{"version":3,"file":"useDictionaryDynamic.cjs","names":["resolveFallbackLocale","useDictionaryDynamicBase"],"sources":["../../../src/server/useDictionaryDynamic.ts"],"sourcesContent":["import type { QualifiedDynamicLoaderMap } from '@intlayer/core/dictionaryManipulator';\nimport type {\n  Dictionary,\n  DictionarySelector,\n} from '@intlayer/types/dictionary';\nimport type {\n  DeclaredLocales,\n  LocalesValues,\n  StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { useDictionaryDynamic as useDictionaryDynamicBase } from 'react-intlayer/server';\nimport { resolveFallbackLocale } from './ambientLocale';\n\n/**\n * On the server side, hook that lazily loads a dictionary (plain or qualified)\n * 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 useDictionaryDynamic = <\n  const T extends Dictionary,\n  const A extends LocalesValues | DictionarySelector = DeclaredLocales,\n>(\n  dictionaryPromise:\n    | StrictModeLocaleMap<() => Promise<T>>\n    | QualifiedDynamicLoaderMap,\n  key: string,\n  localeOrSelector?: A\n): ReturnType<typeof useDictionaryDynamicBase<T, A>> => {\n  const fallbackLocale = resolveFallbackLocale(localeOrSelector);\n\n  return useDictionaryDynamicBase<T, A>(\n    dictionaryPromise,\n    key,\n    localeOrSelector,\n    fallbackLocale\n  );\n};\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAa,wBAIX,mBAGA,KACA,qBACsD;CACtD,MAAM,iBAAiBA,mDAAsB,gBAAgB;CAE7D,WAAOC,4CACL,mBACA,KACA,kBACA,cACF;AACF"}