UNPKG

plural-rules

Version:

Evaluates plural rules, so that localization libraries can choose the right plural form.

1 lines 29.7 kB
{"version":3,"file":"index.min.mjs","sources":["../src/code.js","../src/data-indexer.js","../src/data.js","../src/index.js"],"sourcesContent":["import parsePluralRule from 'cldrpluralruleparser'\nimport { indexPluralForms, parsePluralForms } from './data-indexer.js'\n\nlet rules = []\nlet cardinals = {}\n\nfunction normalizeLocale (locale) {\n return locale.toLowerCase().replace('_', '-')\n}\n\nfunction getLanguage (locale) {\n const separator = locale.indexOf('-')\n return separator > 0 && locale.substr(0, separator)\n}\n\nfunction getPluralRulesForCardinals (locale) {\n locale = normalizeLocale(locale)\n let forms = cardinals[locale]\n let language\n if (forms === undefined) {\n language = getLanguage(locale)\n if (language) {\n forms = cardinals[language]\n }\n }\n if (forms === undefined) {\n throw new Error(`Unrecognised locale: \"${locale}\".`)\n } else if (typeof forms === 'string') {\n forms = parsePluralForms(forms)\n cardinals[language || locale] = forms\n }\n return forms\n}\n\nfunction getPluralFormForCardinal (locale, count) {\n const forms = typeof locale !== 'string'\n ? locale\n : getPluralRulesForCardinals(locale)\n for (const form in forms) {\n const rule = forms[form]\n if (parsePluralRule(rules[rule], count)) {\n return form\n }\n }\n}\n\nfunction setPluralFormsForCardinals (locale, forms) {\n locale = normalizeLocale(locale)\n cardinals[locale] = indexPluralForms(forms, rules)\n}\n\nfunction populatePluralData (data) {\n rules = data.rules\n cardinals = data.cardinals\n}\n\nlet supportedLocales\n\nfunction getSupportedLocales() {\n if (!supportedLocales) supportedLocales = Object.keys(cardinals)\n return supportedLocales\n}\n\nfunction getPluralFormsForLocale(locale) {\n const cardinal = cardinals[locale]\n if (cardinal === undefined) return\n return cardinal\n .split(',')\n .map(form => form.substring(0, form.indexOf(':')))\n}\n\nexport {\n getPluralRulesForCardinals, getPluralFormForCardinal,\n setPluralFormsForCardinals, populatePluralData,\n getSupportedLocales, getPluralFormsForLocale\n}\n","// Input string with the object serialized:\n// \"one:0,other:1\"\n// Output forms, names pointing to array indexes of their rules:\n// {\n// \"one\": 0,\n// \"other\": 1\n// }\nfunction parsePluralForms (serializedForms) {\n return serializedForms\n .split(',')\n .reduce((result, serializedForm) => {\n const parts = serializedForm.split(':')\n result[parts[0]] = +parts[1]\n return result\n }, {})\n}\n\n// Input forms with rules:\n// {\n// \"pluralRule-count-one\": \"i = 1 and v = 0 @integer 1\",\n// \"pluralRule-count-other\": \" @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, …\n// @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\"\n// }\n// Output rules, an array of distinct strings:\n// [\n// \"i = 1 and v = 0 @integer 1\",\n// \" @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, …\n// @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n// ...\n// ]\n// Output forms, names pointing to array indexes of their rules:\n// {\n// \"one\": 0,\n// \"other\": 1\n// }\nfunction indexPluralForms (forms, rules) {\n // Iterate over all plural forms.\n return Object\n .keys(forms)\n .reduce((result, formName) => {\n // Refer to plural rules in the de-duplication array.\n let rule = forms[formName]\n if (typeof rule === 'string') {\n rule = rule\n .trim()\n .replace(/ {2}/g, ' ')\n let ruleIndex = rules.indexOf(rule)\n if (ruleIndex < 0) {\n ruleIndex = rules.length\n rules.push(rule)\n }\n rule = ruleIndex\n }\n // Cut off prefixes \"pluralRule-count- from plural forms.\n if (formName.length > 17) {\n formName = formName.substr(17)\n }\n result[formName] = rule\n return result\n }, {})\n}\n\nexport { indexPluralForms, parsePluralForms }\n","export default {\n \"version\": {\n \"_unicodeVersion\": \"12.1.0\",\n \"_cldrVersion\": \"36\"\n },\n \"rules\": [\n \"n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000\",\n \"@integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~0.9, 1.1~1.6, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n = 0..1 @integer 0, 1 @decimal 0.0, 1.0, 0.00, 1.00, 0.000, 1.000, 0.0000, 1.0000\",\n \"@integer 2~17, 100, 1000, 10000, 100000, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"i = 0 or n = 1 @integer 0, 1 @decimal 0.0~1.0, 0.00~0.04\",\n \"@integer 2~17, 100, 1000, 10000, 100000, 1000000, … @decimal 1.1~2.6, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n = 0 @integer 0 @decimal 0.0, 0.00, 0.000, 0.0000\",\n \"n = 2 @integer 2 @decimal 2.0, 2.00, 2.000, 2.0000\",\n \"n % 100 = 3..10 @integer 3~10, 103~110, 1003, … @decimal 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 103.0, 1003.0, …\",\n \"n % 100 = 11..99 @integer 11~26, 111, 1011, … @decimal 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 111.0, 1011.0, …\",\n \"@integer 100~102, 200~202, 300~302, 400~402, 500~502, 600, 1000, 10000, 100000, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.1, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"i = 1 and v = 0 @integer 1\",\n \"@integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n % 10 = 1 and n % 100 != 11 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, … @decimal 1.0, 21.0, 31.0, 41.0, 51.0, 61.0, 71.0, 81.0, 101.0, 1001.0, …\",\n \"n % 10 = 2..4 and n % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, … @decimal 2.0, 3.0, 4.0, 22.0, 23.0, 24.0, 32.0, 33.0, 102.0, 1002.0, …\",\n \"n % 10 = 0 or n % 10 = 5..9 or n % 100 = 11..14 @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"@decimal 0.1~0.9, 1.1~1.7, 10.1, 100.1, 1000.1, …\",\n \"@integer 0~15, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n % 10 = 1 and n % 100 != 11,71,91 @integer 1, 21, 31, 41, 51, 61, 81, 101, 1001, … @decimal 1.0, 21.0, 31.0, 41.0, 51.0, 61.0, 81.0, 101.0, 1001.0, …\",\n \"n % 10 = 2 and n % 100 != 12,72,92 @integer 2, 22, 32, 42, 52, 62, 82, 102, 1002, … @decimal 2.0, 22.0, 32.0, 42.0, 52.0, 62.0, 82.0, 102.0, 1002.0, …\",\n \"n % 10 = 3..4,9 and n % 100 != 10..19,70..79,90..99 @integer 3, 4, 9, 23, 24, 29, 33, 34, 39, 43, 44, 49, 103, 1003, … @decimal 3.0, 4.0, 9.0, 23.0, 24.0, 29.0, 33.0, 34.0, 103.0, 1003.0, …\",\n \"n != 0 and n % 1000000 = 0 @integer 1000000, … @decimal 1000000.0, 1000000.00, 1000000.000, …\",\n \"@integer 0, 5~8, 10~20, 100, 1000, 10000, 100000, … @decimal 0.0~0.9, 1.1~1.6, 10.0, 100.0, 1000.0, 10000.0, 100000.0, …\",\n \"v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, … @decimal 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 10.1, 100.1, 1000.1, …\",\n \"v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, … @decimal 0.2~0.4, 1.2~1.4, 2.2~2.4, 3.2~3.4, 4.2~4.4, 5.2, 10.2, 100.2, 1000.2, …\",\n \"@integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 0.5~1.0, 1.5~2.0, 2.5~2.7, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"v = 0 and i = 1,2,3 or v = 0 and i % 10 != 4,6,9 or v != 0 and f % 10 != 4,6,9 @integer 0~3, 5, 7, 8, 10~13, 15, 17, 18, 20, 21, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~0.3, 0.5, 0.7, 0.8, 1.0~1.3, 1.5, 1.7, 1.8, 2.0, 2.1, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"@integer 4, 6, 9, 14, 16, 19, 24, 26, 104, 1004, … @decimal 0.4, 0.6, 0.9, 1.4, 1.6, 1.9, 2.4, 2.6, 10.4, 100.4, 1000.4, …\",\n \"i = 2..4 and v = 0 @integer 2~4\",\n \"v != 0 @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"@integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, …\",\n \"n = 3 @integer 3 @decimal 3.0, 3.00, 3.000, 3.0000\",\n \"n = 6 @integer 6 @decimal 6.0, 6.00, 6.000, 6.0000\",\n \"@integer 4, 5, 7~20, 100, 1000, 10000, 100000, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n = 1 or t != 0 and i = 0,1 @integer 1 @decimal 0.1~1.6\",\n \"@integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 2.0~3.4, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"v = 0 and i % 100 = 1 or f % 100 = 1 @integer 1, 101, 201, 301, 401, 501, 601, 701, 1001, … @decimal 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 10.1, 100.1, 1000.1, …\",\n \"v = 0 and i % 100 = 2 or f % 100 = 2 @integer 2, 102, 202, 302, 402, 502, 602, 702, 1002, … @decimal 0.2, 1.2, 2.2, 3.2, 4.2, 5.2, 6.2, 7.2, 10.2, 100.2, 1000.2, …\",\n \"v = 0 and i % 100 = 3..4 or f % 100 = 3..4 @integer 3, 4, 103, 104, 203, 204, 303, 304, 403, 404, 503, 504, 603, 604, 703, 704, 1003, … @decimal 0.3, 0.4, 1.3, 1.4, 2.3, 2.4, 3.3, 3.4, 4.3, 4.4, 5.3, 5.4, 6.3, 6.4, 7.3, 7.4, 10.3, 100.3, 1000.3, …\",\n \"i = 0,1 @integer 0, 1 @decimal 0.0~1.5\",\n \"@integer 2~17, 100, 1000, 10000, 100000, 1000000, … @decimal 2.0~3.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n = 3..6 @integer 3~6 @decimal 3.0, 4.0, 5.0, 6.0, 3.00, 4.00, 5.00, 6.00, 3.000, 4.000, 5.000, 6.000, 3.0000, 4.0000, 5.0000, 6.0000\",\n \"n = 7..10 @integer 7~10 @decimal 7.0, 8.0, 9.0, 10.0, 7.00, 8.00, 9.00, 10.00, 7.000, 8.000, 9.000, 10.000, 7.0000, 8.0000, 9.0000, 10.0000\",\n \"@integer 0, 11~25, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~0.9, 1.1~1.6, 10.1, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n = 1,11 @integer 1, 11 @decimal 1.0, 11.0, 1.00, 11.00, 1.000, 11.000, 1.0000\",\n \"n = 2,12 @integer 2, 12 @decimal 2.0, 12.0, 2.00, 12.00, 2.000, 12.000, 2.0000\",\n \"n = 3..10,13..19 @integer 3~10, 13~19 @decimal 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 3.00\",\n \"@integer 0, 20~34, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~0.9, 1.1~1.6, 10.1, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"v = 0 and i % 10 = 1 @integer 1, 11, 21, 31, 41, 51, 61, 71, 101, 1001, …\",\n \"v = 0 and i % 10 = 2 @integer 2, 12, 22, 32, 42, 52, 62, 72, 102, 1002, …\",\n \"v = 0 and i % 100 = 0,20,40,60,80 @integer 0, 20, 40, 60, 80, 100, 120, 140, 1000, 10000, 100000, 1000000, …\",\n \"@integer 3~10, 13~19, 23, 103, 1003, …\",\n \"i = 2 and v = 0 @integer 2\",\n \"v = 0 and n != 0..10 and n % 10 = 0 @integer 20, 30, 40, 50, 60, 70, 80, 90, 100, 1000, 10000, 100000, 1000000, …\",\n \"@integer 0, 3~17, 101, 1001, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"t = 0 and i % 10 = 1 and i % 100 != 11 or t != 0 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, … @decimal 0.1~1.6, 10.1, 100.1, 1000.1, …\",\n \"@integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"@integer 0, 3~17, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~0.9, 1.1~1.6, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n % 100 = 2,22,42,62,82 or n % 1000 = 0 and n % 100000 = 1000..20000,40000,60000,80000 or n != 0 and n % 1000000 = 100000 @integer 2, 22, 42, 62, 82, 102, 122, 142, 1000, 10000, 100000, … @decimal 2.0, 22.0, 42.0, 62.0, 82.0, 102.0, 122.0, 142.0, 1000.0, 10000.0, 100000.0, …\",\n \"n % 100 = 3,23,43,63,83 @integer 3, 23, 43, 63, 83, 103, 123, 143, 1003, … @decimal 3.0, 23.0, 43.0, 63.0, 83.0, 103.0, 123.0, 143.0, 1003.0, …\",\n \"n != 1 and n % 100 = 1,21,41,61,81 @integer 21, 41, 61, 81, 101, 121, 141, 161, 1001, … @decimal 21.0, 41.0, 61.0, 81.0, 101.0, 121.0, 141.0, 161.0, 1001.0, …\",\n \"@integer 4~19, 100, 1004, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.1, 1000000.0, …\",\n \"i = 0,1 and n != 0 @integer 1 @decimal 0.1~1.6\",\n \"n % 10 = 1 and n % 100 != 11..19 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, … @decimal 1.0, 21.0, 31.0, 41.0, 51.0, 61.0, 71.0, 81.0, 101.0, 1001.0, …\",\n \"n % 10 = 2..9 and n % 100 != 11..19 @integer 2~9, 22~29, 102, 1002, … @decimal 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 22.0, 102.0, 1002.0, …\",\n \"f != 0 @decimal 0.1~0.9, 1.1~1.7, 10.1, 100.1, 1000.1, …\",\n \"@integer 0, 10~20, 30, 40, 50, 60, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19 @integer 0, 10~20, 30, 40, 50, 60, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n % 10 = 1 and n % 100 != 11 or v = 2 and f % 10 = 1 and f % 100 != 11 or v != 2 and f % 10 = 1 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, … @decimal 0.1, 1.0, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 10.1, 100.1, 1000.1, …\",\n \"@integer 2~9, 22~29, 102, 1002, … @decimal 0.2~0.9, 1.2~1.9, 10.2, 100.2, 1000.2, …\",\n \"@integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 0.2~1.0, 1.2~1.7, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"v != 0 or n = 0 or n % 100 = 2..19 @integer 0, 2~16, 102, 1002, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"@integer 20~35, 100, 1000, 10000, 100000, 1000000, …\",\n \"n = 0 or n % 100 = 2..10 @integer 0, 2~10, 102~107, 1002, … @decimal 0.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 10.0, 102.0, 1002.0, …\",\n \"n % 100 = 11..19 @integer 11~19, 111~117, 1011, … @decimal 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 111.0, 1011.0, …\",\n \"@integer 20~35, 100, 1000, 10000, 100000, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.1, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"v = 0 and i % 10 = 2..4 and i % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, …\",\n \"v = 0 and i != 1 and i % 10 = 0..1 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 12..14 @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, …\",\n \"@decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"i = 0..1 @integer 0, 1 @decimal 0.0~1.5\",\n \"v = 0 and i % 10 = 1 and i % 100 != 11 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, …\",\n \"v = 0 and i % 10 = 0 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 11..14 @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, …\",\n \"n = 2..10 @integer 2~10 @decimal 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 2.00, 3.00, 4.00, 5.00, 6.00, 7.00, 8.00\",\n \"@integer 11~26, 100, 1000, 10000, 100000, 1000000, … @decimal 1.1~1.9, 2.1~2.7, 10.1, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n = 0,1 or i = 0 and f = 1 @integer 0, 1 @decimal 0.0, 0.1, 1.0, 0.00, 0.01, 1.00, 0.000, 0.001, 1.000, 0.0000, 0.0001, 1.0000\",\n \"@integer 2~17, 100, 1000, 10000, 100000, 1000000, … @decimal 0.2~0.9, 1.1~1.8, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"v = 0 and i % 100 = 1 @integer 1, 101, 201, 301, 401, 501, 601, 701, 1001, …\",\n \"v = 0 and i % 100 = 2 @integer 2, 102, 202, 302, 402, 502, 602, 702, 1002, …\",\n \"v = 0 and i % 100 = 3..4 or v != 0 @integer 3, 4, 103, 104, 203, 204, 303, 304, 403, 404, 503, 504, 603, 604, 703, 704, 1003, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\",\n \"n = 0..1 or n = 11..99 @integer 0, 1, 11~24 @decimal 0.0, 1.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0\",\n \"@integer 2~10, 100~106, 1000, 10000, 100000, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …\"\n ],\n \"cardinals\": {\n \"af\": \"one:0,other:1\",\n \"ak\": \"one:2,other:3\",\n \"am\": \"one:4,other:5\",\n \"an\": \"one:0,other:1\",\n \"ar\": \"zero:6,one:0,two:7,few:8,many:9,other:10\",\n \"ars\": \"zero:6,one:0,two:7,few:8,many:9,other:10\",\n \"as\": \"one:4,other:5\",\n \"asa\": \"one:0,other:1\",\n \"ast\": \"one:11,other:12\",\n \"az\": \"one:0,other:1\",\n \"be\": \"one:13,few:14,many:15,other:16\",\n \"bem\": \"one:0,other:1\",\n \"bez\": \"one:0,other:1\",\n \"bg\": \"one:0,other:1\",\n \"bho\": \"one:2,other:3\",\n \"bm\": \"other:17\",\n \"bn\": \"one:4,other:5\",\n \"bo\": \"other:17\",\n \"br\": \"one:18,two:19,few:20,many:21,other:22\",\n \"brx\": \"one:0,other:1\",\n \"bs\": \"one:23,few:24,other:25\",\n \"ca\": \"one:11,other:12\",\n \"ce\": \"one:0,other:1\",\n \"ceb\": \"one:26,other:27\",\n \"cgg\": \"one:0,other:1\",\n \"chr\": \"one:0,other:1\",\n \"ckb\": \"one:0,other:1\",\n \"cs\": \"one:11,few:28,many:29,other:30\",\n \"cy\": \"zero:6,one:0,two:7,few:31,many:32,other:33\",\n \"da\": \"one:34,other:35\",\n \"de\": \"one:11,other:12\",\n \"dsb\": \"one:36,two:37,few:38,other:25\",\n \"dv\": \"one:0,other:1\",\n \"dz\": \"other:17\",\n \"ee\": \"one:0,other:1\",\n \"el\": \"one:0,other:1\",\n \"en\": \"one:11,other:12\",\n \"eo\": \"one:0,other:1\",\n \"es\": \"one:0,other:1\",\n \"et\": \"one:11,other:12\",\n \"eu\": \"one:0,other:1\",\n \"fa\": \"one:4,other:5\",\n \"ff\": \"one:39,other:40\",\n \"fi\": \"one:11,other:12\",\n \"fil\": \"one:26,other:27\",\n \"fo\": \"one:0,other:1\",\n \"fr\": \"one:39,other:40\",\n \"fur\": \"one:0,other:1\",\n \"fy\": \"one:11,other:12\",\n \"ga\": \"one:0,two:7,few:41,many:42,other:43\",\n \"gd\": \"one:44,two:45,few:46,other:47\",\n \"gl\": \"one:11,other:12\",\n \"gsw\": \"one:0,other:1\",\n \"gu\": \"one:4,other:5\",\n \"guw\": \"one:2,other:3\",\n \"gv\": \"one:48,two:49,few:50,many:29,other:51\",\n \"ha\": \"one:0,other:1\",\n \"haw\": \"one:0,other:1\",\n \"he\": \"one:11,two:52,many:53,other:54\",\n \"hi\": \"one:4,other:5\",\n \"hr\": \"one:23,few:24,other:25\",\n \"hsb\": \"one:36,two:37,few:38,other:25\",\n \"hu\": \"one:0,other:1\",\n \"hy\": \"one:39,other:40\",\n \"ia\": \"one:11,other:12\",\n \"id\": \"other:17\",\n \"ig\": \"other:17\",\n \"ii\": \"other:17\",\n \"in\": \"other:17\",\n \"io\": \"one:11,other:12\",\n \"is\": \"one:55,other:56\",\n \"it\": \"one:11,other:12\",\n \"iu\": \"one:0,two:7,other:57\",\n \"iw\": \"one:11,two:52,many:53,other:54\",\n \"ja\": \"other:17\",\n \"jbo\": \"other:17\",\n \"jgo\": \"one:0,other:1\",\n \"ji\": \"one:11,other:12\",\n \"jmc\": \"one:0,other:1\",\n \"jv\": \"other:17\",\n \"jw\": \"other:17\",\n \"ka\": \"one:0,other:1\",\n \"kab\": \"one:39,other:40\",\n \"kaj\": \"one:0,other:1\",\n \"kcg\": \"one:0,other:1\",\n \"kde\": \"other:17\",\n \"kea\": \"other:17\",\n \"kk\": \"one:0,other:1\",\n \"kkj\": \"one:0,other:1\",\n \"kl\": \"one:0,other:1\",\n \"km\": \"other:17\",\n \"kn\": \"one:4,other:5\",\n \"ko\": \"other:17\",\n \"ks\": \"one:0,other:1\",\n \"ksb\": \"one:0,other:1\",\n \"ksh\": \"zero:6,one:0,other:3\",\n \"ku\": \"one:0,other:1\",\n \"kw\": \"zero:6,one:0,two:58,few:59,many:60,other:61\",\n \"ky\": \"one:0,other:1\",\n \"lag\": \"zero:6,one:62,other:40\",\n \"lb\": \"one:0,other:1\",\n \"lg\": \"one:0,other:1\",\n \"lkt\": \"other:17\",\n \"ln\": \"one:2,other:3\",\n \"lo\": \"other:17\",\n \"lt\": \"one:63,few:64,many:65,other:66\",\n \"lv\": \"zero:67,one:68,other:69\",\n \"mas\": \"one:0,other:1\",\n \"mg\": \"one:2,other:3\",\n \"mgo\": \"one:0,other:1\",\n \"mk\": \"one:23,other:70\",\n \"ml\": \"one:0,other:1\",\n \"mn\": \"one:0,other:1\",\n \"mo\": \"one:11,few:71,other:72\",\n \"mr\": \"one:0,other:1\",\n \"ms\": \"other:17\",\n \"mt\": \"one:0,few:73,many:74,other:75\",\n \"my\": \"other:17\",\n \"nah\": \"one:0,other:1\",\n \"naq\": \"one:0,two:7,other:57\",\n \"nb\": \"one:0,other:1\",\n \"nd\": \"one:0,other:1\",\n \"ne\": \"one:0,other:1\",\n \"nl\": \"one:11,other:12\",\n \"nn\": \"one:0,other:1\",\n \"nnh\": \"one:0,other:1\",\n \"no\": \"one:0,other:1\",\n \"nqo\": \"other:17\",\n \"nr\": \"one:0,other:1\",\n \"nso\": \"one:2,other:3\",\n \"ny\": \"one:0,other:1\",\n \"nyn\": \"one:0,other:1\",\n \"om\": \"one:0,other:1\",\n \"or\": \"one:0,other:1\",\n \"os\": \"one:0,other:1\",\n \"osa\": \"other:17\",\n \"pa\": \"one:2,other:3\",\n \"pap\": \"one:0,other:1\",\n \"pl\": \"one:11,few:76,many:77,other:78\",\n \"prg\": \"zero:67,one:68,other:69\",\n \"ps\": \"one:0,other:1\",\n \"pt\": \"one:79,other:40\",\n \"pt-pt\": \"one:11,other:12\",\n \"rm\": \"one:0,other:1\",\n \"ro\": \"one:11,few:71,other:72\",\n \"rof\": \"one:0,other:1\",\n \"root\": \"other:17\",\n \"ru\": \"one:80,few:76,many:81,other:78\",\n \"rwk\": \"one:0,other:1\",\n \"sah\": \"other:17\",\n \"saq\": \"one:0,other:1\",\n \"sc\": \"one:11,other:12\",\n \"scn\": \"one:11,other:12\",\n \"sd\": \"one:0,other:1\",\n \"sdh\": \"one:0,other:1\",\n \"se\": \"one:0,two:7,other:57\",\n \"seh\": \"one:0,other:1\",\n \"ses\": \"other:17\",\n \"sg\": \"other:17\",\n \"sh\": \"one:23,few:24,other:25\",\n \"shi\": \"one:4,few:82,other:83\",\n \"si\": \"one:84,other:85\",\n \"sk\": \"one:11,few:28,many:29,other:30\",\n \"sl\": \"one:86,two:87,few:88,other:30\",\n \"sma\": \"one:0,two:7,other:57\",\n \"smi\": \"one:0,two:7,other:57\",\n \"smj\": \"one:0,two:7,other:57\",\n \"smn\": \"one:0,two:7,other:57\",\n \"sms\": \"one:0,two:7,other:57\",\n \"sn\": \"one:0,other:1\",\n \"so\": \"one:0,other:1\",\n \"sq\": \"one:0,other:1\",\n \"sr\": \"one:23,few:24,other:25\",\n \"ss\": \"one:0,other:1\",\n \"ssy\": \"one:0,other:1\",\n \"st\": \"one:0,other:1\",\n \"su\": \"other:17\",\n \"sv\": \"one:11,other:12\",\n \"sw\": \"one:11,other:12\",\n \"syr\": \"one:0,other:1\",\n \"ta\": \"one:0,other:1\",\n \"te\": \"one:0,other:1\",\n \"teo\": \"one:0,other:1\",\n \"th\": \"other:17\",\n \"ti\": \"one:2,other:3\",\n \"tig\": \"one:0,other:1\",\n \"tk\": \"one:0,other:1\",\n \"tl\": \"one:26,other:27\",\n \"tn\": \"one:0,other:1\",\n \"to\": \"other:17\",\n \"tr\": \"one:0,other:1\",\n \"ts\": \"one:0,other:1\",\n \"tzm\": \"one:89,other:90\",\n \"ug\": \"one:0,other:1\",\n \"uk\": \"one:80,few:76,many:81,other:78\",\n \"ur\": \"one:11,other:12\",\n \"uz\": \"one:0,other:1\",\n \"ve\": \"one:0,other:1\",\n \"vi\": \"other:17\",\n \"vo\": \"one:0,other:1\",\n \"vun\": \"one:0,other:1\",\n \"wa\": \"one:2,other:3\",\n \"wae\": \"one:0,other:1\",\n \"wo\": \"other:17\",\n \"xh\": \"one:0,other:1\",\n \"xog\": \"one:0,other:1\",\n \"yi\": \"one:11,other:12\",\n \"yo\": \"other:17\",\n \"yue\": \"other:17\",\n \"zh\": \"other:17\",\n \"zu\": \"one:4,other:5\"\n }\n}","import {\n getPluralRulesForCardinals, getPluralFormForCardinal,\n setPluralFormsForCardinals, populatePluralData,\n getSupportedLocales, getPluralFormsForLocale\n} from './code.js'\nimport pluralData from './data.js'\n\npopulatePluralData(pluralData)\n\nexport {\n getPluralRulesForCardinals, getPluralFormForCardinal,\n setPluralFormsForCardinals,\n getSupportedLocales, getPluralFormsForLocale\n}\n"],"names":["supportedLocales","parsePluralForms","serializedForms","split","reduce","result","serializedForm","parts","indexPluralForms","forms","rules","Object","keys","formName","rule","trim","replace","ruleIndex","indexOf","length","push","substr","cardinals","normalizeLocale","locale","toLowerCase","getLanguage","separator","getPluralRulesForCardinals","language","undefined","Error","getPluralFormForCardinal","count","form","parsePluralRule","setPluralFormsForCardinals","populatePluralData","data","getSupportedLocales","getPluralFormsForLocale","cardinal","map","substring","pluralData"],"mappings":"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,yIACA,sRACA,kJACA,iKACA,oGACA,iDACA,iKACA,gJACA,4DACA,iLACA,8OACA,oOACA,sFACA,8IACA,2IACA,uDACA,sIACA,8HACA,uIACA,2GACA,qJACA,yEACA,0CACA,8FACA,uIACA,0HACA,uIACA,iIACA,sIACA,+EACA,+EACA,yMACA,oJACA,0IACD,CACD,UAAa,CACX,GAAM,gBACN,GAAM,gBACN,GAAM,gBACN,GAAM,gBACN,GAAM,2CACN,IAAO,2CACP,GAAM,gBACN,IAAO,gBACP,IAAO,kBACP,GAAM,gBACN,GAAM,iCACN,IAAO,gBACP,IAAO,gBACP,GAAM,gBACN,IAAO,gBACP,GAAM,WACN,GAAM,gBACN,GAAM,WACN,GAAM,wCACN,IAAO,gBACP,GAAM,yBACN,GAAM,kBACN,GAAM,gBACN,IAAO,kBACP,IAAO,gBACP,IAAO,gBACP,IAAO,gBACP,GAAM,iCACN,GAAM,6CACN,GAAM,kBACN,GAAM,kBACN,IAAO,gCACP,GAAM,gBACN,GAAM,WACN,GAAM,gBACN,GAAM,gBACN,GAAM,kBACN,GAAM,gBACN,GAAM,gBACN,GAAM,kBACN,GAAM,gBACN,GAAM,gBACN,GAAM,kBACN,GAAM,kBACN,IAAO,kBACP,GAAM,gBACN,GAAM,kBACN,IAAO,gBACP,GAAM,kBACN,GAAM,sCACN,GAAM,gCACN,GAAM,kBACN,IAAO,gBACP,GAAM,gBACN,IAAO,gBACP,GAAM,wCACN,GAAM,gBACN,IAAO,gBACP,GAAM,iCACN,GAAM,gBACN,GAAM,yBACN,IAAO,gCACP,GAAM,gBACN,GAAM,kBACN,GAAM,kBACN,GAAM,WACN,GAAM,WACN,GAAM,WACN,GAAM,WACN,GAAM,kBACN,GAAM,kBACN,GAAM,kBACN,GAAM,uBACN,GAAM,iCACN,GAAM,WACN,IAAO,WACP,IAAO,gBACP,GAAM,kBACN,IAAO,gBACP,GAAM,WACN,GAAM,WACN,GAAM,gBACN,IAAO,kBACP,IAAO,gBACP,IAAO,gBACP,IAAO,WACP,IAAO,WACP,GAAM,gBACN,IAAO,gBACP,GAAM,gBACN,GAAM,WACN,GAAM,gBACN,GAAM,WACN,GAAM,gBACN,IAAO,gBACP,IAAO,uBACP,GAAM,gBACN,GAAM,8CACN,GAAM,gBACN,IAAO,yBACP,GAAM,gBACN,GAAM,gBACN,IAAO,WACP,GAAM,gBACN,GAAM,WACN,GAAM,iCACN,GAAM,0BACN,IAAO,gBACP,GAAM,gBACN,IAAO,gBACP,GAAM,kBACN,GAAM,gBACN,GAAM,gBACN,GAAM,yBACN,GAAM,gBACN,GAAM,WACN,GAAM,gCACN,GAAM,WACN,IAAO,gBACP,IAAO,uBACP,GAAM,gBACN,GAAM,gBACN,GAAM,gBACN,GAAM,kBACN,GAAM,gBACN,IAAO,gBACP,GAAM,gBACN,IAAO,WACP,GAAM,gBACN,IAAO,gBACP,GAAM,gBACN,IAAO,gBACP,GAAM,gBACN,GAAM,gBACN,GAAM,gBACN,IAAO,WACP,GAAM,gBACN,IAAO,gBACP,GAAM,iCACN,IAAO,0BACP,GAAM,gBACN,GAAM,kBACN,QAAS,kBACT,GAAM,gBACN,GAAM,yBACN,IAAO,gBACP,KAAQ,WACR,GAAM,iCACN,IAAO,gBACP,IAAO,WACP,IAAO,gBACP,GAAM,kBACN,IAAO,kBACP,GAAM,gBACN,IAAO,gBACP,GAAM,uBACN,IAAO,gBACP,IAAO,WACP,GAAM,WACN,GAAM,yBACN,IAAO,wBACP,GAAM,kBACN,GAAM,iCACN,GAAM,gCACN,IAAO,uBACP,IAAO,uBACP,IAAO,uBACP,IAAO,uBACP,IAAO,uBACP,GAAM,gBACN,GAAM,gBACN,GAAM,gBACN,GAAM,yBACN,GAAM,gBACN,IAAO,gBACP,GAAM,gBACN,GAAM,WACN,GAAM,kBACN,GAAM,kBACN,IAAO,gBACP,GAAM,gBACN,GAAM,gBACN,IAAO,gBACP,GAAM,WACN,GAAM,gBACN,IAAO,gBACP,GAAM,gBACN,GAAM,kBACN,GAAM,gBACN,GAAM,WACN,GAAM,gBACN,GAAM,gBACN,IAAO,kBACP,GAAM,gBACN,GAAM,iCACN,GAAM,kBACN,GAAM,gBACN,GAAM,gBACN,GAAM,WACN,GAAM,gBACN,IAAO,gBACP,GAAM,gBACN,IAAO,gBACP,GAAM,WACN,GAAM,gBACN,IAAO,gBACP,GAAM,kBACN,GAAM,WACN,IAAO,WACP,GAAM,WACN,GAAM,eACP,CACH,EChTAP,mBAAmBO"}