"use client";
import { useForceUpdate } from "../use-force-update/use-force-update.mjs";
import { useEffect, useEffectEvent, useState } from "react";
//#region packages/@mantine/hooks/src/use-text-selection/use-text-selection.ts
function useTextSelection() {
	const forceUpdate = useForceUpdate();
	const [selection, setSelection] = useState(null);
	const handleSelectionChange = useEffectEvent(() => {
		setSelection(document.getSelection());
		forceUpdate();
	});
	useEffect(() => {
		setSelection(document.getSelection());
		document.addEventListener("selectionchange", handleSelectionChange);
		return () => document.removeEventListener("selectionchange", handleSelectionChange);
	}, []);
	return selection;
}
//#endregion
export { useTextSelection };

//# sourceMappingURL=use-text-selection.mjs.map