"use strict";

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

const useResizeObserver = _ref => {
  let {
    ref,
    onResize
  } = _ref;
  const onResizeRef = (0, _react.useRef)(undefined);
  onResizeRef.current = onResize;
  (0, _react.useEffect)(() => {
    if (!ref.current) return undefined;
    if (typeof window === 'undefined' || !('ResizeObserver' in window)) return undefined;
    const observer = new ResizeObserver(() => {
      onResizeRef.current?.();
    });
    observer.observe(ref.current);
    return () => {
      observer.disconnect();
    };
  }, [ref]);
};
exports.useResizeObserver = useResizeObserver;