{"version":3,"file":"Num.shared.mjs","names":[],"sources":["../../../src/components/variables/Num.shared.ts"],"sourcesContent":["import { getI18nConfig } from 'gt-i18n/internal';\nimport { getFormatLocales } from '../../hooks/utils/getFormatLocales';\n\n// Pure compute logic shared by the hook-based and RSC implementations. This\n// module must stay free of hook/context imports so it can be reached from the\n// components-rsc entrypoint.\n\ntype NumProps = {\n  children: number | string | null | undefined;\n  options?: Intl.NumberFormatOptions;\n  locales?: string[];\n  name?: string;\n  _locale?: string;\n  _enableI18n?: boolean;\n};\n\ntype ResolvedNumProps = NumProps & {\n  _locale: string;\n  _enableI18n: boolean;\n};\n\nfunction computeNum({\n  _enableI18n,\n  _locale,\n  children,\n  options = {},\n  locales: localesProp = [],\n}: ResolvedNumProps): string | null {\n  const locales = getFormatLocales({\n    locale: _locale,\n    enableI18n: _enableI18n,\n    localesProp,\n  });\n  const gt = getI18nConfig().getGTClass();\n  if (children == null) return null;\n  const parsedNumber =\n    typeof children === 'string' ? parseFloat(children) : children;\n  return gt.formatNum(parsedNumber, { locales, ...options });\n}\n\nexport { computeNum };\nexport type { NumProps, ResolvedNumProps };\n"],"mappings":"2HAqBA,SAAS,EAAW,CAClB,cACA,UACA,WACA,UAAU,EAAE,CACZ,QAAS,EAAc,EAAE,EACS,CAClC,IAAM,EAAU,EAAiB,CAC/B,OAAQ,EACR,WAAY,EACZ,cACD,CAAC,CACI,EAAK,GAAe,CAAC,YAAY,CACvC,GAAI,GAAY,KAAM,OAAO,KAC7B,IAAM,EACJ,OAAO,GAAa,SAAW,WAAW,EAAS,CAAG,EACxD,OAAO,EAAG,UAAU,EAAc,CAAE,UAAS,GAAG,EAAS,CAAC"}