@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/browser.js CHANGED
@@ -386,6 +386,82 @@ var Civet = (() => {
386
386
  return '"' + str.replace(/"/g, '\\"') + '"';
387
387
  }
388
388
  }
389
+ function lastAccessInCallExpression(exp) {
390
+ let children, i;
391
+ do {
392
+ ({ children } = exp);
393
+ i = children.length - 1;
394
+ while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
395
+ i--;
396
+ if (i < 0)
397
+ return;
398
+ } while (children[i].type === "MemberExpression" && (exp = children[i]));
399
+ return children[i];
400
+ }
401
+ function convertMethodToFunction(method) {
402
+ const { signature, block } = method;
403
+ let { modifier } = signature;
404
+ if (modifier) {
405
+ if (modifier.get || modifier.set) {
406
+ return;
407
+ } else if (modifier.async) {
408
+ modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
409
+ } else {
410
+ modifier = ["function ", ...modifier.children];
411
+ }
412
+ } else {
413
+ modifier = "function ";
414
+ }
415
+ return {
416
+ ...signature,
417
+ id: signature.name,
418
+ type: "FunctionExpression",
419
+ children: [
420
+ [modifier, ...signature.children.slice(1)],
421
+ block
422
+ ],
423
+ block
424
+ };
425
+ }
426
+ function convertObjectToJSXAttributes(obj) {
427
+ const { properties } = obj;
428
+ const parts = [];
429
+ const rest = [];
430
+ for (let i = 0; i < properties.length; i++) {
431
+ if (i > 0)
432
+ parts.push(" ");
433
+ const part = properties[i];
434
+ switch (part.type) {
435
+ case "Identifier":
436
+ parts.push([part.name, "={", part.name, "}"]);
437
+ break;
438
+ case "Property":
439
+ if (part.name.type === "ComputedPropertyName") {
440
+ rest.push(part);
441
+ } else {
442
+ parts.push([part.name, "={", insertTrimmingSpace(part.value, ""), "}"]);
443
+ }
444
+ break;
445
+ case "SpreadProperty":
446
+ parts.push(["{", part.dots, part.value, "}"]);
447
+ break;
448
+ case "MethodDefinition":
449
+ const func = convertMethodToFunction(part);
450
+ if (func) {
451
+ parts.push([part.name, "={", convertMethodToFunction(part), "}"]);
452
+ } else {
453
+ rest.push(part);
454
+ }
455
+ break;
456
+ default:
457
+ throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
458
+ }
459
+ }
460
+ if (rest.length) {
461
+ parts.push(["{...{", ...rest, "}}"]);
462
+ }
463
+ return parts;
464
+ }
389
465
  function processCoffeeInterpolation(s, parts, e, $loc) {
390
466
  if (parts.length === 0 || parts.length === 1 && parts[0].token != null) {
391
467
  return {
@@ -534,6 +610,8 @@ var Civet = (() => {
534
610
  module.exports = {
535
611
  blockWithPrefix,
536
612
  clone,
613
+ convertMethodToFunction,
614
+ convertObjectToJSXAttributes,
537
615
  deepCopy,
538
616
  findAncestor,
539
617
  forRange,
@@ -549,6 +627,7 @@ var Civet = (() => {
549
627
  hoistRefDecs,
550
628
  insertTrimmingSpace,
551
629
  isFunction,
630
+ lastAccessInCallExpression,
552
631
  literalValue,
553
632
  modifyString,
554
633
  processCoffeeInterpolation,
@@ -990,6 +1069,7 @@ ${input.slice(result.pos)}
990
1069
  NonPipelineArgumentPart,
991
1070
  BinaryOpExpression,
992
1071
  BinaryOpRHS,
1072
+ SingleLineBinaryOpRHS,
993
1073
  RHS,
994
1074
  ParenthesizedAssignment,
995
1075
  UnaryExpression,
@@ -1052,6 +1132,7 @@ ${input.slice(result.pos)}
1052
1132
  SliceParameters,
1053
1133
  PropertyAccess,
1054
1134
  PropertyGlob,
1135
+ PropertyBind,
1055
1136
  SuperProperty,
1056
1137
  MetaProperty,
1057
1138
  ReturnValue,
@@ -1064,6 +1145,7 @@ ${input.slice(result.pos)}
1064
1145
  BindingIdentifier,
1065
1146
  NWBindingIdentifier,
1066
1147
  AtIdentifierRef,
1148
+ PinPattern,
1067
1149
  BindingPattern,
1068
1150
  ObjectBindingPattern,
1069
1151
  ObjectBindingPatternContent,
@@ -1082,21 +1164,6 @@ ${input.slice(result.pos)}
1082
1164
  BindingElement,
1083
1165
  BindingRestElement,
1084
1166
  EmptyBindingPattern,
1085
- MatchingPattern,
1086
- ObjectMatchingPattern,
1087
- ObjectMatchingPatternContent,
1088
- NestedMatchingProperties,
1089
- MatchingPropertyList,
1090
- NestedMatchingPropertyList,
1091
- MatchingProperty,
1092
- MatchingRestProperty,
1093
- ArrayMatchingPattern,
1094
- ArrayMatchingPatternContent,
1095
- NestedMatchingElements,
1096
- MatchingElementList,
1097
- NestedMatchingElementList,
1098
- MatchingElement,
1099
- MatchingRestElement,
1100
1167
  FunctionDeclaration,
1101
1168
  FunctionSignature,
1102
1169
  FunctionExpression,
@@ -1258,6 +1325,10 @@ ${input.slice(result.pos)}
1258
1325
  AllowMultiLineImplicitObjectLiteral,
1259
1326
  RestoreMultiLineImplicitObjectLiteral,
1260
1327
  MultiLineImplicitObjectLiteralAllowed,
1328
+ AllowNewlineBinaryOp,
1329
+ ForbidNewlineBinaryOp,
1330
+ RestoreNewlineBinaryOp,
1331
+ NewlineBinaryOpAllowed,
1261
1332
  AllowAll,
1262
1333
  RestoreAll,
1263
1334
  ExpressionStatement,
@@ -1839,7 +1910,7 @@ ${input.slice(result.pos)}
1839
1910
  var $R48 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
1840
1911
  var $R49 = $R(new RegExp("\\s", "suy"));
1841
1912
  var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
1842
- var $R51 = $R(new RegExp("[\\s>]", "suy"));
1913
+ var $R51 = $R(new RegExp("[\\s>]|\\/>", "suy"));
1843
1914
  var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
1844
1915
  var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
1845
1916
  var $R54 = $R(new RegExp("[<>]", "suy"));
@@ -2672,7 +2743,13 @@ ${input.slice(result.pos)}
2672
2743
  var rhs = $2;
2673
2744
  return [[], op, [], rhs];
2674
2745
  });
2675
- var BinaryOpRHS$1 = $S(NotDedented, BinaryOp, $C(_, $S(EOS, __)), RHS);
2746
+ var BinaryOpRHS$1 = $T($S(NewlineBinaryOpAllowed, $S(NotDedented, BinaryOp, $C(_, $S(EOS, __)), RHS)), function(value) {
2747
+ var rhs = value[1];
2748
+ return rhs;
2749
+ });
2750
+ var BinaryOpRHS$2 = $T($S($N(NewlineBinaryOpAllowed), SingleLineBinaryOpRHS), function(value) {
2751
+ return value[1];
2752
+ });
2676
2753
  function BinaryOpRHS(state) {
2677
2754
  let eventData;
2678
2755
  if (state.events) {
@@ -2684,17 +2761,46 @@ ${input.slice(result.pos)}
2684
2761
  }
2685
2762
  }
2686
2763
  if (state.tokenize) {
2687
- const result = $TOKEN("BinaryOpRHS", state, BinaryOpRHS$0(state) || BinaryOpRHS$1(state));
2764
+ const result = $TOKEN("BinaryOpRHS", state, BinaryOpRHS$0(state) || BinaryOpRHS$1(state) || BinaryOpRHS$2(state));
2688
2765
  if (state.events)
2689
2766
  state.events.exit?.("BinaryOpRHS", state, result, eventData);
2690
2767
  return result;
2691
2768
  } else {
2692
- const result = BinaryOpRHS$0(state) || BinaryOpRHS$1(state);
2769
+ const result = BinaryOpRHS$0(state) || BinaryOpRHS$1(state) || BinaryOpRHS$2(state);
2693
2770
  if (state.events)
2694
2771
  state.events.exit?.("BinaryOpRHS", state, result, eventData);
2695
2772
  return result;
2696
2773
  }
2697
2774
  }
2775
+ var SingleLineBinaryOpRHS$0 = $TS($S($E(_), BinaryOp, $C(_, $S(EOS, __)), RHS), function($skip, $loc, $0, $1, $2, $3, $4) {
2776
+ var ws1 = $1;
2777
+ var op = $2;
2778
+ var ws2 = $3;
2779
+ var rhs = $4;
2780
+ return [ws1 || [], op, ws2, rhs];
2781
+ });
2782
+ function SingleLineBinaryOpRHS(state) {
2783
+ let eventData;
2784
+ if (state.events) {
2785
+ const result = state.events.enter?.("SingleLineBinaryOpRHS", state);
2786
+ if (result) {
2787
+ if (result.cache)
2788
+ return result.cache;
2789
+ eventData = result.data;
2790
+ }
2791
+ }
2792
+ if (state.tokenize) {
2793
+ const result = $TOKEN("SingleLineBinaryOpRHS", state, SingleLineBinaryOpRHS$0(state));
2794
+ if (state.events)
2795
+ state.events.exit?.("SingleLineBinaryOpRHS", state, result, eventData);
2796
+ return result;
2797
+ } else {
2798
+ const result = SingleLineBinaryOpRHS$0(state);
2799
+ if (state.events)
2800
+ state.events.exit?.("SingleLineBinaryOpRHS", state, result, eventData);
2801
+ return result;
2802
+ }
2803
+ }
2698
2804
  var RHS$0 = ParenthesizedAssignment;
2699
2805
  var RHS$1 = UnaryExpression;
2700
2806
  var RHS$2 = ExpressionizedStatement;
@@ -4148,14 +4254,14 @@ ${input.slice(result.pos)}
4148
4254
  }
4149
4255
  var CallExpression$0 = $TS($S($EXPECT($L14, fail, 'CallExpression "super"'), ArgumentsWithTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
4150
4256
  var rest = $3;
4151
- return module.processGlob({
4257
+ return module.processCallMemberExpression({
4152
4258
  type: "CallExpression",
4153
4259
  children: [$1, ...$2, ...rest.flat()]
4154
4260
  });
4155
4261
  });
4156
4262
  var CallExpression$1 = $TS($S($EXPECT($L15, fail, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
4157
4263
  var rest = $3;
4158
- return module.processGlob({
4264
+ return module.processCallMemberExpression({
4159
4265
  type: "CallExpression",
4160
4266
  children: [$1, ...$2, ...rest.flat()]
4161
4267
  });
@@ -4166,7 +4272,7 @@ ${input.slice(result.pos)}
4166
4272
  var rest = $3;
4167
4273
  if (rest.length || trailing.length) {
4168
4274
  rest = rest.flat();
4169
- return module.processGlob({
4275
+ return module.processCallMemberExpression({
4170
4276
  type: "CallExpression",
4171
4277
  children: [member, ...trailing, ...rest]
4172
4278
  });
@@ -4309,7 +4415,7 @@ ${input.slice(result.pos)}
4309
4415
  var MemberExpression$0 = $TS($S($C(PrimaryExpression, SuperProperty, MetaProperty), $Q(MemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
4310
4416
  var rest = $2;
4311
4417
  if (rest.length || Array.isArray($1)) {
4312
- return module.processGlob({
4418
+ return module.processCallMemberExpression({
4313
4419
  type: "MemberExpression",
4314
4420
  children: [$1, ...rest].flat()
4315
4421
  });
@@ -4349,7 +4455,8 @@ ${input.slice(result.pos)}
4349
4455
  });
4350
4456
  var MemberExpressionRest$1 = PropertyAccess;
4351
4457
  var MemberExpressionRest$2 = PropertyGlob;
4352
- var MemberExpressionRest$3 = NonNullAssertion;
4458
+ var MemberExpressionRest$3 = PropertyBind;
4459
+ var MemberExpressionRest$4 = NonNullAssertion;
4353
4460
  function MemberExpressionRest(state) {
4354
4461
  let eventData;
4355
4462
  if (state.events) {
@@ -4361,12 +4468,12 @@ ${input.slice(result.pos)}
4361
4468
  }
4362
4469
  }
4363
4470
  if (state.tokenize) {
4364
- const result = $TOKEN("MemberExpressionRest", state, MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state));
4471
+ const result = $TOKEN("MemberExpressionRest", state, MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state) || MemberExpressionRest$4(state));
4365
4472
  if (state.events)
4366
4473
  state.events.exit?.("MemberExpressionRest", state, result, eventData);
4367
4474
  return result;
4368
4475
  } else {
4369
- const result = MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state);
4476
+ const result = MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state) || MemberExpressionRest$4(state);
4370
4477
  if (state.events)
4371
4478
  state.events.exit?.("MemberExpressionRest", state, result, eventData);
4372
4479
  return result;
@@ -4576,9 +4683,11 @@ ${input.slice(result.pos)}
4576
4683
  }
4577
4684
  }
4578
4685
  var PropertyGlob$0 = $TS($S(OptionalDot, BracedObjectLiteral), function($skip, $loc, $0, $1, $2) {
4686
+ var dot = $1;
4579
4687
  var object = $2;
4580
4688
  return {
4581
4689
  type: "PropertyGlob",
4690
+ dot,
4582
4691
  object,
4583
4692
  children: $0
4584
4693
  };
@@ -4605,6 +4714,38 @@ ${input.slice(result.pos)}
4605
4714
  return result;
4606
4715
  }
4607
4716
  }
4717
+ var PropertyBind$0 = $TS($S($E($C(QuestionMark, NonNullAssertion)), At, OptionalDot, $C(IdentifierName, PrivateIdentifier)), function($skip, $loc, $0, $1, $2, $3, $4) {
4718
+ var modifier = $1;
4719
+ var dot = $3;
4720
+ var id = $4;
4721
+ return {
4722
+ type: "PropertyBind",
4723
+ name: id.name,
4724
+ children: [modifier, dot, id]
4725
+ };
4726
+ });
4727
+ function PropertyBind(state) {
4728
+ let eventData;
4729
+ if (state.events) {
4730
+ const result = state.events.enter?.("PropertyBind", state);
4731
+ if (result) {
4732
+ if (result.cache)
4733
+ return result.cache;
4734
+ eventData = result.data;
4735
+ }
4736
+ }
4737
+ if (state.tokenize) {
4738
+ const result = $TOKEN("PropertyBind", state, PropertyBind$0(state));
4739
+ if (state.events)
4740
+ state.events.exit?.("PropertyBind", state, result, eventData);
4741
+ return result;
4742
+ } else {
4743
+ const result = PropertyBind$0(state);
4744
+ if (state.events)
4745
+ state.events.exit?.("PropertyBind", state, result, eventData);
4746
+ return result;
4747
+ }
4748
+ }
4608
4749
  var SuperProperty$0 = $S($EXPECT($L14, fail, 'SuperProperty "super"'), MemberBracketContent);
4609
4750
  var SuperProperty$1 = $S($EXPECT($L14, fail, 'SuperProperty "super"'), $N($C(QuestionMark, NonNullAssertion)), PropertyAccess);
4610
4751
  function SuperProperty(state) {
@@ -4997,20 +5138,41 @@ ${input.slice(result.pos)}
4997
5138
  return result;
4998
5139
  }
4999
5140
  }
5000
- var BindingPattern$0 = $TS($S(__, ObjectBindingPattern), function($skip, $loc, $0, $1, $2) {
5001
- var p = $2;
5002
- return {
5003
- children: [...$1, p],
5004
- names: p.names
5005
- };
5006
- });
5007
- var BindingPattern$1 = $TS($S(__, ArrayBindingPattern), function($skip, $loc, $0, $1, $2) {
5008
- var p = $2;
5141
+ var PinPattern$0 = $TS($S($EXPECT($L17, fail, 'PinPattern "^"'), Identifier), function($skip, $loc, $0, $1, $2) {
5142
+ var identifier = $2;
5009
5143
  return {
5010
- children: [...$1, p.children],
5011
- names: p.names
5144
+ type: "PinPattern",
5145
+ children: $0,
5146
+ identifier
5012
5147
  };
5013
5148
  });
5149
+ function PinPattern(state) {
5150
+ let eventData;
5151
+ if (state.events) {
5152
+ const result = state.events.enter?.("PinPattern", state);
5153
+ if (result) {
5154
+ if (result.cache)
5155
+ return result.cache;
5156
+ eventData = result.data;
5157
+ }
5158
+ }
5159
+ if (state.tokenize) {
5160
+ const result = $TOKEN("PinPattern", state, PinPattern$0(state));
5161
+ if (state.events)
5162
+ state.events.exit?.("PinPattern", state, result, eventData);
5163
+ return result;
5164
+ } else {
5165
+ const result = PinPattern$0(state);
5166
+ if (state.events)
5167
+ state.events.exit?.("PinPattern", state, result, eventData);
5168
+ return result;
5169
+ }
5170
+ }
5171
+ var BindingPattern$0 = ObjectBindingPattern;
5172
+ var BindingPattern$1 = ArrayBindingPattern;
5173
+ var BindingPattern$2 = PinPattern;
5174
+ var BindingPattern$3 = Literal;
5175
+ var BindingPattern$4 = RegularExpressionLiteral;
5014
5176
  function BindingPattern(state) {
5015
5177
  let eventData;
5016
5178
  if (state.events) {
@@ -5022,24 +5184,24 @@ ${input.slice(result.pos)}
5022
5184
  }
5023
5185
  }
5024
5186
  if (state.tokenize) {
5025
- const result = $TOKEN("BindingPattern", state, BindingPattern$0(state) || BindingPattern$1(state));
5187
+ const result = $TOKEN("BindingPattern", state, BindingPattern$0(state) || BindingPattern$1(state) || BindingPattern$2(state) || BindingPattern$3(state) || BindingPattern$4(state));
5026
5188
  if (state.events)
5027
5189
  state.events.exit?.("BindingPattern", state, result, eventData);
5028
5190
  return result;
5029
5191
  } else {
5030
- const result = BindingPattern$0(state) || BindingPattern$1(state);
5192
+ const result = BindingPattern$0(state) || BindingPattern$1(state) || BindingPattern$2(state) || BindingPattern$3(state) || BindingPattern$4(state);
5031
5193
  if (state.events)
5032
5194
  state.events.exit?.("BindingPattern", state, result, eventData);
5033
5195
  return result;
5034
5196
  }
5035
5197
  }
5036
- var ObjectBindingPattern$0 = $TS($S(OpenBrace, ObjectBindingPatternContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
5037
- var c = $2;
5198
+ var ObjectBindingPattern$0 = $TS($S($E(_), OpenBrace, ObjectBindingPatternContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5199
+ var c = $3;
5038
5200
  return {
5039
5201
  type: "ObjectBindingPattern",
5040
- children: [$1, ...c.children, $3, $4],
5041
- content: c.children,
5042
- names: c.names
5202
+ children: $0,
5203
+ names: c.names,
5204
+ properties: c.children
5043
5205
  };
5044
5206
  });
5045
5207
  function ObjectBindingPattern(state) {
@@ -5066,10 +5228,10 @@ ${input.slice(result.pos)}
5066
5228
  }
5067
5229
  var ObjectBindingPatternContent$0 = NestedBindingProperties;
5068
5230
  var ObjectBindingPatternContent$1 = $TV($E(BindingPropertyList), function($skip, $loc, $0, $1) {
5069
- var props2 = $0;
5070
- if (!props2)
5231
+ var props = $0;
5232
+ if (!props)
5071
5233
  return { children: [], names: [] };
5072
- return module.reorderBindingRestProperty(props2);
5234
+ return module.reorderBindingRestProperty(props);
5073
5235
  });
5074
5236
  function ObjectBindingPatternContent(state) {
5075
5237
  let eventData;
@@ -5094,8 +5256,8 @@ ${input.slice(result.pos)}
5094
5256
  }
5095
5257
  }
5096
5258
  var BindingPropertyList$0 = $TV($P($S(BindingProperty, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
5097
- var props2 = $0;
5098
- return props2.map(([prop, delim]) => {
5259
+ var props = $0;
5260
+ return props.map(([prop, delim]) => {
5099
5261
  return {
5100
5262
  ...prop,
5101
5263
  children: [...prop.children, delim]
@@ -5124,12 +5286,14 @@ ${input.slice(result.pos)}
5124
5286
  return result;
5125
5287
  }
5126
5288
  }
5127
- var ArrayBindingPattern$0 = $TS($S(OpenBracket, ArrayBindingPatternContent, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
5128
- var c = $2;
5289
+ var ArrayBindingPattern$0 = $TS($S($E(_), OpenBracket, ArrayBindingPatternContent, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5290
+ var c = $3;
5129
5291
  return {
5130
5292
  type: "ArrayBindingPattern",
5293
+ children: $0,
5131
5294
  names: c.names,
5132
- children: $0
5295
+ elements: c.children,
5296
+ length: c.length
5133
5297
  };
5134
5298
  });
5135
5299
  function ArrayBindingPattern(state) {
@@ -5158,7 +5322,7 @@ ${input.slice(result.pos)}
5158
5322
  var ArrayBindingPatternContent$1 = $TV($E(BindingElementList), function($skip, $loc, $0, $1) {
5159
5323
  var elements = $0;
5160
5324
  if (!elements)
5161
- return { children: [], names: [] };
5325
+ return { children: [], names: [], length: 0 };
5162
5326
  return module.adjustBindingElements(elements);
5163
5327
  });
5164
5328
  function ArrayBindingPatternContent(state) {
@@ -5272,10 +5436,10 @@ ${input.slice(result.pos)}
5272
5436
  }
5273
5437
  }
5274
5438
  var NestedBindingProperties$0 = $TS($S(PushIndent, $Q(NestedBindingPropertyList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
5275
- var props2 = $2;
5276
- if (!props2.length)
5439
+ var props = $2;
5440
+ if (!props.length)
5277
5441
  return $skip;
5278
- return module.reorderBindingRestProperty(props2.flat());
5442
+ return module.reorderBindingRestProperty(props.flat());
5279
5443
  });
5280
5444
  function NestedBindingProperties(state) {
5281
5445
  let eventData;
@@ -5301,8 +5465,8 @@ ${input.slice(result.pos)}
5301
5465
  }
5302
5466
  var NestedBindingPropertyList$0 = $TS($S(Nested, BindingPropertyList), function($skip, $loc, $0, $1, $2) {
5303
5467
  var ws = $1;
5304
- var props2 = $2;
5305
- return props2.map((prop, i) => {
5468
+ var props = $2;
5469
+ return props.map((prop, i) => {
5306
5470
  if (i > 0)
5307
5471
  return prop;
5308
5472
  return {
@@ -5334,35 +5498,53 @@ ${input.slice(result.pos)}
5334
5498
  }
5335
5499
  }
5336
5500
  var BindingProperty$0 = BindingRestProperty;
5337
- var BindingProperty$1 = $TS($S($E(_), PropertyName, $E(_), Colon, $C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
5501
+ 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) {
5338
5502
  var name = $2;
5339
- var b = $5;
5340
- var init = $6;
5503
+ var value = $6;
5504
+ var init = $7;
5341
5505
  return {
5506
+ type: "BindingProperty",
5507
+ children: $0,
5342
5508
  name,
5343
- value: b,
5509
+ value,
5344
5510
  init,
5345
- names: b.names,
5346
- children: $0
5511
+ names: value.names
5347
5512
  };
5348
5513
  });
5349
- var BindingProperty$2 = $TS($S(BindingIdentifier, $E(Initializer)), function($skip, $loc, $0, $1, $2) {
5350
- var b = $1;
5351
- var init = $2;
5352
- if (b.type === "AtBinding") {
5514
+ var BindingProperty$2 = $TS($S($E(_), $E($EXPECT($L17, fail, 'BindingProperty "^"')), BindingIdentifier, $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
5515
+ var ws = $1;
5516
+ var pin = $2;
5517
+ var binding = $3;
5518
+ var init = $4;
5519
+ if (binding.type === "AtBinding") {
5353
5520
  return {
5354
5521
  type: "AtBindingProperty",
5355
- ref: b.ref,
5522
+ children: $0,
5523
+ binding,
5524
+ ref: binding.ref,
5356
5525
  init,
5357
- names: [],
5358
- children: $0
5526
+ names: []
5527
+ };
5528
+ }
5529
+ if (pin) {
5530
+ return {
5531
+ type: "PinProperty",
5532
+ children: [ws, binding],
5533
+ name: binding,
5534
+ value: {
5535
+ type: "PinPattern",
5536
+ identifier: binding
5537
+ }
5359
5538
  };
5360
5539
  }
5361
5540
  return {
5362
- name: b,
5541
+ type: "BindingProperty",
5542
+ children: $0,
5543
+ name: binding,
5544
+ value: void 0,
5363
5545
  init,
5364
- names: b.names,
5365
- children: $0
5546
+ names: binding.names,
5547
+ identifier: binding
5366
5548
  };
5367
5549
  });
5368
5550
  function BindingProperty(state) {
@@ -5488,11 +5670,19 @@ ${input.slice(result.pos)}
5488
5670
  }
5489
5671
  }
5490
5672
  var BindingElement$0 = BindingRestElement;
5491
- var BindingElement$1 = $TS($S($C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2) {
5492
- var binding = $1;
5673
+ var BindingElement$1 = $TS($S($E(_), $C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
5674
+ var ws = $1;
5675
+ var binding = $2;
5676
+ var initializer = $3;
5677
+ if (binding.children) {
5678
+ binding = {
5679
+ ...binding,
5680
+ children: [...binding.children, initializer]
5681
+ };
5682
+ }
5493
5683
  return {
5494
5684
  names: binding.names,
5495
- children: $0
5685
+ children: [ws, binding]
5496
5686
  };
5497
5687
  });
5498
5688
  var BindingElement$2 = $TV($Y($S($E(_), $EXPECT($L21, fail, 'BindingElement ","'))), function($skip, $loc, $0, $1) {
@@ -5574,512 +5764,17 @@ ${input.slice(result.pos)}
5574
5764
  base: "ref",
5575
5765
  id: "ref"
5576
5766
  };
5577
- return {
5578
- type: "EmptyBinding",
5579
- children: [ref],
5580
- names: [],
5581
- ref
5582
- };
5583
- });
5584
- function EmptyBindingPattern(state) {
5585
- let eventData;
5586
- if (state.events) {
5587
- const result = state.events.enter?.("EmptyBindingPattern", state);
5588
- if (result) {
5589
- if (result.cache)
5590
- return result.cache;
5591
- eventData = result.data;
5592
- }
5593
- }
5594
- if (state.tokenize) {
5595
- const result = $TOKEN("EmptyBindingPattern", state, EmptyBindingPattern$0(state));
5596
- if (state.events)
5597
- state.events.exit?.("EmptyBindingPattern", state, result, eventData);
5598
- return result;
5599
- } else {
5600
- const result = EmptyBindingPattern$0(state);
5601
- if (state.events)
5602
- state.events.exit?.("EmptyBindingPattern", state, result, eventData);
5603
- return result;
5604
- }
5605
- }
5606
- var MatchingPattern$0 = ObjectMatchingPattern;
5607
- var MatchingPattern$1 = ArrayMatchingPattern;
5608
- var MatchingPattern$2 = Literal;
5609
- var MatchingPattern$3 = RegularExpressionLiteral;
5610
- function MatchingPattern(state) {
5611
- let eventData;
5612
- if (state.events) {
5613
- const result = state.events.enter?.("MatchingPattern", state);
5614
- if (result) {
5615
- if (result.cache)
5616
- return result.cache;
5617
- eventData = result.data;
5618
- }
5619
- }
5620
- if (state.tokenize) {
5621
- const result = $TOKEN("MatchingPattern", state, MatchingPattern$0(state) || MatchingPattern$1(state) || MatchingPattern$2(state) || MatchingPattern$3(state));
5622
- if (state.events)
5623
- state.events.exit?.("MatchingPattern", state, result, eventData);
5624
- return result;
5625
- } else {
5626
- const result = MatchingPattern$0(state) || MatchingPattern$1(state) || MatchingPattern$2(state) || MatchingPattern$3(state);
5627
- if (state.events)
5628
- state.events.exit?.("MatchingPattern", state, result, eventData);
5629
- return result;
5630
- }
5631
- }
5632
- var ObjectMatchingPattern$0 = $TS($S($E(_), OpenBrace, ObjectMatchingPatternContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5633
- var ws = $1;
5634
- var open = $2;
5635
- var properties = $3;
5636
- var ws = $4;
5637
- var close = $5;
5638
- return {
5639
- type: "ObjectMatchingPattern",
5640
- children: [ws, open, ...properties.children, ...ws, close],
5641
- properties: properties.children
5642
- };
5643
- });
5644
- function ObjectMatchingPattern(state) {
5645
- let eventData;
5646
- if (state.events) {
5647
- const result = state.events.enter?.("ObjectMatchingPattern", state);
5648
- if (result) {
5649
- if (result.cache)
5650
- return result.cache;
5651
- eventData = result.data;
5652
- }
5653
- }
5654
- if (state.tokenize) {
5655
- const result = $TOKEN("ObjectMatchingPattern", state, ObjectMatchingPattern$0(state));
5656
- if (state.events)
5657
- state.events.exit?.("ObjectMatchingPattern", state, result, eventData);
5658
- return result;
5659
- } else {
5660
- const result = ObjectMatchingPattern$0(state);
5661
- if (state.events)
5662
- state.events.exit?.("ObjectMatchingPattern", state, result, eventData);
5663
- return result;
5664
- }
5665
- }
5666
- var ObjectMatchingPatternContent$0 = NestedMatchingProperties;
5667
- var ObjectMatchingPatternContent$1 = $TV($E(MatchingPropertyList), function($skip, $loc, $0, $1) {
5668
- var properties = $0;
5669
- if (!properties)
5670
- return { children: [], names: [] };
5671
- return module.reorderBindingRestProperty(properties);
5672
- });
5673
- function ObjectMatchingPatternContent(state) {
5674
- let eventData;
5675
- if (state.events) {
5676
- const result = state.events.enter?.("ObjectMatchingPatternContent", state);
5677
- if (result) {
5678
- if (result.cache)
5679
- return result.cache;
5680
- eventData = result.data;
5681
- }
5682
- }
5683
- if (state.tokenize) {
5684
- const result = $TOKEN("ObjectMatchingPatternContent", state, ObjectMatchingPatternContent$0(state) || ObjectMatchingPatternContent$1(state));
5685
- if (state.events)
5686
- state.events.exit?.("ObjectMatchingPatternContent", state, result, eventData);
5687
- return result;
5688
- } else {
5689
- const result = ObjectMatchingPatternContent$0(state) || ObjectMatchingPatternContent$1(state);
5690
- if (state.events)
5691
- state.events.exit?.("ObjectMatchingPatternContent", state, result, eventData);
5692
- return result;
5693
- }
5694
- }
5695
- var NestedMatchingProperties$0 = $TS($S(PushIndent, $Q(NestedMatchingPropertyList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
5696
- var properties = $2;
5697
- if (!props.length)
5698
- return $skip;
5699
- return module.reorderBindingRestProperty(props.flat());
5700
- });
5701
- function NestedMatchingProperties(state) {
5702
- let eventData;
5703
- if (state.events) {
5704
- const result = state.events.enter?.("NestedMatchingProperties", state);
5705
- if (result) {
5706
- if (result.cache)
5707
- return result.cache;
5708
- eventData = result.data;
5709
- }
5710
- }
5711
- if (state.tokenize) {
5712
- const result = $TOKEN("NestedMatchingProperties", state, NestedMatchingProperties$0(state));
5713
- if (state.events)
5714
- state.events.exit?.("NestedMatchingProperties", state, result, eventData);
5715
- return result;
5716
- } else {
5717
- const result = NestedMatchingProperties$0(state);
5718
- if (state.events)
5719
- state.events.exit?.("NestedMatchingProperties", state, result, eventData);
5720
- return result;
5721
- }
5722
- }
5723
- var MatchingPropertyList$0 = $TV($P($S(MatchingProperty, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
5724
- var props2 = $0;
5725
- return props2.map(([prop, delim]) => {
5726
- return {
5727
- ...prop,
5728
- children: [...prop.children, delim]
5729
- };
5730
- });
5731
- });
5732
- function MatchingPropertyList(state) {
5733
- let eventData;
5734
- if (state.events) {
5735
- const result = state.events.enter?.("MatchingPropertyList", state);
5736
- if (result) {
5737
- if (result.cache)
5738
- return result.cache;
5739
- eventData = result.data;
5740
- }
5741
- }
5742
- if (state.tokenize) {
5743
- const result = $TOKEN("MatchingPropertyList", state, MatchingPropertyList$0(state));
5744
- if (state.events)
5745
- state.events.exit?.("MatchingPropertyList", state, result, eventData);
5746
- return result;
5747
- } else {
5748
- const result = MatchingPropertyList$0(state);
5749
- if (state.events)
5750
- state.events.exit?.("MatchingPropertyList", state, result, eventData);
5751
- return result;
5752
- }
5753
- }
5754
- var NestedMatchingPropertyList$0 = $TS($S(Nested, MatchingPropertyList), function($skip, $loc, $0, $1, $2) {
5755
- var ws = $1;
5756
- var props2 = $2;
5757
- return props2.map((prop, i) => {
5758
- if (i > 0)
5759
- return prop;
5760
- return {
5761
- ...prop,
5762
- children: [ws, ...prop.children]
5763
- };
5764
- });
5765
- });
5766
- function NestedMatchingPropertyList(state) {
5767
- let eventData;
5768
- if (state.events) {
5769
- const result = state.events.enter?.("NestedMatchingPropertyList", state);
5770
- if (result) {
5771
- if (result.cache)
5772
- return result.cache;
5773
- eventData = result.data;
5774
- }
5775
- }
5776
- if (state.tokenize) {
5777
- const result = $TOKEN("NestedMatchingPropertyList", state, NestedMatchingPropertyList$0(state));
5778
- if (state.events)
5779
- state.events.exit?.("NestedMatchingPropertyList", state, result, eventData);
5780
- return result;
5781
- } else {
5782
- const result = NestedMatchingPropertyList$0(state);
5783
- if (state.events)
5784
- state.events.exit?.("NestedMatchingPropertyList", state, result, eventData);
5785
- return result;
5786
- }
5787
- }
5788
- var MatchingProperty$0 = MatchingRestProperty;
5789
- var MatchingProperty$1 = $TS($S($E(_), PropertyName, $E(_), Colon, $E(_), $C(BindingIdentifier, MatchingPattern)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
5790
- var name = $2;
5791
- var match = $6;
5792
- return {
5793
- type: "BindingMatchProperty",
5794
- name,
5795
- match,
5796
- children: $0
5797
- };
5798
- });
5799
- var MatchingProperty$2 = $TS($S($E(_), BindingIdentifier), function($skip, $loc, $0, $1, $2) {
5800
- var ws = $1;
5801
- var b = $2;
5802
- if (b.type === "AtBinding") {
5803
- return {
5804
- type: "AtBindingProperty",
5805
- ref: b.ref,
5806
- names: [],
5807
- children: [ws, b]
5808
- };
5809
- }
5810
- return {
5811
- type: "BindingProperty",
5812
- names: b.names,
5813
- children: [ws, b],
5814
- identifier: b
5815
- };
5816
- });
5817
- function MatchingProperty(state) {
5818
- let eventData;
5819
- if (state.events) {
5820
- const result = state.events.enter?.("MatchingProperty", state);
5821
- if (result) {
5822
- if (result.cache)
5823
- return result.cache;
5824
- eventData = result.data;
5825
- }
5826
- }
5827
- if (state.tokenize) {
5828
- const result = $TOKEN("MatchingProperty", state, MatchingProperty$0(state) || MatchingProperty$1(state) || MatchingProperty$2(state));
5829
- if (state.events)
5830
- state.events.exit?.("MatchingProperty", state, result, eventData);
5831
- return result;
5832
- } else {
5833
- const result = MatchingProperty$0(state) || MatchingProperty$1(state) || MatchingProperty$2(state);
5834
- if (state.events)
5835
- state.events.exit?.("MatchingProperty", state, result, eventData);
5836
- return result;
5837
- }
5838
- }
5839
- var MatchingRestProperty$0 = BindingRestProperty;
5840
- function MatchingRestProperty(state) {
5841
- let eventData;
5842
- if (state.events) {
5843
- const result = state.events.enter?.("MatchingRestProperty", state);
5844
- if (result) {
5845
- if (result.cache)
5846
- return result.cache;
5847
- eventData = result.data;
5848
- }
5849
- }
5850
- if (state.tokenize) {
5851
- const result = $TOKEN("MatchingRestProperty", state, MatchingRestProperty$0(state));
5852
- if (state.events)
5853
- state.events.exit?.("MatchingRestProperty", state, result, eventData);
5854
- return result;
5855
- } else {
5856
- const result = MatchingRestProperty$0(state);
5857
- if (state.events)
5858
- state.events.exit?.("MatchingRestProperty", state, result, eventData);
5859
- return result;
5860
- }
5861
- }
5862
- var ArrayMatchingPattern$0 = $TS($S($E(_), OpenBracket, ArrayMatchingPatternContent, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5863
- var ws = $1;
5864
- var elements = $3;
5865
- return {
5866
- type: "ArrayMatchingPattern",
5867
- children: $0,
5868
- elements: elements.children,
5869
- length: elements.length
5870
- };
5871
- });
5872
- function ArrayMatchingPattern(state) {
5873
- let eventData;
5874
- if (state.events) {
5875
- const result = state.events.enter?.("ArrayMatchingPattern", state);
5876
- if (result) {
5877
- if (result.cache)
5878
- return result.cache;
5879
- eventData = result.data;
5880
- }
5881
- }
5882
- if (state.tokenize) {
5883
- const result = $TOKEN("ArrayMatchingPattern", state, ArrayMatchingPattern$0(state));
5884
- if (state.events)
5885
- state.events.exit?.("ArrayMatchingPattern", state, result, eventData);
5886
- return result;
5887
- } else {
5888
- const result = ArrayMatchingPattern$0(state);
5889
- if (state.events)
5890
- state.events.exit?.("ArrayMatchingPattern", state, result, eventData);
5891
- return result;
5892
- }
5893
- }
5894
- var ArrayMatchingPatternContent$0 = NestedMatchingElements;
5895
- var ArrayMatchingPatternContent$1 = $TV($E(MatchingElementList), function($skip, $loc, $0, $1) {
5896
- var elements = $0;
5897
- if (!elements)
5898
- return { children: [], names: [], length: 0 };
5899
- return module.adjustBindingElements(elements);
5900
- });
5901
- function ArrayMatchingPatternContent(state) {
5902
- let eventData;
5903
- if (state.events) {
5904
- const result = state.events.enter?.("ArrayMatchingPatternContent", state);
5905
- if (result) {
5906
- if (result.cache)
5907
- return result.cache;
5908
- eventData = result.data;
5909
- }
5910
- }
5911
- if (state.tokenize) {
5912
- const result = $TOKEN("ArrayMatchingPatternContent", state, ArrayMatchingPatternContent$0(state) || ArrayMatchingPatternContent$1(state));
5913
- if (state.events)
5914
- state.events.exit?.("ArrayMatchingPatternContent", state, result, eventData);
5915
- return result;
5916
- } else {
5917
- const result = ArrayMatchingPatternContent$0(state) || ArrayMatchingPatternContent$1(state);
5918
- if (state.events)
5919
- state.events.exit?.("ArrayMatchingPatternContent", state, result, eventData);
5920
- return result;
5921
- }
5922
- }
5923
- var NestedMatchingElements$0 = $TS($S(PushIndent, $Q(NestedMatchingElementList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
5924
- var elements = $2;
5925
- return module.adjustBindingElements(elements.flat());
5926
- });
5927
- function NestedMatchingElements(state) {
5928
- let eventData;
5929
- if (state.events) {
5930
- const result = state.events.enter?.("NestedMatchingElements", state);
5931
- if (result) {
5932
- if (result.cache)
5933
- return result.cache;
5934
- eventData = result.data;
5935
- }
5936
- }
5937
- if (state.tokenize) {
5938
- const result = $TOKEN("NestedMatchingElements", state, NestedMatchingElements$0(state));
5939
- if (state.events)
5940
- state.events.exit?.("NestedMatchingElements", state, result, eventData);
5941
- return result;
5942
- } else {
5943
- const result = NestedMatchingElements$0(state);
5944
- if (state.events)
5945
- state.events.exit?.("NestedMatchingElements", state, result, eventData);
5946
- return result;
5947
- }
5948
- }
5949
- var MatchingElementList$0 = $TV($P($S(MatchingElement, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
5950
- var elements = $0;
5951
- return elements.map(([element, delim]) => {
5952
- return {
5953
- ...element,
5954
- children: [...element.children, delim]
5955
- };
5956
- });
5957
- });
5958
- function MatchingElementList(state) {
5959
- let eventData;
5960
- if (state.events) {
5961
- const result = state.events.enter?.("MatchingElementList", state);
5962
- if (result) {
5963
- if (result.cache)
5964
- return result.cache;
5965
- eventData = result.data;
5966
- }
5967
- }
5968
- if (state.tokenize) {
5969
- const result = $TOKEN("MatchingElementList", state, MatchingElementList$0(state));
5970
- if (state.events)
5971
- state.events.exit?.("MatchingElementList", state, result, eventData);
5972
- return result;
5973
- } else {
5974
- const result = MatchingElementList$0(state);
5975
- if (state.events)
5976
- state.events.exit?.("MatchingElementList", state, result, eventData);
5977
- return result;
5978
- }
5979
- }
5980
- var NestedMatchingElementList$0 = $TS($S(Nested, MatchingElementList), function($skip, $loc, $0, $1, $2) {
5981
- var ws = $1;
5982
- var elements = $2;
5983
- return elements.map((element, i) => {
5984
- if (i > 0)
5985
- return element;
5986
- return {
5987
- ...element,
5988
- children: [ws, ...element.children]
5989
- };
5990
- });
5991
- });
5992
- function NestedMatchingElementList(state) {
5993
- let eventData;
5994
- if (state.events) {
5995
- const result = state.events.enter?.("NestedMatchingElementList", state);
5996
- if (result) {
5997
- if (result.cache)
5998
- return result.cache;
5999
- eventData = result.data;
6000
- }
6001
- }
6002
- if (state.tokenize) {
6003
- const result = $TOKEN("NestedMatchingElementList", state, NestedMatchingElementList$0(state));
6004
- if (state.events)
6005
- state.events.exit?.("NestedMatchingElementList", state, result, eventData);
6006
- return result;
6007
- } else {
6008
- const result = NestedMatchingElementList$0(state);
6009
- if (state.events)
6010
- state.events.exit?.("NestedMatchingElementList", state, result, eventData);
6011
- return result;
6012
- }
6013
- }
6014
- var MatchingElement$0 = MatchingRestElement;
6015
- var MatchingElement$1 = $TS($S($E(_), BindingIdentifier, $E(_), Colon, $E(_), $C(BindingIdentifier, MatchingPattern)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6016
- var ws = $1;
6017
- var name = $2;
6018
- var match = $6;
6019
- let blockPrefix;
6020
- switch (match.type) {
6021
- case "ArrayMatchingPattern":
6022
- case "ObjectMatchingPattern":
6023
- blockPrefix = [match, " = ", name];
6024
- break;
6025
- default:
6026
- break;
6027
- }
6028
- return {
6029
- names: name.names,
6030
- children: [ws, {
6031
- type: "BindingMatchElement",
6032
- name,
6033
- match,
6034
- children: [name],
6035
- blockPrefix
6036
- }]
6037
- };
6038
- });
6039
- var MatchingElement$2 = $TS($S($E(_), $C(BindingIdentifier, MatchingPattern)), function($skip, $loc, $0, $1, $2) {
6040
- var ws = $1;
6041
- var binding = $2;
6042
- return {
6043
- names: binding.names,
6044
- children: [ws, binding]
6045
- };
6046
- });
6047
- var MatchingElement$3 = $TV($Y($S($E(_), $EXPECT($L21, fail, 'MatchingElement ","'))), function($skip, $loc, $0, $1) {
6048
- return {
6049
- children: [{
6050
- type: "ElisionElement",
6051
- children: [""]
6052
- }],
6053
- names: []
6054
- };
6055
- });
6056
- function MatchingElement(state) {
6057
- let eventData;
6058
- if (state.events) {
6059
- const result = state.events.enter?.("MatchingElement", state);
6060
- if (result) {
6061
- if (result.cache)
6062
- return result.cache;
6063
- eventData = result.data;
6064
- }
6065
- }
6066
- if (state.tokenize) {
6067
- const result = $TOKEN("MatchingElement", state, MatchingElement$0(state) || MatchingElement$1(state) || MatchingElement$2(state) || MatchingElement$3(state));
6068
- if (state.events)
6069
- state.events.exit?.("MatchingElement", state, result, eventData);
6070
- return result;
6071
- } else {
6072
- const result = MatchingElement$0(state) || MatchingElement$1(state) || MatchingElement$2(state) || MatchingElement$3(state);
6073
- if (state.events)
6074
- state.events.exit?.("MatchingElement", state, result, eventData);
6075
- return result;
6076
- }
6077
- }
6078
- var MatchingRestElement$0 = BindingRestElement;
6079
- function MatchingRestElement(state) {
5767
+ return {
5768
+ type: "EmptyBinding",
5769
+ children: [ref],
5770
+ names: [],
5771
+ ref
5772
+ };
5773
+ });
5774
+ function EmptyBindingPattern(state) {
6080
5775
  let eventData;
6081
5776
  if (state.events) {
6082
- const result = state.events.enter?.("MatchingRestElement", state);
5777
+ const result = state.events.enter?.("EmptyBindingPattern", state);
6083
5778
  if (result) {
6084
5779
  if (result.cache)
6085
5780
  return result.cache;
@@ -6087,14 +5782,14 @@ ${input.slice(result.pos)}
6087
5782
  }
6088
5783
  }
6089
5784
  if (state.tokenize) {
6090
- const result = $TOKEN("MatchingRestElement", state, MatchingRestElement$0(state));
5785
+ const result = $TOKEN("EmptyBindingPattern", state, EmptyBindingPattern$0(state));
6091
5786
  if (state.events)
6092
- state.events.exit?.("MatchingRestElement", state, result, eventData);
5787
+ state.events.exit?.("EmptyBindingPattern", state, result, eventData);
6093
5788
  return result;
6094
5789
  } else {
6095
- const result = MatchingRestElement$0(state);
5790
+ const result = EmptyBindingPattern$0(state);
6096
5791
  if (state.events)
6097
- state.events.exit?.("MatchingRestElement", state, result, eventData);
5792
+ state.events.exit?.("EmptyBindingPattern", state, result, eventData);
6098
5793
  return result;
6099
5794
  }
6100
5795
  }
@@ -7799,16 +7494,16 @@ ${input.slice(result.pos)}
7799
7494
  var open = $1;
7800
7495
  if (!$3)
7801
7496
  return $skip;
7802
- const [content, ...close] = $3;
7803
- if (content) {
7804
- const children = [open, ...content, close];
7497
+ const [properties, ...close] = $3;
7498
+ if (properties) {
7499
+ const children = [open, ...properties, close];
7805
7500
  return {
7806
7501
  type: "ObjectExpression",
7807
- content,
7808
7502
  children,
7809
7503
  names: children.flatMap((c) => {
7810
7504
  return c.names || [];
7811
- })
7505
+ }),
7506
+ properties
7812
7507
  };
7813
7508
  }
7814
7509
  return {
@@ -8125,11 +7820,11 @@ ${input.slice(result.pos)}
8125
7820
  return result;
8126
7821
  }
8127
7822
  }
8128
- var PropertyDefinition$0 = $TS($S(__, At, IdentifierReference), function($skip, $loc, $0, $1, $2, $3) {
7823
+ var PropertyDefinition$0 = $TS($S(__, AtThis, IdentifierReference), function($skip, $loc, $0, $1, $2, $3) {
8129
7824
  var ws = $1;
8130
7825
  var at = $2;
8131
7826
  var id = $3;
8132
- const value = [{ ...at, token: "this." }, id];
7827
+ const value = [at, ".", id];
8133
7828
  return {
8134
7829
  type: "Property",
8135
7830
  children: [ws, id, ": ", ...value],
@@ -8187,26 +7882,19 @@ ${input.slice(result.pos)}
8187
7882
  if (value.type === "Identifier") {
8188
7883
  return { ...value, children: [ws, ...value.children] };
8189
7884
  }
8190
- let exp = value, children, i;
8191
- do {
8192
- ({ children } = exp);
8193
- i = children.length - 1;
8194
- while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
8195
- i--;
8196
- if (i < 0)
8197
- return $skip;
8198
- } while (children[i].type === "MemberExpression" && (exp = children[i]));
8199
- const last = children[i];
7885
+ const last = lastAccessInCallExpression(value);
7886
+ if (!last)
7887
+ return $skip;
8200
7888
  let name;
8201
- if (last.name) {
8202
- ({ name } = last);
8203
- } else if (last.type === "Index") {
7889
+ if (last.type === "Index") {
8204
7890
  name = {
8205
7891
  type: "ComputedPropertyName",
8206
7892
  children: last.children
8207
7893
  };
8208
7894
  } else {
8209
- return $skip;
7895
+ ({ name } = last);
7896
+ if (!name)
7897
+ return $skip;
8210
7898
  }
8211
7899
  return {
8212
7900
  type: "Property",
@@ -10922,7 +10610,7 @@ ${input.slice(result.pos)}
10922
10610
  return result;
10923
10611
  }
10924
10612
  }
10925
- var CaseClause$0 = $TS($S(MatchingPattern, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
10613
+ var CaseClause$0 = $TS($S(BindingPattern, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
10926
10614
  var pattern = $1;
10927
10615
  var block = $2;
10928
10616
  return {
@@ -10932,10 +10620,23 @@ ${input.slice(result.pos)}
10932
10620
  pattern
10933
10621
  };
10934
10622
  });
10935
- var CaseClause$1 = $T($S(Case, CaseExpressionList, $C(NestedBlockStatements, EmptyBareBlock)), function(value) {
10623
+ var CaseClause$1 = $TS($S(SingleLineBinaryOpRHS, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
10624
+ var pattern = $1;
10625
+ var block = $2;
10626
+ return {
10627
+ type: "PatternClause",
10628
+ children: $0,
10629
+ block,
10630
+ pattern: {
10631
+ type: "ConditionFragment",
10632
+ children: pattern
10633
+ }
10634
+ };
10635
+ });
10636
+ var CaseClause$2 = $T($S(Case, CaseExpressionList, $C(NestedBlockStatements, EmptyBareBlock)), function(value) {
10936
10637
  return { "type": "CaseClause", "children": value };
10937
10638
  });
10938
- 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) {
10639
+ 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) {
10939
10640
  var cases = $2;
10940
10641
  var block = $4;
10941
10642
  var b = $5;
@@ -10947,7 +10648,7 @@ ${input.slice(result.pos)}
10947
10648
  children: $0
10948
10649
  };
10949
10650
  });
10950
- var CaseClause$3 = $TS($S(Default, ImpliedColon, $C(NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2, $3) {
10651
+ var CaseClause$4 = $TS($S(Default, ImpliedColon, $C(NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2, $3) {
10951
10652
  var block = $3;
10952
10653
  return {
10953
10654
  type: "DefaultClause",
@@ -10955,7 +10656,7 @@ ${input.slice(result.pos)}
10955
10656
  children: $0
10956
10657
  };
10957
10658
  });
10958
- var CaseClause$4 = $TS($S(Else, ImpliedColon, $C(ThenClause, BracedBlock, EmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
10659
+ var CaseClause$5 = $TS($S(Else, ImpliedColon, $C(ThenClause, BracedBlock, EmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
10959
10660
  var block = $3;
10960
10661
  $1.token = "default";
10961
10662
  return {
@@ -10975,12 +10676,12 @@ ${input.slice(result.pos)}
10975
10676
  }
10976
10677
  }
10977
10678
  if (state.tokenize) {
10978
- const result = $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state));
10679
+ const result = $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state) || CaseClause$5(state));
10979
10680
  if (state.events)
10980
10681
  state.events.exit?.("CaseClause", state, result, eventData);
10981
10682
  return result;
10982
10683
  } else {
10983
- const result = CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state);
10684
+ const result = CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state) || CaseClause$3(state) || CaseClause$4(state) || CaseClause$5(state);
10984
10685
  if (state.events)
10985
10686
  state.events.exit?.("CaseClause", state, result, eventData);
10986
10687
  return result;
@@ -11334,8 +11035,8 @@ ${input.slice(result.pos)}
11334
11035
  return result;
11335
11036
  }
11336
11037
  }
11337
- var ExpressionWithIndentedApplicationForbidden$0 = $TS($S(ForbidIndentedApplication, $E(ExtendedExpression), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
11338
- var exp = $2;
11038
+ var ExpressionWithIndentedApplicationForbidden$0 = $TS($S(ForbidIndentedApplication, ForbidNewlineBinaryOp, $E(ExtendedExpression), RestoreNewlineBinaryOp, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11039
+ var exp = $3;
11339
11040
  if (exp)
11340
11041
  return exp;
11341
11042
  return $skip;
@@ -11777,7 +11478,111 @@ ${input.slice(result.pos)}
11777
11478
  return result;
11778
11479
  }
11779
11480
  }
11780
- var AllowAll$0 = $S(AllowTrailingMemberProperty, AllowIndentedApplication, AllowMultiLineImplicitObjectLiteral, AllowClassImplicitCall);
11481
+ var AllowNewlineBinaryOp$0 = $TV($EXPECT($L0, fail, 'AllowNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
11482
+ module.forbidNewlineBinaryOp.push(false);
11483
+ });
11484
+ function AllowNewlineBinaryOp(state) {
11485
+ let eventData;
11486
+ if (state.events) {
11487
+ const result = state.events.enter?.("AllowNewlineBinaryOp", state);
11488
+ if (result) {
11489
+ if (result.cache)
11490
+ return result.cache;
11491
+ eventData = result.data;
11492
+ }
11493
+ }
11494
+ if (state.tokenize) {
11495
+ const result = $TOKEN("AllowNewlineBinaryOp", state, AllowNewlineBinaryOp$0(state));
11496
+ if (state.events)
11497
+ state.events.exit?.("AllowNewlineBinaryOp", state, result, eventData);
11498
+ return result;
11499
+ } else {
11500
+ const result = AllowNewlineBinaryOp$0(state);
11501
+ if (state.events)
11502
+ state.events.exit?.("AllowNewlineBinaryOp", state, result, eventData);
11503
+ return result;
11504
+ }
11505
+ }
11506
+ var ForbidNewlineBinaryOp$0 = $TV($EXPECT($L0, fail, 'ForbidNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
11507
+ module.forbidNewlineBinaryOp.push(true);
11508
+ });
11509
+ function ForbidNewlineBinaryOp(state) {
11510
+ let eventData;
11511
+ if (state.events) {
11512
+ const result = state.events.enter?.("ForbidNewlineBinaryOp", state);
11513
+ if (result) {
11514
+ if (result.cache)
11515
+ return result.cache;
11516
+ eventData = result.data;
11517
+ }
11518
+ }
11519
+ if (state.tokenize) {
11520
+ const result = $TOKEN("ForbidNewlineBinaryOp", state, ForbidNewlineBinaryOp$0(state));
11521
+ if (state.events)
11522
+ state.events.exit?.("ForbidNewlineBinaryOp", state, result, eventData);
11523
+ return result;
11524
+ } else {
11525
+ const result = ForbidNewlineBinaryOp$0(state);
11526
+ if (state.events)
11527
+ state.events.exit?.("ForbidNewlineBinaryOp", state, result, eventData);
11528
+ return result;
11529
+ }
11530
+ }
11531
+ var RestoreNewlineBinaryOp$0 = $TV($EXPECT($L0, fail, 'RestoreNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
11532
+ module.forbidNewlineBinaryOp.pop();
11533
+ });
11534
+ function RestoreNewlineBinaryOp(state) {
11535
+ let eventData;
11536
+ if (state.events) {
11537
+ const result = state.events.enter?.("RestoreNewlineBinaryOp", state);
11538
+ if (result) {
11539
+ if (result.cache)
11540
+ return result.cache;
11541
+ eventData = result.data;
11542
+ }
11543
+ }
11544
+ if (state.tokenize) {
11545
+ const result = $TOKEN("RestoreNewlineBinaryOp", state, RestoreNewlineBinaryOp$0(state));
11546
+ if (state.events)
11547
+ state.events.exit?.("RestoreNewlineBinaryOp", state, result, eventData);
11548
+ return result;
11549
+ } else {
11550
+ const result = RestoreNewlineBinaryOp$0(state);
11551
+ if (state.events)
11552
+ state.events.exit?.("RestoreNewlineBinaryOp", state, result, eventData);
11553
+ return result;
11554
+ }
11555
+ }
11556
+ var NewlineBinaryOpAllowed$0 = $TV($EXPECT($L0, fail, 'NewlineBinaryOpAllowed ""'), function($skip, $loc, $0, $1) {
11557
+ if (module.config.verbose) {
11558
+ console.log("forbidNewlineBinaryOp:", module.forbidNewlineBinaryOp);
11559
+ }
11560
+ if (module.newlineBinaryOpForbidden)
11561
+ return $skip;
11562
+ });
11563
+ function NewlineBinaryOpAllowed(state) {
11564
+ let eventData;
11565
+ if (state.events) {
11566
+ const result = state.events.enter?.("NewlineBinaryOpAllowed", state);
11567
+ if (result) {
11568
+ if (result.cache)
11569
+ return result.cache;
11570
+ eventData = result.data;
11571
+ }
11572
+ }
11573
+ if (state.tokenize) {
11574
+ const result = $TOKEN("NewlineBinaryOpAllowed", state, NewlineBinaryOpAllowed$0(state));
11575
+ if (state.events)
11576
+ state.events.exit?.("NewlineBinaryOpAllowed", state, result, eventData);
11577
+ return result;
11578
+ } else {
11579
+ const result = NewlineBinaryOpAllowed$0(state);
11580
+ if (state.events)
11581
+ state.events.exit?.("NewlineBinaryOpAllowed", state, result, eventData);
11582
+ return result;
11583
+ }
11584
+ }
11585
+ var AllowAll$0 = $S(AllowTrailingMemberProperty, AllowIndentedApplication, AllowMultiLineImplicitObjectLiteral, AllowClassImplicitCall, AllowNewlineBinaryOp);
11781
11586
  function AllowAll(state) {
11782
11587
  let eventData;
11783
11588
  if (state.events) {
@@ -11800,7 +11605,7 @@ ${input.slice(result.pos)}
11800
11605
  return result;
11801
11606
  }
11802
11607
  }
11803
- var RestoreAll$0 = $S(RestoreTrailingMemberProperty, RestoreIndentedApplication, RestoreMultiLineImplicitObjectLiteral, RestoreClassImplicitCall);
11608
+ var RestoreAll$0 = $S(RestoreTrailingMemberProperty, RestoreIndentedApplication, RestoreMultiLineImplicitObjectLiteral, RestoreClassImplicitCall, RestoreNewlineBinaryOp);
11804
11609
  function RestoreAll(state) {
11805
11610
  let eventData;
11806
11611
  if (state.events) {
@@ -12512,7 +12317,7 @@ ${input.slice(result.pos)}
12512
12317
  return result;
12513
12318
  }
12514
12319
  }
12515
- var ExportDeclaration$0 = $TS($S(Export, __, Default, __, $C(HoistableDeclaration, ClassDeclaration, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12320
+ var ExportDeclaration$0 = $TS($S($E(Decorators), Export, __, Default, __, $C(HoistableDeclaration, ClassDeclaration, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
12516
12321
  return { type: "ExportDeclaration", children: $0 };
12517
12322
  });
12518
12323
  var ExportDeclaration$1 = $TS($S(Export, __, ExportFromClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
@@ -17193,42 +16998,7 @@ ${input.slice(result.pos)}
17193
16998
  }
17194
16999
  }
17195
17000
  var JSXAttribute$0 = $TS($S(BracedObjectLiteral), function($skip, $loc, $0, $1) {
17196
- const { children } = $1;
17197
- const parts = [];
17198
- const rest = [];
17199
- for (let i = 1; i < children.length - 1; i++) {
17200
- if (i > 1)
17201
- parts.push(" ");
17202
- const part = children[i];
17203
- switch (part.type) {
17204
- case "Identifier":
17205
- parts.push([part.name, "={", part.name, "}"]);
17206
- break;
17207
- case "Property":
17208
- if (part.name.type === "ComputedPropertyName") {
17209
- rest.push(part);
17210
- } else {
17211
- parts.push([part.name, "={", insertTrimmingSpace(part.value, ""), "}"]);
17212
- }
17213
- break;
17214
- case "SpreadProperty":
17215
- parts.push(["{", part.dots, part.value, "}"]);
17216
- break;
17217
- case "MethodDefinition":
17218
- try {
17219
- parts.push([part.name, "={", module.convertMethodToFunction(part), "}"]);
17220
- } catch {
17221
- rest.push(part);
17222
- }
17223
- break;
17224
- default:
17225
- throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
17226
- }
17227
- }
17228
- if (rest.length) {
17229
- parts.push(["{...{", ...rest, "}}"]);
17230
- }
17231
- return parts;
17001
+ return convertObjectToJSXAttributes($1);
17232
17002
  });
17233
17003
  var JSXAttribute$1 = $TS($S(JSXAttributeName, $C(JSXAttributeInitializer, $Y(JSXAttributeSpace))), function($skip, $loc, $0, $1, $2) {
17234
17004
  var name = $1;
@@ -17248,16 +17018,73 @@ ${input.slice(result.pos)}
17248
17018
  }
17249
17019
  });
17250
17020
  var JSXAttribute$2 = $S(InsertInlineOpenBrace, DotDotDot, InlineJSXAttributeValue, InsertCloseBrace, $Y(JSXAttributeSpace));
17251
- var JSXAttribute$3 = $TS($S($EXPECT($L13, fail, 'JSXAttribute "#"'), JSXShorthandString), function($skip, $loc, $0, $1, $2) {
17021
+ var JSXAttribute$3 = $TS($S(AtThis, $E(Identifier), $Q(InlineJSXCallExpressionRest), $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3, $4) {
17022
+ var at = $1;
17023
+ var id = $2;
17024
+ var rest = $3;
17025
+ const access = id && {
17026
+ type: "PropertyAccess",
17027
+ children: [".", id],
17028
+ name: id
17029
+ };
17030
+ const expr = module.processCallMemberExpression({
17031
+ type: "CallExpression",
17032
+ children: [at, access, ...rest.flat()]
17033
+ });
17034
+ const last = lastAccessInCallExpression(expr);
17035
+ if (!last)
17036
+ return $skip;
17037
+ let name;
17038
+ if (last.type === "Index") {
17039
+ return [
17040
+ "{...{",
17041
+ { ...last, type: "ComputedPropertyName" },
17042
+ ": ",
17043
+ expr,
17044
+ "}}"
17045
+ ];
17046
+ } else if (last.name) {
17047
+ return [last.name, "={", expr, "}"];
17048
+ }
17049
+ return $skip;
17050
+ });
17051
+ var JSXAttribute$4 = $TS($S(Identifier, $P(InlineJSXCallExpressionRest), $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3) {
17052
+ var id = $1;
17053
+ var rest = $2;
17054
+ const expr = module.processCallMemberExpression({
17055
+ type: "CallExpression",
17056
+ children: [id, ...rest.flat()]
17057
+ });
17058
+ if (expr.type === "ObjectExpression") {
17059
+ return convertObjectToJSXAttributes(expr);
17060
+ }
17061
+ const last = lastAccessInCallExpression(expr);
17062
+ if (!last)
17063
+ return $skip;
17064
+ let name;
17065
+ if (last.type === "Index") {
17066
+ return [
17067
+ "{...{",
17068
+ { ...last, type: "ComputedPropertyName" },
17069
+ ": ",
17070
+ expr,
17071
+ "}}"
17072
+ ];
17073
+ } else if (last.name) {
17074
+ return [last.name, "={", expr, "}"];
17075
+ }
17076
+ return $skip;
17077
+ });
17078
+ var JSXAttribute$5 = $TS($S($EXPECT($L13, fail, 'JSXAttribute "#"'), JSXShorthandString), function($skip, $loc, $0, $1, $2) {
17252
17079
  return [" ", "id=", $2];
17253
17080
  });
17254
- var JSXAttribute$4 = $TS($S(Dot, JSXShorthandString), function($skip, $loc, $0, $1, $2) {
17081
+ var JSXAttribute$6 = $TS($S(Dot, JSXShorthandString), function($skip, $loc, $0, $1, $2) {
17255
17082
  return {
17256
17083
  type: "JSXClass",
17257
17084
  class: $2
17258
17085
  };
17259
17086
  });
17260
- var JSXAttribute$5 = $TS($S($TEXT($EXPECT($R6, fail, "JSXAttribute /[!+-]/")), JSXAttributeName), function($skip, $loc, $0, $1, $2) {
17087
+ var JSXAttribute$7 = $TS($S($TEXT($EXPECT($R6, fail, "JSXAttribute /[!+-]/")), JSXAttributeName, $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3) {
17261
17088
  var toggle = $1;
17262
17089
  var id = $2;
17263
17090
  const value = toggle === "+" ? "true" : "false";
@@ -17274,18 +17101,18 @@ ${input.slice(result.pos)}
17274
17101
  }
17275
17102
  }
17276
17103
  if (state.tokenize) {
17277
- const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state));
17104
+ 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));
17278
17105
  if (state.events)
17279
17106
  state.events.exit?.("JSXAttribute", state, result, eventData);
17280
17107
  return result;
17281
17108
  } else {
17282
- const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state);
17109
+ 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);
17283
17110
  if (state.events)
17284
17111
  state.events.exit?.("JSXAttribute", state, result, eventData);
17285
17112
  return result;
17286
17113
  }
17287
17114
  }
17288
- var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]/"));
17115
+ var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]|\\/>/"));
17289
17116
  function JSXAttributeSpace(state) {
17290
17117
  let eventData;
17291
17118
  if (state.events) {
@@ -17388,12 +17215,14 @@ ${input.slice(result.pos)}
17388
17215
  var JSXAttributeValue$0 = $S(OpenBrace, PostfixedExpression, $E(Whitespace), CloseBrace);
17389
17216
  var JSXAttributeValue$1 = JSXElement;
17390
17217
  var JSXAttributeValue$2 = JSXFragment;
17391
- var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
17218
+ var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace, $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3, $4) {
17219
+ var open = $1;
17392
17220
  var value = $2;
17221
+ var close = $3;
17393
17222
  if (value.type === "StringLiteral") {
17394
17223
  return $skip;
17395
17224
  }
17396
- return $0;
17225
+ return [open, value, close];
17397
17226
  });
17398
17227
  var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
17399
17228
  function JSXAttributeValue(state) {
@@ -17576,12 +17405,41 @@ ${input.slice(result.pos)}
17576
17405
  return result;
17577
17406
  }
17578
17407
  }
17579
- var InlineJSXCallExpression$0 = $S($EXPECT($L14, fail, 'InlineJSXCallExpression "super"'), ExplicitArguments);
17580
- var InlineJSXCallExpression$1 = $S($EXPECT($L15, fail, 'InlineJSXCallExpression "import"'), OpenParen, PostfixedExpression, __, CloseParen);
17408
+ var InlineJSXCallExpression$0 = $TS($S($EXPECT($L14, fail, 'InlineJSXCallExpression "super"'), ExplicitArguments, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
17409
+ var args = $2;
17410
+ var rest = $3;
17411
+ return module.processCallMemberExpression({
17412
+ type: "CallExpression",
17413
+ children: [
17414
+ $1,
17415
+ { type: "Call", children: args },
17416
+ ...rest.flat()
17417
+ ]
17418
+ });
17419
+ });
17420
+ var InlineJSXCallExpression$1 = $TS($S($EXPECT($L15, fail, 'InlineJSXCallExpression "import"'), ExplicitArguments, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
17421
+ var args = $2;
17422
+ var rest = $3;
17423
+ return module.processCallMemberExpression({
17424
+ type: "CallExpression",
17425
+ children: [
17426
+ $1,
17427
+ { type: "Call", children: args },
17428
+ ...rest.flat()
17429
+ ]
17430
+ });
17431
+ });
17581
17432
  var InlineJSXCallExpression$2 = $TS($S(InlineJSXMemberExpression, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2) {
17582
- if ($2.length)
17583
- return $0;
17584
- return $1;
17433
+ var member = $1;
17434
+ var rest = $2;
17435
+ if (rest.length) {
17436
+ rest = rest.flat();
17437
+ return module.processCallMemberExpression({
17438
+ type: "CallExpression",
17439
+ children: [member, ...rest]
17440
+ });
17441
+ }
17442
+ return member;
17585
17443
  });
17586
17444
  function InlineJSXCallExpression(state) {
17587
17445
  let eventData;
@@ -17605,9 +17463,20 @@ ${input.slice(result.pos)}
17605
17463
  return result;
17606
17464
  }
17607
17465
  }
17608
- var InlineJSXCallExpressionRest$0 = MemberExpressionRest;
17609
- var InlineJSXCallExpressionRest$1 = TemplateLiteral;
17610
- var InlineJSXCallExpressionRest$2 = $S($E($C(OptionalShorthand, NonNullAssertion)), ExplicitArguments);
17466
+ var InlineJSXCallExpressionRest$0 = InlineJSXMemberExpressionRest;
17467
+ var InlineJSXCallExpressionRest$1 = $TV($C(TemplateLiteral, StringLiteral), function($skip, $loc, $0, $1) {
17468
+ if ($1.type === "StringLiteral") {
17469
+ return "`" + $1.token.slice(1, -1).replace(/(`|\$\{)/g, "\\$1") + "`";
17470
+ }
17471
+ return $1;
17472
+ });
17473
+ var InlineJSXCallExpressionRest$2 = $TS($S($E($C(OptionalShorthand, NonNullAssertion)), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
17474
+ var args = $2;
17475
+ args = { type: "Call", children: args };
17476
+ if (!$1)
17477
+ return args;
17478
+ return [$1, args];
17479
+ });
17611
17480
  function InlineJSXCallExpressionRest(state) {
17612
17481
  let eventData;
17613
17482
  if (state.events) {
@@ -17630,13 +17499,16 @@ ${input.slice(result.pos)}
17630
17499
  return result;
17631
17500
  }
17632
17501
  }
17633
- var InlineJSXMemberExpression$0 = $TS($S(InlineJSXPrimaryExpression, $Q(InlineJSXMemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
17634
- if ($2.length)
17635
- return $0;
17502
+ var InlineJSXMemberExpression$0 = $TS($S($C(InlineJSXPrimaryExpression, SuperProperty, MetaProperty), $Q(InlineJSXMemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
17503
+ var rest = $2;
17504
+ if (rest.length || Array.isArray($1)) {
17505
+ return module.processCallMemberExpression({
17506
+ type: "MemberExpression",
17507
+ children: [$1, ...rest].flat()
17508
+ });
17509
+ }
17636
17510
  return $1;
17637
17511
  });
17638
- var InlineJSXMemberExpression$1 = SuperProperty;
17639
- var InlineJSXMemberExpression$2 = MetaProperty;
17640
17512
  function InlineJSXMemberExpression(state) {
17641
17513
  let eventData;
17642
17514
  if (state.events) {
@@ -17648,12 +17520,12 @@ ${input.slice(result.pos)}
17648
17520
  }
17649
17521
  }
17650
17522
  if (state.tokenize) {
17651
- const result = $TOKEN("InlineJSXMemberExpression", state, InlineJSXMemberExpression$0(state) || InlineJSXMemberExpression$1(state) || InlineJSXMemberExpression$2(state));
17523
+ const result = $TOKEN("InlineJSXMemberExpression", state, InlineJSXMemberExpression$0(state));
17652
17524
  if (state.events)
17653
17525
  state.events.exit?.("InlineJSXMemberExpression", state, result, eventData);
17654
17526
  return result;
17655
17527
  } else {
17656
- const result = InlineJSXMemberExpression$0(state) || InlineJSXMemberExpression$1(state) || InlineJSXMemberExpression$2(state);
17528
+ const result = InlineJSXMemberExpression$0(state);
17657
17529
  if (state.events)
17658
17530
  state.events.exit?.("InlineJSXMemberExpression", state, result, eventData);
17659
17531
  return result;
@@ -17669,7 +17541,9 @@ ${input.slice(result.pos)}
17669
17541
  return $2;
17670
17542
  });
17671
17543
  var InlineJSXMemberExpressionRest$1 = PropertyAccess;
17672
- var InlineJSXMemberExpressionRest$2 = NonNullAssertion;
17544
+ var InlineJSXMemberExpressionRest$2 = PropertyGlob;
17545
+ var InlineJSXMemberExpressionRest$3 = PropertyBind;
17546
+ var InlineJSXMemberExpressionRest$4 = NonNullAssertion;
17673
17547
  function InlineJSXMemberExpressionRest(state) {
17674
17548
  let eventData;
17675
17549
  if (state.events) {
@@ -17681,12 +17555,12 @@ ${input.slice(result.pos)}
17681
17555
  }
17682
17556
  }
17683
17557
  if (state.tokenize) {
17684
- const result = $TOKEN("InlineJSXMemberExpressionRest", state, InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state));
17558
+ const result = $TOKEN("InlineJSXMemberExpressionRest", state, InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state) || InlineJSXMemberExpressionRest$3(state) || InlineJSXMemberExpressionRest$4(state));
17685
17559
  if (state.events)
17686
17560
  state.events.exit?.("InlineJSXMemberExpressionRest", state, result, eventData);
17687
17561
  return result;
17688
17562
  } else {
17689
- const result = InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state);
17563
+ const result = InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state) || InlineJSXMemberExpressionRest$3(state) || InlineJSXMemberExpressionRest$4(state);
17690
17564
  if (state.events)
17691
17565
  state.events.exit?.("InlineJSXMemberExpressionRest", state, result, eventData);
17692
17566
  return result;
@@ -18399,9 +18273,9 @@ ${input.slice(result.pos)}
18399
18273
  }
18400
18274
  }
18401
18275
  var NestedInterfaceProperties$0 = $TS($S(PushIndent, $Q(NestedInterfaceProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18402
- var props2 = $2;
18403
- if (props2.length)
18404
- return props2;
18276
+ var props = $2;
18277
+ if (props.length)
18278
+ return props;
18405
18279
  return $skip;
18406
18280
  });
18407
18281
  function NestedInterfaceProperties(state) {
@@ -18782,23 +18656,23 @@ ${input.slice(result.pos)}
18782
18656
  }
18783
18657
  }
18784
18658
  var EnumBlock$0 = $TS($S(__, OpenBrace, NestedEnumProperties, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
18785
- var props2 = $3;
18659
+ var props = $3;
18786
18660
  return {
18787
- properties: props2.properties,
18661
+ properties: props.properties,
18788
18662
  children: $0
18789
18663
  };
18790
18664
  });
18791
18665
  var EnumBlock$1 = $TS($S(__, OpenBrace, $Q($S(__, EnumProperty)), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
18792
- var props2 = $3;
18666
+ var props = $3;
18793
18667
  return {
18794
- properties: props2.map((p) => p[1]),
18668
+ properties: props.map((p) => p[1]),
18795
18669
  children: $0
18796
18670
  };
18797
18671
  });
18798
18672
  var EnumBlock$2 = $TS($S(InsertOpenBrace, NestedEnumProperties, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
18799
- var props2 = $2;
18673
+ var props = $2;
18800
18674
  return {
18801
- properties: props2.properties,
18675
+ properties: props.properties,
18802
18676
  children: $0
18803
18677
  };
18804
18678
  });
@@ -18825,11 +18699,11 @@ ${input.slice(result.pos)}
18825
18699
  }
18826
18700
  }
18827
18701
  var NestedEnumProperties$0 = $TS($S(PushIndent, $Q(NestedEnumProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18828
- var props2 = $2;
18829
- if (!props2.length)
18702
+ var props = $2;
18703
+ if (!props.length)
18830
18704
  return $skip;
18831
18705
  return {
18832
- properties: props2.map((p) => p.property),
18706
+ properties: props.map((p) => p.property),
18833
18707
  children: $0
18834
18708
  };
18835
18709
  });
@@ -19804,7 +19678,7 @@ ${input.slice(result.pos)}
19804
19678
  return result;
19805
19679
  }
19806
19680
  }
19807
- var TypeParameter$0 = $S(__, Identifier, $E(TypeConstraint), $E(TypeInitializer), TypeParameterDelimiter);
19681
+ var TypeParameter$0 = $S(__, $E($S($EXPECT($L129, fail, 'TypeParameter "const"'), $E(_))), Identifier, $E(TypeConstraint), $E(TypeInitializer), TypeParameterDelimiter);
19808
19682
  function TypeParameter(state) {
19809
19683
  let eventData;
19810
19684
  if (state.events) {
@@ -21001,6 +20875,7 @@ ${input.slice(result.pos)}
21001
20875
  module.forbidIndentedApplication = [false];
21002
20876
  module.forbidTrailingMemberProperty = [false];
21003
20877
  module.forbidMultiLineImplicitObjectLiteral = [false];
20878
+ module.forbidNewlineBinaryOp = [false];
21004
20879
  module.JSXTagStack = [];
21005
20880
  module.operators = /* @__PURE__ */ new Set();
21006
20881
  if (!module._init) {
@@ -21036,6 +20911,12 @@ ${input.slice(result.pos)}
21036
20911
  return s[s.length - 1];
21037
20912
  }
21038
20913
  },
20914
+ newlineBinaryOpForbidden: {
20915
+ get() {
20916
+ const { forbidNewlineBinaryOp: s } = module;
20917
+ return s[s.length - 1];
20918
+ }
20919
+ },
21039
20920
  currentJSXTag: {
21040
20921
  get() {
21041
20922
  const { JSXTagStack: s } = module;
@@ -21303,14 +21184,14 @@ ${input.slice(result.pos)}
21303
21184
  Object.assign(module.config, directive.config);
21304
21185
  }
21305
21186
  });
21306
- module.processGlob = (node) => {
21187
+ module.processCallMemberExpression = (node) => {
21307
21188
  const { children } = node;
21308
21189
  for (let i = 0; i < children.length; i++) {
21309
21190
  const glob = children[i];
21310
21191
  if (glob?.type === "PropertyGlob") {
21311
- const prefix = children.slice(0, i).concat(glob.children[0]);
21192
+ const prefix = children.slice(0, i).concat(glob.dot);
21312
21193
  const parts = [];
21313
- for (const part of glob.object.content) {
21194
+ for (const part of glob.object.properties) {
21314
21195
  if (part.type === "MethodDefinition") {
21315
21196
  throw new Error("Glob pattern cannot have method definition");
21316
21197
  }
@@ -21333,7 +21214,7 @@ ${input.slice(result.pos)}
21333
21214
  });
21334
21215
  } else {
21335
21216
  parts.push({
21336
- type: part.type,
21217
+ type: part.type === "Identifier" ? "Property" : part.type,
21337
21218
  name: part.name,
21338
21219
  value,
21339
21220
  delim: part.delim,
@@ -21355,14 +21236,29 @@ ${input.slice(result.pos)}
21355
21236
  glob.object.children[0],
21356
21237
  ...parts,
21357
21238
  glob.object.children.at(-1)
21358
- ]
21239
+ ],
21240
+ properties: parts
21359
21241
  };
21360
21242
  if (i === children.length - 1)
21361
21243
  return object;
21362
- return module.processGlob({
21244
+ return module.processCallMemberExpression({
21363
21245
  ...node,
21364
21246
  children: [object, ...children.slice(i + 1)]
21365
21247
  });
21248
+ } else if (glob?.type === "PropertyBind") {
21249
+ const prefix = children.slice(0, i);
21250
+ return module.processCallMemberExpression({
21251
+ ...node,
21252
+ children: [
21253
+ prefix,
21254
+ {
21255
+ ...glob,
21256
+ type: "PropertyAccess",
21257
+ children: [...glob.children, ".bind(", prefix, ")"]
21258
+ },
21259
+ ...children.slice(i + 1)
21260
+ ]
21261
+ });
21366
21262
  }
21367
21263
  }
21368
21264
  return node;
@@ -21951,11 +21847,11 @@ ${input.slice(result.pos)}
21951
21847
  length
21952
21848
  };
21953
21849
  };
21954
- module.reorderBindingRestProperty = function(props2) {
21955
- const names = props2.flatMap((p) => p.names);
21850
+ module.reorderBindingRestProperty = function(props) {
21851
+ const names = props.flatMap((p) => p.names);
21956
21852
  let restIndex = -1;
21957
21853
  let restCount = 0;
21958
- props2.forEach(({ type }, i) => {
21854
+ props.forEach(({ type }, i) => {
21959
21855
  if (type === "BindingRestProperty") {
21960
21856
  if (restIndex < 0)
21961
21857
  restIndex = i;
@@ -21964,19 +21860,19 @@ ${input.slice(result.pos)}
21964
21860
  });
21965
21861
  if (restCount === 0) {
21966
21862
  return {
21967
- children: props2,
21863
+ children: props,
21968
21864
  names
21969
21865
  };
21970
21866
  } else if (restCount === 1) {
21971
- let after = props2.slice(restIndex + 1);
21972
- let rest = props2[restIndex];
21973
- props2 = props2.slice(0, restIndex);
21867
+ let after = props.slice(restIndex + 1);
21868
+ let rest = props[restIndex];
21869
+ props = props.slice(0, restIndex);
21974
21870
  if (after.length) {
21975
21871
  const [restDelim] = rest.children.slice(-1), lastAfterProp = after[after.length - 1], lastAfterChildren = lastAfterProp.children, [lastDelim] = lastAfterChildren.slice(-1);
21976
21872
  rest = { ...rest, children: [...rest.children.slice(0, -1), lastDelim] };
21977
21873
  after = [...after.slice(0, -1), { ...lastAfterProp, children: [...lastAfterChildren.slice(0, -1), restDelim] }];
21978
21874
  }
21979
- const children = [...props2, ...after, rest];
21875
+ const children = [...props, ...after, rest];
21980
21876
  return {
21981
21877
  children,
21982
21878
  names
@@ -21986,7 +21882,7 @@ ${input.slice(result.pos)}
21986
21882
  children: [{
21987
21883
  type: "Error",
21988
21884
  message: "Multiple rest properties in object pattern"
21989
- }, props2]
21885
+ }, props]
21990
21886
  };
21991
21887
  };
21992
21888
  function addParentPointers(node, parent) {
@@ -22060,7 +21956,7 @@ ${input.slice(result.pos)}
22060
21956
  gatherRecursiveAll(statements, (n) => n.type === "AtBindingProperty").forEach((binding) => {
22061
21957
  const { ref } = binding;
22062
21958
  if (asThis) {
22063
- const atBinding = binding.children[0];
21959
+ const atBinding = binding.binding;
22064
21960
  atBinding.children.pop();
22065
21961
  atBinding.type = void 0;
22066
21962
  binding.children.unshift(ref.id, ": this.", ref.base);
@@ -22306,34 +22202,11 @@ ${input.slice(result.pos)}
22306
22202
  throw new Error("Unknown postfix statement");
22307
22203
  }
22308
22204
  };
22309
- module.convertMethodToFunction = function(method) {
22310
- const { signature, block } = method;
22311
- let { modifier } = signature;
22312
- if (modifier) {
22313
- if (modifier.get || modifier.set) {
22314
- throw new Error("cannot convert get/set method to function");
22315
- } else if (modifier.async) {
22316
- modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
22317
- } else {
22318
- modifier = ["function ", ...modifier.children];
22319
- }
22320
- } else {
22321
- modifier = "function ";
22322
- }
22323
- return {
22324
- ...signature,
22325
- id: signature.name,
22326
- type: "FunctionExpression",
22327
- children: [
22328
- [modifier, ...signature.children.slice(1)],
22329
- block
22330
- ],
22331
- block
22332
- };
22333
- };
22334
22205
  function getPatternConditions(pattern, ref, conditions) {
22206
+ if (pattern.rest)
22207
+ return;
22335
22208
  switch (pattern.type) {
22336
- case "ArrayMatchingPattern": {
22209
+ case "ArrayBindingPattern": {
22337
22210
  const { elements, length } = pattern, hasRest = elements.some((e) => e.rest), comparator = hasRest ? " >= " : " === ", l = [comparator, (length - hasRest).toString()];
22338
22211
  conditions.push(
22339
22212
  ["Array.isArray(", ref, ")"],
@@ -22341,46 +22214,28 @@ ${input.slice(result.pos)}
22341
22214
  );
22342
22215
  elements.forEach(({ children: [, e] }, i) => {
22343
22216
  const subRef = [ref, "[", i.toString(), "]"];
22344
- switch (e.type) {
22345
- case "ArrayMatchingPattern":
22346
- case "ObjectMatchingPattern":
22347
- case "RegularExpressionLiteral":
22348
- getPatternConditions(e, subRef, conditions);
22349
- break;
22350
- case "BindingMatchElement":
22351
- getPatternConditions(e.match, subRef, conditions);
22352
- break;
22353
- }
22217
+ getPatternConditions(e, subRef, conditions);
22354
22218
  });
22355
22219
  const postRest = pattern.children.find((c) => c?.blockPrefix);
22356
22220
  if (postRest) {
22357
22221
  const postElements = postRest.blockPrefix.children[1], { length: postLength } = postElements;
22358
22222
  postElements.forEach(({ children: [, e] }, i) => {
22359
22223
  const subRef = [ref, "[", ref, ".length - ", (postLength + i).toString(), "]"];
22360
- switch (e.type) {
22361
- case "ArrayMatchingPattern":
22362
- case "ObjectMatchingPattern":
22363
- case "RegularExpressionLiteral":
22364
- case "Literal":
22365
- getPatternConditions(e, subRef, conditions);
22366
- break;
22367
- case "BindingMatchElement":
22368
- getPatternConditions(e.match, subRef, conditions);
22369
- break;
22370
- }
22224
+ getPatternConditions(e, subRef, conditions);
22371
22225
  });
22372
22226
  }
22373
22227
  break;
22374
22228
  }
22375
- case "ObjectMatchingPattern": {
22229
+ case "ObjectBindingPattern": {
22376
22230
  conditions.push(
22377
22231
  ["typeof ", ref, " === 'object'"],
22378
22232
  [ref, " != null"]
22379
22233
  );
22380
22234
  pattern.properties.forEach((p) => {
22381
22235
  switch (p.type) {
22382
- case "BindingMatchProperty": {
22383
- const { name, match } = p;
22236
+ case "PinProperty":
22237
+ case "BindingProperty": {
22238
+ const { name, value } = p;
22384
22239
  let subRef;
22385
22240
  switch (name.type) {
22386
22241
  case "ComputedPropertyName":
@@ -22397,16 +22252,20 @@ ${input.slice(result.pos)}
22397
22252
  conditions.push(["'", name, "' in ", ref]);
22398
22253
  subRef = [ref, ".", name];
22399
22254
  }
22400
- getPatternConditions(p.match, subRef, conditions);
22255
+ if (value) {
22256
+ getPatternConditions(value, subRef, conditions);
22257
+ }
22401
22258
  break;
22402
22259
  }
22403
- case "BindingProperty":
22404
- conditions.push(["'", p.identifier, "' in ", ref]);
22405
- break;
22406
22260
  }
22407
22261
  });
22408
22262
  break;
22409
22263
  }
22264
+ case "ConditionFragment":
22265
+ conditions.push(
22266
+ [ref, " ", pattern.children]
22267
+ );
22268
+ break;
22410
22269
  case "RegularExpressionLiteral": {
22411
22270
  conditions.push(
22412
22271
  ["typeof ", ref, " === 'string'"],
@@ -22414,13 +22273,22 @@ ${input.slice(result.pos)}
22414
22273
  );
22415
22274
  break;
22416
22275
  }
22417
- default: {
22276
+ case "PinPattern":
22277
+ conditions.push([
22278
+ ref,
22279
+ " === ",
22280
+ pattern.identifier
22281
+ ]);
22282
+ break;
22283
+ case "Literal":
22418
22284
  conditions.push([
22419
22285
  ref,
22420
22286
  " === ",
22421
22287
  pattern
22422
22288
  ]);
22423
- }
22289
+ break;
22290
+ default:
22291
+ break;
22424
22292
  }
22425
22293
  }
22426
22294
  function elideMatchersFromArrayBindings(elements) {
@@ -22429,6 +22297,7 @@ ${input.slice(result.pos)}
22429
22297
  case "Literal":
22430
22298
  case "RegularExpressionLiteral":
22431
22299
  case "StringLiteral":
22300
+ case "PinPattern":
22432
22301
  return sep;
22433
22302
  default:
22434
22303
  return [ws, nonMatcherBindings(e), sep];
@@ -22438,27 +22307,19 @@ ${input.slice(result.pos)}
22438
22307
  function elideMatchersFromPropertyBindings(properties) {
22439
22308
  return properties.map((p) => {
22440
22309
  switch (p.type) {
22441
- case "BindingMatchProperty": {
22442
- const { children, name, match } = p;
22443
- const [ws, , , , , , sep] = children;
22444
- switch (match.type) {
22445
- case "ArrayMatchingPattern":
22446
- case "ObjectMatchingPattern":
22310
+ case "BindingProperty": {
22311
+ const { children, name, value } = p;
22312
+ const [ws] = children;
22313
+ const sep = children[children.length - 1];
22314
+ switch (value && value.type) {
22315
+ case "ArrayBindingPattern":
22316
+ case "ObjectBindingPattern":
22447
22317
  return {
22448
22318
  ...p,
22449
- children: [ws, name, ": ", nonMatcherBindings(match)]
22319
+ children: [ws, name, ": ", nonMatcherBindings(value)]
22450
22320
  };
22451
22321
  case "Identifier":
22452
- switch (name.type) {
22453
- case "ComputedPropertyName":
22454
- case "Literal":
22455
- case "StringLiteral":
22456
- case "NumericLiteral":
22457
- return {
22458
- ...p,
22459
- children: [ws, name, ": ", match, sep]
22460
- };
22461
- }
22322
+ return p;
22462
22323
  case "Literal":
22463
22324
  case "RegularExpressionLiteral":
22464
22325
  case "StringLiteral":
@@ -22469,7 +22330,7 @@ ${input.slice(result.pos)}
22469
22330
  };
22470
22331
  }
22471
22332
  }
22472
- case "BindingProperty":
22333
+ case "PinProperty":
22473
22334
  case "BindingRestProperty":
22474
22335
  default:
22475
22336
  return p;
@@ -22478,7 +22339,7 @@ ${input.slice(result.pos)}
22478
22339
  }
22479
22340
  function nonMatcherBindings(pattern) {
22480
22341
  switch (pattern.type) {
22481
- case "ArrayMatchingPattern":
22342
+ case "ArrayBindingPattern":
22482
22343
  return ["[", elideMatchersFromArrayBindings(pattern.elements), "]"];
22483
22344
  case "PostRestBindingElements": {
22484
22345
  const els = elideMatchersFromArrayBindings(pattern.children[1]);
@@ -22491,19 +22352,19 @@ ${input.slice(result.pos)}
22491
22352
  ]
22492
22353
  };
22493
22354
  }
22494
- case "ObjectMatchingPattern":
22355
+ case "ObjectBindingPattern":
22495
22356
  return ["{", elideMatchersFromPropertyBindings(pattern.properties), "}"];
22496
22357
  default:
22497
22358
  return pattern;
22498
22359
  }
22499
22360
  }
22500
22361
  function aggregateDuplicateBindings(bindings) {
22501
- const props2 = gatherRecursiveAll(bindings, (n) => n.type === "BindingMatchProperty");
22362
+ const props = gatherRecursiveAll(bindings, (n) => n.type === "BindingProperty");
22502
22363
  const declarations = [];
22503
22364
  const propsGroupedByName = /* @__PURE__ */ new Map();
22504
- for (const p of props2) {
22505
- const { name } = p;
22506
- const key = name.name;
22365
+ for (const p of props) {
22366
+ const { name, value } = p;
22367
+ const key = value?.name || name.name;
22507
22368
  if (propsGroupedByName.has(key)) {
22508
22369
  propsGroupedByName.get(key).push(p);
22509
22370
  } else {
@@ -22591,10 +22452,10 @@ ${input.slice(result.pos)}
22591
22452
  };
22592
22453
  const prefix = [];
22593
22454
  switch (pattern.type) {
22594
- case "ArrayMatchingPattern":
22455
+ case "ArrayBindingPattern":
22595
22456
  if (pattern.length === 0)
22596
22457
  break;
22597
- case "ObjectMatchingPattern": {
22458
+ case "ObjectBindingPattern": {
22598
22459
  if (pattern.properties?.length === 0)
22599
22460
  break;
22600
22461
  let [splices, thisAssignments] = gatherBindingCode(pattern);
@@ -23303,6 +23164,8 @@ ${input.slice(result.pos)}
23303
23164
  var {
23304
23165
  blockWithPrefix,
23305
23166
  clone,
23167
+ convertMethodToFunction,
23168
+ convertObjectToJSXAttributes,
23306
23169
  deepCopy,
23307
23170
  findAncestor,
23308
23171
  forRange,
@@ -23318,6 +23181,7 @@ ${input.slice(result.pos)}
23318
23181
  hoistRefDecs,
23319
23182
  insertTrimmingSpace,
23320
23183
  isFunction,
23184
+ lastAccessInCallExpression,
23321
23185
  literalValue,
23322
23186
  modifyString,
23323
23187
  processCoffeeInterpolation,
@@ -23769,7 +23633,7 @@ ${input.slice(result.pos)}
23769
23633
  var uncacheable;
23770
23634
  ({ parse } = import_parser.default);
23771
23635
  ({ SourceMap: SourceMap2 } = util_exports);
23772
- 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"]);
23636
+ 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"]);
23773
23637
  var compile = function(src, options) {
23774
23638
  var ast, code, events, filename, ref, result, sm;
23775
23639
  if (!options) {