{"version":3,"file":"singleton-operations.cjs","names":["getI18nConfig"],"sources":["../../src/i18n-store/singleton-operations.ts"],"sourcesContent":["import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { createGlobalSingleton } from 'gt-i18n/internal';\nimport { I18nStore } from './I18nStore';\nimport { getI18nConfig } from '../setup/i18nConfig';\n\n// ===== I18n Store ===== //\n\nconst i18nStoreSingleton = createGlobalSingleton<I18nStore>({\n  namespace: 'reactCore',\n  key: 'i18nStore',\n  source: '@generaltranslation/react-core',\n  notInitialized: () => createI18nStoreNotInitializedError(),\n});\n\nexport const getI18nStore = i18nStoreSingleton.get;\nexport const setI18nStore = i18nStoreSingleton.set;\nexport const isI18nStoreInitialized = i18nStoreSingleton.isInitialized;\n\nfunction createI18nStoreNotInitializedError(): Error {\n  const renderStrategy = getI18nConfig().getRenderStrategy();\n  const errorMessage = createDiagnosticMessage({\n    source: '@generaltranslation/react-core',\n    severity: 'Error',\n    whatHappened: 'Cannot access I18nStore before it is initialized.',\n    fix:\n      renderStrategy === 'SPA'\n        ? 'Initialize GT before reading GT runtime context.'\n        : 'Add a <GTProvider> at the root of your component tree.',\n  });\n\n  return new Error(errorMessage);\n}\n"],"mappings":"mKAOA,MAAM,GAAA,EAAA,EAAA,uBAAsD,CAC1D,UAAW,YACX,IAAK,YACL,OAAQ,iCACR,mBAAsB,GAAoC,CAC3D,CAAC,CAEW,EAAe,EAAmB,IAClC,EAAe,EAAmB,IACT,EAAmB,cAEzD,SAAS,GAA4C,CAEnD,IAAM,GAAA,EAAA,EAAA,yBAAuC,CAC3C,OAAQ,iCACR,SAAU,QACV,aAAc,oDACd,IALqBA,EAAAA,eAAe,CAAC,mBAMrB,GAAK,MACf,mDACA,yDACP,CAAC,CAEF,OAAW,MAAM,EAAa"}