{"version":3,"file":"intl-messageformat.min.js","sources":["../lib/compiler.js","../node_modules/intl-messageformat-parser/src/parser.js","../lib/core.js"],"sourcesContent":["/*\nCopyright (c) 2014, Yahoo! Inc. All rights reserved.\nCopyrights licensed under the New BSD License.\nSee the accompanying LICENSE file for terms.\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Compiler = /** @class */ (function () {\n function Compiler(locales, formats) {\n this.locales = [];\n this.formats = {\n number: {},\n date: {},\n time: {}\n };\n this.pluralNumberFormat = null;\n this.currentPlural = null;\n this.pluralStack = [];\n this.locales = locales;\n this.formats = formats;\n }\n Compiler.prototype.compile = function (ast) {\n this.pluralStack = [];\n this.currentPlural = null;\n this.pluralNumberFormat = null;\n return this.compileMessage(ast);\n };\n Compiler.prototype.compileMessage = function (ast) {\n var _this = this;\n if (!(ast && ast.type === 'messageFormatPattern')) {\n throw new Error('Message AST is not of type: \"messageFormatPattern\"');\n }\n var elements = ast.elements;\n var pattern = elements\n .filter(function (el) {\n return el.type === 'messageTextElement' || el.type === 'argumentElement';\n })\n .map(function (el) {\n return el.type === 'messageTextElement'\n ? _this.compileMessageText(el)\n : _this.compileArgument(el);\n });\n if (pattern.length !== elements.length) {\n throw new Error('Message element does not have a valid type');\n }\n return pattern;\n };\n Compiler.prototype.compileMessageText = function (element) {\n // When this `element` is part of plural sub-pattern and its value contains\n // an unescaped '#', use a `PluralOffsetString` helper to properly output\n // the number with the correct offset in the string.\n if (this.currentPlural && /(^|[^\\\\])#/g.test(element.value)) {\n // Create a cache a NumberFormat instance that can be reused for any\n // PluralOffsetString instance in this message.\n if (!this.pluralNumberFormat) {\n this.pluralNumberFormat = new Intl.NumberFormat(this.locales);\n }\n return new PluralOffsetString(this.currentPlural.id, this.currentPlural.format.offset, this.pluralNumberFormat, element.value);\n }\n // Unescape the escaped '#'s in the message text.\n return element.value.replace(/\\\\#/g, '#');\n };\n Compiler.prototype.compileArgument = function (element) {\n var format = element.format, id = element.id;\n if (!format) {\n return new StringFormat(id);\n }\n var _a = this, formats = _a.formats, locales = _a.locales;\n switch (format.type) {\n case 'numberFormat':\n return {\n id: id,\n format: new Intl.NumberFormat(locales, formats.number[format.style])\n .format\n };\n case 'dateFormat':\n return {\n id: id,\n format: new Intl.DateTimeFormat(locales, formats.date[format.style])\n .format\n };\n case 'timeFormat':\n return {\n id: id,\n format: new Intl.DateTimeFormat(locales, formats.time[format.style])\n .format\n };\n case 'pluralFormat':\n return new PluralFormat(id, format.ordinal, format.offset, this.compileOptions(element), locales);\n case 'selectFormat':\n return new SelectFormat(id, this.compileOptions(element));\n default:\n throw new Error('Message element does not have a valid format type');\n }\n };\n Compiler.prototype.compileOptions = function (element) {\n var _this = this;\n var format = element.format;\n var options = format.options;\n // Save the current plural element, if any, then set it to a new value when\n // compiling the options sub-patterns. This conforms the spec's algorithm\n // for handling `\"#\"` syntax in message text.\n this.pluralStack.push(this.currentPlural);\n this.currentPlural = format.type === 'pluralFormat' ? element : null;\n var optionsHash = options.reduce(function (all, option) {\n // Compile the sub-pattern and save it under the options's selector.\n all[option.selector] = _this.compileMessage(option.value);\n return all;\n }, {});\n // Pop the plural stack to put back the original current plural value.\n this.currentPlural = this.pluralStack.pop();\n return optionsHash;\n };\n return Compiler;\n}());\nexport default Compiler;\n// -- Compiler Helper Classes --------------------------------------------------\nvar Formatter = /** @class */ (function () {\n function Formatter(id) {\n this.id = id;\n }\n return Formatter;\n}());\nvar StringFormat = /** @class */ (function (_super) {\n __extends(StringFormat, _super);\n function StringFormat() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n StringFormat.prototype.format = function (value) {\n if (!value && typeof value !== 'number') {\n return '';\n }\n return typeof value === 'string' ? value : String(value);\n };\n return StringFormat;\n}(Formatter));\nexport { StringFormat };\nvar PluralFormat = /** @class */ (function () {\n function PluralFormat(id, useOrdinal, offset, options, locales) {\n this.id = id;\n this.offset = offset;\n this.options = options;\n this.pluralRules = new Intl.PluralRules(locales, {\n type: useOrdinal ? 'ordinal' : 'cardinal'\n });\n }\n PluralFormat.prototype.getOption = function (value) {\n var options = this.options;\n var option = options['=' + value] ||\n options[this.pluralRules.select(value - this.offset)];\n return option || options.other;\n };\n return PluralFormat;\n}());\nexport { PluralFormat };\nvar PluralOffsetString = /** @class */ (function (_super) {\n __extends(PluralOffsetString, _super);\n function PluralOffsetString(id, offset, numberFormat, string) {\n var _this = _super.call(this, id) || this;\n _this.offset = offset;\n _this.numberFormat = numberFormat;\n _this.string = string;\n return _this;\n }\n PluralOffsetString.prototype.format = function (value) {\n var number = this.numberFormat.format(value - this.offset);\n return this.string\n .replace(/(^|[^\\\\])#/g, '$1' + number)\n .replace(/\\\\#/g, '#');\n };\n return PluralOffsetString;\n}(Formatter));\nexport { PluralOffsetString };\nvar SelectFormat = /** @class */ (function () {\n function SelectFormat(id, options) {\n this.id = id;\n this.options = options;\n }\n SelectFormat.prototype.getOption = function (value) {\n var options = this.options;\n return options[value] || options.other;\n };\n return SelectFormat;\n}());\nexport { SelectFormat };\nexport function isSelectOrPluralFormat(f) {\n return !!f.options;\n}\n//# sourceMappingURL=compiler.js.map","export default /*\n * Generated by PEG.js 0.10.0.\n *\n * http://pegjs.org/\n */\n(function() {\n \"use strict\";\n\n function peg$subclass(child, parent) {\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n }\n\n function peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n }\n\n peg$subclass(peg$SyntaxError, Error);\n\n peg$SyntaxError.buildMessage = function(expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n \"class\": function(expectation) {\n var escapedParts = \"\",\n i;\n\n for (i = 0; i < expectation.parts.length; i++) {\n escapedParts += expectation.parts[i] instanceof Array\n ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])\n : classEscape(expectation.parts[i]);\n }\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n\n any: function(expectation) {\n return \"any character\";\n },\n\n end: function(expectation) {\n return \"end of input\";\n },\n\n other: function(expectation) {\n return expectation.description;\n }\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\^/g, '\\\\^')\n .replace(/-/g, '\\\\-')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = new Array(expected.length),\n i, j;\n\n for (i = 0; i < expected.length; i++) {\n descriptions[i] = describeExpectation(expected[i]);\n }\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n };\n\n function peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n\n var peg$FAILED = {},\n\n peg$startRuleFunctions = { start: peg$parsestart },\n peg$startRuleFunction = peg$parsestart,\n\n peg$c0 = function(elements) {\n return {\n type : 'messageFormatPattern',\n elements: elements,\n location: location()\n };\n },\n peg$c1 = function(chunks) {\n return chunks.reduce(function (all, chunk) {\n return all.concat(chunk)\n }, []).join('')\n },\n peg$c2 = function(messageText) {\n return {\n type : 'messageTextElement',\n value: messageText,\n location: location()\n };\n },\n peg$c3 = /^[^ \\t\\n\\r,.+={}#]/,\n peg$c4 = peg$classExpectation([\" \", \"\\t\", \"\\n\", \"\\r\", \",\", \".\", \"+\", \"=\", \"{\", \"}\", \"#\"], true, false),\n peg$c5 = \"{\",\n peg$c6 = peg$literalExpectation(\"{\", false),\n peg$c7 = \",\",\n peg$c8 = peg$literalExpectation(\",\", false),\n peg$c9 = \"}\",\n peg$c10 = peg$literalExpectation(\"}\", false),\n peg$c11 = function(id, format) {\n return {\n type : 'argumentElement',\n id : id,\n format: format && format[2],\n location: location()\n };\n },\n peg$c12 = \"number\",\n peg$c13 = peg$literalExpectation(\"number\", false),\n peg$c14 = \"date\",\n peg$c15 = peg$literalExpectation(\"date\", false),\n peg$c16 = \"time\",\n peg$c17 = peg$literalExpectation(\"time\", false),\n peg$c18 = function(type, style) {\n return {\n type : type + 'Format',\n style: style && style[2],\n location: location()\n };\n },\n peg$c19 = \"plural\",\n peg$c20 = peg$literalExpectation(\"plural\", false),\n peg$c21 = function(pluralStyle) {\n return {\n type : pluralStyle.type,\n ordinal: false,\n offset : pluralStyle.offset || 0,\n options: pluralStyle.options,\n location: location()\n };\n },\n peg$c22 = \"selectordinal\",\n peg$c23 = peg$literalExpectation(\"selectordinal\", false),\n peg$c24 = function(pluralStyle) {\n return {\n type : pluralStyle.type,\n ordinal: true,\n offset : pluralStyle.offset || 0,\n options: pluralStyle.options,\n location: location()\n }\n },\n peg$c25 = \"select\",\n peg$c26 = peg$literalExpectation(\"select\", false),\n peg$c27 = function(options) {\n return {\n type : 'selectFormat',\n options: options,\n location: location()\n };\n },\n peg$c28 = \"=\",\n peg$c29 = peg$literalExpectation(\"=\", false),\n peg$c30 = function(selector, pattern) {\n return {\n type : 'optionalFormatPattern',\n selector: selector,\n value : pattern,\n location: location()\n };\n },\n peg$c31 = \"offset:\",\n peg$c32 = peg$literalExpectation(\"offset:\", false),\n peg$c33 = function(number) {\n return number;\n },\n peg$c34 = function(offset, options) {\n return {\n type : 'pluralFormat',\n offset : offset,\n options: options,\n location: location()\n };\n },\n peg$c35 = peg$otherExpectation(\"whitespace\"),\n peg$c36 = /^[ \\t\\n\\r]/,\n peg$c37 = peg$classExpectation([\" \", \"\\t\", \"\\n\", \"\\r\"], false, false),\n peg$c38 = peg$otherExpectation(\"optionalWhitespace\"),\n peg$c39 = /^[0-9]/,\n peg$c40 = peg$classExpectation([[\"0\", \"9\"]], false, false),\n peg$c41 = /^[0-9a-f]/i,\n peg$c42 = peg$classExpectation([[\"0\", \"9\"], [\"a\", \"f\"]], false, true),\n peg$c43 = \"0\",\n peg$c44 = peg$literalExpectation(\"0\", false),\n peg$c45 = /^[1-9]/,\n peg$c46 = peg$classExpectation([[\"1\", \"9\"]], false, false),\n peg$c47 = function(digits) {\n return parseInt(digits, 10);\n },\n peg$c48 = /^[^{}\\\\\\0-\\x1F\\x7F \\t\\n\\r]/,\n peg$c49 = peg$classExpectation([\"{\", \"}\", \"\\\\\", [\"\\0\", \"\\x1F\"], \"\\x7F\", \" \", \"\\t\", \"\\n\", \"\\r\"], true, false),\n peg$c50 = \"\\\\\\\\\",\n peg$c51 = peg$literalExpectation(\"\\\\\\\\\", false),\n peg$c52 = function() { return '\\\\'; },\n peg$c53 = \"\\\\#\",\n peg$c54 = peg$literalExpectation(\"\\\\#\", false),\n peg$c55 = function() { return '\\\\#'; },\n peg$c56 = \"\\\\{\",\n peg$c57 = peg$literalExpectation(\"\\\\{\", false),\n peg$c58 = function() { return '\\u007B'; },\n peg$c59 = \"\\\\}\",\n peg$c60 = peg$literalExpectation(\"\\\\}\", false),\n peg$c61 = function() { return '\\u007D'; },\n peg$c62 = \"\\\\u\",\n peg$c63 = peg$literalExpectation(\"\\\\u\", false),\n peg$c64 = function(digits) {\n return String.fromCharCode(parseInt(digits, 16));\n },\n peg$c65 = function(chars) { return chars.join(''); },\n\n peg$currPos = 0,\n peg$savedPos = 0,\n peg$posDetailsCache = [{ line: 1, column: 1 }],\n peg$maxFailPos = 0,\n peg$maxFailExpected = [],\n peg$silentFails = 0,\n\n peg$result;\n\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n\n if (details) {\n return details;\n } else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos),\n endPosDetails = peg$computePosDetails(endPos);\n\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parsestart() {\n var s0;\n\n s0 = peg$parsemessageFormatPattern();\n\n return s0;\n }\n\n function peg$parsemessageFormatPattern() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsemessageFormatElement();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsemessageFormatElement();\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parsemessageFormatElement() {\n var s0;\n\n s0 = peg$parsemessageTextElement();\n if (s0 === peg$FAILED) {\n s0 = peg$parseargumentElement();\n }\n\n return s0;\n }\n\n function peg$parsemessageText() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$currPos;\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n s4 = peg$parsechars();\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s3 = [s3, s4, s5];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$currPos;\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n s4 = peg$parsechars();\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s3 = [s3, s4, s5];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c1(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsews();\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n }\n\n return s0;\n }\n\n function peg$parsemessageTextElement() {\n var s0, s1;\n\n s0 = peg$currPos;\n s1 = peg$parsemessageText();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c2(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseargument() {\n var s0, s1, s2;\n\n s0 = peg$parsenumber();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n if (peg$c3.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (peg$c3.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n }\n\n return s0;\n }\n\n function peg$parseargumentElement() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c5;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c6); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseargument();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 44) {\n s6 = peg$c7;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c8); }\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$parse_();\n if (s7 !== peg$FAILED) {\n s8 = peg$parseelementFormat();\n if (s8 !== peg$FAILED) {\n s6 = [s6, s7, s8];\n s5 = s6;\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n if (s5 === peg$FAILED) {\n s5 = null;\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s7 = peg$c9;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c10); }\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c11(s3, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseelementFormat() {\n var s0;\n\n s0 = peg$parsesimpleFormat();\n if (s0 === peg$FAILED) {\n s0 = peg$parsepluralFormat();\n if (s0 === peg$FAILED) {\n s0 = peg$parseselectOrdinalFormat();\n if (s0 === peg$FAILED) {\n s0 = peg$parseselectFormat();\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsesimpleFormat() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 6) === peg$c12) {\n s1 = peg$c12;\n peg$currPos += 6;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c13); }\n }\n if (s1 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c14) {\n s1 = peg$c14;\n peg$currPos += 4;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c15); }\n }\n if (s1 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c16) {\n s1 = peg$c16;\n peg$currPos += 4;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c17); }\n }\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 44) {\n s4 = peg$c7;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c8); }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsechars();\n if (s6 !== peg$FAILED) {\n s4 = [s4, s5, s6];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c18(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsepluralFormat() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 6) === peg$c19) {\n s1 = peg$c19;\n peg$currPos += 6;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c20); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s3 = peg$c7;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c8); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsepluralStyle();\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c21(s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseselectOrdinalFormat() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 13) === peg$c22) {\n s1 = peg$c22;\n peg$currPos += 13;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c23); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s3 = peg$c7;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c8); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsepluralStyle();\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c24(s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseselectFormat() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 6) === peg$c25) {\n s1 = peg$c25;\n peg$currPos += 6;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c26); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s3 = peg$c7;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c8); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseoptionalFormatPattern();\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseoptionalFormatPattern();\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c27(s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseselector() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 61) {\n s2 = peg$c28;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c29); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsenumber();\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parsechars();\n }\n\n return s0;\n }\n\n function peg$parseoptionalFormatPattern() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseselector();\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 123) {\n s4 = peg$c5;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c6); }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parsemessageFormatPattern();\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s6 = peg$c9;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c10); }\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c30(s2, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseoffset() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 7) === peg$c31) {\n s1 = peg$c31;\n peg$currPos += 7;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c32); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsenumber();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c33(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsepluralStyle() {\n var s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = peg$parseoffset();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseoptionalFormatPattern();\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseoptionalFormatPattern();\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c34(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsews() {\n var s0, s1;\n\n peg$silentFails++;\n s0 = [];\n if (peg$c36.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c37); }\n }\n if (s1 !== peg$FAILED) {\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (peg$c36.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c37); }\n }\n }\n } else {\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c35); }\n }\n\n return s0;\n }\n\n function peg$parse_() {\n var s0, s1, s2;\n\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsews();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsews();\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n\n return s0;\n }\n\n function peg$parsedigit() {\n var s0;\n\n if (peg$c39.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c40); }\n }\n\n return s0;\n }\n\n function peg$parsehexDigit() {\n var s0;\n\n if (peg$c41.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c42); }\n }\n\n return s0;\n }\n\n function peg$parsenumber() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 48) {\n s1 = peg$c43;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c44); }\n }\n if (s1 === peg$FAILED) {\n s1 = peg$currPos;\n s2 = peg$currPos;\n if (peg$c45.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c46); }\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parsedigit();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parsedigit();\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c47(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parsechar() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n if (peg$c48.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c49); }\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c50) {\n s1 = peg$c50;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c51); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c52();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c53) {\n s1 = peg$c53;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c54); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c55();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c56) {\n s1 = peg$c56;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c57); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c58();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c59) {\n s1 = peg$c59;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c60); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c61();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c62) {\n s1 = peg$c62;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c63); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$currPos;\n s4 = peg$parsehexDigit();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsehexDigit();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsehexDigit();\n if (s6 !== peg$FAILED) {\n s7 = peg$parsehexDigit();\n if (s7 !== peg$FAILED) {\n s4 = [s4, s5, s6, s7];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s2 = input.substring(s2, peg$currPos);\n } else {\n s2 = s3;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c64(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsechars() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsechar();\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsechar();\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c65(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n peg$result = peg$startRuleFunction();\n\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n }\n\n return {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n };\n})()","/*\nCopyright (c) 2014, Yahoo! Inc. All rights reserved.\nCopyrights licensed under the New BSD License.\nSee the accompanying LICENSE file for terms.\n*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\n/* jslint esnext: true */\nimport Compiler, { isSelectOrPluralFormat } from './compiler';\nimport parser from 'intl-messageformat-parser';\nfunction resolveLocale(locales) {\n if (typeof locales === 'string') {\n locales = [locales];\n }\n try {\n return Intl.NumberFormat.supportedLocalesOf(locales, {\n localeMatcher: 'lookup'\n })[0];\n }\n catch (e) {\n return MessageFormat.defaultLocale;\n }\n}\nfunction formatPatterns(pattern, values) {\n var result = '';\n for (var _i = 0, pattern_1 = pattern; _i < pattern_1.length; _i++) {\n var part = pattern_1[_i];\n // Exist early for string parts.\n if (typeof part === 'string') {\n result += part;\n continue;\n }\n var id = part.id;\n // Enforce that all required values are provided by the caller.\n if (!(values && id in values)) {\n throw new FormatError(\"A value must be provided for: \" + id, id);\n }\n var value = values[id];\n // Recursively format plural and select parts' option — which can be a\n // nested pattern structure. The choosing of the option to use is\n // abstracted-by and delegated-to the part helper object.\n if (isSelectOrPluralFormat(part)) {\n result += formatPatterns(part.getOption(value), values);\n }\n else {\n result += part.format(value);\n }\n }\n return result;\n}\nfunction mergeConfig(c1, c2) {\n if (!c2) {\n return c1;\n }\n return __assign({}, (c1 || {}), (c2 || {}), Object.keys(c1).reduce(function (all, k) {\n all[k] = __assign({}, c1[k], (c2[k] || {}));\n return all;\n }, {}));\n}\nfunction mergeConfigs(defaultConfig, configs) {\n if (!configs) {\n return defaultConfig;\n }\n return __assign({}, defaultConfig, { date: mergeConfig(defaultConfig.date, configs.date) });\n}\nvar FormatError = /** @class */ (function (_super) {\n __extends(FormatError, _super);\n function FormatError(msg, variableId) {\n var _this = _super.call(this, msg) || this;\n _this.variableId = variableId;\n return _this;\n }\n return FormatError;\n}(Error));\nvar MessageFormat = /** @class */ (function () {\n function MessageFormat(message, locales, overrideFormats) {\n var _this = this;\n if (locales === void 0) { locales = MessageFormat.defaultLocale; }\n // \"Bind\" `format()` method to `this` so it can be passed by reference like\n // the other `Intl` APIs.\n this.format = function (values) {\n try {\n return formatPatterns(_this.pattern, values);\n }\n catch (e) {\n if (e.variableId) {\n throw new Error(\"The intl string context variable '\" + e.variableId + \"' was not provided to the string '\" + _this.message + \"'\");\n }\n else {\n throw e;\n }\n }\n };\n // Parse string messages into an AST.\n var ast = typeof message === 'string' ? MessageFormat.__parse(message) : message;\n if (!(ast && ast.type === 'messageFormatPattern')) {\n throw new TypeError('A message must be provided as a String or AST.');\n }\n // Creates a new object with the specified `formats` merged with the default\n // formats.\n var formats = mergeConfigs(MessageFormat.formats, overrideFormats);\n // Defined first because it's used to build the format pattern.\n this._locale = resolveLocale(locales || []);\n // Compile the `ast` to a pattern that is highly optimized for repeated\n // `format()` invocations. **Note:** This passes the `locales` set provided\n // to the constructor instead of just the resolved locale.\n this.pattern = new Compiler(locales, formats).compile(ast);\n this.message = message;\n }\n MessageFormat.prototype.resolvedOptions = function () {\n return { locale: this._locale };\n };\n MessageFormat.defaultLocale = 'en';\n // Default format options used as the prototype of the `formats` provided to the\n // constructor. These are used when constructing the internal Intl.NumberFormat\n // and Intl.DateTimeFormat instances.\n MessageFormat.formats = {\n number: {\n currency: {\n style: 'currency'\n },\n percent: {\n style: 'percent'\n }\n },\n date: {\n short: {\n month: 'numeric',\n day: 'numeric',\n year: '2-digit'\n },\n medium: {\n month: 'short',\n day: 'numeric',\n year: 'numeric'\n },\n long: {\n month: 'long',\n day: 'numeric',\n year: 'numeric'\n },\n full: {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric'\n }\n },\n time: {\n short: {\n hour: 'numeric',\n minute: 'numeric'\n },\n medium: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n },\n long: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short'\n },\n full: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short'\n }\n }\n };\n MessageFormat.__parse = parser.parse;\n return MessageFormat;\n}());\nexport default MessageFormat;\n//# sourceMappingURL=core.js.map"],"names":["extendStatics","__extends","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__","this","constructor","prototype","create","Compiler","compile","ast","pluralStack","currentPlural","pluralNumberFormat","compileMessage","_this","type","Error","elements","pattern","filter","el","map","compileMessageText","compileArgument","length","element","test","value","Intl","NumberFormat","locales","PluralOffsetString","id","format","offset","replace","StringFormat","formats","number","style","DateTimeFormat","date","time","PluralFormat","ordinal","compileOptions","SelectFormat","options","push","optionsHash","reduce","all","option","selector","pop","Formatter","_super","String","apply","arguments","getOption","pluralRules","select","other","useOrdinal","PluralRules","numberFormat","string","call","child","parent","peg$SyntaxError","ctor","buildMessage","expected","found","DESCRIBE_EXPECTATION_FNS","literal","expectation","literalEscape","text","class","i","escapedParts","parts","classEscape","inverted","any","end","description","hex","ch","charCodeAt","toString","toUpperCase","s","j","descriptions","sort","slice","join","describeExpected","SyntaxError","parse","input","peg$result","location","peg$FAILED","peg$startRuleFunctions","start","peg$parsestart","peg$startRuleFunction","peg$c0","peg$c1","chunks","chunk","concat","peg$c2","messageText","peg$c3","peg$c4","peg$classExpectation","peg$c5","peg$c6","peg$literalExpectation","peg$c7","peg$c8","peg$c9","peg$c10","peg$c11","peg$c12","peg$c13","peg$c14","peg$c15","peg$c16","peg$c17","peg$c18","peg$c19","peg$c20","peg$c21","pluralStyle","peg$c22","peg$c23","peg$c24","peg$c25","peg$c26","peg$c27","peg$c28","peg$c29","peg$c30","peg$c31","peg$c32","peg$c33","peg$c34","peg$c35","peg$otherExpectation","peg$c36","peg$c37","peg$c38","peg$c39","peg$c40","peg$c41","peg$c42","peg$c43","peg$c44","peg$c45","peg$c46","peg$c47","digits","parseInt","peg$c48","peg$c49","peg$c50","peg$c51","peg$c52","peg$c53","peg$c54","peg$c55","peg$c56","peg$c57","peg$c58","peg$c59","peg$c60","peg$c61","peg$c62","peg$c63","peg$c64","fromCharCode","peg$c65","chars","peg$currPos","peg$savedPos","peg$posDetailsCache","line","column","peg$maxFailPos","peg$maxFailExpected","peg$silentFails","startRule","peg$computeLocation","ignoreCase","peg$computePosDetails","pos","details","startPos","endPos","startPosDetails","endPosDetails","peg$fail","peg$parsemessageFormatPattern","s0","s1","s2","peg$parsemessageFormatElement","s3","s4","s5","peg$parse_","peg$parsechars","peg$parsews","substring","peg$parsemessageText","peg$parsemessageTextElement","s6","s7","s8","peg$parsenumber","charAt","peg$parseargument","substr","peg$parsesimpleFormat","peg$parsepluralStyle","peg$parsepluralFormat","peg$parseselectOrdinalFormat","peg$parseoptionalFormatPattern","peg$parseselectFormat","peg$parseelementFormat","peg$parseargumentElement","peg$parseselector","peg$parseoffset","peg$parsedigit","peg$parsehexDigit","peg$parsechar","message","name","captureStackTrace","__assign","assign","t","n","mergeConfigs","defaultConfig","configs","c1","c2","keys","k","mergeConfig","FormatError","msg","variableId","MessageFormat","resolvedOptions","locale","_locale","defaultLocale","currency","percent","short","month","day","year","medium","long","full","weekday","hour","minute","second","timeZoneName","__parse","parser","overrideFormats","values","formatPatterns","result","_i","pattern_1","part","e","TypeError","supportedLocalesOf","localeMatcher","resolveLocale"],"mappings":"uMAKA,IACQA,EADJC,GACID,EAAgB,SAAUE,EAAGC,GAI7B,OAHAH,EAAgBI,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,MACpDN,EAAGC,IAErB,SAAUD,EAAGC,GAEhB,SAASO,IAAOC,KAAKC,YAAcV,EADnCF,EAAcE,EAAGC,GAEjBD,EAAEW,UAAkB,OAANV,EAAaC,OAAOU,OAAOX,IAAMO,EAAGG,UAAYV,EAAEU,UAAW,IAAIH,KAGnFK,GAcAA,EAASF,UAAUG,QAAU,SAAUC,GAInC,OAHAN,KAAKO,YAAc,GACnBP,KAAKQ,cAAgB,KACrBR,KAAKS,mBAAqB,KACnBT,KAAKU,eAAeJ,IAE/BF,EAASF,UAAUQ,eAAiB,SAAUJ,GAC1C,IAAIK,EAAQX,KACZ,IAAMM,GAAoB,yBAAbA,EAAIM,KACb,MAAM,IAAIC,MAAM,sDAEpB,IAAIC,EAAWR,EAAIQ,SACfC,EAAUD,EACTE,OAAO,SAAUC,GAClB,MAAmB,uBAAZA,EAAGL,MAA6C,oBAAZK,EAAGL,OAE7CM,IAAI,SAAUD,GACf,MAAmB,uBAAZA,EAAGL,KACJD,EAAMQ,mBAAmBF,GACzBN,EAAMS,gBAAgBH,KAEhC,GAAIF,EAAQM,SAAWP,EAASO,OAC5B,MAAM,IAAIR,MAAM,8CAEpB,OAAOE,GAEXX,EAASF,UAAUiB,mBAAqB,SAAUG,GAI9C,OAAItB,KAAKQ,eAAiB,cAAce,KAAKD,EAAQE,QAG5CxB,KAAKS,qBACNT,KAAKS,mBAAqB,IAAIgB,KAAKC,aAAa1B,KAAK2B,UAElD,IAAIC,EAAmB5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