{"version":3,"file":"useDictionary.cjs","names":["resolveFallbackLocale","useDictionaryBase"],"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type {\n  Dictionary,\n  DictionarySelectorForGroup,\n  QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\nimport type {\n  DeclaredLocales,\n  LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useDictionary as useDictionaryBase } from 'react-intlayer/server';\nimport { resolveFallbackLocale } from './ambientLocale';\n\n/**\n * On the server side, hook that transforms a dictionary (or qualified\n * dictionary group) and returns the content for the given locale or selector.\n *\n * If the locale is not provided, it will use the locale from the server\n * context, falling back to the locale carried by the request.\n */\nexport const useDictionary = <\n  const T extends Dictionary | QualifiedDictionaryGroup,\n  const A extends\n    | LocalesValues\n    | DictionarySelectorForGroup<T> = DeclaredLocales,\n>(\n  dictionary: T,\n  localeOrSelector?: A\n): ReturnType<typeof useDictionaryBase<T, A>> => {\n  const fallbackLocale = resolveFallbackLocale(localeOrSelector);\n\n  return useDictionaryBase<T, A>(dictionary, localeOrSelector, fallbackLocale);\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,iBAMX,YACA,qBAC+C;CAC/C,MAAM,iBAAiBA,mDAAsB,gBAAgB;CAE7D,WAAOC,qCAAwB,YAAY,kBAAkB,cAAc;AAC7E"}