"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const React = require("react");
const index = require("../../../_vendor/usehooks-ts/dist-index.cjs");
const core = require("../../../types/core.cjs");
function useResponseState(message) {
  const itemRef = React.useRef(null);
  const isHovered = index.useHover(itemRef);
  const isUser = message?.role === "user";
  const isStreaming = !isUser && (message?.isStreaming || message?.status === core.Status.Streaming);
  const isPending = !isUser && message?.status === core.Status.Pending;
  const showActions = !isStreaming && !isPending && isHovered;
  const renderedContent = React.useMemo(() => {
    if (isUser || !message?.content) {
      return message?.content;
    }
    return message.content + (isStreaming ? "|" : "");
  }, [message?.content, isStreaming, isUser]);
  return {
    itemRef,
    isHovered,
    isStreaming,
    isPending,
    showActions,
    renderedContent
  };
}
exports.useResponseState = useResponseState;
//# sourceMappingURL=use-response-state.cjs.map
