{"version":3,"file":"Plural.shared.mjs","names":[],"sources":["../../../src/components/branches/Plural.shared.ts"],"sourcesContent":["import { getPluralBranch } from '../../utils/plurals/getPluralBranch';\nimport type { ReactNode } from 'react';\nimport { getFormatLocales } from '../../hooks/utils/getFormatLocales';\n\n// Pure render 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 PluralProps = {\n  children?: ReactNode;\n  n: number;\n  locales?: string[];\n  _locale?: string;\n  _enableI18n?: boolean;\n  [key: string]: ReactNode;\n};\n\ntype ResolvedPluralProps = PluralProps & {\n  _locale: string;\n  _enableI18n: boolean;\n};\n\nfunction renderPlural({\n  _enableI18n,\n  _locale,\n  children,\n  n,\n  locales: localesProp = [],\n  ...branches\n}: ResolvedPluralProps): ReactNode {\n  const locales = getFormatLocales({\n    locale: _locale,\n    enableI18n: _enableI18n,\n    localesProp,\n  });\n  if (typeof n !== 'number') {\n    return children;\n  }\n  const resolvedBranch = getPluralBranch(n, locales, branches);\n  return resolvedBranch != null ? resolvedBranch : children;\n}\n\nexport { renderPlural };\nexport type { PluralProps, ResolvedPluralProps };\n"],"mappings":"oJAsBA,SAAS,EAAa,CACpB,cACA,UACA,WACA,IACA,QAAS,EAAc,EAAE,CACzB,GAAG,GAC8B,CACjC,IAAM,EAAU,EAAiB,CAC/B,OAAQ,EACR,WAAY,EACZ,cACD,CAAC,CAKF,OAJI,OAAO,GAAM,SAGM,EAAgB,EAAG,EAAS,EAC5C,EAA0C,EAHxC"}