import { formatInteractionForLLM } from "./index488.js";
import { useCallback, useMemo } from "react";
//#region src/hooks/useInteractionHandler.ts
/**
* Hook that creates a memoized interaction handler that automatically
* formats interaction events for LLM consumption.
*
* @param options - Configuration options including the callback and format settings
* @returns A stable callback function that handles interaction events
*
* @example
* ```tsx
* function MyComponent() {
*   const handleInteraction = useInteractionHandler({
*     onInteraction: (event, formatted) => {
*       console.log('Event:', event);
*       console.log('Formatted:', formatted);
*       // Send formatted message to LLM
*     },
*     format: 'natural', // or 'structured', 'markdown'
*   });
*
*   return (
*     <AIInteractionProvider onInteraction={handleInteraction}>
*       <MarkdownRenderer>{markdownContent}</MarkdownRenderer>
*     </AIInteractionProvider>
*   );
* }
* ```
*/
function useInteractionHandler(options) {
	const { onInteraction, format, includeTimestamp, labels } = options;
	const formatOptions = useMemo(() => ({
		format,
		includeTimestamp,
		labels
	}), [
		format,
		includeTimestamp,
		labels
	]);
	return useCallback((event) => {
		onInteraction(event, formatInteractionForLLM(event, formatOptions));
	}, [onInteraction, formatOptions]);
}
//#endregion
export { useInteractionHandler };

//# sourceMappingURL=index489.js.map