"use client";
import { getStackSeriesIdentifier as g } from "../../../util/stacks/getStackSeriesIdentifier.js";
import { getValueByDataKey as u } from "../../../util/ChartUtils.js";
function K(c, s, v) {
  var {
    chartData: d = []
  } = s, {
    allowDuplicatedCategory: f,
    dataKey: o
  } = v, a = /* @__PURE__ */ new Map();
  return c.forEach((t) => {
    var r, l = (r = t.data) !== null && r !== void 0 ? r : d;
    if (!(l == null || l.length === 0)) {
      var y = g(t);
      l.forEach((n, p) => {
        var i = o == null || f ? p : String(u(n, o, null)), D = u(n, t.dataKey, 0), e;
        a.has(i) ? e = a.get(i) : e = {}, Object.assign(e, {
          [y]: D
        }), a.set(i, e);
      });
    }
  }), Array.from(a.values());
}
export {
  K as combineDisplayedStackedData
};
