#!/usr/bin/env node
import {
  computeRowScrollTop
} from "./chunk-BNQ5O6LE.js";
import {
  SCROLL_VIEWPORT
} from "./chunk-6OWHQ7HM.js";
import {
  init_esm_shims
} from "./chunk-DHET7RCE.js";

// src/cli/components/hooks/use-row-scroll.ts
init_esm_shims();
import { useRef } from "react";
function useRowScroll({
  focusedIndex,
  itemCount,
  availableHeight
}) {
  const scrollTopRef = useRef(0);
  const scrollEnabled = availableHeight > 0 && availableHeight >= SCROLL_VIEWPORT.MIN_VIEWPORT_ROWS && itemCount > availableHeight;
  if (scrollEnabled) {
    scrollTopRef.current = computeRowScrollTop(focusedIndex, scrollTopRef.current, availableHeight);
  }
  return { scrollEnabled, scrollTop: scrollTopRef.current };
}

export {
  useRowScroll
};
//# sourceMappingURL=chunk-WYVDNGJB.js.map