import { jsx as e, jsxs as g } from "react/jsx-runtime";
import { RadialBarChart as A, PolarGrid as P, RadialBar as T, LabelList as I, PolarRadiusAxis as O, Label as Y } from "recharts";
import { ChartContainer as $, ChartTooltip as D, ChartTooltipContent as E } from "../ChartPrimitive.js";
import H from "../../utils/getCenterSubY.js";
const J = ({
  id: u,
  chartConfig: o,
  data: b,
  displayFields: r,
  height: p = 300,
  size: n,
  tooltipContent: y,
  innerRadius: x,
  outerRadius: C,
  startAngle: N,
  endAngle: z,
  customRadialLabel: f,
  polarGridProps: i,
  radialBarProps: v,
  centerTitle: l,
  centerSub: c,
  isStack: L,
  hideLegendIcon: R,
  reverseStackOrder: S
}) => {
  const d = Object.keys(o), q = r ? d.filter((t) => r == null ? void 0 : r.includes(t)) : d, a = n === "100%" || n === "auto", h = typeof n == "number" ? n : p, j = a ? "size-full aspect-square [container-type:size]" : "mx-auto aspect-square", k = a ? "fill-[var(--base-foreground)] text-[length:clamp(1.125rem,9cqmin,2.5rem)] font-[var(--font-weight-bold)]" : "fill-[var(--base-foreground)] text-[length:var(--typography-base-sizes-3x-large-font-size)] font-[var(--font-weight-bold)]", K = a ? "fill-[var(--base-muted-foreground)] text-[length:clamp(0.625rem,3.5cqmin,0.875rem)] font-[var(--font-weight-normal)]" : "fill-[var(--base-muted-foreground)] text-[length:var(--typography-base-sizes-extra-small-font-size)] font-[var(--font-weight-normal)] leading-[var(--typography-base-sizes-extra-small-line-height)]";
  return /* @__PURE__ */ e(
    $,
    {
      id: u,
      config: o,
      className: j,
      ...!a && h && {
        style: { height: h }
      },
      children: /* @__PURE__ */ g(
        A,
        {
          data: b,
          startAngle: N,
          endAngle: z,
          innerRadius: x,
          outerRadius: C,
          reverseStackOrder: S,
          children: [
            !R && /* @__PURE__ */ e(D, { cursor: !1, content: /* @__PURE__ */ e(E, { hideLabel: !0, ...y }) }),
            i && /* @__PURE__ */ e(P, { gridType: "circle", ...i }),
            q.map((t) => /* @__PURE__ */ e(
              T,
              {
                dataKey: t,
                fill: `var(--color-${t})`,
                ...L && { stackId: "a" },
                ...!i && { background: { fill: "var(--base-muted)" } },
                ...v,
                children: f && /* @__PURE__ */ e(
                  I,
                  {
                    position: "insideStart",
                    dataKey: f.dataKey,
                    className: "fill-white capitalize mix-blend-luminosity",
                    fontSize: 11,
                    formatter: (m) => {
                      var s;
                      return (s = o[String(m)]) == null ? void 0 : s.label;
                    }
                  }
                )
              },
              t
            )),
            (l || c) && /* @__PURE__ */ e(O, { tick: !1, tickLine: !1, axisLine: !1, children: /* @__PURE__ */ e(
              Y,
              {
                content: ({ viewBox: t }) => {
                  if (t && "cx" in t && "cy" in t) {
                    const m = a ? {} : { y: t.cy }, s = a ? l ? { dy: "2.2em" } : {} : { y: H(t.cy) };
                    return /* @__PURE__ */ g("text", { x: t.cx, y: t.cy, textAnchor: "middle", dominantBaseline: "middle", children: [
                      l && /* @__PURE__ */ e("tspan", { x: t.cx, ...m, className: k, children: l }),
                      c && /* @__PURE__ */ e("tspan", { x: t.cx, ...s, className: K, children: c })
                    ] });
                  }
                }
              }
            ) })
          ]
        }
      )
    }
  );
};
J.displayName = "RadialChart";
export {
  J as default
};
//# sourceMappingURL=RadialChart.js.map
