text: // @ts-nocheck
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = function (d, b) {
          extendStatics = Object.setPrototypeOf ||
              ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
              function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
          return extendStatics(d, b);
      };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  var __assign = (this && this.__assign) || function () {
      __assign = Object.assign || function(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                  t[p] = s[p];
          }
          return t;
      };
      return __assign.apply(this, arguments);
  };
  // @generated
  import { TYPE, } from './types';
  import { parseDateTimeSkeleton, parseNumberSkeleton } from './skeleton';
  var SyntaxError = /** @class */ (function (_super) {
      __extends(SyntaxError, _super);
      function SyntaxError(message, expected, found, location) {
          var _this = _super.call(this) || this;
          _this.message = message;
          _this.expected = expected;
          _this.found = found;
          _this.location = location;
          _this.name = "SyntaxError";
          if (typeof Error.captureStackTrace === "function") {
              Error.captureStackTrace(_this, SyntaxError);
          }
          return _this;
      }
      SyntaxError.buildMessage = function (expected, found) {
          function hex(ch) {
              return ch.charCodeAt(0).toString(16).toUpperCase();
          }
          function literalEscape(s) {
              return s
                  .replace(/\\/g, "\\\\")
                  .replace(/"/g, "\\\"")
                  .replace(/\0/g, "\\0")
                  .replace(/\t/g, "\\t")
                  .replace(/\n/g, "\\n")
                  .replace(/\r/g, "\\r")
                  .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
                  .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
          }
          function classEscape(s) {
              return s
                  .replace(/\\/g, "\\\\")
                  .replace(/\]/g, "\\]")
                  .replace(/\^/g, "\\^")
                  .replace(/-/g, "\\-")
                  .replace(/\0/g, "\\0")
                  .replace(/\t/g, "\\t")
                  .replace(/\n/g, "\\n")
                  .replace(/\r/g, "\\r")
                  .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
                  .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
          }
          function describeExpectation(expectation) {
              switch (expectation.type) {
                  case "literal":
                      return "\"" + literalEscape(expectation.text) + "\"";
                  case "class":
                      var escapedParts = expectation.parts.map(function (part) {
                          return Array.isArray(part)
                              ? classEscape(part[0]) + "-" + classEscape(part[1])
                              : classEscape(part);
                      });
                      return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
                  case "any":
                      return "any character";
                  case "end":
                      return "end of input";
                  case "other":
                      return expectation.description;
              }
          }
          function describeExpected(expected1) {
              var descriptions = expected1.map(describeExpectation);
              var i;
              var j;
              descriptions.sort();
              if (descriptions.length > 0) {
                  for (i = 1, j = 1; i < descriptions.length; i++) {
                      if (descriptions[i - 1] !== descriptions[i]) {
                          descriptions[j] = descriptions[i];
                          j++;
                      }
                  }
                  descriptions.length = j;
              }
              switch (descriptions.length) {
                  case 1:
                      return descriptions[0];
                  case 2:
                      return descriptions[0] + " or " + descriptions[1];
                  default:
                      return descriptions.slice(0, -1).join(", ")
                          + ", or "
                          + descriptions[descriptions.length - 1];
              }
          }
          function describeFound(found1) {
              return found1 ? "\"" + literalEscape(found1) + "\"" : "end of input";
          }
          return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
      };
      return SyntaxError;
  }(Error));
  export { SyntaxError };
  function peg$parse(input, options) {
      options = options !== undefined ? options : {};
      var peg$FAILED = {};
      var peg$startRuleFunctions = { start: peg$parsestart };
      var peg$startRuleFunction = peg$parsestart;
      var peg$c0 = function () { return !ignoreTag; };
      var peg$c1 = function (x) { return x; };
      var peg$c2 = function () { return ignoreTag; };
      var peg$c3 = "<";
      var peg$c4 = peg$literalExpectation("<", false);
      var peg$c5 = function (parts) {
          return parts.join('');
      };
      var peg$c6 = function () { return '<'; };
      var peg$c7 = function (messageText) {
          return __assign({ type: TYPE.literal, value: messageText }, insertLocation());
      };
      var peg$c8 = "#";
      var peg$c9 = peg$literalExpectation("#", false);
      var peg$c10 = function () {
          return __assign({ type: TYPE.pound }, insertLocation());
      };
      var peg$c11 = peg$otherExpectation("tagElement");
      var peg$c12 = function (open, children, close) {
          if (open !== close) {
              error("Mismatch tag \"" + open + "\" !== \"" + close + "\"", location());
          }
          return __assign({ type: TYPE.tag, value: open, children: children }, insertLocation());
      };
      var peg$c13 = "/>";
      var peg$c14 = peg$literalExpectation("/>", false);
      var peg$c15 = function (value) {
          return __assign({ type: TYPE.literal, value: value.join('') }, insertLocation());
      };
      var peg$c16 = ">";
      var peg$c17 = peg$literalExpectation(">", false);
      var peg$c18 = function (tag) { return tag; };
      var peg$c19 = "</";
      var peg$c20 = peg$literalExpectation("</", false);
      var peg$c21 = peg$otherExpectation("argumentElement");
      var peg$c22 = "{";
      var peg$c23 = peg$literalExpectation("{", false);
      var peg$c24 = "}";
      var peg$c25 = peg$literalExpectation("}", false);
      var peg$c26 = function (value) {
          return __assign({ type: TYPE.argument, value: value }, insertLocation());
      };
      var peg$c27 = peg$otherExpectation("numberSkeletonId");
      var peg$c28 = /^['\/{}]/;
      var peg$c29 = peg$classExpectation(["'", "/", "{", "}"], false, false);
      var peg$c30 = peg$anyExpectation();
      var peg$c31 = peg$otherExpectation("numberSkeletonTokenOption");
      var peg$c32 = "/";
      var peg$c33 = peg$literalExpectation("/", false);
      var peg$c34 = function (option) { return option; };
      var peg$c35 = peg$otherExpectation("numberSkeletonToken");
      var peg$c36 = function (stem, options) {
          return { stem: stem, options: options };
      };
      var peg$c37 = function (tokens) {
          return __assign({ type: 0 /* number */, tokens: tokens, parsedOptions: shouldParseSkeleton ? parseNumberSkeleton(tokens) : {} }, insertLocation());
      };
      var peg$c38 = "::";
      var peg$c39 = peg$literalExpectation("::", false);
      var peg$c40 = function (skeleton) { return skeleton; };
      var peg$c41 = function () { messageCtx.push('numberArgStyle'); return true; };
      var peg$c42 = function (style) {
          messageCtx.pop();
          return style.replace(/\s*$/, '');
      };
      var peg$c43 = ",";
      var peg$c44 = peg$literalExpectation(",", false);
      var peg$c45 = "number";
      var peg$c46 = peg$literalExpectation("number", false);
      var peg$c47 = function (value, type, style) {
          return __assign({ type: type === 'number' ? TYPE.number : type === 'date' ? TYPE.date : TYPE.time, style: style && style[2], value: value }, insertLocation());
      };
      var peg$c48 = "'";
      var peg$c49 = peg$literalExpectation("'", false);
      var peg$c50 = /^[^']/;
      var peg$c51 = peg$classExpectation(["'"], true, false);
      var peg$c52 = /^[^a-zA-Z'{}]/;
      var peg$c53 = peg$classExpectation([["a", "z"], ["A", "Z"], "'", "{", "}"], true, false);
      var peg$c54 = /^[a-zA-Z]/;
      var peg$c55 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false);
      var peg$c56 = function (pattern) {
          return __assign({ type: 1 /* dateTime */, pattern: pattern, parsedOptions: shouldParseSkeleton ? parseDateTimeSkeleton(pattern) : {} }, insertLocation());
      };
      var peg$c57 = function () { messageCtx.push('dateOrTimeArgStyle'); return true; };
      var peg$c58 = "date";
      var peg$c59 = peg$literalExpectation("date", false);
      var peg$c60 = "time";
      var peg$c61 = peg$literalExpectation("time", false);
      var peg$c62 = "plural";
      var peg$c63 = peg$literalExpectation("plural", false);
      var peg$c64 = "selectordinal";
      var peg$c65 = peg$literalExpectation("selectordinal", false);
      var peg$c66 = "offset:";
      var peg$c67 = peg$literalExpectation("offset:", false);
      var peg$c68 = function (value, pluralType, offset, options) {
          return __assign({ type: TYPE.plural, pluralType: pluralType === 'plural' ? 'cardinal' : 'ordinal', value: value, offset: offset ? offset[2] : 0, options: options.reduce(function (all, _a) {
                  var id = _a.id, value = _a.value, optionLocation = _a.location;
                  if (id in all) {
                      error("Duplicate option \"" + id + "\" in plural element: \"" + text() + "\"", location());
                  }
                  all[id] = {
                      value: value,
                      location: optionLocation
                  };
                  return all;
              }, {}) }, insertLocation());
      };
      var peg$c69 = "select";
      var peg$c70 = peg$literalExpectation("select", false);
      var peg$c71 = function (value, options) {
          return __assign({ type: TYPE.select, value: value, options: options.reduce(function (all, _a) {
                  var id = _a.id, value = _a.value, optionLocation = _a.location;
                  if (id in all) {
                      error("Duplicate option \"" + id + "\" in select element: \"" + text() + "\"", location());
                  }
                  all[id] = {
                      value: value,
                      location: optionLocation
                  };
                  return all;
              }, {}) }, insertLocation());
      };
      var peg$c72 = "=";
      var peg$c73 = peg$literalExpectation("=", false);
      var peg$c74 = function (id) { messageCtx.push('select'); return true; };
      var peg$c75 = function (id, value) {
          messageCtx.pop();
          return __assign({ id: id,
              value: value }, insertLocation());
      };
      var peg$c76 = function (id) { messageCtx.push('plural'); return true; };
      var peg$c77 = function (id, value) {
          messageCtx.pop();
          return __assign({ id: id,
              value: value }, insertLocation());
      };
      var peg$c78 = peg$otherExpectation("whitespace");
      var peg$c79 = /^[\t-\r \x85\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;
      var peg$c80 = peg$classExpectation([["\t", "\r"], " ", "\x85", "\xA0", "\u1680", ["\u2000", "\u200A"], "\u2028", "\u2029", "\u202F", "\u205F", "\u3000"], false, false);
      var peg$c81 = peg$otherExpectation("syntax pattern");
      var peg$c82 = /^[!-\/:-@[-\^`{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]/;
      var peg$c83 = peg$classExpectation([["!", "/"], [":", "@"], ["[", "^"], "`", ["{", "~"], ["\xA1", "\xA7"], "\xA9", "\xAB", "\xAC", "\xAE", "\xB0", "\xB1", "\xB6", "\xBB", "\xBF", "\xD7", "\xF7", ["\u2010", "\u2027"], ["\u2030", "\u203E"], ["\u2041", "\u2053"], ["\u2055", "\u205E"], ["\u2190", "\u245F"], ["\u2500", "\u2775"], ["\u2794", "\u2BFF"], ["\u2E00", "\u2E7F"], ["\u3001", "\u3003"], ["\u3008", "\u3020"], "\u3030", "\uFD3E", "\uFD3F", "\uFE45", "\uFE46"], false, false);
      var peg$c84 = peg$otherExpectation("optional whitespace");
      var peg$c85 = peg$otherExpectation("number");
      var peg$c86 = "-";
      var peg$c87 = peg$literalExpectation("-", false);
      var peg$c88 = function (negative, num) {
          return num
              ? negative
                  ? -num
                  : num
              : 0;
      };
      var peg$c89 = peg$otherExpectation("apostrophe");
      var peg$c90 = peg$otherExpectation("double apostrophes");
      var peg$c91 = "''";
      var peg$c92 = peg$literalExpectation("''", false);
      var peg$c93 = function () { return "'"; };
      var peg$c94 = function (escapedChar, quotedChars) {
          return escapedChar + quotedChars.replace("''", "'");
      };
      var peg$c95 = function (x) {
          return (x !== '<' &&
              x !== '{' &&
              !(isInPluralOption() && x === '#') &&
              !(isNestedMessageText() && x === '}'));
      };
      var peg$c96 = "\n";
      var peg$c97 = peg$literalExpectation("\n", false);
      var peg$c98 = function (x) {
          return x === '<' || x === '>' || x === '{' || x === '}' || (isInPluralOption() && x === '#');
      };
      var peg$c99 = peg$otherExpectation("argNameOrNumber");
      var peg$c100 = peg$otherExpectation("validTag");
      var peg$c101 = peg$otherExpectation("argNumber");
      var peg$c102 = "0";
      var peg$c103 = peg$literalExpectation("0", false);
      var peg$c104 = function () { return 0; };
      var peg$c105 = /^[1-9]/;
      var peg$c106 = peg$classExpectation([["1", "9"]], false, false);
      var peg$c107 = /^[0-9]/;
      var peg$c108 = peg$classExpectation([["0", "9"]], false, false);
      var peg$c109 = function (digits) {
          return parseInt(digits.join(''), 10);
      };
      var peg$c110 = peg$otherExpectation("argName");
      var peg$c111 = peg$otherExpectation("tagName");
      var peg$currPos = 0;
      var peg$savedPos = 0;
      var peg$posDetailsCache = [{ line: 1, column: 1 }];
      var peg$maxFailPos = 0;
      var peg$maxFailExpected = [];
      var peg$silentFails = 0;
      var peg$result;
      if (options.startRule !== undefined) {
          if (!(options.startRule in peg$startRuleFunctions)) {
              throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
          }
          peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
      }
      function text() {
          return input.substring(peg$savedPos, peg$currPos);
      }
      function location() {
          return peg$computeLocation(peg$savedPos, peg$currPos);
      }
      function expected(description, location1) {
          location1 = location1 !== undefined
              ? location1
              : peg$computeLocation(peg$savedPos, peg$currPos);
          throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location1);
      }
      function error(message, location1) {
          location1 = location1 !== undefined
              ? location1
              : peg$computeLocation(peg$savedPos, peg$currPos);
          throw peg$buildSimpleError(message, location1);
      }
      function peg$literalExpectation(text1, ignoreCase) {
          return { type: "literal", text: text1, ignoreCase: ignoreCase };
      }
      function peg$classExpectation(parts, inverted, ignoreCase) {
          return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
      }
      function peg$anyExpectation() {
          return { type: "any" };
      }
      function peg$endExpectation() {
          return { type: "end" };
      }
      function peg$otherExpectation(description) {
          return { type: "other", description: description };
      }
      function peg$computePosDetails(pos) {
          var details = peg$posDetailsCache[pos];
          var p;
          if (details) {
              return details;
          }
          else {
              p = pos - 1;
              while (!peg$posDetailsCache[p]) {
                  p--;
              }
              details = peg$posDetailsCache[p];
              details = {
                  line: details.line,
                  column: details.column
              };
              while (p < pos) {
                  if (input.charCodeAt(p) === 10) {
                      details.line++;
                      details.column = 1;
                  }
                  else {
                      details.column++;
                  }
                  p++;
              }
              peg$posDetailsCache[pos] = details;
              return details;
          }
      }
      function peg$computeLocation(startPos, endPos) {
          var startPosDetails = peg$computePosDetails(startPos);
          var endPosDetails = peg$computePosDetails(endPos);
          return {
              start: {
                  offset: startPos,
                  line: startPosDetails.line,
                  column: startPosDetails.column
              },
              end: {
                  offset: endPos,
                  line: endPosDetails.line,
                  column: endPosDetails.column
              }
          };
      }
      function peg$fail(expected1) {
          if (peg$currPos < peg$maxFailPos) {
              return;
          }
          if (peg$currPos > peg$maxFailPos) {
              peg$maxFailPos = peg$currPos;
              peg$maxFailExpected = [];
          }
          peg$maxFailExpected.push(expected1);
      }
      function peg$buildSimpleError(message, location1) {
          return new SyntaxError(message, [], "", location1);
      }
      function peg$buildStructuredError(expected1, found, location1) {
          return new SyntaxError(SyntaxError.buildMessage(expected1, found), expected1, found, location1);
      }
      function peg$parsestart() {
          var s0;
          s0 = peg$parsemessage();
          return s0;
      }
      function peg$parsemessage() {
          var s0, s1;
          s0 = [];
          s1 = peg$parsemessageElement();
          while (s1 !== peg$FAILED) {
              s0.push(s1);
              s1 = peg$parsemessageElement();
          }
          return s0;
      }
      function peg$parsemessageElement() {
          var s0, s1, s2;
          s0 = peg$currPos;
          peg$savedPos = peg$currPos;
          s1 = peg$c0();
          if (s1) {
              s1 = undefined;
          }
          else {
              s1 = peg$FAILED;
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parsetagElement();
              if (s2 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c1(s2);
                  s0 = s1;
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          if (s0 === peg$FAILED) {
              s0 = peg$parseliteralElement();
              if (s0 === peg$FAILED) {
                  s0 = peg$parseargumentElement();
                  if (s0 === peg$FAILED) {
                      s0 = peg$parsesimpleFormatElement();
                      if (s0 === peg$FAILED) {
                          s0 = peg$parsepluralElement();
                          if (s0 === peg$FAILED) {
                              s0 = peg$parseselectElement();
                              if (s0 === peg$FAILED) {
                                  s0 = peg$parsepoundElement();
                              }
                          }
                      }
                  }
              }
          }
          return s0;
      }
      function peg$parsemessageText() {
          var s0, s1, s2, s3;
          s0 = peg$currPos;
          peg$savedPos = peg$currPos;
          s1 = peg$c2();
          if (s1) {
              s1 = undefined;
          }
          else {
              s1 = peg$FAILED;
          }
          if (s1 !== peg$FAILED) {
              s2 = [];
              s3 = peg$parsedoubleApostrophes();
              if (s3 === peg$FAILED) {
                  s3 = peg$parsequotedString();
                  if (s3 === peg$FAILED) {
                      s3 = peg$parseunquotedString();
                      if (s3 === peg$FAILED) {
                          if (input.charCodeAt(peg$currPos) === 60) {
                              s3 = peg$c3;
                              peg$currPos++;
                          }
                          else {
                              s3 = peg$FAILED;
                              if (peg$silentFails === 0) {
                                  peg$fail(peg$c4);
                              }
                          }
                      }
                  }
              }
              if (s3 !== peg$FAILED) {
                  while (s3 !== peg$FAILED) {
                      s2.push(s3);
                      s3 = peg$parsedoubleApostrophes();
                      if (s3 === peg$FAILED) {
                          s3 = peg$parsequotedString();
                          if (s3 === peg$FAILED) {
                              s3 = peg$parseunquotedString();
                              if (s3 === peg$FAILED) {
                                  if (input.charCodeAt(peg$currPos) === 60) {
                                      s3 = peg$c3;
                                      peg$currPos++;
                                  }
                                  else {
                                      s3 = peg$FAILED;
                                      if (peg$silentFails === 0) {
                                          peg$fail(peg$c4);
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
              else {
                  s2 = peg$FAILED;
              }
              if (s2 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c5(s2);
                  s0 = s1;
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          if (s0 === peg$FAILED) {
              s0 = peg$currPos;
              s1 = [];
              s2 = peg$parsedoubleApostrophes();
              if (s2 === peg$FAILED) {
                  s2 = peg$parsequotedString();
                  if (s2 === peg$FAILED) {
                      s2 = peg$parseunquotedString();
                      if (s2 === peg$FAILED) {
                          s2 = peg$parsenonTagStartingAngleBracket();
                      }
                  }
              }
              if (s2 !== peg$FAILED) {
                  while (s2 !== peg$FAILED) {
                      s1.push(s2);
                      s2 = peg$parsedoubleApostrophes();
                      if (s2 === peg$FAILED) {
                          s2 = peg$parsequotedString();
                          if (s2 === peg$FAILED) {
                              s2 = peg$parseunquotedString();
                              if (s2 === peg$FAILED) {
                                  s2 = peg$parsenonTagStartingAngleBracket();
                              }
                          }
                      }
                  }
              }
              else {
                  s1 = peg$FAILED;
              }
              if (s1 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c5(s1);
              }
              s0 = s1;
          }
          return s0;
      }
      function peg$parsenonTagStartingAngleBracket() {
          var s0, s1, s2;
          s0 = peg$currPos;
          s1 = peg$currPos;
          peg$silentFails++;
          s2 = peg$parseopeningTag();
          if (s2 === peg$FAILED) {
              s2 = peg$parseclosingTag();
              if (s2 === peg$FAILED) {
                  s2 = peg$parseselfClosingTag();
              }
          }
          peg$silentFails--;
          if (s2 === peg$FAILED) {
              s1 = undefined;
          }
          else {
              peg$currPos = s1;
              s1 = peg$FAILED;
          }
          if (s1 !== peg$FAILED) {
              if (input.charCodeAt(peg$currPos) === 60) {
                  s2 = peg$c3;
                  peg$currPos++;
              }
              else {
                  s2 = peg$FAILED;
                  if (peg$silentFails === 0) {
                      peg$fail(peg$c4);
                  }
              }
              if (s2 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c6();
                  s0 = s1;
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parseliteralElement() {
          var s0, s1;
          s0 = peg$currPos;
          s1 = peg$parsemessageText();
          if (s1 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c7(s1);
          }
          s0 = s1;
          return s0;
      }
      function peg$parsepoundElement() {
          var s0, s1;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 35) {
              s1 = peg$c8;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c9);
              }
          }
          if (s1 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c10();
          }
          s0 = s1;
          return s0;
      }
      function peg$parsetagElement() {
          var s0, s1, s2, s3;
          peg$silentFails++;
          s0 = peg$parseselfClosingTag();
          if (s0 === peg$FAILED) {
              s0 = peg$currPos;
              s1 = peg$parseopeningTag();
              if (s1 !== peg$FAILED) {
                  s2 = peg$parsemessage();
                  if (s2 !== peg$FAILED) {
                      s3 = peg$parseclosingTag();
                      if (s3 !== peg$FAILED) {
                          peg$savedPos = s0;
                          s1 = peg$c12(s1, s2, s3);
                          s0 = s1;
                      }
                      else {
                          peg$currPos = s0;
                          s0 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c11);
              }
          }
          return s0;
      }
      function peg$parseselfClosingTag() {
          var s0, s1, s2, s3, s4, s5;
          s0 = peg$currPos;
          s1 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 60) {
              s2 = peg$c3;
              peg$currPos++;
          }
          else {
              s2 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c4);
              }
          }
          if (s2 !== peg$FAILED) {
              s3 = peg$parsevalidTag();
              if (s3 !== peg$FAILED) {
                  s4 = peg$parse_();
                  if (s4 !== peg$FAILED) {
                      if (input.substr(peg$currPos, 2) === peg$c13) {
                          s5 = peg$c13;
                          peg$currPos += 2;
                      }
                      else {
                          s5 = peg$FAILED;
                          if (peg$silentFails === 0) {
                              peg$fail(peg$c14);
                          }
                      }
                      if (s5 !== peg$FAILED) {
                          s2 = [s2, s3, s4, s5];
                          s1 = s2;
                      }
                      else {
                          peg$currPos = s1;
                          s1 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s1;
                      s1 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s1;
                  s1 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s1;
              s1 = peg$FAILED;
          }
          if (s1 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c15(s1);
          }
          s0 = s1;
          return s0;
      }
      function peg$parseopeningTag() {
          var s0, s1, s2, s3;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 60) {
              s1 = peg$c3;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c4);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parsevalidTag();
              if (s2 !== peg$FAILED) {
                  if (input.charCodeAt(peg$currPos) === 62) {
                      s3 = peg$c16;
                      peg$currPos++;
                  }
                  else {
                      s3 = peg$FAILED;
                      if (peg$silentFails === 0) {
                          peg$fail(peg$c17);
                      }
                  }
                  if (s3 !== peg$FAILED) {
                      peg$savedPos = s0;
                      s1 = peg$c18(s2);
                      s0 = s1;
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parseclosingTag() {
          var s0, s1, s2, s3;
          s0 = peg$currPos;
          if (input.substr(peg$currPos, 2) === peg$c19) {
              s1 = peg$c19;
              peg$currPos += 2;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c20);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parsevalidTag();
              if (s2 !== peg$FAILED) {
                  if (input.charCodeAt(peg$currPos) === 62) {
                      s3 = peg$c16;
                      peg$currPos++;
                  }
                  else {
                      s3 = peg$FAILED;
                      if (peg$silentFails === 0) {
                          peg$fail(peg$c17);
                      }
                  }
                  if (s3 !== peg$FAILED) {
                      peg$savedPos = s0;
                      s1 = peg$c18(s2);
                      s0 = s1;
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parseargumentElement() {
          var s0, s1, s2, s3, s4, s5;
          peg$silentFails++;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 123) {
              s1 = peg$c22;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c23);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parse_();
              if (s2 !== peg$FAILED) {
                  s3 = peg$parseargNameOrNumber();
                  if (s3 !== peg$FAILED) {
                      s4 = peg$parse_();
                      if (s4 !== peg$FAILED) {
                          if (input.charCodeAt(peg$currPos) === 125) {
                              s5 = peg$c24;
                              peg$currPos++;
                          }
                          else {
                              s5 = peg$FAILED;
                              if (peg$silentFails === 0) {
                                  peg$fail(peg$c25);
                              }
                          }
                          if (s5 !== peg$FAILED) {
                              peg$savedPos = s0;
                              s1 = peg$c26(s3);
                              s0 = s1;
                          }
                          else {
                              peg$currPos = s0;
                              s0 = peg$FAILED;
                          }
                      }
                      else {
                          peg$currPos = s0;
                          s0 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c21);
              }
          }
          return s0;
      }
      function peg$parsenumberSkeletonId() {
          var s0, s1, s2, s3, s4;
          peg$silentFails++;
          s0 = peg$currPos;
          s1 = [];
          s2 = peg$currPos;
          s3 = peg$currPos;
          peg$silentFails++;
          s4 = peg$parsewhiteSpace();
          if (s4 === peg$FAILED) {
              if (peg$c28.test(input.charAt(peg$currPos))) {
                  s4 = input.charAt(peg$currPos);
                  peg$currPos++;
              }
              else {
                  s4 = peg$FAILED;
                  if (peg$silentFails === 0) {
                      peg$fail(peg$c29);
                  }
              }
          }
          peg$silentFails--;
          if (s4 === peg$FAILED) {
              s3 = undefined;
          }
          else {
              peg$currPos = s3;
              s3 = peg$FAILED;
          }
          if (s3 !== peg$FAILED) {
              if (input.length > peg$currPos) {
                  s4 = input.charAt(peg$currPos);
                  peg$currPos++;
              }
              else {
                  s4 = peg$FAILED;
                  if (peg$silentFails === 0) {
                      peg$fail(peg$c30);
                  }
              }
              if (s4 !== peg$FAILED) {
                  s3 = [s3, s4];
                  s2 = s3;
              }
              else {
                  peg$currPos = s2;
                  s2 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s2;
              s2 = peg$FAILED;
          }
          if (s2 !== peg$FAILED) {
              while (s2 !== peg$FAILED) {
                  s1.push(s2);
                  s2 = peg$currPos;
                  s3 = peg$currPos;
                  peg$silentFails++;
                  s4 = peg$parsewhiteSpace();
                  if (s4 === peg$FAILED) {
                      if (peg$c28.test(input.charAt(peg$currPos))) {
                          s4 = input.charAt(peg$currPos);
                          peg$currPos++;
                      }
                      else {
                          s4 = peg$FAILED;
                          if (peg$silentFails === 0) {
                              peg$fail(peg$c29);
                          }
                      }
                  }
                  peg$silentFails--;
                  if (s4 === peg$FAILED) {
                      s3 = undefined;
                  }
                  else {
                      peg$currPos = s3;
                      s3 = peg$FAILED;
                  }
                  if (s3 !== peg$FAILED) {
                      if (input.length > peg$currPos) {
                          s4 = input.charAt(peg$currPos);
                          peg$currPos++;
                      }
                      else {
                          s4 = peg$FAILED;
                          if (peg$silentFails === 0) {
                              peg$fail(peg$c30);
                          }
                      }
                      if (s4 !== peg$FAILED) {
                          s3 = [s3, s4];
                          s2 = s3;
                      }
                      else {
                          peg$currPos = s2;
                          s2 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s2;
                      s2 = peg$FAILED;
                  }
              }
          }
          else {
              s1 = peg$FAILED;
          }
          if (s1 !== peg$FAILED) {
              s0 = input.substring(s0, peg$currPos);
          }
          else {
              s0 = s1;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c27);
              }
          }
          return s0;
      }
      function peg$parsenumberSkeletonTokenOption() {
          var s0, s1, s2;
          peg$silentFails++;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 47) {
              s1 = peg$c32;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c33);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parsenumberSkeletonId();
              if (s2 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c34(s2);
                  s0 = s1;
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c31);
              }
          }
          return s0;
      }
      function peg$parsenumberSkeletonToken() {
          var s0, s1, s2, s3, s4;
          peg$silentFails++;
          s0 = peg$currPos;
          s1 = peg$parse_();
          if (s1 !== peg$FAILED) {
              s2 = peg$parsenumberSkeletonId();
              if (s2 !== peg$FAILED) {
                  s3 = [];
                  s4 = peg$parsenumberSkeletonTokenOption();
                  while (s4 !== peg$FAILED) {
                      s3.push(s4);
                      s4 = peg$parsenumberSkeletonTokenOption();
                  }
                  if (s3 !== peg$FAILED) {
                      peg$savedPos = s0;
                      s1 = peg$c36(s2, s3);
                      s0 = s1;
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c35);
              }
          }
          return s0;
      }
      function peg$parsenumberSkeleton() {
          var s0, s1, s2;
          s0 = peg$currPos;
          s1 = [];
          s2 = peg$parsenumberSkeletonToken();
          if (s2 !== peg$FAILED) {
              while (s2 !== peg$FAILED) {
                  s1.push(s2);
                  s2 = peg$parsenumberSkeletonToken();
              }
          }
          else {
              s1 = peg$FAILED;
          }
          if (s1 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c37(s1);
          }
          s0 = s1;
          return s0;
      }
      function peg$parsenumberArgStyle() {
          var s0, s1, s2;
          s0 = peg$currPos;
          if (input.substr(peg$currPos, 2) === peg$c38) {
              s1 = peg$c38;
              peg$currPos += 2;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c39);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parsenumberSkeleton();
              if (s2 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c40(s2);
                  s0 = s1;
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          if (s0 === peg$FAILED) {
              s0 = peg$currPos;
              peg$savedPos = peg$currPos;
              s1 = peg$c41();
              if (s1) {
                  s1 = undefined;
              }
              else {
                  s1 = peg$FAILED;
              }
              if (s1 !== peg$FAILED) {
                  s2 = peg$parsemessageText();
                  if (s2 !== peg$FAILED) {
                      peg$savedPos = s0;
                      s1 = peg$c42(s2);
                      s0 = s1;
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          return s0;
      }
      function peg$parsenumberFormatElement() {
          var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 123) {
              s1 = peg$c22;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c23);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parse_();
              if (s2 !== peg$FAILED) {
                  s3 = peg$parseargNameOrNumber();
                  if (s3 !== peg$FAILED) {
                      s4 = peg$parse_();
                      if (s4 !== peg$FAILED) {
                          if (input.charCodeAt(peg$currPos) === 44) {
                              s5 = peg$c43;
                              peg$currPos++;
                          }
                          else {
                              s5 = peg$FAILED;
                              if (peg$silentFails === 0) {
                                  peg$fail(peg$c44);
                              }
                          }
                          if (s5 !== peg$FAILED) {
                              s6 = peg$parse_();
                              if (s6 !== peg$FAILED) {
                                  if (input.substr(peg$currPos, 6) === peg$c45) {
                                      s7 = peg$c45;
                                      peg$currPos += 6;
                                  }
                                  else {
                                      s7 = peg$FAILED;
                                      if (peg$silentFails === 0) {
                                          peg$fail(peg$c46);
                                      }
                                  }
                                  if (s7 !== peg$FAILED) {
                                      s8 = peg$parse_();
                                      if (s8 !== peg$FAILED) {
                                          s9 = peg$currPos;
                                          if (input.charCodeAt(peg$currPos) === 44) {
                                              s10 = peg$c43;
                                              peg$currPos++;
                                          }
                                          else {
                                              s10 = peg$FAILED;
                                              if (peg$silentFails === 0) {
                                                  peg$fail(peg$c44);
                                              }
                                          }
                                          if (s10 !== peg$FAILED) {
                                              s11 = peg$parse_();
                                              if (s11 !== peg$FAILED) {
                                                  s12 = peg$parsenumberArgStyle();
                                                  if (s12 !== peg$FAILED) {
                                                      s10 = [s10, s11, s12];
                                                      s9 = s10;
                                                  }
                                                  else {
                                                      peg$currPos = s9;
                                                      s9 = peg$FAILED;
                                                  }
                                              }
                                              else {
                                                  peg$currPos = s9;
                                                  s9 = peg$FAILED;
                                              }
                                          }
                                          else {
                                              peg$currPos = s9;
                                              s9 = peg$FAILED;
                                          }
                                          if (s9 === peg$FAILED) {
                                              s9 = null;
                                          }
                                          if (s9 !== peg$FAILED) {
                                              s10 = peg$parse_();
                                              if (s10 !== peg$FAILED) {
                                                  if (input.charCodeAt(peg$currPos) === 125) {
                                                      s11 = peg$c24;
                                                      peg$currPos++;
                                                  }
                                                  else {
                                                      s11 = peg$FAILED;
                                                      if (peg$silentFails === 0) {
                                                          peg$fail(peg$c25);
                                                      }
                                                  }
                                                  if (s11 !== peg$FAILED) {
                                                      peg$savedPos = s0;
                                                      s1 = peg$c47(s3, s7, s9);
                                                      s0 = s1;
                                                  }
                                                  else {
                                                      peg$currPos = s0;
                                                      s0 = peg$FAILED;
                                                  }
                                              }
                                              else {
                                                  peg$currPos = s0;
                                                  s0 = peg$FAILED;
                                              }
                                          }
                                          else {
                                              peg$currPos = s0;
                                              s0 = peg$FAILED;
                                          }
                                      }
                                      else {
                                          peg$currPos = s0;
                                          s0 = peg$FAILED;
                                      }
                                  }
                                  else {
                                      peg$currPos = s0;
                                      s0 = peg$FAILED;
                                  }
                              }
                              else {
                                  peg$currPos = s0;
                                  s0 = peg$FAILED;
                              }
                          }
                          else {
                              peg$currPos = s0;
                              s0 = peg$FAILED;
                          }
                      }
                      else {
                          peg$currPos = s0;
                          s0 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parsedateTimeSkeletonLiteral() {
          var s0, s1, s2, s3;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 39) {
              s1 = peg$c48;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c49);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = [];
              s3 = peg$parsedoubleApostrophes();
              if (s3 === peg$FAILED) {
                  if (peg$c50.test(input.charAt(peg$currPos))) {
                      s3 = input.charAt(peg$currPos);
                      peg$currPos++;
                  }
                  else {
                      s3 = peg$FAILED;
                      if (peg$silentFails === 0) {
                          peg$fail(peg$c51);
                      }
                  }
              }
              if (s3 !== peg$FAILED) {
                  while (s3 !== peg$FAILED) {
                      s2.push(s3);
                      s3 = peg$parsedoubleApostrophes();
                      if (s3 === peg$FAILED) {
                          if (peg$c50.test(input.charAt(peg$currPos))) {
                              s3 = input.charAt(peg$currPos);
                              peg$currPos++;
                          }
                          else {
                              s3 = peg$FAILED;
                              if (peg$silentFails === 0) {
                                  peg$fail(peg$c51);
                              }
                          }
                      }
                  }
              }
              else {
                  s2 = peg$FAILED;
              }
              if (s2 !== peg$FAILED) {
                  if (input.charCodeAt(peg$currPos) === 39) {
                      s3 = peg$c48;
                      peg$currPos++;
                  }
                  else {
                      s3 = peg$FAILED;
                      if (peg$silentFails === 0) {
                          peg$fail(peg$c49);
                      }
                  }
                  if (s3 !== peg$FAILED) {
                      s1 = [s1, s2, s3];
                      s0 = s1;
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          if (s0 === peg$FAILED) {
              s0 = [];
              s1 = peg$parsedoubleApostrophes();
              if (s1 === peg$FAILED) {
                  if (peg$c52.test(input.charAt(peg$currPos))) {
                      s1 = input.charAt(peg$currPos);
                      peg$currPos++;
                  }
                  else {
                      s1 = peg$FAILED;
                      if (peg$silentFails === 0) {
                          peg$fail(peg$c53);
                      }
                  }
              }
              if (s1 !== peg$FAILED) {
                  while (s1 !== peg$FAILED) {
                      s0.push(s1);
                      s1 = peg$parsedoubleApostrophes();
                      if (s1 === peg$FAILED) {
                          if (peg$c52.test(input.charAt(peg$currPos))) {
                              s1 = input.charAt(peg$currPos);
                              peg$currPos++;
                          }
                          else {
                              s1 = peg$FAILED;
                              if (peg$silentFails === 0) {
                                  peg$fail(peg$c53);
                              }
                          }
                      }
                  }
              }
              else {
                  s0 = peg$FAILED;
              }
          }
          return s0;
      }
      function peg$parsedateTimeSkeletonPattern() {
          var s0, s1;
          s0 = [];
          if (peg$c54.test(input.charAt(peg$currPos))) {
              s1 = input.charAt(peg$currPos);
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c55);
              }
          }
          if (s1 !== peg$FAILED) {
              while (s1 !== peg$FAILED) {
                  s0.push(s1);
                  if (peg$c54.test(input.charAt(peg$currPos))) {
                      s1 = input.charAt(peg$currPos);
                      peg$currPos++;
                  }
                  else {
                      s1 = peg$FAILED;
                      if (peg$silentFails === 0) {
                          peg$fail(peg$c55);
                      }
                  }
              }
          }
          else {
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parsedateTimeSkeleton() {
          var s0, s1, s2, s3;
          s0 = peg$currPos;
          s1 = peg$currPos;
          s2 = [];
          s3 = peg$parsedateTimeSkeletonLiteral();
          if (s3 === peg$FAILED) {
              s3 = peg$parsedateTimeSkeletonPattern();
          }
          if (s3 !== peg$FAILED) {
              while (s3 !== peg$FAILED) {
                  s2.push(s3);
                  s3 = peg$parsedateTimeSkeletonLiteral();
                  if (s3 === peg$FAILED) {
                      s3 = peg$parsedateTimeSkeletonPattern();
                  }
              }
          }
          else {
              s2 = peg$FAILED;
          }
          if (s2 !== peg$FAILED) {
              s1 = input.substring(s1, peg$currPos);
          }
          else {
              s1 = s2;
          }
          if (s1 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c56(s1);
          }
          s0 = s1;
          return s0;
      }
      function peg$parsedateOrTimeArgStyle() {
          var s0, s1, s2;
          s0 = peg$currPos;
          if (input.substr(peg$currPos, 2) === peg$c38) {
              s1 = peg$c38;
              peg$currPos += 2;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c39);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parsedateTimeSkeleton();
              if (s2 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c40(s2);
                  s0 = s1;
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          if (s0 === peg$FAILED) {
              s0 = peg$currPos;
              peg$savedPos = peg$currPos;
              s1 = peg$c57();
              if (s1) {
                  s1 = undefined;
              }
              else {
                  s1 = peg$FAILED;
              }
              if (s1 !== peg$FAILED) {
                  s2 = peg$parsemessageText();
                  if (s2 !== peg$FAILED) {
                      peg$savedPos = s0;
                      s1 = peg$c42(s2);
                      s0 = s1;
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          return s0;
      }
      function peg$parsedateOrTimeFormatElement() {
          var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 123) {
              s1 = peg$c22;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c23);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parse_();
              if (s2 !== peg$FAILED) {
                  s3 = peg$parseargNameOrNumber();
                  if (s3 !== peg$FAILED) {
                      s4 = peg$parse_();
                      if (s4 !== peg$FAILED) {
                          if (input.charCodeAt(peg$currPos) === 44) {
                              s5 = peg$c43;
                              peg$currPos++;
                          }
                          else {
                              s5 = peg$FAILED;
                              if (peg$silentFails === 0) {
                                  peg$fail(peg$c44);
                              }
                          }
                          if (s5 !== peg$FAILED) {
                              s6 = peg$parse_();
                              if (s6 !== peg$FAILED) {
                                  if (input.substr(peg$currPos, 4) === peg$c58) {
                                      s7 = peg$c58;
                                      peg$currPos += 4;
                                  }
                                  else {
                                      s7 = peg$FAILED;
                                      if (peg$silentFails === 0) {
                                          peg$fail(peg$c59);
                                      }
                                  }
                                  if (s7 === peg$FAILED) {
                                      if (input.substr(peg$currPos, 4) === peg$c60) {
                                          s7 = peg$c60;
                                          peg$currPos += 4;
                                      }
                                      else {
                                          s7 = peg$FAILED;
                                          if (peg$silentFails === 0) {
                                              peg$fail(peg$c61);
                                          }
                                      }
                                  }
                                  if (s7 !== peg$FAILED) {
                                      s8 = peg$parse_();
                                      if (s8 !== peg$FAILED) {
                                          s9 = peg$currPos;
                                          if (input.charCodeAt(peg$currPos) === 44) {
                                              s10 = peg$c43;
                                              peg$currPos++;
                                          }
                                          else {
                                              s10 = peg$FAILED;
                                              if (peg$silentFails === 0) {
                                                  peg$fail(peg$c44);
                                              }
                                          }
                                          if (s10 !== peg$FAILED) {
                                              s11 = peg$parse_();
                                              if (s11 !== peg$FAILED) {
                                                  s12 = peg$parsedateOrTimeArgStyle();
                                                  if (s12 !== peg$FAILED) {
                                                      s10 = [s10, s11, s12];
                                                      s9 = s10;
                                                  }
                                                  else {
                                                      peg$currPos = s9;
                                                      s9 = peg$FAILED;
                                                  }
                                              }
                                              else {
                                                  peg$currPos = s9;
                                                  s9 = peg$FAILED;
                                              }
                                          }
                                          else {
                                              peg$currPos = s9;
                                              s9 = peg$FAILED;
                                          }
                                          if (s9 === peg$FAILED) {
                                              s9 = null;
                                          }
                                          if (s9 !== peg$FAILED) {
                                              s10 = peg$parse_();
                                              if (s10 !== peg$FAILED) {
                                                  if (input.charCodeAt(peg$currPos) === 125) {
                                                      s11 = peg$c24;
                                                      peg$currPos++;
                                                  }
                                                  else {
                                                      s11 = peg$FAILED;
                                                      if (peg$silentFails === 0) {
                                                          peg$fail(peg$c25);
                                                      }
                                                  }
                                                  if (s11 !== peg$FAILED) {
                                                      peg$savedPos = s0;
                                                      s1 = peg$c47(s3, s7, s9);
                                                      s0 = s1;
                                                  }
                                                  else {
                                                      peg$currPos = s0;
                                                      s0 = peg$FAILED;
                                                  }
                                              }
                                              else {
                                                  peg$currPos = s0;
                                                  s0 = peg$FAILED;
                                              }
                                          }
                                          else {
                                              peg$currPos = s0;
                                              s0 = peg$FAILED;
                                          }
                                      }
                                      else {
                                          peg$currPos = s0;
                                          s0 = peg$FAILED;
                                      }
                                  }
                                  else {
                                      peg$currPos = s0;
                                      s0 = peg$FAILED;
                                  }
                              }
                              else {
                                  peg$currPos = s0;
                                  s0 = peg$FAILED;
                              }
                          }
                          else {
                              peg$currPos = s0;
                              s0 = peg$FAILED;
                          }
                      }
                      else {
                          peg$currPos = s0;
                          s0 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parsesimpleFormatElement() {
          var s0;
          s0 = peg$parsenumberFormatElement();
          if (s0 === peg$FAILED) {
              s0 = peg$parsedateOrTimeFormatElement();
          }
          return s0;
      }
      function peg$parsepluralElement() {
          var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 123) {
              s1 = peg$c22;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c23);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parse_();
              if (s2 !== peg$FAILED) {
                  s3 = peg$parseargNameOrNumber();
                  if (s3 !== peg$FAILED) {
                      s4 = peg$parse_();
                      if (s4 !== peg$FAILED) {
                          if (input.charCodeAt(peg$currPos) === 44) {
                              s5 = peg$c43;
                              peg$currPos++;
                          }
                          else {
                              s5 = peg$FAILED;
                              if (peg$silentFails === 0) {
                                  peg$fail(peg$c44);
                              }
                          }
                          if (s5 !== peg$FAILED) {
                              s6 = peg$parse_();
                              if (s6 !== peg$FAILED) {
                                  if (input.substr(peg$currPos, 6) === peg$c62) {
                                      s7 = peg$c62;
                                      peg$currPos += 6;
                                  }
                                  else {
                                      s7 = peg$FAILED;
                                      if (peg$silentFails === 0) {
                                          peg$fail(peg$c63);
                                      }
                                  }
                                  if (s7 === peg$FAILED) {
                                      if (input.substr(peg$currPos, 13) === peg$c64) {
                                          s7 = peg$c64;
                                          peg$currPos += 13;
                                      }
                                      else {
                                          s7 = peg$FAILED;
                                          if (peg$silentFails === 0) {
                                              peg$fail(peg$c65);
                                          }
                                      }
                                  }
                                  if (s7 !== peg$FAILED) {
                                      s8 = peg$parse_();
                                      if (s8 !== peg$FAILED) {
                                          if (input.charCodeAt(peg$currPos) === 44) {
                                              s9 = peg$c43;
                                              peg$currPos++;
                                          }
                                          else {
                                              s9 = peg$FAILED;
                                              if (peg$silentFails === 0) {
                                                  peg$fail(peg$c44);
                                              }
                                          }
                                          if (s9 !== peg$FAILED) {
                                              s10 = peg$parse_();
                                              if (s10 !== peg$FAILED) {
                                                  s11 = peg$currPos;
                                                  if (input.substr(peg$currPos, 7) === peg$c66) {
                                                      s12 = peg$c66;
                                                      peg$currPos += 7;
                                                  }
                                                  else {
                                                      s12 = peg$FAILED;
                                                      if (peg$silentFails === 0) {
                                                          peg$fail(peg$c67);
                                                      }
                                                  }
                                                  if (s12 !== peg$FAILED) {
                                                      s13 = peg$parse_();
                                                      if (s13 !== peg$FAILED) {
                                                          s14 = peg$parsenumber();
                                                          if (s14 !== peg$FAILED) {
                                                              s12 = [s12, s13, s14];
                                                              s11 = s12;
                                                          }
                                                          else {
                                                              peg$currPos = s11;
                                                              s11 = peg$FAILED;
                                                          }
                                                      }
                                                      else {
                                                          peg$currPos = s11;
                                                          s11 = peg$FAILED;
                                                      }
                                                  }
                                                  else {
                                                      peg$currPos = s11;
                                                      s11 = peg$FAILED;
                                                  }
                                                  if (s11 === peg$FAILED) {
                                                      s11 = null;
                                                  }
                                                  if (s11 !== peg$FAILED) {
                                                      s12 = peg$parse_();
                                                      if (s12 !== peg$FAILED) {
                                                          s13 = [];
                                                          s14 = peg$parsepluralOption();
                                                          if (s14 !== peg$FAILED) {
                                                              while (s14 !== peg$FAILED) {
                                                                  s13.push(s14);
                                                                  s14 = peg$parsepluralOption();
                                                              }
                                                          }
                                                          else {
                                                              s13 = peg$FAILED;
                                                          }
                                                          if (s13 !== peg$FAILED) {
                                                              s14 = peg$parse_();
                                                              if (s14 !== peg$FAILED) {
                                                                  if (input.charCodeAt(peg$currPos) === 125) {
                                                                      s15 = peg$c24;
                                                                      peg$currPos++;
                                                                  }
                                                                  else {
                                                                      s15 = peg$FAILED;
                                                                      if (peg$silentFails === 0) {
                                                                          peg$fail(peg$c25);
                                                                      }
                                                                  }
                                                                  if (s15 !== peg$FAILED) {
                                                                      peg$savedPos = s0;
                                                                      s1 = peg$c68(s3, s7, s11, s13);
                                                                      s0 = s1;
                                                                  }
                                                                  else {
                                                                      peg$currPos = s0;
                                                                      s0 = peg$FAILED;
                                                                  }
                                                              }
                                                              else {
                                                                  peg$currPos = s0;
                                                                  s0 = peg$FAILED;
                                                              }
                                                          }
                                                          else {
                                                              peg$currPos = s0;
                                                              s0 = peg$FAILED;
                                                          }
                                                      }
                                                      else {
                                                          peg$currPos = s0;
                                                          s0 = peg$FAILED;
                                                      }
                                                  }
                                                  else {
                                                      peg$currPos = s0;
                                                      s0 = peg$FAILED;
                                                  }
                                              }
                                              else {
                                                  peg$currPos = s0;
                                                  s0 = peg$FAILED;
                                              }
                                          }
                                          else {
                                              peg$currPos = s0;
                                              s0 = peg$FAILED;
                                          }
                                      }
                                      else {
                                          peg$currPos = s0;
                                          s0 = peg$FAILED;
                                      }
                                  }
                                  else {
                                      peg$currPos = s0;
                                      s0 = peg$FAILED;
                                  }
                              }
                              else {
                                  peg$currPos = s0;
                                  s0 = peg$FAILED;
                              }
                          }
                          else {
                              peg$currPos = s0;
                              s0 = peg$FAILED;
                          }
                      }
                      else {
                          peg$currPos = s0;
                          s0 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parseselectElement() {
          var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 123) {
              s1 = peg$c22;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c23);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parse_();
              if (s2 !== peg$FAILED) {
                  s3 = peg$parseargNameOrNumber();
                  if (s3 !== peg$FAILED) {
                      s4 = peg$parse_();
                      if (s4 !== peg$FAILED) {
                          if (input.charCodeAt(peg$currPos) === 44) {
                              s5 = peg$c43;
                              peg$currPos++;
                          }
                          else {
                              s5 = peg$FAILED;
                              if (peg$silentFails === 0) {
                                  peg$fail(peg$c44);
                              }
                          }
                          if (s5 !== peg$FAILED) {
                              s6 = peg$parse_();
                              if (s6 !== peg$FAILED) {
                                  if (input.substr(peg$currPos, 6) === peg$c69) {
                                      s7 = peg$c69;
                                      peg$currPos += 6;
                                  }
                                  else {
                                      s7 = peg$FAILED;
                                      if (peg$silentFails === 0) {
                                          peg$fail(peg$c70);
                                      }
                                  }
                                  if (s7 !== peg$FAILED) {
                                      s8 = peg$parse_();
                                      if (s8 !== peg$FAILED) {
                                          if (input.charCodeAt(peg$currPos) === 44) {
                                              s9 = peg$c43;
                                              peg$currPos++;
                                          }
                                          else {
                                              s9 = peg$FAILED;
                                              if (peg$silentFails === 0) {
                                                  peg$fail(peg$c44);
                                              }
                                          }
                                          if (s9 !== peg$FAILED) {
                                              s10 = peg$parse_();
                                              if (s10 !== peg$FAILED) {
                                                  s11 = [];
                                                  s12 = peg$parseselectOption();
                                                  if (s12 !== peg$FAILED) {
                                                      while (s12 !== peg$FAILED) {
                                                          s11.push(s12);
                                                          s12 = peg$parseselectOption();
                                                      }
                                                  }
                                                  else {
                                                      s11 = peg$FAILED;
                                                  }
                                                  if (s11 !== peg$FAILED) {
                                                      s12 = peg$parse_();
                                                      if (s12 !== peg$FAILED) {
                                                          if (input.charCodeAt(peg$currPos) === 125) {
                                                              s13 = peg$c24;
                                                              peg$currPos++;
                                                          }
                                                          else {
                                                              s13 = peg$FAILED;
                                                              if (peg$silentFails === 0) {
                                                                  peg$fail(peg$c25);
                                                              }
                                                          }
                                                          if (s13 !== peg$FAILED) {
                                                              peg$savedPos = s0;
                                                              s1 = peg$c71(s3, s11);
                                                              s0 = s1;
                                                          }
                                                          else {
                                                              peg$currPos = s0;
                                                              s0 = peg$FAILED;
                                                          }
                                                      }
                                                      else {
                                                          peg$currPos = s0;
                                                          s0 = peg$FAILED;
                                                      }
                                                  }
                                                  else {
                                                      peg$currPos = s0;
                                                      s0 = peg$FAILED;
                                                  }
                                              }
                                              else {
                                                  peg$currPos = s0;
                                                  s0 = peg$FAILED;
                                              }
                                          }
                                          else {
                                              peg$currPos = s0;
                                              s0 = peg$FAILED;
                                          }
                                      }
                                      else {
                                          peg$currPos = s0;
                                          s0 = peg$FAILED;
                                      }
                                  }
                                  else {
                                      peg$currPos = s0;
                                      s0 = peg$FAILED;
                                  }
                              }
                              else {
                                  peg$currPos = s0;
                                  s0 = peg$FAILED;
                              }
                          }
                          else {
                              peg$currPos = s0;
                              s0 = peg$FAILED;
                          }
                      }
                      else {
                          peg$currPos = s0;
                          s0 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parsepluralRuleSelectValue() {
          var s0, s1, s2, s3;
          s0 = peg$currPos;
          s1 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 61) {
              s2 = peg$c72;
              peg$currPos++;
          }
          else {
              s2 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c73);
              }
          }
          if (s2 !== peg$FAILED) {
              s3 = peg$parsenumber();
              if (s3 !== peg$FAILED) {
                  s2 = [s2, s3];
                  s1 = s2;
              }
              else {
                  peg$currPos = s1;
                  s1 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s1;
              s1 = peg$FAILED;
          }
          if (s1 !== peg$FAILED) {
              s0 = input.substring(s0, peg$currPos);
          }
          else {
              s0 = s1;
          }
          if (s0 === peg$FAILED) {
              s0 = peg$parseargName();
          }
          return s0;
      }
      function peg$parseselectOption() {
          var s0, s1, s2, s3, s4, s5, s6, s7;
          s0 = peg$currPos;
          s1 = peg$parse_();
          if (s1 !== peg$FAILED) {
              s2 = peg$parseargName();
              if (s2 !== peg$FAILED) {
                  s3 = peg$parse_();
                  if (s3 !== peg$FAILED) {
                      if (input.charCodeAt(peg$currPos) === 123) {
                          s4 = peg$c22;
                          peg$currPos++;
                      }
                      else {
                          s4 = peg$FAILED;
                          if (peg$silentFails === 0) {
                              peg$fail(peg$c23);
                          }
                      }
                      if (s4 !== peg$FAILED) {
                          peg$savedPos = peg$currPos;
                          s5 = peg$c74(s2);
                          if (s5) {
                              s5 = undefined;
                          }
                          else {
                              s5 = peg$FAILED;
                          }
                          if (s5 !== peg$FAILED) {
                              s6 = peg$parsemessage();
                              if (s6 !== peg$FAILED) {
                                  if (input.charCodeAt(peg$currPos) === 125) {
                                      s7 = peg$c24;
                                      peg$currPos++;
                                  }
                                  else {
                                      s7 = peg$FAILED;
                                      if (peg$silentFails === 0) {
                                          peg$fail(peg$c25);
                                      }
                                  }
                                  if (s7 !== peg$FAILED) {
                                      peg$savedPos = s0;
                                      s1 = peg$c75(s2, s6);
                                      s0 = s1;
                                  }
                                  else {
                                      peg$currPos = s0;
                                      s0 = peg$FAILED;
                                  }
                              }
                              else {
                                  peg$currPos = s0;
                                  s0 = peg$FAILED;
                              }
                          }
                          else {
                              peg$currPos = s0;
                              s0 = peg$FAILED;
                          }
                      }
                      else {
                          peg$currPos = s0;
                          s0 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parsepluralOption() {
          var s0, s1, s2, s3, s4, s5, s6, s7;
          s0 = peg$currPos;
          s1 = peg$parse_();
          if (s1 !== peg$FAILED) {
              s2 = peg$parsepluralRuleSelectValue();
              if (s2 !== peg$FAILED) {
                  s3 = peg$parse_();
                  if (s3 !== peg$FAILED) {
                      if (input.charCodeAt(peg$currPos) === 123) {
                          s4 = peg$c22;
                          peg$currPos++;
                      }
                      else {
                          s4 = peg$FAILED;
                          if (peg$silentFails === 0) {
                              peg$fail(peg$c23);
                          }
                      }
                      if (s4 !== peg$FAILED) {
                          peg$savedPos = peg$currPos;
                          s5 = peg$c76(s2);
                          if (s5) {
                              s5 = undefined;
                          }
                          else {
                              s5 = peg$FAILED;
                          }
                          if (s5 !== peg$FAILED) {
                              s6 = peg$parsemessage();
                              if (s6 !== peg$FAILED) {
                                  if (input.charCodeAt(peg$currPos) === 125) {
                                      s7 = peg$c24;
                                      peg$currPos++;
                                  }
                                  else {
                                      s7 = peg$FAILED;
                                      if (peg$silentFails === 0) {
                                          peg$fail(peg$c25);
                                      }
                                  }
                                  if (s7 !== peg$FAILED) {
                                      peg$savedPos = s0;
                                      s1 = peg$c77(s2, s6);
                                      s0 = s1;
                                  }
                                  else {
                                      peg$currPos = s0;
                                      s0 = peg$FAILED;
                                  }
                              }
                              else {
                                  peg$currPos = s0;
                                  s0 = peg$FAILED;
                              }
                          }
                          else {
                              peg$currPos = s0;
                              s0 = peg$FAILED;
                          }
                      }
                      else {
                          peg$currPos = s0;
                          s0 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parsewhiteSpace() {
          var s0, s1;
          peg$silentFails++;
          if (peg$c79.test(input.charAt(peg$currPos))) {
              s0 = input.charAt(peg$currPos);
              peg$currPos++;
          }
          else {
              s0 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c80);
              }
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c78);
              }
          }
          return s0;
      }
      function peg$parsepatternSyntax() {
          var s0, s1;
          peg$silentFails++;
          if (peg$c82.test(input.charAt(peg$currPos))) {
              s0 = input.charAt(peg$currPos);
              peg$currPos++;
          }
          else {
              s0 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c83);
              }
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c81);
              }
          }
          return s0;
      }
      function peg$parse_() {
          var s0, s1, s2;
          peg$silentFails++;
          s0 = peg$currPos;
          s1 = [];
          s2 = peg$parsewhiteSpace();
          while (s2 !== peg$FAILED) {
              s1.push(s2);
              s2 = peg$parsewhiteSpace();
          }
          if (s1 !== peg$FAILED) {
              s0 = input.substring(s0, peg$currPos);
          }
          else {
              s0 = s1;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c84);
              }
          }
          return s0;
      }
      function peg$parsenumber() {
          var s0, s1, s2;
          peg$silentFails++;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 45) {
              s1 = peg$c86;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c87);
              }
          }
          if (s1 === peg$FAILED) {
              s1 = null;
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parseargNumber();
              if (s2 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c88(s1, s2);
                  s0 = s1;
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c85);
              }
          }
          return s0;
      }
      function peg$parseapostrophe() {
          var s0, s1;
          peg$silentFails++;
          if (input.charCodeAt(peg$currPos) === 39) {
              s0 = peg$c48;
              peg$currPos++;
          }
          else {
              s0 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c49);
              }
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c89);
              }
          }
          return s0;
      }
      function peg$parsedoubleApostrophes() {
          var s0, s1;
          peg$silentFails++;
          s0 = peg$currPos;
          if (input.substr(peg$currPos, 2) === peg$c91) {
              s1 = peg$c91;
              peg$currPos += 2;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c92);
              }
          }
          if (s1 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c93();
          }
          s0 = s1;
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c90);
              }
          }
          return s0;
      }
      function peg$parsequotedString() {
          var s0, s1, s2, s3, s4, s5;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 39) {
              s1 = peg$c48;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c49);
              }
          }
          if (s1 !== peg$FAILED) {
              s2 = peg$parseescapedChar();
              if (s2 !== peg$FAILED) {
                  s3 = peg$currPos;
                  s4 = [];
                  if (input.substr(peg$currPos, 2) === peg$c91) {
                      s5 = peg$c91;
                      peg$currPos += 2;
                  }
                  else {
                      s5 = peg$FAILED;
                      if (peg$silentFails === 0) {
                          peg$fail(peg$c92);
                      }
                  }
                  if (s5 === peg$FAILED) {
                      if (peg$c50.test(input.charAt(peg$currPos))) {
                          s5 = input.charAt(peg$currPos);
                          peg$currPos++;
                      }
                      else {
                          s5 = peg$FAILED;
                          if (peg$silentFails === 0) {
                              peg$fail(peg$c51);
                          }
                      }
                  }
                  while (s5 !== peg$FAILED) {
                      s4.push(s5);
                      if (input.substr(peg$currPos, 2) === peg$c91) {
                          s5 = peg$c91;
                          peg$currPos += 2;
                      }
                      else {
                          s5 = peg$FAILED;
                          if (peg$silentFails === 0) {
                              peg$fail(peg$c92);
                          }
                      }
                      if (s5 === peg$FAILED) {
                          if (peg$c50.test(input.charAt(peg$currPos))) {
                              s5 = input.charAt(peg$currPos);
                              peg$currPos++;
                          }
                          else {
                              s5 = peg$FAILED;
                              if (peg$silentFails === 0) {
                                  peg$fail(peg$c51);
                              }
                          }
                      }
                  }
                  if (s4 !== peg$FAILED) {
                      s3 = input.substring(s3, peg$currPos);
                  }
                  else {
                      s3 = s4;
                  }
                  if (s3 !== peg$FAILED) {
                      if (input.charCodeAt(peg$currPos) === 39) {
                          s4 = peg$c48;
                          peg$currPos++;
                      }
                      else {
                          s4 = peg$FAILED;
                          if (peg$silentFails === 0) {
                              peg$fail(peg$c49);
                          }
                      }
                      if (s4 === peg$FAILED) {
                          s4 = null;
                      }
                      if (s4 !== peg$FAILED) {
                          peg$savedPos = s0;
                          s1 = peg$c94(s2, s3);
                          s0 = s1;
                      }
                      else {
                          peg$currPos = s0;
                          s0 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s0;
                      s0 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s0;
                  s0 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s0;
              s0 = peg$FAILED;
          }
          return s0;
      }
      function peg$parseunquotedString() {
          var s0, s1, s2, s3;
          s0 = peg$currPos;
          s1 = peg$currPos;
          if (input.length > peg$currPos) {
              s2 = input.charAt(peg$currPos);
              peg$currPos++;
          }
          else {
              s2 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c30);
              }
          }
          if (s2 !== peg$FAILED) {
              peg$savedPos = peg$currPos;
              s3 = peg$c95(s2);
              if (s3) {
                  s3 = undefined;
              }
              else {
                  s3 = peg$FAILED;
              }
              if (s3 !== peg$FAILED) {
                  s2 = [s2, s3];
                  s1 = s2;
              }
              else {
                  peg$currPos = s1;
                  s1 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s1;
              s1 = peg$FAILED;
          }
          if (s1 === peg$FAILED) {
              if (input.charCodeAt(peg$currPos) === 10) {
                  s1 = peg$c96;
                  peg$currPos++;
              }
              else {
                  s1 = peg$FAILED;
                  if (peg$silentFails === 0) {
                      peg$fail(peg$c97);
                  }
              }
          }
          if (s1 !== peg$FAILED) {
              s0 = input.substring(s0, peg$currPos);
          }
          else {
              s0 = s1;
          }
          return s0;
      }
      function peg$parseescapedChar() {
          var s0, s1, s2, s3;
          s0 = peg$currPos;
          s1 = peg$currPos;
          if (input.length > peg$currPos) {
              s2 = input.charAt(peg$currPos);
              peg$currPos++;
          }
          else {
              s2 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c30);
              }
          }
          if (s2 !== peg$FAILED) {
              peg$savedPos = peg$currPos;
              s3 = peg$c98(s2);
              if (s3) {
                  s3 = undefined;
              }
              else {
                  s3 = peg$FAILED;
              }
              if (s3 !== peg$FAILED) {
                  s2 = [s2, s3];
                  s1 = s2;
              }
              else {
                  peg$currPos = s1;
                  s1 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s1;
              s1 = peg$FAILED;
          }
          if (s1 !== peg$FAILED) {
              s0 = input.substring(s0, peg$currPos);
          }
          else {
              s0 = s1;
          }
          return s0;
      }
      function peg$parseargNameOrNumber() {
          var s0, s1;
          peg$silentFails++;
          s0 = peg$currPos;
          s1 = peg$parseargNumber();
          if (s1 === peg$FAILED) {
              s1 = peg$parseargName();
          }
          if (s1 !== peg$FAILED) {
              s0 = input.substring(s0, peg$currPos);
          }
          else {
              s0 = s1;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c99);
              }
          }
          return s0;
      }
      function peg$parsevalidTag() {
          var s0, s1;
          peg$silentFails++;
          s0 = peg$currPos;
          s1 = peg$parseargNumber();
          if (s1 === peg$FAILED) {
              s1 = peg$parsetagName();
          }
          if (s1 !== peg$FAILED) {
              s0 = input.substring(s0, peg$currPos);
          }
          else {
              s0 = s1;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c100);
              }
          }
          return s0;
      }
      function peg$parseargNumber() {
          var s0, s1, s2, s3, s4;
          peg$silentFails++;
          s0 = peg$currPos;
          if (input.charCodeAt(peg$currPos) === 48) {
              s1 = peg$c102;
              peg$currPos++;
          }
          else {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c103);
              }
          }
          if (s1 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c104();
          }
          s0 = s1;
          if (s0 === peg$FAILED) {
              s0 = peg$currPos;
              s1 = peg$currPos;
              if (peg$c105.test(input.charAt(peg$currPos))) {
                  s2 = input.charAt(peg$currPos);
                  peg$currPos++;
              }
              else {
                  s2 = peg$FAILED;
                  if (peg$silentFails === 0) {
                      peg$fail(peg$c106);
                  }
              }
              if (s2 !== peg$FAILED) {
                  s3 = [];
                  if (peg$c107.test(input.charAt(peg$currPos))) {
                      s4 = input.charAt(peg$currPos);
                      peg$currPos++;
                  }
                  else {
                      s4 = peg$FAILED;
                      if (peg$silentFails === 0) {
                          peg$fail(peg$c108);
                      }
                  }
                  while (s4 !== peg$FAILED) {
                      s3.push(s4);
                      if (peg$c107.test(input.charAt(peg$currPos))) {
                          s4 = input.charAt(peg$currPos);
                          peg$currPos++;
                      }
                      else {
                          s4 = peg$FAILED;
                          if (peg$silentFails === 0) {
                              peg$fail(peg$c108);
                          }
                      }
                  }
                  if (s3 !== peg$FAILED) {
                      s2 = [s2, s3];
                      s1 = s2;
                  }
                  else {
                      peg$currPos = s1;
                      s1 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s1;
                  s1 = peg$FAILED;
              }
              if (s1 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c109(s1);
              }
              s0 = s1;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c101);
              }
          }
          return s0;
      }
      function peg$parseargName() {
          var s0, s1, s2, s3, s4;
          peg$silentFails++;
          s0 = peg$currPos;
          s1 = [];
          s2 = peg$currPos;
          s3 = peg$currPos;
          peg$silentFails++;
          s4 = peg$parsewhiteSpace();
          if (s4 === peg$FAILED) {
              s4 = peg$parsepatternSyntax();
          }
          peg$silentFails--;
          if (s4 === peg$FAILED) {
              s3 = undefined;
          }
          else {
              peg$currPos = s3;
              s3 = peg$FAILED;
          }
          if (s3 !== peg$FAILED) {
              if (input.length > peg$currPos) {
                  s4 = input.charAt(peg$currPos);
                  peg$currPos++;
              }
              else {
                  s4 = peg$FAILED;
                  if (peg$silentFails === 0) {
                      peg$fail(peg$c30);
                  }
              }
              if (s4 !== peg$FAILED) {
                  s3 = [s3, s4];
                  s2 = s3;
              }
              else {
                  peg$currPos = s2;
                  s2 = peg$FAILED;
              }
          }
          else {
              peg$currPos = s2;
              s2 = peg$FAILED;
          }
          if (s2 !== peg$FAILED) {
              while (s2 !== peg$FAILED) {
                  s1.push(s2);
                  s2 = peg$currPos;
                  s3 = peg$currPos;
                  peg$silentFails++;
                  s4 = peg$parsewhiteSpace();
                  if (s4 === peg$FAILED) {
                      s4 = peg$parsepatternSyntax();
                  }
                  peg$silentFails--;
                  if (s4 === peg$FAILED) {
                      s3 = undefined;
                  }
                  else {
                      peg$currPos = s3;
                      s3 = peg$FAILED;
                  }
                  if (s3 !== peg$FAILED) {
                      if (input.length > peg$currPos) {
                          s4 = input.charAt(peg$currPos);
                          peg$currPos++;
                      }
                      else {
                          s4 = peg$FAILED;
                          if (peg$silentFails === 0) {
                              peg$fail(peg$c30);
                          }
                      }
                      if (s4 !== peg$FAILED) {
                          s3 = [s3, s4];
                          s2 = s3;
                      }
                      else {
                          peg$currPos = s2;
                          s2 = peg$FAILED;
                      }
                  }
                  else {
                      peg$currPos = s2;
                      s2 = peg$FAILED;
                  }
              }
          }
          else {
              s1 = peg$FAILED;
          }
          if (s1 !== peg$FAILED) {
              s0 = input.substring(s0, peg$currPos);
          }
          else {
              s0 = s1;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c110);
              }
          }
          return s0;
      }
      function peg$parsetagName() {
          var s0, s1, s2, s3, s4;
          peg$silentFails++;
          s0 = peg$currPos;
          s1 = [];
          if (input.charCodeAt(peg$currPos) === 45) {
              s2 = peg$c86;
              peg$currPos++;
          }
          else {
              s2 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c87);
              }
          }
          if (s2 === peg$FAILED) {
              s2 = peg$currPos;
              s3 = peg$currPos;
              peg$silentFails++;
              s4 = peg$parsewhiteSpace();
              if (s4 === peg$FAILED) {
                  s4 = peg$parsepatternSyntax();
              }
              peg$silentFails--;
              if (s4 === peg$FAILED) {
                  s3 = undefined;
              }
              else {
                  peg$currPos = s3;
                  s3 = peg$FAILED;
              }
              if (s3 !== peg$FAILED) {
                  if (input.length > peg$currPos) {
                      s4 = input.charAt(peg$currPos);
                      peg$currPos++;
                  }
                  else {
                      s4 = peg$FAILED;
                      if (peg$silentFails === 0) {
                          peg$fail(peg$c30);
                      }
                  }
                  if (s4 !== peg$FAILED) {
                      s3 = [s3, s4];
                      s2 = s3;
                  }
                  else {
                      peg$currPos = s2;
                      s2 = peg$FAILED;
                  }
              }
              else {
                  peg$currPos = s2;
                  s2 = peg$FAILED;
              }
          }
          if (s2 !== peg$FAILED) {
              while (s2 !== peg$FAILED) {
                  s1.push(s2);
                  if (input.charCodeAt(peg$currPos) === 45) {
                      s2 = peg$c86;
                      peg$currPos++;
                  }
                  else {
                      s2 = peg$FAILED;
                      if (peg$silentFails === 0) {
                          peg$fail(peg$c87);
                      }
                  }
                  if (s2 === peg$FAILED) {
                      s2 = peg$currPos;
                      s3 = peg$currPos;
                      peg$silentFails++;
                      s4 = peg$parsewhiteSpace();
                      if (s4 === peg$FAILED) {
                          s4 = peg$parsepatternSyntax();
                      }
                      peg$silentFails--;
                      if (s4 === peg$FAILED) {
                          s3 = undefined;
                      }
                      else {
                          peg$currPos = s3;
                          s3 = peg$FAILED;
                      }
                      if (s3 !== peg$FAILED) {
                          if (input.length > peg$currPos) {
                              s4 = input.charAt(peg$currPos);
                              peg$currPos++;
                          }
                          else {
                              s4 = peg$FAILED;
                              if (peg$silentFails === 0) {
                                  peg$fail(peg$c30);
                              }
                          }
                          if (s4 !== peg$FAILED) {
                              s3 = [s3, s4];
                              s2 = s3;
                          }
                          else {
                              peg$currPos = s2;
                              s2 = peg$FAILED;
                          }
                      }
                      else {
                          peg$currPos = s2;
                          s2 = peg$FAILED;
                      }
                  }
              }
          }
          else {
              s1 = peg$FAILED;
          }
          if (s1 !== peg$FAILED) {
              s0 = input.substring(s0, peg$currPos);
          }
          else {
              s0 = s1;
          }
          peg$silentFails--;
          if (s0 === peg$FAILED) {
              s1 = peg$FAILED;
              if (peg$silentFails === 0) {
                  peg$fail(peg$c111);
              }
          }
          return s0;
      }
      var messageCtx = ['root'];
      function isNestedMessageText() {
          return messageCtx.length > 1;
      }
      function isInPluralOption() {
          return messageCtx[messageCtx.length - 1] === 'plural';
      }
      function insertLocation() {
          return options && options.captureLocation ? {
              location: location()
          } : {};
      }
      var ignoreTag = options && options.ignoreTag;
      var shouldParseSkeleton = options && options.shouldParseSkeleton;
      peg$result = peg$startRuleFunction();
      if (peg$result !== peg$FAILED && peg$currPos === input.length) {
          return peg$result;
      }
      else {
          if (peg$result !== peg$FAILED && peg$currPos < input.length) {
              peg$fail(peg$endExpectation());
          }
          throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length
              ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
              : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
      }
  }
  export var pegParse = peg$parse;
  