import { o as k } from "./rolldown-runtime.js";
import { i as y, t as L } from "./vendor/react.js";
import { et as $, j as M, tt as E } from "./vendor/recharts.js";
import { t as l } from "./utils.js";
import { t as S } from "./create-safe-context.js";
var m = /* @__PURE__ */ k(y(), 1), n = L(), T = {
  light: "",
  dark: ".dark"
}, [P, _] = S("ChartContainer");
function R({ id: c, className: e, children: t, config: r, ...a }) {
  const d = m.useId(), o = `chart-${c || d.replace(/:/g, "")}`;
  return /* @__PURE__ */ (0, n.jsx)(P.Provider, {
    value: { config: r },
    children: /* @__PURE__ */ (0, n.jsxs)("div", {
      "data-slot": "chart",
      "data-chart": o,
      className: l("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", e),
      ...a,
      children: [/* @__PURE__ */ (0, n.jsx)(q, {
        id: o,
        config: r
      }), /* @__PURE__ */ (0, n.jsx)(E, {
        minWidth: 0,
        children: t
      })]
    })
  });
}
var q = ({ id: c, config: e }) => {
  const t = Object.entries(e).filter(([, r]) => r.theme || r.color);
  return t.length ? /* @__PURE__ */ (0, n.jsx)("style", { dangerouslySetInnerHTML: { __html: Object.entries(T).map(([r, a]) => `
${a} [data-chart=${c}] {
${t.map(([d, o]) => {
    const i = o.theme?.[r] || o.color;
    return i ? `  --color-${d}: ${i};` : null;
  }).join(`
`)}
}
`).join(`
`) } }) : null;
}, z = M;
function I({ active: c, payload: e, className: t, indicator: r = "dot", hideLabel: a = !1, hideIndicator: d = !1, label: o, labelFormatter: i, labelClassName: g, formatter: j, color: N, nameKey: w, labelKey: x }) {
  const { config: h } = _(), b = m.useMemo(() => {
    if (a || !e?.length) return null;
    const [s] = e, p = v(h, s, `${x || s?.dataKey || s?.name || "value"}`), u = !x && typeof o == "string" ? h[o]?.label || o : p?.label;
    return i ? /* @__PURE__ */ (0, n.jsx)("div", {
      className: l("font-medium", g),
      children: i(u, e)
    }) : u ? /* @__PURE__ */ (0, n.jsx)("div", {
      className: l("font-medium", g),
      children: u
    }) : null;
  }, [
    o,
    i,
    e,
    a,
    g,
    h,
    x
  ]);
  if (!c || !e?.length) return null;
  const f = e.length === 1 && r !== "dot";
  return /* @__PURE__ */ (0, n.jsxs)("div", {
    className: l("border-border/50 bg-background gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl grid min-w-[8rem] items-start", t),
    children: [f ? null : b, /* @__PURE__ */ (0, n.jsx)("div", {
      className: "grid gap-1.5",
      children: e.filter((s) => s.type !== "none").map((s, p) => {
        const u = v(h, s, `${w || s.name || s.dataKey || "value"}`), C = N || s.payload?.fill || s.color;
        return /* @__PURE__ */ (0, n.jsx)("div", {
          className: l("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", r === "dot" && "items-center"),
          children: j && s?.value !== void 0 && s.name ? j(s.value, s.name, s, p, s.payload) : /* @__PURE__ */ (0, n.jsxs)(n.Fragment, { children: [u?.icon ? /* @__PURE__ */ (0, n.jsx)(u.icon, {}) : !d && /* @__PURE__ */ (0, n.jsx)("div", {
            className: l("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
              "h-2.5 w-2.5": r === "dot",
              "w-1": r === "line",
              "w-0 border-[1.5px] border-dashed bg-transparent": r === "dashed",
              "my-0.5": f && r === "dashed"
            }),
            style: {
              "--color-bg": C,
              "--color-border": C
            }
          }), /* @__PURE__ */ (0, n.jsxs)("div", {
            className: l("flex flex-1 justify-between leading-none", f ? "items-end" : "items-center"),
            children: [/* @__PURE__ */ (0, n.jsxs)("div", {
              className: "grid gap-1.5",
              children: [f ? b : null, /* @__PURE__ */ (0, n.jsx)("span", {
                className: "text-muted-foreground",
                children: u?.label || s.name
              })]
            }), s.value && /* @__PURE__ */ (0, n.jsx)("span", {
              className: "text-foreground font-mono font-medium tabular-nums",
              children: s.value.toLocaleString()
            })]
          })] })
        }, s.dataKey);
      })
    })]
  });
}
var A = $;
function K({ className: c, hideIcon: e = !1, payload: t, verticalAlign: r = "bottom", nameKey: a }) {
  const { config: d } = _();
  return t?.length ? /* @__PURE__ */ (0, n.jsx)("div", {
    className: l("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", c),
    children: t.filter((o) => o.type !== "none").map((o) => {
      const i = v(d, o, `${a || o.dataKey || "value"}`);
      return /* @__PURE__ */ (0, n.jsxs)("div", {
        className: l("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
        children: [i?.icon && !e ? /* @__PURE__ */ (0, n.jsx)(i.icon, {}) : /* @__PURE__ */ (0, n.jsx)("div", {
          className: "h-2 w-2 shrink-0 rounded-[2px]",
          style: { backgroundColor: o.color }
        }), i?.label]
      }, o.value);
    })
  }) : null;
}
function v(c, e, t) {
  if (typeof e != "object" || e === null) return;
  const r = "payload" in e && typeof e.payload == "object" && e.payload !== null ? e.payload : void 0;
  let a = t;
  return t in e && typeof e[t] == "string" ? a = e[t] : r && t in r && typeof r[t] == "string" && (a = r[t]), a in c ? c[a] : c[t];
}
R.displayName = "ChartContainer";
I.displayName = "ChartTooltipContent";
K.displayName = "ChartLegendContent";
var H = "(prefers-reduced-motion: reduce)";
function B() {
  const [c, e] = (0, m.useState)(!1);
  return (0, m.useEffect)(() => {
    const t = window.matchMedia(H);
    e(t.matches);
    const r = (a) => {
      e(a.matches);
    };
    return t.addEventListener("change", r), () => t.removeEventListener("change", r);
  }, []), c;
}
export {
  z as a,
  K as i,
  R as n,
  I as o,
  A as r,
  B as t
};

//# sourceMappingURL=use-reduced-motion2.js.map