import { jsx as l } from "react/jsx-runtime";
import { a as m } from "./index.CfQlFjZU.js";
import { D as d } from "./DataTable.CDOMpN3l.js";
import { useMemo as a } from "react";
import { f as u } from "./useFormatNumber.B91lpWtw.js";
import "./ProgressActivity.DYLCzf8q.js";
import "./index.B0wX8xO7.js";
import "./formInputIcon.module.CU3tuFAI.js";
import "./isEqual.Bk3xqtBB.js";
const f = ({
  clicks: e,
  isLoading: n = !1
}) => {
  const o = a(() => e.reduce((r, t) => r + (t.unique || 0), 0), [e]), i = a(() => e.reduce((r, t) => r + (t.total || 0), 0), [e]);
  return {
    clicks: a(() => [
      ...[...e].sort((t, s) => s.unique - t.unique).map((t) => ({
        ...t,
        unique: t.unique !== void 0 ? u(t.unique) : "-",
        total: t.total !== void 0 ? u(t.total) : "-"
      })),
      {
        name: "Total",
        unique: u(o),
        total: u(i)
      }
    ], [e, o, i]),
    isLoading: n
  };
}, p = ({ clicks: e, isLoading: n = !1 }) => /* @__PURE__ */ l(
  d,
  {
    head: ["Links clicked", "Unique clicks", "Total clicks"],
    data: e,
    isLoading: n,
    row: (o) => [o.name, o.unique, o.total]
  }
), j = m(p, f);
export {
  j as C
};
