@sepveneto/free-dom 0.12.8 → 0.13.1

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/index.js CHANGED
@@ -2417,9 +2417,9 @@ var require_decode = __commonJS({
2417
2417
  }
2418
2418
  });
2419
2419
 
2420
- // ../../node_modules/.pnpm/@babel+parser@7.25.8/node_modules/@babel/parser/lib/index.js
2420
+ // ../../node_modules/.pnpm/@babel+parser@7.26.2/node_modules/@babel/parser/lib/index.js
2421
2421
  var require_lib = __commonJS({
2422
- "../../node_modules/.pnpm/@babel+parser@7.25.8/node_modules/@babel/parser/lib/index.js"(exports) {
2422
+ "../../node_modules/.pnpm/@babel+parser@7.26.2/node_modules/@babel/parser/lib/index.js"(exports) {
2423
2423
  "use strict";
2424
2424
  Object.defineProperty(exports, "__esModule", {
2425
2425
  value: true
@@ -2564,15 +2564,12 @@ var require_lib = __commonJS({
2564
2564
  }) => `Unsyntactic ${type === "BreakStatement" ? "break" : "continue"}.`,
2565
2565
  IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
2566
2566
  IllegalReturn: "'return' outside of function.",
2567
- ImportAttributesUseAssert: "The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedAssertSyntax: true` option in the import attributes plugin to suppress this error.",
2567
+ ImportAttributesUseAssert: "The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",
2568
2568
  ImportBindingIsString: ({
2569
2569
  importName
2570
2570
  }) => `A string literal cannot be used as an imported binding.
2571
2571
  - Did you mean \`import { "${importName}" as foo }\`?`,
2572
- ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments.",
2573
- ImportCallArity: ({
2574
- maxArgumentCount
2575
- }) => `\`import()\` requires exactly ${maxArgumentCount === 1 ? "one argument" : "one or two arguments"}.`,
2572
+ ImportCallArity: `\`import()\` requires exactly one or two arguments.`,
2576
2573
  ImportCallNotNewExpression: "Cannot use new with import(...).",
2577
2574
  ImportCallSpreadArgument: "`...` is not allowed in `import()`.",
2578
2575
  ImportJSONBindingNotDefault: "A JSON module can only be imported with `default`.",
@@ -3099,13 +3096,11 @@ var require_lib = __commonJS({
3099
3096
  finishCallExpression(unfinished, optional) {
3100
3097
  const node = super.finishCallExpression(unfinished, optional);
3101
3098
  if (node.callee.type === "Import") {
3099
+ var _ref, _ref2;
3102
3100
  node.type = "ImportExpression";
3103
3101
  node.source = node.arguments[0];
3104
- if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
3105
- var _ref, _ref2;
3106
- node.options = (_ref = node.arguments[1]) != null ? _ref : null;
3107
- node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
3108
- }
3102
+ node.options = (_ref = node.arguments[1]) != null ? _ref : null;
3103
+ node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
3109
3104
  delete node.arguments;
3110
3105
  delete node.callee;
3111
3106
  }
@@ -3647,6 +3642,9 @@ var require_lib = __commonJS({
3647
3642
  name: createToken("name", {
3648
3643
  startsExpr
3649
3644
  }),
3645
+ placeholder: createToken("%%", {
3646
+ startsExpr: true
3647
+ }),
3650
3648
  string: createToken("string", {
3651
3649
  startsExpr
3652
3650
  }),
@@ -3673,22 +3671,19 @@ var require_lib = __commonJS({
3673
3671
  jsxTagStart: createToken("jsxTagStart", {
3674
3672
  startsExpr: true
3675
3673
  }),
3676
- jsxTagEnd: createToken("jsxTagEnd"),
3677
- placeholder: createToken("%%", {
3678
- startsExpr: true
3679
- })
3674
+ jsxTagEnd: createToken("jsxTagEnd")
3680
3675
  };
3681
3676
  function tokenIsIdentifier(token) {
3682
- return token >= 93 && token <= 132;
3677
+ return token >= 93 && token <= 133;
3683
3678
  }
3684
3679
  function tokenKeywordOrIdentifierIsKeyword(token) {
3685
3680
  return token <= 92;
3686
3681
  }
3687
3682
  function tokenIsKeywordOrIdentifier(token) {
3688
- return token >= 58 && token <= 132;
3683
+ return token >= 58 && token <= 133;
3689
3684
  }
3690
3685
  function tokenIsLiteralPropertyName(token) {
3691
- return token >= 58 && token <= 136;
3686
+ return token >= 58 && token <= 137;
3692
3687
  }
3693
3688
  function tokenComesBeforeExpression(token) {
3694
3689
  return tokenBeforeExprs[token];
@@ -3752,7 +3747,7 @@ var require_lib = __commonJS({
3752
3747
  context.push(types.template);
3753
3748
  }
3754
3749
  };
3755
- tokenTypes[142].updateContext = (context) => {
3750
+ tokenTypes[143].updateContext = (context) => {
3756
3751
  context.push(types.j_expr, types.j_oTag);
3757
3752
  };
3758
3753
  }
@@ -4033,6 +4028,12 @@ var require_lib = __commonJS({
4033
4028
  this.sawUnambiguousESM = false;
4034
4029
  this.ambiguousScriptDifferentAst = false;
4035
4030
  }
4031
+ sourceToOffsetPos(sourcePos) {
4032
+ return sourcePos + this.startIndex;
4033
+ }
4034
+ offsetToSourcePos(offsetPos) {
4035
+ return offsetPos - this.startIndex;
4036
+ }
4036
4037
  hasPlugin(pluginConfig) {
4037
4038
  if (typeof pluginConfig === "string") {
4038
4039
  return this.plugins.has(pluginConfig);
@@ -4148,7 +4149,7 @@ var require_lib = __commonJS({
4148
4149
  containingNode: node,
4149
4150
  start: commentStart
4150
4151
  } = commentWS;
4151
- if (this.input.charCodeAt(commentStart - 1) === 44) {
4152
+ if (this.input.charCodeAt(this.offsetToSourcePos(commentStart) - 1) === 44) {
4152
4153
  switch (node.type) {
4153
4154
  case "ObjectExpression":
4154
4155
  case "ObjectPattern":
@@ -4299,6 +4300,7 @@ var require_lib = __commonJS({
4299
4300
  var State = class {
4300
4301
  constructor() {
4301
4302
  this.flags = 1024;
4303
+ this.startIndex = void 0;
4302
4304
  this.curLine = void 0;
4303
4305
  this.lineStart = void 0;
4304
4306
  this.startLoc = void 0;
@@ -4315,7 +4317,7 @@ var require_lib = __commonJS({
4315
4317
  this.commentsLen = 0;
4316
4318
  this.commentStack = [];
4317
4319
  this.pos = 0;
4318
- this.type = 139;
4320
+ this.type = 140;
4319
4321
  this.value = null;
4320
4322
  this.start = 0;
4321
4323
  this.end = 0;
@@ -4338,13 +4340,15 @@ var require_lib = __commonJS({
4338
4340
  init({
4339
4341
  strictMode,
4340
4342
  sourceType,
4343
+ startIndex,
4341
4344
  startLine,
4342
4345
  startColumn
4343
4346
  }) {
4344
4347
  this.strict = strictMode === false ? false : strictMode === true ? true : sourceType === "module";
4348
+ this.startIndex = startIndex;
4345
4349
  this.curLine = startLine;
4346
4350
  this.lineStart = -startColumn;
4347
- this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
4351
+ this.startLoc = this.endLoc = new Position(startLine, startColumn, startIndex);
4348
4352
  }
4349
4353
  get maybeInArrowParameters() {
4350
4354
  return (this.flags & 2) > 0;
@@ -4455,11 +4459,12 @@ var require_lib = __commonJS({
4455
4459
  this.flags &= -4097;
4456
4460
  }
4457
4461
  curPosition() {
4458
- return new Position(this.curLine, this.pos - this.lineStart, this.pos);
4462
+ return new Position(this.curLine, this.pos - this.lineStart, this.pos + this.startIndex);
4459
4463
  }
4460
4464
  clone() {
4461
4465
  const state2 = new State();
4462
4466
  state2.flags = this.flags;
4467
+ state2.startIndex = this.startIndex;
4463
4468
  state2.curLine = this.curLine;
4464
4469
  state2.lineStart = this.lineStart;
4465
4470
  state2.startLoc = this.startLoc;
@@ -4777,10 +4782,11 @@ var require_lib = __commonJS({
4777
4782
  var VALID_REGEX_FLAGS = /* @__PURE__ */ new Set([103, 109, 115, 105, 121, 117, 100, 118]);
4778
4783
  var Token = class {
4779
4784
  constructor(state2) {
4785
+ const startIndex = state2.startIndex || 0;
4780
4786
  this.type = state2.type;
4781
4787
  this.value = state2.value;
4782
- this.start = state2.start;
4783
- this.end = state2.end;
4788
+ this.start = startIndex + state2.start;
4789
+ this.end = startIndex + state2.end;
4784
4790
  this.loc = new SourceLocation(state2.startLoc, state2.endLoc);
4785
4791
  }
4786
4792
  };
@@ -4923,7 +4929,7 @@ var require_lib = __commonJS({
4923
4929
  if (!this.isLookahead)
4924
4930
  this.state.startLoc = this.state.curPosition();
4925
4931
  if (this.state.pos >= this.length) {
4926
- this.finishToken(139);
4932
+ this.finishToken(140);
4927
4933
  return;
4928
4934
  }
4929
4935
  this.getTokenFromCode(this.codePointAtPos(this.state.pos));
@@ -4948,8 +4954,8 @@ var require_lib = __commonJS({
4948
4954
  const comment = {
4949
4955
  type: "CommentBlock",
4950
4956
  value: this.input.slice(start + 2, end),
4951
- start,
4952
- end: end + commentEnd.length,
4957
+ start: this.sourceToOffsetPos(start),
4958
+ end: this.sourceToOffsetPos(end + commentEnd.length),
4953
4959
  loc: new SourceLocation(startLoc, this.state.curPosition())
4954
4960
  };
4955
4961
  if (this.options.tokens)
@@ -4974,8 +4980,8 @@ var require_lib = __commonJS({
4974
4980
  const comment = {
4975
4981
  type: "CommentLine",
4976
4982
  value,
4977
- start,
4978
- end,
4983
+ start: this.sourceToOffsetPos(start),
4984
+ end: this.sourceToOffsetPos(end),
4979
4985
  loc: new SourceLocation(startLoc, this.state.curPosition())
4980
4986
  };
4981
4987
  if (this.options.tokens)
@@ -5064,8 +5070,8 @@ var require_lib = __commonJS({
5064
5070
  if (comments.length > 0) {
5065
5071
  const end = this.state.pos;
5066
5072
  const commentWhitespace = {
5067
- start: spaceStart,
5068
- end,
5073
+ start: this.sourceToOffsetPos(spaceStart),
5074
+ end: this.sourceToOffsetPos(end),
5069
5075
  comments,
5070
5076
  leadingNode: null,
5071
5077
  trailingNode: null,
@@ -5110,10 +5116,10 @@ var require_lib = __commonJS({
5110
5116
  }
5111
5117
  } else if (isIdentifierStart(next)) {
5112
5118
  ++this.state.pos;
5113
- this.finishToken(138, this.readWord1(next));
5119
+ this.finishToken(139, this.readWord1(next));
5114
5120
  } else if (next === 92) {
5115
5121
  ++this.state.pos;
5116
- this.finishToken(138, this.readWord1());
5122
+ this.finishToken(139, this.readWord1());
5117
5123
  } else {
5118
5124
  this.finishOp(27, 1);
5119
5125
  }
@@ -5526,7 +5532,7 @@ var require_lib = __commonJS({
5526
5532
  mods += char;
5527
5533
  }
5528
5534
  this.state.pos = pos;
5529
- this.finishToken(137, {
5535
+ this.finishToken(138, {
5530
5536
  pattern: content,
5531
5537
  flags: mods
5532
5538
  });
@@ -5540,6 +5546,7 @@ var require_lib = __commonJS({
5540
5546
  return n;
5541
5547
  }
5542
5548
  readRadixNumber(radix) {
5549
+ const start = this.state.pos;
5543
5550
  const startLoc = this.state.curPosition();
5544
5551
  let isBigInt = false;
5545
5552
  this.state.pos += 2;
@@ -5560,11 +5567,11 @@ var require_lib = __commonJS({
5560
5567
  throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
5561
5568
  }
5562
5569
  if (isBigInt) {
5563
- const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
5564
- this.finishToken(135, str);
5570
+ const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
5571
+ this.finishToken(136, str);
5565
5572
  return;
5566
5573
  }
5567
- this.finishToken(134, val);
5574
+ this.finishToken(135, val);
5568
5575
  }
5569
5576
  readNumber(startsWithDot) {
5570
5577
  const start = this.state.pos;
@@ -5627,15 +5634,15 @@ var require_lib = __commonJS({
5627
5634
  }
5628
5635
  const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
5629
5636
  if (isBigInt) {
5630
- this.finishToken(135, str);
5637
+ this.finishToken(136, str);
5631
5638
  return;
5632
5639
  }
5633
5640
  if (isDecimal) {
5634
- this.finishToken(136, str);
5641
+ this.finishToken(137, str);
5635
5642
  return;
5636
5643
  }
5637
5644
  const val = isOctal ? parseInt(str, 8) : parseFloat(str);
5638
- this.finishToken(134, val);
5645
+ this.finishToken(135, val);
5639
5646
  }
5640
5647
  readCodePoint(throwOnInvalid) {
5641
5648
  const {
@@ -5655,7 +5662,7 @@ var require_lib = __commonJS({
5655
5662
  this.state.pos = pos + 1;
5656
5663
  this.state.lineStart = lineStart;
5657
5664
  this.state.curLine = curLine;
5658
- this.finishToken(133, str);
5665
+ this.finishToken(134, str);
5659
5666
  }
5660
5667
  readTemplateContinuation() {
5661
5668
  if (!this.match(8)) {
@@ -5677,7 +5684,7 @@ var require_lib = __commonJS({
5677
5684
  this.state.lineStart = lineStart;
5678
5685
  this.state.curLine = curLine;
5679
5686
  if (firstInvalidLoc) {
5680
- this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, firstInvalidLoc.pos);
5687
+ this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, this.sourceToOffsetPos(firstInvalidLoc.pos));
5681
5688
  }
5682
5689
  if (this.input.codePointAt(pos) === 96) {
5683
5690
  this.finishToken(24, firstInvalidLoc ? null : opening + str + "`");
@@ -6073,10 +6080,10 @@ var require_lib = __commonJS({
6073
6080
  }
6074
6081
  }
6075
6082
  canInsertSemicolon() {
6076
- return this.match(139) || this.match(8) || this.hasPrecedingLineBreak();
6083
+ return this.match(140) || this.match(8) || this.hasPrecedingLineBreak();
6077
6084
  }
6078
6085
  hasPrecedingLineBreak() {
6079
- return hasNewLine(this.input, this.state.lastTokEndLoc.index, this.state.start);
6086
+ return hasNewLine(this.input, this.offsetToSourcePos(this.state.lastTokEndLoc.index), this.state.start);
6080
6087
  }
6081
6088
  hasFollowingLineBreak() {
6082
6089
  return hasNewLine(this.input, this.state.end, this.nextTokenStart());
@@ -6486,7 +6493,7 @@ var require_lib = __commonJS({
6486
6493
  return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
6487
6494
  }
6488
6495
  finishToken(type, val) {
6489
- if (type !== 133 && type !== 13 && type !== 28) {
6496
+ if (type !== 134 && type !== 13 && type !== 28) {
6490
6497
  if (this.flowPragma === void 0) {
6491
6498
  this.flowPragma = null;
6492
6499
  }
@@ -6616,7 +6623,7 @@ var require_lib = __commonJS({
6616
6623
  }
6617
6624
  flowParseDeclareModule(node) {
6618
6625
  this.scope.enter(0);
6619
- if (this.match(133)) {
6626
+ if (this.match(134)) {
6620
6627
  node.id = super.parseExprAtom();
6621
6628
  } else {
6622
6629
  node.id = this.parseIdentifier();
@@ -6844,7 +6851,7 @@ var require_lib = __commonJS({
6844
6851
  const node = this.startNode();
6845
6852
  node.params = [];
6846
6853
  this.state.inType = true;
6847
- if (this.match(47) || this.match(142)) {
6854
+ if (this.match(47) || this.match(143)) {
6848
6855
  this.next();
6849
6856
  } else {
6850
6857
  this.unexpected();
@@ -6918,7 +6925,7 @@ var require_lib = __commonJS({
6918
6925
  return this.finishNode(node, "InterfaceTypeAnnotation");
6919
6926
  }
6920
6927
  flowParseObjectPropertyKey() {
6921
- return this.match(134) || this.match(133) ? super.parseExprAtom() : this.parseIdentifier(true);
6928
+ return this.match(135) || this.match(134) ? super.parseExprAtom() : this.parseIdentifier(true);
6922
6929
  }
6923
6930
  flowParseObjectTypeIndexer(node, isStatic, variance) {
6924
6931
  node.static = isStatic;
@@ -7362,7 +7369,7 @@ var require_lib = __commonJS({
7362
7369
  node2.typeParameters = null;
7363
7370
  return this.finishNode(node2, "FunctionTypeAnnotation");
7364
7371
  }
7365
- case 133:
7372
+ case 134:
7366
7373
  return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
7367
7374
  case 85:
7368
7375
  case 86:
@@ -7372,19 +7379,19 @@ var require_lib = __commonJS({
7372
7379
  case 53:
7373
7380
  if (this.state.value === "-") {
7374
7381
  this.next();
7375
- if (this.match(134)) {
7382
+ if (this.match(135)) {
7376
7383
  return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
7377
7384
  }
7378
- if (this.match(135)) {
7385
+ if (this.match(136)) {
7379
7386
  return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
7380
7387
  }
7381
7388
  throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
7382
7389
  }
7383
7390
  this.unexpected();
7384
7391
  return;
7385
- case 134:
7386
- return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
7387
7392
  case 135:
7393
+ return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
7394
+ case 136:
7388
7395
  return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
7389
7396
  case 88:
7390
7397
  this.next();
@@ -7554,7 +7561,7 @@ var require_lib = __commonJS({
7554
7561
  this.next();
7555
7562
  return this.flowParseInterface(node);
7556
7563
  }
7557
- } else if (this.plugins.get("flow").enums && this.isContextual(126)) {
7564
+ } else if (this.isContextual(126)) {
7558
7565
  const node = this.startNode();
7559
7566
  this.next();
7560
7567
  return this.flowParseEnumDeclaration(node);
@@ -7587,7 +7594,7 @@ var require_lib = __commonJS({
7587
7594
  const {
7588
7595
  type
7589
7596
  } = this.state;
7590
- if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.plugins.get("flow").enums && type === 126) {
7597
+ if (type === 126 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) {
7591
7598
  return !this.state.containsEsc;
7592
7599
  }
7593
7600
  return super.shouldParseExportDeclaration();
@@ -7596,13 +7603,13 @@ var require_lib = __commonJS({
7596
7603
  const {
7597
7604
  type
7598
7605
  } = this.state;
7599
- if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.plugins.get("flow").enums && type === 126) {
7606
+ if (type === 126 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) {
7600
7607
  return this.state.containsEsc;
7601
7608
  }
7602
7609
  return super.isExportDefaultSpecifier();
7603
7610
  }
7604
7611
  parseExportDefaultExpression() {
7605
- if (this.plugins.get("flow").enums && this.isContextual(126)) {
7612
+ if (this.isContextual(126)) {
7606
7613
  const node = this.startNode();
7607
7614
  this.next();
7608
7615
  return this.flowParseEnumDeclaration(node);
@@ -7705,7 +7712,7 @@ var require_lib = __commonJS({
7705
7712
  }
7706
7713
  forwardNoArrowParamsConversionAt(node, parse2) {
7707
7714
  let result;
7708
- if (this.state.noArrowParamsConversionAt.includes(node.start)) {
7715
+ if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
7709
7716
  this.state.noArrowParamsConversionAt.push(this.state.start);
7710
7717
  result = parse2();
7711
7718
  this.state.noArrowParamsConversionAt.pop();
@@ -7756,7 +7763,7 @@ var require_lib = __commonJS({
7756
7763
  const declarationNode = this.startNode();
7757
7764
  this.next();
7758
7765
  return this.flowParseInterface(declarationNode);
7759
- } else if (this.plugins.get("flow").enums && this.isContextual(126)) {
7766
+ } else if (this.isContextual(126)) {
7760
7767
  node.exportKind = "value";
7761
7768
  const declarationNode = this.startNode();
7762
7769
  this.next();
@@ -8143,7 +8150,7 @@ var require_lib = __commonJS({
8143
8150
  var _jsx;
8144
8151
  let state2 = null;
8145
8152
  let jsx2;
8146
- if (this.hasPlugin("jsx") && (this.match(142) || this.match(47))) {
8153
+ if (this.hasPlugin("jsx") && (this.match(143) || this.match(47))) {
8147
8154
  state2 = this.state.clone();
8148
8155
  jsx2 = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state2);
8149
8156
  if (!jsx2.error)
@@ -8229,14 +8236,14 @@ var require_lib = __commonJS({
8229
8236
  return this.match(14) || super.shouldParseArrow(params);
8230
8237
  }
8231
8238
  setArrowFunctionParameters(node, params) {
8232
- if (this.state.noArrowParamsConversionAt.includes(node.start)) {
8239
+ if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
8233
8240
  node.params = params;
8234
8241
  } else {
8235
8242
  super.setArrowFunctionParameters(node, params);
8236
8243
  }
8237
8244
  }
8238
8245
  checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
8239
- if (isArrowFunction && this.state.noArrowParamsConversionAt.includes(node.start)) {
8246
+ if (isArrowFunction && this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
8240
8247
  return;
8241
8248
  }
8242
8249
  for (let i = 0; i < node.params.length; i++) {
@@ -8247,14 +8254,14 @@ var require_lib = __commonJS({
8247
8254
  super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
8248
8255
  }
8249
8256
  parseParenAndDistinguishExpression(canBeArrow) {
8250
- return super.parseParenAndDistinguishExpression(canBeArrow && !this.state.noArrowAt.includes(this.state.start));
8257
+ return super.parseParenAndDistinguishExpression(canBeArrow && !this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)));
8251
8258
  }
8252
8259
  parseSubscripts(base, startLoc, noCalls) {
8253
8260
  if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.includes(startLoc.index)) {
8254
8261
  this.next();
8255
8262
  const node = this.startNodeAt(startLoc);
8256
8263
  node.callee = base;
8257
- node.arguments = super.parseCallExpressionArguments(11, false);
8264
+ node.arguments = super.parseCallExpressionArguments(11);
8258
8265
  base = this.finishNode(node, "CallExpression");
8259
8266
  } else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
8260
8267
  const state2 = this.state.clone();
@@ -8288,7 +8295,7 @@ var require_lib = __commonJS({
8288
8295
  node.callee = base;
8289
8296
  node.typeArguments = this.flowParseTypeParameterInstantiation();
8290
8297
  this.expect(10);
8291
- node.arguments = this.parseCallExpressionArguments(11, false);
8298
+ node.arguments = this.parseCallExpressionArguments(11);
8292
8299
  node.optional = true;
8293
8300
  return this.finishCallExpression(node, true);
8294
8301
  } else if (!noCalls && this.shouldParseTypes() && this.match(47)) {
@@ -8297,7 +8304,7 @@ var require_lib = __commonJS({
8297
8304
  const result = this.tryParse(() => {
8298
8305
  node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
8299
8306
  this.expect(10);
8300
- node.arguments = super.parseCallExpressionArguments(11, false);
8307
+ node.arguments = super.parseCallExpressionArguments(11);
8301
8308
  if (subscriptState.optionalChainMember) {
8302
8309
  node.optional = false;
8303
8310
  }
@@ -8415,7 +8422,7 @@ var require_lib = __commonJS({
8415
8422
  const startLoc = this.state.startLoc;
8416
8423
  const endOfInit = () => this.match(12) || this.match(8);
8417
8424
  switch (this.state.type) {
8418
- case 134: {
8425
+ case 135: {
8419
8426
  const literal = this.parseNumericLiteral(this.state.value);
8420
8427
  if (endOfInit()) {
8421
8428
  return {
@@ -8429,7 +8436,7 @@ var require_lib = __commonJS({
8429
8436
  loc: startLoc
8430
8437
  };
8431
8438
  }
8432
- case 133: {
8439
+ case 134: {
8433
8440
  const literal = this.parseStringLiteral(this.state.value);
8434
8441
  if (endOfInit()) {
8435
8442
  return {
@@ -9027,14 +9034,14 @@ var require_lib = __commonJS({
9027
9034
  if (this.state.pos === this.state.start) {
9028
9035
  if (ch === 60 && this.state.canStartJSXElement) {
9029
9036
  ++this.state.pos;
9030
- this.finishToken(142);
9037
+ this.finishToken(143);
9031
9038
  } else {
9032
9039
  super.getTokenFromCode(ch);
9033
9040
  }
9034
9041
  return;
9035
9042
  }
9036
9043
  out += this.input.slice(chunkStart, this.state.pos);
9037
- this.finishToken(141, out);
9044
+ this.finishToken(142, out);
9038
9045
  return;
9039
9046
  case 38:
9040
9047
  out += this.input.slice(chunkStart, this.state.pos);
@@ -9091,7 +9098,7 @@ var require_lib = __commonJS({
9091
9098
  }
9092
9099
  }
9093
9100
  out += this.input.slice(chunkStart, this.state.pos++);
9094
- this.finishToken(133, out);
9101
+ this.finishToken(134, out);
9095
9102
  }
9096
9103
  jsxReadEntity() {
9097
9104
  const startPos = ++this.state.pos;
@@ -9131,11 +9138,11 @@ var require_lib = __commonJS({
9131
9138
  do {
9132
9139
  ch = this.input.charCodeAt(++this.state.pos);
9133
9140
  } while (isIdentifierChar(ch) || ch === 45);
9134
- this.finishToken(140, this.input.slice(start, this.state.pos));
9141
+ this.finishToken(141, this.input.slice(start, this.state.pos));
9135
9142
  }
9136
9143
  jsxParseIdentifier() {
9137
9144
  const node = this.startNode();
9138
- if (this.match(140)) {
9145
+ if (this.match(141)) {
9139
9146
  node.name = this.state.value;
9140
9147
  } else if (tokenIsKeyword(this.state.type)) {
9141
9148
  node.name = tokenLabelName(this.state.type);
@@ -9181,8 +9188,8 @@ var require_lib = __commonJS({
9181
9188
  this.raise(JsxErrors.AttributeIsEmpty, node);
9182
9189
  }
9183
9190
  return node;
9184
- case 142:
9185
- case 133:
9191
+ case 143:
9192
+ case 134:
9186
9193
  return this.parseExprAtom();
9187
9194
  default:
9188
9195
  throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
@@ -9230,7 +9237,7 @@ var require_lib = __commonJS({
9230
9237
  }
9231
9238
  jsxParseOpeningElementAt(startLoc) {
9232
9239
  const node = this.startNodeAt(startLoc);
9233
- if (this.eat(143)) {
9240
+ if (this.eat(144)) {
9234
9241
  return this.finishNode(node, "JSXOpeningFragment");
9235
9242
  }
9236
9243
  node.name = this.jsxParseElementName();
@@ -9238,21 +9245,21 @@ var require_lib = __commonJS({
9238
9245
  }
9239
9246
  jsxParseOpeningElementAfterName(node) {
9240
9247
  const attributes = [];
9241
- while (!this.match(56) && !this.match(143)) {
9248
+ while (!this.match(56) && !this.match(144)) {
9242
9249
  attributes.push(this.jsxParseAttribute());
9243
9250
  }
9244
9251
  node.attributes = attributes;
9245
9252
  node.selfClosing = this.eat(56);
9246
- this.expect(143);
9253
+ this.expect(144);
9247
9254
  return this.finishNode(node, "JSXOpeningElement");
9248
9255
  }
9249
9256
  jsxParseClosingElementAt(startLoc) {
9250
9257
  const node = this.startNodeAt(startLoc);
9251
- if (this.eat(143)) {
9258
+ if (this.eat(144)) {
9252
9259
  return this.finishNode(node, "JSXClosingFragment");
9253
9260
  }
9254
9261
  node.name = this.jsxParseElementName();
9255
- this.expect(143);
9262
+ this.expect(144);
9256
9263
  return this.finishNode(node, "JSXClosingElement");
9257
9264
  }
9258
9265
  jsxParseElementAt(startLoc) {
@@ -9264,7 +9271,7 @@ var require_lib = __commonJS({
9264
9271
  contents:
9265
9272
  for (; ; ) {
9266
9273
  switch (this.state.type) {
9267
- case 142:
9274
+ case 143:
9268
9275
  startLoc = this.state.startLoc;
9269
9276
  this.next();
9270
9277
  if (this.eat(56)) {
@@ -9273,7 +9280,7 @@ var require_lib = __commonJS({
9273
9280
  }
9274
9281
  children.push(this.jsxParseElementAt(startLoc));
9275
9282
  break;
9276
- case 141:
9283
+ case 142:
9277
9284
  children.push(this.parseLiteral(this.state.value, "JSXText"));
9278
9285
  break;
9279
9286
  case 5: {
@@ -9330,10 +9337,10 @@ var require_lib = __commonJS({
9330
9337
  context[context.length - 1] = newContext;
9331
9338
  }
9332
9339
  parseExprAtom(refExpressionErrors) {
9333
- if (this.match(142)) {
9340
+ if (this.match(143)) {
9334
9341
  return this.jsxParseElement();
9335
9342
  } else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
9336
- this.replaceToken(142);
9343
+ this.replaceToken(143);
9337
9344
  return this.jsxParseElement();
9338
9345
  } else {
9339
9346
  return super.parseExprAtom(refExpressionErrors);
@@ -9357,7 +9364,7 @@ var require_lib = __commonJS({
9357
9364
  }
9358
9365
  if (code2 === 62) {
9359
9366
  ++this.state.pos;
9360
- this.finishToken(143);
9367
+ this.finishToken(144);
9361
9368
  return;
9362
9369
  }
9363
9370
  if ((code2 === 34 || code2 === 39) && context === types.j_oTag) {
@@ -9367,7 +9374,7 @@ var require_lib = __commonJS({
9367
9374
  }
9368
9375
  if (code2 === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
9369
9376
  ++this.state.pos;
9370
- this.finishToken(142);
9377
+ this.finishToken(143);
9371
9378
  return;
9372
9379
  }
9373
9380
  super.getTokenFromCode(code2);
@@ -9377,12 +9384,12 @@ var require_lib = __commonJS({
9377
9384
  context,
9378
9385
  type
9379
9386
  } = this.state;
9380
- if (type === 56 && prevType === 142) {
9387
+ if (type === 56 && prevType === 143) {
9381
9388
  context.splice(-2, 2, types.j_cTag);
9382
9389
  this.state.canStartJSXElement = false;
9383
- } else if (type === 142) {
9384
- context.push(types.j_oTag);
9385
9390
  } else if (type === 143) {
9391
+ context.push(types.j_oTag);
9392
+ } else if (type === 144) {
9386
9393
  const out = context[context.length - 1];
9387
9394
  if (out === types.j_oTag && prevType === 56 || out === types.j_cTag) {
9388
9395
  context.pop();
@@ -9739,7 +9746,7 @@ var require_lib = __commonJS({
9739
9746
  return this.parseBindingRestProperty(this.startNode());
9740
9747
  }
9741
9748
  const prop = this.startNode();
9742
- if (type === 138) {
9749
+ if (type === 139) {
9743
9750
  this.expectPlugin("destructuringPrivate", startLoc);
9744
9751
  this.classScope.usePrivateName(this.state.value, startLoc);
9745
9752
  prop.key = this.parsePrivateName();
@@ -10067,7 +10074,7 @@ var require_lib = __commonJS({
10067
10074
  return tokenIsIdentifier(this.state.type);
10068
10075
  }
10069
10076
  tsTokenCanFollowModifier() {
10070
- return this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(138) || this.isLiteralPropertyName();
10077
+ return this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(139) || this.isLiteralPropertyName();
10071
10078
  }
10072
10079
  tsNextTokenOnSameLineAndCanFollowModifier() {
10073
10080
  this.next();
@@ -10239,22 +10246,16 @@ var require_lib = __commonJS({
10239
10246
  const node = this.startNode();
10240
10247
  this.expect(83);
10241
10248
  this.expect(10);
10242
- if (!this.match(133)) {
10249
+ if (!this.match(134)) {
10243
10250
  this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
10244
10251
  }
10245
10252
  node.argument = super.parseExprAtom();
10246
- if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
10253
+ if (this.eat(12) && !this.match(11)) {
10254
+ node.options = super.parseMaybeAssignAllowIn();
10255
+ this.eat(12);
10256
+ } else {
10247
10257
  node.options = null;
10248
10258
  }
10249
- if (this.eat(12)) {
10250
- if (!this.hasPlugin("importAssertions")) {
10251
- this.expectPlugin("importAttributes");
10252
- }
10253
- if (!this.match(11)) {
10254
- node.options = super.parseMaybeAssignAllowIn();
10255
- this.eat(12);
10256
- }
10257
- }
10258
10259
  this.expect(11);
10259
10260
  if (this.eat(16)) {
10260
10261
  node.qualifier = this.tsParseEntityName();
@@ -10323,7 +10324,7 @@ var require_lib = __commonJS({
10323
10324
  }
10324
10325
  tsParseTypeParameters(parseModifiers) {
10325
10326
  const node = this.startNode();
10326
- if (this.match(47) || this.match(142)) {
10327
+ if (this.match(47) || this.match(143)) {
10327
10328
  this.next();
10328
10329
  } else {
10329
10330
  this.unexpected();
@@ -10652,9 +10653,9 @@ var require_lib = __commonJS({
10652
10653
  tsParseLiteralTypeNode() {
10653
10654
  const node = this.startNode();
10654
10655
  switch (this.state.type) {
10655
- case 134:
10656
10656
  case 135:
10657
- case 133:
10657
+ case 136:
10658
+ case 134:
10658
10659
  case 85:
10659
10660
  case 86:
10660
10661
  node.literal = super.parseExprAtom();
@@ -10684,9 +10685,9 @@ var require_lib = __commonJS({
10684
10685
  }
10685
10686
  tsParseNonArrayType() {
10686
10687
  switch (this.state.type) {
10687
- case 133:
10688
10688
  case 134:
10689
10689
  case 135:
10690
+ case 136:
10690
10691
  case 85:
10691
10692
  case 86:
10692
10693
  return this.tsParseLiteralTypeNode();
@@ -10694,7 +10695,7 @@ var require_lib = __commonJS({
10694
10695
  if (this.state.value === "-") {
10695
10696
  const node = this.startNode();
10696
10697
  const nextToken = this.lookahead();
10697
- if (nextToken.type !== 134 && nextToken.type !== 135) {
10698
+ if (nextToken.type !== 135 && nextToken.type !== 136) {
10698
10699
  this.unexpected();
10699
10700
  }
10700
10701
  node.literal = this.parseMaybeUnary();
@@ -11102,7 +11103,7 @@ var require_lib = __commonJS({
11102
11103
  }
11103
11104
  tsParseEnumMember() {
11104
11105
  const node = this.startNode();
11105
- node.id = this.match(133) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
11106
+ node.id = this.match(134) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
11106
11107
  if (this.eat(29)) {
11107
11108
  node.initializer = super.parseMaybeAssignAllowIn();
11108
11109
  }
@@ -11149,9 +11150,11 @@ var require_lib = __commonJS({
11149
11150
  }
11150
11151
  tsParseAmbientExternalModuleDeclaration(node) {
11151
11152
  if (this.isContextual(112)) {
11153
+ node.kind = "global";
11152
11154
  node.global = true;
11153
11155
  node.id = this.parseIdentifier();
11154
- } else if (this.match(133)) {
11156
+ } else if (this.match(134)) {
11157
+ node.kind = "module";
11155
11158
  node.id = super.parseStringLiteral(this.state.value);
11156
11159
  } else {
11157
11160
  this.unexpected();
@@ -11190,7 +11193,7 @@ var require_lib = __commonJS({
11190
11193
  const node = this.startNode();
11191
11194
  this.expectContextual(119);
11192
11195
  this.expect(10);
11193
- if (!this.match(133)) {
11196
+ if (!this.match(134)) {
11194
11197
  this.unexpected();
11195
11198
  }
11196
11199
  node.expression = super.parseExprAtom();
@@ -11286,6 +11289,7 @@ var require_lib = __commonJS({
11286
11289
  this.scope.enter(256);
11287
11290
  this.prodParam.enter(0);
11288
11291
  const mod = node;
11292
+ mod.kind = "global";
11289
11293
  mod.global = true;
11290
11294
  mod.id = expr;
11291
11295
  mod.body = this.tsParseModuleBlock();
@@ -11307,15 +11311,17 @@ var require_lib = __commonJS({
11307
11311
  break;
11308
11312
  case "module":
11309
11313
  if (this.tsCheckLineTerminator(next)) {
11310
- if (this.match(133)) {
11314
+ if (this.match(134)) {
11311
11315
  return this.tsParseAmbientExternalModuleDeclaration(node);
11312
11316
  } else if (tokenIsIdentifier(this.state.type)) {
11317
+ node.kind = "module";
11313
11318
  return this.tsParseModuleOrNamespaceDeclaration(node);
11314
11319
  }
11315
11320
  }
11316
11321
  break;
11317
11322
  case "namespace":
11318
11323
  if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
11324
+ node.kind = "namespace";
11319
11325
  return this.tsParseModuleOrNamespaceDeclaration(node);
11320
11326
  }
11321
11327
  break;
@@ -11516,7 +11522,7 @@ var require_lib = __commonJS({
11516
11522
  if (!noCalls && this.eat(10)) {
11517
11523
  const node2 = this.startNodeAt(startLoc);
11518
11524
  node2.callee = base;
11519
- node2.arguments = this.parseCallExpressionArguments(11, false);
11525
+ node2.arguments = this.parseCallExpressionArguments(11);
11520
11526
  this.tsCheckForInvalidTypeCasts(node2.arguments);
11521
11527
  node2.typeParameters = typeArguments;
11522
11528
  if (state2.optionalChainMember) {
@@ -11610,7 +11616,7 @@ var require_lib = __commonJS({
11610
11616
  }
11611
11617
  }
11612
11618
  parseImport(node) {
11613
- if (this.match(133)) {
11619
+ if (this.match(134)) {
11614
11620
  node.importKind = "value";
11615
11621
  return super.parseImport(node);
11616
11622
  }
@@ -11888,7 +11894,7 @@ var require_lib = __commonJS({
11888
11894
  key
11889
11895
  } = node;
11890
11896
  this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, {
11891
- propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
11897
+ propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end))}]`
11892
11898
  });
11893
11899
  }
11894
11900
  return super.parseClassProperty(node);
@@ -11987,7 +11993,7 @@ var require_lib = __commonJS({
11987
11993
  let state2;
11988
11994
  let jsx2;
11989
11995
  let typeCast;
11990
- if (this.hasPlugin("jsx") && (this.match(142) || this.match(47))) {
11996
+ if (this.hasPlugin("jsx") && (this.match(143) || this.match(47))) {
11991
11997
  state2 = this.state.clone();
11992
11998
  jsx2 = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state2);
11993
11999
  if (!jsx2.error)
@@ -12332,7 +12338,7 @@ var require_lib = __commonJS({
12332
12338
  key
12333
12339
  } = method;
12334
12340
  this.raise(TSErrors.AbstractMethodHasImplementation, method, {
12335
- methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
12341
+ methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end))}]`
12336
12342
  });
12337
12343
  }
12338
12344
  }
@@ -12507,13 +12513,13 @@ var require_lib = __commonJS({
12507
12513
  });
12508
12514
  var placeholders = (superClass) => class PlaceholdersParserMixin extends superClass {
12509
12515
  parsePlaceholder(expectedNode) {
12510
- if (this.match(144)) {
12516
+ if (this.match(133)) {
12511
12517
  const node = this.startNode();
12512
12518
  this.next();
12513
12519
  this.assertNoSpace();
12514
12520
  node.name = super.parseIdentifier(true);
12515
12521
  this.assertNoSpace();
12516
- this.expect(144);
12522
+ this.expect(133);
12517
12523
  return this.finishPlaceholder(node, expectedNode);
12518
12524
  }
12519
12525
  }
@@ -12527,7 +12533,7 @@ var require_lib = __commonJS({
12527
12533
  }
12528
12534
  getTokenFromCode(code2) {
12529
12535
  if (code2 === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
12530
- this.finishOp(144, 2);
12536
+ this.finishOp(133, 2);
12531
12537
  } else {
12532
12538
  super.getTokenFromCode(code2);
12533
12539
  }
@@ -12561,7 +12567,7 @@ var require_lib = __commonJS({
12561
12567
  return true;
12562
12568
  }
12563
12569
  const nextToken = this.lookahead();
12564
- if (nextToken.type === 144) {
12570
+ if (nextToken.type === 133) {
12565
12571
  return true;
12566
12572
  }
12567
12573
  return false;
@@ -12600,7 +12606,7 @@ var require_lib = __commonJS({
12600
12606
  const oldStrict = this.state.strict;
12601
12607
  const placeholder = this.parsePlaceholder("Identifier");
12602
12608
  if (placeholder) {
12603
- if (this.match(81) || this.match(144) || this.match(5)) {
12609
+ if (this.match(81) || this.match(133) || this.match(5)) {
12604
12610
  node.id = placeholder;
12605
12611
  } else if (optionalId || !isStatement) {
12606
12612
  node.id = null;
@@ -12637,7 +12643,7 @@ var require_lib = __commonJS({
12637
12643
  if (this.match(65)) {
12638
12644
  const next = this.nextTokenStart();
12639
12645
  if (this.isUnparsedContextual(next, "from")) {
12640
- if (this.input.startsWith(tokenLabelName(144), this.nextTokenStartSince(next + 4))) {
12646
+ if (this.input.startsWith(tokenLabelName(133), this.nextTokenStartSince(next + 4))) {
12641
12647
  return true;
12642
12648
  }
12643
12649
  }
@@ -12688,7 +12694,7 @@ var require_lib = __commonJS({
12688
12694
  return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
12689
12695
  }
12690
12696
  assertNoSpace() {
12691
- if (this.state.start > this.state.lastTokEndLoc.index) {
12697
+ if (this.state.start > this.offsetToSourcePos(this.state.lastTokEndLoc.index)) {
12692
12698
  this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
12693
12699
  }
12694
12700
  }
@@ -12765,8 +12771,8 @@ var require_lib = __commonJS({
12765
12771
  }
12766
12772
  if (pluginsMap.has("moduleAttributes")) {
12767
12773
  {
12768
- if (pluginsMap.has("importAttributes") || pluginsMap.has("importAssertions")) {
12769
- throw new Error("Cannot combine importAssertions, importAttributes and moduleAttributes plugins.");
12774
+ if (pluginsMap.has("deprecatedImportAssert") || pluginsMap.has("importAssertions")) {
12775
+ throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");
12770
12776
  }
12771
12777
  const moduleAttributesVersionPluginOption = pluginsMap.get("moduleAttributes").version;
12772
12778
  if (moduleAttributesVersionPluginOption !== "may-2020") {
@@ -12775,8 +12781,13 @@ var require_lib = __commonJS({
12775
12781
  }
12776
12782
  }
12777
12783
  if (pluginsMap.has("importAssertions")) {
12778
- if (pluginsMap.has("importAttributes")) {
12779
- throw new Error("Cannot combine importAssertions and importAttributes plugins.");
12784
+ if (pluginsMap.has("deprecatedImportAssert")) {
12785
+ throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.");
12786
+ }
12787
+ }
12788
+ if (!pluginsMap.has("deprecatedImportAssert") && pluginsMap.has("importAttributes") && pluginsMap.get("importAttributes").deprecatedAssertSyntax) {
12789
+ {
12790
+ pluginsMap.set("deprecatedImportAssert", {});
12780
12791
  }
12781
12792
  }
12782
12793
  if (pluginsMap.has("recordAndTuple")) {
@@ -12808,38 +12819,52 @@ var require_lib = __commonJS({
12808
12819
  placeholders
12809
12820
  };
12810
12821
  var mixinPluginNames = Object.keys(mixinPlugins);
12811
- var defaultOptions = {
12812
- sourceType: "script",
12813
- sourceFilename: void 0,
12814
- startColumn: 0,
12815
- startLine: 1,
12816
- allowAwaitOutsideFunction: false,
12817
- allowReturnOutsideFunction: false,
12818
- allowNewTargetOutsideFunction: false,
12819
- allowImportExportEverywhere: false,
12820
- allowSuperOutsideMethod: false,
12821
- allowUndeclaredExports: false,
12822
- plugins: [],
12823
- strictMode: null,
12824
- ranges: false,
12825
- tokens: false,
12826
- createImportExpressions: false,
12827
- createParenthesizedExpressions: false,
12828
- errorRecovery: false,
12829
- attachComment: true,
12830
- annexB: true
12831
- };
12822
+ function createDefaultOptions() {
12823
+ return {
12824
+ sourceType: "script",
12825
+ sourceFilename: void 0,
12826
+ startIndex: 0,
12827
+ startColumn: 0,
12828
+ startLine: 1,
12829
+ allowAwaitOutsideFunction: false,
12830
+ allowReturnOutsideFunction: false,
12831
+ allowNewTargetOutsideFunction: false,
12832
+ allowImportExportEverywhere: false,
12833
+ allowSuperOutsideMethod: false,
12834
+ allowUndeclaredExports: false,
12835
+ plugins: [],
12836
+ strictMode: null,
12837
+ ranges: false,
12838
+ tokens: false,
12839
+ createImportExpressions: false,
12840
+ createParenthesizedExpressions: false,
12841
+ errorRecovery: false,
12842
+ attachComment: true,
12843
+ annexB: true
12844
+ };
12845
+ }
12832
12846
  function getOptions(opts) {
12847
+ const options = createDefaultOptions();
12833
12848
  if (opts == null) {
12834
- return Object.assign({}, defaultOptions);
12849
+ return options;
12835
12850
  }
12836
12851
  if (opts.annexB != null && opts.annexB !== false) {
12837
12852
  throw new Error("The `annexB` option can only be set to `false`.");
12838
12853
  }
12839
- const options = {};
12840
- for (const key of Object.keys(defaultOptions)) {
12841
- var _opts$key;
12842
- options[key] = (_opts$key = opts[key]) != null ? _opts$key : defaultOptions[key];
12854
+ for (const key of Object.keys(options)) {
12855
+ if (opts[key] != null)
12856
+ options[key] = opts[key];
12857
+ }
12858
+ if (options.startLine === 1) {
12859
+ if (opts.startIndex == null && options.startColumn > 0) {
12860
+ options.startIndex = options.startColumn;
12861
+ } else if (opts.startColumn == null && options.startIndex > 0) {
12862
+ options.startColumn = options.startIndex;
12863
+ }
12864
+ } else if (opts.startColumn == null || opts.startIndex == null) {
12865
+ if (opts.startIndex != null) {
12866
+ throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
12867
+ }
12843
12868
  }
12844
12869
  return options;
12845
12870
  }
@@ -12868,13 +12893,13 @@ var require_lib = __commonJS({
12868
12893
  }
12869
12894
  }
12870
12895
  shouldExitDescending(expr, potentialArrowAt) {
12871
- return expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt;
12896
+ return expr.type === "ArrowFunctionExpression" && this.offsetToSourcePos(expr.start) === potentialArrowAt;
12872
12897
  }
12873
12898
  getExpression() {
12874
12899
  this.enterInitialScopes();
12875
12900
  this.nextToken();
12876
12901
  const expr = this.parseExpression();
12877
- if (!this.match(139)) {
12902
+ if (!this.match(140)) {
12878
12903
  this.unexpected();
12879
12904
  }
12880
12905
  this.finalizeRemainingComments();
@@ -12994,7 +13019,7 @@ var require_lib = __commonJS({
12994
13019
  return expr;
12995
13020
  }
12996
13021
  parseMaybeUnaryOrPrivate(refExpressionErrors) {
12997
- return this.match(138) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
13022
+ return this.match(139) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
12998
13023
  }
12999
13024
  parseExprOps(refExpressionErrors) {
13000
13025
  const startLoc = this.state.startLoc;
@@ -13235,7 +13260,7 @@ var require_lib = __commonJS({
13235
13260
  if (computed12) {
13236
13261
  node.property = this.parseExpression();
13237
13262
  this.expect(3);
13238
- } else if (this.match(138)) {
13263
+ } else if (this.match(139)) {
13239
13264
  if (base.type === "Super") {
13240
13265
  this.raise(Errors.SuperPrivateField, startLoc);
13241
13266
  }
@@ -13280,7 +13305,7 @@ var require_lib = __commonJS({
13280
13305
  if (optional) {
13281
13306
  node.arguments = this.parseCallExpressionArguments(11);
13282
13307
  } else {
13283
- node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super", node, refExpressionErrors);
13308
+ node.arguments = this.parseCallExpressionArguments(11, base.type !== "Super", node, refExpressionErrors);
13284
13309
  }
13285
13310
  let finishedNode = this.finishCallExpression(node, optionalChainMember);
13286
13311
  if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
@@ -13312,19 +13337,12 @@ var require_lib = __commonJS({
13312
13337
  return this.finishNode(node, "TaggedTemplateExpression");
13313
13338
  }
13314
13339
  atPossibleAsyncArrow(base) {
13315
- return base.type === "Identifier" && base.name === "async" && this.state.lastTokEndLoc.index === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && base.start === this.state.potentialArrowAt;
13340
+ return base.type === "Identifier" && base.name === "async" && this.state.lastTokEndLoc.index === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.offsetToSourcePos(base.start) === this.state.potentialArrowAt;
13316
13341
  }
13317
13342
  finishCallExpression(node, optional) {
13318
13343
  if (node.callee.type === "Import") {
13319
- if (node.arguments.length === 2) {
13320
- if (!(this.hasPlugin("moduleAttributes") || this.hasPlugin("importAssertions"))) {
13321
- this.expectPlugin("importAttributes");
13322
- }
13323
- }
13324
13344
  if (node.arguments.length === 0 || node.arguments.length > 2) {
13325
- this.raise(Errors.ImportCallArity, node, {
13326
- maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1
13327
- });
13345
+ this.raise(Errors.ImportCallArity, node);
13328
13346
  } else {
13329
13347
  for (const arg of node.arguments) {
13330
13348
  if (arg.type === "SpreadElement") {
@@ -13335,7 +13353,7 @@ var require_lib = __commonJS({
13335
13353
  }
13336
13354
  return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
13337
13355
  }
13338
- parseCallExpressionArguments(close, dynamicImport, allowPlaceholder, nodeForExtra, refExpressionErrors) {
13356
+ parseCallExpressionArguments(close, allowPlaceholder, nodeForExtra, refExpressionErrors) {
13339
13357
  const elts = [];
13340
13358
  let first = true;
13341
13359
  const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
@@ -13346,9 +13364,6 @@ var require_lib = __commonJS({
13346
13364
  } else {
13347
13365
  this.expect(12);
13348
13366
  if (this.match(close)) {
13349
- if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
13350
- this.raise(Errors.ImportCallArgumentTrailingComma, this.state.lastTokStartLoc);
13351
- }
13352
13367
  if (nodeForExtra) {
13353
13368
  this.addTrailingCommaExtraToNode(nodeForExtra);
13354
13369
  }
@@ -13418,11 +13433,11 @@ var require_lib = __commonJS({
13418
13433
  this.readRegexp();
13419
13434
  return this.parseRegExpLiteral(this.state.value);
13420
13435
  }
13421
- case 134:
13422
- return this.parseNumericLiteral(this.state.value);
13423
13436
  case 135:
13437
+ return this.parseNumericLiteral(this.state.value);
13438
+ case 136:
13424
13439
  return this.parseBigIntLiteral(this.state.value);
13425
- case 133:
13440
+ case 134:
13426
13441
  return this.parseStringLiteral(this.state.value);
13427
13442
  case 84:
13428
13443
  return this.parseNullLiteral();
@@ -13470,7 +13485,7 @@ var require_lib = __commonJS({
13470
13485
  throw this.raise(Errors.UnsupportedBind, callee);
13471
13486
  }
13472
13487
  }
13473
- case 138: {
13488
+ case 139: {
13474
13489
  this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, {
13475
13490
  identifierName: this.state.value
13476
13491
  });
@@ -13506,7 +13521,7 @@ var require_lib = __commonJS({
13506
13521
  break;
13507
13522
  }
13508
13523
  default:
13509
- if (type === 136) {
13524
+ if (type === 137) {
13510
13525
  return this.parseDecimalLiteral(this.state.value);
13511
13526
  }
13512
13527
  if (tokenIsIdentifier(type)) {
@@ -13695,7 +13710,7 @@ var require_lib = __commonJS({
13695
13710
  }
13696
13711
  parseLiteralAtNode(value, type, node) {
13697
13712
  this.addExtra(node, "rawValue", value);
13698
- this.addExtra(node, "raw", this.input.slice(node.start, this.state.end));
13713
+ this.addExtra(node, "raw", this.input.slice(this.offsetToSourcePos(node.start), this.state.end));
13699
13714
  node.value = value;
13700
13715
  this.next();
13701
13716
  return this.finishNode(node, type);
@@ -13718,7 +13733,7 @@ var require_lib = __commonJS({
13718
13733
  }
13719
13734
  parseRegExpLiteral(value) {
13720
13735
  const node = this.startNode();
13721
- this.addExtra(node, "raw", this.input.slice(node.start, this.state.end));
13736
+ this.addExtra(node, "raw", this.input.slice(this.offsetToSourcePos(node.start), this.state.end));
13722
13737
  node.pattern = value.pattern;
13723
13738
  node.flags = value.flags;
13724
13739
  this.next();
@@ -14094,16 +14109,16 @@ var require_lib = __commonJS({
14094
14109
  key = this.parseIdentifier(true);
14095
14110
  } else {
14096
14111
  switch (type) {
14097
- case 134:
14112
+ case 135:
14098
14113
  key = this.parseNumericLiteral(value);
14099
14114
  break;
14100
- case 133:
14115
+ case 134:
14101
14116
  key = this.parseStringLiteral(value);
14102
14117
  break;
14103
- case 135:
14118
+ case 136:
14104
14119
  key = this.parseBigIntLiteral(value);
14105
14120
  break;
14106
- case 138: {
14121
+ case 139: {
14107
14122
  const privateKeyLoc = this.state.startLoc;
14108
14123
  if (refExpressionErrors != null) {
14109
14124
  if (refExpressionErrors.privateKeyLoc === null) {
@@ -14116,7 +14131,7 @@ var require_lib = __commonJS({
14116
14131
  break;
14117
14132
  }
14118
14133
  default:
14119
- if (type === 136) {
14134
+ if (type === 137) {
14120
14135
  key = this.parseDecimalLiteral(value);
14121
14136
  break;
14122
14137
  }
@@ -14124,7 +14139,7 @@ var require_lib = __commonJS({
14124
14139
  }
14125
14140
  }
14126
14141
  prop.key = key;
14127
- if (type !== 138) {
14142
+ if (type !== 139) {
14128
14143
  prop.computed = false;
14129
14144
  }
14130
14145
  }
@@ -14380,7 +14395,7 @@ var require_lib = __commonJS({
14380
14395
  const {
14381
14396
  type
14382
14397
  } = this.state;
14383
- return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 102 && !this.state.containsEsc || type === 137 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
14398
+ return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 102 && !this.state.containsEsc || type === 138 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
14384
14399
  }
14385
14400
  parseYield() {
14386
14401
  const node = this.startNode();
@@ -14392,7 +14407,7 @@ var require_lib = __commonJS({
14392
14407
  delegating = this.eat(55);
14393
14408
  switch (this.state.type) {
14394
14409
  case 13:
14395
- case 139:
14410
+ case 140:
14396
14411
  case 8:
14397
14412
  case 11:
14398
14413
  case 3:
@@ -14412,16 +14427,16 @@ var require_lib = __commonJS({
14412
14427
  parseImportCall(node) {
14413
14428
  this.next();
14414
14429
  node.source = this.parseMaybeAssignAllowIn();
14415
- if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
14416
- node.options = null;
14417
- }
14430
+ node.options = null;
14418
14431
  if (this.eat(12)) {
14419
- if (!(this.hasPlugin("moduleAttributes") || this.hasPlugin("importAssertions"))) {
14420
- this.expectPlugin("importAttributes");
14421
- }
14422
14432
  if (!this.match(11)) {
14423
14433
  node.options = this.parseMaybeAssignAllowIn();
14424
- this.eat(12);
14434
+ if (this.eat(12) && !this.match(11)) {
14435
+ do {
14436
+ this.parseMaybeAssignAllowIn();
14437
+ } while (this.eat(12) && !this.match(11));
14438
+ this.raise(Errors.ImportCallArity, node);
14439
+ }
14425
14440
  }
14426
14441
  }
14427
14442
  this.expect(11);
@@ -14578,7 +14593,7 @@ var require_lib = __commonJS({
14578
14593
  };
14579
14594
  var loneSurrogate = /[\uD800-\uDFFF]/u;
14580
14595
  var keywordRelationalOperator = /in(?:stanceof)?/y;
14581
- function babel7CompatTokens(tokens, input) {
14596
+ function babel7CompatTokens(tokens, input, startIndex) {
14582
14597
  for (let i = 0; i < tokens.length; i++) {
14583
14598
  const token = tokens[i];
14584
14599
  const {
@@ -14586,7 +14601,7 @@ var require_lib = __commonJS({
14586
14601
  } = token;
14587
14602
  if (typeof type === "number") {
14588
14603
  {
14589
- if (type === 138) {
14604
+ if (type === 139) {
14590
14605
  const {
14591
14606
  loc,
14592
14607
  start,
@@ -14623,7 +14638,7 @@ var require_lib = __commonJS({
14623
14638
  const backquoteEnd = start + 1;
14624
14639
  const backquoteEndLoc = createPositionWithColumnOffset(loc.start, 1);
14625
14640
  let startToken;
14626
- if (input.charCodeAt(start) === 96) {
14641
+ if (input.charCodeAt(start - startIndex) === 96) {
14627
14642
  startToken = new Token({
14628
14643
  type: getExportedToken(22),
14629
14644
  value: "`",
@@ -14690,11 +14705,11 @@ var require_lib = __commonJS({
14690
14705
  file.program = this.parseProgram(program);
14691
14706
  file.comments = this.comments;
14692
14707
  if (this.options.tokens) {
14693
- file.tokens = babel7CompatTokens(this.tokens, this.input);
14708
+ file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
14694
14709
  }
14695
14710
  return this.finishNode(file, "File");
14696
14711
  }
14697
- parseProgram(program, end = 139, sourceType = this.options.sourceType) {
14712
+ parseProgram(program, end = 140, sourceType = this.options.sourceType) {
14698
14713
  program.sourceType = sourceType;
14699
14714
  program.interpreter = this.parseInterpreterDirective();
14700
14715
  this.parseBlockBody(program, true, true, end);
@@ -14709,7 +14724,7 @@ var require_lib = __commonJS({
14709
14724
  this.addExtra(program, "topLevelAwait", this.state.hasTopLevelAwait);
14710
14725
  }
14711
14726
  let finishedProgram;
14712
- if (end === 139) {
14727
+ if (end === 140) {
14713
14728
  finishedProgram = this.finishNode(program, "Program");
14714
14729
  } else {
14715
14730
  finishedProgram = this.finishNodeAt(program, "Program", createPositionWithColumnOffset(this.state.startLoc, -1));
@@ -14723,7 +14738,7 @@ var require_lib = __commonJS({
14723
14738
  delete directive.expression;
14724
14739
  const directiveLiteral = directive.value;
14725
14740
  const expressionValue = directiveLiteral.value;
14726
- const raw = this.input.slice(directiveLiteral.start, directiveLiteral.end);
14741
+ const raw = this.input.slice(this.offsetToSourcePos(directiveLiteral.start), this.offsetToSourcePos(directiveLiteral.end));
14727
14742
  const val = directiveLiteral.value = raw.slice(1, -1);
14728
14743
  this.addExtra(directiveLiteral, "raw", raw);
14729
14744
  this.addExtra(directiveLiteral, "rawValue", val);
@@ -15029,7 +15044,7 @@ var require_lib = __commonJS({
15029
15044
  while (this.eat(16)) {
15030
15045
  const node2 = this.startNodeAt(startLoc);
15031
15046
  node2.object = expr;
15032
- if (this.match(138)) {
15047
+ if (this.match(139)) {
15033
15048
  this.classScope.usePrivateName(this.state.value, this.state.startLoc);
15034
15049
  node2.property = this.parsePrivateName();
15035
15050
  } else {
@@ -15049,7 +15064,7 @@ var require_lib = __commonJS({
15049
15064
  if (this.eat(10)) {
15050
15065
  const node = this.startNodeAtNode(expr);
15051
15066
  node.callee = expr;
15052
- node.arguments = this.parseCallExpressionArguments(11, false);
15067
+ node.arguments = this.parseCallExpressionArguments(11);
15053
15068
  this.toReferencedList(node.arguments);
15054
15069
  return this.finishNode(node, "CallExpression");
15055
15070
  }
@@ -15329,7 +15344,7 @@ var require_lib = __commonJS({
15329
15344
  for (let i = this.state.labels.length - 1; i >= 0; i--) {
15330
15345
  const label = this.state.labels[i];
15331
15346
  if (label.statementStart === node.start) {
15332
- label.statementStart = this.state.start;
15347
+ label.statementStart = this.sourceToOffsetPos(this.state.start);
15333
15348
  label.kind = kind;
15334
15349
  } else {
15335
15350
  break;
@@ -15338,7 +15353,7 @@ var require_lib = __commonJS({
15338
15353
  this.state.labels.push({
15339
15354
  name: maybeName,
15340
15355
  kind,
15341
- statementStart: this.state.start
15356
+ statementStart: this.sourceToOffsetPos(this.state.start)
15342
15357
  });
15343
15358
  node.body = flags & 8 ? this.parseStatementOrSloppyAnnexBFunctionDeclaration(true) : this.parseStatement();
15344
15359
  this.state.labels.pop();
@@ -15638,7 +15653,7 @@ var require_lib = __commonJS({
15638
15653
  this.parsePropertyNamePrefixOperator(member);
15639
15654
  if (this.eat(55)) {
15640
15655
  method.kind = "method";
15641
- const isPrivateName = this.match(138);
15656
+ const isPrivateName = this.match(139);
15642
15657
  this.parseClassElementName(method);
15643
15658
  if (isPrivateName) {
15644
15659
  this.pushClassPrivateMethod(classBody, privateMethod, true, false);
@@ -15689,7 +15704,7 @@ var require_lib = __commonJS({
15689
15704
  this.unexpected(maybeQuestionTokenStartLoc);
15690
15705
  }
15691
15706
  method.kind = "method";
15692
- const isPrivate2 = this.match(138);
15707
+ const isPrivate2 = this.match(139);
15693
15708
  this.parseClassElementName(method);
15694
15709
  this.parsePostMemberNameModifiers(publicMember);
15695
15710
  if (isPrivate2) {
@@ -15703,7 +15718,7 @@ var require_lib = __commonJS({
15703
15718
  } else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(55) && this.isLineTerminator())) {
15704
15719
  this.resetPreviousNodeTrailingComments(key);
15705
15720
  method.kind = maybeContextualKw;
15706
- const isPrivate2 = this.match(138);
15721
+ const isPrivate2 = this.match(139);
15707
15722
  this.parseClassElementName(publicMethod);
15708
15723
  if (isPrivate2) {
15709
15724
  this.pushClassPrivateMethod(classBody, privateMethod, false, false);
@@ -15717,7 +15732,7 @@ var require_lib = __commonJS({
15717
15732
  } else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
15718
15733
  this.expectPlugin("decoratorAutoAccessors");
15719
15734
  this.resetPreviousNodeTrailingComments(key);
15720
- const isPrivate2 = this.match(138);
15735
+ const isPrivate2 = this.match(139);
15721
15736
  this.parseClassElementName(publicProp);
15722
15737
  this.pushClassAccessorProperty(classBody, accessorProp, isPrivate2);
15723
15738
  } else if (this.isLineTerminator()) {
@@ -15735,10 +15750,10 @@ var require_lib = __commonJS({
15735
15750
  type,
15736
15751
  value
15737
15752
  } = this.state;
15738
- if ((type === 132 || type === 133) && member.static && value === "prototype") {
15753
+ if ((type === 132 || type === 134) && member.static && value === "prototype") {
15739
15754
  this.raise(Errors.StaticPrototype, this.state.startLoc);
15740
15755
  }
15741
- if (type === 138) {
15756
+ if (type === 139) {
15742
15757
  if (value === "constructor") {
15743
15758
  this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
15744
15759
  }
@@ -16155,7 +16170,7 @@ var require_lib = __commonJS({
16155
16170
  break;
16156
16171
  }
16157
16172
  const isMaybeTypeOnly = this.isContextual(130);
16158
- const isString = this.match(133);
16173
+ const isString = this.match(134);
16159
16174
  const node = this.startNode();
16160
16175
  node.local = this.parseModuleExportName();
16161
16176
  nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
@@ -16173,7 +16188,7 @@ var require_lib = __commonJS({
16173
16188
  return this.finishNode(node, "ExportSpecifier");
16174
16189
  }
16175
16190
  parseModuleExportName() {
16176
- if (this.match(133)) {
16191
+ if (this.match(134)) {
16177
16192
  const result = this.parseStringLiteral(this.state.value);
16178
16193
  const surrogate = loneSurrogate.exec(result.value);
16179
16194
  if (surrogate) {
@@ -16293,7 +16308,7 @@ var require_lib = __commonJS({
16293
16308
  return tokenIsIdentifier(type) ? type !== 98 || this.lookaheadCharCode() === 102 : type !== 12;
16294
16309
  }
16295
16310
  parseImport(node) {
16296
- if (this.match(133)) {
16311
+ if (this.match(134)) {
16297
16312
  return this.parseImportSourceAndAttributes(node);
16298
16313
  }
16299
16314
  return this.parseImportSpecifiersAndAfter(node, this.parseMaybeImportPhase(node, false));
@@ -16319,7 +16334,7 @@ var require_lib = __commonJS({
16319
16334
  return this.finishNode(node, "ImportDeclaration");
16320
16335
  }
16321
16336
  parseImportSource() {
16322
- if (!this.match(133))
16337
+ if (!this.match(134))
16323
16338
  this.unexpected();
16324
16339
  return this.parseExprAtom();
16325
16340
  }
@@ -16349,13 +16364,13 @@ var require_lib = __commonJS({
16349
16364
  });
16350
16365
  }
16351
16366
  attrNames.add(keyName);
16352
- if (this.match(133)) {
16367
+ if (this.match(134)) {
16353
16368
  node.key = this.parseStringLiteral(keyName);
16354
16369
  } else {
16355
16370
  node.key = this.parseIdentifier(true);
16356
16371
  }
16357
16372
  this.expect(14);
16358
- if (!this.match(133)) {
16373
+ if (!this.match(134)) {
16359
16374
  throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
16360
16375
  }
16361
16376
  node.value = this.parseStringLiteral(this.state.value);
@@ -16380,7 +16395,7 @@ var require_lib = __commonJS({
16380
16395
  }
16381
16396
  attributes.add(node.key.name);
16382
16397
  this.expect(14);
16383
- if (!this.match(133)) {
16398
+ if (!this.match(134)) {
16384
16399
  throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
16385
16400
  }
16386
16401
  node.value = this.parseStringLiteral(this.state.value);
@@ -16401,32 +16416,22 @@ var require_lib = __commonJS({
16401
16416
  if (this.hasPlugin("moduleAttributes")) {
16402
16417
  attributes = this.parseModuleAttributes();
16403
16418
  } else {
16404
- if (!this.hasPlugin("importAssertions")) {
16405
- this.expectPlugin("importAttributes");
16406
- }
16407
16419
  attributes = this.parseImportAttributes();
16408
16420
  }
16409
16421
  {
16410
16422
  useWith = true;
16411
16423
  }
16412
16424
  } else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
16413
- if (this.hasPlugin("importAttributes")) {
16414
- if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) {
16415
- this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
16416
- }
16425
+ if (!this.hasPlugin("deprecatedImportAssert") && !this.hasPlugin("importAssertions")) {
16426
+ this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
16427
+ }
16428
+ if (!this.hasPlugin("importAssertions")) {
16417
16429
  this.addExtra(node, "deprecatedAssertSyntax", true);
16418
- } else {
16419
- this.expectOnePlugin(["importAttributes", "importAssertions"]);
16420
16430
  }
16421
16431
  this.next();
16422
16432
  attributes = this.parseImportAttributes();
16423
- } else if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
16424
- attributes = [];
16425
16433
  } else {
16426
- if (this.hasPlugin("moduleAttributes")) {
16427
- attributes = [];
16428
- } else
16429
- return;
16434
+ attributes = [];
16430
16435
  }
16431
16436
  if (!useWith && this.hasPlugin("importAssertions")) {
16432
16437
  node.assertions = attributes;
@@ -16471,7 +16476,7 @@ var require_lib = __commonJS({
16471
16476
  break;
16472
16477
  }
16473
16478
  const specifier = this.startNode();
16474
- const importedIsString = this.match(133);
16479
+ const importedIsString = this.match(134);
16475
16480
  const isMaybeTypeOnly = this.isContextual(130);
16476
16481
  specifier.imported = this.parseModuleExportName();
16477
16482
  const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly, void 0);
@@ -16509,6 +16514,7 @@ var require_lib = __commonJS({
16509
16514
  this.initializeScopes();
16510
16515
  this.plugins = pluginsMap;
16511
16516
  this.filename = options.sourceFilename;
16517
+ this.startIndex = options.startIndex;
16512
16518
  }
16513
16519
  getScopeHandler() {
16514
16520
  return ScopeHandler;
@@ -56592,8 +56598,8 @@ function useDraggableData(props) {
56592
56598
  props.dragStartFn(evt, data);
56593
56599
  };
56594
56600
  const handleDrag = (evt, data) => {
56595
- x.value = Number(data.x.toFixed(2));
56596
- y.value = Number(data.y.toFixed(2));
56601
+ x.value = Math.round(data.x);
56602
+ y.value = Math.round(data.y);
56597
56603
  deltaX.value = data.deltaX;
56598
56604
  deltaY.value = data.deltaY;
56599
56605
  props.dragFn(evt, data);
@@ -57933,22 +57939,6 @@ var freeDomProps = {
57933
57939
  default: void 0
57934
57940
  },
57935
57941
  keyboard: Boolean,
57936
- x: {
57937
- type: Number,
57938
- default: 0
57939
- },
57940
- y: {
57941
- type: Number,
57942
- default: 0
57943
- },
57944
- width: {
57945
- type: Number,
57946
- default: void 0
57947
- },
57948
- height: {
57949
- type: Number,
57950
- default: void 0
57951
- },
57952
57942
  handle: {
57953
57943
  type: String,
57954
57944
  default: void 0
@@ -58141,10 +58131,10 @@ var freeDom = (0, import_vue_demi17.defineComponent)({
58141
58131
  const isValid = sceneContext.check?.({ x: _x, y: _y, width: w, height: h7 });
58142
58132
  if (!isValid)
58143
58133
  return;
58144
- width.value = Number(w.toFixed(2));
58145
- height.value = Number(h7.toFixed(2));
58146
- x.value = Number(_x.toFixed(2));
58147
- y.value = Number(_y.toFixed(2));
58134
+ width.value = Math.round(w);
58135
+ height.value = Math.round(h7);
58136
+ x.value = Math.round(_x);
58137
+ y.value = Math.round(_y);
58148
58138
  props.resizeFn(evt, { node, width: w, height: h7, handle: axis });
58149
58139
  sceneContext.emit("move", sceneContext.manualDiff.value ? !evt.shiftKey : evt.shiftKey);
58150
58140
  };
@@ -58295,6 +58285,7 @@ var freeDomWrapProps = {
58295
58285
  type: Number,
58296
58286
  default: 2
58297
58287
  },
58288
+ autoExpand: [Boolean, Object],
58298
58289
  manualDiff: Boolean,
58299
58290
  showLine: {
58300
58291
  type: Boolean,
@@ -58307,6 +58298,14 @@ var freeDomWrapProps = {
58307
58298
  keyboard: Boolean,
58308
58299
  disabledBatch: Boolean,
58309
58300
  handle: freeDomProps.handle,
58301
+ width: {
58302
+ type: Number,
58303
+ default: void 0
58304
+ },
58305
+ height: {
58306
+ type: Number,
58307
+ default: void 0
58308
+ },
58310
58309
  minWidth: {
58311
58310
  type: Number,
58312
58311
  default: void 0
@@ -58325,32 +58324,63 @@ var freeDomWrapProps = {
58325
58324
  var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
58326
58325
  name: "FreeDomWrap",
58327
58326
  props: freeDomWrapProps,
58328
- emits: ["batch-select", "drop"],
58327
+ emits: ["batch-select", "drop", "update:width", "update:height"],
58329
58328
  setup(props, { emit }) {
58330
58329
  const eventBus = useEventBus();
58331
58330
  const nodes = (0, import_vue_demi18.ref)([]);
58332
58331
  const history = useOperateHistory(nodes);
58333
- const width = (0, import_vue_demi18.ref)(0);
58334
- const height = (0, import_vue_demi18.ref)(0);
58332
+ const width = (0, import_vue_demi18.ref)(props.width);
58333
+ const height = (0, import_vue_demi18.ref)(props.height);
58335
58334
  const rectRef = (0, import_vue_demi18.shallowRef)();
58336
58335
  const wrapRect = useElementBounding(rectRef);
58336
+ const wrapStyle = (0, import_vue_demi18.computed)(() => ({
58337
+ height: height.value + "px",
58338
+ width: width.value + "px"
58339
+ }));
58337
58340
  (0, import_vue_demi18.watch)([
58338
58341
  wrapRect.width,
58339
58342
  wrapRect.height,
58340
58343
  () => nodes.value.length
58341
58344
  ], ([w, h7]) => {
58342
58345
  debug2("update size");
58343
- width.value = w;
58344
- height.value = h7;
58345
58346
  if (!w || !h7)
58346
58347
  return;
58348
+ width.value = w;
58349
+ height.value = h7;
58350
+ emit("update:width", w);
58351
+ emit("update:height", h7);
58347
58352
  runCorrect();
58348
- });
58353
+ }, { immediate: true });
58349
58354
  const selectedNodes = (0, import_vue_demi18.computed)(() => nodes.value.filter((node) => node.node.selected));
58355
+ const expandSize = (node) => {
58356
+ let expandWidth = props.autoExpand === true;
58357
+ let expandHeight = props.autoExpand === true;
58358
+ if (typeof props.autoExpand === "object") {
58359
+ expandWidth = !!props.autoExpand.width;
58360
+ expandHeight = !!props.autoExpand.height;
58361
+ }
58362
+ if (!expandWidth && !expandHeight)
58363
+ return;
58364
+ const {
58365
+ x = 0,
58366
+ width: nw = 0,
58367
+ y = 0,
58368
+ height: nh = 0
58369
+ } = node.node._rect;
58370
+ if (expandWidth && width.value && x + nw >= width.value) {
58371
+ width.value += 1;
58372
+ }
58373
+ if (expandHeight && height.value && y + nh >= height.value) {
58374
+ height.value += 1;
58375
+ }
58376
+ };
58350
58377
  eventBus.on("move", (nodeId) => {
58351
58378
  const mainNode = selectedNodes.value.find((node) => node.uuid === nodeId);
58352
58379
  if (!mainNode)
58353
58380
  return;
58381
+ if (props.autoExpand) {
58382
+ expandSize(mainNode);
58383
+ }
58354
58384
  const { deltaX, deltaY } = mainNode.node._rect;
58355
58385
  selectedNodes.value.forEach((node) => {
58356
58386
  if (node.uuid === nodeId)
@@ -58393,6 +58423,8 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
58393
58423
  nodes.value.splice(index, 1);
58394
58424
  }
58395
58425
  function checkValid(pos) {
58426
+ if (!width.value || !height.value)
58427
+ return false;
58396
58428
  const { x, y, width: w, height: h7 } = pos;
58397
58429
  return x >= 0 && x + w <= width.value && y >= 0 && y + h7 <= height.value;
58398
58430
  }
@@ -58401,17 +58433,19 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
58401
58433
  let y = Math.max(pos.y, 0);
58402
58434
  let w = pos.width;
58403
58435
  let h7 = pos.height;
58404
- if (pos.x + pos.width > width.value) {
58405
- x = width.value - pos.width;
58436
+ const containerWidth = width.value || 0;
58437
+ const containerHeight = height.value || 0;
58438
+ if (pos.x + pos.width > containerWidth) {
58439
+ x = containerWidth - pos.width;
58406
58440
  if (x < 0) {
58407
- w = Math.max(width.value, minWidth);
58441
+ w = Math.max(containerWidth, minWidth);
58408
58442
  x = 0;
58409
58443
  }
58410
58444
  }
58411
- if (pos.y + pos.height > height.value) {
58412
- y = height.value - pos.height;
58445
+ if (pos.y + pos.height > containerHeight) {
58446
+ y = containerHeight - pos.height;
58413
58447
  if (y < 0) {
58414
- h7 = Math.max(height.value, minHeight);
58448
+ h7 = Math.max(containerHeight, minHeight);
58415
58449
  y = 0;
58416
58450
  }
58417
58451
  }
@@ -58449,7 +58483,8 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
58449
58483
  rectRef,
58450
58484
  selecting,
58451
58485
  mask,
58452
- history
58486
+ history,
58487
+ wrapStyle
58453
58488
  };
58454
58489
  },
58455
58490
  render() {
@@ -58460,24 +58495,30 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
58460
58495
  slots,
58461
58496
  marklineComp
58462
58497
  ];
58463
- return createRender(
58498
+ const main = createRender(
58464
58499
  "section",
58465
58500
  {
58466
58501
  ref: "rectRef",
58467
- class: "vv-free-dom--scene"
58468
- },
58502
+ class: "vv-free-dom--scene",
58503
+ style: this.wrapStyle
58504
+ }
58505
+ )(slotList);
58506
+ const wrap = (comp) => createRender(
58507
+ "section",
58508
+ {},
58469
58509
  {},
58470
58510
  {
58511
+ onMousedown: this.mask.handleMousedown,
58512
+ onMousemove: this.mask.handleMousemove,
58471
58513
  ondrop: (evt) => {
58472
58514
  this.$emit("drop", evt);
58473
58515
  },
58474
58516
  ondragover: (evt) => {
58475
58517
  evt.preventDefault();
58476
- },
58477
- onMousedown: this.mask.handleMousedown,
58478
- onMousemove: this.mask.handleMousemove
58518
+ }
58479
58519
  }
58480
- )(slotList);
58520
+ )(comp);
58521
+ return wrap(main);
58481
58522
  }
58482
58523
  });
58483
58524