/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["testId", "onActionClick", "hideProvider"];
import "./index.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { useMemo } from 'react';
import { fg } from '@atlaskit/platform-feature-flags';
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
import { ActionName } from '../../../../../constants';
import { useFlexibleCardContext } from '../../../../../state/flexible-ui-context';
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
import * as Actions from '../../actions';
import { Provider } from '../../elements';
import Block from '../block';
/**
 * Allowed footer actions for HoverCard, in display order. Fetched from context.
 * @featureGate platform_sl_3p_auth_rovo_action_kill_switch
 */
var HIDDEN_HOVER_CARD_FOOTER_ACTIONS = [ActionName.RovoChatAction];
var ignoreContainerMarginStyles = null;
var inlineActionNudgeFooterMarginStyles = null;
var elevatedFooterStyles = null;
var providerStyles = null;
var actionsStyles = null;

/**
 * Footer block for HoverCard resolved view: Provider on the left, ActionGroup (up to 4 actions) on the right.
 * @internal
 * @param {ResolvedHoverCardFooterBlockProps} ResolvedHoverCardFooterBlockProps
 * @see Block
 */
var ResolvedHoverCardFooterBlock = function ResolvedHoverCardFooterBlock(_ref) {
  var _props$size, _cardContext$ui;
  var _ref$testId = _ref.testId,
    testId = _ref$testId === void 0 ? 'smart-hover-card-footer-block' : _ref$testId,
    onActionClick = _ref.onActionClick,
    hideProvider = _ref.hideProvider,
    props = _objectWithoutProperties(_ref, _excluded);
  var cardContext = useFlexibleCardContext();
  var context = useFlexibleUiContext();
  var size = (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : cardContext === null || cardContext === void 0 || (_cardContext$ui = cardContext.ui) === null || _cardContext$ui === void 0 ? void 0 : _cardContext$ui.size;
  var actions = useMemo(function () {
    if (!(context !== null && context !== void 0 && context.actions)) {
      return [];
    }
    var arr = Object.keys(context.actions);
    arr = arr.filter(function (name) {
      return !HIDDEN_HOVER_CARD_FOOTER_ACTIONS.includes(name);
    });
    return arr.map(function (name) {
      var Action = name in Actions ? Actions[name] : undefined;
      return Action ? /*#__PURE__*/React.createElement(Action, {
        key: name,
        as: "stack-item",
        content: "",
        onClick: function onClick() {
          return onActionClick === null || onActionClick === void 0 ? void 0 : onActionClick(name);
        },
        size: size,
        iconSize: 'small'
      }) : null;
    });
  }, [context === null || context === void 0 ? void 0 : context.actions, onActionClick, size]);
  return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
    size: size,
    testId: "".concat(testId, "-resolved-view"),
    className: ax(["_18zrpxbi _1rjcutpp _vchhusvi _1bsb129b _18u01ivi _2hwxc10g _otyr1ya9 _4t3ioahv", "_zulpu2gc _x3doj0fz _bfhkhfxm _mrkb1mok _1o0z1mok", fg('rovogrowth-640-inline-action-nudge-fg') && expValEqualsNoExposure('rovogrowth-640-inline-action-nudge-exp', 'isEnabled', true) && "_19pkutpp"])
  }), !hideProvider && /*#__PURE__*/React.createElement("div", {
    className: ax(["_4t3i1ejb _1e0c1txw _4cvr1h6o _1bah1y6m _vchhusvi _16jlkb7n"])
  }, /*#__PURE__*/React.createElement(Provider, {
    appearance: "subtle",
    testId: "".concat(testId, "-provider")
  })), actions.length > 0 ? /*#__PURE__*/React.createElement("div", {
    "data-testid": "".concat(testId, "-actions"),
    className: ax(["_zulpidpf _1e0c1txw _18u01wug _4cvr1h6o _vchhusvi _7386ze3t _1xdd12b0 _17zize3t _19p4ze3t _6zimze3t _f9lhze3t _rvy9ze3t _ue4dze3t _zgrbze3t _10cuze3t _6syfze3t _3hv7ze3t"])
  }, actions) : null);
};
export default ResolvedHoverCardFooterBlock;