import { useRef, useMemo } from "react";
import { useHover } from "../../../_vendor/usehooks-ts/dist-index.js";
import { Status } from "../../../types/core.js";
function useResponseState(message) {
  const itemRef = useRef(null);
  const isHovered = useHover(itemRef);
  const isUser = message?.role === "user";
  const isStreaming = !isUser && (message?.isStreaming || message?.status === Status.Streaming);
  const isPending = !isUser && message?.status === Status.Pending;
  const showActions = !isStreaming && !isPending && isHovered;
  const renderedContent = useMemo(() => {
    if (isUser || !message?.content) {
      return message?.content;
    }
    return message.content + (isStreaming ? "|" : "");
  }, [message?.content, isStreaming, isUser]);
  return {
    itemRef,
    isHovered,
    isStreaming,
    isPending,
    showActions,
    renderedContent
  };
}
export {
  useResponseState
};
//# sourceMappingURL=use-response-state.js.map
