function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
var _excluded = ["rate", "type", "strokeWidth", "trailColor", "strokeColor", "width", "name", "unit", "info"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import { Progress } from 'antd';
import useSettings from "../../_hooks/useSettings";
import "./style";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export function Line(props) {
  var _useSettings = useSettings(),
    isDark = _useSettings.isDark;
  var _props$rate = props.rate,
    rate = _props$rate === void 0 ? 0 : _props$rate,
    trailColor = props.trailColor,
    strokeColor = props.strokeColor,
    _props$width = props.width,
    width = _props$width === void 0 ? 120 : _props$width;
  return /*#__PURE__*/_jsx(Progress, {
    percent: rate,
    width: width,
    size: {
      width: width
    },
    strokeColor: strokeColor ? strokeColor : rate > 100 ? {
      from: '#FF5861',
      to: '#FF000E'
    } : isDark ? {
      from: '#139DFF',
      to: '#00FFF6'
    } : '#1677FF',
    trailColor: trailColor ? trailColor : isDark ? 'rgba(255,255,255,0.05)' : 'rgba(0,0,0,0.05)',
    railColor: trailColor ? trailColor : isDark ? 'rgba(255,255,255,0.05)' : 'rgba(0,0,0,0.05)',
    showInfo: false
  });
}
var Circle = function Circle(props) {
  var _useSettings2 = useSettings(),
    isDark = _useSettings2.isDark;
  var _props$rate2 = props.rate,
    rate = _props$rate2 === void 0 ? 0 : _props$rate2,
    _props$type = props.type,
    type = _props$type === void 0 ? 'circle' : _props$type,
    _props$strokeWidth = props.strokeWidth,
    strokeWidth = _props$strokeWidth === void 0 ? 8 : _props$strokeWidth,
    trailColor = props.trailColor,
    strokeColor = props.strokeColor,
    _props$width2 = props.width,
    width = _props$width2 === void 0 ? 120 : _props$width2,
    _props$name = props.name,
    name = _props$name === void 0 ? '有效作业率' : _props$name,
    _props$unit = props.unit,
    unit = _props$unit === void 0 ? '%' : _props$unit,
    info = props.info,
    restProps = _objectWithoutProperties(props, _excluded);
  return /*#__PURE__*/_jsx(Progress, _objectSpread({
    percent: rate,
    type: type,
    width: width,
    size: width,
    strokeWidth: strokeWidth,
    strokeLinecap: "round",
    strokeColor: strokeColor || (isDark ? {
      '0%': '#009DFF',
      '100%': '#44FF98'
    } : '#1677FF'),
    trailColor: trailColor ? trailColor : isDark ? 'rgba(0, 157, 255, 0.68)' : '#e1ecfd',
    railColor: trailColor ? trailColor : isDark ? 'rgba(0, 157, 255, 0.68)' : '#e1ecfd',
    format: function format(percent) {
      return /*#__PURE__*/_jsxs("div", {
        className: "vm-progress-text ".concat(isDark ? 'dark' : ''),
        children: [info !== null && info !== void 0 ? info : percent, /*#__PURE__*/_jsx("span", {
          children: unit
        }), /*#__PURE__*/_jsx("div", {
          className: "vm-progress-text-name",
          children: name
        })]
      });
    }
  }, restProps));
};
export default {
  Line: Line,
  Circle: Circle
};