@danielx/civet 0.5.93 → 0.6.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.
package/dist/main.mjs CHANGED
@@ -383,6 +383,82 @@ var require_lib = __commonJS({
383
383
  return '"' + str.replace(/"/g, '\\"') + '"';
384
384
  }
385
385
  }
386
+ function lastAccessInCallExpression(exp) {
387
+ let children, i;
388
+ do {
389
+ ({ children } = exp);
390
+ i = children.length - 1;
391
+ while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
392
+ i--;
393
+ if (i < 0)
394
+ return;
395
+ } while (children[i].type === "MemberExpression" && (exp = children[i]));
396
+ return children[i];
397
+ }
398
+ function convertMethodToFunction(method) {
399
+ const { signature, block } = method;
400
+ let { modifier } = signature;
401
+ if (modifier) {
402
+ if (modifier.get || modifier.set) {
403
+ return;
404
+ } else if (modifier.async) {
405
+ modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
406
+ } else {
407
+ modifier = ["function ", ...modifier.children];
408
+ }
409
+ } else {
410
+ modifier = "function ";
411
+ }
412
+ return {
413
+ ...signature,
414
+ id: signature.name,
415
+ type: "FunctionExpression",
416
+ children: [
417
+ [modifier, ...signature.children.slice(1)],
418
+ block
419
+ ],
420
+ block
421
+ };
422
+ }
423
+ function convertObjectToJSXAttributes(obj) {
424
+ const { properties } = obj;
425
+ const parts = [];
426
+ const rest = [];
427
+ for (let i = 0; i < properties.length; i++) {
428
+ if (i > 0)
429
+ parts.push(" ");
430
+ const part = properties[i];
431
+ switch (part.type) {
432
+ case "Identifier":
433
+ parts.push([part.name, "={", part.name, "}"]);
434
+ break;
435
+ case "Property":
436
+ if (part.name.type === "ComputedPropertyName") {
437
+ rest.push(part);
438
+ } else {
439
+ parts.push([part.name, "={", insertTrimmingSpace(part.value, ""), "}"]);
440
+ }
441
+ break;
442
+ case "SpreadProperty":
443
+ parts.push(["{", part.dots, part.value, "}"]);
444
+ break;
445
+ case "MethodDefinition":
446
+ const func = convertMethodToFunction(part);
447
+ if (func) {
448
+ parts.push([part.name, "={", convertMethodToFunction(part), "}"]);
449
+ } else {
450
+ rest.push(part);
451
+ }
452
+ break;
453
+ default:
454
+ throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
455
+ }
456
+ }
457
+ if (rest.length) {
458
+ parts.push(["{...{", ...rest, "}}"]);
459
+ }
460
+ return parts;
461
+ }
386
462
  function processCoffeeInterpolation(s, parts, e, $loc) {
387
463
  if (parts.length === 0 || parts.length === 1 && parts[0].token != null) {
388
464
  return {
@@ -531,6 +607,8 @@ var require_lib = __commonJS({
531
607
  module.exports = {
532
608
  blockWithPrefix,
533
609
  clone,
610
+ convertMethodToFunction,
611
+ convertObjectToJSXAttributes,
534
612
  deepCopy,
535
613
  findAncestor,
536
614
  forRange,
@@ -546,6 +624,7 @@ var require_lib = __commonJS({
546
624
  hoistRefDecs,
547
625
  insertTrimmingSpace,
548
626
  isFunction,
627
+ lastAccessInCallExpression,
549
628
  literalValue,
550
629
  modifyString,
551
630
  processCoffeeInterpolation,
@@ -987,6 +1066,7 @@ ${input.slice(result.pos)}
987
1066
  NonPipelineArgumentPart,
988
1067
  BinaryOpExpression,
989
1068
  BinaryOpRHS,
1069
+ SingleLineBinaryOpRHS,
990
1070
  RHS,
991
1071
  ParenthesizedAssignment,
992
1072
  UnaryExpression,
@@ -1049,6 +1129,7 @@ ${input.slice(result.pos)}
1049
1129
  SliceParameters,
1050
1130
  PropertyAccess,
1051
1131
  PropertyGlob,
1132
+ PropertyBind,
1052
1133
  SuperProperty,
1053
1134
  MetaProperty,
1054
1135
  ReturnValue,
@@ -1061,6 +1142,7 @@ ${input.slice(result.pos)}
1061
1142
  BindingIdentifier,
1062
1143
  NWBindingIdentifier,
1063
1144
  AtIdentifierRef,
1145
+ PinPattern,
1064
1146
  BindingPattern,
1065
1147
  ObjectBindingPattern,
1066
1148
  ObjectBindingPatternContent,
@@ -1079,21 +1161,6 @@ ${input.slice(result.pos)}
1079
1161
  BindingElement,
1080
1162
  BindingRestElement,
1081
1163
  EmptyBindingPattern,
1082
- MatchingPattern,
1083
- ObjectMatchingPattern,
1084
- ObjectMatchingPatternContent,
1085
- NestedMatchingProperties,
1086
- MatchingPropertyList,
1087
- NestedMatchingPropertyList,
1088
- MatchingProperty,
1089
- MatchingRestProperty,
1090
- ArrayMatchingPattern,
1091
- ArrayMatchingPatternContent,
1092
- NestedMatchingElements,
1093
- MatchingElementList,
1094
- NestedMatchingElementList,
1095
- MatchingElement,
1096
- MatchingRestElement,
1097
1164
  FunctionDeclaration,
1098
1165
  FunctionSignature,
1099
1166
  FunctionExpression,
@@ -1255,6 +1322,10 @@ ${input.slice(result.pos)}
1255
1322
  AllowMultiLineImplicitObjectLiteral,
1256
1323
  RestoreMultiLineImplicitObjectLiteral,
1257
1324
  MultiLineImplicitObjectLiteralAllowed,
1325
+ AllowNewlineBinaryOp,
1326
+ ForbidNewlineBinaryOp,
1327
+ RestoreNewlineBinaryOp,
1328
+ NewlineBinaryOpAllowed,
1258
1329
  AllowAll,
1259
1330
  RestoreAll,
1260
1331
  ExpressionStatement,
@@ -1836,7 +1907,7 @@ ${input.slice(result.pos)}
1836
1907
  var $R48 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
1837
1908
  var $R49 = $R(new RegExp("\\s", "suy"));
1838
1909
  var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
1839
- var $R51 = $R(new RegExp("[\\s>]", "suy"));
1910
+ var $R51 = $R(new RegExp("[\\s>]|\\/>", "suy"));
1840
1911
  var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
1841
1912
  var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
1842
1913
  var $R54 = $R(new RegExp("[<>]", "suy"));
@@ -2669,7 +2740,13 @@ ${input.slice(result.pos)}
2669
2740
  var rhs = $2;
2670
2741
  return [[], op, [], rhs];
2671
2742
  });
2672
- var BinaryOpRHS$1 = $S(NotDedented, BinaryOp, $C(_, $S(EOS, __)), RHS);
2743
+ var BinaryOpRHS$1 = $T($S(NewlineBinaryOpAllowed, $S(NotDedented, BinaryOp, $C(_, $S(EOS, __)), RHS)), function(value) {
2744
+ var rhs = value[1];
2745
+ return rhs;
2746
+ });
2747
+ var BinaryOpRHS$2 = $T($S($N(NewlineBinaryOpAllowed), SingleLineBinaryOpRHS), function(value) {
2748
+ return value[1];
2749
+ });
2673
2750
  function BinaryOpRHS(state) {
2674
2751
  let eventData;
2675
2752
  if (state.events) {
@@ -2681,17 +2758,46 @@ ${input.slice(result.pos)}
2681
2758
  }
2682
2759
  }
2683
2760
  if (state.tokenize) {
2684
- const result = $TOKEN("BinaryOpRHS", state, BinaryOpRHS$0(state) || BinaryOpRHS$1(state));
2761
+ const result = $TOKEN("BinaryOpRHS", state, BinaryOpRHS$0(state) || BinaryOpRHS$1(state) || BinaryOpRHS$2(state));
2685
2762
  if (state.events)
2686
2763
  state.events.exit?.("BinaryOpRHS", state, result, eventData);
2687
2764
  return result;
2688
2765
  } else {
2689
- const result = BinaryOpRHS$0(state) || BinaryOpRHS$1(state);
2766
+ const result = BinaryOpRHS$0(state) || BinaryOpRHS$1(state) || BinaryOpRHS$2(state);
2690
2767
  if (state.events)
2691
2768
  state.events.exit?.("BinaryOpRHS", state, result, eventData);
2692
2769
  return result;
2693
2770
  }
2694
2771
  }
2772
+ var SingleLineBinaryOpRHS$0 = $TS($S($E(_), BinaryOp, $C(_, $S(EOS, __)), RHS), function($skip, $loc, $0, $1, $2, $3, $4) {
2773
+ var ws1 = $1;
2774
+ var op = $2;
2775
+ var ws2 = $3;
2776
+ var rhs = $4;
2777
+ return [ws1 || [], op, ws2, rhs];
2778
+ });
2779
+ function SingleLineBinaryOpRHS(state) {
2780
+ let eventData;
2781
+ if (state.events) {
2782
+ const result = state.events.enter?.("SingleLineBinaryOpRHS", state);
2783
+ if (result) {
2784
+ if (result.cache)
2785
+ return result.cache;
2786
+ eventData = result.data;
2787
+ }
2788
+ }
2789
+ if (state.tokenize) {
2790
+ const result = $TOKEN("SingleLineBinaryOpRHS", state, SingleLineBinaryOpRHS$0(state));
2791
+ if (state.events)
2792
+ state.events.exit?.("SingleLineBinaryOpRHS", state, result, eventData);
2793
+ return result;
2794
+ } else {
2795
+ const result = SingleLineBinaryOpRHS$0(state);
2796
+ if (state.events)
2797
+ state.events.exit?.("SingleLineBinaryOpRHS", state, result, eventData);
2798
+ return result;
2799
+ }
2800
+ }
2695
2801
  var RHS$0 = ParenthesizedAssignment;
2696
2802
  var RHS$1 = UnaryExpression;
2697
2803
  var RHS$2 = ExpressionizedStatement;
@@ -4145,14 +4251,14 @@ ${input.slice(result.pos)}
4145
4251
  }
4146
4252
  var CallExpression$0 = $TS($S($EXPECT($L14, fail, 'CallExpression "super"'), ArgumentsWithTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
4147
4253
  var rest = $3;
4148
- return module.processGlob({
4254
+ return module.processCallMemberExpression({
4149
4255
  type: "CallExpression",
4150
4256
  children: [$1, ...$2, ...rest.flat()]
4151
4257
  });
4152
4258
  });
4153
4259
  var CallExpression$1 = $TS($S($EXPECT($L15, fail, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
4154
4260
  var rest = $3;
4155
- return module.processGlob({
4261
+ return module.processCallMemberExpression({
4156
4262
  type: "CallExpression",
4157
4263
  children: [$1, ...$2, ...rest.flat()]
4158
4264
  });
@@ -4163,7 +4269,7 @@ ${input.slice(result.pos)}
4163
4269
  var rest = $3;
4164
4270
  if (rest.length || trailing.length) {
4165
4271
  rest = rest.flat();
4166
- return module.processGlob({
4272
+ return module.processCallMemberExpression({
4167
4273
  type: "CallExpression",
4168
4274
  children: [member, ...trailing, ...rest]
4169
4275
  });
@@ -4306,7 +4412,7 @@ ${input.slice(result.pos)}
4306
4412
  var MemberExpression$0 = $TS($S($C(PrimaryExpression, SuperProperty, MetaProperty), $Q(MemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
4307
4413
  var rest = $2;
4308
4414
  if (rest.length || Array.isArray($1)) {
4309
- return module.processGlob({
4415
+ return module.processCallMemberExpression({
4310
4416
  type: "MemberExpression",
4311
4417
  children: [$1, ...rest].flat()
4312
4418
  });
@@ -4346,7 +4452,8 @@ ${input.slice(result.pos)}
4346
4452
  });
4347
4453
  var MemberExpressionRest$1 = PropertyAccess;
4348
4454
  var MemberExpressionRest$2 = PropertyGlob;
4349
- var MemberExpressionRest$3 = NonNullAssertion;
4455
+ var MemberExpressionRest$3 = PropertyBind;
4456
+ var MemberExpressionRest$4 = NonNullAssertion;
4350
4457
  function MemberExpressionRest(state) {
4351
4458
  let eventData;
4352
4459
  if (state.events) {
@@ -4358,12 +4465,12 @@ ${input.slice(result.pos)}
4358
4465
  }
4359
4466
  }
4360
4467
  if (state.tokenize) {
4361
- const result = $TOKEN("MemberExpressionRest", state, MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state));
4468
+ const result = $TOKEN("MemberExpressionRest", state, MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state) || MemberExpressionRest$4(state));
4362
4469
  if (state.events)
4363
4470
  state.events.exit?.("MemberExpressionRest", state, result, eventData);
4364
4471
  return result;
4365
4472
  } else {
4366
- const result = MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state);
4473
+ const result = MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state) || MemberExpressionRest$4(state);
4367
4474
  if (state.events)
4368
4475
  state.events.exit?.("MemberExpressionRest", state, result, eventData);
4369
4476
  return result;
@@ -4573,9 +4680,11 @@ ${input.slice(result.pos)}
4573
4680
  }
4574
4681
  }
4575
4682
  var PropertyGlob$0 = $TS($S(OptionalDot, BracedObjectLiteral), function($skip, $loc, $0, $1, $2) {
4683
+ var dot = $1;
4576
4684
  var object = $2;
4577
4685
  return {
4578
4686
  type: "PropertyGlob",
4687
+ dot,
4579
4688
  object,
4580
4689
  children: $0
4581
4690
  };
@@ -4602,6 +4711,38 @@ ${input.slice(result.pos)}
4602
4711
  return result;
4603
4712
  }
4604
4713
  }
4714
+ var PropertyBind$0 = $TS($S($E($C(QuestionMark, NonNullAssertion)), At, OptionalDot, $C(IdentifierName, PrivateIdentifier)), function($skip, $loc, $0, $1, $2, $3, $4) {
4715
+ var modifier = $1;
4716
+ var dot = $3;
4717
+ var id = $4;
4718
+ return {
4719
+ type: "PropertyBind",
4720
+ name: id.name,
4721
+ children: [modifier, dot, id]
4722
+ };
4723
+ });
4724
+ function PropertyBind(state) {
4725
+ let eventData;
4726
+ if (state.events) {
4727
+ const result = state.events.enter?.("PropertyBind", state);
4728
+ if (result) {
4729
+ if (result.cache)
4730
+ return result.cache;
4731
+ eventData = result.data;
4732
+ }
4733
+ }
4734
+ if (state.tokenize) {
4735
+ const result = $TOKEN("PropertyBind", state, PropertyBind$0(state));
4736
+ if (state.events)
4737
+ state.events.exit?.("PropertyBind", state, result, eventData);
4738
+ return result;
4739
+ } else {
4740
+ const result = PropertyBind$0(state);
4741
+ if (state.events)
4742
+ state.events.exit?.("PropertyBind", state, result, eventData);
4743
+ return result;
4744
+ }
4745
+ }
4605
4746
  var SuperProperty$0 = $S($EXPECT($L14, fail, 'SuperProperty "super"'), MemberBracketContent);
4606
4747
  var SuperProperty$1 = $S($EXPECT($L14, fail, 'SuperProperty "super"'), $N($C(QuestionMark, NonNullAssertion)), PropertyAccess);
4607
4748
  function SuperProperty(state) {
@@ -4994,20 +5135,41 @@ ${input.slice(result.pos)}
4994
5135
  return result;
4995
5136
  }
4996
5137
  }
4997
- var BindingPattern$0 = $TS($S(__, ObjectBindingPattern), function($skip, $loc, $0, $1, $2) {
4998
- var p = $2;
4999
- return {
5000
- children: [...$1, p],
5001
- names: p.names
5002
- };
5003
- });
5004
- var BindingPattern$1 = $TS($S(__, ArrayBindingPattern), function($skip, $loc, $0, $1, $2) {
5005
- var p = $2;
5138
+ var PinPattern$0 = $TS($S($EXPECT($L17, fail, 'PinPattern "^"'), Identifier), function($skip, $loc, $0, $1, $2) {
5139
+ var identifier = $2;
5006
5140
  return {
5007
- children: [...$1, p.children],
5008
- names: p.names
5141
+ type: "PinPattern",
5142
+ children: $0,
5143
+ identifier
5009
5144
  };
5010
5145
  });
5146
+ function PinPattern(state) {
5147
+ let eventData;
5148
+ if (state.events) {
5149
+ const result = state.events.enter?.("PinPattern", state);
5150
+ if (result) {
5151
+ if (result.cache)
5152
+ return result.cache;
5153
+ eventData = result.data;
5154
+ }
5155
+ }
5156
+ if (state.tokenize) {
5157
+ const result = $TOKEN("PinPattern", state, PinPattern$0(state));
5158
+ if (state.events)
5159
+ state.events.exit?.("PinPattern", state, result, eventData);
5160
+ return result;
5161
+ } else {
5162
+ const result = PinPattern$0(state);
5163
+ if (state.events)
5164
+ state.events.exit?.("PinPattern", state, result, eventData);
5165
+ return result;
5166
+ }
5167
+ }
5168
+ var BindingPattern$0 = ObjectBindingPattern;
5169
+ var BindingPattern$1 = ArrayBindingPattern;
5170
+ var BindingPattern$2 = PinPattern;
5171
+ var BindingPattern$3 = Literal;
5172
+ var BindingPattern$4 = RegularExpressionLiteral;
5011
5173
  function BindingPattern(state) {
5012
5174
  let eventData;
5013
5175
  if (state.events) {
@@ -5019,24 +5181,24 @@ ${input.slice(result.pos)}
5019
5181
  }
5020
5182
  }
5021
5183
  if (state.tokenize) {
5022
- const result = $TOKEN("BindingPattern", state, BindingPattern$0(state) || BindingPattern$1(state));
5184
+ const result = $TOKEN("BindingPattern", state, BindingPattern$0(state) || BindingPattern$1(state) || BindingPattern$2(state) || BindingPattern$3(state) || BindingPattern$4(state));
5023
5185
  if (state.events)
5024
5186
  state.events.exit?.("BindingPattern", state, result, eventData);
5025
5187
  return result;
5026
5188
  } else {
5027
- const result = BindingPattern$0(state) || BindingPattern$1(state);
5189
+ const result = BindingPattern$0(state) || BindingPattern$1(state) || BindingPattern$2(state) || BindingPattern$3(state) || BindingPattern$4(state);
5028
5190
  if (state.events)
5029
5191
  state.events.exit?.("BindingPattern", state, result, eventData);
5030
5192
  return result;
5031
5193
  }
5032
5194
  }
5033
- var ObjectBindingPattern$0 = $TS($S(OpenBrace, ObjectBindingPatternContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
5034
- var c = $2;
5195
+ var ObjectBindingPattern$0 = $TS($S($E(_), OpenBrace, ObjectBindingPatternContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5196
+ var c = $3;
5035
5197
  return {
5036
5198
  type: "ObjectBindingPattern",
5037
- children: [$1, ...c.children, $3, $4],
5038
- content: c.children,
5039
- names: c.names
5199
+ children: $0,
5200
+ names: c.names,
5201
+ properties: c.children
5040
5202
  };
5041
5203
  });
5042
5204
  function ObjectBindingPattern(state) {
@@ -5063,10 +5225,10 @@ ${input.slice(result.pos)}
5063
5225
  }
5064
5226
  var ObjectBindingPatternContent$0 = NestedBindingProperties;
5065
5227
  var ObjectBindingPatternContent$1 = $TV($E(BindingPropertyList), function($skip, $loc, $0, $1) {
5066
- var props2 = $0;
5067
- if (!props2)
5228
+ var props = $0;
5229
+ if (!props)
5068
5230
  return { children: [], names: [] };
5069
- return module.reorderBindingRestProperty(props2);
5231
+ return module.reorderBindingRestProperty(props);
5070
5232
  });
5071
5233
  function ObjectBindingPatternContent(state) {
5072
5234
  let eventData;
@@ -5091,8 +5253,8 @@ ${input.slice(result.pos)}
5091
5253
  }
5092
5254
  }
5093
5255
  var BindingPropertyList$0 = $TV($P($S(BindingProperty, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
5094
- var props2 = $0;
5095
- return props2.map(([prop, delim]) => {
5256
+ var props = $0;
5257
+ return props.map(([prop, delim]) => {
5096
5258
  return {
5097
5259
  ...prop,
5098
5260
  children: [...prop.children, delim]
@@ -5121,12 +5283,14 @@ ${input.slice(result.pos)}
5121
5283
  return result;
5122
5284
  }
5123
5285
  }
5124
- var ArrayBindingPattern$0 = $TS($S(OpenBracket, ArrayBindingPatternContent, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
5125
- var c = $2;
5286
+ var ArrayBindingPattern$0 = $TS($S($E(_), OpenBracket, ArrayBindingPatternContent, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5287
+ var c = $3;
5126
5288
  return {
5127
5289
  type: "ArrayBindingPattern",
5290
+ children: $0,
5128
5291
  names: c.names,
5129
- children: $0
5292
+ elements: c.children,
5293
+ length: c.length
5130
5294
  };
5131
5295
  });
5132
5296
  function ArrayBindingPattern(state) {
@@ -5155,7 +5319,7 @@ ${input.slice(result.pos)}
5155
5319
  var ArrayBindingPatternContent$1 = $TV($E(BindingElementList), function($skip, $loc, $0, $1) {
5156
5320
  var elements = $0;
5157
5321
  if (!elements)
5158
- return { children: [], names: [] };
5322
+ return { children: [], names: [], length: 0 };
5159
5323
  return module.adjustBindingElements(elements);
5160
5324
  });
5161
5325
  function ArrayBindingPatternContent(state) {
@@ -5269,10 +5433,10 @@ ${input.slice(result.pos)}
5269
5433
  }
5270
5434
  }
5271
5435
  var NestedBindingProperties$0 = $TS($S(PushIndent, $Q(NestedBindingPropertyList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
5272
- var props2 = $2;
5273
- if (!props2.length)
5436
+ var props = $2;
5437
+ if (!props.length)
5274
5438
  return $skip;
5275
- return module.reorderBindingRestProperty(props2.flat());
5439
+ return module.reorderBindingRestProperty(props.flat());
5276
5440
  });
5277
5441
  function NestedBindingProperties(state) {
5278
5442
  let eventData;
@@ -5298,8 +5462,8 @@ ${input.slice(result.pos)}
5298
5462
  }
5299
5463
  var NestedBindingPropertyList$0 = $TS($S(Nested, BindingPropertyList), function($skip, $loc, $0, $1, $2) {
5300
5464
  var ws = $1;
5301
- var props2 = $2;
5302
- return props2.map((prop, i) => {
5465
+ var props = $2;
5466
+ return props.map((prop, i) => {
5303
5467
  if (i > 0)
5304
5468
  return prop;
5305
5469
  return {
@@ -5331,35 +5495,53 @@ ${input.slice(result.pos)}
5331
5495
  }
5332
5496
  }
5333
5497
  var BindingProperty$0 = BindingRestProperty;
5334
- var BindingProperty$1 = $TS($S($E(_), PropertyName, $E(_), Colon, $C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
5498
+ var BindingProperty$1 = $TS($S($E(_), PropertyName, $E(_), Colon, $E(_), $C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
5335
5499
  var name = $2;
5336
- var b = $5;
5337
- var init = $6;
5500
+ var value = $6;
5501
+ var init = $7;
5338
5502
  return {
5503
+ type: "BindingProperty",
5504
+ children: $0,
5339
5505
  name,
5340
- value: b,
5506
+ value,
5341
5507
  init,
5342
- names: b.names,
5343
- children: $0
5508
+ names: value.names
5344
5509
  };
5345
5510
  });
5346
- var BindingProperty$2 = $TS($S(BindingIdentifier, $E(Initializer)), function($skip, $loc, $0, $1, $2) {
5347
- var b = $1;
5348
- var init = $2;
5349
- if (b.type === "AtBinding") {
5511
+ var BindingProperty$2 = $TS($S($E(_), $E($EXPECT($L17, fail, 'BindingProperty "^"')), BindingIdentifier, $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
5512
+ var ws = $1;
5513
+ var pin = $2;
5514
+ var binding = $3;
5515
+ var init = $4;
5516
+ if (binding.type === "AtBinding") {
5350
5517
  return {
5351
5518
  type: "AtBindingProperty",
5352
- ref: b.ref,
5519
+ children: $0,
5520
+ binding,
5521
+ ref: binding.ref,
5353
5522
  init,
5354
- names: [],
5355
- children: $0
5523
+ names: []
5524
+ };
5525
+ }
5526
+ if (pin) {
5527
+ return {
5528
+ type: "PinProperty",
5529
+ children: [ws, binding],
5530
+ name: binding,
5531
+ value: {
5532
+ type: "PinPattern",
5533
+ identifier: binding
5534
+ }
5356
5535
  };
5357
5536
  }
5358
5537
  return {
5359
- name: b,
5538
+ type: "BindingProperty",
5539
+ children: $0,
5540
+ name: binding,
5541
+ value: void 0,
5360
5542
  init,
5361
- names: b.names,
5362
- children: $0
5543
+ names: binding.names,
5544
+ identifier: binding
5363
5545
  };
5364
5546
  });
5365
5547
  function BindingProperty(state) {
@@ -5485,11 +5667,19 @@ ${input.slice(result.pos)}
5485
5667
  }
5486
5668
  }
5487
5669
  var BindingElement$0 = BindingRestElement;
5488
- var BindingElement$1 = $TS($S($C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2) {
5489
- var binding = $1;
5670
+ var BindingElement$1 = $TS($S($E(_), $C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
5671
+ var ws = $1;
5672
+ var binding = $2;
5673
+ var initializer = $3;
5674
+ if (binding.children) {
5675
+ binding = {
5676
+ ...binding,
5677
+ children: [...binding.children, initializer]
5678
+ };
5679
+ }
5490
5680
  return {
5491
5681
  names: binding.names,
5492
- children: $0
5682
+ children: [ws, binding]
5493
5683
  };
5494
5684
  });
5495
5685
  var BindingElement$2 = $TV($Y($S($E(_), $EXPECT($L21, fail, 'BindingElement ","'))), function($skip, $loc, $0, $1) {
@@ -5571,512 +5761,17 @@ ${input.slice(result.pos)}
5571
5761
  base: "ref",
5572
5762
  id: "ref"
5573
5763
  };
5574
- return {
5575
- type: "EmptyBinding",
5576
- children: [ref],
5577
- names: [],
5578
- ref
5579
- };
5580
- });
5581
- function EmptyBindingPattern(state) {
5582
- let eventData;
5583
- if (state.events) {
5584
- const result = state.events.enter?.("EmptyBindingPattern", state);
5585
- if (result) {
5586
- if (result.cache)
5587
- return result.cache;
5588
- eventData = result.data;
5589
- }
5590
- }
5591
- if (state.tokenize) {
5592
- const result = $TOKEN("EmptyBindingPattern", state, EmptyBindingPattern$0(state));
5593
- if (state.events)
5594
- state.events.exit?.("EmptyBindingPattern", state, result, eventData);
5595
- return result;
5596
- } else {
5597
- const result = EmptyBindingPattern$0(state);
5598
- if (state.events)
5599
- state.events.exit?.("EmptyBindingPattern", state, result, eventData);
5600
- return result;
5601
- }
5602
- }
5603
- var MatchingPattern$0 = ObjectMatchingPattern;
5604
- var MatchingPattern$1 = ArrayMatchingPattern;
5605
- var MatchingPattern$2 = Literal;
5606
- var MatchingPattern$3 = RegularExpressionLiteral;
5607
- function MatchingPattern(state) {
5608
- let eventData;
5609
- if (state.events) {
5610
- const result = state.events.enter?.("MatchingPattern", state);
5611
- if (result) {
5612
- if (result.cache)
5613
- return result.cache;
5614
- eventData = result.data;
5615
- }
5616
- }
5617
- if (state.tokenize) {
5618
- const result = $TOKEN("MatchingPattern", state, MatchingPattern$0(state) || MatchingPattern$1(state) || MatchingPattern$2(state) || MatchingPattern$3(state));
5619
- if (state.events)
5620
- state.events.exit?.("MatchingPattern", state, result, eventData);
5621
- return result;
5622
- } else {
5623
- const result = MatchingPattern$0(state) || MatchingPattern$1(state) || MatchingPattern$2(state) || MatchingPattern$3(state);
5624
- if (state.events)
5625
- state.events.exit?.("MatchingPattern", state, result, eventData);
5626
- return result;
5627
- }
5628
- }
5629
- var ObjectMatchingPattern$0 = $TS($S($E(_), OpenBrace, ObjectMatchingPatternContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5630
- var ws = $1;
5631
- var open = $2;
5632
- var properties = $3;
5633
- var ws = $4;
5634
- var close = $5;
5635
- return {
5636
- type: "ObjectMatchingPattern",
5637
- children: [ws, open, ...properties.children, ...ws, close],
5638
- properties: properties.children
5639
- };
5640
- });
5641
- function ObjectMatchingPattern(state) {
5642
- let eventData;
5643
- if (state.events) {
5644
- const result = state.events.enter?.("ObjectMatchingPattern", state);
5645
- if (result) {
5646
- if (result.cache)
5647
- return result.cache;
5648
- eventData = result.data;
5649
- }
5650
- }
5651
- if (state.tokenize) {
5652
- const result = $TOKEN("ObjectMatchingPattern", state, ObjectMatchingPattern$0(state));
5653
- if (state.events)
5654
- state.events.exit?.("ObjectMatchingPattern", state, result, eventData);
5655
- return result;
5656
- } else {
5657
- const result = ObjectMatchingPattern$0(state);
5658
- if (state.events)
5659
- state.events.exit?.("ObjectMatchingPattern", state, result, eventData);
5660
- return result;
5661
- }
5662
- }
5663
- var ObjectMatchingPatternContent$0 = NestedMatchingProperties;
5664
- var ObjectMatchingPatternContent$1 = $TV($E(MatchingPropertyList), function($skip, $loc, $0, $1) {
5665
- var properties = $0;
5666
- if (!properties)
5667
- return { children: [], names: [] };
5668
- return module.reorderBindingRestProperty(properties);
5669
- });
5670
- function ObjectMatchingPatternContent(state) {
5671
- let eventData;
5672
- if (state.events) {
5673
- const result = state.events.enter?.("ObjectMatchingPatternContent", state);
5674
- if (result) {
5675
- if (result.cache)
5676
- return result.cache;
5677
- eventData = result.data;
5678
- }
5679
- }
5680
- if (state.tokenize) {
5681
- const result = $TOKEN("ObjectMatchingPatternContent", state, ObjectMatchingPatternContent$0(state) || ObjectMatchingPatternContent$1(state));
5682
- if (state.events)
5683
- state.events.exit?.("ObjectMatchingPatternContent", state, result, eventData);
5684
- return result;
5685
- } else {
5686
- const result = ObjectMatchingPatternContent$0(state) || ObjectMatchingPatternContent$1(state);
5687
- if (state.events)
5688
- state.events.exit?.("ObjectMatchingPatternContent", state, result, eventData);
5689
- return result;
5690
- }
5691
- }
5692
- var NestedMatchingProperties$0 = $TS($S(PushIndent, $Q(NestedMatchingPropertyList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
5693
- var properties = $2;
5694
- if (!props.length)
5695
- return $skip;
5696
- return module.reorderBindingRestProperty(props.flat());
5697
- });
5698
- function NestedMatchingProperties(state) {
5699
- let eventData;
5700
- if (state.events) {
5701
- const result = state.events.enter?.("NestedMatchingProperties", state);
5702
- if (result) {
5703
- if (result.cache)
5704
- return result.cache;
5705
- eventData = result.data;
5706
- }
5707
- }
5708
- if (state.tokenize) {
5709
- const result = $TOKEN("NestedMatchingProperties", state, NestedMatchingProperties$0(state));
5710
- if (state.events)
5711
- state.events.exit?.("NestedMatchingProperties", state, result, eventData);
5712
- return result;
5713
- } else {
5714
- const result = NestedMatchingProperties$0(state);
5715
- if (state.events)
5716
- state.events.exit?.("NestedMatchingProperties", state, result, eventData);
5717
- return result;
5718
- }
5719
- }
5720
- var MatchingPropertyList$0 = $TV($P($S(MatchingProperty, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
5721
- var props2 = $0;
5722
- return props2.map(([prop, delim]) => {
5723
- return {
5724
- ...prop,
5725
- children: [...prop.children, delim]
5726
- };
5727
- });
5728
- });
5729
- function MatchingPropertyList(state) {
5730
- let eventData;
5731
- if (state.events) {
5732
- const result = state.events.enter?.("MatchingPropertyList", state);
5733
- if (result) {
5734
- if (result.cache)
5735
- return result.cache;
5736
- eventData = result.data;
5737
- }
5738
- }
5739
- if (state.tokenize) {
5740
- const result = $TOKEN("MatchingPropertyList", state, MatchingPropertyList$0(state));
5741
- if (state.events)
5742
- state.events.exit?.("MatchingPropertyList", state, result, eventData);
5743
- return result;
5744
- } else {
5745
- const result = MatchingPropertyList$0(state);
5746
- if (state.events)
5747
- state.events.exit?.("MatchingPropertyList", state, result, eventData);
5748
- return result;
5749
- }
5750
- }
5751
- var NestedMatchingPropertyList$0 = $TS($S(Nested, MatchingPropertyList), function($skip, $loc, $0, $1, $2) {
5752
- var ws = $1;
5753
- var props2 = $2;
5754
- return props2.map((prop, i) => {
5755
- if (i > 0)
5756
- return prop;
5757
- return {
5758
- ...prop,
5759
- children: [ws, ...prop.children]
5760
- };
5761
- });
5762
- });
5763
- function NestedMatchingPropertyList(state) {
5764
- let eventData;
5765
- if (state.events) {
5766
- const result = state.events.enter?.("NestedMatchingPropertyList", state);
5767
- if (result) {
5768
- if (result.cache)
5769
- return result.cache;
5770
- eventData = result.data;
5771
- }
5772
- }
5773
- if (state.tokenize) {
5774
- const result = $TOKEN("NestedMatchingPropertyList", state, NestedMatchingPropertyList$0(state));
5775
- if (state.events)
5776
- state.events.exit?.("NestedMatchingPropertyList", state, result, eventData);
5777
- return result;
5778
- } else {
5779
- const result = NestedMatchingPropertyList$0(state);
5780
- if (state.events)
5781
- state.events.exit?.("NestedMatchingPropertyList", state, result, eventData);
5782
- return result;
5783
- }
5784
- }
5785
- var MatchingProperty$0 = MatchingRestProperty;
5786
- var MatchingProperty$1 = $TS($S($E(_), PropertyName, $E(_), Colon, $E(_), $C(BindingIdentifier, MatchingPattern)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
5787
- var name = $2;
5788
- var match = $6;
5789
- return {
5790
- type: "BindingMatchProperty",
5791
- name,
5792
- match,
5793
- children: $0
5794
- };
5795
- });
5796
- var MatchingProperty$2 = $TS($S($E(_), BindingIdentifier), function($skip, $loc, $0, $1, $2) {
5797
- var ws = $1;
5798
- var b = $2;
5799
- if (b.type === "AtBinding") {
5800
- return {
5801
- type: "AtBindingProperty",
5802
- ref: b.ref,
5803
- names: [],
5804
- children: [ws, b]
5805
- };
5806
- }
5807
- return {
5808
- type: "BindingProperty",
5809
- names: b.names,
5810
- children: [ws, b],
5811
- identifier: b
5812
- };
5813
- });
5814
- function MatchingProperty(state) {
5815
- let eventData;
5816
- if (state.events) {
5817
- const result = state.events.enter?.("MatchingProperty", state);
5818
- if (result) {
5819
- if (result.cache)
5820
- return result.cache;
5821
- eventData = result.data;
5822
- }
5823
- }
5824
- if (state.tokenize) {
5825
- const result = $TOKEN("MatchingProperty", state, MatchingProperty$0(state) || MatchingProperty$1(state) || MatchingProperty$2(state));
5826
- if (state.events)
5827
- state.events.exit?.("MatchingProperty", state, result, eventData);
5828
- return result;
5829
- } else {
5830
- const result = MatchingProperty$0(state) || MatchingProperty$1(state) || MatchingProperty$2(state);
5831
- if (state.events)
5832
- state.events.exit?.("MatchingProperty", state, result, eventData);
5833
- return result;
5834
- }
5835
- }
5836
- var MatchingRestProperty$0 = BindingRestProperty;
5837
- function MatchingRestProperty(state) {
5838
- let eventData;
5839
- if (state.events) {
5840
- const result = state.events.enter?.("MatchingRestProperty", state);
5841
- if (result) {
5842
- if (result.cache)
5843
- return result.cache;
5844
- eventData = result.data;
5845
- }
5846
- }
5847
- if (state.tokenize) {
5848
- const result = $TOKEN("MatchingRestProperty", state, MatchingRestProperty$0(state));
5849
- if (state.events)
5850
- state.events.exit?.("MatchingRestProperty", state, result, eventData);
5851
- return result;
5852
- } else {
5853
- const result = MatchingRestProperty$0(state);
5854
- if (state.events)
5855
- state.events.exit?.("MatchingRestProperty", state, result, eventData);
5856
- return result;
5857
- }
5858
- }
5859
- var ArrayMatchingPattern$0 = $TS($S($E(_), OpenBracket, ArrayMatchingPatternContent, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5860
- var ws = $1;
5861
- var elements = $3;
5862
- return {
5863
- type: "ArrayMatchingPattern",
5864
- children: $0,
5865
- elements: elements.children,
5866
- length: elements.length
5867
- };
5868
- });
5869
- function ArrayMatchingPattern(state) {
5870
- let eventData;
5871
- if (state.events) {
5872
- const result = state.events.enter?.("ArrayMatchingPattern", state);
5873
- if (result) {
5874
- if (result.cache)
5875
- return result.cache;
5876
- eventData = result.data;
5877
- }
5878
- }
5879
- if (state.tokenize) {
5880
- const result = $TOKEN("ArrayMatchingPattern", state, ArrayMatchingPattern$0(state));
5881
- if (state.events)
5882
- state.events.exit?.("ArrayMatchingPattern", state, result, eventData);
5883
- return result;
5884
- } else {
5885
- const result = ArrayMatchingPattern$0(state);
5886
- if (state.events)
5887
- state.events.exit?.("ArrayMatchingPattern", state, result, eventData);
5888
- return result;
5889
- }
5890
- }
5891
- var ArrayMatchingPatternContent$0 = NestedMatchingElements;
5892
- var ArrayMatchingPatternContent$1 = $TV($E(MatchingElementList), function($skip, $loc, $0, $1) {
5893
- var elements = $0;
5894
- if (!elements)
5895
- return { children: [], names: [], length: 0 };
5896
- return module.adjustBindingElements(elements);
5897
- });
5898
- function ArrayMatchingPatternContent(state) {
5899
- let eventData;
5900
- if (state.events) {
5901
- const result = state.events.enter?.("ArrayMatchingPatternContent", state);
5902
- if (result) {
5903
- if (result.cache)
5904
- return result.cache;
5905
- eventData = result.data;
5906
- }
5907
- }
5908
- if (state.tokenize) {
5909
- const result = $TOKEN("ArrayMatchingPatternContent", state, ArrayMatchingPatternContent$0(state) || ArrayMatchingPatternContent$1(state));
5910
- if (state.events)
5911
- state.events.exit?.("ArrayMatchingPatternContent", state, result, eventData);
5912
- return result;
5913
- } else {
5914
- const result = ArrayMatchingPatternContent$0(state) || ArrayMatchingPatternContent$1(state);
5915
- if (state.events)
5916
- state.events.exit?.("ArrayMatchingPatternContent", state, result, eventData);
5917
- return result;
5918
- }
5919
- }
5920
- var NestedMatchingElements$0 = $TS($S(PushIndent, $Q(NestedMatchingElementList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
5921
- var elements = $2;
5922
- return module.adjustBindingElements(elements.flat());
5923
- });
5924
- function NestedMatchingElements(state) {
5925
- let eventData;
5926
- if (state.events) {
5927
- const result = state.events.enter?.("NestedMatchingElements", state);
5928
- if (result) {
5929
- if (result.cache)
5930
- return result.cache;
5931
- eventData = result.data;
5932
- }
5933
- }
5934
- if (state.tokenize) {
5935
- const result = $TOKEN("NestedMatchingElements", state, NestedMatchingElements$0(state));
5936
- if (state.events)
5937
- state.events.exit?.("NestedMatchingElements", state, result, eventData);
5938
- return result;
5939
- } else {
5940
- const result = NestedMatchingElements$0(state);
5941
- if (state.events)
5942
- state.events.exit?.("NestedMatchingElements", state, result, eventData);
5943
- return result;
5944
- }
5945
- }
5946
- var MatchingElementList$0 = $TV($P($S(MatchingElement, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
5947
- var elements = $0;
5948
- return elements.map(([element, delim]) => {
5949
- return {
5950
- ...element,
5951
- children: [...element.children, delim]
5952
- };
5953
- });
5954
- });
5955
- function MatchingElementList(state) {
5956
- let eventData;
5957
- if (state.events) {
5958
- const result = state.events.enter?.("MatchingElementList", state);
5959
- if (result) {
5960
- if (result.cache)
5961
- return result.cache;
5962
- eventData = result.data;
5963
- }
5964
- }
5965
- if (state.tokenize) {
5966
- const result = $TOKEN("MatchingElementList", state, MatchingElementList$0(state));
5967
- if (state.events)
5968
- state.events.exit?.("MatchingElementList", state, result, eventData);
5969
- return result;
5970
- } else {
5971
- const result = MatchingElementList$0(state);
5972
- if (state.events)
5973
- state.events.exit?.("MatchingElementList", state, result, eventData);
5974
- return result;
5975
- }
5976
- }
5977
- var NestedMatchingElementList$0 = $TS($S(Nested, MatchingElementList), function($skip, $loc, $0, $1, $2) {
5978
- var ws = $1;
5979
- var elements = $2;
5980
- return elements.map((element, i) => {
5981
- if (i > 0)
5982
- return element;
5983
- return {
5984
- ...element,
5985
- children: [ws, ...element.children]
5986
- };
5987
- });
5988
- });
5989
- function NestedMatchingElementList(state) {
5990
- let eventData;
5991
- if (state.events) {
5992
- const result = state.events.enter?.("NestedMatchingElementList", state);
5993
- if (result) {
5994
- if (result.cache)
5995
- return result.cache;
5996
- eventData = result.data;
5997
- }
5998
- }
5999
- if (state.tokenize) {
6000
- const result = $TOKEN("NestedMatchingElementList", state, NestedMatchingElementList$0(state));
6001
- if (state.events)
6002
- state.events.exit?.("NestedMatchingElementList", state, result, eventData);
6003
- return result;
6004
- } else {
6005
- const result = NestedMatchingElementList$0(state);
6006
- if (state.events)
6007
- state.events.exit?.("NestedMatchingElementList", state, result, eventData);
6008
- return result;
6009
- }
6010
- }
6011
- var MatchingElement$0 = MatchingRestElement;
6012
- var MatchingElement$1 = $TS($S($E(_), BindingIdentifier, $E(_), Colon, $E(_), $C(BindingIdentifier, MatchingPattern)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6013
- var ws = $1;
6014
- var name = $2;
6015
- var match = $6;
6016
- let blockPrefix;
6017
- switch (match.type) {
6018
- case "ArrayMatchingPattern":
6019
- case "ObjectMatchingPattern":
6020
- blockPrefix = [match, " = ", name];
6021
- break;
6022
- default:
6023
- break;
6024
- }
6025
- return {
6026
- names: name.names,
6027
- children: [ws, {
6028
- type: "BindingMatchElement",
6029
- name,
6030
- match,
6031
- children: [name],
6032
- blockPrefix
6033
- }]
6034
- };
6035
- });
6036
- var MatchingElement$2 = $TS($S($E(_), $C(BindingIdentifier, MatchingPattern)), function($skip, $loc, $0, $1, $2) {
6037
- var ws = $1;
6038
- var binding = $2;
6039
- return {
6040
- names: binding.names,
6041
- children: [ws, binding]
6042
- };
6043
- });
6044
- var MatchingElement$3 = $TV($Y($S($E(_), $EXPECT($L21, fail, 'MatchingElement ","'))), function($skip, $loc, $0, $1) {
6045
- return {
6046
- children: [{
6047
- type: "ElisionElement",
6048
- children: [""]
6049
- }],
6050
- names: []
6051
- };
6052
- });
6053
- function MatchingElement(state) {
6054
- let eventData;
6055
- if (state.events) {
6056
- const result = state.events.enter?.("MatchingElement", state);
6057
- if (result) {
6058
- if (result.cache)
6059
- return result.cache;
6060
- eventData = result.data;
6061
- }
6062
- }
6063
- if (state.tokenize) {
6064
- const result = $TOKEN("MatchingElement", state, MatchingElement$0(state) || MatchingElement$1(state) || MatchingElement$2(state) || MatchingElement$3(state));
6065
- if (state.events)
6066
- state.events.exit?.("MatchingElement", state, result, eventData);
6067
- return result;
6068
- } else {
6069
- const result = MatchingElement$0(state) || MatchingElement$1(state) || MatchingElement$2(state) || MatchingElement$3(state);
6070
- if (state.events)
6071
- state.events.exit?.("MatchingElement", state, result, eventData);
6072
- return result;
6073
- }
6074
- }
6075
- var MatchingRestElement$0 = BindingRestElement;
6076
- function MatchingRestElement(state) {
5764
+ return {
5765
+ type: "EmptyBinding",
5766
+ children: [ref],
5767
+ names: [],
5768
+ ref
5769
+ };
5770
+ });
5771
+ function EmptyBindingPattern(state) {
6077
5772
  let eventData;
6078
5773
  if (state.events) {
6079
- const result = state.events.enter?.("MatchingRestElement", state);
5774
+ const result = state.events.enter?.("EmptyBindingPattern", state);
6080
5775
  if (result) {
6081
5776
  if (result.cache)
6082
5777
  return result.cache;
@@ -6084,14 +5779,14 @@ ${input.slice(result.pos)}
6084
5779
  }
6085
5780
  }
6086
5781
  if (state.tokenize) {
6087
- const result = $TOKEN("MatchingRestElement", state, MatchingRestElement$0(state));
5782
+ const result = $TOKEN("EmptyBindingPattern", state, EmptyBindingPattern$0(state));
6088
5783
  if (state.events)
6089
- state.events.exit?.("MatchingRestElement", state, result, eventData);
5784
+ state.events.exit?.("EmptyBindingPattern", state, result, eventData);
6090
5785
  return result;
6091
5786
  } else {
6092
- const result = MatchingRestElement$0(state);
5787
+ const result = EmptyBindingPattern$0(state);
6093
5788
  if (state.events)
6094
- state.events.exit?.("MatchingRestElement", state, result, eventData);
5789
+ state.events.exit?.("EmptyBindingPattern", state, result, eventData);
6095
5790
  return result;
6096
5791
  }
6097
5792
  }
@@ -7796,16 +7491,16 @@ ${input.slice(result.pos)}
7796
7491
  var open = $1;
7797
7492
  if (!$3)
7798
7493
  return $skip;
7799
- const [content, ...close] = $3;
7800
- if (content) {
7801
- const children = [open, ...content, close];
7494
+ const [properties, ...close] = $3;
7495
+ if (properties) {
7496
+ const children = [open, ...properties, close];
7802
7497
  return {
7803
7498
  type: "ObjectExpression",
7804
- content,
7805
7499
  children,
7806
7500
  names: children.flatMap((c) => {
7807
7501
  return c.names || [];
7808
- })
7502
+ }),
7503
+ properties
7809
7504
  };
7810
7505
  }
7811
7506
  return {
@@ -8122,11 +7817,11 @@ ${input.slice(result.pos)}
8122
7817
  return result;
8123
7818
  }
8124
7819
  }
8125
- var PropertyDefinition$0 = $TS($S(__, At, IdentifierReference), function($skip, $loc, $0, $1, $2, $3) {
7820
+ var PropertyDefinition$0 = $TS($S(__, AtThis, IdentifierReference), function($skip, $loc, $0, $1, $2, $3) {
8126
7821
  var ws = $1;
8127
7822
  var at = $2;
8128
7823
  var id = $3;
8129
- const value = [{ ...at, token: "this." }, id];
7824
+ const value = [at, ".", id];
8130
7825
  return {
8131
7826
  type: "Property",
8132
7827
  children: [ws, id, ": ", ...value],
@@ -8184,26 +7879,19 @@ ${input.slice(result.pos)}
8184
7879
  if (value.type === "Identifier") {
8185
7880
  return { ...value, children: [ws, ...value.children] };
8186
7881
  }
8187
- let exp = value, children, i;
8188
- do {
8189
- ({ children } = exp);
8190
- i = children.length - 1;
8191
- while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
8192
- i--;
8193
- if (i < 0)
8194
- return $skip;
8195
- } while (children[i].type === "MemberExpression" && (exp = children[i]));
8196
- const last = children[i];
7882
+ const last = lastAccessInCallExpression(value);
7883
+ if (!last)
7884
+ return $skip;
8197
7885
  let name;
8198
- if (last.name) {
8199
- ({ name } = last);
8200
- } else if (last.type === "Index") {
7886
+ if (last.type === "Index") {
8201
7887
  name = {
8202
7888
  type: "ComputedPropertyName",
8203
7889
  children: last.children
8204
7890
  };
8205
7891
  } else {
8206
- return $skip;
7892
+ ({ name } = last);
7893
+ if (!name)
7894
+ return $skip;
8207
7895
  }
8208
7896
  return {
8209
7897
  type: "Property",
@@ -10919,7 +10607,7 @@ ${input.slice(result.pos)}
10919
10607
  return result;
10920
10608
  }
10921
10609
  }
10922
- var CaseClause$0 = $TS($S(MatchingPattern, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
10610
+ var CaseClause$0 = $TS($S(BindingPattern, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
10923
10611
  var pattern = $1;
10924
10612
  var block = $2;
10925
10613
  return {
@@ -10929,10 +10617,23 @@ ${input.slice(result.pos)}
10929
10617
  pattern
10930
10618
  };
10931
10619
  });
10932
- var CaseClause$1 = $T($S(Case, CaseExpressionList, $C(NestedBlockStatements, EmptyBareBlock)), function(value) {
10620
+ var CaseClause$1 = $TS($S(SingleLineBinaryOpRHS, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
10621
+ var pattern = $1;
10622
+ var block = $2;
10623
+ return {
10624
+ type: "PatternClause",
10625
+ children: $0,
10626
+ block,
10627
+ pattern: {
10628
+ type: "ConditionFragment",
10629
+ children: pattern
10630
+ }
10631
+ };
10632
+ });
10633
+ var CaseClause$2 = $T($S(Case, CaseExpressionList, $C(NestedBlockStatements, EmptyBareBlock)), function(value) {
10933
10634
  return { "type": "CaseClause", "children": value };
10934
10635
  });
10935
- var CaseClause$2 = $TS($S(When, CaseExpressionList, InsertOpenBrace, $C(ThenClause, NestedBlockStatements, EmptyBareBlock), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
10636
+ var CaseClause$3 = $TS($S(When, CaseExpressionList, InsertOpenBrace, $C(ThenClause, NestedBlockStatements, EmptyBareBlock), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
10936
10637
  var cases = $2;
10937
10638
  var block = $4;
10938
10639
  var b = $5;
@@ -10944,7 +10645,7 @@ ${input.slice(result.pos)}
10944
10645
  children: $0
10945
10646
  };
10946
10647
  });
10947
- var CaseClause$3 = $TS($S(Default, ImpliedColon, $C(NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2, $3) {
10648
+ var CaseClause$4 = $TS($S(Default, ImpliedColon, $C(NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2, $3) {
10948
10649
  var block = $3;
10949
10650
  return {
10950
10651
  type: "DefaultClause",
@@ -10952,7 +10653,7 @@ ${input.slice(result.pos)}
10952
10653
  children: $0
10953
10654
  };
10954
10655
  });
10955
- var CaseClause$4 = $TS($S(Else, ImpliedColon, $C(ThenClause, BracedBlock, EmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
10656
+ var CaseClause$5 = $TS($S(Else, ImpliedColon, $C(ThenClause, BracedBlock, EmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
10956
10657
  var block = $3;
10957
10658
  $1.token = "default";
10958
10659
  return {
@@ -10972,12 +10673,12 @@ ${input.slice(result.pos)}
10972
10673
  }
10973
10674
  }
10974
10675
  if (state.tokenize) {
10975
- const result = $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state));
10676
+ const result = $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state) || CaseClause$5(state));
10976
10677
  if (state.events)
10977
10678
  state.events.exit?.("CaseClause", state, result, eventData);
10978
10679
  return result;
10979
10680
  } else {
10980
- const result = CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state);
10681
+ const result = CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state) || CaseClause$5(state);
10981
10682
  if (state.events)
10982
10683
  state.events.exit?.("CaseClause", state, result, eventData);
10983
10684
  return result;
@@ -11331,8 +11032,8 @@ ${input.slice(result.pos)}
11331
11032
  return result;
11332
11033
  }
11333
11034
  }
11334
- var ExpressionWithIndentedApplicationForbidden$0 = $TS($S(ForbidIndentedApplication, $E(ExtendedExpression), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
11335
- var exp = $2;
11035
+ var ExpressionWithIndentedApplicationForbidden$0 = $TS($S(ForbidIndentedApplication, ForbidNewlineBinaryOp, $E(ExtendedExpression), RestoreNewlineBinaryOp, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11036
+ var exp = $3;
11336
11037
  if (exp)
11337
11038
  return exp;
11338
11039
  return $skip;
@@ -11774,7 +11475,111 @@ ${input.slice(result.pos)}
11774
11475
  return result;
11775
11476
  }
11776
11477
  }
11777
- var AllowAll$0 = $S(AllowTrailingMemberProperty, AllowIndentedApplication, AllowMultiLineImplicitObjectLiteral, AllowClassImplicitCall);
11478
+ var AllowNewlineBinaryOp$0 = $TV($EXPECT($L0, fail, 'AllowNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
11479
+ module.forbidNewlineBinaryOp.push(false);
11480
+ });
11481
+ function AllowNewlineBinaryOp(state) {
11482
+ let eventData;
11483
+ if (state.events) {
11484
+ const result = state.events.enter?.("AllowNewlineBinaryOp", state);
11485
+ if (result) {
11486
+ if (result.cache)
11487
+ return result.cache;
11488
+ eventData = result.data;
11489
+ }
11490
+ }
11491
+ if (state.tokenize) {
11492
+ const result = $TOKEN("AllowNewlineBinaryOp", state, AllowNewlineBinaryOp$0(state));
11493
+ if (state.events)
11494
+ state.events.exit?.("AllowNewlineBinaryOp", state, result, eventData);
11495
+ return result;
11496
+ } else {
11497
+ const result = AllowNewlineBinaryOp$0(state);
11498
+ if (state.events)
11499
+ state.events.exit?.("AllowNewlineBinaryOp", state, result, eventData);
11500
+ return result;
11501
+ }
11502
+ }
11503
+ var ForbidNewlineBinaryOp$0 = $TV($EXPECT($L0, fail, 'ForbidNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
11504
+ module.forbidNewlineBinaryOp.push(true);
11505
+ });
11506
+ function ForbidNewlineBinaryOp(state) {
11507
+ let eventData;
11508
+ if (state.events) {
11509
+ const result = state.events.enter?.("ForbidNewlineBinaryOp", state);
11510
+ if (result) {
11511
+ if (result.cache)
11512
+ return result.cache;
11513
+ eventData = result.data;
11514
+ }
11515
+ }
11516
+ if (state.tokenize) {
11517
+ const result = $TOKEN("ForbidNewlineBinaryOp", state, ForbidNewlineBinaryOp$0(state));
11518
+ if (state.events)
11519
+ state.events.exit?.("ForbidNewlineBinaryOp", state, result, eventData);
11520
+ return result;
11521
+ } else {
11522
+ const result = ForbidNewlineBinaryOp$0(state);
11523
+ if (state.events)
11524
+ state.events.exit?.("ForbidNewlineBinaryOp", state, result, eventData);
11525
+ return result;
11526
+ }
11527
+ }
11528
+ var RestoreNewlineBinaryOp$0 = $TV($EXPECT($L0, fail, 'RestoreNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
11529
+ module.forbidNewlineBinaryOp.pop();
11530
+ });
11531
+ function RestoreNewlineBinaryOp(state) {
11532
+ let eventData;
11533
+ if (state.events) {
11534
+ const result = state.events.enter?.("RestoreNewlineBinaryOp", state);
11535
+ if (result) {
11536
+ if (result.cache)
11537
+ return result.cache;
11538
+ eventData = result.data;
11539
+ }
11540
+ }
11541
+ if (state.tokenize) {
11542
+ const result = $TOKEN("RestoreNewlineBinaryOp", state, RestoreNewlineBinaryOp$0(state));
11543
+ if (state.events)
11544
+ state.events.exit?.("RestoreNewlineBinaryOp", state, result, eventData);
11545
+ return result;
11546
+ } else {
11547
+ const result = RestoreNewlineBinaryOp$0(state);
11548
+ if (state.events)
11549
+ state.events.exit?.("RestoreNewlineBinaryOp", state, result, eventData);
11550
+ return result;
11551
+ }
11552
+ }
11553
+ var NewlineBinaryOpAllowed$0 = $TV($EXPECT($L0, fail, 'NewlineBinaryOpAllowed ""'), function($skip, $loc, $0, $1) {
11554
+ if (module.config.verbose) {
11555
+ console.log("forbidNewlineBinaryOp:", module.forbidNewlineBinaryOp);
11556
+ }
11557
+ if (module.newlineBinaryOpForbidden)
11558
+ return $skip;
11559
+ });
11560
+ function NewlineBinaryOpAllowed(state) {
11561
+ let eventData;
11562
+ if (state.events) {
11563
+ const result = state.events.enter?.("NewlineBinaryOpAllowed", state);
11564
+ if (result) {
11565
+ if (result.cache)
11566
+ return result.cache;
11567
+ eventData = result.data;
11568
+ }
11569
+ }
11570
+ if (state.tokenize) {
11571
+ const result = $TOKEN("NewlineBinaryOpAllowed", state, NewlineBinaryOpAllowed$0(state));
11572
+ if (state.events)
11573
+ state.events.exit?.("NewlineBinaryOpAllowed", state, result, eventData);
11574
+ return result;
11575
+ } else {
11576
+ const result = NewlineBinaryOpAllowed$0(state);
11577
+ if (state.events)
11578
+ state.events.exit?.("NewlineBinaryOpAllowed", state, result, eventData);
11579
+ return result;
11580
+ }
11581
+ }
11582
+ var AllowAll$0 = $S(AllowTrailingMemberProperty, AllowIndentedApplication, AllowMultiLineImplicitObjectLiteral, AllowClassImplicitCall, AllowNewlineBinaryOp);
11778
11583
  function AllowAll(state) {
11779
11584
  let eventData;
11780
11585
  if (state.events) {
@@ -11797,7 +11602,7 @@ ${input.slice(result.pos)}
11797
11602
  return result;
11798
11603
  }
11799
11604
  }
11800
- var RestoreAll$0 = $S(RestoreTrailingMemberProperty, RestoreIndentedApplication, RestoreMultiLineImplicitObjectLiteral, RestoreClassImplicitCall);
11605
+ var RestoreAll$0 = $S(RestoreTrailingMemberProperty, RestoreIndentedApplication, RestoreMultiLineImplicitObjectLiteral, RestoreClassImplicitCall, RestoreNewlineBinaryOp);
11801
11606
  function RestoreAll(state) {
11802
11607
  let eventData;
11803
11608
  if (state.events) {
@@ -12509,7 +12314,7 @@ ${input.slice(result.pos)}
12509
12314
  return result;
12510
12315
  }
12511
12316
  }
12512
- var ExportDeclaration$0 = $TS($S(Export, __, Default, __, $C(HoistableDeclaration, ClassDeclaration, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12317
+ var ExportDeclaration$0 = $TS($S($E(Decorators), Export, __, Default, __, $C(HoistableDeclaration, ClassDeclaration, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
12513
12318
  return { type: "ExportDeclaration", children: $0 };
12514
12319
  });
12515
12320
  var ExportDeclaration$1 = $TS($S(Export, __, ExportFromClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
@@ -17190,42 +16995,7 @@ ${input.slice(result.pos)}
17190
16995
  }
17191
16996
  }
17192
16997
  var JSXAttribute$0 = $TS($S(BracedObjectLiteral), function($skip, $loc, $0, $1) {
17193
- const { children } = $1;
17194
- const parts = [];
17195
- const rest = [];
17196
- for (let i = 1; i < children.length - 1; i++) {
17197
- if (i > 1)
17198
- parts.push(" ");
17199
- const part = children[i];
17200
- switch (part.type) {
17201
- case "Identifier":
17202
- parts.push([part.name, "={", part.name, "}"]);
17203
- break;
17204
- case "Property":
17205
- if (part.name.type === "ComputedPropertyName") {
17206
- rest.push(part);
17207
- } else {
17208
- parts.push([part.name, "={", insertTrimmingSpace(part.value, ""), "}"]);
17209
- }
17210
- break;
17211
- case "SpreadProperty":
17212
- parts.push(["{", part.dots, part.value, "}"]);
17213
- break;
17214
- case "MethodDefinition":
17215
- try {
17216
- parts.push([part.name, "={", module.convertMethodToFunction(part), "}"]);
17217
- } catch {
17218
- rest.push(part);
17219
- }
17220
- break;
17221
- default:
17222
- throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
17223
- }
17224
- }
17225
- if (rest.length) {
17226
- parts.push(["{...{", ...rest, "}}"]);
17227
- }
17228
- return parts;
16998
+ return convertObjectToJSXAttributes($1);
17229
16999
  });
17230
17000
  var JSXAttribute$1 = $TS($S(JSXAttributeName, $C(JSXAttributeInitializer, $Y(JSXAttributeSpace))), function($skip, $loc, $0, $1, $2) {
17231
17001
  var name = $1;
@@ -17245,16 +17015,73 @@ ${input.slice(result.pos)}
17245
17015
  }
17246
17016
  });
17247
17017
  var JSXAttribute$2 = $S(InsertInlineOpenBrace, DotDotDot, InlineJSXAttributeValue, InsertCloseBrace, $Y(JSXAttributeSpace));
17248
- var JSXAttribute$3 = $TS($S($EXPECT($L13, fail, 'JSXAttribute "#"'), JSXShorthandString), function($skip, $loc, $0, $1, $2) {
17018
+ var JSXAttribute$3 = $TS($S(AtThis, $E(Identifier), $Q(InlineJSXCallExpressionRest), $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3, $4) {
17019
+ var at = $1;
17020
+ var id = $2;
17021
+ var rest = $3;
17022
+ const access = id && {
17023
+ type: "PropertyAccess",
17024
+ children: [".", id],
17025
+ name: id
17026
+ };
17027
+ const expr = module.processCallMemberExpression({
17028
+ type: "CallExpression",
17029
+ children: [at, access, ...rest.flat()]
17030
+ });
17031
+ const last = lastAccessInCallExpression(expr);
17032
+ if (!last)
17033
+ return $skip;
17034
+ let name;
17035
+ if (last.type === "Index") {
17036
+ return [
17037
+ "{...{",
17038
+ { ...last, type: "ComputedPropertyName" },
17039
+ ": ",
17040
+ expr,
17041
+ "}}"
17042
+ ];
17043
+ } else if (last.name) {
17044
+ return [last.name, "={", expr, "}"];
17045
+ }
17046
+ return $skip;
17047
+ });
17048
+ var JSXAttribute$4 = $TS($S(Identifier, $P(InlineJSXCallExpressionRest), $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3) {
17049
+ var id = $1;
17050
+ var rest = $2;
17051
+ const expr = module.processCallMemberExpression({
17052
+ type: "CallExpression",
17053
+ children: [id, ...rest.flat()]
17054
+ });
17055
+ if (expr.type === "ObjectExpression") {
17056
+ return convertObjectToJSXAttributes(expr);
17057
+ }
17058
+ const last = lastAccessInCallExpression(expr);
17059
+ if (!last)
17060
+ return $skip;
17061
+ let name;
17062
+ if (last.type === "Index") {
17063
+ return [
17064
+ "{...{",
17065
+ { ...last, type: "ComputedPropertyName" },
17066
+ ": ",
17067
+ expr,
17068
+ "}}"
17069
+ ];
17070
+ } else if (last.name) {
17071
+ return [last.name, "={", expr, "}"];
17072
+ }
17073
+ return $skip;
17074
+ });
17075
+ var JSXAttribute$5 = $TS($S($EXPECT($L13, fail, 'JSXAttribute "#"'), JSXShorthandString), function($skip, $loc, $0, $1, $2) {
17249
17076
  return [" ", "id=", $2];
17250
17077
  });
17251
- var JSXAttribute$4 = $TS($S(Dot, JSXShorthandString), function($skip, $loc, $0, $1, $2) {
17078
+ var JSXAttribute$6 = $TS($S(Dot, JSXShorthandString), function($skip, $loc, $0, $1, $2) {
17252
17079
  return {
17253
17080
  type: "JSXClass",
17254
17081
  class: $2
17255
17082
  };
17256
17083
  });
17257
- var JSXAttribute$5 = $TS($S($TEXT($EXPECT($R6, fail, "JSXAttribute /[!+-]/")), JSXAttributeName), function($skip, $loc, $0, $1, $2) {
17084
+ var JSXAttribute$7 = $TS($S($TEXT($EXPECT($R6, fail, "JSXAttribute /[!+-]/")), JSXAttributeName, $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3) {
17258
17085
  var toggle = $1;
17259
17086
  var id = $2;
17260
17087
  const value = toggle === "+" ? "true" : "false";
@@ -17271,18 +17098,18 @@ ${input.slice(result.pos)}
17271
17098
  }
17272
17099
  }
17273
17100
  if (state.tokenize) {
17274
- const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state));
17101
+ const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state) || JSXAttribute$6(state) || JSXAttribute$7(state));
17275
17102
  if (state.events)
17276
17103
  state.events.exit?.("JSXAttribute", state, result, eventData);
17277
17104
  return result;
17278
17105
  } else {
17279
- const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state);
17106
+ const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state) || JSXAttribute$6(state) || JSXAttribute$7(state);
17280
17107
  if (state.events)
17281
17108
  state.events.exit?.("JSXAttribute", state, result, eventData);
17282
17109
  return result;
17283
17110
  }
17284
17111
  }
17285
- var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]/"));
17112
+ var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]|\\/>/"));
17286
17113
  function JSXAttributeSpace(state) {
17287
17114
  let eventData;
17288
17115
  if (state.events) {
@@ -17385,12 +17212,14 @@ ${input.slice(result.pos)}
17385
17212
  var JSXAttributeValue$0 = $S(OpenBrace, PostfixedExpression, $E(Whitespace), CloseBrace);
17386
17213
  var JSXAttributeValue$1 = JSXElement;
17387
17214
  var JSXAttributeValue$2 = JSXFragment;
17388
- var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
17215
+ var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace, $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3, $4) {
17216
+ var open = $1;
17389
17217
  var value = $2;
17218
+ var close = $3;
17390
17219
  if (value.type === "StringLiteral") {
17391
17220
  return $skip;
17392
17221
  }
17393
- return $0;
17222
+ return [open, value, close];
17394
17223
  });
17395
17224
  var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
17396
17225
  function JSXAttributeValue(state) {
@@ -17573,12 +17402,41 @@ ${input.slice(result.pos)}
17573
17402
  return result;
17574
17403
  }
17575
17404
  }
17576
- var InlineJSXCallExpression$0 = $S($EXPECT($L14, fail, 'InlineJSXCallExpression "super"'), ExplicitArguments);
17577
- var InlineJSXCallExpression$1 = $S($EXPECT($L15, fail, 'InlineJSXCallExpression "import"'), OpenParen, PostfixedExpression, __, CloseParen);
17405
+ var InlineJSXCallExpression$0 = $TS($S($EXPECT($L14, fail, 'InlineJSXCallExpression "super"'), ExplicitArguments, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
17406
+ var args = $2;
17407
+ var rest = $3;
17408
+ return module.processCallMemberExpression({
17409
+ type: "CallExpression",
17410
+ children: [
17411
+ $1,
17412
+ { type: "Call", children: args },
17413
+ ...rest.flat()
17414
+ ]
17415
+ });
17416
+ });
17417
+ var InlineJSXCallExpression$1 = $TS($S($EXPECT($L15, fail, 'InlineJSXCallExpression "import"'), ExplicitArguments, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
17418
+ var args = $2;
17419
+ var rest = $3;
17420
+ return module.processCallMemberExpression({
17421
+ type: "CallExpression",
17422
+ children: [
17423
+ $1,
17424
+ { type: "Call", children: args },
17425
+ ...rest.flat()
17426
+ ]
17427
+ });
17428
+ });
17578
17429
  var InlineJSXCallExpression$2 = $TS($S(InlineJSXMemberExpression, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2) {
17579
- if ($2.length)
17580
- return $0;
17581
- return $1;
17430
+ var member = $1;
17431
+ var rest = $2;
17432
+ if (rest.length) {
17433
+ rest = rest.flat();
17434
+ return module.processCallMemberExpression({
17435
+ type: "CallExpression",
17436
+ children: [member, ...rest]
17437
+ });
17438
+ }
17439
+ return member;
17582
17440
  });
17583
17441
  function InlineJSXCallExpression(state) {
17584
17442
  let eventData;
@@ -17602,9 +17460,20 @@ ${input.slice(result.pos)}
17602
17460
  return result;
17603
17461
  }
17604
17462
  }
17605
- var InlineJSXCallExpressionRest$0 = MemberExpressionRest;
17606
- var InlineJSXCallExpressionRest$1 = TemplateLiteral;
17607
- var InlineJSXCallExpressionRest$2 = $S($E($C(OptionalShorthand, NonNullAssertion)), ExplicitArguments);
17463
+ var InlineJSXCallExpressionRest$0 = InlineJSXMemberExpressionRest;
17464
+ var InlineJSXCallExpressionRest$1 = $TV($C(TemplateLiteral, StringLiteral), function($skip, $loc, $0, $1) {
17465
+ if ($1.type === "StringLiteral") {
17466
+ return "`" + $1.token.slice(1, -1).replace(/(`|\$\{)/g, "\\$1") + "`";
17467
+ }
17468
+ return $1;
17469
+ });
17470
+ var InlineJSXCallExpressionRest$2 = $TS($S($E($C(OptionalShorthand, NonNullAssertion)), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
17471
+ var args = $2;
17472
+ args = { type: "Call", children: args };
17473
+ if (!$1)
17474
+ return args;
17475
+ return [$1, args];
17476
+ });
17608
17477
  function InlineJSXCallExpressionRest(state) {
17609
17478
  let eventData;
17610
17479
  if (state.events) {
@@ -17627,13 +17496,16 @@ ${input.slice(result.pos)}
17627
17496
  return result;
17628
17497
  }
17629
17498
  }
17630
- var InlineJSXMemberExpression$0 = $TS($S(InlineJSXPrimaryExpression, $Q(InlineJSXMemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
17631
- if ($2.length)
17632
- return $0;
17499
+ var InlineJSXMemberExpression$0 = $TS($S($C(InlineJSXPrimaryExpression, SuperProperty, MetaProperty), $Q(InlineJSXMemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
17500
+ var rest = $2;
17501
+ if (rest.length || Array.isArray($1)) {
17502
+ return module.processCallMemberExpression({
17503
+ type: "MemberExpression",
17504
+ children: [$1, ...rest].flat()
17505
+ });
17506
+ }
17633
17507
  return $1;
17634
17508
  });
17635
- var InlineJSXMemberExpression$1 = SuperProperty;
17636
- var InlineJSXMemberExpression$2 = MetaProperty;
17637
17509
  function InlineJSXMemberExpression(state) {
17638
17510
  let eventData;
17639
17511
  if (state.events) {
@@ -17645,12 +17517,12 @@ ${input.slice(result.pos)}
17645
17517
  }
17646
17518
  }
17647
17519
  if (state.tokenize) {
17648
- const result = $TOKEN("InlineJSXMemberExpression", state, InlineJSXMemberExpression$0(state) || InlineJSXMemberExpression$1(state) || InlineJSXMemberExpression$2(state));
17520
+ const result = $TOKEN("InlineJSXMemberExpression", state, InlineJSXMemberExpression$0(state));
17649
17521
  if (state.events)
17650
17522
  state.events.exit?.("InlineJSXMemberExpression", state, result, eventData);
17651
17523
  return result;
17652
17524
  } else {
17653
- const result = InlineJSXMemberExpression$0(state) || InlineJSXMemberExpression$1(state) || InlineJSXMemberExpression$2(state);
17525
+ const result = InlineJSXMemberExpression$0(state);
17654
17526
  if (state.events)
17655
17527
  state.events.exit?.("InlineJSXMemberExpression", state, result, eventData);
17656
17528
  return result;
@@ -17666,7 +17538,9 @@ ${input.slice(result.pos)}
17666
17538
  return $2;
17667
17539
  });
17668
17540
  var InlineJSXMemberExpressionRest$1 = PropertyAccess;
17669
- var InlineJSXMemberExpressionRest$2 = NonNullAssertion;
17541
+ var InlineJSXMemberExpressionRest$2 = PropertyGlob;
17542
+ var InlineJSXMemberExpressionRest$3 = PropertyBind;
17543
+ var InlineJSXMemberExpressionRest$4 = NonNullAssertion;
17670
17544
  function InlineJSXMemberExpressionRest(state) {
17671
17545
  let eventData;
17672
17546
  if (state.events) {
@@ -17678,12 +17552,12 @@ ${input.slice(result.pos)}
17678
17552
  }
17679
17553
  }
17680
17554
  if (state.tokenize) {
17681
- const result = $TOKEN("InlineJSXMemberExpressionRest", state, InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state));
17555
+ const result = $TOKEN("InlineJSXMemberExpressionRest", state, InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state) || InlineJSXMemberExpressionRest$3(state) || InlineJSXMemberExpressionRest$4(state));
17682
17556
  if (state.events)
17683
17557
  state.events.exit?.("InlineJSXMemberExpressionRest", state, result, eventData);
17684
17558
  return result;
17685
17559
  } else {
17686
- const result = InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state);
17560
+ const result = InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state) || InlineJSXMemberExpressionRest$3(state) || InlineJSXMemberExpressionRest$4(state);
17687
17561
  if (state.events)
17688
17562
  state.events.exit?.("InlineJSXMemberExpressionRest", state, result, eventData);
17689
17563
  return result;
@@ -18396,9 +18270,9 @@ ${input.slice(result.pos)}
18396
18270
  }
18397
18271
  }
18398
18272
  var NestedInterfaceProperties$0 = $TS($S(PushIndent, $Q(NestedInterfaceProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18399
- var props2 = $2;
18400
- if (props2.length)
18401
- return props2;
18273
+ var props = $2;
18274
+ if (props.length)
18275
+ return props;
18402
18276
  return $skip;
18403
18277
  });
18404
18278
  function NestedInterfaceProperties(state) {
@@ -18779,23 +18653,23 @@ ${input.slice(result.pos)}
18779
18653
  }
18780
18654
  }
18781
18655
  var EnumBlock$0 = $TS($S(__, OpenBrace, NestedEnumProperties, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
18782
- var props2 = $3;
18656
+ var props = $3;
18783
18657
  return {
18784
- properties: props2.properties,
18658
+ properties: props.properties,
18785
18659
  children: $0
18786
18660
  };
18787
18661
  });
18788
18662
  var EnumBlock$1 = $TS($S(__, OpenBrace, $Q($S(__, EnumProperty)), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
18789
- var props2 = $3;
18663
+ var props = $3;
18790
18664
  return {
18791
- properties: props2.map((p) => p[1]),
18665
+ properties: props.map((p) => p[1]),
18792
18666
  children: $0
18793
18667
  };
18794
18668
  });
18795
18669
  var EnumBlock$2 = $TS($S(InsertOpenBrace, NestedEnumProperties, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
18796
- var props2 = $2;
18670
+ var props = $2;
18797
18671
  return {
18798
- properties: props2.properties,
18672
+ properties: props.properties,
18799
18673
  children: $0
18800
18674
  };
18801
18675
  });
@@ -18822,11 +18696,11 @@ ${input.slice(result.pos)}
18822
18696
  }
18823
18697
  }
18824
18698
  var NestedEnumProperties$0 = $TS($S(PushIndent, $Q(NestedEnumProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18825
- var props2 = $2;
18826
- if (!props2.length)
18699
+ var props = $2;
18700
+ if (!props.length)
18827
18701
  return $skip;
18828
18702
  return {
18829
- properties: props2.map((p) => p.property),
18703
+ properties: props.map((p) => p.property),
18830
18704
  children: $0
18831
18705
  };
18832
18706
  });
@@ -19801,7 +19675,7 @@ ${input.slice(result.pos)}
19801
19675
  return result;
19802
19676
  }
19803
19677
  }
19804
- var TypeParameter$0 = $S(__, Identifier, $E(TypeConstraint), $E(TypeInitializer), TypeParameterDelimiter);
19678
+ var TypeParameter$0 = $S(__, $E($S($EXPECT($L129, fail, 'TypeParameter "const"'), $E(_))), Identifier, $E(TypeConstraint), $E(TypeInitializer), TypeParameterDelimiter);
19805
19679
  function TypeParameter(state) {
19806
19680
  let eventData;
19807
19681
  if (state.events) {
@@ -20998,6 +20872,7 @@ ${input.slice(result.pos)}
20998
20872
  module.forbidIndentedApplication = [false];
20999
20873
  module.forbidTrailingMemberProperty = [false];
21000
20874
  module.forbidMultiLineImplicitObjectLiteral = [false];
20875
+ module.forbidNewlineBinaryOp = [false];
21001
20876
  module.JSXTagStack = [];
21002
20877
  module.operators = /* @__PURE__ */ new Set();
21003
20878
  if (!module._init) {
@@ -21033,6 +20908,12 @@ ${input.slice(result.pos)}
21033
20908
  return s[s.length - 1];
21034
20909
  }
21035
20910
  },
20911
+ newlineBinaryOpForbidden: {
20912
+ get() {
20913
+ const { forbidNewlineBinaryOp: s } = module;
20914
+ return s[s.length - 1];
20915
+ }
20916
+ },
21036
20917
  currentJSXTag: {
21037
20918
  get() {
21038
20919
  const { JSXTagStack: s } = module;
@@ -21300,14 +21181,14 @@ ${input.slice(result.pos)}
21300
21181
  Object.assign(module.config, directive.config);
21301
21182
  }
21302
21183
  });
21303
- module.processGlob = (node) => {
21184
+ module.processCallMemberExpression = (node) => {
21304
21185
  const { children } = node;
21305
21186
  for (let i = 0; i < children.length; i++) {
21306
21187
  const glob = children[i];
21307
21188
  if (glob?.type === "PropertyGlob") {
21308
- const prefix = children.slice(0, i).concat(glob.children[0]);
21189
+ const prefix = children.slice(0, i).concat(glob.dot);
21309
21190
  const parts = [];
21310
- for (const part of glob.object.content) {
21191
+ for (const part of glob.object.properties) {
21311
21192
  if (part.type === "MethodDefinition") {
21312
21193
  throw new Error("Glob pattern cannot have method definition");
21313
21194
  }
@@ -21330,7 +21211,7 @@ ${input.slice(result.pos)}
21330
21211
  });
21331
21212
  } else {
21332
21213
  parts.push({
21333
- type: part.type,
21214
+ type: part.type === "Identifier" ? "Property" : part.type,
21334
21215
  name: part.name,
21335
21216
  value,
21336
21217
  delim: part.delim,
@@ -21352,14 +21233,29 @@ ${input.slice(result.pos)}
21352
21233
  glob.object.children[0],
21353
21234
  ...parts,
21354
21235
  glob.object.children.at(-1)
21355
- ]
21236
+ ],
21237
+ properties: parts
21356
21238
  };
21357
21239
  if (i === children.length - 1)
21358
21240
  return object;
21359
- return module.processGlob({
21241
+ return module.processCallMemberExpression({
21360
21242
  ...node,
21361
21243
  children: [object, ...children.slice(i + 1)]
21362
21244
  });
21245
+ } else if (glob?.type === "PropertyBind") {
21246
+ const prefix = children.slice(0, i);
21247
+ return module.processCallMemberExpression({
21248
+ ...node,
21249
+ children: [
21250
+ prefix,
21251
+ {
21252
+ ...glob,
21253
+ type: "PropertyAccess",
21254
+ children: [...glob.children, ".bind(", prefix, ")"]
21255
+ },
21256
+ ...children.slice(i + 1)
21257
+ ]
21258
+ });
21363
21259
  }
21364
21260
  }
21365
21261
  return node;
@@ -21948,11 +21844,11 @@ ${input.slice(result.pos)}
21948
21844
  length
21949
21845
  };
21950
21846
  };
21951
- module.reorderBindingRestProperty = function(props2) {
21952
- const names = props2.flatMap((p) => p.names);
21847
+ module.reorderBindingRestProperty = function(props) {
21848
+ const names = props.flatMap((p) => p.names);
21953
21849
  let restIndex = -1;
21954
21850
  let restCount = 0;
21955
- props2.forEach(({ type }, i) => {
21851
+ props.forEach(({ type }, i) => {
21956
21852
  if (type === "BindingRestProperty") {
21957
21853
  if (restIndex < 0)
21958
21854
  restIndex = i;
@@ -21961,19 +21857,19 @@ ${input.slice(result.pos)}
21961
21857
  });
21962
21858
  if (restCount === 0) {
21963
21859
  return {
21964
- children: props2,
21860
+ children: props,
21965
21861
  names
21966
21862
  };
21967
21863
  } else if (restCount === 1) {
21968
- let after = props2.slice(restIndex + 1);
21969
- let rest = props2[restIndex];
21970
- props2 = props2.slice(0, restIndex);
21864
+ let after = props.slice(restIndex + 1);
21865
+ let rest = props[restIndex];
21866
+ props = props.slice(0, restIndex);
21971
21867
  if (after.length) {
21972
21868
  const [restDelim] = rest.children.slice(-1), lastAfterProp = after[after.length - 1], lastAfterChildren = lastAfterProp.children, [lastDelim] = lastAfterChildren.slice(-1);
21973
21869
  rest = { ...rest, children: [...rest.children.slice(0, -1), lastDelim] };
21974
21870
  after = [...after.slice(0, -1), { ...lastAfterProp, children: [...lastAfterChildren.slice(0, -1), restDelim] }];
21975
21871
  }
21976
- const children = [...props2, ...after, rest];
21872
+ const children = [...props, ...after, rest];
21977
21873
  return {
21978
21874
  children,
21979
21875
  names
@@ -21983,7 +21879,7 @@ ${input.slice(result.pos)}
21983
21879
  children: [{
21984
21880
  type: "Error",
21985
21881
  message: "Multiple rest properties in object pattern"
21986
- }, props2]
21882
+ }, props]
21987
21883
  };
21988
21884
  };
21989
21885
  function addParentPointers(node, parent) {
@@ -22057,7 +21953,7 @@ ${input.slice(result.pos)}
22057
21953
  gatherRecursiveAll(statements, (n) => n.type === "AtBindingProperty").forEach((binding) => {
22058
21954
  const { ref } = binding;
22059
21955
  if (asThis) {
22060
- const atBinding = binding.children[0];
21956
+ const atBinding = binding.binding;
22061
21957
  atBinding.children.pop();
22062
21958
  atBinding.type = void 0;
22063
21959
  binding.children.unshift(ref.id, ": this.", ref.base);
@@ -22303,34 +22199,11 @@ ${input.slice(result.pos)}
22303
22199
  throw new Error("Unknown postfix statement");
22304
22200
  }
22305
22201
  };
22306
- module.convertMethodToFunction = function(method) {
22307
- const { signature, block } = method;
22308
- let { modifier } = signature;
22309
- if (modifier) {
22310
- if (modifier.get || modifier.set) {
22311
- throw new Error("cannot convert get/set method to function");
22312
- } else if (modifier.async) {
22313
- modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
22314
- } else {
22315
- modifier = ["function ", ...modifier.children];
22316
- }
22317
- } else {
22318
- modifier = "function ";
22319
- }
22320
- return {
22321
- ...signature,
22322
- id: signature.name,
22323
- type: "FunctionExpression",
22324
- children: [
22325
- [modifier, ...signature.children.slice(1)],
22326
- block
22327
- ],
22328
- block
22329
- };
22330
- };
22331
22202
  function getPatternConditions(pattern, ref, conditions) {
22203
+ if (pattern.rest)
22204
+ return;
22332
22205
  switch (pattern.type) {
22333
- case "ArrayMatchingPattern": {
22206
+ case "ArrayBindingPattern": {
22334
22207
  const { elements, length } = pattern, hasRest = elements.some((e) => e.rest), comparator = hasRest ? " >= " : " === ", l = [comparator, (length - hasRest).toString()];
22335
22208
  conditions.push(
22336
22209
  ["Array.isArray(", ref, ")"],
@@ -22338,46 +22211,28 @@ ${input.slice(result.pos)}
22338
22211
  );
22339
22212
  elements.forEach(({ children: [, e] }, i) => {
22340
22213
  const subRef = [ref, "[", i.toString(), "]"];
22341
- switch (e.type) {
22342
- case "ArrayMatchingPattern":
22343
- case "ObjectMatchingPattern":
22344
- case "RegularExpressionLiteral":
22345
- getPatternConditions(e, subRef, conditions);
22346
- break;
22347
- case "BindingMatchElement":
22348
- getPatternConditions(e.match, subRef, conditions);
22349
- break;
22350
- }
22214
+ getPatternConditions(e, subRef, conditions);
22351
22215
  });
22352
22216
  const postRest = pattern.children.find((c) => c?.blockPrefix);
22353
22217
  if (postRest) {
22354
22218
  const postElements = postRest.blockPrefix.children[1], { length: postLength } = postElements;
22355
22219
  postElements.forEach(({ children: [, e] }, i) => {
22356
22220
  const subRef = [ref, "[", ref, ".length - ", (postLength + i).toString(), "]"];
22357
- switch (e.type) {
22358
- case "ArrayMatchingPattern":
22359
- case "ObjectMatchingPattern":
22360
- case "RegularExpressionLiteral":
22361
- case "Literal":
22362
- getPatternConditions(e, subRef, conditions);
22363
- break;
22364
- case "BindingMatchElement":
22365
- getPatternConditions(e.match, subRef, conditions);
22366
- break;
22367
- }
22221
+ getPatternConditions(e, subRef, conditions);
22368
22222
  });
22369
22223
  }
22370
22224
  break;
22371
22225
  }
22372
- case "ObjectMatchingPattern": {
22226
+ case "ObjectBindingPattern": {
22373
22227
  conditions.push(
22374
22228
  ["typeof ", ref, " === 'object'"],
22375
22229
  [ref, " != null"]
22376
22230
  );
22377
22231
  pattern.properties.forEach((p) => {
22378
22232
  switch (p.type) {
22379
- case "BindingMatchProperty": {
22380
- const { name, match } = p;
22233
+ case "PinProperty":
22234
+ case "BindingProperty": {
22235
+ const { name, value } = p;
22381
22236
  let subRef;
22382
22237
  switch (name.type) {
22383
22238
  case "ComputedPropertyName":
@@ -22394,16 +22249,20 @@ ${input.slice(result.pos)}
22394
22249
  conditions.push(["'", name, "' in ", ref]);
22395
22250
  subRef = [ref, ".", name];
22396
22251
  }
22397
- getPatternConditions(p.match, subRef, conditions);
22252
+ if (value) {
22253
+ getPatternConditions(value, subRef, conditions);
22254
+ }
22398
22255
  break;
22399
22256
  }
22400
- case "BindingProperty":
22401
- conditions.push(["'", p.identifier, "' in ", ref]);
22402
- break;
22403
22257
  }
22404
22258
  });
22405
22259
  break;
22406
22260
  }
22261
+ case "ConditionFragment":
22262
+ conditions.push(
22263
+ [ref, " ", pattern.children]
22264
+ );
22265
+ break;
22407
22266
  case "RegularExpressionLiteral": {
22408
22267
  conditions.push(
22409
22268
  ["typeof ", ref, " === 'string'"],
@@ -22411,13 +22270,22 @@ ${input.slice(result.pos)}
22411
22270
  );
22412
22271
  break;
22413
22272
  }
22414
- default: {
22273
+ case "PinPattern":
22274
+ conditions.push([
22275
+ ref,
22276
+ " === ",
22277
+ pattern.identifier
22278
+ ]);
22279
+ break;
22280
+ case "Literal":
22415
22281
  conditions.push([
22416
22282
  ref,
22417
22283
  " === ",
22418
22284
  pattern
22419
22285
  ]);
22420
- }
22286
+ break;
22287
+ default:
22288
+ break;
22421
22289
  }
22422
22290
  }
22423
22291
  function elideMatchersFromArrayBindings(elements) {
@@ -22426,6 +22294,7 @@ ${input.slice(result.pos)}
22426
22294
  case "Literal":
22427
22295
  case "RegularExpressionLiteral":
22428
22296
  case "StringLiteral":
22297
+ case "PinPattern":
22429
22298
  return sep;
22430
22299
  default:
22431
22300
  return [ws, nonMatcherBindings(e), sep];
@@ -22435,27 +22304,19 @@ ${input.slice(result.pos)}
22435
22304
  function elideMatchersFromPropertyBindings(properties) {
22436
22305
  return properties.map((p) => {
22437
22306
  switch (p.type) {
22438
- case "BindingMatchProperty": {
22439
- const { children, name, match } = p;
22440
- const [ws, , , , , , sep] = children;
22441
- switch (match.type) {
22442
- case "ArrayMatchingPattern":
22443
- case "ObjectMatchingPattern":
22307
+ case "BindingProperty": {
22308
+ const { children, name, value } = p;
22309
+ const [ws] = children;
22310
+ const sep = children[children.length - 1];
22311
+ switch (value && value.type) {
22312
+ case "ArrayBindingPattern":
22313
+ case "ObjectBindingPattern":
22444
22314
  return {
22445
22315
  ...p,
22446
- children: [ws, name, ": ", nonMatcherBindings(match)]
22316
+ children: [ws, name, ": ", nonMatcherBindings(value)]
22447
22317
  };
22448
22318
  case "Identifier":
22449
- switch (name.type) {
22450
- case "ComputedPropertyName":
22451
- case "Literal":
22452
- case "StringLiteral":
22453
- case "NumericLiteral":
22454
- return {
22455
- ...p,
22456
- children: [ws, name, ": ", match, sep]
22457
- };
22458
- }
22319
+ return p;
22459
22320
  case "Literal":
22460
22321
  case "RegularExpressionLiteral":
22461
22322
  case "StringLiteral":
@@ -22466,7 +22327,7 @@ ${input.slice(result.pos)}
22466
22327
  };
22467
22328
  }
22468
22329
  }
22469
- case "BindingProperty":
22330
+ case "PinProperty":
22470
22331
  case "BindingRestProperty":
22471
22332
  default:
22472
22333
  return p;
@@ -22475,7 +22336,7 @@ ${input.slice(result.pos)}
22475
22336
  }
22476
22337
  function nonMatcherBindings(pattern) {
22477
22338
  switch (pattern.type) {
22478
- case "ArrayMatchingPattern":
22339
+ case "ArrayBindingPattern":
22479
22340
  return ["[", elideMatchersFromArrayBindings(pattern.elements), "]"];
22480
22341
  case "PostRestBindingElements": {
22481
22342
  const els = elideMatchersFromArrayBindings(pattern.children[1]);
@@ -22488,19 +22349,19 @@ ${input.slice(result.pos)}
22488
22349
  ]
22489
22350
  };
22490
22351
  }
22491
- case "ObjectMatchingPattern":
22352
+ case "ObjectBindingPattern":
22492
22353
  return ["{", elideMatchersFromPropertyBindings(pattern.properties), "}"];
22493
22354
  default:
22494
22355
  return pattern;
22495
22356
  }
22496
22357
  }
22497
22358
  function aggregateDuplicateBindings(bindings) {
22498
- const props2 = gatherRecursiveAll(bindings, (n) => n.type === "BindingMatchProperty");
22359
+ const props = gatherRecursiveAll(bindings, (n) => n.type === "BindingProperty");
22499
22360
  const declarations = [];
22500
22361
  const propsGroupedByName = /* @__PURE__ */ new Map();
22501
- for (const p of props2) {
22502
- const { name } = p;
22503
- const key = name.name;
22362
+ for (const p of props) {
22363
+ const { name, value } = p;
22364
+ const key = value?.name || name.name;
22504
22365
  if (propsGroupedByName.has(key)) {
22505
22366
  propsGroupedByName.get(key).push(p);
22506
22367
  } else {
@@ -22588,10 +22449,10 @@ ${input.slice(result.pos)}
22588
22449
  };
22589
22450
  const prefix = [];
22590
22451
  switch (pattern.type) {
22591
- case "ArrayMatchingPattern":
22452
+ case "ArrayBindingPattern":
22592
22453
  if (pattern.length === 0)
22593
22454
  break;
22594
- case "ObjectMatchingPattern": {
22455
+ case "ObjectBindingPattern": {
22595
22456
  if (pattern.properties?.length === 0)
22596
22457
  break;
22597
22458
  let [splices, thisAssignments] = gatherBindingCode(pattern);
@@ -23300,6 +23161,8 @@ ${input.slice(result.pos)}
23300
23161
  var {
23301
23162
  blockWithPrefix,
23302
23163
  clone,
23164
+ convertMethodToFunction,
23165
+ convertObjectToJSXAttributes,
23303
23166
  deepCopy,
23304
23167
  findAncestor,
23305
23168
  forRange,
@@ -23315,6 +23178,7 @@ ${input.slice(result.pos)}
23315
23178
  hoistRefDecs,
23316
23179
  insertTrimmingSpace,
23317
23180
  isFunction,
23181
+ lastAccessInCallExpression,
23318
23182
  literalValue,
23319
23183
  modifyString,
23320
23184
  processCoffeeInterpolation,
@@ -23757,7 +23621,7 @@ var parse;
23757
23621
  var uncacheable;
23758
23622
  ({ parse } = import_parser.default);
23759
23623
  ({ SourceMap: SourceMap2 } = util_exports);
23760
- uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "Dedented", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedNonAssignmentExtendedExpression", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
23624
+ uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowNewlineBinaryOp", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "Dedented", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidNewlineBinaryOp", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedNonAssignmentExtendedExpression", "NestedObject", "NestedPropertyDefinitions", "NewlineBinaryOpAllowed", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RestoreNewlineBinaryOp", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineBinaryOpRHS", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
23761
23625
  var compile = function(src, options) {
23762
23626
  var ast, code, events, filename, ref, result, sm;
23763
23627
  if (!options) {