"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useContentOverflow = void 0;
var _react = require("react");
var _hooks = require("../../hooks");
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.

const useContentOverflow = _ref => {
  let {
    contentRef,
    hiddenElementRef,
    maxHeight
  } = _ref;
  const [isOverflowing, setIsOverflowing] = (0, _react.useState)(false);
  const checkHeight = () => {
    const contentElement = contentRef.current;
    const hiddenElement = hiddenElementRef.current;
    if (!contentElement || !hiddenElement) return;
    setIsOverflowing(contentElement.scrollHeight > hiddenElement.getBoundingClientRect().height);
  };
  const checkHeightRef = (0, _react.useRef)(checkHeight);
  checkHeightRef.current = checkHeight;
  (0, _react.useLayoutEffect)(() => {
    checkHeightRef.current();
  }, [maxHeight]);
  (0, _hooks.useResizeObserver)({
    ref: contentRef,
    onResize: checkHeight
  });
  return isOverflowing;
};
exports.useContentOverflow = useContentOverflow;