{"version":3,"file":"getTypingStatusMessage.mjs","names":[],"sources":["../../../../../src/components/TypingIndicator/utils/getTypingStatusMessage.ts"],"sourcesContent":["import type { TranslationContextValue } from '../../../context/TranslationContext';\nimport type { TypingEntry } from '../hooks/useDebouncedTypingActive';\n\n/** Localized typing status for the live region and the inline header: names, or a count. */\nexport const getTypingStatusMessage = (\n  displayUsers: readonly TypingEntry[],\n  t: TranslationContextValue['t'],\n) => {\n  const namedUsers = displayUsers\n    .map(({ user }) => user?.name?.trim() || user?.id || '')\n    .filter(Boolean);\n  const count = displayUsers.length;\n\n  if (count === 1 && namedUsers.length === 1) {\n    return t('typing.singleUser', '{{ typing }} is typing', { typing: namedUsers[0] });\n  }\n\n  if (count === 2 && namedUsers.length === 2) {\n    // Each name is its own value, so a translation words the whole sentence, conjunction included.\n    return t('typing.twoUsers', '{{ firstUser }} and {{ secondUser }} are typing', {\n      firstUser: namedUsers[0],\n      secondUser: namedUsers[1],\n    });\n  }\n\n  return t('typing.manyUsers', {\n    count,\n    defaultValue_one: '{{ count }} person is typing',\n    defaultValue_other: '{{ count }} people are typing',\n  });\n};\n"],"mappings":";;AAIA,IAAa,0BACX,cACA,MACG;CACH,MAAM,aAAa,aAChB,KAAK,EAAE,WAAW,MAAM,MAAM,KAAK,KAAK,MAAM,MAAM,EAAE,CAAC,CACvD,OAAO,OAAO;CACjB,MAAM,QAAQ,aAAa;CAE3B,IAAI,UAAU,KAAK,WAAW,WAAW,GACvC,OAAO,EAAE,qBAAqB,0BAA0B,EAAE,QAAQ,WAAW,GAAG,CAAC;CAGnF,IAAI,UAAU,KAAK,WAAW,WAAW,GAEvC,OAAO,EAAE,mBAAmB,mDAAmD;EAC7E,WAAW,WAAW;EACtB,YAAY,WAAW;CACzB,CAAC;CAGH,OAAO,EAAE,oBAAoB;EAC3B;EACA,kBAAkB;EAClB,oBAAoB;CACtB,CAAC;AACH"}