"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.transProgress = exports.getOptions = exports.getOSetting = exports.getKrSetting = exports.getKrOptions = void 0;

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

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

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 getOSetting = function getOSetting() {
  return {
    settingTitle: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Setmatically"),
    switchLabel: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Setmatically"),
    options: [{
      label: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Autup"),
      key: 1,
      tooltip: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_KRCompletion")
    }, {
      label: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Autcom"),
      key: 2,
      tooltip: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_SubO")
    }],
    getRecommandText: function getRecommandText() {
      var autoUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      var updateWay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
      var recommandProgressObj = arguments.length > 2 ? arguments[2] : undefined;

      if (autoUpdate) {
        if (updateWay == 1) return /*#__PURE__*/_react["default"].createElement("span", {
          className: "auto-update__recommand-tip"
        }, (0, _getLocale.getLocale)('OKR_MyO_Pop_Upd_Automatic'));
        if (updateWay == 2) return /*#__PURE__*/_react["default"].createElement("span", {
          className: "auto-update__recommand-tip"
        }, (0, _getLocale.getLocale)('OKR_MyO_calculationSubO'));
      } else {
        var childOkrProgress = recommandProgressObj.childOkrProgress,
            childkrProgress = recommandProgressObj.childkrProgress;
        var textArr = [];
        childkrProgress !== -1 && textArr.push("KR\u5B8C\u6210\u5EA6".concat(childkrProgress, "%"));
        childOkrProgress !== -1 && textArr.push("".concat((0, _getLocale.getLocale)('OKR_MyO_Ew_SubobjCom')).concat(childOkrProgress, "%"));
        if (textArr.length == 0) return '';
        return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
          className: "auto-update__recommand-icon"
        }, (0, _getLocale.getLocale)('Per_Ass_Pop_title_Recommend')), /*#__PURE__*/_react["default"].createElement("span", {
          className: "auto-update__recommand-tip"
        }, "\uFF08", textArr.join('，'), "\uFF09"));
      }
    }
  };
};

exports.getOSetting = getOSetting;

var getKrSetting = function getKrSetting() {
  return {
    settingTitle: (0, _getLocale.getLocale)("OKR_MyO_KRCompletion"),
    switchLabel: (0, _getLocale.getLocale)("OKR_MyO_SetKRcompletion"),
    options: [{
      label: (0, _getLocale.getLocale)("OKR_MyO_Updatetask"),
      key: 1,
      tooltip: (0, _getLocale.getLocale)("OKR_MyO_AeKRcompletionde")
    }, {
      label: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Autcom"),
      key: 2,
      tooltip: (0, _getLocale.getLocale)("OKR_MyO_KRcompletionde")
    }],
    getRecommandText: function getRecommandText(recommandProgressObj) {
      var autoUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
      var updateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;

      if (autoUpdate) {
        if (updateWay === 1) return /*#__PURE__*/_react["default"].createElement("span", {
          className: "auto-update__recommand-tip"
        }, (0, _getLocale.getLocale)("OKR_MyO_Automatic"));
        if (updateWay === 2) return /*#__PURE__*/_react["default"].createElement("span", {
          className: "auto-update__recommand-tip"
        }, (0, _getLocale.getLocale)("OKR_MyO_calculationSubO"));
        return /*#__PURE__*/_react["default"].createElement("span", null);
      }

      var childOkrProgress = recommandProgressObj.childOkrProgress,
          childEProgress = recommandProgressObj.childEProgress;
      var textArr = [];

      if (childEProgress !== -1) {
        textArr.push("".concat((0, _getLocale.getLocale)("OKR_MyO_Ecompletion")).concat(childEProgress).concat((0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Percentage")));
      }

      if (childOkrProgress !== -1) {
        textArr.push("".concat((0, _getLocale.getLocale)("OKR_MyO_Ew_SubobjCom")).concat(childOkrProgress).concat((0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Percentage")));
      }

      if (textArr.length === 0) return "";
      return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
        className: "auto-update__recommand-icon"
      }, (0, _getLocale.getLocale)("Per_Ass_Pop_title_Recommend")), /*#__PURE__*/_react["default"].createElement("span", {
        className: "auto-update__recommand-tip",
        style: {
          marginLeft: 0
        }
      }, "(", textArr.join("，"), ")"));
    }
  };
};

exports.getKrSetting = getKrSetting;

var transProgress = function transProgress(progress) {
  return progress === -1 ? 0 : progress;
};

exports.transProgress = transProgress;

var getKrOptions = function getKrOptions() {
  return [{
    id: 1,
    color: "#2879ff",
    text: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Notrack")
  }, {
    id: 2,
    color: "#F6BD16",
    text: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Atrisk")
  }, {
    id: 3,
    color: "#F05E5E",
    text: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Postoned")
  }];
};

exports.getKrOptions = getKrOptions;

var getOptions = function getOptions() {
  return [{
    id: 6,
    color: "#2879ff",
    text: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Notrack")
  }, {
    id: 2,
    color: "#F6BD16",
    text: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Atrisk")
  }, {
    id: 3,
    color: "#F05E5E",
    text: (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Postoned")
  }];
};

exports.getOptions = getOptions;