"use strict";
const React = require("react");
const classNames = require("../_util/classNames.js");
const index = require("../ConfigProvider/index.js");
const lineProgess = require("./line-progess.js");
const circleProgress = require("./circle-progress.js");
const stepsProgress = require("./steps-progress.js");
const useMergeProps = require("../_util/hooks/useMergeProps.js");
const omit = require("../_util/omit.js");
const emotionReactJsxRuntime_browser_esm = require("../../../../../../@emotion_react@11.10.4_3toe27fv7etiytxb5kxc7fxaw4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");
var __assign = globalThis && globalThis.__assign || function() {
  __assign = Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];
      for (var p in s)
        if (Object.prototype.hasOwnProperty.call(s, p))
          t[p] = s[p];
    }
    return t;
  };
  return __assign.apply(this, arguments);
};
var __rest = globalThis && globalThis.__rest || function(s, e) {
  var t = {};
  for (var p in s)
    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
      t[p] = s[p];
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
      if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
        t[p[i]] = s[p[i]];
    }
  return t;
};
var defaultProps = {
  type: "line",
  showText: true,
  percent: 0,
  size: "default"
};
function Progress(baseProps, ref) {
  var _a;
  var _b = React.useContext(index.ConfigContext), getPrefixCls = _b.getPrefixCls, componentConfig = _b.componentConfig, rtl = _b.rtl;
  var props = useMergeProps(baseProps, defaultProps, componentConfig === null || componentConfig === void 0 ? void 0 : componentConfig.Progress);
  var className = props.className, style = props.style, size = props.size, width = props.width, strokeWidth = props.strokeWidth, steps = props.steps, percent = props.percent, rest = __rest(props, ["className", "style", "size", "width", "strokeWidth", "steps", "percent"]);
  var type = steps && props.type !== "circle" ? "steps" : props.type;
  var prefixCls = getPrefixCls("progress");
  var status = "status" in props ? props.status : percent >= 100 ? "success" : "normal";
  var widthStyle = {
    width
  };
  if (size === "mini" && type === "line") {
    widthStyle.width = width || 16;
    widthStyle.height = width || 16;
  }
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
    ...__assign({
      ref,
      className: classNames(prefixCls, prefixCls + "-" + type, prefixCls + "-" + size, (_a = {}, _a[prefixCls + "-is-" + status] = status !== "normal", _a[prefixCls + "-rtl"] = rtl, _a), className),
      style: __assign(__assign({}, widthStyle), style)
    }, omit(rest, ["type", "animation", "status", "color", "trailColor", "showText", "formatText", "buffer", "bufferColor"])),
    children: [type === "steps" && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(stepsProgress.default, {
      ...__assign({}, props, {
        type,
        status,
        prefixCls
      })
    }), type === "circle" && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(circleProgress, {
      ...__assign({
        width: props.width
      }, props, {
        pathStrokeColor: props.trailColor,
        status,
        prefixCls
      })
    }), type === "line" && (size === "mini" ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(circleProgress, {
      ...__assign({
        pathStrokeColor: props.trailColor
      }, props, {
        pathStrokeWidth: strokeWidth || 4,
        width: width || 16,
        strokeWidth: strokeWidth || 4,
        prefixCls,
        status
      })
    }) : /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(lineProgess, {
      ...__assign({}, props, {
        status,
        prefixCls
      })
    }))]
  });
}
var ProgressRef = React.forwardRef(Progress);
ProgressRef.displayName = "Progress";
const Progress$1 = ProgressRef;
module.exports = Progress$1;
//# sourceMappingURL=index.js.map
