{"version":3,"file":"ThreadListLoadingIndicator.mjs","names":[],"sources":["../../../../../src/components/Threads/ThreadList/ThreadListLoadingIndicator.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { PaginatorState, Thread } from 'stream-chat';\n\nimport { LoadingIndicator as DefaultLoadingIndicator } from '../../Loading';\nimport { useChatContext, useComponentContext } from '../../../context';\nimport { useStateStore } from '../../../store';\n\n// `isLoading` with threads already loaded means the next page is loading.\nconst selector = (nextValue: PaginatorState<Thread>) => ({\n  isLoadingNext: nextValue.isLoading && !!nextValue.items?.length,\n});\n\nexport const ThreadListLoadingIndicator = () => {\n  const { LoadingIndicator = DefaultLoadingIndicator } = useComponentContext();\n  const { client } = useChatContext();\n  const { isLoadingNext } = useStateStore(client.threads.paginator.state, selector);\n\n  if (!isLoadingNext) return null;\n\n  return (\n    <div className='str-chat__thread-list-loading-indicator'>\n      <LoadingIndicator />\n    </div>\n  );\n};\n"],"mappings":";;;;;;;AASA,IAAM,YAAY,eAAuC,EACvD,eAAe,UAAU,aAAa,CAAC,CAAC,UAAU,OAAO,OAC3D;AAEA,IAAa,mCAAmC;CAC9C,MAAM,EAAE,kBAAA,qBAAmB,qBAA4B,oBAAoB;CAC3E,MAAM,EAAE,WAAW,eAAe;CAClC,MAAM,EAAE,kBAAkB,cAAc,OAAO,QAAQ,UAAU,OAAO,QAAQ;CAEhF,IAAI,CAAC,eAAe,OAAO;CAE3B,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,oBAAC,oBAAD,CAAmB,CAAA;CAChB,CAAA;AAET"}