@formatjs/cli 6.8.8 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/formatjs +1050 -1057
  2. package/package.json +2 -2
package/bin/formatjs CHANGED
@@ -32,9 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  mod
33
33
  ));
34
34
 
35
- // node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/error.js
35
+ // node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/error.js
36
36
  var require_error = __commonJS({
37
- "node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/error.js"(exports) {
37
+ "node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/error.js"(exports) {
38
38
  var CommanderError2 = class extends Error {
39
39
  /**
40
40
  * Constructs the CommanderError class
@@ -67,9 +67,9 @@ var require_error = __commonJS({
67
67
  }
68
68
  });
69
69
 
70
- // node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/argument.js
70
+ // node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/argument.js
71
71
  var require_argument = __commonJS({
72
- "node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/argument.js"(exports) {
72
+ "node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/argument.js"(exports) {
73
73
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
74
74
  var Argument2 = class {
75
75
  /**
@@ -101,7 +101,7 @@ var require_argument = __commonJS({
101
101
  this._name = name;
102
102
  break;
103
103
  }
104
- if (this._name.length > 3 && this._name.slice(-3) === "...") {
104
+ if (this._name.endsWith("...")) {
105
105
  this.variadic = true;
106
106
  this._name = this._name.slice(0, -3);
107
107
  }
@@ -117,11 +117,12 @@ var require_argument = __commonJS({
117
117
  /**
118
118
  * @package
119
119
  */
120
- _concatValue(value, previous) {
120
+ _collectValue(value, previous) {
121
121
  if (previous === this.defaultValue || !Array.isArray(previous)) {
122
122
  return [value];
123
123
  }
124
- return previous.concat(value);
124
+ previous.push(value);
125
+ return previous;
125
126
  }
126
127
  /**
127
128
  * Set the default value, and optionally supply the description to be displayed in the help.
@@ -160,7 +161,7 @@ var require_argument = __commonJS({
160
161
  );
161
162
  }
162
163
  if (this.variadic) {
163
- return this._concatValue(arg, previous);
164
+ return this._collectValue(arg, previous);
164
165
  }
165
166
  return arg;
166
167
  };
@@ -194,9 +195,9 @@ var require_argument = __commonJS({
194
195
  }
195
196
  });
196
197
 
197
- // node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/help.js
198
+ // node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/help.js
198
199
  var require_help = __commonJS({
199
- "node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/help.js"(exports) {
200
+ "node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/help.js"(exports) {
200
201
  var { humanReadableArgName } = require_argument();
201
202
  var Help2 = class {
202
203
  constructor() {
@@ -474,7 +475,11 @@ var require_help = __commonJS({
474
475
  extraInfo.push(`env: ${option.envVar}`);
475
476
  }
476
477
  if (extraInfo.length > 0) {
477
- return `${option.description} (${extraInfo.join(", ")})`;
478
+ const extraDescription = `(${extraInfo.join(", ")})`;
479
+ if (option.description) {
480
+ return `${option.description} ${extraDescription}`;
481
+ }
482
+ return extraDescription;
478
483
  }
479
484
  return option.description;
480
485
  }
@@ -506,6 +511,43 @@ var require_help = __commonJS({
506
511
  }
507
512
  return argument.description;
508
513
  }
514
+ /**
515
+ * Format a list of items, given a heading and an array of formatted items.
516
+ *
517
+ * @param {string} heading
518
+ * @param {string[]} items
519
+ * @param {Help} helper
520
+ * @returns string[]
521
+ */
522
+ formatItemList(heading, items, helper) {
523
+ if (items.length === 0)
524
+ return [];
525
+ return [helper.styleTitle(heading), ...items, ""];
526
+ }
527
+ /**
528
+ * Group items by their help group heading.
529
+ *
530
+ * @param {Command[] | Option[]} unsortedItems
531
+ * @param {Command[] | Option[]} visibleItems
532
+ * @param {Function} getGroup
533
+ * @returns {Map<string, Command[] | Option[]>}
534
+ */
535
+ groupItems(unsortedItems, visibleItems, getGroup) {
536
+ const result = /* @__PURE__ */ new Map();
537
+ unsortedItems.forEach((item) => {
538
+ const group = getGroup(item);
539
+ if (!result.has(group))
540
+ result.set(group, []);
541
+ });
542
+ visibleItems.forEach((item) => {
543
+ const group = getGroup(item);
544
+ if (!result.has(group)) {
545
+ result.set(group, []);
546
+ }
547
+ result.get(group).push(item);
548
+ });
549
+ return result;
550
+ }
509
551
  /**
510
552
  * Generate the built-in help text.
511
553
  *
@@ -539,26 +581,23 @@ var require_help = __commonJS({
539
581
  helper.styleArgumentDescription(helper.argumentDescription(argument))
540
582
  );
541
583
  });
542
- if (argumentList.length > 0) {
543
- output = output.concat([
544
- helper.styleTitle("Arguments:"),
545
- ...argumentList,
546
- ""
547
- ]);
548
- }
549
- const optionList = helper.visibleOptions(cmd).map((option) => {
550
- return callFormatItem(
551
- helper.styleOptionTerm(helper.optionTerm(option)),
552
- helper.styleOptionDescription(helper.optionDescription(option))
553
- );
584
+ output = output.concat(
585
+ this.formatItemList("Arguments:", argumentList, helper)
586
+ );
587
+ const optionGroups = this.groupItems(
588
+ cmd.options,
589
+ helper.visibleOptions(cmd),
590
+ (option) => option.helpGroupHeading ?? "Options:"
591
+ );
592
+ optionGroups.forEach((options, group) => {
593
+ const optionList = options.map((option) => {
594
+ return callFormatItem(
595
+ helper.styleOptionTerm(helper.optionTerm(option)),
596
+ helper.styleOptionDescription(helper.optionDescription(option))
597
+ );
598
+ });
599
+ output = output.concat(this.formatItemList(group, optionList, helper));
554
600
  });
555
- if (optionList.length > 0) {
556
- output = output.concat([
557
- helper.styleTitle("Options:"),
558
- ...optionList,
559
- ""
560
- ]);
561
- }
562
601
  if (helper.showGlobalOptions) {
563
602
  const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
564
603
  return callFormatItem(
@@ -566,27 +605,24 @@ var require_help = __commonJS({
566
605
  helper.styleOptionDescription(helper.optionDescription(option))
567
606
  );
568
607
  });
569
- if (globalOptionList.length > 0) {
570
- output = output.concat([
571
- helper.styleTitle("Global Options:"),
572
- ...globalOptionList,
573
- ""
574
- ]);
575
- }
576
- }
577
- const commandList = helper.visibleCommands(cmd).map((cmd2) => {
578
- return callFormatItem(
579
- helper.styleSubcommandTerm(helper.subcommandTerm(cmd2)),
580
- helper.styleSubcommandDescription(helper.subcommandDescription(cmd2))
608
+ output = output.concat(
609
+ this.formatItemList("Global Options:", globalOptionList, helper)
581
610
  );
582
- });
583
- if (commandList.length > 0) {
584
- output = output.concat([
585
- helper.styleTitle("Commands:"),
586
- ...commandList,
587
- ""
588
- ]);
589
611
  }
612
+ const commandGroups = this.groupItems(
613
+ cmd.commands,
614
+ helper.visibleCommands(cmd),
615
+ (sub) => sub.helpGroup() || "Commands:"
616
+ );
617
+ commandGroups.forEach((commands, group) => {
618
+ const commandList = commands.map((sub) => {
619
+ return callFormatItem(
620
+ helper.styleSubcommandTerm(helper.subcommandTerm(sub)),
621
+ helper.styleSubcommandDescription(helper.subcommandDescription(sub))
622
+ );
623
+ });
624
+ output = output.concat(this.formatItemList(group, commandList, helper));
625
+ });
590
626
  return output.join("\n");
591
627
  }
592
628
  /**
@@ -769,9 +805,9 @@ ${itemIndentStr}`);
769
805
  }
770
806
  });
771
807
 
772
- // node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/option.js
808
+ // node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/option.js
773
809
  var require_option = __commonJS({
774
- "node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/option.js"(exports) {
810
+ "node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/option.js"(exports) {
775
811
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
776
812
  var Option2 = class {
777
813
  /**
@@ -803,6 +839,7 @@ var require_option = __commonJS({
803
839
  this.argChoices = void 0;
804
840
  this.conflictsWith = [];
805
841
  this.implied = void 0;
842
+ this.helpGroupHeading = void 0;
806
843
  }
807
844
  /**
808
845
  * Set the default value, and optionally supply the description to be displayed in the help.
@@ -913,11 +950,12 @@ var require_option = __commonJS({
913
950
  /**
914
951
  * @package
915
952
  */
916
- _concatValue(value, previous) {
953
+ _collectValue(value, previous) {
917
954
  if (previous === this.defaultValue || !Array.isArray(previous)) {
918
955
  return [value];
919
956
  }
920
- return previous.concat(value);
957
+ previous.push(value);
958
+ return previous;
921
959
  }
922
960
  /**
923
961
  * Only allow option value to be one of choices.
@@ -934,7 +972,7 @@ var require_option = __commonJS({
934
972
  );
935
973
  }
936
974
  if (this.variadic) {
937
- return this._concatValue(arg, previous);
975
+ return this._collectValue(arg, previous);
938
976
  }
939
977
  return arg;
940
978
  };
@@ -963,6 +1001,16 @@ var require_option = __commonJS({
963
1001
  }
964
1002
  return camelcase(this.name());
965
1003
  }
1004
+ /**
1005
+ * Set the help group heading.
1006
+ *
1007
+ * @param {string} heading
1008
+ * @return {Option}
1009
+ */
1010
+ helpGroup(heading) {
1011
+ this.helpGroupHeading = heading;
1012
+ return this;
1013
+ }
966
1014
  /**
967
1015
  * Check if `arg` matches the short or long flag.
968
1016
  *
@@ -1073,9 +1121,9 @@ var require_option = __commonJS({
1073
1121
  }
1074
1122
  });
1075
1123
 
1076
- // node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/suggestSimilar.js
1124
+ // node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/suggestSimilar.js
1077
1125
  var require_suggestSimilar = __commonJS({
1078
- "node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/suggestSimilar.js"(exports) {
1126
+ "node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/suggestSimilar.js"(exports) {
1079
1127
  var maxDistance = 3;
1080
1128
  function editDistance(a, b) {
1081
1129
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -1155,9 +1203,9 @@ var require_suggestSimilar = __commonJS({
1155
1203
  }
1156
1204
  });
1157
1205
 
1158
- // node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/command.js
1206
+ // node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/command.js
1159
1207
  var require_command = __commonJS({
1160
- "node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/lib/command.js"(exports) {
1208
+ "node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/lib/command.js"(exports) {
1161
1209
  var EventEmitter = require("node:events").EventEmitter;
1162
1210
  var childProcess = require("node:child_process");
1163
1211
  var path2 = require("node:path");
@@ -1229,6 +1277,9 @@ var require_command = __commonJS({
1229
1277
  this._addImplicitHelpCommand = void 0;
1230
1278
  this._helpCommand = void 0;
1231
1279
  this._helpConfiguration = {};
1280
+ this._helpGroupHeading = void 0;
1281
+ this._defaultCommandGroup = void 0;
1282
+ this._defaultOptionGroup = void 0;
1232
1283
  }
1233
1284
  /**
1234
1285
  * Copy settings that are useful to have in common across root command and subcommands.
@@ -1373,7 +1424,10 @@ var require_command = __commonJS({
1373
1424
  configureOutput(configuration) {
1374
1425
  if (configuration === void 0)
1375
1426
  return this._outputConfiguration;
1376
- Object.assign(this._outputConfiguration, configuration);
1427
+ this._outputConfiguration = {
1428
+ ...this._outputConfiguration,
1429
+ ...configuration
1430
+ };
1377
1431
  return this;
1378
1432
  }
1379
1433
  /**
@@ -1447,16 +1501,16 @@ var require_command = __commonJS({
1447
1501
  *
1448
1502
  * @param {string} name
1449
1503
  * @param {string} [description]
1450
- * @param {(Function|*)} [fn] - custom argument processing function
1504
+ * @param {(Function|*)} [parseArg] - custom argument processing function or default value
1451
1505
  * @param {*} [defaultValue]
1452
1506
  * @return {Command} `this` command for chaining
1453
1507
  */
1454
- argument(name, description, fn, defaultValue) {
1508
+ argument(name, description, parseArg, defaultValue) {
1455
1509
  const argument = this.createArgument(name, description);
1456
- if (typeof fn === "function") {
1457
- argument.default(defaultValue).argParser(fn);
1510
+ if (typeof parseArg === "function") {
1511
+ argument.default(defaultValue).argParser(parseArg);
1458
1512
  } else {
1459
- argument.default(fn);
1513
+ argument.default(parseArg);
1460
1514
  }
1461
1515
  this.addArgument(argument);
1462
1516
  return this;
@@ -1486,7 +1540,7 @@ var require_command = __commonJS({
1486
1540
  */
1487
1541
  addArgument(argument) {
1488
1542
  const previousArgument = this.registeredArguments.slice(-1)[0];
1489
- if (previousArgument && previousArgument.variadic) {
1543
+ if (previousArgument == null ? void 0 : previousArgument.variadic) {
1490
1544
  throw new Error(
1491
1545
  `only the last argument can be variadic '${previousArgument.name()}'`
1492
1546
  );
@@ -1515,10 +1569,13 @@ var require_command = __commonJS({
1515
1569
  helpCommand(enableOrNameAndArgs, description) {
1516
1570
  if (typeof enableOrNameAndArgs === "boolean") {
1517
1571
  this._addImplicitHelpCommand = enableOrNameAndArgs;
1572
+ if (enableOrNameAndArgs && this._defaultCommandGroup) {
1573
+ this._initCommandGroup(this._getHelpCommand());
1574
+ }
1518
1575
  return this;
1519
1576
  }
1520
- enableOrNameAndArgs = enableOrNameAndArgs ?? "help [command]";
1521
- const [, helpName, helpArgs] = enableOrNameAndArgs.match(/([^ ]+) *(.*)/);
1577
+ const nameAndArgs = enableOrNameAndArgs ?? "help [command]";
1578
+ const [, helpName, helpArgs] = nameAndArgs.match(/([^ ]+) *(.*)/);
1522
1579
  const helpDescription = description ?? "display help for command";
1523
1580
  const helpCommand = this.createCommand(helpName);
1524
1581
  helpCommand.helpOption(false);
@@ -1528,6 +1585,8 @@ var require_command = __commonJS({
1528
1585
  helpCommand.description(helpDescription);
1529
1586
  this._addImplicitHelpCommand = true;
1530
1587
  this._helpCommand = helpCommand;
1588
+ if (enableOrNameAndArgs || description)
1589
+ this._initCommandGroup(helpCommand);
1531
1590
  return this;
1532
1591
  }
1533
1592
  /**
@@ -1544,6 +1603,7 @@ var require_command = __commonJS({
1544
1603
  }
1545
1604
  this._addImplicitHelpCommand = true;
1546
1605
  this._helpCommand = helpCommand;
1606
+ this._initCommandGroup(helpCommand);
1547
1607
  return this;
1548
1608
  }
1549
1609
  /**
@@ -1692,6 +1752,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1692
1752
  throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'
1693
1753
  - already used by option '${matchingOption.flags}'`);
1694
1754
  }
1755
+ this._initOptionGroup(option);
1695
1756
  this.options.push(option);
1696
1757
  }
1697
1758
  /**
@@ -1715,6 +1776,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1715
1776
  `cannot add command '${newCmd}' as already have command '${existingCmd}'`
1716
1777
  );
1717
1778
  }
1779
+ this._initCommandGroup(command);
1718
1780
  this.commands.push(command);
1719
1781
  }
1720
1782
  /**
@@ -1747,7 +1809,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1747
1809
  if (val !== null && option.parseArg) {
1748
1810
  val = this._callParseArg(option, val, oldValue, invalidValueMessage);
1749
1811
  } else if (val !== null && option.variadic) {
1750
- val = option._concatValue(val, oldValue);
1812
+ val = option._collectValue(val, oldValue);
1751
1813
  }
1752
1814
  if (val == null) {
1753
1815
  if (option.negate) {
@@ -2406,7 +2468,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2406
2468
  * @private
2407
2469
  */
2408
2470
  _chainOrCall(promise, fn) {
2409
- if (promise && promise.then && typeof promise.then === "function") {
2471
+ if ((promise == null ? void 0 : promise.then) && typeof promise.then === "function") {
2410
2472
  return promise.then(() => fn());
2411
2473
  }
2412
2474
  return fn();
@@ -2462,6 +2524,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2462
2524
  * @private
2463
2525
  */
2464
2526
  _parseCommand(operands, unknown) {
2527
+ var _a;
2465
2528
  const parsed = this.parseOptions(unknown);
2466
2529
  this._parseOptionsEnv();
2467
2530
  this._parseOptionsImplied();
@@ -2511,7 +2574,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2511
2574
  promiseChain = this._chainOrCallHooks(promiseChain, "postAction");
2512
2575
  return promiseChain;
2513
2576
  }
2514
- if (this.parent && this.parent.listenerCount(commandEvent)) {
2577
+ if ((_a = this.parent) == null ? void 0 : _a.listenerCount(commandEvent)) {
2515
2578
  checkForUnknownOptions();
2516
2579
  this._processArguments();
2517
2580
  this.parent.emit(commandEvent, operands, unknown);
@@ -2623,27 +2686,36 @@ Expecting one of '${allowedValues.join("', '")}'`);
2623
2686
  * sub --unknown uuu op => [sub], [--unknown uuu op]
2624
2687
  * sub -- --unknown uuu op => [sub --unknown uuu op], []
2625
2688
  *
2626
- * @param {string[]} argv
2689
+ * @param {string[]} args
2627
2690
  * @return {{operands: string[], unknown: string[]}}
2628
2691
  */
2629
- parseOptions(argv) {
2692
+ parseOptions(args) {
2630
2693
  const operands = [];
2631
2694
  const unknown = [];
2632
2695
  let dest = operands;
2633
- const args = argv.slice();
2634
2696
  function maybeOption(arg) {
2635
2697
  return arg.length > 1 && arg[0] === "-";
2636
2698
  }
2699
+ const negativeNumberArg = (arg) => {
2700
+ if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg))
2701
+ return false;
2702
+ return !this._getCommandAndAncestors().some(
2703
+ (cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short))
2704
+ );
2705
+ };
2637
2706
  let activeVariadicOption = null;
2638
- while (args.length) {
2639
- const arg = args.shift();
2707
+ let activeGroup = null;
2708
+ let i = 0;
2709
+ while (i < args.length || activeGroup) {
2710
+ const arg = activeGroup ?? args[i++];
2711
+ activeGroup = null;
2640
2712
  if (arg === "--") {
2641
2713
  if (dest === unknown)
2642
2714
  dest.push(arg);
2643
- dest.push(...args);
2715
+ dest.push(...args.slice(i));
2644
2716
  break;
2645
2717
  }
2646
- if (activeVariadicOption && !maybeOption(arg)) {
2718
+ if (activeVariadicOption && (!maybeOption(arg) || negativeNumberArg(arg))) {
2647
2719
  this.emit(`option:${activeVariadicOption.name()}`, arg);
2648
2720
  continue;
2649
2721
  }
@@ -2652,14 +2724,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
2652
2724
  const option = this._findOption(arg);
2653
2725
  if (option) {
2654
2726
  if (option.required) {
2655
- const value = args.shift();
2727
+ const value = args[i++];
2656
2728
  if (value === void 0)
2657
2729
  this.optionMissingArgument(option);
2658
2730
  this.emit(`option:${option.name()}`, value);
2659
2731
  } else if (option.optional) {
2660
2732
  let value = null;
2661
- if (args.length > 0 && !maybeOption(args[0])) {
2662
- value = args.shift();
2733
+ if (i < args.length && (!maybeOption(args[i]) || negativeNumberArg(args[i]))) {
2734
+ value = args[i++];
2663
2735
  }
2664
2736
  this.emit(`option:${option.name()}`, value);
2665
2737
  } else {
@@ -2676,7 +2748,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2676
2748
  this.emit(`option:${option.name()}`, arg.slice(2));
2677
2749
  } else {
2678
2750
  this.emit(`option:${option.name()}`);
2679
- args.unshift(`-${arg.slice(2)}`);
2751
+ activeGroup = `-${arg.slice(2)}`;
2680
2752
  }
2681
2753
  continue;
2682
2754
  }
@@ -2689,31 +2761,24 @@ Expecting one of '${allowedValues.join("', '")}'`);
2689
2761
  continue;
2690
2762
  }
2691
2763
  }
2692
- if (maybeOption(arg)) {
2764
+ if (dest === operands && maybeOption(arg) && !(this.commands.length === 0 && negativeNumberArg(arg))) {
2693
2765
  dest = unknown;
2694
2766
  }
2695
2767
  if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown.length === 0) {
2696
2768
  if (this._findCommand(arg)) {
2697
2769
  operands.push(arg);
2698
- if (args.length > 0)
2699
- unknown.push(...args);
2770
+ unknown.push(...args.slice(i));
2700
2771
  break;
2701
2772
  } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
2702
- operands.push(arg);
2703
- if (args.length > 0)
2704
- operands.push(...args);
2773
+ operands.push(arg, ...args.slice(i));
2705
2774
  break;
2706
2775
  } else if (this._defaultCommandName) {
2707
- unknown.push(arg);
2708
- if (args.length > 0)
2709
- unknown.push(...args);
2776
+ unknown.push(arg, ...args.slice(i));
2710
2777
  break;
2711
2778
  }
2712
2779
  }
2713
2780
  if (this._passThroughOptions) {
2714
- dest.push(arg);
2715
- if (args.length > 0)
2716
- dest.push(...args);
2781
+ dest.push(arg, ...args.slice(i));
2717
2782
  break;
2718
2783
  }
2719
2784
  dest.push(arg);
@@ -3075,6 +3140,72 @@ Expecting one of '${allowedValues.join("', '")}'`);
3075
3140
  this._name = str;
3076
3141
  return this;
3077
3142
  }
3143
+ /**
3144
+ * Set/get the help group heading for this subcommand in parent command's help.
3145
+ *
3146
+ * @param {string} [heading]
3147
+ * @return {Command | string}
3148
+ */
3149
+ helpGroup(heading) {
3150
+ if (heading === void 0)
3151
+ return this._helpGroupHeading ?? "";
3152
+ this._helpGroupHeading = heading;
3153
+ return this;
3154
+ }
3155
+ /**
3156
+ * Set/get the default help group heading for subcommands added to this command.
3157
+ * (This does not override a group set directly on the subcommand using .helpGroup().)
3158
+ *
3159
+ * @example
3160
+ * program.commandsGroup('Development Commands:);
3161
+ * program.command('watch')...
3162
+ * program.command('lint')...
3163
+ * ...
3164
+ *
3165
+ * @param {string} [heading]
3166
+ * @returns {Command | string}
3167
+ */
3168
+ commandsGroup(heading) {
3169
+ if (heading === void 0)
3170
+ return this._defaultCommandGroup ?? "";
3171
+ this._defaultCommandGroup = heading;
3172
+ return this;
3173
+ }
3174
+ /**
3175
+ * Set/get the default help group heading for options added to this command.
3176
+ * (This does not override a group set directly on the option using .helpGroup().)
3177
+ *
3178
+ * @example
3179
+ * program
3180
+ * .optionsGroup('Development Options:')
3181
+ * .option('-d, --debug', 'output extra debugging')
3182
+ * .option('-p, --profile', 'output profiling information')
3183
+ *
3184
+ * @param {string} [heading]
3185
+ * @returns {Command | string}
3186
+ */
3187
+ optionsGroup(heading) {
3188
+ if (heading === void 0)
3189
+ return this._defaultOptionGroup ?? "";
3190
+ this._defaultOptionGroup = heading;
3191
+ return this;
3192
+ }
3193
+ /**
3194
+ * @param {Option} option
3195
+ * @private
3196
+ */
3197
+ _initOptionGroup(option) {
3198
+ if (this._defaultOptionGroup && !option.helpGroupHeading)
3199
+ option.helpGroup(this._defaultOptionGroup);
3200
+ }
3201
+ /**
3202
+ * @param {Command} cmd
3203
+ * @private
3204
+ */
3205
+ _initCommandGroup(cmd) {
3206
+ if (this._defaultCommandGroup && !cmd.helpGroup())
3207
+ cmd.helpGroup(this._defaultCommandGroup);
3208
+ }
3078
3209
  /**
3079
3210
  * Set the name of the command from script filename, such as process.argv[1],
3080
3211
  * or require.main.filename, or __filename.
@@ -3213,15 +3344,22 @@ Expecting one of '${allowedValues.join("', '")}'`);
3213
3344
  helpOption(flags, description) {
3214
3345
  if (typeof flags === "boolean") {
3215
3346
  if (flags) {
3216
- this._helpOption = this._helpOption ?? void 0;
3347
+ if (this._helpOption === null)
3348
+ this._helpOption = void 0;
3349
+ if (this._defaultOptionGroup) {
3350
+ this._initOptionGroup(this._getHelpOption());
3351
+ }
3217
3352
  } else {
3218
3353
  this._helpOption = null;
3219
3354
  }
3220
3355
  return this;
3221
3356
  }
3222
- flags = flags ?? "-h, --help";
3223
- description = description ?? "display help for command";
3224
- this._helpOption = this.createOption(flags, description);
3357
+ this._helpOption = this.createOption(
3358
+ flags ?? "-h, --help",
3359
+ description ?? "display help for command"
3360
+ );
3361
+ if (flags || description)
3362
+ this._initOptionGroup(this._helpOption);
3225
3363
  return this;
3226
3364
  }
3227
3365
  /**
@@ -3246,6 +3384,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3246
3384
  */
3247
3385
  addHelpOption(option) {
3248
3386
  this._helpOption = option;
3387
+ this._initOptionGroup(option);
3249
3388
  return this;
3250
3389
  }
3251
3390
  /**
@@ -3358,9 +3497,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3358
3497
  }
3359
3498
  });
3360
3499
 
3361
- // node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/index.js
3500
+ // node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/index.js
3362
3501
  var require_commander = __commonJS({
3363
- "node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/index.js"(exports) {
3502
+ "node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/index.js"(exports) {
3364
3503
  var { Argument: Argument2 } = require_argument();
3365
3504
  var { Command: Command2 } = require_command();
3366
3505
  var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
@@ -9229,139 +9368,11 @@ var require_loud_rejection = __commonJS({
9229
9368
  }
9230
9369
  });
9231
9370
 
9232
- // node_modules/.aspect_rules_js/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
9233
- function __spreadArray(to, from, pack) {
9234
- if (pack || arguments.length === 2)
9235
- for (var i = 0, l = from.length, ar; i < l; i++) {
9236
- if (ar || !(i in from)) {
9237
- if (!ar)
9238
- ar = Array.prototype.slice.call(from, 0, i);
9239
- ar[i] = from[i];
9240
- }
9241
- }
9242
- return to.concat(ar || Array.prototype.slice.call(from));
9243
- }
9244
- var __assign;
9245
- var init_tslib_es6 = __esm({
9246
- "node_modules/.aspect_rules_js/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs"() {
9247
- __assign = function() {
9248
- __assign = Object.assign || function __assign2(t) {
9249
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9250
- s = arguments[i];
9251
- for (var p2 in s)
9252
- if (Object.prototype.hasOwnProperty.call(s, p2))
9253
- t[p2] = s[p2];
9254
- }
9255
- return t;
9256
- };
9257
- return __assign.apply(this, arguments);
9258
- };
9259
- }
9260
- });
9261
-
9262
- // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/error.js
9263
- var ErrorKind;
9264
- var init_error = __esm({
9265
- "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/error.js"() {
9266
- (function(ErrorKind2) {
9267
- ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_CLOSING_BRACE"] = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE";
9268
- ErrorKind2[ErrorKind2["EMPTY_ARGUMENT"] = 2] = "EMPTY_ARGUMENT";
9269
- ErrorKind2[ErrorKind2["MALFORMED_ARGUMENT"] = 3] = "MALFORMED_ARGUMENT";
9270
- ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_TYPE"] = 4] = "EXPECT_ARGUMENT_TYPE";
9271
- ErrorKind2[ErrorKind2["INVALID_ARGUMENT_TYPE"] = 5] = "INVALID_ARGUMENT_TYPE";
9272
- ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_STYLE"] = 6] = "EXPECT_ARGUMENT_STYLE";
9273
- ErrorKind2[ErrorKind2["INVALID_NUMBER_SKELETON"] = 7] = "INVALID_NUMBER_SKELETON";
9274
- ErrorKind2[ErrorKind2["INVALID_DATE_TIME_SKELETON"] = 8] = "INVALID_DATE_TIME_SKELETON";
9275
- ErrorKind2[ErrorKind2["EXPECT_NUMBER_SKELETON"] = 9] = "EXPECT_NUMBER_SKELETON";
9276
- ErrorKind2[ErrorKind2["EXPECT_DATE_TIME_SKELETON"] = 10] = "EXPECT_DATE_TIME_SKELETON";
9277
- ErrorKind2[ErrorKind2["UNCLOSED_QUOTE_IN_ARGUMENT_STYLE"] = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE";
9278
- ErrorKind2[ErrorKind2["EXPECT_SELECT_ARGUMENT_OPTIONS"] = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS";
9279
- ErrorKind2[ErrorKind2["EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE"] = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE";
9280
- ErrorKind2[ErrorKind2["INVALID_PLURAL_ARGUMENT_OFFSET_VALUE"] = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE";
9281
- ErrorKind2[ErrorKind2["EXPECT_SELECT_ARGUMENT_SELECTOR"] = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR";
9282
- ErrorKind2[ErrorKind2["EXPECT_PLURAL_ARGUMENT_SELECTOR"] = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR";
9283
- ErrorKind2[ErrorKind2["EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT"] = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT";
9284
- ErrorKind2[ErrorKind2["EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT"] = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT";
9285
- ErrorKind2[ErrorKind2["INVALID_PLURAL_ARGUMENT_SELECTOR"] = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR";
9286
- ErrorKind2[ErrorKind2["DUPLICATE_PLURAL_ARGUMENT_SELECTOR"] = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR";
9287
- ErrorKind2[ErrorKind2["DUPLICATE_SELECT_ARGUMENT_SELECTOR"] = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR";
9288
- ErrorKind2[ErrorKind2["MISSING_OTHER_CLAUSE"] = 22] = "MISSING_OTHER_CLAUSE";
9289
- ErrorKind2[ErrorKind2["INVALID_TAG"] = 23] = "INVALID_TAG";
9290
- ErrorKind2[ErrorKind2["INVALID_TAG_NAME"] = 25] = "INVALID_TAG_NAME";
9291
- ErrorKind2[ErrorKind2["UNMATCHED_CLOSING_TAG"] = 26] = "UNMATCHED_CLOSING_TAG";
9292
- ErrorKind2[ErrorKind2["UNCLOSED_TAG"] = 27] = "UNCLOSED_TAG";
9293
- })(ErrorKind || (ErrorKind = {}));
9294
- }
9295
- });
9296
-
9297
- // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/types.js
9298
- function isLiteralElement(el) {
9299
- return el.type === TYPE.literal;
9300
- }
9301
- function isArgumentElement(el) {
9302
- return el.type === TYPE.argument;
9303
- }
9304
- function isNumberElement(el) {
9305
- return el.type === TYPE.number;
9306
- }
9307
- function isDateElement(el) {
9308
- return el.type === TYPE.date;
9309
- }
9310
- function isTimeElement(el) {
9311
- return el.type === TYPE.time;
9312
- }
9313
- function isSelectElement(el) {
9314
- return el.type === TYPE.select;
9315
- }
9316
- function isPluralElement(el) {
9317
- return el.type === TYPE.plural;
9318
- }
9319
- function isPoundElement(el) {
9320
- return el.type === TYPE.pound;
9321
- }
9322
- function isTagElement(el) {
9323
- return el.type === TYPE.tag;
9324
- }
9325
- function isNumberSkeleton(el) {
9326
- return !!(el && typeof el === "object" && el.type === SKELETON_TYPE.number);
9327
- }
9328
- function isDateTimeSkeleton(el) {
9329
- return !!(el && typeof el === "object" && el.type === SKELETON_TYPE.dateTime);
9330
- }
9331
- var TYPE, SKELETON_TYPE;
9332
- var init_types = __esm({
9333
- "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/types.js"() {
9334
- (function(TYPE2) {
9335
- TYPE2[TYPE2["literal"] = 0] = "literal";
9336
- TYPE2[TYPE2["argument"] = 1] = "argument";
9337
- TYPE2[TYPE2["number"] = 2] = "number";
9338
- TYPE2[TYPE2["date"] = 3] = "date";
9339
- TYPE2[TYPE2["time"] = 4] = "time";
9340
- TYPE2[TYPE2["select"] = 5] = "select";
9341
- TYPE2[TYPE2["plural"] = 6] = "plural";
9342
- TYPE2[TYPE2["pound"] = 7] = "pound";
9343
- TYPE2[TYPE2["tag"] = 8] = "tag";
9344
- })(TYPE || (TYPE = {}));
9345
- (function(SKELETON_TYPE2) {
9346
- SKELETON_TYPE2[SKELETON_TYPE2["number"] = 0] = "number";
9347
- SKELETON_TYPE2[SKELETON_TYPE2["dateTime"] = 1] = "dateTime";
9348
- })(SKELETON_TYPE || (SKELETON_TYPE = {}));
9349
- }
9350
- });
9351
-
9352
- // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/regex.generated.js
9353
- var SPACE_SEPARATOR_REGEX;
9354
- var init_regex_generated = __esm({
9355
- "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/regex.generated.js"() {
9356
- SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
9357
- }
9358
- });
9359
-
9360
9371
  // node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/date-time.js
9361
9372
  function parseDateTimeSkeleton(skeleton) {
9362
- var result = {};
9363
- skeleton.replace(DATE_TIME_REGEX, function(match) {
9364
- var len = match.length;
9373
+ const result = {};
9374
+ skeleton.replace(DATE_TIME_REGEX, (match) => {
9375
+ const len = match.length;
9365
9376
  switch (match[0]) {
9366
9377
  case "G":
9367
9378
  result.era = len === 4 ? "long" : len === 5 ? "narrow" : "short";
@@ -9379,7 +9390,13 @@ function parseDateTimeSkeleton(skeleton) {
9379
9390
  throw new RangeError("`q/Q` (quarter) patterns are not supported");
9380
9391
  case "M":
9381
9392
  case "L":
9382
- result.month = ["numeric", "2-digit", "short", "long", "narrow"][len - 1];
9393
+ result.month = [
9394
+ "numeric",
9395
+ "2-digit",
9396
+ "short",
9397
+ "long",
9398
+ "narrow"
9399
+ ][len - 1];
9383
9400
  break;
9384
9401
  case "w":
9385
9402
  case "W":
@@ -9398,13 +9415,23 @@ function parseDateTimeSkeleton(skeleton) {
9398
9415
  if (len < 4) {
9399
9416
  throw new RangeError("`e..eee` (weekday) patterns are not supported");
9400
9417
  }
9401
- result.weekday = ["short", "long", "narrow", "short"][len - 4];
9418
+ result.weekday = [
9419
+ "short",
9420
+ "long",
9421
+ "narrow",
9422
+ "short"
9423
+ ][len - 4];
9402
9424
  break;
9403
9425
  case "c":
9404
9426
  if (len < 4) {
9405
9427
  throw new RangeError("`c..ccc` (weekday) patterns are not supported");
9406
9428
  }
9407
- result.weekday = ["short", "long", "narrow", "short"][len - 4];
9429
+ result.weekday = [
9430
+ "short",
9431
+ "long",
9432
+ "narrow",
9433
+ "short"
9434
+ ][len - 4];
9408
9435
  break;
9409
9436
  case "a":
9410
9437
  result.hour12 = true;
@@ -9465,7 +9492,7 @@ var init_date_time = __esm({
9465
9492
 
9466
9493
  // node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/regex.generated.js
9467
9494
  var WHITE_SPACE_REGEX;
9468
- var init_regex_generated2 = __esm({
9495
+ var init_regex_generated = __esm({
9469
9496
  "node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/regex.generated.js"() {
9470
9497
  WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
9471
9498
  }
@@ -9476,24 +9503,23 @@ function parseNumberSkeletonFromString(skeleton) {
9476
9503
  if (skeleton.length === 0) {
9477
9504
  throw new Error("Number skeleton cannot be empty");
9478
9505
  }
9479
- var stringTokens = skeleton.split(WHITE_SPACE_REGEX).filter(function(x) {
9480
- return x.length > 0;
9481
- });
9482
- var tokens = [];
9483
- for (var _i = 0, stringTokens_1 = stringTokens; _i < stringTokens_1.length; _i++) {
9484
- var stringToken = stringTokens_1[_i];
9485
- var stemAndOptions = stringToken.split("/");
9506
+ const stringTokens = skeleton.split(WHITE_SPACE_REGEX).filter((x) => x.length > 0);
9507
+ const tokens = [];
9508
+ for (const stringToken of stringTokens) {
9509
+ let stemAndOptions = stringToken.split("/");
9486
9510
  if (stemAndOptions.length === 0) {
9487
9511
  throw new Error("Invalid number skeleton");
9488
9512
  }
9489
- var stem = stemAndOptions[0], options = stemAndOptions.slice(1);
9490
- for (var _a = 0, options_1 = options; _a < options_1.length; _a++) {
9491
- var option = options_1[_a];
9513
+ const [stem, ...options] = stemAndOptions;
9514
+ for (const option of options) {
9492
9515
  if (option.length === 0) {
9493
9516
  throw new Error("Invalid number skeleton");
9494
9517
  }
9495
9518
  }
9496
- tokens.push({ stem, options });
9519
+ tokens.push({
9520
+ stem,
9521
+ options
9522
+ });
9497
9523
  }
9498
9524
  return tokens;
9499
9525
  }
@@ -9501,7 +9527,7 @@ function icuUnitToEcma(unit) {
9501
9527
  return unit.replace(/^(.*?)-/, "");
9502
9528
  }
9503
9529
  function parseSignificantPrecision(str) {
9504
- var result = {};
9530
+ const result = {};
9505
9531
  if (str[str.length - 1] === "r") {
9506
9532
  result.roundingPriority = "morePrecision";
9507
9533
  } else if (str[str.length - 1] === "s") {
@@ -9526,19 +9552,13 @@ function parseSignificantPrecision(str) {
9526
9552
  function parseSign(str) {
9527
9553
  switch (str) {
9528
9554
  case "sign-auto":
9529
- return {
9530
- signDisplay: "auto"
9531
- };
9555
+ return { signDisplay: "auto" };
9532
9556
  case "sign-accounting":
9533
9557
  case "()":
9534
- return {
9535
- currencySign: "accounting"
9536
- };
9558
+ return { currencySign: "accounting" };
9537
9559
  case "sign-always":
9538
9560
  case "+!":
9539
- return {
9540
- signDisplay: "always"
9541
- };
9561
+ return { signDisplay: "always" };
9542
9562
  case "sign-accounting-always":
9543
9563
  case "()!":
9544
9564
  return {
@@ -9547,9 +9567,7 @@ function parseSign(str) {
9547
9567
  };
9548
9568
  case "sign-except-zero":
9549
9569
  case "+?":
9550
- return {
9551
- signDisplay: "exceptZero"
9552
- };
9570
+ return { signDisplay: "exceptZero" };
9553
9571
  case "sign-accounting-except-zero":
9554
9572
  case "()?":
9555
9573
  return {
@@ -9558,26 +9576,20 @@ function parseSign(str) {
9558
9576
  };
9559
9577
  case "sign-never":
9560
9578
  case "+_":
9561
- return {
9562
- signDisplay: "never"
9563
- };
9579
+ return { signDisplay: "never" };
9564
9580
  }
9565
9581
  }
9566
9582
  function parseConciseScientificAndEngineeringStem(stem) {
9567
- var result;
9583
+ let result;
9568
9584
  if (stem[0] === "E" && stem[1] === "E") {
9569
- result = {
9570
- notation: "engineering"
9571
- };
9585
+ result = { notation: "engineering" };
9572
9586
  stem = stem.slice(2);
9573
9587
  } else if (stem[0] === "E") {
9574
- result = {
9575
- notation: "scientific"
9576
- };
9588
+ result = { notation: "scientific" };
9577
9589
  stem = stem.slice(1);
9578
9590
  }
9579
9591
  if (result) {
9580
- var signDisplay = stem.slice(0, 2);
9592
+ const signDisplay = stem.slice(0, 2);
9581
9593
  if (signDisplay === "+!") {
9582
9594
  result.signDisplay = "always";
9583
9595
  stem = stem.slice(2);
@@ -9593,17 +9605,16 @@ function parseConciseScientificAndEngineeringStem(stem) {
9593
9605
  return result;
9594
9606
  }
9595
9607
  function parseNotationOptions(opt) {
9596
- var result = {};
9597
- var signOpts = parseSign(opt);
9608
+ const result = {};
9609
+ const signOpts = parseSign(opt);
9598
9610
  if (signOpts) {
9599
9611
  return signOpts;
9600
9612
  }
9601
9613
  return result;
9602
9614
  }
9603
9615
  function parseNumberSkeleton(tokens) {
9604
- var result = {};
9605
- for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
9606
- var token = tokens_1[_i];
9616
+ let result = {};
9617
+ for (const token of tokens) {
9607
9618
  switch (token.stem) {
9608
9619
  case "percent":
9609
9620
  case "%":
@@ -9641,14 +9652,24 @@ function parseNumberSkeleton(tokens) {
9641
9652
  result.compactDisplay = "long";
9642
9653
  continue;
9643
9654
  case "scientific":
9644
- result = __assign(__assign(__assign({}, result), { notation: "scientific" }), token.options.reduce(function(all, opt2) {
9645
- return __assign(__assign({}, all), parseNotationOptions(opt2));
9646
- }, {}));
9655
+ result = {
9656
+ ...result,
9657
+ notation: "scientific",
9658
+ ...token.options.reduce((all, opt) => ({
9659
+ ...all,
9660
+ ...parseNotationOptions(opt)
9661
+ }), {})
9662
+ };
9647
9663
  continue;
9648
9664
  case "engineering":
9649
- result = __assign(__assign(__assign({}, result), { notation: "engineering" }), token.options.reduce(function(all, opt2) {
9650
- return __assign(__assign({}, all), parseNotationOptions(opt2));
9651
- }, {}));
9665
+ result = {
9666
+ ...result,
9667
+ notation: "engineering",
9668
+ ...token.options.reduce((all, opt) => ({
9669
+ ...all,
9670
+ ...parseNotationOptions(opt)
9671
+ }), {})
9672
+ };
9652
9673
  continue;
9653
9674
  case "notation-simple":
9654
9675
  result.notation = "standard";
@@ -9730,25 +9751,40 @@ function parseNumberSkeleton(tokens) {
9730
9751
  }
9731
9752
  return "";
9732
9753
  });
9733
- var opt = token.options[0];
9754
+ const opt = token.options[0];
9734
9755
  if (opt === "w") {
9735
- result = __assign(__assign({}, result), { trailingZeroDisplay: "stripIfInteger" });
9756
+ result = {
9757
+ ...result,
9758
+ trailingZeroDisplay: "stripIfInteger"
9759
+ };
9736
9760
  } else if (opt) {
9737
- result = __assign(__assign({}, result), parseSignificantPrecision(opt));
9761
+ result = {
9762
+ ...result,
9763
+ ...parseSignificantPrecision(opt)
9764
+ };
9738
9765
  }
9739
9766
  continue;
9740
9767
  }
9741
9768
  if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {
9742
- result = __assign(__assign({}, result), parseSignificantPrecision(token.stem));
9769
+ result = {
9770
+ ...result,
9771
+ ...parseSignificantPrecision(token.stem)
9772
+ };
9743
9773
  continue;
9744
9774
  }
9745
- var signOpts = parseSign(token.stem);
9775
+ const signOpts = parseSign(token.stem);
9746
9776
  if (signOpts) {
9747
- result = __assign(__assign({}, result), signOpts);
9777
+ result = {
9778
+ ...result,
9779
+ ...signOpts
9780
+ };
9748
9781
  }
9749
- var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);
9782
+ const conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);
9750
9783
  if (conciseScientificAndEngineeringOpts) {
9751
- result = __assign(__assign({}, result), conciseScientificAndEngineeringOpts);
9784
+ result = {
9785
+ ...result,
9786
+ ...conciseScientificAndEngineeringOpts
9787
+ };
9752
9788
  }
9753
9789
  }
9754
9790
  return result;
@@ -9756,8 +9792,7 @@ function parseNumberSkeleton(tokens) {
9756
9792
  var FRACTION_PRECISION_REGEX, SIGNIFICANT_PRECISION_REGEX, INTEGER_WIDTH_REGEX, CONCISE_INTEGER_WIDTH_REGEX;
9757
9793
  var init_number = __esm({
9758
9794
  "node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/number.js"() {
9759
- init_tslib_es6();
9760
- init_regex_generated2();
9795
+ init_regex_generated();
9761
9796
  FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
9762
9797
  SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
9763
9798
  INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
@@ -9773,15 +9808,115 @@ var init_icu_skeleton_parser = __esm({
9773
9808
  }
9774
9809
  });
9775
9810
 
9811
+ // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/types.js
9812
+ function isLiteralElement(el) {
9813
+ return el.type === TYPE.literal;
9814
+ }
9815
+ function isArgumentElement(el) {
9816
+ return el.type === TYPE.argument;
9817
+ }
9818
+ function isNumberElement(el) {
9819
+ return el.type === TYPE.number;
9820
+ }
9821
+ function isDateElement(el) {
9822
+ return el.type === TYPE.date;
9823
+ }
9824
+ function isTimeElement(el) {
9825
+ return el.type === TYPE.time;
9826
+ }
9827
+ function isSelectElement(el) {
9828
+ return el.type === TYPE.select;
9829
+ }
9830
+ function isPluralElement(el) {
9831
+ return el.type === TYPE.plural;
9832
+ }
9833
+ function isPoundElement(el) {
9834
+ return el.type === TYPE.pound;
9835
+ }
9836
+ function isTagElement(el) {
9837
+ return el.type === TYPE.tag;
9838
+ }
9839
+ function isNumberSkeleton(el) {
9840
+ return !!(el && typeof el === "object" && el.type === SKELETON_TYPE.number);
9841
+ }
9842
+ function isDateTimeSkeleton(el) {
9843
+ return !!(el && typeof el === "object" && el.type === SKELETON_TYPE.dateTime);
9844
+ }
9845
+ var TYPE, SKELETON_TYPE;
9846
+ var init_types = __esm({
9847
+ "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/types.js"() {
9848
+ init_icu_skeleton_parser();
9849
+ TYPE = function(TYPE2) {
9850
+ TYPE2[TYPE2["literal"] = 0] = "literal";
9851
+ TYPE2[TYPE2["argument"] = 1] = "argument";
9852
+ TYPE2[TYPE2["number"] = 2] = "number";
9853
+ TYPE2[TYPE2["date"] = 3] = "date";
9854
+ TYPE2[TYPE2["time"] = 4] = "time";
9855
+ TYPE2[TYPE2["select"] = 5] = "select";
9856
+ TYPE2[TYPE2["plural"] = 6] = "plural";
9857
+ TYPE2[TYPE2["pound"] = 7] = "pound";
9858
+ TYPE2[TYPE2["tag"] = 8] = "tag";
9859
+ return TYPE2;
9860
+ }({});
9861
+ SKELETON_TYPE = function(SKELETON_TYPE2) {
9862
+ SKELETON_TYPE2[SKELETON_TYPE2["number"] = 0] = "number";
9863
+ SKELETON_TYPE2[SKELETON_TYPE2["dateTime"] = 1] = "dateTime";
9864
+ return SKELETON_TYPE2;
9865
+ }({});
9866
+ }
9867
+ });
9868
+
9869
+ // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/error.js
9870
+ var ErrorKind;
9871
+ var init_error = __esm({
9872
+ "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/error.js"() {
9873
+ init_types();
9874
+ ErrorKind = function(ErrorKind2) {
9875
+ ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_CLOSING_BRACE"] = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE";
9876
+ ErrorKind2[ErrorKind2["EMPTY_ARGUMENT"] = 2] = "EMPTY_ARGUMENT";
9877
+ ErrorKind2[ErrorKind2["MALFORMED_ARGUMENT"] = 3] = "MALFORMED_ARGUMENT";
9878
+ ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_TYPE"] = 4] = "EXPECT_ARGUMENT_TYPE";
9879
+ ErrorKind2[ErrorKind2["INVALID_ARGUMENT_TYPE"] = 5] = "INVALID_ARGUMENT_TYPE";
9880
+ ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_STYLE"] = 6] = "EXPECT_ARGUMENT_STYLE";
9881
+ ErrorKind2[ErrorKind2["INVALID_NUMBER_SKELETON"] = 7] = "INVALID_NUMBER_SKELETON";
9882
+ ErrorKind2[ErrorKind2["INVALID_DATE_TIME_SKELETON"] = 8] = "INVALID_DATE_TIME_SKELETON";
9883
+ ErrorKind2[ErrorKind2["EXPECT_NUMBER_SKELETON"] = 9] = "EXPECT_NUMBER_SKELETON";
9884
+ ErrorKind2[ErrorKind2["EXPECT_DATE_TIME_SKELETON"] = 10] = "EXPECT_DATE_TIME_SKELETON";
9885
+ ErrorKind2[ErrorKind2["UNCLOSED_QUOTE_IN_ARGUMENT_STYLE"] = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE";
9886
+ ErrorKind2[ErrorKind2["EXPECT_SELECT_ARGUMENT_OPTIONS"] = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS";
9887
+ ErrorKind2[ErrorKind2["EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE"] = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE";
9888
+ ErrorKind2[ErrorKind2["INVALID_PLURAL_ARGUMENT_OFFSET_VALUE"] = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE";
9889
+ ErrorKind2[ErrorKind2["EXPECT_SELECT_ARGUMENT_SELECTOR"] = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR";
9890
+ ErrorKind2[ErrorKind2["EXPECT_PLURAL_ARGUMENT_SELECTOR"] = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR";
9891
+ ErrorKind2[ErrorKind2["EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT"] = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT";
9892
+ ErrorKind2[ErrorKind2["EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT"] = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT";
9893
+ ErrorKind2[ErrorKind2["INVALID_PLURAL_ARGUMENT_SELECTOR"] = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR";
9894
+ ErrorKind2[ErrorKind2["DUPLICATE_PLURAL_ARGUMENT_SELECTOR"] = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR";
9895
+ ErrorKind2[ErrorKind2["DUPLICATE_SELECT_ARGUMENT_SELECTOR"] = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR";
9896
+ ErrorKind2[ErrorKind2["MISSING_OTHER_CLAUSE"] = 22] = "MISSING_OTHER_CLAUSE";
9897
+ ErrorKind2[ErrorKind2["INVALID_TAG"] = 23] = "INVALID_TAG";
9898
+ ErrorKind2[ErrorKind2["INVALID_TAG_NAME"] = 25] = "INVALID_TAG_NAME";
9899
+ ErrorKind2[ErrorKind2["UNMATCHED_CLOSING_TAG"] = 26] = "UNMATCHED_CLOSING_TAG";
9900
+ ErrorKind2[ErrorKind2["UNCLOSED_TAG"] = 27] = "UNCLOSED_TAG";
9901
+ return ErrorKind2;
9902
+ }({});
9903
+ }
9904
+ });
9905
+
9906
+ // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/regex.generated.js
9907
+ var SPACE_SEPARATOR_REGEX;
9908
+ var init_regex_generated2 = __esm({
9909
+ "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/regex.generated.js"() {
9910
+ SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
9911
+ }
9912
+ });
9913
+
9776
9914
  // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/time-data.generated.js
9777
9915
  var timeData;
9778
9916
  var init_time_data_generated = __esm({
9779
9917
  "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/time-data.generated.js"() {
9780
9918
  timeData = {
9781
- "001": [
9782
- "H",
9783
- "h"
9784
- ],
9919
+ "001": ["H", "h"],
9785
9920
  "419": [
9786
9921
  "h",
9787
9922
  "H",
@@ -9794,10 +9929,7 @@ var init_time_data_generated = __esm({
9794
9929
  "hb",
9795
9930
  "hB"
9796
9931
  ],
9797
- "AD": [
9798
- "H",
9799
- "hB"
9800
- ],
9932
+ "AD": ["H", "hB"],
9801
9933
  "AE": [
9802
9934
  "h",
9803
9935
  "hB",
@@ -9827,41 +9959,24 @@ var init_time_data_generated = __esm({
9827
9959
  "H",
9828
9960
  "hB"
9829
9961
  ],
9830
- "AM": [
9831
- "H",
9832
- "hB"
9833
- ],
9834
- "AO": [
9835
- "H",
9836
- "hB"
9837
- ],
9962
+ "AM": ["H", "hB"],
9963
+ "AO": ["H", "hB"],
9838
9964
  "AR": [
9839
9965
  "h",
9840
9966
  "H",
9841
9967
  "hB",
9842
9968
  "hb"
9843
9969
  ],
9844
- "AS": [
9845
- "h",
9846
- "H"
9847
- ],
9848
- "AT": [
9849
- "H",
9850
- "hB"
9851
- ],
9970
+ "AS": ["h", "H"],
9971
+ "AT": ["H", "hB"],
9852
9972
  "AU": [
9853
9973
  "h",
9854
9974
  "hb",
9855
9975
  "H",
9856
9976
  "hB"
9857
9977
  ],
9858
- "AW": [
9859
- "H",
9860
- "hB"
9861
- ],
9862
- "AX": [
9863
- "H"
9864
- ],
9978
+ "AW": ["H", "hB"],
9979
+ "AX": ["H"],
9865
9980
  "AZ": [
9866
9981
  "H",
9867
9982
  "hB",
@@ -9883,14 +9998,8 @@ var init_time_data_generated = __esm({
9883
9998
  "hB",
9884
9999
  "H"
9885
10000
  ],
9886
- "BE": [
9887
- "H",
9888
- "hB"
9889
- ],
9890
- "BF": [
9891
- "H",
9892
- "hB"
9893
- ],
10001
+ "BE": ["H", "hB"],
10002
+ "BF": ["H", "hB"],
9894
10003
  "BG": [
9895
10004
  "H",
9896
10005
  "hB",
@@ -9902,18 +10011,9 @@ var init_time_data_generated = __esm({
9902
10011
  "hb",
9903
10012
  "H"
9904
10013
  ],
9905
- "BI": [
9906
- "H",
9907
- "h"
9908
- ],
9909
- "BJ": [
9910
- "H",
9911
- "hB"
9912
- ],
9913
- "BL": [
9914
- "H",
9915
- "hB"
9916
- ],
10014
+ "BI": ["H", "h"],
10015
+ "BJ": ["H", "hB"],
10016
+ "BL": ["H", "hB"],
9917
10017
  "BM": [
9918
10018
  "h",
9919
10019
  "hb",
@@ -9932,33 +10032,22 @@ var init_time_data_generated = __esm({
9932
10032
  "hB",
9933
10033
  "hb"
9934
10034
  ],
9935
- "BQ": [
9936
- "H"
9937
- ],
9938
- "BR": [
9939
- "H",
9940
- "hB"
9941
- ],
10035
+ "BQ": ["H"],
10036
+ "BR": ["H", "hB"],
9942
10037
  "BS": [
9943
10038
  "h",
9944
10039
  "hb",
9945
10040
  "H",
9946
10041
  "hB"
9947
10042
  ],
9948
- "BT": [
9949
- "h",
9950
- "H"
9951
- ],
10043
+ "BT": ["h", "H"],
9952
10044
  "BW": [
9953
10045
  "H",
9954
10046
  "h",
9955
10047
  "hb",
9956
10048
  "hB"
9957
10049
  ],
9958
- "BY": [
9959
- "H",
9960
- "h"
9961
- ],
10050
+ "BY": ["H", "h"],
9962
10051
  "BZ": [
9963
10052
  "H",
9964
10053
  "h",
@@ -9977,28 +10066,19 @@ var init_time_data_generated = __esm({
9977
10066
  "hb",
9978
10067
  "hB"
9979
10068
  ],
9980
- "CD": [
9981
- "hB",
9982
- "H"
9983
- ],
10069
+ "CD": ["hB", "H"],
9984
10070
  "CF": [
9985
10071
  "H",
9986
10072
  "h",
9987
10073
  "hB"
9988
10074
  ],
9989
- "CG": [
9990
- "H",
9991
- "hB"
9992
- ],
10075
+ "CG": ["H", "hB"],
9993
10076
  "CH": [
9994
10077
  "H",
9995
10078
  "hB",
9996
10079
  "h"
9997
10080
  ],
9998
- "CI": [
9999
- "H",
10000
- "hB"
10001
- ],
10081
+ "CI": ["H", "hB"],
10002
10082
  "CK": [
10003
10083
  "H",
10004
10084
  "h",
@@ -10028,9 +10108,7 @@ var init_time_data_generated = __esm({
10028
10108
  "hB",
10029
10109
  "hb"
10030
10110
  ],
10031
- "CP": [
10032
- "H"
10033
- ],
10111
+ "CP": ["H"],
10034
10112
  "CR": [
10035
10113
  "h",
10036
10114
  "H",
@@ -10043,14 +10121,8 @@ var init_time_data_generated = __esm({
10043
10121
  "hB",
10044
10122
  "hb"
10045
10123
  ],
10046
- "CV": [
10047
- "H",
10048
- "hB"
10049
- ],
10050
- "CW": [
10051
- "H",
10052
- "hB"
10053
- ],
10124
+ "CV": ["H", "hB"],
10125
+ "CW": ["H", "hB"],
10054
10126
  "CX": [
10055
10127
  "H",
10056
10128
  "h",
@@ -10063,26 +10135,16 @@ var init_time_data_generated = __esm({
10063
10135
  "hb",
10064
10136
  "hB"
10065
10137
  ],
10066
- "CZ": [
10067
- "H"
10068
- ],
10069
- "DE": [
10070
- "H",
10071
- "hB"
10072
- ],
10138
+ "CZ": ["H"],
10139
+ "DE": ["H", "hB"],
10073
10140
  "DG": [
10074
10141
  "H",
10075
10142
  "h",
10076
10143
  "hb",
10077
10144
  "hB"
10078
10145
  ],
10079
- "DJ": [
10080
- "h",
10081
- "H"
10082
- ],
10083
- "DK": [
10084
- "H"
10085
- ],
10146
+ "DJ": ["h", "H"],
10147
+ "DK": ["H"],
10086
10148
  "DM": [
10087
10149
  "h",
10088
10150
  "hb",
@@ -10113,10 +10175,7 @@ var init_time_data_generated = __esm({
10113
10175
  "hB",
10114
10176
  "hb"
10115
10177
  ],
10116
- "EE": [
10117
- "H",
10118
- "hB"
10119
- ],
10178
+ "EE": ["H", "hB"],
10120
10179
  "EG": [
10121
10180
  "h",
10122
10181
  "hB",
@@ -10129,10 +10188,7 @@ var init_time_data_generated = __esm({
10129
10188
  "hb",
10130
10189
  "H"
10131
10190
  ],
10132
- "ER": [
10133
- "h",
10134
- "H"
10135
- ],
10191
+ "ER": ["h", "H"],
10136
10192
  "ES": [
10137
10193
  "H",
10138
10194
  "hB",
@@ -10145,9 +10201,7 @@ var init_time_data_generated = __esm({
10145
10201
  "h",
10146
10202
  "H"
10147
10203
  ],
10148
- "FI": [
10149
- "H"
10150
- ],
10204
+ "FI": ["H"],
10151
10205
  "FJ": [
10152
10206
  "h",
10153
10207
  "hb",
@@ -10166,18 +10220,9 @@ var init_time_data_generated = __esm({
10166
10220
  "H",
10167
10221
  "hB"
10168
10222
  ],
10169
- "FO": [
10170
- "H",
10171
- "h"
10172
- ],
10173
- "FR": [
10174
- "H",
10175
- "hB"
10176
- ],
10177
- "GA": [
10178
- "H",
10179
- "hB"
10180
- ],
10223
+ "FO": ["H", "h"],
10224
+ "FR": ["H", "hB"],
10225
+ "GA": ["H", "hB"],
10181
10226
  "GB": [
10182
10227
  "H",
10183
10228
  "h",
@@ -10195,44 +10240,29 @@ var init_time_data_generated = __esm({
10195
10240
  "hB",
10196
10241
  "h"
10197
10242
  ],
10198
- "GF": [
10199
- "H",
10200
- "hB"
10201
- ],
10243
+ "GF": ["H", "hB"],
10202
10244
  "GG": [
10203
10245
  "H",
10204
10246
  "h",
10205
10247
  "hb",
10206
10248
  "hB"
10207
10249
  ],
10208
- "GH": [
10209
- "h",
10210
- "H"
10211
- ],
10250
+ "GH": ["h", "H"],
10212
10251
  "GI": [
10213
10252
  "H",
10214
10253
  "h",
10215
10254
  "hb",
10216
10255
  "hB"
10217
10256
  ],
10218
- "GL": [
10219
- "H",
10220
- "h"
10221
- ],
10257
+ "GL": ["H", "h"],
10222
10258
  "GM": [
10223
10259
  "h",
10224
10260
  "hb",
10225
10261
  "H",
10226
10262
  "hB"
10227
10263
  ],
10228
- "GN": [
10229
- "H",
10230
- "hB"
10231
- ],
10232
- "GP": [
10233
- "H",
10234
- "hB"
10235
- ],
10264
+ "GN": ["H", "hB"],
10265
+ "GP": ["H", "hB"],
10236
10266
  "GQ": [
10237
10267
  "H",
10238
10268
  "hB",
@@ -10263,10 +10293,7 @@ var init_time_data_generated = __esm({
10263
10293
  "H",
10264
10294
  "hB"
10265
10295
  ],
10266
- "GW": [
10267
- "H",
10268
- "hB"
10269
- ],
10296
+ "GW": ["H", "hB"],
10270
10297
  "GY": [
10271
10298
  "h",
10272
10299
  "hb",
@@ -10285,43 +10312,29 @@ var init_time_data_generated = __esm({
10285
10312
  "hB",
10286
10313
  "hb"
10287
10314
  ],
10288
- "HR": [
10289
- "H",
10290
- "hB"
10291
- ],
10292
- "HU": [
10293
- "H",
10294
- "h"
10295
- ],
10315
+ "HR": ["H", "hB"],
10316
+ "HU": ["H", "h"],
10296
10317
  "IC": [
10297
10318
  "H",
10298
10319
  "h",
10299
10320
  "hB",
10300
10321
  "hb"
10301
10322
  ],
10302
- "ID": [
10303
- "H"
10304
- ],
10323
+ "ID": ["H"],
10305
10324
  "IE": [
10306
10325
  "H",
10307
10326
  "h",
10308
10327
  "hb",
10309
10328
  "hB"
10310
10329
  ],
10311
- "IL": [
10312
- "H",
10313
- "hB"
10314
- ],
10330
+ "IL": ["H", "hB"],
10315
10331
  "IM": [
10316
10332
  "H",
10317
10333
  "h",
10318
10334
  "hb",
10319
10335
  "hB"
10320
10336
  ],
10321
- "IN": [
10322
- "h",
10323
- "H"
10324
- ],
10337
+ "IN": ["h", "H"],
10325
10338
  "IO": [
10326
10339
  "H",
10327
10340
  "h",
@@ -10334,17 +10347,9 @@ var init_time_data_generated = __esm({
10334
10347
  "hb",
10335
10348
  "H"
10336
10349
  ],
10337
- "IR": [
10338
- "hB",
10339
- "H"
10340
- ],
10341
- "IS": [
10342
- "H"
10343
- ],
10344
- "IT": [
10345
- "H",
10346
- "hB"
10347
- ],
10350
+ "IR": ["hB", "H"],
10351
+ "IS": ["H"],
10352
+ "IT": ["H", "hB"],
10348
10353
  "JE": [
10349
10354
  "H",
10350
10355
  "h",
@@ -10428,10 +10433,7 @@ var init_time_data_generated = __esm({
10428
10433
  "H",
10429
10434
  "hB"
10430
10435
  ],
10431
- "KZ": [
10432
- "H",
10433
- "hB"
10434
- ],
10436
+ "KZ": ["H", "hB"],
10435
10437
  "LA": [
10436
10438
  "H",
10437
10439
  "hb",
@@ -10467,10 +10469,7 @@ var init_time_data_generated = __esm({
10467
10469
  "H",
10468
10470
  "hB"
10469
10471
  ],
10470
- "LS": [
10471
- "h",
10472
- "H"
10473
- ],
10472
+ "LS": ["h", "H"],
10474
10473
  "LT": [
10475
10474
  "H",
10476
10475
  "h",
@@ -10500,27 +10499,15 @@ var init_time_data_generated = __esm({
10500
10499
  "hB",
10501
10500
  "hb"
10502
10501
  ],
10503
- "MC": [
10504
- "H",
10505
- "hB"
10506
- ],
10507
- "MD": [
10508
- "H",
10509
- "hB"
10510
- ],
10502
+ "MC": ["H", "hB"],
10503
+ "MD": ["H", "hB"],
10511
10504
  "ME": [
10512
10505
  "H",
10513
10506
  "hB",
10514
10507
  "h"
10515
10508
  ],
10516
- "MF": [
10517
- "H",
10518
- "hB"
10519
- ],
10520
- "MG": [
10521
- "H",
10522
- "h"
10523
- ],
10509
+ "MF": ["H", "hB"],
10510
+ "MG": ["H", "h"],
10524
10511
  "MH": [
10525
10512
  "h",
10526
10513
  "hb",
@@ -10533,9 +10520,7 @@ var init_time_data_generated = __esm({
10533
10520
  "hb",
10534
10521
  "hB"
10535
10522
  ],
10536
- "ML": [
10537
- "H"
10538
- ],
10523
+ "ML": ["H"],
10539
10524
  "MM": [
10540
10525
  "hB",
10541
10526
  "hb",
@@ -10560,10 +10545,7 @@ var init_time_data_generated = __esm({
10560
10545
  "H",
10561
10546
  "hB"
10562
10547
  ],
10563
- "MQ": [
10564
- "H",
10565
- "hB"
10566
- ],
10548
+ "MQ": ["H", "hB"],
10567
10549
  "MR": [
10568
10550
  "h",
10569
10551
  "hB",
@@ -10576,18 +10558,9 @@ var init_time_data_generated = __esm({
10576
10558
  "hb",
10577
10559
  "hB"
10578
10560
  ],
10579
- "MT": [
10580
- "H",
10581
- "h"
10582
- ],
10583
- "MU": [
10584
- "H",
10585
- "h"
10586
- ],
10587
- "MV": [
10588
- "H",
10589
- "h"
10590
- ],
10561
+ "MT": ["H", "h"],
10562
+ "MU": ["H", "h"],
10563
+ "MV": ["H", "h"],
10591
10564
  "MW": [
10592
10565
  "h",
10593
10566
  "hb",
@@ -10606,23 +10579,15 @@ var init_time_data_generated = __esm({
10606
10579
  "h",
10607
10580
  "H"
10608
10581
  ],
10609
- "MZ": [
10610
- "H",
10611
- "hB"
10612
- ],
10582
+ "MZ": ["H", "hB"],
10613
10583
  "NA": [
10614
10584
  "h",
10615
10585
  "H",
10616
10586
  "hB",
10617
10587
  "hb"
10618
10588
  ],
10619
- "NC": [
10620
- "H",
10621
- "hB"
10622
- ],
10623
- "NE": [
10624
- "H"
10625
- ],
10589
+ "NC": ["H", "hB"],
10590
+ "NE": ["H"],
10626
10591
  "NF": [
10627
10592
  "H",
10628
10593
  "h",
@@ -10641,14 +10606,8 @@ var init_time_data_generated = __esm({
10641
10606
  "hB",
10642
10607
  "hb"
10643
10608
  ],
10644
- "NL": [
10645
- "H",
10646
- "hB"
10647
- ],
10648
- "NO": [
10649
- "H",
10650
- "h"
10651
- ],
10609
+ "NL": ["H", "hB"],
10610
+ "NO": ["H", "h"],
10652
10611
  "NP": [
10653
10612
  "H",
10654
10613
  "h",
@@ -10695,10 +10654,7 @@ var init_time_data_generated = __esm({
10695
10654
  "h",
10696
10655
  "hB"
10697
10656
  ],
10698
- "PG": [
10699
- "h",
10700
- "H"
10701
- ],
10657
+ "PG": ["h", "H"],
10702
10658
  "PH": [
10703
10659
  "h",
10704
10660
  "hB",
@@ -10710,14 +10666,8 @@ var init_time_data_generated = __esm({
10710
10666
  "hB",
10711
10667
  "H"
10712
10668
  ],
10713
- "PL": [
10714
- "H",
10715
- "h"
10716
- ],
10717
- "PM": [
10718
- "H",
10719
- "hB"
10720
- ],
10669
+ "PL": ["H", "h"],
10670
+ "PM": ["H", "hB"],
10721
10671
  "PN": [
10722
10672
  "H",
10723
10673
  "h",
@@ -10736,14 +10686,8 @@ var init_time_data_generated = __esm({
10736
10686
  "hb",
10737
10687
  "H"
10738
10688
  ],
10739
- "PT": [
10740
- "H",
10741
- "hB"
10742
- ],
10743
- "PW": [
10744
- "h",
10745
- "H"
10746
- ],
10689
+ "PT": ["H", "hB"],
10690
+ "PW": ["h", "H"],
10747
10691
  "PY": [
10748
10692
  "h",
10749
10693
  "H",
@@ -10756,26 +10700,15 @@ var init_time_data_generated = __esm({
10756
10700
  "hb",
10757
10701
  "H"
10758
10702
  ],
10759
- "RE": [
10760
- "H",
10761
- "hB"
10762
- ],
10763
- "RO": [
10764
- "H",
10765
- "hB"
10766
- ],
10703
+ "RE": ["H", "hB"],
10704
+ "RO": ["H", "hB"],
10767
10705
  "RS": [
10768
10706
  "H",
10769
10707
  "hB",
10770
10708
  "h"
10771
10709
  ],
10772
- "RU": [
10773
- "H"
10774
- ],
10775
- "RW": [
10776
- "H",
10777
- "h"
10778
- ],
10710
+ "RU": ["H"],
10711
+ "RW": ["H", "h"],
10779
10712
  "SA": [
10780
10713
  "h",
10781
10714
  "hB",
@@ -10799,9 +10732,7 @@ var init_time_data_generated = __esm({
10799
10732
  "hb",
10800
10733
  "H"
10801
10734
  ],
10802
- "SE": [
10803
- "H"
10804
- ],
10735
+ "SE": ["H"],
10805
10736
  "SG": [
10806
10737
  "h",
10807
10738
  "hb",
@@ -10814,16 +10745,9 @@ var init_time_data_generated = __esm({
10814
10745
  "hb",
10815
10746
  "hB"
10816
10747
  ],
10817
- "SI": [
10818
- "H",
10819
- "hB"
10820
- ],
10821
- "SJ": [
10822
- "H"
10823
- ],
10824
- "SK": [
10825
- "H"
10826
- ],
10748
+ "SI": ["H", "hB"],
10749
+ "SJ": ["H"],
10750
+ "SK": ["H"],
10827
10751
  "SL": [
10828
10752
  "h",
10829
10753
  "hb",
@@ -10840,24 +10764,15 @@ var init_time_data_generated = __esm({
10840
10764
  "h",
10841
10765
  "hB"
10842
10766
  ],
10843
- "SO": [
10844
- "h",
10845
- "H"
10846
- ],
10847
- "SR": [
10848
- "H",
10849
- "hB"
10850
- ],
10767
+ "SO": ["h", "H"],
10768
+ "SR": ["H", "hB"],
10851
10769
  "SS": [
10852
10770
  "h",
10853
10771
  "hb",
10854
10772
  "H",
10855
10773
  "hB"
10856
10774
  ],
10857
- "ST": [
10858
- "H",
10859
- "hB"
10860
- ],
10775
+ "ST": ["H", "hB"],
10861
10776
  "SV": [
10862
10777
  "h",
10863
10778
  "H",
@@ -10904,42 +10819,24 @@ var init_time_data_generated = __esm({
10904
10819
  "h",
10905
10820
  "hB"
10906
10821
  ],
10907
- "TG": [
10908
- "H",
10909
- "hB"
10910
- ],
10911
- "TH": [
10912
- "H",
10913
- "h"
10914
- ],
10915
- "TJ": [
10916
- "H",
10917
- "h"
10918
- ],
10822
+ "TG": ["H", "hB"],
10823
+ "TH": ["H", "h"],
10824
+ "TJ": ["H", "h"],
10919
10825
  "TL": [
10920
10826
  "H",
10921
10827
  "hB",
10922
10828
  "hb",
10923
10829
  "h"
10924
10830
  ],
10925
- "TM": [
10926
- "H",
10927
- "h"
10928
- ],
10831
+ "TM": ["H", "h"],
10929
10832
  "TN": [
10930
10833
  "h",
10931
10834
  "hB",
10932
10835
  "hb",
10933
10836
  "H"
10934
10837
  ],
10935
- "TO": [
10936
- "h",
10937
- "H"
10938
- ],
10939
- "TR": [
10940
- "H",
10941
- "hB"
10942
- ],
10838
+ "TO": ["h", "H"],
10839
+ "TR": ["H", "hB"],
10943
10840
  "TT": [
10944
10841
  "h",
10945
10842
  "hb",
@@ -11021,22 +10918,10 @@ var init_time_data_generated = __esm({
11021
10918
  "H",
11022
10919
  "hB"
11023
10920
  ],
11024
- "VN": [
11025
- "H",
11026
- "h"
11027
- ],
11028
- "VU": [
11029
- "h",
11030
- "H"
11031
- ],
11032
- "WF": [
11033
- "H",
11034
- "hB"
11035
- ],
11036
- "WS": [
11037
- "h",
11038
- "H"
11039
- ],
10921
+ "VN": ["H", "h"],
10922
+ "VU": ["h", "H"],
10923
+ "WF": ["H", "hB"],
10924
+ "WS": ["h", "H"],
11040
10925
  "XK": [
11041
10926
  "H",
11042
10927
  "hB",
@@ -11048,10 +10933,7 @@ var init_time_data_generated = __esm({
11048
10933
  "hb",
11049
10934
  "H"
11050
10935
  ],
11051
- "YT": [
11052
- "H",
11053
- "hB"
11054
- ],
10936
+ "YT": ["H", "hB"],
11055
10937
  "ZA": [
11056
10938
  "H",
11057
10939
  "h",
@@ -11064,10 +10946,7 @@ var init_time_data_generated = __esm({
11064
10946
  "H",
11065
10947
  "hB"
11066
10948
  ],
11067
- "ZW": [
11068
- "H",
11069
- "h"
11070
- ],
10949
+ "ZW": ["H", "h"],
11071
10950
  "af-ZA": [
11072
10951
  "H",
11073
10952
  "h",
@@ -11163,10 +11042,7 @@ var init_time_data_generated = __esm({
11163
11042
  "h",
11164
11043
  "H"
11165
11044
  ],
11166
- "ku-SY": [
11167
- "H",
11168
- "hB"
11169
- ],
11045
+ "ku-SY": ["H", "hB"],
11170
11046
  "ml-IN": [
11171
11047
  "hB",
11172
11048
  "h",
@@ -11207,19 +11083,19 @@ var init_time_data_generated = __esm({
11207
11083
 
11208
11084
  // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/date-time-pattern-generator.js
11209
11085
  function getBestPattern(skeleton, locale) {
11210
- var skeletonCopy = "";
11211
- for (var patternPos = 0; patternPos < skeleton.length; patternPos++) {
11212
- var patternChar = skeleton.charAt(patternPos);
11086
+ let skeletonCopy = "";
11087
+ for (let patternPos = 0; patternPos < skeleton.length; patternPos++) {
11088
+ const patternChar = skeleton.charAt(patternPos);
11213
11089
  if (patternChar === "j") {
11214
- var extraLength = 0;
11090
+ let extraLength = 0;
11215
11091
  while (patternPos + 1 < skeleton.length && skeleton.charAt(patternPos + 1) === patternChar) {
11216
11092
  extraLength++;
11217
11093
  patternPos++;
11218
11094
  }
11219
- var hourLen = 1 + (extraLength & 1);
11220
- var dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);
11221
- var dayPeriodChar = "a";
11222
- var hourChar = getDefaultHourSymbolFromLocale(locale);
11095
+ let hourLen = 1 + (extraLength & 1);
11096
+ let dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);
11097
+ let dayPeriodChar = "a";
11098
+ let hourChar = getDefaultHourSymbolFromLocale(locale);
11223
11099
  if (hourChar == "H" || hourChar == "k") {
11224
11100
  dayPeriodLen = 0;
11225
11101
  }
@@ -11238,10 +11114,8 @@ function getBestPattern(skeleton, locale) {
11238
11114
  return skeletonCopy;
11239
11115
  }
11240
11116
  function getDefaultHourSymbolFromLocale(locale) {
11241
- var hourCycle = locale.hourCycle;
11242
- if (hourCycle === void 0 && // @ts-ignore hourCycle(s) is not identified yet
11243
- locale.hourCycles && // @ts-ignore
11244
- locale.hourCycles.length) {
11117
+ let hourCycle = locale.hourCycle;
11118
+ if (hourCycle === void 0 && locale.hourCycles && locale.hourCycles.length) {
11245
11119
  hourCycle = locale.hourCycles[0];
11246
11120
  }
11247
11121
  if (hourCycle) {
@@ -11258,12 +11132,12 @@ function getDefaultHourSymbolFromLocale(locale) {
11258
11132
  throw new Error("Invalid hourCycle");
11259
11133
  }
11260
11134
  }
11261
- var languageTag = locale.language;
11262
- var regionTag;
11135
+ const languageTag = locale.language;
11136
+ let regionTag;
11263
11137
  if (languageTag !== "root") {
11264
11138
  regionTag = locale.maximize().region;
11265
11139
  }
11266
- var hourCycles = timeData[regionTag || ""] || timeData[languageTag || ""] || timeData["".concat(languageTag, "-001")] || timeData["001"];
11140
+ const hourCycles = timeData[regionTag || ""] || timeData[languageTag || ""] || timeData[`${languageTag}-001`] || timeData["001"];
11267
11141
  return hourCycles[0];
11268
11142
  }
11269
11143
  var init_date_time_pattern_generator = __esm({
@@ -11274,13 +11148,15 @@ var init_date_time_pattern_generator = __esm({
11274
11148
 
11275
11149
  // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/parser.js
11276
11150
  function createLocation(start, end) {
11277
- return { start, end };
11151
+ return {
11152
+ start,
11153
+ end
11154
+ };
11278
11155
  }
11279
11156
  function matchIdentifierAtIndex(s, index) {
11280
- var _a;
11281
11157
  IDENTIFIER_PREFIX_RE.lastIndex = index;
11282
- var match = IDENTIFIER_PREFIX_RE.exec(s);
11283
- return (_a = match[1]) !== null && _a !== void 0 ? _a : "";
11158
+ const match = IDENTIFIER_PREFIX_RE.exec(s);
11159
+ return match[1] ?? "";
11284
11160
  }
11285
11161
  function _isAlpha(codepoint) {
11286
11162
  return codepoint >= 97 && codepoint <= 122 || codepoint >= 65 && codepoint <= 90;
@@ -11297,77 +11173,65 @@ function _isWhiteSpace(c) {
11297
11173
  var SPACE_SEPARATOR_START_REGEX, SPACE_SEPARATOR_END_REGEX, hasNativeFromEntries, hasTrimStart, hasTrimEnd, fromEntries, trimStart, trimEnd, IDENTIFIER_PREFIX_RE, Parser;
11298
11174
  var init_parser = __esm({
11299
11175
  "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/parser.js"() {
11300
- init_tslib_es6();
11301
11176
  init_error();
11302
11177
  init_types();
11303
- init_regex_generated();
11178
+ init_regex_generated2();
11304
11179
  init_icu_skeleton_parser();
11305
11180
  init_date_time_pattern_generator();
11306
- SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
11307
- SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
11181
+ SPACE_SEPARATOR_START_REGEX = new RegExp(`^${SPACE_SEPARATOR_REGEX.source}*`);
11182
+ SPACE_SEPARATOR_END_REGEX = new RegExp(`${SPACE_SEPARATOR_REGEX.source}*$`);
11308
11183
  hasNativeFromEntries = !!Object.fromEntries;
11309
11184
  hasTrimStart = !!String.prototype.trimStart;
11310
11185
  hasTrimEnd = !!String.prototype.trimEnd;
11311
- fromEntries = // native
11312
- hasNativeFromEntries ? Object.fromEntries : (
11313
- // Ponyfill
11314
- function fromEntries2(entries) {
11315
- var obj = {};
11316
- for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
11317
- var _a = entries_1[_i], k = _a[0], v = _a[1];
11318
- obj[k] = v;
11319
- }
11320
- return obj;
11186
+ fromEntries = hasNativeFromEntries ? Object.fromEntries : function fromEntries2(entries) {
11187
+ const obj = {};
11188
+ for (const [k, v] of entries) {
11189
+ obj[k] = v;
11321
11190
  }
11322
- );
11323
- trimStart = hasTrimStart ? (
11324
- // Native
11325
- function trimStart2(s) {
11326
- return s.trimStart();
11327
- }
11328
- ) : (
11329
- // Ponyfill
11330
- function trimStart3(s) {
11331
- return s.replace(SPACE_SEPARATOR_START_REGEX, "");
11332
- }
11333
- );
11334
- trimEnd = hasTrimEnd ? (
11335
- // Native
11336
- function trimEnd2(s) {
11337
- return s.trimEnd();
11338
- }
11339
- ) : (
11340
- // Ponyfill
11341
- function trimEnd3(s) {
11342
- return s.replace(SPACE_SEPARATOR_END_REGEX, "");
11343
- }
11344
- );
11191
+ return obj;
11192
+ };
11193
+ trimStart = hasTrimStart ? function trimStart2(s) {
11194
+ return s.trimStart();
11195
+ } : function trimStart3(s) {
11196
+ return s.replace(SPACE_SEPARATOR_START_REGEX, "");
11197
+ };
11198
+ trimEnd = hasTrimEnd ? function trimEnd2(s) {
11199
+ return s.trimEnd();
11200
+ } : function trimEnd3(s) {
11201
+ return s.replace(SPACE_SEPARATOR_END_REGEX, "");
11202
+ };
11345
11203
  IDENTIFIER_PREFIX_RE = new RegExp("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
11346
- Parser = /** @class */
11347
- function() {
11348
- function Parser2(message, options) {
11349
- if (options === void 0) {
11350
- options = {};
11351
- }
11204
+ Parser = class {
11205
+ message;
11206
+ position;
11207
+ locale;
11208
+ ignoreTag;
11209
+ requiresOtherClause;
11210
+ shouldParseSkeletons;
11211
+ constructor(message, options = {}) {
11352
11212
  this.message = message;
11353
- this.position = { offset: 0, line: 1, column: 1 };
11213
+ this.position = {
11214
+ offset: 0,
11215
+ line: 1,
11216
+ column: 1
11217
+ };
11354
11218
  this.ignoreTag = !!options.ignoreTag;
11355
11219
  this.locale = options.locale;
11356
11220
  this.requiresOtherClause = !!options.requiresOtherClause;
11357
11221
  this.shouldParseSkeletons = !!options.shouldParseSkeletons;
11358
11222
  }
11359
- Parser2.prototype.parse = function() {
11223
+ parse() {
11360
11224
  if (this.offset() !== 0) {
11361
11225
  throw Error("parser can only be used once");
11362
11226
  }
11363
11227
  return this.parseMessage(0, "", false);
11364
- };
11365
- Parser2.prototype.parseMessage = function(nestingLevel, parentArgType, expectingCloseTag) {
11366
- var elements = [];
11228
+ }
11229
+ parseMessage(nestingLevel, parentArgType, expectingCloseTag) {
11230
+ let elements = [];
11367
11231
  while (!this.isEOF()) {
11368
- var char = this.char();
11232
+ const char = this.char();
11369
11233
  if (char === 123) {
11370
- var result = this.parseArgument(nestingLevel, expectingCloseTag);
11234
+ const result = this.parseArgument(nestingLevel, expectingCloseTag);
11371
11235
  if (result.err) {
11372
11236
  return result;
11373
11237
  }
@@ -11375,7 +11239,7 @@ var init_parser = __esm({
11375
11239
  } else if (char === 125 && nestingLevel > 0) {
11376
11240
  break;
11377
11241
  } else if (char === 35 && (parentArgType === "plural" || parentArgType === "selectordinal")) {
11378
- var position = this.clonePosition();
11242
+ const position = this.clonePosition();
11379
11243
  this.bump();
11380
11244
  elements.push({
11381
11245
  type: TYPE.pound,
@@ -11388,48 +11252,69 @@ var init_parser = __esm({
11388
11252
  return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
11389
11253
  }
11390
11254
  } else if (char === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) {
11391
- var result = this.parseTag(nestingLevel, parentArgType);
11255
+ const result = this.parseTag(nestingLevel, parentArgType);
11392
11256
  if (result.err) {
11393
11257
  return result;
11394
11258
  }
11395
11259
  elements.push(result.val);
11396
11260
  } else {
11397
- var result = this.parseLiteral(nestingLevel, parentArgType);
11261
+ const result = this.parseLiteral(nestingLevel, parentArgType);
11398
11262
  if (result.err) {
11399
11263
  return result;
11400
11264
  }
11401
11265
  elements.push(result.val);
11402
11266
  }
11403
11267
  }
11404
- return { val: elements, err: null };
11405
- };
11406
- Parser2.prototype.parseTag = function(nestingLevel, parentArgType) {
11407
- var startPosition = this.clonePosition();
11268
+ return {
11269
+ val: elements,
11270
+ err: null
11271
+ };
11272
+ }
11273
+ /**
11274
+ * A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
11275
+ * [custom element name][] except that a dash is NOT always mandatory and uppercase letters
11276
+ * are accepted:
11277
+ *
11278
+ * ```
11279
+ * tag ::= "<" tagName (whitespace)* "/>" | "<" tagName (whitespace)* ">" message "</" tagName (whitespace)* ">"
11280
+ * tagName ::= [a-z] (PENChar)*
11281
+ * PENChar ::=
11282
+ * "-" | "." | [0-9] | "_" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |
11283
+ * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
11284
+ * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
11285
+ * ```
11286
+ *
11287
+ * [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
11288
+ * NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
11289
+ * since other tag-based engines like React allow it
11290
+ */
11291
+ parseTag(nestingLevel, parentArgType) {
11292
+ const startPosition = this.clonePosition();
11408
11293
  this.bump();
11409
- var tagName = this.parseTagName();
11294
+ const tagName = this.parseTagName();
11410
11295
  this.bumpSpace();
11411
11296
  if (this.bumpIf("/>")) {
11412
11297
  return {
11413
11298
  val: {
11414
11299
  type: TYPE.literal,
11415
- value: "<".concat(tagName, "/>"),
11300
+ value: `<${tagName}/>`,
11416
11301
  location: createLocation(startPosition, this.clonePosition())
11417
11302
  },
11418
11303
  err: null
11419
11304
  };
11420
11305
  } else if (this.bumpIf(">")) {
11421
- var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);
11306
+ const childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);
11422
11307
  if (childrenResult.err) {
11423
11308
  return childrenResult;
11424
11309
  }
11425
- var children = childrenResult.val;
11426
- var endTagStartPosition = this.clonePosition();
11310
+ const children = childrenResult.val;
11311
+ const endTagStartPosition = this.clonePosition();
11427
11312
  if (this.bumpIf("</")) {
11428
11313
  if (this.isEOF() || !_isAlpha(this.char())) {
11429
11314
  return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
11430
11315
  }
11431
- var closingTagNameStartPosition = this.clonePosition();
11432
- var closingTagName = this.parseTagName();
11316
+ const closingTagNameStartPosition = this.clonePosition();
11317
+ const closingTagName = this.parseTagName();
11433
11318
  if (tagName !== closingTagName) {
11434
11319
  return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition()));
11435
11320
  }
@@ -11452,51 +11337,62 @@ var init_parser = __esm({
11452
11337
  } else {
11453
11338
  return this.error(ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));
11454
11339
  }
11455
- };
11456
- Parser2.prototype.parseTagName = function() {
11457
- var startOffset = this.offset();
11340
+ }
11341
+ /**
11342
+ * This method assumes that the caller has peeked ahead for the first tag character.
11343
+ */
11344
+ parseTagName() {
11345
+ const startOffset = this.offset();
11458
11346
  this.bump();
11459
11347
  while (!this.isEOF() && _isPotentialElementNameChar(this.char())) {
11460
11348
  this.bump();
11461
11349
  }
11462
11350
  return this.message.slice(startOffset, this.offset());
11463
- };
11464
- Parser2.prototype.parseLiteral = function(nestingLevel, parentArgType) {
11465
- var start = this.clonePosition();
11466
- var value = "";
11351
+ }
11352
+ parseLiteral(nestingLevel, parentArgType) {
11353
+ const start = this.clonePosition();
11354
+ let value = "";
11467
11355
  while (true) {
11468
- var parseQuoteResult = this.tryParseQuote(parentArgType);
11356
+ const parseQuoteResult = this.tryParseQuote(parentArgType);
11469
11357
  if (parseQuoteResult) {
11470
11358
  value += parseQuoteResult;
11471
11359
  continue;
11472
11360
  }
11473
- var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);
11361
+ const parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);
11474
11362
  if (parseUnquotedResult) {
11475
11363
  value += parseUnquotedResult;
11476
11364
  continue;
11477
11365
  }
11478
- var parseLeftAngleResult = this.tryParseLeftAngleBracket();
11366
+ const parseLeftAngleResult = this.tryParseLeftAngleBracket();
11479
11367
  if (parseLeftAngleResult) {
11480
11368
  value += parseLeftAngleResult;
11481
11369
  continue;
11482
11370
  }
11483
11371
  break;
11484
11372
  }
11485
- var location = createLocation(start, this.clonePosition());
11373
+ const location = createLocation(start, this.clonePosition());
11486
11374
  return {
11487
- val: { type: TYPE.literal, value, location },
11375
+ val: {
11376
+ type: TYPE.literal,
11377
+ value,
11378
+ location
11379
+ },
11488
11380
  err: null
11489
11381
  };
11490
- };
11491
- Parser2.prototype.tryParseLeftAngleBracket = function() {
11492
- if (!this.isEOF() && this.char() === 60 && (this.ignoreTag || // If at the opening tag or closing tag position, bail.
11493
- !_isAlphaOrSlash(this.peek() || 0))) {
11382
+ }
11383
+ tryParseLeftAngleBracket() {
11384
+ if (!this.isEOF() && this.char() === 60 && (this.ignoreTag || !_isAlphaOrSlash(this.peek() || 0))) {
11494
11385
  this.bump();
11495
11386
  return "<";
11496
11387
  }
11497
11388
  return null;
11498
- };
11499
- Parser2.prototype.tryParseQuote = function(parentArgType) {
11389
+ }
11390
+ /**
11391
+ * Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
11392
+ * a character that requires quoting (that is, "only where needed"), and works the same in
11393
+ * nested messages as on the top level of the pattern. The new behavior is otherwise compatible.
11394
+ */
11395
+ tryParseQuote(parentArgType) {
11500
11396
  if (this.isEOF() || this.char() !== 39) {
11501
11397
  return null;
11502
11398
  }
@@ -11519,10 +11415,10 @@ var init_parser = __esm({
11519
11415
  return null;
11520
11416
  }
11521
11417
  this.bump();
11522
- var codePoints = [this.char()];
11418
+ const codePoints = [this.char()];
11523
11419
  this.bump();
11524
11420
  while (!this.isEOF()) {
11525
- var ch = this.char();
11421
+ const ch = this.char();
11526
11422
  if (ch === 39) {
11527
11423
  if (this.peek() === 39) {
11528
11424
  codePoints.push(39);
@@ -11536,22 +11432,22 @@ var init_parser = __esm({
11536
11432
  }
11537
11433
  this.bump();
11538
11434
  }
11539
- return String.fromCodePoint.apply(String, codePoints);
11540
- };
11541
- Parser2.prototype.tryParseUnquoted = function(nestingLevel, parentArgType) {
11435
+ return String.fromCodePoint(...codePoints);
11436
+ }
11437
+ tryParseUnquoted(nestingLevel, parentArgType) {
11542
11438
  if (this.isEOF()) {
11543
11439
  return null;
11544
11440
  }
11545
- var ch = this.char();
11441
+ const ch = this.char();
11546
11442
  if (ch === 60 || ch === 123 || ch === 35 && (parentArgType === "plural" || parentArgType === "selectordinal") || ch === 125 && nestingLevel > 0) {
11547
11443
  return null;
11548
11444
  } else {
11549
11445
  this.bump();
11550
11446
  return String.fromCodePoint(ch);
11551
11447
  }
11552
- };
11553
- Parser2.prototype.parseArgument = function(nestingLevel, expectingCloseTag) {
11554
- var openingBracePosition = this.clonePosition();
11448
+ }
11449
+ parseArgument(nestingLevel, expectingCloseTag) {
11450
+ const openingBracePosition = this.clonePosition();
11555
11451
  this.bump();
11556
11452
  this.bumpSpace();
11557
11453
  if (this.isEOF()) {
@@ -11561,7 +11457,7 @@ var init_parser = __esm({
11561
11457
  this.bump();
11562
11458
  return this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
11563
11459
  }
11564
- var value = this.parseIdentifierIfPossible().value;
11460
+ let value = this.parseIdentifierIfPossible().value;
11565
11461
  if (!value) {
11566
11462
  return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
11567
11463
  }
@@ -11575,7 +11471,6 @@ var init_parser = __esm({
11575
11471
  return {
11576
11472
  val: {
11577
11473
  type: TYPE.argument,
11578
- // value does not include the opening and closing braces.
11579
11474
  value,
11580
11475
  location: createLocation(openingBracePosition, this.clonePosition())
11581
11476
  },
@@ -11593,22 +11488,28 @@ var init_parser = __esm({
11593
11488
  default:
11594
11489
  return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
11595
11490
  }
11596
- };
11597
- Parser2.prototype.parseIdentifierIfPossible = function() {
11598
- var startingPosition = this.clonePosition();
11599
- var startOffset = this.offset();
11600
- var value = matchIdentifierAtIndex(this.message, startOffset);
11601
- var endOffset = startOffset + value.length;
11491
+ }
11492
+ /**
11493
+ * Advance the parser until the end of the identifier, if it is currently on
11494
+ * an identifier character. Return an empty string otherwise.
11495
+ */
11496
+ parseIdentifierIfPossible() {
11497
+ const startingPosition = this.clonePosition();
11498
+ const startOffset = this.offset();
11499
+ const value = matchIdentifierAtIndex(this.message, startOffset);
11500
+ const endOffset = startOffset + value.length;
11602
11501
  this.bumpTo(endOffset);
11603
- var endPosition = this.clonePosition();
11604
- var location = createLocation(startingPosition, endPosition);
11605
- return { value, location };
11606
- };
11607
- Parser2.prototype.parseArgumentOptions = function(nestingLevel, expectingCloseTag, value, openingBracePosition) {
11608
- var _a;
11609
- var typeStartPosition = this.clonePosition();
11610
- var argType = this.parseIdentifierIfPossible().value;
11611
- var typeEndPosition = this.clonePosition();
11502
+ const endPosition = this.clonePosition();
11503
+ const location = createLocation(startingPosition, endPosition);
11504
+ return {
11505
+ value,
11506
+ location
11507
+ };
11508
+ }
11509
+ parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition) {
11510
+ let typeStartPosition = this.clonePosition();
11511
+ let argType = this.parseIdentifierIfPossible().value;
11512
+ let typeEndPosition = this.clonePosition();
11612
11513
  switch (argType) {
11613
11514
  case "":
11614
11515
  return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
@@ -11616,54 +11517,67 @@ var init_parser = __esm({
11616
11517
  case "date":
11617
11518
  case "time": {
11618
11519
  this.bumpSpace();
11619
- var styleAndLocation = null;
11520
+ let styleAndLocation = null;
11620
11521
  if (this.bumpIf(",")) {
11621
11522
  this.bumpSpace();
11622
- var styleStartPosition = this.clonePosition();
11623
- var result = this.parseSimpleArgStyleIfPossible();
11523
+ const styleStartPosition = this.clonePosition();
11524
+ const result = this.parseSimpleArgStyleIfPossible();
11624
11525
  if (result.err) {
11625
11526
  return result;
11626
11527
  }
11627
- var style = trimEnd(result.val);
11528
+ const style = trimEnd(result.val);
11628
11529
  if (style.length === 0) {
11629
11530
  return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
11630
11531
  }
11631
- var styleLocation = createLocation(styleStartPosition, this.clonePosition());
11632
- styleAndLocation = { style, styleLocation };
11532
+ const styleLocation = createLocation(styleStartPosition, this.clonePosition());
11533
+ styleAndLocation = {
11534
+ style,
11535
+ styleLocation
11536
+ };
11633
11537
  }
11634
- var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
11538
+ const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
11635
11539
  if (argCloseResult.err) {
11636
11540
  return argCloseResult;
11637
11541
  }
11638
- var location_1 = createLocation(openingBracePosition, this.clonePosition());
11542
+ const location = createLocation(openingBracePosition, this.clonePosition());
11639
11543
  if (styleAndLocation && styleAndLocation.style.startsWith("::")) {
11640
- var skeleton = trimStart(styleAndLocation.style.slice(2));
11544
+ let skeleton = trimStart(styleAndLocation.style.slice(2));
11641
11545
  if (argType === "number") {
11642
- var result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);
11546
+ const result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);
11643
11547
  if (result.err) {
11644
11548
  return result;
11645
11549
  }
11646
11550
  return {
11647
- val: { type: TYPE.number, value, location: location_1, style: result.val },
11551
+ val: {
11552
+ type: TYPE.number,
11553
+ value,
11554
+ location,
11555
+ style: result.val
11556
+ },
11648
11557
  err: null
11649
11558
  };
11650
11559
  } else {
11651
11560
  if (skeleton.length === 0) {
11652
- return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1);
11561
+ return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location);
11653
11562
  }
11654
- var dateTimePattern = skeleton;
11563
+ let dateTimePattern = skeleton;
11655
11564
  if (this.locale) {
11656
11565
  dateTimePattern = getBestPattern(skeleton, this.locale);
11657
11566
  }
11658
- var style = {
11567
+ const style = {
11659
11568
  type: SKELETON_TYPE.dateTime,
11660
11569
  pattern: dateTimePattern,
11661
11570
  location: styleAndLocation.styleLocation,
11662
11571
  parsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(dateTimePattern) : {}
11663
11572
  };
11664
- var type = argType === "date" ? TYPE.date : TYPE.time;
11573
+ const type = argType === "date" ? TYPE.date : TYPE.time;
11665
11574
  return {
11666
- val: { type, value, location: location_1, style },
11575
+ val: {
11576
+ type,
11577
+ value,
11578
+ location,
11579
+ style
11580
+ },
11667
11581
  err: null
11668
11582
  };
11669
11583
  }
@@ -11672,8 +11586,8 @@ var init_parser = __esm({
11672
11586
  val: {
11673
11587
  type: argType === "number" ? TYPE.number : argType === "date" ? TYPE.date : TYPE.time,
11674
11588
  value,
11675
- location: location_1,
11676
- style: (_a = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && _a !== void 0 ? _a : null
11589
+ location,
11590
+ style: (styleAndLocation == null ? void 0 : styleAndLocation.style) ?? null
11677
11591
  },
11678
11592
  err: null
11679
11593
  };
@@ -11681,20 +11595,20 @@ var init_parser = __esm({
11681
11595
  case "plural":
11682
11596
  case "selectordinal":
11683
11597
  case "select": {
11684
- var typeEndPosition_1 = this.clonePosition();
11598
+ const typeEndPosition2 = this.clonePosition();
11685
11599
  this.bumpSpace();
11686
11600
  if (!this.bumpIf(",")) {
11687
- return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, __assign({}, typeEndPosition_1)));
11601
+ return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition2, { ...typeEndPosition2 }));
11688
11602
  }
11689
11603
  this.bumpSpace();
11690
- var identifierAndLocation = this.parseIdentifierIfPossible();
11691
- var pluralOffset = 0;
11604
+ let identifierAndLocation = this.parseIdentifierIfPossible();
11605
+ let pluralOffset = 0;
11692
11606
  if (argType !== "select" && identifierAndLocation.value === "offset") {
11693
11607
  if (!this.bumpIf(":")) {
11694
11608
  return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));
11695
11609
  }
11696
11610
  this.bumpSpace();
11697
- var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
11611
+ const result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
11698
11612
  if (result.err) {
11699
11613
  return result;
11700
11614
  }
@@ -11702,22 +11616,22 @@ var init_parser = __esm({
11702
11616
  identifierAndLocation = this.parseIdentifierIfPossible();
11703
11617
  pluralOffset = result.val;
11704
11618
  }
11705
- var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);
11619
+ const optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);
11706
11620
  if (optionsResult.err) {
11707
11621
  return optionsResult;
11708
11622
  }
11709
- var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
11623
+ const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
11710
11624
  if (argCloseResult.err) {
11711
11625
  return argCloseResult;
11712
11626
  }
11713
- var location_2 = createLocation(openingBracePosition, this.clonePosition());
11627
+ const location = createLocation(openingBracePosition, this.clonePosition());
11714
11628
  if (argType === "select") {
11715
11629
  return {
11716
11630
  val: {
11717
11631
  type: TYPE.select,
11718
11632
  value,
11719
11633
  options: fromEntries(optionsResult.val),
11720
- location: location_2
11634
+ location
11721
11635
  },
11722
11636
  err: null
11723
11637
  };
@@ -11729,7 +11643,7 @@ var init_parser = __esm({
11729
11643
  options: fromEntries(optionsResult.val),
11730
11644
  offset: pluralOffset,
11731
11645
  pluralType: argType === "plural" ? "cardinal" : "ordinal",
11732
- location: location_2
11646
+ location
11733
11647
  },
11734
11648
  err: null
11735
11649
  };
@@ -11738,23 +11652,29 @@ var init_parser = __esm({
11738
11652
  default:
11739
11653
  return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
11740
11654
  }
11741
- };
11742
- Parser2.prototype.tryParseArgumentClose = function(openingBracePosition) {
11655
+ }
11656
+ tryParseArgumentClose(openingBracePosition) {
11743
11657
  if (this.isEOF() || this.char() !== 125) {
11744
11658
  return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
11745
11659
  }
11746
11660
  this.bump();
11747
- return { val: true, err: null };
11748
- };
11749
- Parser2.prototype.parseSimpleArgStyleIfPossible = function() {
11750
- var nestedBraces = 0;
11751
- var startPosition = this.clonePosition();
11661
+ return {
11662
+ val: true,
11663
+ err: null
11664
+ };
11665
+ }
11666
+ /**
11667
+ * See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659
11668
+ */
11669
+ parseSimpleArgStyleIfPossible() {
11670
+ let nestedBraces = 0;
11671
+ const startPosition = this.clonePosition();
11752
11672
  while (!this.isEOF()) {
11753
- var ch = this.char();
11673
+ const ch = this.char();
11754
11674
  switch (ch) {
11755
11675
  case 39: {
11756
11676
  this.bump();
11757
- var apostrophePosition = this.clonePosition();
11677
+ let apostrophePosition = this.clonePosition();
11758
11678
  if (!this.bumpUntil("'")) {
11759
11679
  return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));
11760
11680
  }
@@ -11786,12 +11706,12 @@ var init_parser = __esm({
11786
11706
  val: this.message.slice(startPosition.offset, this.offset()),
11787
11707
  err: null
11788
11708
  };
11789
- };
11790
- Parser2.prototype.parseNumberSkeletonFromString = function(skeleton, location) {
11791
- var tokens = [];
11709
+ }
11710
+ parseNumberSkeletonFromString(skeleton, location) {
11711
+ let tokens = [];
11792
11712
  try {
11793
11713
  tokens = parseNumberSkeletonFromString(skeleton);
11794
- } catch (_a) {
11714
+ } catch {
11795
11715
  return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location);
11796
11716
  }
11797
11717
  return {
@@ -11803,18 +11723,27 @@ var init_parser = __esm({
11803
11723
  },
11804
11724
  err: null
11805
11725
  };
11806
- };
11807
- Parser2.prototype.tryParsePluralOrSelectOptions = function(nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {
11808
- var _a;
11809
- var hasOtherClause = false;
11810
- var options = [];
11811
- var parsedSelectors = /* @__PURE__ */ new Set();
11812
- var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;
11726
+ }
11727
+ /**
11728
+ * @param nesting_level The current nesting level of messages.
11729
+ * This can be positive when parsing message fragment in select or plural argument options.
11730
+ * @param parent_arg_type The parent argument's type.
11731
+ * @param parsed_first_identifier If provided, this is the first identifier-like selector of
11732
+ * the argument. It is a by-product of a previous parsing attempt.
11733
+ * @param expecting_close_tag If true, this message is directly or indirectly nested inside
11734
+ * between a pair of opening and closing tags. The nested message will not parse beyond
11735
+ * the closing tag boundary.
11736
+ */
11737
+ tryParsePluralOrSelectOptions(nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {
11738
+ let hasOtherClause = false;
11739
+ const options = [];
11740
+ const parsedSelectors = /* @__PURE__ */ new Set();
11741
+ let { value: selector, location: selectorLocation } = parsedFirstIdentifier;
11813
11742
  while (true) {
11814
11743
  if (selector.length === 0) {
11815
- var startPosition = this.clonePosition();
11744
+ const startPosition = this.clonePosition();
11816
11745
  if (parentArgType !== "select" && this.bumpIf("=")) {
11817
- var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);
11746
+ const result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);
11818
11747
  if (result.err) {
11819
11748
  return result;
11820
11749
  }
@@ -11831,28 +11760,25 @@ var init_parser = __esm({
11831
11760
  hasOtherClause = true;
11832
11761
  }
11833
11762
  this.bumpSpace();
11834
- var openingBracePosition = this.clonePosition();
11763
+ const openingBracePosition = this.clonePosition();
11835
11764
  if (!this.bumpIf("{")) {
11836
11765
  return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));
11837
11766
  }
11838
- var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);
11767
+ const fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);
11839
11768
  if (fragmentResult.err) {
11840
11769
  return fragmentResult;
11841
11770
  }
11842
- var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
11771
+ const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
11843
11772
  if (argCloseResult.err) {
11844
11773
  return argCloseResult;
11845
11774
  }
11846
- options.push([
11847
- selector,
11848
- {
11849
- value: fragmentResult.val,
11850
- location: createLocation(openingBracePosition, this.clonePosition())
11851
- }
11852
- ]);
11775
+ options.push([selector, {
11776
+ value: fragmentResult.val,
11777
+ location: createLocation(openingBracePosition, this.clonePosition())
11778
+ }]);
11853
11779
  parsedSelectors.add(selector);
11854
11780
  this.bumpSpace();
11855
- _a = this.parseIdentifierIfPossible(), selector = _a.value, selectorLocation = _a.location;
11781
+ ({ value: selector, location: selectorLocation } = this.parseIdentifierIfPossible());
11856
11782
  }
11857
11783
  if (options.length === 0) {
11858
11784
  return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));
@@ -11860,19 +11786,22 @@ var init_parser = __esm({
11860
11786
  if (this.requiresOtherClause && !hasOtherClause) {
11861
11787
  return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));
11862
11788
  }
11863
- return { val: options, err: null };
11864
- };
11865
- Parser2.prototype.tryParseDecimalInteger = function(expectNumberError, invalidNumberError) {
11866
- var sign = 1;
11867
- var startingPosition = this.clonePosition();
11789
+ return {
11790
+ val: options,
11791
+ err: null
11792
+ };
11793
+ }
11794
+ tryParseDecimalInteger(expectNumberError, invalidNumberError) {
11795
+ let sign = 1;
11796
+ const startingPosition = this.clonePosition();
11868
11797
  if (this.bumpIf("+")) {
11869
11798
  } else if (this.bumpIf("-")) {
11870
11799
  sign = -1;
11871
11800
  }
11872
- var hasDigits = false;
11873
- var decimal = 0;
11801
+ let hasDigits = false;
11802
+ let decimal = 0;
11874
11803
  while (!this.isEOF()) {
11875
- var ch = this.char();
11804
+ const ch = this.char();
11876
11805
  if (ch >= 48 && ch <= 57) {
11877
11806
  hasDigits = true;
11878
11807
  decimal = decimal * 10 + (ch - 48);
@@ -11881,7 +11810,7 @@ var init_parser = __esm({
11881
11810
  break;
11882
11811
  }
11883
11812
  }
11884
- var location = createLocation(startingPosition, this.clonePosition());
11813
+ const location = createLocation(startingPosition, this.clonePosition());
11885
11814
  if (!hasDigits) {
11886
11815
  return this.error(expectNumberError, location);
11887
11816
  }
@@ -11889,33 +11818,40 @@ var init_parser = __esm({
11889
11818
  if (!Number.isSafeInteger(decimal)) {
11890
11819
  return this.error(invalidNumberError, location);
11891
11820
  }
11892
- return { val: decimal, err: null };
11893
- };
11894
- Parser2.prototype.offset = function() {
11821
+ return {
11822
+ val: decimal,
11823
+ err: null
11824
+ };
11825
+ }
11826
+ offset() {
11895
11827
  return this.position.offset;
11896
- };
11897
- Parser2.prototype.isEOF = function() {
11828
+ }
11829
+ isEOF() {
11898
11830
  return this.offset() === this.message.length;
11899
- };
11900
- Parser2.prototype.clonePosition = function() {
11831
+ }
11832
+ clonePosition() {
11901
11833
  return {
11902
11834
  offset: this.position.offset,
11903
11835
  line: this.position.line,
11904
11836
  column: this.position.column
11905
11837
  };
11906
- };
11907
- Parser2.prototype.char = function() {
11908
- var offset = this.position.offset;
11838
+ }
11839
+ /**
11840
+ * Return the code point at the current position of the parser.
11841
+ * Throws if the index is out of bound.
11842
+ */
11843
+ char() {
11844
+ const offset = this.position.offset;
11909
11845
  if (offset >= this.message.length) {
11910
11846
  throw Error("out of bound");
11911
11847
  }
11912
- var code = this.message.codePointAt(offset);
11848
+ const code = this.message.codePointAt(offset);
11913
11849
  if (code === void 0) {
11914
- throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
11850
+ throw Error(`Offset ${offset} is at invalid UTF-16 code unit boundary`);
11915
11851
  }
11916
11852
  return code;
11917
- };
11918
- Parser2.prototype.error = function(kind, location) {
11853
+ }
11854
+ error(kind, location) {
11919
11855
  return {
11920
11856
  val: null,
11921
11857
  err: {
@@ -11924,12 +11860,13 @@ var init_parser = __esm({
11924
11860
  location
11925
11861
  }
11926
11862
  };
11927
- };
11928
- Parser2.prototype.bump = function() {
11863
+ }
11864
+ /** Bump the parser to the next UTF-16 code unit. */
11865
+ bump() {
11929
11866
  if (this.isEOF()) {
11930
11867
  return;
11931
11868
  }
11932
- var code = this.char();
11869
+ const code = this.char();
11933
11870
  if (code === 10) {
11934
11871
  this.position.line += 1;
11935
11872
  this.position.column = 1;
@@ -11938,19 +11875,29 @@ var init_parser = __esm({
11938
11875
  this.position.column += 1;
11939
11876
  this.position.offset += code < 65536 ? 1 : 2;
11940
11877
  }
11941
- };
11942
- Parser2.prototype.bumpIf = function(prefix) {
11878
+ }
11879
+ /**
11880
+ * If the substring starting at the current position of the parser has
11881
+ * the given prefix, then bump the parser to the character immediately
11882
+ * following the prefix and return true. Otherwise, don't bump the parser
11883
+ * and return false.
11884
+ */
11885
+ bumpIf(prefix) {
11943
11886
  if (this.message.startsWith(prefix, this.offset())) {
11944
- for (var i = 0; i < prefix.length; i++) {
11887
+ for (let i = 0; i < prefix.length; i++) {
11945
11888
  this.bump();
11946
11889
  }
11947
11890
  return true;
11948
11891
  }
11949
11892
  return false;
11950
- };
11951
- Parser2.prototype.bumpUntil = function(pattern) {
11952
- var currentOffset = this.offset();
11953
- var index = this.message.indexOf(pattern, currentOffset);
11893
+ }
11894
+ /**
11895
+ * Bump the parser until the pattern character is found and return `true`.
11896
+ * Otherwise bump to the end of the file and return `false`.
11897
+ */
11898
+ bumpUntil(pattern) {
11899
+ const currentOffset = this.offset();
11900
+ const index = this.message.indexOf(pattern, currentOffset);
11954
11901
  if (index >= 0) {
11955
11902
  this.bumpTo(index);
11956
11903
  return true;
@@ -11958,42 +11905,50 @@ var init_parser = __esm({
11958
11905
  this.bumpTo(this.message.length);
11959
11906
  return false;
11960
11907
  }
11961
- };
11962
- Parser2.prototype.bumpTo = function(targetOffset) {
11908
+ }
11909
+ /**
11910
+ * Bump the parser to the target offset.
11911
+ * If target offset is beyond the end of the input, bump the parser to the end of the input.
11912
+ */
11913
+ bumpTo(targetOffset) {
11963
11914
  if (this.offset() > targetOffset) {
11964
- throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
11915
+ throw Error(`targetOffset ${targetOffset} must be greater than or equal to the current offset ${this.offset()}`);
11965
11916
  }
11966
11917
  targetOffset = Math.min(targetOffset, this.message.length);
11967
11918
  while (true) {
11968
- var offset = this.offset();
11919
+ const offset = this.offset();
11969
11920
  if (offset === targetOffset) {
11970
11921
  break;
11971
11922
  }
11972
11923
  if (offset > targetOffset) {
11973
- throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
11924
+ throw Error(`targetOffset ${targetOffset} is at invalid UTF-16 code unit boundary`);
11974
11925
  }
11975
11926
  this.bump();
11976
11927
  if (this.isEOF()) {
11977
11928
  break;
11978
11929
  }
11979
11930
  }
11980
- };
11981
- Parser2.prototype.bumpSpace = function() {
11931
+ }
11932
+ /** advance the parser through all whitespace to the next non-whitespace code unit. */
11933
+ bumpSpace() {
11982
11934
  while (!this.isEOF() && _isWhiteSpace(this.char())) {
11983
11935
  this.bump();
11984
11936
  }
11985
- };
11986
- Parser2.prototype.peek = function() {
11937
+ }
11938
+ /**
11939
+ * Peek at the *next* Unicode codepoint in the input without advancing the parser.
11940
+ * If the input has been exhausted, then this returns null.
11941
+ */
11942
+ peek() {
11987
11943
  if (this.isEOF()) {
11988
11944
  return null;
11989
11945
  }
11990
- var code = this.char();
11991
- var offset = this.offset();
11992
- var nextCode = this.message.charCodeAt(offset + (code >= 65536 ? 2 : 1));
11993
- return nextCode !== null && nextCode !== void 0 ? nextCode : null;
11994
- };
11995
- return Parser2;
11996
- }();
11946
+ const code = this.char();
11947
+ const offset = this.offset();
11948
+ const nextCode = this.message.charCodeAt(offset + (code >= 65536 ? 2 : 1));
11949
+ return nextCode ?? null;
11950
+ }
11951
+ };
11997
11952
  }
11998
11953
  });
11999
11954
 
@@ -12003,21 +11958,58 @@ function cloneDeep(obj) {
12003
11958
  return obj.map(cloneDeep);
12004
11959
  }
12005
11960
  if (obj !== null && typeof obj === "object") {
12006
- return Object.keys(obj).reduce(function(cloned, k) {
11961
+ return Object.keys(obj).reduce((cloned, k) => {
12007
11962
  cloned[k] = cloneDeep(obj[k]);
12008
11963
  return cloned;
12009
11964
  }, {});
12010
11965
  }
12011
11966
  return obj;
12012
11967
  }
11968
+ function replacePoundWithArgument(ast, variableName) {
11969
+ return ast.map((el) => {
11970
+ if (isPoundElement(el)) {
11971
+ return {
11972
+ type: TYPE.number,
11973
+ value: variableName,
11974
+ style: null,
11975
+ location: el.location
11976
+ };
11977
+ }
11978
+ if (isPluralElement(el) || isSelectElement(el)) {
11979
+ const newOptions = {};
11980
+ for (const key of Object.keys(el.options)) {
11981
+ newOptions[key] = { value: replacePoundWithArgument(el.options[key].value, variableName) };
11982
+ }
11983
+ return {
11984
+ ...el,
11985
+ options: newOptions
11986
+ };
11987
+ }
11988
+ if (isTagElement(el)) {
11989
+ return {
11990
+ ...el,
11991
+ children: replacePoundWithArgument(el.children, variableName)
11992
+ };
11993
+ }
11994
+ return el;
11995
+ });
11996
+ }
12013
11997
  function hoistPluralOrSelectElement(ast, el, positionToInject) {
12014
- var cloned = cloneDeep(el);
12015
- var options = cloned.options;
12016
- cloned.options = Object.keys(options).reduce(function(all, k) {
12017
- var newValue = hoistSelectors(__spreadArray(__spreadArray(__spreadArray([], ast.slice(0, positionToInject), true), options[k].value, true), ast.slice(positionToInject + 1), true));
12018
- all[k] = {
12019
- value: newValue
12020
- };
11998
+ const cloned = cloneDeep(el);
11999
+ const { options } = cloned;
12000
+ const afterElements = ast.slice(positionToInject + 1);
12001
+ const hasSubsequentPluralOrSelect = afterElements.some(isPluralOrSelectElement);
12002
+ cloned.options = Object.keys(options).reduce((all, k) => {
12003
+ let optionValue = options[k].value;
12004
+ if (hasSubsequentPluralOrSelect && isPluralElement(el)) {
12005
+ optionValue = replacePoundWithArgument(optionValue, el.value);
12006
+ }
12007
+ const newValue = hoistSelectors([
12008
+ ...ast.slice(0, positionToInject),
12009
+ ...optionValue,
12010
+ ...afterElements
12011
+ ]);
12012
+ all[k] = { value: newValue };
12021
12013
  return all;
12022
12014
  }, {});
12023
12015
  return cloned;
@@ -12026,7 +12018,7 @@ function isPluralOrSelectElement(el) {
12026
12018
  return isPluralElement(el) || isSelectElement(el);
12027
12019
  }
12028
12020
  function findPluralOrSelectElement(ast) {
12029
- return !!ast.find(function(el) {
12021
+ return !!ast.find((el) => {
12030
12022
  if (isPluralOrSelectElement(el)) {
12031
12023
  return true;
12032
12024
  }
@@ -12037,8 +12029,8 @@ function findPluralOrSelectElement(ast) {
12037
12029
  });
12038
12030
  }
12039
12031
  function hoistSelectors(ast) {
12040
- for (var i = 0; i < ast.length; i++) {
12041
- var el = ast[i];
12032
+ for (let i = 0; i < ast.length; i++) {
12033
+ const el = ast[i];
12042
12034
  if (isPluralOrSelectElement(el)) {
12043
12035
  return [hoistPluralOrSelectElement(ast, el, i)];
12044
12036
  }
@@ -12048,20 +12040,17 @@ function hoistSelectors(ast) {
12048
12040
  }
12049
12041
  return ast;
12050
12042
  }
12051
- function collectVariables(ast, vars) {
12052
- if (vars === void 0) {
12053
- vars = /* @__PURE__ */ new Map();
12054
- }
12055
- ast.forEach(function(el) {
12043
+ function collectVariables(ast, vars = /* @__PURE__ */ new Map()) {
12044
+ ast.forEach((el) => {
12056
12045
  if (isArgumentElement(el) || isDateElement(el) || isTimeElement(el) || isNumberElement(el)) {
12057
12046
  if (el.value in vars && vars.get(el.value) !== el.type) {
12058
- throw new Error("Variable ".concat(el.value, " has conflicting types"));
12047
+ throw new Error(`Variable ${el.value} has conflicting types`);
12059
12048
  }
12060
12049
  vars.set(el.value, el.type);
12061
12050
  }
12062
12051
  if (isPluralElement(el) || isSelectElement(el)) {
12063
12052
  vars.set(el.value, el.type);
12064
- Object.keys(el.options).forEach(function(k) {
12053
+ Object.keys(el.options).forEach((k) => {
12065
12054
  collectVariables(el.options[k].value, vars);
12066
12055
  });
12067
12056
  }
@@ -12072,32 +12061,31 @@ function collectVariables(ast, vars) {
12072
12061
  });
12073
12062
  }
12074
12063
  function isStructurallySame(a, b) {
12075
- var aVars = /* @__PURE__ */ new Map();
12076
- var bVars = /* @__PURE__ */ new Map();
12064
+ const aVars = /* @__PURE__ */ new Map();
12065
+ const bVars = /* @__PURE__ */ new Map();
12077
12066
  collectVariables(a, aVars);
12078
12067
  collectVariables(b, bVars);
12079
12068
  if (aVars.size !== bVars.size) {
12080
12069
  return {
12081
12070
  success: false,
12082
- error: new Error("Different number of variables: [".concat(Array.from(aVars.keys()).join(", "), "] vs [").concat(Array.from(bVars.keys()).join(", "), "]"))
12071
+ error: new Error(`Different number of variables: [${Array.from(aVars.keys()).join(", ")}] vs [${Array.from(bVars.keys()).join(", ")}]`)
12083
12072
  };
12084
12073
  }
12085
- return Array.from(aVars.entries()).reduce(function(result, _a) {
12086
- var key = _a[0], type = _a[1];
12074
+ return Array.from(aVars.entries()).reduce((result, [key, type]) => {
12087
12075
  if (!result.success) {
12088
12076
  return result;
12089
12077
  }
12090
- var bType = bVars.get(key);
12078
+ const bType = bVars.get(key);
12091
12079
  if (bType == null) {
12092
12080
  return {
12093
12081
  success: false,
12094
- error: new Error("Missing variable ".concat(key, " in message"))
12082
+ error: new Error(`Missing variable ${key} in message`)
12095
12083
  };
12096
12084
  }
12097
12085
  if (bType !== type) {
12098
12086
  return {
12099
12087
  success: false,
12100
- error: new Error("Variable ".concat(key, " has conflicting types: ").concat(TYPE[type], " vs ").concat(TYPE[bType]))
12088
+ error: new Error(`Variable ${key} has conflicting types: ${TYPE[type]} vs ${TYPE[bType]}`)
12101
12089
  };
12102
12090
  }
12103
12091
  return result;
@@ -12105,17 +12093,16 @@ function isStructurallySame(a, b) {
12105
12093
  }
12106
12094
  var init_manipulator = __esm({
12107
12095
  "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/manipulator.js"() {
12108
- init_tslib_es6();
12109
12096
  init_types();
12110
12097
  }
12111
12098
  });
12112
12099
 
12113
12100
  // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/index.js
12114
12101
  function pruneLocation(els) {
12115
- els.forEach(function(el) {
12102
+ els.forEach((el) => {
12116
12103
  delete el.location;
12117
12104
  if (isSelectElement(el) || isPluralElement(el)) {
12118
- for (var k in el.options) {
12105
+ for (const k in el.options) {
12119
12106
  delete el.options[k].location;
12120
12107
  pruneLocation(el.options[k].value);
12121
12108
  }
@@ -12128,26 +12115,26 @@ function pruneLocation(els) {
12128
12115
  }
12129
12116
  });
12130
12117
  }
12131
- function parse(message, opts) {
12132
- if (opts === void 0) {
12133
- opts = {};
12134
- }
12135
- opts = __assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);
12136
- var result = new Parser(message, opts).parse();
12118
+ function parse(message, opts = {}) {
12119
+ opts = {
12120
+ shouldParseSkeletons: true,
12121
+ requiresOtherClause: true,
12122
+ ...opts
12123
+ };
12124
+ const result = new Parser(message, opts).parse();
12137
12125
  if (result.err) {
12138
- var error2 = SyntaxError(ErrorKind[result.err.kind]);
12126
+ const error2 = SyntaxError(ErrorKind[result.err.kind]);
12139
12127
  error2.location = result.err.location;
12140
12128
  error2.originalMessage = result.err.message;
12141
12129
  throw error2;
12142
12130
  }
12143
- if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {
12131
+ if (!(opts == null ? void 0 : opts.captureLocation)) {
12144
12132
  pruneLocation(result.val);
12145
12133
  }
12146
12134
  return result.val;
12147
12135
  }
12148
12136
  var init_icu_messageformat_parser = __esm({
12149
12137
  "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/index.js"() {
12150
- init_tslib_es6();
12151
12138
  init_error();
12152
12139
  init_parser();
12153
12140
  init_types();
@@ -17644,6 +17631,99 @@ var init_console_utils = __esm({
17644
17631
  }
17645
17632
  });
17646
17633
 
17634
+ // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/printer.js
17635
+ function printAST(ast) {
17636
+ return doPrintAST(ast, false);
17637
+ }
17638
+ function doPrintAST(ast, isInPlural) {
17639
+ const printedNodes = ast.map((el, i) => {
17640
+ if (isLiteralElement(el)) {
17641
+ return printLiteralElement(el, isInPlural, i === 0, i === ast.length - 1);
17642
+ }
17643
+ if (isArgumentElement(el)) {
17644
+ return printArgumentElement(el);
17645
+ }
17646
+ if (isDateElement(el) || isTimeElement(el) || isNumberElement(el)) {
17647
+ return printSimpleFormatElement(el);
17648
+ }
17649
+ if (isPluralElement(el)) {
17650
+ return printPluralElement(el);
17651
+ }
17652
+ if (isSelectElement(el)) {
17653
+ return printSelectElement(el);
17654
+ }
17655
+ if (isPoundElement(el)) {
17656
+ return "#";
17657
+ }
17658
+ if (isTagElement(el)) {
17659
+ return printTagElement(el);
17660
+ }
17661
+ });
17662
+ return printedNodes.join("");
17663
+ }
17664
+ function printTagElement(el) {
17665
+ return `<${el.value}>${printAST(el.children)}</${el.value}>`;
17666
+ }
17667
+ function printEscapedMessage(message) {
17668
+ return message.replace(/([{}](?:[\s\S]*[{}])?)/, `'$1'`);
17669
+ }
17670
+ function printLiteralElement({ value }, isInPlural, isFirstEl, isLastEl) {
17671
+ let escaped = value;
17672
+ if (!isFirstEl && escaped[0] === `'`) {
17673
+ escaped = `''${escaped.slice(1)}`;
17674
+ }
17675
+ if (!isLastEl && escaped[escaped.length - 1] === `'`) {
17676
+ escaped = `${escaped.slice(0, escaped.length - 1)}''`;
17677
+ }
17678
+ escaped = printEscapedMessage(escaped);
17679
+ return isInPlural ? escaped.replace("#", "'#'") : escaped;
17680
+ }
17681
+ function printArgumentElement({ value }) {
17682
+ return `{${value}}`;
17683
+ }
17684
+ function printSimpleFormatElement(el) {
17685
+ return `{${el.value}, ${TYPE[el.type]}${el.style ? `, ${printArgumentStyle(el.style)}` : ""}}`;
17686
+ }
17687
+ function printNumberSkeletonToken(token) {
17688
+ const { stem, options } = token;
17689
+ return options.length === 0 ? stem : `${stem}${options.map((o) => `/${o}`).join("")}`;
17690
+ }
17691
+ function printArgumentStyle(style) {
17692
+ if (typeof style === "string") {
17693
+ return printEscapedMessage(style);
17694
+ } else if (style.type === SKELETON_TYPE.dateTime) {
17695
+ return `::${printDateTimeSkeleton(style)}`;
17696
+ } else {
17697
+ return `::${style.tokens.map(printNumberSkeletonToken).join(" ")}`;
17698
+ }
17699
+ }
17700
+ function printDateTimeSkeleton(style) {
17701
+ return style.pattern;
17702
+ }
17703
+ function printSelectElement(el) {
17704
+ const msg = [
17705
+ el.value,
17706
+ "select",
17707
+ Object.keys(el.options).map((id) => `${id}{${doPrintAST(el.options[id].value, false)}}`).join(" ")
17708
+ ].join(",");
17709
+ return `{${msg}}`;
17710
+ }
17711
+ function printPluralElement(el) {
17712
+ const type = el.pluralType === "cardinal" ? "plural" : "selectordinal";
17713
+ const msg = [
17714
+ el.value,
17715
+ type,
17716
+ [el.offset ? `offset:${el.offset}` : "", ...Object.keys(el.options).map((id) => `${id}{${doPrintAST(el.options[id].value, true)}}`)].filter(Boolean).join(" ")
17717
+ ].join(",");
17718
+ return `{${msg}}`;
17719
+ }
17720
+ var init_printer = __esm({
17721
+ "node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/printer.js"() {
17722
+ init_icu_skeleton_parser();
17723
+ init_types();
17724
+ }
17725
+ });
17726
+
17647
17727
  // node_modules/.aspect_rules_js/typescript@5.8.3/node_modules/typescript/lib/typescript.js
17648
17728
  var require_typescript = __commonJS({
17649
17729
  "node_modules/.aspect_rules_js/typescript@5.8.3/node_modules/typescript/lib/typescript.js"(exports, module2) {
@@ -229125,6 +229205,12 @@ var init_interpolate_name = __esm({
229125
229205
  }
229126
229206
  });
229127
229207
 
229208
+ // node_modules/.aspect_rules_js/@formatjs+ts-transformer@0.0.0/node_modules/@formatjs/ts-transformer/src/types.js
229209
+ var init_types2 = __esm({
229210
+ "node_modules/.aspect_rules_js/@formatjs+ts-transformer@0.0.0/node_modules/@formatjs/ts-transformer/src/types.js"() {
229211
+ }
229212
+ });
229213
+
229128
229214
  // node_modules/.aspect_rules_js/@formatjs+ts-transformer@0.0.0/node_modules/@formatjs/ts-transformer/src/transform.js
229129
229215
  function primitiveToTSNode(factory, v) {
229130
229216
  return typeof v === "string" ? factory.createStringLiteral(v) : typeof v === "number" ? factory.createNumericLiteral(v + "") : typeof v === "boolean" ? v ? factory.createTrue() : factory.createFalse() : void 0;
@@ -229209,7 +229295,7 @@ function evaluateStringConcat(ts2, node) {
229209
229295
  }
229210
229296
  return ["", false];
229211
229297
  }
229212
- function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocation, preserveWhitespace }, sf) {
229298
+ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocation, preserveWhitespace, flatten: flatten2 }, sf) {
229213
229299
  let properties = void 0;
229214
229300
  if (ts2.isObjectLiteralExpression(node)) {
229215
229301
  properties = node.properties;
@@ -229249,6 +229335,10 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
229249
229335
  break;
229250
229336
  }
229251
229337
  } else if (ts2.isTaggedTemplateExpression(initializer)) {
229338
+ const isMessageProp = name.text === "id" || name.text === "defaultMessage" || name.text === "description";
229339
+ if (!isMessageProp) {
229340
+ return;
229341
+ }
229252
229342
  const { template } = initializer;
229253
229343
  if (!ts2.isNoSubstitutionTemplateLiteral(template)) {
229254
229344
  throw new Error("Tagged template expression must be no substitution");
@@ -229293,6 +229383,10 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
229293
229383
  break;
229294
229384
  }
229295
229385
  } else if (ts2.isTaggedTemplateExpression(initializer.expression)) {
229386
+ const isMessageProp = name.text === "id" || name.text === "defaultMessage" || name.text === "description";
229387
+ if (!isMessageProp) {
229388
+ return;
229389
+ }
229296
229390
  const { expression: { template } } = initializer;
229297
229391
  if (!ts2.isNoSubstitutionTemplateLiteral(template)) {
229298
229392
  throw new Error("Tagged template expression must be no substitution");
@@ -229323,7 +229417,11 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
229323
229417
  msg.description = result;
229324
229418
  break;
229325
229419
  }
229420
+ } else if (MESSAGE_DESC_KEYS.includes(name.text) && name.text !== "description") {
229421
+ throw new Error(`[FormatJS] \`${name.text}\` must be a string literal or statically evaluable expression to be extracted.`);
229326
229422
  }
229423
+ } else if (MESSAGE_DESC_KEYS.includes(name.text) && name.text !== "description") {
229424
+ throw new Error(`[FormatJS] \`${name.text}\` must be a string literal to be extracted.`);
229327
229425
  }
229328
229426
  } else if (ts2.isBinaryExpression(initializer)) {
229329
229427
  const [result, isStatic] = evaluateStringConcat(ts2, initializer);
@@ -229339,9 +229437,13 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
229339
229437
  msg.description = result;
229340
229438
  break;
229341
229439
  }
229440
+ } else if (MESSAGE_DESC_KEYS.includes(name.text) && name.text !== "description") {
229441
+ throw new Error(`[FormatJS] \`${name.text}\` must be a string literal or statically evaluable expression to be extracted.`);
229342
229442
  }
229343
229443
  } else if (ts2.isObjectLiteralExpression(initializer) && name.text === "description") {
229344
229444
  msg.description = objectLiteralExpressionToObj(ts2, initializer);
229445
+ } else if (MESSAGE_DESC_KEYS.includes(name.text) && name.text !== "description") {
229446
+ throw new Error(`[FormatJS] \`${name.text}\` must be a string literal to be extracted.`);
229345
229447
  }
229346
229448
  }
229347
229449
  });
@@ -229351,13 +229453,17 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
229351
229453
  if (msg.defaultMessage && !preserveWhitespace) {
229352
229454
  msg.defaultMessage = msg.defaultMessage.trim().replace(/\s+/gm, " ");
229353
229455
  }
229456
+ if (flatten2 && msg.defaultMessage) {
229457
+ try {
229458
+ msg.defaultMessage = printAST(hoistSelectors(parse(msg.defaultMessage)));
229459
+ } catch {
229460
+ }
229461
+ }
229354
229462
  if (msg.defaultMessage && overrideIdFn) {
229355
229463
  switch (typeof overrideIdFn) {
229356
229464
  case "string":
229357
229465
  if (!msg.id) {
229358
- msg.id = interpolateName({ resourcePath: sf.fileName }, overrideIdFn, {
229359
- content: msg.description ? `${msg.defaultMessage}#${typeof msg.description === "string" ? msg.description : stringify2(msg.description)}` : msg.defaultMessage
229360
- });
229466
+ msg.id = interpolateName({ resourcePath: sf.fileName }, overrideIdFn, { content: msg.description ? `${msg.defaultMessage}#${typeof msg.description === "string" ? msg.description : stringify2(msg.description)}` : msg.defaultMessage });
229361
229467
  }
229362
229468
  break;
229363
229469
  case "function":
@@ -229385,6 +229491,12 @@ function isMemberMethodFormatMessageCall(ts2, node, additionalFunctionNames) {
229385
229491
  if (ts2.isPropertyAccessExpression(method)) {
229386
229492
  return fnNames.has(method.name.text);
229387
229493
  }
229494
+ if (ts2.isExpressionWithTypeArguments && ts2.isExpressionWithTypeArguments(method)) {
229495
+ const expr = method.expression;
229496
+ if (ts2.isPropertyAccessExpression(expr)) {
229497
+ return fnNames.has(expr.name.text);
229498
+ }
229499
+ }
229388
229500
  return ts2.isIdentifier(method) && fnNames.has(method.text);
229389
229501
  }
229390
229502
  function extractMessageFromJsxComponent(ts2, factory, node, opts, sf) {
@@ -229409,12 +229521,7 @@ function extractMessageFromJsxComponent(ts2, factory, node, opts, sf) {
229409
229521
  return factory.updateJsxSelfClosingElement(node, node.tagName, node.typeArguments, factory.createJsxAttributes(newProps));
229410
229522
  }
229411
229523
  function setAttributesInObject(ts2, factory, node, msg, ast) {
229412
- const newProps = [
229413
- factory.createPropertyAssignment("id", factory.createStringLiteral(msg.id)),
229414
- ...msg.defaultMessage ? [
229415
- factory.createPropertyAssignment("defaultMessage", ast ? messageASTToTSNode(factory, parse(msg.defaultMessage)) : factory.createStringLiteral(msg.defaultMessage))
229416
- ] : []
229417
- ];
229524
+ const newProps = [factory.createPropertyAssignment("id", factory.createStringLiteral(msg.id)), ...msg.defaultMessage ? [factory.createPropertyAssignment("defaultMessage", ast ? messageASTToTSNode(factory, parse(msg.defaultMessage)) : factory.createStringLiteral(msg.defaultMessage))] : []];
229418
229525
  for (const prop of node.properties) {
229419
229526
  if (ts2.isPropertyAssignment(prop) && ts2.isIdentifier(prop.name) && MESSAGE_DESC_KEYS.includes(prop.name.text)) {
229420
229527
  continue;
@@ -229426,12 +229533,7 @@ function setAttributesInObject(ts2, factory, node, msg, ast) {
229426
229533
  return factory.createObjectLiteralExpression(factory.createNodeArray(newProps));
229427
229534
  }
229428
229535
  function generateNewProperties(ts2, factory, node, msg, ast) {
229429
- const newProps = [
229430
- factory.createJsxAttribute(factory.createIdentifier("id"), factory.createStringLiteral(msg.id)),
229431
- ...msg.defaultMessage ? [
229432
- factory.createJsxAttribute(factory.createIdentifier("defaultMessage"), ast ? factory.createJsxExpression(void 0, messageASTToTSNode(factory, parse(msg.defaultMessage))) : factory.createStringLiteral(msg.defaultMessage))
229433
- ] : []
229434
- ];
229536
+ const newProps = [factory.createJsxAttribute(factory.createIdentifier("id"), factory.createStringLiteral(msg.id)), ...msg.defaultMessage ? [factory.createJsxAttribute(factory.createIdentifier("defaultMessage"), ast ? factory.createJsxExpression(void 0, messageASTToTSNode(factory, parse(msg.defaultMessage))) : factory.createStringLiteral(msg.defaultMessage))] : []];
229435
229537
  for (const prop of node.properties) {
229436
229538
  if (ts2.isJsxAttribute(prop) && ts2.isIdentifier(prop.name) && MESSAGE_DESC_KEYS.includes(prop.name.text)) {
229437
229539
  continue;
@@ -229485,13 +229587,10 @@ function extractMessagesFromCallExpression(ts2, factory, node, opts, sf) {
229485
229587
  if (typeof onMsgExtracted === "function") {
229486
229588
  onMsgExtracted(sf.fileName, [msg]);
229487
229589
  }
229488
- return factory.updateCallExpression(node, node.expression, node.typeArguments, [
229489
- setAttributesInObject(ts2, factory, descriptorsObj, {
229490
- defaultMessage: opts.removeDefaultMessage ? void 0 : msg.defaultMessage,
229491
- id: msg.id
229492
- }, opts.ast),
229493
- ...restArgs
229494
- ]);
229590
+ return factory.updateCallExpression(node, node.expression, node.typeArguments, [setAttributesInObject(ts2, factory, descriptorsObj, {
229591
+ defaultMessage: opts.removeDefaultMessage ? void 0 : msg.defaultMessage,
229592
+ id: msg.id
229593
+ }, opts.ast), ...restArgs]);
229495
229594
  }
229496
229595
  }
229497
229596
  return node;
@@ -229504,7 +229603,10 @@ function getVisitor(ts2, ctx, sf, opts) {
229504
229603
  return visitor;
229505
229604
  }
229506
229605
  function transformWithTs(ts2, opts) {
229507
- opts = { ...DEFAULT_OPTS, ...opts };
229606
+ opts = {
229607
+ ...DEFAULT_OPTS,
229608
+ ...opts
229609
+ };
229508
229610
  debug2("Transforming options", opts);
229509
229611
  const transformFn = (ctx) => {
229510
229612
  return (sf) => {
@@ -229534,10 +229636,13 @@ var stringifyNs2, typescript, stringify2, MESSAGE_DESC_KEYS, DEFAULT_OPTS, PRAGM
229534
229636
  var init_transform = __esm({
229535
229637
  "node_modules/.aspect_rules_js/@formatjs+ts-transformer@0.0.0/node_modules/@formatjs/ts-transformer/src/transform.js"() {
229536
229638
  init_icu_messageformat_parser();
229639
+ init_manipulator();
229640
+ init_printer();
229537
229641
  stringifyNs2 = __toESM(require_json_stable_stringify());
229538
229642
  typescript = __toESM(require_typescript());
229539
229643
  init_console_utils2();
229540
229644
  init_interpolate_name();
229645
+ init_types2();
229541
229646
  stringify2 = stringifyNs2.default || stringifyNs2;
229542
229647
  MESSAGE_DESC_KEYS = [
229543
229648
  "id",
@@ -229552,12 +229657,6 @@ var init_transform = __esm({
229552
229657
  }
229553
229658
  });
229554
229659
 
229555
- // node_modules/.aspect_rules_js/@formatjs+ts-transformer@0.0.0/node_modules/@formatjs/ts-transformer/src/types.js
229556
- var init_types2 = __esm({
229557
- "node_modules/.aspect_rules_js/@formatjs+ts-transformer@0.0.0/node_modules/@formatjs/ts-transformer/src/types.js"() {
229558
- }
229559
- });
229560
-
229561
229660
  // node_modules/.aspect_rules_js/@formatjs+ts-transformer@0.0.0/node_modules/@formatjs/ts-transformer/index.js
229562
229661
  var init_ts_transformer = __esm({
229563
229662
  "node_modules/.aspect_rules_js/@formatjs+ts-transformer@0.0.0/node_modules/@formatjs/ts-transformer/index.js"() {
@@ -229768,7 +229867,7 @@ var init_gts_extractor = __esm({
229768
229867
  }
229769
229868
  });
229770
229869
 
229771
- // node_modules/.aspect_rules_js/commander@13.1.0/node_modules/commander/esm.mjs
229870
+ // node_modules/.aspect_rules_js/commander@14.0.2/node_modules/commander/esm.mjs
229772
229871
  var import_index = __toESM(require_commander(), 1);
229773
229872
  var {
229774
229873
  program,
@@ -230236,109 +230335,6 @@ init_console_utils();
230236
230335
  init_ts_transformer();
230237
230336
  init_console_utils();
230238
230337
  var stringifyNs3 = __toESM(require_json_stable_stringify());
230239
- init_icu_messageformat_parser();
230240
- init_manipulator();
230241
-
230242
- // node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/printer.js
230243
- init_tslib_es6();
230244
- init_types();
230245
- function printAST(ast) {
230246
- return doPrintAST(ast, false);
230247
- }
230248
- function doPrintAST(ast, isInPlural) {
230249
- var printedNodes = ast.map(function(el, i) {
230250
- if (isLiteralElement(el)) {
230251
- return printLiteralElement(el, isInPlural, i === 0, i === ast.length - 1);
230252
- }
230253
- if (isArgumentElement(el)) {
230254
- return printArgumentElement(el);
230255
- }
230256
- if (isDateElement(el) || isTimeElement(el) || isNumberElement(el)) {
230257
- return printSimpleFormatElement(el);
230258
- }
230259
- if (isPluralElement(el)) {
230260
- return printPluralElement(el);
230261
- }
230262
- if (isSelectElement(el)) {
230263
- return printSelectElement(el);
230264
- }
230265
- if (isPoundElement(el)) {
230266
- return "#";
230267
- }
230268
- if (isTagElement(el)) {
230269
- return printTagElement(el);
230270
- }
230271
- });
230272
- return printedNodes.join("");
230273
- }
230274
- function printTagElement(el) {
230275
- return "<".concat(el.value, ">").concat(printAST(el.children), "</").concat(el.value, ">");
230276
- }
230277
- function printEscapedMessage(message) {
230278
- return message.replace(/([{}](?:[\s\S]*[{}])?)/, "'$1'");
230279
- }
230280
- function printLiteralElement(_a, isInPlural, isFirstEl, isLastEl) {
230281
- var value = _a.value;
230282
- var escaped = value;
230283
- if (!isFirstEl && escaped[0] === "'") {
230284
- escaped = "''".concat(escaped.slice(1));
230285
- }
230286
- if (!isLastEl && escaped[escaped.length - 1] === "'") {
230287
- escaped = "".concat(escaped.slice(0, escaped.length - 1), "''");
230288
- }
230289
- escaped = printEscapedMessage(escaped);
230290
- return isInPlural ? escaped.replace("#", "'#'") : escaped;
230291
- }
230292
- function printArgumentElement(_a) {
230293
- var value = _a.value;
230294
- return "{".concat(value, "}");
230295
- }
230296
- function printSimpleFormatElement(el) {
230297
- return "{".concat(el.value, ", ").concat(TYPE[el.type]).concat(el.style ? ", ".concat(printArgumentStyle(el.style)) : "", "}");
230298
- }
230299
- function printNumberSkeletonToken(token) {
230300
- var stem = token.stem, options = token.options;
230301
- return options.length === 0 ? stem : "".concat(stem).concat(options.map(function(o) {
230302
- return "/".concat(o);
230303
- }).join(""));
230304
- }
230305
- function printArgumentStyle(style) {
230306
- if (typeof style === "string") {
230307
- return printEscapedMessage(style);
230308
- } else if (style.type === SKELETON_TYPE.dateTime) {
230309
- return "::".concat(printDateTimeSkeleton(style));
230310
- } else {
230311
- return "::".concat(style.tokens.map(printNumberSkeletonToken).join(" "));
230312
- }
230313
- }
230314
- function printDateTimeSkeleton(style) {
230315
- return style.pattern;
230316
- }
230317
- function printSelectElement(el) {
230318
- var msg = [
230319
- el.value,
230320
- "select",
230321
- Object.keys(el.options).map(function(id) {
230322
- return "".concat(id, "{").concat(doPrintAST(el.options[id].value, false), "}");
230323
- }).join(" ")
230324
- ].join(",");
230325
- return "{".concat(msg, "}");
230326
- }
230327
- function printPluralElement(el) {
230328
- var type = el.pluralType === "cardinal" ? "plural" : "selectordinal";
230329
- var msg = [
230330
- el.value,
230331
- type,
230332
- __spreadArray([
230333
- el.offset ? "offset:".concat(el.offset) : ""
230334
- ], Object.keys(el.options).map(function(id) {
230335
- return "".concat(id, "{").concat(doPrintAST(el.options[id].value, true), "}");
230336
- }), true).filter(Boolean).join(" ")
230337
- ].join(",");
230338
- return "{".concat(msg, "}");
230339
- }
230340
-
230341
- // packages/cli-lib/src/extract.ts
230342
230338
  init_parse_script();
230343
230339
  var import_promises = require("fs/promises");
230344
230340
  var stringify3 = stringifyNs3.default || stringifyNs3;
@@ -230421,7 +230417,7 @@ async function processFile(source, fn, { idInterpolationPattern, ...opts }) {
230421
230417
  return { messages, meta };
230422
230418
  }
230423
230419
  async function extract(files, extractOpts) {
230424
- const { throws, readFromStdin, flatten: flatten2, ...opts } = extractOpts;
230420
+ const { throws, readFromStdin, ...opts } = extractOpts;
230425
230421
  let rawResults = [];
230426
230422
  try {
230427
230423
  if (readFromStdin) {
@@ -230486,9 +230482,6 @@ ${JSON.stringify(message, void 0, 2)}`
230486
230482
  const results = {};
230487
230483
  const messages = Array.from(extractedMessages.values());
230488
230484
  for (const { id, ...msg } of messages) {
230489
- if (flatten2 && msg.defaultMessage) {
230490
- msg.defaultMessage = printAST(hoistSelectors(parse(msg.defaultMessage)));
230491
- }
230492
230485
  results[id] = msg;
230493
230486
  }
230494
230487
  if (typeof formatter.serialize === "function") {