/* index.tsx generated by @compiled/babel-plugin v0.38.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-next';
import { cx } from '@atlaskit/css';
import { Box, Pressable } from '@atlaskit/primitives/compiled';
import { InternalActionName } from '../../../../../constants';
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
const styles = {
  button: "_1e0c1bgi",
  padding: "_18zrutpp",
  message: "_1rjcze3t _18zrze3t"
};
const UnresolvedAction = ({
  testId = 'unresolved-action',
  hasPadding = false
}) => {
  var _context$actions;
  const context = useFlexibleUiContext();
  const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[InternalActionName.UnresolvedAction];
  if (!data) {
    return null;
  }
  const {
    descriptor,
    onClick,
    values
  } = data;
  const hasAction = onClick !== undefined;
  const message = /*#__PURE__*/React.createElement(Box, {
    testId: `${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;