"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _progress = _interopRequireDefault(require("@alifd/next/lib/progress"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _icon = _interopRequireDefault(require("@alifd/next/lib/icon"));
var _box = _interopRequireDefault(require("@alifd/next/lib/box"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var React = _interopRequireWildcard(require("react"));
require("./index.scss");
var _excluded = ["percent", "shape", "size", "state", "progressive", "style", "backgroundColor", "color", "hasBorder", "content", "isContent", "isIcon", "iconSize", "iconColor", "fontSize"];
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 progress = function progress(_ref) {
  var percent = _ref.percent,
    shape = _ref.shape,
    size = _ref.size,
    state = _ref.state,
    progressive = _ref.progressive,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    backgroundColor = _ref.backgroundColor,
    color = _ref.color,
    hasBorder = _ref.hasBorder,
    content = _ref.content,
    isContent = _ref.isContent,
    isIcon = _ref.isIcon,
    iconSize = _ref.iconSize,
    iconColor = _ref.iconColor,
    fontSize = _ref.fontSize,
    otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
  //  if(state){
  //      // eslint-disable-next-line no-alert
  //     alert(state)
  //  }

  var _style = style || {};
  var _otherProps = otherProps || {};
  _otherProps.style = _style;
  var textRender = function textRender(percent) {
    return isContent ? /*#__PURE__*/React.createElement(_box["default"], null, isIcon !== 'icon' ? /*#__PURE__*/React.createElement(_box["default"], null, percent, "%") : percent !== 100 ? null : /*#__PURE__*/React.createElement(_icon["default"], {
      type: "select",
      className: "boxIcon",
      style: {
        fontSize: iconSize + "px",
        color: "" + iconColor
      }
    }), /*#__PURE__*/React.createElement(_box["default"], {
      style: {
        fontSize: fontSize + "px",
        marginTop: '2px'
      }
    }, content)) : null;
  };
  return /*#__PURE__*/React.createElement(_progress["default"], (0, _extends2["default"])({
    percent: percent,
    shape: shape,
    size: size,
    state: state,
    progressive: progressive,
    backgroundColor: backgroundColor,
    color: color,
    hasBorder: hasBorder,
    textRender: textRender
  }, _otherProps));
};
progress.displayName = 'Progress';
var _default = progress;
exports["default"] = _default;