import { jsx as a, Fragment as b } from "@emotion/react/jsx-runtime";
import { getPropertyByString as i } from "@m4l/core";
import { ChipStatusFormatterColumnWrapperStyled as S } from "../../../formatters/ChipStatusFormatter/slots/ChipStatusFormatterSlots.js";
import { getNullGuard as l } from "../../../../utils/getNullGuard.js";
import { ChipStatusFormatter as h } from "../../../formatters/ChipStatusFormatter/ChipStatusFormatter.js";
const W = (p) => {
  const { fieldStatus: r, fieldLabel: t, statusesColors: u, fallbackColor: m } = p;
  return (c) => {
    const { childRows: o } = c;
    if (o.length === 0)
      return /* @__PURE__ */ a(b, { children: "-" });
    const e = o[0], f = r.toString().startsWith("row.") ? r.toString().substring(4) : r.toString(), s = typeof t == "string" && t.startsWith("row.") ? t.substring(4) : t, n = l(
      i(e, f)
    ), g = `${typeof s == "string" ? l(
      i(e, s)
    ) : typeof t == "function" ? t(e, n) : ""} (${o.length})`;
    return /* @__PURE__ */ a(
      h,
      {
        label: g,
        status: n,
        statusesColors: u,
        Component: S,
        fallbackColor: m
      }
    );
  };
};
export {
  W as ColumnChipStatusGroupFormatter
};
