{"version":3,"file":"ChatContext.mjs","names":[],"sources":["../../../src/context/ChatContext.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport type { PropsWithChildren } from 'react';\nimport type {\n  ChannelManager,\n  SearchController,\n  StreamChat,\n  UserMuteResponse,\n} from 'stream-chat';\n\nimport type { ChatProps } from '../components/Chat/Chat';\nimport { requireContext } from './requireContext';\n\ntype CSSClasses =\n  | 'chat'\n  | 'channel'\n  | 'channelList'\n  | 'message'\n  | 'messageList'\n  | 'thread'\n  | 'threadList'\n  | 'virtualMessage'\n  | 'virtualizedMessageList';\n\nexport type CustomClasses = Partial<Record<CSSClasses, string>>;\n\nexport type ChatContextValue = {\n  /**\n   * The client's `ChannelManager`, which queries and manages channels across channel lists. The\n   * application registers its lists with `client.channelManager.insertPaginator({ paginator })`;\n   * the SDK creates none.\n   */\n  channelManager: ChannelManager;\n  getAppSettings: () => ReturnType<StreamChat['getAppSettings']> | null;\n  /** Users muted by the current user. */\n  mutes: Array<UserMuteResponse>;\n  /** Controls all search operations. */\n  searchController: SearchController;\n  useImageFlagEmojisOnWindows: boolean;\n  /** Class names for the main container components of the SDK. */\n  customClasses?: CustomClasses;\n} & Partial<Pick<ChatProps, 'isMessageAIGenerated'>> &\n  Required<Pick<ChatProps, 'theme' | 'client'>>;\n\nexport const ChatContext = React.createContext<ChatContextValue | undefined>(undefined);\n\nexport const ChatProvider = ({\n  children,\n  value,\n}: PropsWithChildren<{\n  value: ChatContextValue;\n}>) => (\n  <ChatContext.Provider value={value as unknown as ChatContextValue}>\n    {children}\n  </ChatContext.Provider>\n);\n\nexport const useChatContext = () =>\n  requireContext(useContext(ChatContext), 'useChatContext', 'Chat');\n"],"mappings":";;;;AA2CA,IAAa,cAAc,MAAM,cAA4C,KAAA,CAAS;AAEtF,IAAa,gBAAgB,EAC3B,UACA,YAIA,oBAAC,YAAY,UAAb;CAA6B;CAC1B;AACmB,CAAA;AAGxB,IAAa,uBACX,eAAe,WAAW,WAAW,GAAG,kBAAkB,MAAM"}