"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getErrorMessage = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _reactIntl = require("react-intl");
var _aiSummary = require("../../../../../utils/ai-summary");
var _aiEventErrorViewed = _interopRequireDefault(require("../../common/ai-summary/ai-event-error-viewed"));
var _aiLearnMoreAnchor = _interopRequireDefault(require("../../common/ai-summary/ai-learn-more-anchor"));
var getErrorMessage = exports.getErrorMessage = function getErrorMessage(error) {
  var _getAISummaryErrorMes = (0, _aiSummary.getAISummaryErrorMessage)(error),
    message = _getAISummaryErrorMes.message,
    url = _getAISummaryErrorMes.url;
  return {
    appearance: 'error',
    title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_aiEventErrorViewed.default, {
      reason: error
    }), /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, (0, _extends2.default)({}, message, {
      values: {
        a: function a(chunks) {
          return /*#__PURE__*/_react.default.createElement(_aiLearnMoreAnchor.default, {
            href: url
          }, chunks);
        }
      }
    })))
  };
};