import { useState as m, useCallback as y } from "react";
import { getIndexRowHeightVariant as e } from "../../helpers/shared/getIndexRowHeightVariant/getIndexRowHeightVariant.js";
const a = ({
  rowHeights: t,
  rowHeaderHeights: r,
  initialRowHeightVariant: n
}) => {
  const [u, f] = m(() => {
    if (typeof t != typeof r)
      throw new Error("Must be same type rowheights and rowHeaderTypes");
    if (typeof t == "number" && typeof r == "number")
      return {
        rowHVariant: "compact",
        rowHeight: t,
        rowHeaderHeight: r
      };
    if (typeof t != "number" && t.length !== 3)
      throw new Error("Must be 3 heights");
    if (typeof r != "number" && r.length !== 3)
      throw new Error("Must be 3 HeaderHeights");
    return {
      rowHVariant: n,
      rowHeight: typeof t != "number" ? t[e(n)] : t,
      rowHeaderHeight: typeof r != "number" ? r[e(n)] : r
    };
  }), p = y(
    (o) => {
      if (typeof t == "number" || typeof r == "number")
        throw new Error("Only use setCurrentRowHeight with vector rowHeights");
      f({
        rowHVariant: o,
        rowHeight: t[e(o)],
        rowHeaderHeight: r[e(o)]
      });
    },
    [t, r]
  );
  return {
    currentRowHeightVariant: u,
    setRowHeightVariant: p
  };
};
export {
  a as useRowHeight
};
