{"version":3,"file":"validLocale.mjs","names":[],"sources":["../../../../package/common/configProvider/validLocale.ts"],"sourcesContent":["const reported = new Set<string>();\n\n/**\n * `tag` as Intl writes it, or `undefined` (the browser's locale) for a tag Intl throws on, such as\n * `'de_AT'` or `''`: every formatter and collator below it would throw during render.\n */\nexport function validLocale(tag: string | undefined, source: string): string | undefined {\n  if (tag === undefined) return undefined;\n  try {\n    return Intl.getCanonicalLocales(tag)[0];\n  } catch {\n    if (!reported.has(tag)) {\n      reported.add(tag);\n      console.warn(\n        `${source}: \\`locale\\` ${JSON.stringify(tag)} is not a language tag, so the browser's locale is used. ` +\n          `Write it like 'de-AT'.`,\n      );\n    }\n    return undefined;\n  }\n}\n"],"mappings":"aAAA,IAAM,EAAW,IAAI,IAMrB,SAAgB,EAAY,EAAyB,EAAoC,CACnF,OAAQ,IAAA,GACZ,GAAI,CACF,OAAO,KAAK,oBAAoB,CAAG,CAAC,CAAC,EACvC,MAAQ,CACD,EAAS,IAAI,CAAG,IACnB,EAAS,IAAI,CAAG,EAChB,QAAQ,KACN,GAAG,EAAO,eAAe,KAAK,UAAU,CAAG,EAAE,gFAE/C,GAEF,MACF,CACF"}