"use strict";

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

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

var _classnames = _interopRequireDefault(require("classnames"));

var _CircleProgress = _interopRequireDefault(require("../../../components-v1/progress/CircleProgress"));

var _openData = require("../../../utils/open-data");

var _creator = _interopRequireDefault(require("./fields/creator"));

var _precls = _interopRequireDefault(require("../precls"));

var _config = require("../utils/config");

var _helper = require("./helper");

require("./index.css");

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

function KrNode(_ref) {
  var data = _ref.data;
  var mileStoneId = data.mileStoneId,
      _data$mileStoneName = data.mileStoneName,
      mileStoneName = _data$mileStoneName === void 0 ? "" : _data$mileStoneName,
      _data$user = data.user,
      user = _data$user === void 0 ? {} : _data$user,
      riskLevel = data.riskLevel,
      progress = data.progress,
      modelType = data.modelType,
      mapkrVisible = data.mapkrVisible,
      _data$SortNum = data.SortNum,
      SortNum = _data$SortNum === void 0 ? 0 : _data$SortNum,
      krWeight = data.krWeight; // const riskLevelSuffix = ['normal', 'progress', 'risk', 'dangerous'];

  if (!mapkrVisible) return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "--node"), "".concat(_precls["default"], "--node__private"))
  });
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "--node"), "".concat(_precls["default"], "--node__kr"))
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "--node__kr-title"))
  }, /*#__PURE__*/_react["default"].createElement("span", {
    style: {
      color: "#5AD8A6",
      marginRight: 8
    }
  }, "KR", SortNum + 1), (0, _openData.parseString)(mileStoneName)), /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "--node-desp"))
  }, /*#__PURE__*/_react["default"].createElement(_creator["default"], {
    creator: user || {}
  }), _config.KrWeightSetting && /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "--node-weight"))
  }, krWeight, "%"), /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "--node-progress"))
  }, /*#__PURE__*/_react["default"].createElement(_CircleProgress["default"], {
    linear: true,
    linearId: mileStoneId,
    linearStartColor: (0, _helper.getProcessColor)(riskLevel, "linearStartColor"),
    linearEndColor: (0, _helper.getProcessColor)(riskLevel, "linearEndColor"),
    backgroundColor: (0, _helper.getProcessColor)(riskLevel, "backgroundColor"),
    percent: progress,
    showTextContent: false,
    size: 18,
    width: 3
  }), /*#__PURE__*/_react["default"].createElement("span", null, progress, "%"))));
}

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