import { jsxs as n, jsx as s } from "react/jsx-runtime";
import { forwardRef as f } from "react";
import { cx as u } from "../../utils/classNames.js";
import { useArrowTheme as _ } from "../../hooks/useArrowTheme.js";
const v = (e, r) => `${Math.min(Math.abs(e) / Math.abs(r) * 100, 100).toLocaleString("en", {
  minimumFractionDigits: 0,
  maximumFractionDigits: 1
})}%`, N = (e, r) => `${Math.abs(e)}/${Math.abs(r)}`, b = f(
  ({
    inverse: e,
    label: r,
    currentValue: o = 0,
    maxValue: t = 100,
    variant: i = "regular",
    color: a = "branded",
    format: g = "percentage",
    className: d
  }, l) => {
    const m = _(), p = e ?? m.inverse, c = i === "hero", h = g === "fraction";
    return a === "monochrome" && i === "hero" ? /* @__PURE__ */ n("p", { children: [
      "Progress Ring's ",
      /* @__PURE__ */ s("strong", { children: "Hero" }),
      " variant does not support",
      " ",
      /* @__PURE__ */ s("strong", { children: "Monochrome" }),
      " color."
    ] }) : /* @__PURE__ */ n(
      "div",
      {
        ref: l,
        className: u("tdds-progress-ring", d),
        "data-inverse": p ? "true" : void 0,
        "data-color": a,
        "data-variant": i,
        style: {
          "--current-value": o,
          "--max-value": t
        },
        children: [
          /* @__PURE__ */ n(
            "svg",
            {
              className: "tdds-progress-ring__ring",
              fill: "none",
              xmlns: "http://www.w3.org/2000/svg",
              "aria-hidden": "true",
              focusable: "false",
              children: [
                /* @__PURE__ */ s(
                  "circle",
                  {
                    cx: "50%",
                    cy: "50%",
                    className: "tdds-progress-ring__ring--track",
                    stroke: "currentColor",
                    vectorEffect: "non-scaling-stroke"
                  }
                ),
                /* @__PURE__ */ s(
                  "circle",
                  {
                    cx: "50%",
                    cy: "50%",
                    className: "tdds-progress-ring__ring--progress",
                    stroke: "currentColor",
                    strokeLinecap: "round",
                    vectorEffect: "non-scaling-stroke"
                  }
                )
              ]
            }
          ),
          /* @__PURE__ */ n("div", { className: "tdds-progress-ring__inner", children: [
            /* @__PURE__ */ s("span", { className: "tdds-progress-ring__big-number", children: h ? N(o, t) : v(o, t) }),
            c && r ? /* @__PURE__ */ s("span", { className: "tdds-progress-ring__label", children: r }) : null
          ] }),
          !c && r ? /* @__PURE__ */ s("span", { className: "tdds-progress-ring__label", children: r }) : null
        ]
      }
    );
  }
);
b.displayName = "ProgressRing";
export {
  b as ProgressRing
};
//# sourceMappingURL=ProgressRing.js.map
