{"version":3,"file":"useEntityKey.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError, EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string | (() => EntityAccessor) => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":["useContext","EntityKeyContext","BindingError"],"mappings":";;;;;AAIO,MAAM,eAAe,MAAuC;AAC5D,QAAA,YAAYA,iBAAWC,iCAAgB;AAE7C,MAAI,cAAc,QAAW;AAC5B,UAAM,IAAIC,QAAA;AAAA,MACT;AAAA,IAED;AAAA,EAAA;AAEM,SAAA;AACR;;"}