{"version":3,"file":"useLastOwnMessage.mjs","names":[],"sources":["../../../../../src/components/MessageList/hooks/useLastOwnMessage.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { findReverse } from '../../../utils/findReverse';\nimport type { LocalMessage } from 'stream-chat';\n\n// fixme: we should be able to retrieve last own message quickly from the LLC. Should be done when refactoring the LLC Channel state to reactive.\nexport const useLastOwnMessage = ({\n  messages,\n  ownUserId,\n}: {\n  messages?: LocalMessage[];\n  ownUserId?: string;\n}) =>\n  useMemo(\n    () =>\n      messages && findReverse(messages, (msg) => (msg.user && msg.user.id) === ownUserId),\n    [messages, ownUserId],\n  );\n"],"mappings":";;;AAKA,IAAa,qBAAqB,EAChC,UACA,gBAKA,cAEI,YAAY,YAAY,WAAW,SAAS,IAAI,QAAQ,IAAI,KAAK,QAAQ,SAAS,GACpF,CAAC,UAAU,SAAS,CACtB"}