{"version":3,"file":"useNotificationTarget.mjs","names":[],"sources":["../../../../../src/components/Notifications/hooks/useNotificationTarget.ts"],"sourcesContent":["import { useChannelListContext, useWorkspaceNavigation } from '../../../context';\nimport { useChannelInstanceContext } from '../../../context/ChannelInstanceContext';\nimport { useThreadContext } from '../../Threads/ThreadContext';\n\nimport type { NotificationTargetPanel } from '../notificationTarget';\n\n/**\n * Resolves the panel where notifications emitted by the current component are displayed.\n *\n * @returns The first match of thread, channel, thread list, channel list, or undefined.\n */\nexport const useNotificationTarget = (): NotificationTargetPanel | undefined => {\n  const { isThreadsView } = useWorkspaceNavigation();\n  const { paginator } = useChannelListContext();\n  // Does not throw outside a `Channel` subtree, unlike `useChannel`.\n  const { channel } = useChannelInstanceContext();\n  const threadInstance = useThreadContext();\n\n  if (threadInstance) return 'thread';\n  if (channel) return 'channel';\n  if (isThreadsView) return 'thread-list';\n  if (paginator) return 'channel-list';\n  return undefined;\n};\n"],"mappings":";;;;;;;;;;AAWA,IAAa,8BAAmE;CAC9E,MAAM,EAAE,kBAAkB,uBAAuB;CACjD,MAAM,EAAE,cAAc,sBAAsB;CAE5C,MAAM,EAAE,YAAY,0BAA0B;CAG9C,IAFuB,iBAEnB,GAAgB,OAAO;CAC3B,IAAI,SAAS,OAAO;CACpB,IAAI,eAAe,OAAO;CAC1B,IAAI,WAAW,OAAO;AAExB"}