"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.EOkrCreateSuggestResultType = void 0;

var _react = _interopRequireWildcard(require("react"));

var _lottieWeb = _interopRequireDefault(require("lottie-web"));

var _example = _interopRequireDefault(require("../img/example.svg"));

var _packUp = _interopRequireDefault(require("../img/pack-up"));

var _leftQuotation = _interopRequireDefault(require("../img/left-quotation.svg"));

var _rightQuotation = _interopRequireDefault(require("../img/right-quotation.svg"));

var _checkRight = _interopRequireDefault(require("../img/check-right.svg"));

var _checkWrong = _interopRequireDefault(require("../img/check-wrong.svg"));

var _checkNormal = _interopRequireDefault(require("../img/check-normal.svg"));

var _checkAnimation = _interopRequireDefault(require("../animation/check-animation"));

var _wave = _interopRequireDefault(require("../img/wave.png"));

var _getLocale = require("../../../utils/getLocale");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var EOkrCreateSuggestResultType;
exports.EOkrCreateSuggestResultType = EOkrCreateSuggestResultType;

(function (EOkrCreateSuggestResultType) {
  EOkrCreateSuggestResultType["normal"] = "normal";
  EOkrCreateSuggestResultType["wrong"] = "wrong";
  EOkrCreateSuggestResultType["correct"] = "correct";
})(EOkrCreateSuggestResultType || (exports.EOkrCreateSuggestResultType = EOkrCreateSuggestResultType = {}));

var OkrCreateSuggest = function OkrCreateSuggest(_ref) {
  var descs = _ref.descs,
      example = _ref.example,
      results = _ref.results,
      handleClose = _ref.handleClose,
      isOSuggest = _ref.isOSuggest,
      isInput = _ref.isInput;
  var handleCloseCheck = (0, _react.useCallback)(function () {
    handleClose && handleClose();
  }, [handleClose]);
  var animationRef = (0, _react.useRef)(document.createElement("div"));
  var renderCheckIcon = (0, _react.useCallback)(function (result) {
    switch (result) {
      case "wrong":
        return /*#__PURE__*/_react["default"].createElement("img", {
          className: "okr-create-suggest__check-item-icon",
          src: _checkWrong["default"]
        });

      case "correct":
        return /*#__PURE__*/_react["default"].createElement("img", {
          className: "okr-create-suggest__check-item-icon",
          src: _checkRight["default"]
        });

      default:
        return /*#__PURE__*/_react["default"].createElement("img", {
          className: "okr-create-suggest__check-item-icon",
          src: _checkNormal["default"]
        });
    }
  }, []);
  (0, _react.useEffect)(function () {
    _lottieWeb["default"].loadAnimation({
      container: animationRef.current,
      // 容器节点
      renderer: "svg",
      loop: true,
      autoplay: true,
      animationData: _checkAnimation["default"] // JSON数据

    });
  }, []);
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-create-suggest"
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: "okr-create-suggest__triangle ".concat(isOSuggest ? "" : "okr-create-suggest__triangle--iskr")
  }), /*#__PURE__*/_react["default"].createElement("img", {
    src: _leftQuotation["default"]
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-create-suggest__descs"
  }, descs.map(function (desc, key) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "okr-create-suggest__desc",
      key: key
    }, desc);
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-create-suggest__right-quotation"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: _rightQuotation["default"]
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-create-suggest__block"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-create-suggest__block-title"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    className: "okr-create-suggest__block-title-icon",
    src: _example["default"]
  }), (0, _getLocale.getLocale)("Per_Ass_New_form_push_Example")), example.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "okr-create-suggest__example",
      key: index
    }, item);
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-create-suggest__animation-wrapper"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    ref: animationRef,
    className: isInput ? "okr-create-suggest__animation-wave" : "okr-create-suggest__animation-wave--hidden"
  }), isInput ? null : /*#__PURE__*/_react["default"].createElement("img", {
    className: "okr-create-suggest__animation-wave--static",
    src: _wave["default"]
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-create-suggest__animation-text"
  }, isInput ? (0, _getLocale.getLocale)("OKR_MyO_Pop_Intelligent") : "".concat(isOSuggest ? (0, _getLocale.getLocale)("OKR_MyO_Pop_PendingO") : (0, _getLocale.getLocale)("OKR_MyO_Pop_PendingKR")))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-create-suggest__block"
  }, results.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "okr-create-suggest__check-item",
      key: index
    }, renderCheckIcon(item.result), item.text);
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-create-suggest__pack-up",
    onClick: handleCloseCheck
  }, /*#__PURE__*/_react["default"].createElement(_packUp["default"], {
    color: "currentColor"
  }), " ", /*#__PURE__*/_react["default"].createElement("span", {
    className: "okr-create-suggest__pack-up-text"
  }, (0, _getLocale.getLocale)("Mod_Fold"))));
};

var _default = OkrCreateSuggest;
exports["default"] = _default;