{"version":3,"file":"useCloseThread.mjs","names":[],"sources":["../../../../../src/components/Threads/hooks/useCloseThread.ts"],"sourcesContent":["import { useCallback } from 'react';\n\nimport { useThreadContext } from '../ThreadContext';\nimport { useWorkspaceNavigation, useWorkspacePanel } from '../../../context';\nimport type { WorkspaceNavigationOptions } from '../../../context';\n\n/**\n * Returns a function that closes the thread in context by releasing the slot it occupies. The\n * thread's activation belongs to whoever activated it (`useActiveThread` releases it on unmount),\n * so closing does not touch it. The calling panel is passed along, so the right one closes when\n * the thread is open in several.\n *\n * @returns Close handler. Its options are merged over `{ panel }` and passed to `closeThread`.\n */\nexport const useCloseThread = () => {\n  const { closeThread } = useWorkspaceNavigation();\n  const panel = useWorkspacePanel();\n  const thread = useThreadContext();\n\n  return useCallback(\n    (options?: WorkspaceNavigationOptions) => {\n      closeThread(thread?.id, { panel, ...options });\n    },\n    [closeThread, panel, thread],\n  );\n};\n"],"mappings":";;;;;;;;;;;;AAcA,IAAa,uBAAuB;CAClC,MAAM,EAAE,gBAAgB,uBAAuB;CAC/C,MAAM,QAAQ,kBAAkB;CAChC,MAAM,SAAS,iBAAiB;CAEhC,OAAO,aACJ,YAAyC;EACxC,YAAY,QAAQ,IAAI;GAAE;GAAO,GAAG;EAAQ,CAAC;CAC/C,GACA;EAAC;EAAa;EAAO;CAAM,CAC7B;AACF"}