"use strict";

exports.__esModule = true;
exports.setScroll = exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _lottieWrapper = _interopRequireDefault(require("../../atom/lottie-wrapper"));
var _buttonLink = _interopRequireDefault(require("../../atom/button-link"));
var _reviewCardCongrats = _interopRequireDefault(require("../../molecule/review-card-congrats"));
var _style = _interopRequireDefault(require("./style.css"));
var _propTypes = _interopRequireDefault(require("./prop-types"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
const setScroll = container => () => {
  container.current?.scrollTo && container.current.scrollTo({
    left: 1000,
    behavior: 'smooth'
  });
};
exports.setScroll = setScroll;
const ReviewCongrats = props => {
  const {
    'aria-label': ariaLabel,
    'data-name': dataName,
    animationLottie,
    title,
    cardCongratsStar,
    cardCongratsRank,
    buttonRevising,
    buttonRevisingSkill
  } = props;
  const container = (0, _react.useRef)(null);
  (0, _react.useEffect)(() => {
    const timer = setTimeout(setScroll(container), 2000);
    return () => timer && clearTimeout(timer);
  }, []);
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.mainContainer,
    "aria-label": ariaLabel,
    "data-name": dataName,
    "data-testid": "congrats"
  }, /*#__PURE__*/_react.default.createElement(_lottieWrapper.default
  /** confetti animation */, _extends({}, animationLottie, {
    loop: false,
    animationControl: 'play',
    autoplay: true,
    "data-name": "lottie-wrapper",
    className: _style.default.lottie,
    backupImageClassName: _style.default.ie11Backup
  })), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.containerCongrats
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.title
  }, title), /*#__PURE__*/_react.default.createElement("div", {
    ref: container,
    className: _style.default.containerCards
  }, cardCongratsRank ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reviewCardCongrats.default, _extends({}, cardCongratsStar, {
    className: _style.default.cardStar
  })), /*#__PURE__*/_react.default.createElement(_reviewCardCongrats.default, _extends({}, cardCongratsRank, {
    timerAnimation: 1800,
    className: _style.default.cardRank
  }))) : /*#__PURE__*/_react.default.createElement(_reviewCardCongrats.default, _extends({}, cardCongratsStar, {
    className: _style.default.cardStarNoRank
  }))), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.buttonContainer
  }, buttonRevising ? /*#__PURE__*/_react.default.createElement(_buttonLink.default, _extends({}, buttonRevising, {
    className: _style.default.buttonRevise,
    "data-testid": "revise-skill-link"
  })) : null, buttonRevisingSkill ? /*#__PURE__*/_react.default.createElement(_buttonLink.default, _extends({}, buttonRevisingSkill, {
    className: _style.default.buttonRevise,
    "data-testid": "revise-another-skill-link"
  })) : null)));
};
ReviewCongrats.propTypes = process.env.NODE_ENV !== "production" ? _propTypes.default : {};
var _default = exports.default = ReviewCongrats;
//# sourceMappingURL=index.js.map