/* index.tsx generated by @compiled/babel-plugin v0.38.1 */
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["actionGroup", "metadata", "position", "subtitle", "testId", "text", "icon", "title", "metadataPosition", "hideIcon", "CompetitorPrompt", "url", "hideIconLoadingSkeleton"];
import "./index.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { Box } from '@atlaskit/primitives/compiled';
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkWidth } from '../../../../../../constants';
import { LinkIcon } from '../../../elements';
import Block from '../../block';
import ElementGroup from '../../element-group';
import { renderElementItems } from '../../utils';
var style = null;
var styles = {
  titleBox: "_1e0c1txw _2lx2vrvc _4cvr1h6o _1bsb1osq"
};

/**
 * This renders a fully resolved TitleBlock.
 * This should render when a Smart Link returns a valid response.
 * @see TitleBlock
 */
var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
  var actionGroup = _ref.actionGroup,
    _ref$metadata = _ref.metadata,
    metadata = _ref$metadata === void 0 ? [] : _ref$metadata,
    position = _ref.position,
    _ref$subtitle = _ref.subtitle,
    subtitle = _ref$subtitle === void 0 ? [] : _ref$subtitle,
    testId = _ref.testId,
    _text = _ref.text,
    icon = _ref.icon,
    title = _ref.title,
    metadataPosition = _ref.metadataPosition,
    hideIcon = _ref.hideIcon,
    CompetitorPrompt = _ref.CompetitorPrompt,
    url = _ref.url,
    hideIconLoadingSkeleton = _ref.hideIconLoadingSkeleton,
    blockProps = _objectWithoutProperties(_ref, _excluded);
  var size = blockProps.size;
  var metadataElements = renderElementItems(metadata);
  var subtitleElements = renderElementItems(subtitle);
  return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
    testId: "".concat(testId, "-resolved-view")
  }), !hideIcon && /*#__PURE__*/React.createElement(LinkIcon, {
    overrideIcon: icon,
    position: position,
    size: size,
    hideLoadingSkeleton: hideIconLoadingSkeleton
  }), /*#__PURE__*/React.createElement(ElementGroup, {
    direction: SmartLinkDirection.Vertical,
    width: SmartLinkWidth.Flexible,
    size: blockProps.size,
    className: ax(["_zulp1b66"])
  }, CompetitorPrompt && url ? /*#__PURE__*/React.createElement(Box, {
    xcss: styles.titleBox
  }, title, /*#__PURE__*/React.createElement(CompetitorPrompt, {
    sourceUrl: url,
    linkType: 'card'
  })) : title, subtitleElements && /*#__PURE__*/React.createElement(ElementGroup, {
    direction: SmartLinkDirection.Horizontal
  }, subtitleElements)), metadataElements && /*#__PURE__*/React.createElement(ElementGroup, {
    direction: SmartLinkDirection.Horizontal,
    align: SmartLinkAlignment.Right,
    position: metadataPosition !== null && metadataPosition !== void 0 ? metadataPosition : SmartLinkPosition.Center,
    size: blockProps.size
  }, metadataElements), actionGroup);
};
export default TitleBlockResolvedView;