import * as t from "react";
function i(n = !0) {
  const [u, o] = t.useState(!1), c = t.useRef(n);
  c.current = n;
  const e = t.useRef(null), f = t.useCallback((r) => {
    if (e.current && (e.current.disconnect(), e.current = null), !r)
      return;
    const s = () => {
      c.current && o(r.scrollHeight > r.clientHeight + 1);
    };
    s(), e.current = new ResizeObserver(s), e.current.observe(r);
  }, []);
  return t.useEffect(() => {
    const r = e;
    return () => r.current?.disconnect();
  }, []), { ref: f, isTruncated: u };
}
export {
  i as useIsTruncated
};
