"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
var _constants = require("../../../../../../constants");
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
var _actionButton = _interopRequireDefault(require("./action-button"));
var _excluded = ["content", "tooltipMessage", "tooltipOnHide", "hideTooltipOnMouseDown", "hideTooltip"];
var ActionStackItem = function ActionStackItem(_ref) {
  var _flexibleUiContext$ac;
  var content = _ref.content,
    tooltipMessage = _ref.tooltipMessage,
    tooltipOnHide = _ref.tooltipOnHide,
    hideTooltipOnMouseDown = _ref.hideTooltipOnMouseDown,
    hideTooltip = _ref.hideTooltip,
    props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var flexibleUiContext = (0, _flexibleUiContext.useFlexibleUiContext)();
  var isRovoAction = !!(flexibleUiContext !== null && flexibleUiContext !== void 0 && (_flexibleUiContext$ac = flexibleUiContext.actions) !== null && _flexibleUiContext$ac !== void 0 && _flexibleUiContext$ac[_constants.ActionName.RovoChatAction]);
  var isRovoPillVariant = isRovoAction && (0, _platformFeatureFlags.fg)('rovogrowth-640-inline-action-nudge-fg') && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('rovogrowth-640-inline-action-nudge-exp', 'isEnabled', true);
  return hideTooltip ? /*#__PURE__*/_react.default.createElement(_actionButton.default, (0, _extends2.default)({}, props, {
    content: content
  })) : /*#__PURE__*/_react.default.createElement(_tooltip.default, {
    content: tooltipMessage || content,
    onHide: tooltipOnHide,
    hideTooltipOnMouseDown: hideTooltipOnMouseDown,
    position: isRovoPillVariant ? 'right' : undefined
  }, function (tooltipProps) {
    return /*#__PURE__*/_react.default.createElement(_actionButton.default, (0, _extends2.default)({}, props, {
      content: content,
      tooltipProps: tooltipProps
    }));
  });
};
var _default = exports.default = ActionStackItem;