// src/hooks/use-streaming-message/use-streaming-message.ts
function useStreamingMessage(chat, messageId) {
  const message = chat.messages.find((m) => m.id === messageId);
  const lastAssistant = (() => {
    for (let i = chat.messages.length - 1; i >= 0; i--) {
      if (chat.messages[i]?.role === "assistant") return chat.messages[i];
    }
    return void 0;
  })();
  const isActive = chat.status === "submitted" || chat.status === "streaming";
  const isStreaming = isActive && lastAssistant?.id === messageId;
  return {
    message,
    isStreaming,
    abort: chat.stop,
    retry: chat.reload
  };
}

export { useStreamingMessage };
//# sourceMappingURL=use-streaming-message.js.map
//# sourceMappingURL=use-streaming-message.js.map