{"version":3,"file":"usePluginContext.mjs","sources":["../../../../src/context/plugins/usePluginContext.tsx"],"sourcesContent":["import { useContext } from 'react';\n\nimport { KeyValue } from '../../types/data';\n\nimport { PluginContext, PluginContextType } from './PluginContext';\n\nexport function usePluginContext<T extends KeyValue = KeyValue>(): PluginContextType<T> | null {\n  const context = useContext(PluginContext);\n\n  // The extensions hooks (e.g. `usePluginLinks()`) are using this hook to check\n  // if they are inside a plugin or not (core Grafana), so we should be able to return an empty state as well (`null`).\n  if (!context) {\n    return null;\n  }\n\n  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n  return context as PluginContextType<T>;\n}\n"],"names":[],"mappings":";;;;AAMO,SAAS,gBAAA,GAA+E;AAC7F,EAAA,MAAM,OAAA,GAAU,WAAW,aAAa,CAAA;AAIxC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,OAAO,OAAA;AACT;;;;"}