import { jsx as r, jsxs as p, Fragment as T } from "react/jsx-runtime";
import { createElement as W } from "react";
import { Area as _, ResponsiveContainer as F, AreaChart as S, CartesianGrid as U, XAxis as X, YAxis as Y, Legend as $, Brush as B } from "recharts";
import { isObject as m } from "es-toolkit/compat";
import { getColor as d, mapGridOptions as H } from "./chartHelper.js";
import K, { DEFAULT_ARIA_GRADIENT_ID as N } from "./AreaGradient.js";
import q from "./ChartTooltip.js";
import { getLegendDefaultProps as z } from "./Legend.js";
import { renderAxis as J } from "./XAxis.js";
import { getAreaDefaultProps as M } from "./Area.js";
import { renderReferenceLine as Q } from "./ReferenceLine.js";
const mr = (l) => {
  const {
    width: h,
    height: f,
    data: g = [],
    dataUnit: c = "",
    dataKey: A = "value",
    gradients: u = [],
    areas: x = [],
    referenceLines: y = [],
    xAxisOptions: k,
    yAxisOptions: C,
    gridOptions: D,
    containerOptions: w,
    showXAxis: P = !0,
    showYAxis: G = !1,
    additionalAxes: O = [],
    showGrid: b = !1,
    legend: i,
    brush: L = !1,
    tooltip: o = !0,
    ...I
  } = l, a = x.map((e) => {
    const j = { ...M(), ...e.props }, { strokeColor: s, ...v } = j, n = e.key, E = d(s);
    return {
      area: /* @__PURE__ */ W(
        _,
        {
          ...v,
          key: e.key,
          stroke: E,
          fill: `url(#${n})`
        }
      ),
      gradient: /* @__PURE__ */ r(K, { id: n || N, color: s }, e.key)
    };
  }), R = m(o) ? o.props : {}, t = m(i) ? { ...z(), ...i.props } : {};
  return /* @__PURE__ */ r(
    F,
    {
      minHeight: 100,
      minWidth: 100,
      initialDimension: { width: 100, height: 100 },
      ...w,
      children: /* @__PURE__ */ p(
        S,
        {
          width: h,
          height: f,
          data: g,
          margin: { top: 15, right: 15, left: 15, bottom: 15 },
          ...I,
          children: [
            /* @__PURE__ */ p("defs", { children: [
              u,
              a.map((e) => e.gradient)
            ] }),
            b && /* @__PURE__ */ r(U, { strokeDasharray: "3 3", ...H(D) }),
            /* @__PURE__ */ r(X, { hide: !P, dataKey: A, ...k }),
            /* @__PURE__ */ r(Y, { hide: !G, unit: c, ...C }),
            O.map(J),
            o && /* @__PURE__ */ r(q, { ...R }),
            i && t && /* @__PURE__ */ r(T, { children: /* @__PURE__ */ r(
              $,
              {
                wrapperStyle: t.verticalAlign === "bottom" ? { bottom: 0 } : t.wrapperStyle,
                ...t
              }
            ) }),
            a.map((e) => e.area),
            y.map(Q),
            L && /* @__PURE__ */ r(B, { stroke: d("gray") })
          ]
        }
      )
    }
  );
};
export {
  mr as default
};
//# sourceMappingURL=AreaChart.js.map
