{"version":3,"file":"getPluralBranch.mjs","names":[],"sources":["../../../src/utils/plurals/getPluralBranch.ts"],"sourcesContent":["import {\n  getPluralForm,\n  isAcceptedPluralForm,\n} from 'generaltranslation/internal';\n\n/**\n * Main function to get the appropriate branch based on the provided number and branches.\n *\n * @param {number} n - The number to determine the branch for.\n * @param {any} branches - The object containing possible branches.\n * @returns {any} The determined branch.\n */\nexport function getPluralBranch<T>(\n  n: number,\n  locales: string[],\n  branches: Record<string, T>\n) {\n  let branchName = '';\n  let branch = null;\n  if (typeof n === 'number' && !branch && branches) {\n    const pluralForms = Object.keys(branches).filter(isAcceptedPluralForm);\n    branchName = getPluralForm(n, pluralForms, locales);\n  }\n  if (branchName && !branch) branch = branches[branchName];\n  return branch;\n}\n"],"mappings":"sFAYA,SAAgB,EACd,EACA,EACA,EACA,CACA,IAAI,EAAa,GACb,EAAS,KAMb,OALI,OAAO,GAAM,UAAY,CAAC,GAAU,IAEtC,EAAa,EAAc,EADP,OAAO,KAAK,EAAS,CAAC,OAAO,EACR,CAAE,EAAQ,EAEjD,GAAc,CAAC,IAAQ,EAAS,EAAS,IACtC"}