/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
import _extends from "@babel/runtime/helpers/extends";
import "./index.compiled.css";
import { ax, ix } from "@compiled/react/runtime";
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { cx } from '@atlaskit/css';
import { Box, Pressable } from '@atlaskit/primitives/compiled';
import { InternalActionName } from '../../../../../constants';
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
var styles = {
  button: "_1e0c1bgi",
  padding: "_18zrutpp",
  message: "_1rjcze3t _18zrze3t"
};
var UnresolvedAction = function UnresolvedAction(_ref) {
  var _context$actions;
  var _ref$testId = _ref.testId,
    testId = _ref$testId === void 0 ? 'unresolved-action' : _ref$testId,
    _ref$hasPadding = _ref.hasPadding,
    hasPadding = _ref$hasPadding === void 0 ? false : _ref$hasPadding;
  var context = useFlexibleUiContext();
  var data = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[InternalActionName.UnresolvedAction];
  if (!data) {
    return null;
  }
  var descriptor = data.descriptor,
    onClick = data.onClick,
    values = data.values;
  var hasAction = onClick !== undefined;
  var message = /*#__PURE__*/React.createElement(Box, {
    testId: "".concat(testId, "-errored-view-message"),
    tabIndex: hasAction ? 0 : undefined,
    xcss: cx(styles.message, hasPadding && styles.padding)
  }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, descriptor, {
    values: values
  })));
  return hasAction ? /*#__PURE__*/React.createElement(Pressable, {
    onClick: data.onClick,
    style: {
      color: "inherit",
      font: "inherit",
      textAlign: "inherit"
    },
    xcss: styles.button
  }, message) : message;
};
export default UnresolvedAction;