import { useState, useRef, startTransition } from "react";
import { useWindowEvent } from "../../../../../../../../@mantine_hooks@7.15.2_react@18.3.1/node_modules/@mantine/hooks/esm/use-window-event/use-window-event.mjs";
import { useIsomorphicEffect } from "../../../../../../../../@mantine_hooks@7.15.2_react@18.3.1/node_modules/@mantine/hooks/esm/use-isomorphic-effect/use-isomorphic-effect.mjs";
function useResizing({ transitionDuration, disabled }) {
  const [resizing, setResizing] = useState(true);
  const resizingTimeout = useRef(-1);
  const disabledTimeout = useRef(-1);
  useWindowEvent("resize", () => {
    setResizing(true);
    clearTimeout(resizingTimeout.current);
    resizingTimeout.current = window.setTimeout(
      () => startTransition(() => {
        setResizing(false);
      }),
      200
    );
  });
  useIsomorphicEffect(() => {
    setResizing(true);
    clearTimeout(disabledTimeout.current);
    disabledTimeout.current = window.setTimeout(
      () => startTransition(() => {
        setResizing(false);
      }),
      transitionDuration || 0
    );
  }, [disabled, transitionDuration]);
  return resizing;
}
export {
  useResizing
};
