/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
require("./index.compiled.css");
var _react = _interopRequireWildcard(require("react"));
var React = _react;
var _runtime = require("@compiled/react/runtime");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _constants = require("../../../../../constants");
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
var Actions = _interopRequireWildcard(require("../../actions"));
var _elements = require("../../elements");
var _block = _interopRequireDefault(require("../block"));
var _excluded = ["testId", "onActionClick", "hideProvider"];
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
/**
 * Allowed footer actions for HoverCard, in display order. Fetched from context.
 */
var HIDDEN_HOVER_CARD_FOOTER_ACTIONS = [_constants.ActionName.RovoChatAction];
var ignoreContainerMarginStyles = 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 = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var cardContext = (0, _flexibleUiContext.useFlexibleCardContext)();
  var context = (0, _flexibleUiContext.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 = (0, _react.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;

      // Note: For the spinner to render properly, e.g. AI summary action,
      // the spinner need to be updated. See FIX-ME comment on ActionButton
      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.default, (0, _extends2.default)({}, props, {
    size: size,
    testId: "".concat(testId, "-resolved-view"),
    className: (0, _runtime.ax)(["_18zrpxbi _1rjcutpp _vchhusvi _1bsb129b _18u01ivi _2hwxc10g _otyr1ya9 _4t3ioahv", "_zulpu2gc _x3doj0fz _bfhkhfxm _mrkb1mok _1o0z1mok"])
  }), !hideProvider && /*#__PURE__*/React.createElement("div", {
    className: (0, _runtime.ax)(["_4t3i1ejb _1e0c1txw _4cvr1h6o _1bah1y6m _vchhusvi _16jlkb7n"])
  }, /*#__PURE__*/React.createElement(_elements.Provider, {
    appearance: "subtle",
    testId: "".concat(testId, "-provider")
  })), actions.length > 0 ? /*#__PURE__*/React.createElement("div", {
    "data-testid": "".concat(testId, "-actions"),
    className: (0, _runtime.ax)(["_zulpidpf _1e0c1txw _18u01wug _4cvr1h6o _vchhusvi _7386ze3t _1xdd12b0 _17zize3t _19p4ze3t _6zimze3t _f9lhze3t _rvy9ze3t _ue4dze3t _zgrbze3t _10cuze3t _6syfze3t _3hv7ze3t"])
  }, actions) : null);
};
var _default = exports.default = ResolvedHoverCardFooterBlock;