import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["href", "children", "testId", "isLinkComponent"];
import React from 'react';
import AKLink from '@atlaskit/link';
import { withLinkClickedEvent } from '../../../utils/analytics/click';
var Anchor = withLinkClickedEvent('a');
export var LinkComponent = withLinkClickedEvent(AKLink);
var Hyperlink = function Hyperlink(_ref) {
  var href = _ref.href,
    children = _ref.children,
    testId = _ref.testId,
    _ref$isLinkComponent = _ref.isLinkComponent,
    isLinkComponent = _ref$isLinkComponent === void 0 ? false : _ref$isLinkComponent,
    props = _objectWithoutProperties(_ref, _excluded);
  var Link = isLinkComponent ? LinkComponent : Anchor;
  return /*#__PURE__*/React.createElement(Link, _extends({}, isLinkComponent ? {
    testId: testId
  } : {
    'data-testid': testId
  }, {
    href: href || ''
  }, props), children);
};
export default Hyperlink;