"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.extractFlexibleCardActions = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _constants = require("../../../constants");
var _extractAiSummaryAction = require("./extract-ai-summary-action");
var _extractAutomationAction = require("./extract-automation-action");
var _extractCopyLinkAction = require("./extract-copy-link-action");
var _extractDownloadAction = require("./extract-download-action");
var _extractFollowAction = _interopRequireDefault(require("./extract-follow-action"));
var _extractPreviewAction = require("./extract-preview-action");
var _extractViewRelatedLinksAction = require("./extract-view-related-links-action");
var extractFlexibleCardActions = exports.extractFlexibleCardActions = function extractFlexibleCardActions(_ref) {
  var actionOptions = _ref.actionOptions,
    aiSummaryConfig = _ref.aiSummaryConfig,
    appearance = _ref.appearance,
    fireEvent = _ref.fireEvent,
    id = _ref.id,
    origin = _ref.origin,
    response = _ref.response,
    url = _ref.url,
    isPreviewPanelAvailable = _ref.isPreviewPanelAvailable,
    openPreviewPanel = _ref.openPreviewPanel;
  var action = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.ActionName.CopyLinkAction, (0, _extractCopyLinkAction.extractCopyLinkClientAction)({
    actionOptions: actionOptions,
    appearance: appearance,
    id: id,
    response: response
  })), _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadClientAction)({
    actionOptions: actionOptions,
    appearance: appearance,
    id: id,
    response: response
  })), _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewClientAction)({
    actionOptions: actionOptions,
    appearance: appearance,
    fireEvent: fireEvent,
    id: id,
    origin: origin,
    response: response,
    isPreviewPanelAvailable: isPreviewPanelAvailable,
    openPreviewPanel: openPreviewPanel
  })), _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), _constants.InternalActionName.ViewRelatedLinksAction, (0, _extractViewRelatedLinksAction.extractViewRelatedLinksAction)(response));
  return Object.values(action).some(function (value) {
    return Boolean(value);
  }) ? action : undefined;
};