@arcgis/arcade-languageservice 5.1.0-next.9 → 5.1.0-next.90

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.d.ts CHANGED
@@ -152,7 +152,7 @@ declare interface CallExpression extends NodeBase<typeof NodeTypes.CallExpressio
152
152
  * Example: foo(1, 2, 3)
153
153
  * The callee is foo.
154
154
  */
155
- callee: Identifier | MemberExpression | SafeMemberExpression;
155
+ callee: Expression;
156
156
  /**
157
157
  * The arguments of the call expression.
158
158
  * Example: foo(1, 2, 3)
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { CompletionItemKind as g, InsertTextFormat as B, InsertTextMode as S, DiagnosticSeverity as A } from "vscode-languageserver-types";
1
+ import { CompletionItemKind as x, InsertTextFormat as B, InsertTextMode as S, DiagnosticSeverity as A } from "vscode-languageserver-types";
2
2
  import { DiagnosticSeverity as fi } from "vscode-languageserver-types";
3
- import { isDictionaryVariable as Je, isValueVariable as Ee, ApiService as Qe } from "@arcgis/languages-api-utils";
3
+ import { isDictionaryVariable as Ge, isValueVariable as Ee, ApiService as Je } from "@arcgis/languages-api-utils";
4
4
  const V = {
5
5
  False: "false",
6
6
  Null: "null",
@@ -58,7 +58,7 @@ const V = {
58
58
  VariableDeclaration: "VariableDeclaration",
59
59
  VariableDeclarator: "VariableDeclarator",
60
60
  WhileStatement: "WhileStatement"
61
- }, ue = ["++", "--"], Ne = ["-", "+", "!", "~"], Me = ["=", "/=", "*=", "%=", "+=", "-="], Ue = ["||", "&&"], Ze = [
61
+ }, ue = ["++", "--"], Ne = ["-", "+", "!", "~"], Me = ["=", "/=", "*=", "%=", "+=", "-="], Ue = ["||", "&&"], Qe = [
62
62
  "|",
63
63
  "&",
64
64
  ">>",
@@ -188,22 +188,22 @@ class z extends Error {
188
188
  );
189
189
  }
190
190
  }
191
- function Xe(n) {
191
+ function Ze(n) {
192
192
  return !!n && typeof n == "object" && "type" in n && n.type === u.Program;
193
193
  }
194
- function I(n) {
194
+ function b(n) {
195
195
  return !!n && typeof n == "object" && "type" in n && n.type === u.BlockStatement;
196
196
  }
197
- function Ye(n) {
197
+ function Xe(n) {
198
198
  return !!n && typeof n == "object" && "type" in n && n.type === u.BlockComment;
199
199
  }
200
200
  function pe(n) {
201
201
  return !!n && typeof n == "object" && "type" in n && n.type === u.EmptyStatement;
202
202
  }
203
- function et(n) {
203
+ function Ye(n) {
204
204
  return !!n && typeof n == "object" && "type" in n && n.type === u.ExpressionStatement;
205
205
  }
206
- function xe(n) {
206
+ function ge(n) {
207
207
  return !!n && typeof n == "object" && "type" in n && n.type === u.FunctionDeclaration;
208
208
  }
209
209
  function ae(n) {
@@ -218,7 +218,7 @@ function J(n) {
218
218
  function oe(n) {
219
219
  return !!n && typeof n == "object" && "type" in n && n.type === u.BinaryExpression;
220
220
  }
221
- function b(n) {
221
+ function I(n) {
222
222
  return !!n && typeof n == "object" && "type" in n && n.type === u.Identifier;
223
223
  }
224
224
  function ze(n) {
@@ -227,28 +227,28 @@ function ze(n) {
227
227
  function ce(n) {
228
228
  return !!n && typeof n == "object" && "type" in n && n.type === u.LogicalExpression;
229
229
  }
230
- function ge(n) {
230
+ function xe(n) {
231
231
  return !!n && typeof n == "object" && "type" in n && n.type === u.ObjectExpression;
232
232
  }
233
233
  function Fe(n) {
234
234
  return !!n && typeof n == "object" && "type" in n && n.type === u.MemberExpression;
235
235
  }
236
- function tt(n) {
236
+ function et(n) {
237
237
  return !!n && typeof n == "object" && "type" in n && n.type === u.SafeMemberExpression;
238
238
  }
239
- function it(n) {
239
+ function tt(n) {
240
240
  return !!n && typeof n == "object" && "type" in n && n.type === u.MemberAccessChainExpression;
241
241
  }
242
- function nt(n) {
242
+ function it(n) {
243
243
  return !!n && typeof n == "object" && "type" in n && n.type === u.UnaryExpression;
244
244
  }
245
- function rt(n) {
245
+ function nt(n) {
246
246
  return !!n && typeof n == "object" && "type" in n && n.type === u.UpdateExpression;
247
247
  }
248
248
  function Ve(n) {
249
249
  return !!n && typeof n == "object" && "type" in n && n.type === u.VariableDeclarator;
250
250
  }
251
- function st(n) {
251
+ function rt(n) {
252
252
  return !!n && typeof n == "object" && "type" in n && n.type === u.Property;
253
253
  }
254
254
  function ie(n, e) {
@@ -257,12 +257,12 @@ function ie(n, e) {
257
257
  function Ae(n, e) {
258
258
  return n.range[0] >= e.range[0] && n.range[1] <= e.range[1];
259
259
  }
260
- class ut {
260
+ class st {
261
261
  constructor() {
262
262
  this.comments = [], this._nodeStack = [], this._newComments = [];
263
263
  }
264
264
  insertInnerComments(e) {
265
- if (!I(e) || e.body.length !== 0)
265
+ if (!b(e) || e.body.length !== 0)
266
266
  return;
267
267
  const t = [];
268
268
  for (let i = this._newComments.length - 1; i >= 0; i--) {
@@ -275,7 +275,7 @@ class ut {
275
275
  const t = this._nodeStack.at(-1);
276
276
  if (!t)
277
277
  return;
278
- if (I(e) && Ae(t, e))
278
+ if (b(e) && Ae(t, e))
279
279
  for (let r = this._newComments.length - 1; r >= 0; r--) {
280
280
  const s = this._newComments[r];
281
281
  Ae(s, e) && (t.trailingComments = [...t.trailingComments ?? [], s], this._newComments.splice(r, 1));
@@ -312,7 +312,7 @@ class ut {
312
312
  i.unshift(a), t.leadingComments.splice(s, 1);
313
313
  continue;
314
314
  }
315
- Ve(e) && !Ye(a) && (r.unshift(a), t.leadingComments.splice(s, 1));
315
+ Ve(e) && !Xe(a) && (r.unshift(a), t.leadingComments.splice(s, 1));
316
316
  }
317
317
  t.leadingComments.length === 0 && delete t.leadingComments, i.length && (e.leadingComments = i), r.length && (e.trailingComments = [...r, ...e.trailingComments ?? []]);
318
318
  return;
@@ -324,7 +324,7 @@ class ut {
324
324
  i.length && (e.leadingComments = i);
325
325
  }
326
326
  attachComments(e) {
327
- if (Xe(e) && e.body.length > 0) {
327
+ if (Ze(e) && e.body.length > 0) {
328
328
  const t = this._nodeStack.at(-1);
329
329
  if (t) {
330
330
  t.trailingComments = [...t.trailingComments ?? [], ...this._newComments], this._newComments.length = 0, this._nodeStack.pop();
@@ -339,10 +339,10 @@ class ut {
339
339
  this.comments.push(e), this._newComments.push(e);
340
340
  }
341
341
  }
342
- const at = /\$\{(.*?)\}/gu;
342
+ const ut = /\$\{(.*?)\}/gu;
343
343
  function he(n, e) {
344
344
  const t = je[n];
345
- return e ? t.replace(at, (i, r) => e[r]?.toString() ?? "") : t;
345
+ return e ? t.replace(ut, (i, r) => e[r]?.toString() ?? "") : t;
346
346
  }
347
347
  class _e {
348
348
  constructor(e = !1) {
@@ -450,7 +450,7 @@ ue.forEach((n) => N[n.length - 1].push(n));
450
450
  Ne.forEach((n) => N[n.length - 1].push(n));
451
451
  Ue.forEach((n) => N[n.length - 1].push(n));
452
452
  Me.forEach((n) => N[n.length - 1].push(n));
453
- Ze.forEach((n) => N[n.length - 1].push(n));
453
+ Qe.forEach((n) => N[n.length - 1].push(n));
454
454
  N[w.length - 1].push(w);
455
455
  class $e {
456
456
  constructor(e, t) {
@@ -993,11 +993,11 @@ const y = {
993
993
  AsObject: 0,
994
994
  Automatic: 1
995
995
  };
996
- function be(n, e = 0) {
996
+ function Ie(n, e = 0) {
997
997
  let t = n.start - n.lineStart, i = n.lineNumber;
998
998
  return t < 0 && (t += e, i -= 1), { index: n.start, line: i, column: t };
999
999
  }
1000
- function Ie(n) {
1000
+ function be(n) {
1001
1001
  return [
1002
1002
  { index: n.range[0], ...n.loc.start },
1003
1003
  { index: n.range[1], ...n.loc.end }
@@ -1006,13 +1006,13 @@ function Ie(n) {
1006
1006
  function we(n) {
1007
1007
  return n in q ? q[n] : 0;
1008
1008
  }
1009
- class ot {
1009
+ class at {
1010
1010
  constructor(e, t = {}, i) {
1011
1011
  this.delegate = i, this.hasLineTerminator = !1, this.options = {
1012
1012
  tokens: typeof t.tokens == "boolean" && t.tokens,
1013
1013
  comments: typeof t.comments == "boolean" && t.comments,
1014
1014
  tolerant: typeof t.tolerant == "boolean" && t.tolerant
1015
- }, this.options.comments && (this.commentHandler = new ut()), this.errorHandler = new _e(this.options.tolerant), this.scanner = new $e(e, this.errorHandler), this.context = {
1015
+ }, this.options.comments && (this.commentHandler = new st()), this.errorHandler = new _e(this.options.tolerant), this.scanner = new $e(e, this.errorHandler), this.context = {
1016
1016
  isAssignmentTarget: !1,
1017
1017
  blockContext: y.None,
1018
1018
  curlyParsingType: re.AsObject
@@ -1079,11 +1079,11 @@ class ot {
1079
1079
  i ??= h.UnexpectedToken, r ??= { value: s };
1080
1080
  const a = he(i, r);
1081
1081
  if (t) {
1082
- const d = t.start, C = t.lineNumber, F = t.start - t.lineStart + 1;
1082
+ const d = t.start, E = t.lineNumber, F = t.start - t.lineStart + 1;
1083
1083
  return new z({
1084
1084
  code: i,
1085
1085
  index: d,
1086
- line: C,
1086
+ line: E,
1087
1087
  column: F,
1088
1088
  len: t.end - t.start - 1,
1089
1089
  data: r,
@@ -1421,50 +1421,48 @@ class ot {
1421
1421
  }
1422
1422
  parseLeftHandSideExpression() {
1423
1423
  const e = this.captureStartMarker();
1424
- let t = this.inheritCoverGrammar(this.parsePrimaryExpression.bind(this));
1425
- const i = this.captureStartMarker();
1426
- let r = !1, s;
1427
- for (; s = this.getMatchingPunctuator(["(", "[", ".", w]); ) {
1428
- let a = !1;
1429
- switch (s === w && (r = !0, a = !0, this.expectPunctuator(w), this.getMatchingPunctuator("[") ? s = "[" : s = "."), s) {
1424
+ let t = this.inheritCoverGrammar(this.parsePrimaryExpression.bind(this)), i = !1, r;
1425
+ for (; r = this.getMatchingPunctuator(["(", "[", ".", w]); ) {
1426
+ let s = !1;
1427
+ switch (r === w && (i = !0, s = !0, this.expectPunctuator(w), this.getMatchingPunctuator("[") ? r = "[" : r = "."), r) {
1430
1428
  case "(": {
1431
- this.context.isAssignmentTarget = !1, t.type !== u.Identifier && t.type !== u.MemberExpression && t.type !== u.SafeMemberExpression && this.throwError(h.IdentifierExpected, e, i);
1432
- const o = this.parseArguments();
1429
+ this.context.isAssignmentTarget = !1;
1430
+ const a = this.parseArguments();
1433
1431
  t = this.finalize({
1434
1432
  type: u.CallExpression,
1435
1433
  callee: t,
1436
- arguments: o,
1434
+ arguments: a,
1437
1435
  ...this.getItemLocation(e)
1438
1436
  });
1439
1437
  continue;
1440
1438
  }
1441
1439
  case "[": {
1442
- this.context.isAssignmentTarget = !a, this.expectPunctuator("[");
1443
- const o = this.isolateCoverGrammar(() => this.parseExpression());
1440
+ this.context.isAssignmentTarget = !s, this.expectPunctuator("[");
1441
+ const a = this.isolateCoverGrammar(() => this.parseExpression());
1444
1442
  this.expectPunctuator("]"), t = this.finalize({
1445
- type: a ? u.SafeMemberExpression : u.MemberExpression,
1443
+ type: s ? u.SafeMemberExpression : u.MemberExpression,
1446
1444
  computed: !0,
1447
1445
  object: t,
1448
- property: o,
1446
+ property: a,
1449
1447
  ...this.getItemLocation(e)
1450
1448
  });
1451
1449
  continue;
1452
1450
  }
1453
1451
  case ".": {
1454
- this.context.isAssignmentTarget = !a, a || this.expectPunctuator(".");
1455
- const o = this.parseMemberName();
1452
+ this.context.isAssignmentTarget = !s, s || this.expectPunctuator(".");
1453
+ const a = this.parseMemberName();
1456
1454
  t = this.finalize({
1457
- type: a ? u.SafeMemberExpression : u.MemberExpression,
1455
+ type: s ? u.SafeMemberExpression : u.MemberExpression,
1458
1456
  computed: !1,
1459
1457
  object: t,
1460
- property: o,
1458
+ property: a,
1461
1459
  ...this.getItemLocation(e)
1462
1460
  });
1463
1461
  continue;
1464
1462
  }
1465
1463
  }
1466
1464
  }
1467
- return r ? this.finalize({
1465
+ return i ? this.finalize({
1468
1466
  type: u.MemberAccessChainExpression,
1469
1467
  expression: t,
1470
1468
  ...this.getItemLocation(e)
@@ -1529,27 +1527,27 @@ class ot {
1529
1527
  o = c.pop();
1530
1528
  const k = c.pop();
1531
1529
  d.pop(), a = c.pop(), s.pop();
1532
- const R = s[s.length - 1], ee = be(R, R.lineStart);
1530
+ const R = s[s.length - 1], ee = Ie(R, R.lineStart);
1533
1531
  c.push(this.finalize(this.createBinaryOrLogicalExpression(ee, k, a, o)));
1534
1532
  }
1535
1533
  c.push(this.rawToken.value), d.push(r), s.push(this.rawToken), this.readNextRawToken(), c.push(this.inheritCoverGrammar(this.parseUnaryExpression.bind(this)));
1536
1534
  }
1537
- let C = c.length - 1;
1538
- t = c[C];
1535
+ let E = c.length - 1;
1536
+ t = c[E];
1539
1537
  let F = s.pop();
1540
- for (; C > 1; ) {
1538
+ for (; E > 1; ) {
1541
1539
  const k = s.pop();
1542
1540
  if (!k)
1543
1541
  break;
1544
- const R = F?.lineStart, ee = be(k, R), Ge = c[C - 1];
1542
+ const R = F?.lineStart, ee = Ie(k, R), qe = c[E - 1];
1545
1543
  t = this.finalize(
1546
- this.createBinaryOrLogicalExpression(ee, Ge, c[C - 2], t)
1547
- ), C -= 2, F = k;
1544
+ this.createBinaryOrLogicalExpression(ee, qe, c[E - 2], t)
1545
+ ), E -= 2, F = k;
1548
1546
  }
1549
1547
  return t;
1550
1548
  }
1551
1549
  createBinaryOrLogicalExpression(e, t, i, r) {
1552
- return Ue.includes(t) ? ((i.type === u.AssignmentExpression || i.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...Ie(i)), (r.type === u.AssignmentExpression || r.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...Ie(i)), {
1550
+ return Ue.includes(t) ? ((i.type === u.AssignmentExpression || i.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...be(i)), (r.type === u.AssignmentExpression || r.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...be(i)), {
1553
1551
  type: u.LogicalExpression,
1554
1552
  operator: t,
1555
1553
  left: i,
@@ -1703,20 +1701,20 @@ class ot {
1703
1701
  if (this.expectKeyword(f.For), this.expectPunctuator("("), this.matchKeyword(f.Var)) {
1704
1702
  const d = this.captureStartMarker();
1705
1703
  this.readNextRawToken();
1706
- const C = this.parseVariableDeclarators();
1704
+ const E = this.parseVariableDeclarators();
1707
1705
  t = this.finalize({
1708
1706
  type: u.VariableDeclaration,
1709
- declarations: C,
1707
+ declarations: E,
1710
1708
  kind: "var",
1711
1709
  ...this.getItemLocation(d)
1712
1710
  });
1713
1711
  const F = this.matchKeyword(f.In), k = this.matchContextualKeyword(te.Of);
1714
- C.length === 1 && (F || k) && (C[0].init && this.throwError(h.ForInOfLoopInitializer, d), e = F ? u.ForInStatement : u.ForOfStatement, s = t);
1712
+ E.length === 1 && (F || k) && (E[0].init && this.throwError(h.ForInOfLoopInitializer, d), e = F ? u.ForInStatement : u.ForOfStatement, s = t);
1715
1713
  } else if (!this.matchPunctuator(";")) {
1716
- const d = this.context.isAssignmentTarget, C = this.captureStartMarker();
1714
+ const d = this.context.isAssignmentTarget, E = this.captureStartMarker();
1717
1715
  t = this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this));
1718
1716
  const F = this.matchKeyword(f.In), k = this.matchContextualKeyword(te.Of);
1719
- F || k ? (this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInForIn, C), t.type !== u.Identifier && this.throwError(h.InvalidLeftHandSideInForIn, C), e = F ? u.ForInStatement : u.ForOfStatement, s = t) : this.context.isAssignmentTarget = d;
1717
+ F || k ? (this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInForIn, E), t.type !== u.Identifier && this.throwError(h.InvalidLeftHandSideInForIn, E), e = F ? u.ForInStatement : u.ForOfStatement, s = t) : this.context.isAssignmentTarget = d;
1720
1718
  }
1721
1719
  e === u.ForStatement ? (this.expectPunctuator(";"), i = this.matchPunctuator(";") ? null : this.isolateCoverGrammar(this.parseExpression.bind(this)), this.expectPunctuator(";"), r = this.matchPunctuator(")") ? null : this.isolateCoverGrammar(this.parseExpression.bind(this))) : (this.readNextRawToken(), a = this.parseExpression()), this.expectPunctuator(")");
1722
1720
  const c = this.withBlockContext(
@@ -1871,7 +1869,7 @@ class ot {
1871
1869
  });
1872
1870
  }
1873
1871
  }
1874
- class ct {
1872
+ class ot {
1875
1873
  constructor(e, t) {
1876
1874
  this.errorHandler = new _e(), this.errorHandler.tolerant = t ? typeof t.tolerant == "boolean" && t.tolerant : !1, this.scanner = new $e(e, this.errorHandler), this.trackComments = t ? typeof t.comment == "boolean" && t.comment : !1, this.buffer = [];
1877
1875
  }
@@ -1912,10 +1910,10 @@ class ct {
1912
1910
  }
1913
1911
  }
1914
1912
  function Re(n, e, t) {
1915
- return new ot(n, e, t).parseScript();
1913
+ return new at(n, e, t).parseScript();
1916
1914
  }
1917
- function ht(n, e, t) {
1918
- const i = new ct(n, e), r = [];
1915
+ function ct(n, e, t) {
1916
+ const i = new ot(n, e), r = [];
1919
1917
  let s;
1920
1918
  try {
1921
1919
  let a;
@@ -1948,7 +1946,7 @@ const p = {
1948
1946
  UnexpectedEmptyFunction: "UnexpectedEmptyFunction",
1949
1947
  UnexpectedPropertyIdentifier: "UnexpectedPropertyIdentifier",
1950
1948
  UnknownPropertyIdentifier: "UnknownPropertyIdentifier"
1951
- }, lt = {
1949
+ }, ht = {
1952
1950
  [p.AlreadyDefined]: "'${identifier}' is already defined.",
1953
1951
  [p.ApiConflict]: "'${identifier}' is already defined as an Arcade constant or function.",
1954
1952
  [p.AssignedNeverUsed]: "'${identifier}' is assigned but never used.",
@@ -1975,19 +1973,19 @@ const p = {
1975
1973
  function Q(n, e) {
1976
1974
  return n.line - e.line || n.column - e.column;
1977
1975
  }
1978
- function Dt(n, e) {
1976
+ function lt(n, e) {
1979
1977
  const t = {
1980
1978
  start: n.loc.start,
1981
1979
  end: n.loc.end
1982
- }, i = (r) => pt(t, r.loc);
1980
+ }, i = (r) => Dt(t, r.loc);
1983
1981
  return Q(t.start, t.end) < 0 && (t.start = { ...t.start }, e.skipSpaces(t.start), Q(t.start, t.end) < 0 && (t.end = { ...t.end }, e.skipSpaces(t.end, !0))), n.leadingComments?.forEach(i), n.trailingComments?.forEach(i), t;
1984
1982
  }
1985
- function pt(n, e) {
1983
+ function Dt(n, e) {
1986
1984
  Q(e.start, n.start) < 0 && (n.start = e.start), Q(n.end, e.end) < 0 && (n.end = e.end);
1987
1985
  }
1988
- const dt = /\S/u;
1986
+ const pt = /\S/u;
1989
1987
  function W(n = "") {
1990
- return !dt.test(n);
1988
+ return !pt.test(n);
1991
1989
  }
1992
1990
  const se = {
1993
1991
  indentWidth: 2,
@@ -2001,7 +1999,7 @@ function de(n) {
2001
1999
  quote: n?.quote ?? se.quote
2002
2000
  };
2003
2001
  }
2004
- const mt = /^\s*/u, ft = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u;
2002
+ const dt = /^\s*/u, mt = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u;
2005
2003
  class Z {
2006
2004
  // private cachedIndentWidth: number | void = void 0;
2007
2005
  constructor(e) {
@@ -2013,11 +2011,11 @@ class Z {
2013
2011
  return e;
2014
2012
  const i = t?.indentWidth;
2015
2013
  return new Z(
2016
- e.split(ft).map((s) => {
2017
- const a = mt.exec(s)?.[0] ?? "";
2014
+ e.split(mt).map((s) => {
2015
+ const a = dt.exec(s)?.[0] ?? "";
2018
2016
  return {
2019
2017
  line: s,
2020
- indentation: Ct(a, i),
2018
+ indentation: ft(a, i),
2021
2019
  // Boolean indicating whether this line can be re-indented.
2022
2020
  locked: !1,
2023
2021
  sliceStart: a.length,
@@ -2118,7 +2116,7 @@ class Z {
2118
2116
  `);
2119
2117
  }
2120
2118
  }
2121
- function Ct(n, e = 2) {
2119
+ function ft(n, e = 2) {
2122
2120
  let t = 0;
2123
2121
  const i = n.length;
2124
2122
  for (let r = 0; r < i; r++)
@@ -2136,7 +2134,6 @@ function Ct(n, e = 2) {
2136
2134
  // '\r'
2137
2135
  case 65279:
2138
2136
  break;
2139
- case 32:
2140
2137
  // ' '
2141
2138
  default:
2142
2139
  t += 1;
@@ -2157,13 +2154,13 @@ function O(n, e, t) {
2157
2154
  function ke(n, e, t) {
2158
2155
  return !n && !t ? "" : n ? t ? `${n}${e}${t}` : n : t;
2159
2156
  }
2160
- const Et = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u;
2157
+ const Ct = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u;
2161
2158
  class D {
2162
2159
  constructor(e = []) {
2163
2160
  this.lines = e;
2164
2161
  }
2165
2162
  static fromString(e) {
2166
- return new D(e.split(Et));
2163
+ return new D(e.split(Ct));
2167
2164
  }
2168
2165
  /**
2169
2166
  * Append the elements lines together into a new FormattedLines.
@@ -2252,10 +2249,10 @@ function M(n = 0, e) {
2252
2249
  function K(n) {
2253
2250
  return n.replace(/['"]/gu, (e) => e === '"' ? "'" : '"');
2254
2251
  }
2255
- function xt(n, e) {
2252
+ function Et(n, e) {
2256
2253
  switch (n.type) {
2257
2254
  case u.UnaryExpression:
2258
- return (Fe(e) || tt(e)) && e.object === n;
2255
+ return (Fe(e) || et(e)) && e.object === n;
2259
2256
  case u.BinaryExpression:
2260
2257
  case u.LogicalExpression:
2261
2258
  switch (e.type) {
@@ -2297,7 +2294,7 @@ function xt(n, e) {
2297
2294
  return !1;
2298
2295
  }
2299
2296
  }
2300
- function E(n, e, t) {
2297
+ function C(n, e, t) {
2301
2298
  switch (n?.type) {
2302
2299
  case u.BinaryExpression:
2303
2300
  case u.LogicalExpression:
@@ -2306,11 +2303,11 @@ function E(n, e, t) {
2306
2303
  return new fe(n, e, t);
2307
2304
  case u.MemberExpression:
2308
2305
  case u.SafeMemberExpression:
2309
- return new He(n, e, t);
2306
+ return new At(n, e, t);
2310
2307
  case u.Identifier:
2311
2308
  return new le(n, e, t);
2312
2309
  case u.CallExpression:
2313
- return new At(n, e, t);
2310
+ return new Ft(n, e, t);
2314
2311
  case u.ObjectExpression:
2315
2312
  return U(n, e, t);
2316
2313
  case u.ArrayExpression:
@@ -2334,7 +2331,7 @@ function U(n, e, t) {
2334
2331
  switch (n.type) {
2335
2332
  case u.ArrayExpression:
2336
2333
  return i.setupCollection(
2337
- n.elements.map((r) => E(r, n, t)),
2334
+ n.elements.map((r) => C(r, n, t)),
2338
2335
  "SquareBrackets"
2339
2336
  ), i;
2340
2337
  case u.ObjectExpression:
@@ -2349,15 +2346,15 @@ function U(n, e, t) {
2349
2346
  ), i;
2350
2347
  case u.FunctionDeclaration:
2351
2348
  return i.prefix = `function ${n.id.name}`, i.setupCollection(
2352
- n.params.map((r) => E(r, n, t)),
2349
+ n.params.map((r) => C(r, n, t)),
2353
2350
  "Parentheses"
2354
2351
  ), i;
2355
2352
  case u.ForStatement:
2356
2353
  return i.prefix = "for ", i.setupCollection(
2357
2354
  [
2358
- E(n.init, n, t),
2359
- E(n.test, n, t),
2360
- E(n.update, n, t)
2355
+ C(n.init, n, t),
2356
+ C(n.test, n, t),
2357
+ C(n.update, n, t)
2361
2358
  ],
2362
2359
  "Parentheses",
2363
2360
  ";"
@@ -2366,9 +2363,9 @@ function U(n, e, t) {
2366
2363
  case u.ForOfStatement:
2367
2364
  return i.prefix = "for ", i.setupCollection([new fe(n, e, t)], "Parentheses", ""), i;
2368
2365
  case u.IfStatement:
2369
- return i.prefix = "if ", i.setupCollection([E(n.test, n, t)], "Parentheses", ""), i;
2366
+ return i.prefix = "if ", i.setupCollection([C(n.test, n, t)], "Parentheses", ""), i;
2370
2367
  case u.WhileStatement:
2371
- return i.prefix = "while ", i.setupCollection([E(n.test, n, t)], "Parentheses", ""), i;
2368
+ return i.prefix = "while ", i.setupCollection([C(n.test, n, t)], "Parentheses", ""), i;
2372
2369
  default:
2373
2370
  return i;
2374
2371
  }
@@ -2380,7 +2377,7 @@ function gt(n, e, t) {
2380
2377
  const r = [
2381
2378
  ...X(n.left, n.operator),
2382
2379
  ...X(n.right, n.operator)
2383
- ].map((a) => E(a, n, t)), s = new Y(n, e, t);
2380
+ ].map((a) => C(a, n, t)), s = new Y(n, e, t);
2384
2381
  return s.setupCollection(r, "None", ` ${n.operator}`), s;
2385
2382
  }
2386
2383
  function X(n, e) {
@@ -2391,7 +2388,7 @@ function X(n, e) {
2391
2388
  }
2392
2389
  class L {
2393
2390
  constructor(e, t, i) {
2394
- this.node = e, this.parent = t, this.options = i, this.prefix = "", this.suffix = "", this.groupingParentheses = !1, this.groupingParentheses = xt(e, t);
2391
+ this.node = e, this.parent = t, this.options = i, this.prefix = "", this.suffix = "", this.groupingParentheses = !1, this.groupingParentheses = Et(e, t);
2395
2392
  }
2396
2393
  get openingParenthesis() {
2397
2394
  return this.groupingParentheses ? "(" : "";
@@ -2445,7 +2442,7 @@ class Y extends L {
2445
2442
  }
2446
2443
  }
2447
2444
  getLinesLevel(e = 0) {
2448
- return this.bracketsType !== "None" || et(this.parent) || Ve(this.parent) || (ce(this.node) || oe(this.node)) && (ce(this.parent) || oe(this.parent)) ? e + 1 : e;
2445
+ return this.bracketsType !== "None" || Ye(this.parent) || Ve(this.parent) || (ce(this.node) || oe(this.node)) && (ce(this.parent) || oe(this.parent)) ? e + 1 : e;
2449
2446
  }
2450
2447
  finalize(e, t = "singleLine", i = 0) {
2451
2448
  if (this.bracketsType === "None")
@@ -2487,17 +2484,17 @@ class Y extends L {
2487
2484
  return this.finalize(i, e, t);
2488
2485
  }
2489
2486
  }
2490
- const Ft = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/u;
2487
+ const xt = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/u;
2491
2488
  class le extends L {
2492
2489
  constructor(e, t, i) {
2493
2490
  super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "StringPrinter";
2494
2491
  }
2495
2492
  format() {
2496
- if (b(this.node))
2493
+ if (I(this.node))
2497
2494
  return this.finalize(this.node.name);
2498
2495
  if (typeof this.node.value != "string")
2499
2496
  return this.finalize(this.node.raw);
2500
- if (st(this.parent) && this.parent.key === this.node && ze(this.node) && typeof this.node.value == "string" && Ft.test(this.node.value))
2497
+ if (rt(this.parent) && this.parent.key === this.node && ze(this.node) && typeof this.node.value == "string" && xt.test(this.node.value))
2501
2498
  return this.finalize(this.node.value);
2502
2499
  switch (this.options.quote) {
2503
2500
  case "auto": {
@@ -2514,16 +2511,16 @@ class le extends L {
2514
2511
  class Ke extends L {
2515
2512
  constructor(e, t, i) {
2516
2513
  super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "SingleExpressionPrinter";
2517
- const r = nt(e), s = rt(e);
2514
+ const r = it(e), s = nt(e);
2518
2515
  if (r || s) {
2519
- this.prefix = r ? e.operator : "", this.suffix = s && !e.prefix ? e.operator : "", this.printer = E(e.argument, e, this.options);
2516
+ this.prefix = r ? e.operator : "", this.suffix = s && !e.prefix ? e.operator : "", this.printer = C(e.argument, e, this.options);
2520
2517
  return;
2521
2518
  }
2522
- if (it(e)) {
2523
- this.printer = E(e.expression, e, this.options);
2519
+ if (tt(e)) {
2520
+ this.printer = C(e.expression, e, this.options);
2524
2521
  return;
2525
2522
  }
2526
- this.printer = E(e, t, this.options);
2523
+ this.printer = C(e, t, this.options);
2527
2524
  }
2528
2525
  format(e = "singleLine", t = 0) {
2529
2526
  return this.finalize(this.printer.format(e, t));
@@ -2537,28 +2534,28 @@ class De extends L {
2537
2534
  return this.finalize(this.printer.format(e, t));
2538
2535
  }
2539
2536
  }
2540
- class At extends L {
2537
+ class Ft extends L {
2541
2538
  constructor(e, t, i) {
2542
2539
  super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "CallExpressionPrinter", this.argumentsPrinter = new Y(e, t, i), this.argumentsPrinter.setupCollection(
2543
- e.arguments.map((r) => E(r, e, i)),
2540
+ e.arguments.map((r) => C(r, e, i)),
2544
2541
  "Parentheses"
2545
- ), b(e.callee) ? this.argumentsPrinter.prefix = e.callee.name : this.memberExpressionPrinter = new He(e.callee, t, i);
2542
+ ), I(e.callee) ? this.argumentsPrinter.prefix = e.callee.name : this.calleePrinter = C(e.callee, t, i);
2546
2543
  }
2547
2544
  format(e = "singleLine", t = 0) {
2548
- if (!this.memberExpressionPrinter)
2545
+ if (!this.calleePrinter)
2549
2546
  return this.finalize(this.argumentsPrinter.format(e, t));
2550
- let i = this.memberExpressionPrinter.format("singleLine", t), r = this.argumentsPrinter.format("singleLine", t);
2547
+ let i = this.calleePrinter.format("singleLine", t), r = this.argumentsPrinter.format("singleLine", t);
2551
2548
  if (e === "singleLine")
2552
2549
  return this.finalize(D.joinLines([i, r]));
2553
2550
  let s = me(t, this.options) + this.leadingString.length + i.firstLineLength;
2554
- return s + 1 < this.options.wrapColumn ? (r = this.argumentsPrinter.format("multiline", t), this.finalize(D.joinLines([i, r]))) : (i = this.memberExpressionPrinter.format("multiline", t), s = i.lastLineLength, s + r.maxLineLength > this.options.wrapColumn && (r = this.argumentsPrinter.format("multiline", t + 1)), this.finalize(D.joinLines([i, r])));
2551
+ return s + 1 < this.options.wrapColumn ? (r = this.argumentsPrinter.format("multiline", t), this.finalize(D.joinLines([i, r]))) : (i = this.calleePrinter.format("multiline", t), s = i.lastLineLength, s + r.maxLineLength > this.options.wrapColumn && (r = this.argumentsPrinter.format("multiline", t + 1)), this.finalize(D.joinLines([i, r])));
2555
2552
  }
2556
2553
  }
2557
- class He extends L {
2554
+ class At extends L {
2558
2555
  constructor(e, t, i) {
2559
- if (super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "MemberExpressionPrinter", this.objectPrinter = E(e.object, e, this.options), e.computed) {
2556
+ if (super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "MemberExpressionPrinter", this.objectPrinter = C(e.object, e, this.options), e.computed) {
2560
2557
  const r = new Y(e.property, e, this.options);
2561
- r.setupCollection([E(e.property, e, this.options)], "SquareBrackets"), r.prefix = e.type === "SafeMemberExpression" ? w : "", this.propertyPrinter = r;
2558
+ r.setupCollection([C(e.property, e, this.options)], "SquareBrackets"), r.prefix = e.type === "SafeMemberExpression" ? w : "", this.propertyPrinter = r;
2562
2559
  } else {
2563
2560
  const r = new Ke(e.property, e, this.options);
2564
2561
  r.prefix = e.type === "SafeMemberExpression" ? w : ".", this.propertyPrinter = r;
@@ -2581,7 +2578,7 @@ class He extends L {
2581
2578
  }
2582
2579
  class yt extends L {
2583
2580
  constructor(e, t, i) {
2584
- super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "PropertyPrinter", this.key = E(e.key, e, this.options), e.shorthand || (this.key.suffix = ":", this.value = E(e.value, e, this.options));
2581
+ super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "PropertyPrinter", this.key = C(e.key, e, this.options), e.shorthand || (this.key.suffix = ":", this.value = C(e.value, e, this.options));
2585
2582
  }
2586
2583
  format(e = "singleLine", t = 0) {
2587
2584
  if (this.node.shorthand || !this.value)
@@ -2604,18 +2601,18 @@ class fe extends L {
2604
2601
  constructor(e, t, i) {
2605
2602
  switch (super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "OperationPrinter", this.operator = "", this.noNewLineWrapping = !1, e.type) {
2606
2603
  case u.AssignmentExpression:
2607
- this.leftPrinter = E(e.left, e, this.options), this.operator = ` ${e.operator}`, this.rightPrinter = E(e.right, e, this.options), this.noNewLineWrapping = (b(e.left) || ze(e.left)) && (J(e.right) || ge(e.right));
2604
+ this.leftPrinter = C(e.left, e, this.options), this.operator = ` ${e.operator}`, this.rightPrinter = C(e.right, e, this.options), this.noNewLineWrapping = (I(e.left) || ze(e.left)) && (J(e.right) || xe(e.right));
2608
2605
  return;
2609
2606
  case u.VariableDeclarator:
2610
- this.leftPrinter = E(e.id, e, this.options), e.init && (this.operator = " =", this.rightPrinter = E(e.init, e, this.options)), this.noNewLineWrapping = J(e.init) || ge(e.init);
2607
+ this.leftPrinter = C(e.id, e, this.options), e.init && (this.operator = " =", this.rightPrinter = C(e.init, e, this.options)), this.noNewLineWrapping = J(e.init) || xe(e.init);
2611
2608
  return;
2612
2609
  case u.ForInStatement:
2613
2610
  case u.ForOfStatement:
2614
- this.leftPrinter = E(e.left, e, this.options), this.operator = e.type === "ForInStatement" ? " in" : " of", this.rightPrinter = E(e.right, e, this.options);
2611
+ this.leftPrinter = C(e.left, e, this.options), this.operator = e.type === "ForInStatement" ? " in" : " of", this.rightPrinter = C(e.right, e, this.options);
2615
2612
  return;
2616
2613
  case u.BinaryExpression:
2617
2614
  case u.LogicalExpression:
2618
- this.leftPrinter = E(e.left, e, this.options), this.operator = ` ${e.operator}`, this.rightPrinter = E(e.right, e, this.options);
2615
+ this.leftPrinter = C(e.left, e, this.options), this.operator = ` ${e.operator}`, this.rightPrinter = C(e.right, e, this.options);
2619
2616
  return;
2620
2617
  }
2621
2618
  }
@@ -2638,7 +2635,7 @@ class Bt extends L {
2638
2635
  constructor(e, t, i) {
2639
2636
  super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "TemplateLiteralPrinter", this.parts = [];
2640
2637
  const r = e.expressions.map(
2641
- (s) => E(s, e, this.options)
2638
+ (s) => C(s, e, this.options)
2642
2639
  );
2643
2640
  this.parts.push("`"), e.quasis.forEach((s, a) => {
2644
2641
  this.parts.push(s.value.raw), a < r.length && (this.parts.push("${"), this.parts.push(r[a]), this.parts.push("}"));
@@ -2654,7 +2651,7 @@ function St(n) {
2654
2651
  const e = { ...n.leadingComments?.slice(0, 1)[0]?.loc.start ?? n.loc.start }, t = { ...n.trailingComments?.slice(-1)[0]?.loc.end ?? n.loc.end };
2655
2652
  return { start: e, end: t };
2656
2653
  }
2657
- function bt(n) {
2654
+ function It(n) {
2658
2655
  return n.trailingComments?.slice(-1)[0]?.type === u.LineComment;
2659
2656
  }
2660
2657
  class T {
@@ -2689,7 +2686,7 @@ class T {
2689
2686
  case u.EmptyStatement:
2690
2687
  case u.BreakStatement:
2691
2688
  case u.ContinueStatement:
2692
- return new It(e, this.node, this.options);
2689
+ return new bt(e, this.node, this.options);
2693
2690
  default:
2694
2691
  throw new Error(`unknown type: ${JSON.stringify(e)}`);
2695
2692
  }
@@ -2772,7 +2769,7 @@ class T {
2772
2769
  ) ?? { formattedLines: s }).formattedLines;
2773
2770
  }
2774
2771
  formatInnerComments(e = 0) {
2775
- if (!I(this.node) || !Array.isArray(this.node.innerComments) || !this.node.innerComments.length)
2772
+ if (!b(this.node) || !Array.isArray(this.node.innerComments) || !this.node.innerComments.length)
2776
2773
  return new D();
2777
2774
  const t = this.getIndentation(e);
2778
2775
  return this.node.innerComments.reduce(
@@ -2793,12 +2790,7 @@ class T {
2793
2790
  ).formattedLines;
2794
2791
  }
2795
2792
  formatComment(e) {
2796
- switch (e.type) {
2797
- case u.BlockComment:
2798
- return D.fromString(e.value).surroundWith("/*", "*/");
2799
- default:
2800
- return D.fromString(e.value.trimEnd()).surroundWith("//");
2801
- }
2793
+ return e.type === u.BlockComment ? D.fromString(e.value).surroundWith("/*", "*/") : D.fromString(e.value.trimEnd()).surroundWith("//");
2802
2794
  }
2803
2795
  /**
2804
2796
  * Invoked for a single line format. Measure is the length of the statement would fit
@@ -2819,7 +2811,7 @@ class $ extends T {
2819
2811
  format(e = 0) {
2820
2812
  if (this.printers.length === 0)
2821
2813
  return this.formatEmptyBlock(e);
2822
- const t = [], i = I(this.node);
2814
+ const t = [], i = b(this.node);
2823
2815
  i && t.push("{");
2824
2816
  const r = i ? e + 1 : e;
2825
2817
  let s;
@@ -2831,13 +2823,13 @@ class $ extends T {
2831
2823
  }), i && t.push(`${this.getIndentation(e)}}`), this.addComments(D.appendLines(t), e);
2832
2824
  }
2833
2825
  formatEmptyBlock(e = 0) {
2834
- if (!I(this.node))
2826
+ if (!b(this.node))
2835
2827
  return this.addComments(D.fromString(""), e);
2836
2828
  const t = this.formatInnerComments(e + 1), i = "{", r = `${this.getIndentation(e)}}`;
2837
2829
  return t.isEmpty ? ae(this.parent) ? this.addComments(D.appendLines([i, r]), e) : this.addComments(D.fromString("{}"), e) : this.addComments(D.appendLines([i, t, r]), e);
2838
2830
  }
2839
2831
  }
2840
- class It extends T {
2832
+ class bt extends T {
2841
2833
  constructor(e, t, i) {
2842
2834
  switch (super(e, t, i), this.node = e, this.keyword = "", this.node.type) {
2843
2835
  case u.ContinueStatement:
@@ -2874,9 +2866,9 @@ class Le extends T {
2874
2866
  }
2875
2867
  class Te extends T {
2876
2868
  constructor(e, t, i) {
2877
- if (super(e, t, i), this.node = e, xe(e))
2869
+ if (super(e, t, i), this.node = e, ge(e))
2878
2870
  this.header = U(e, t, i), this.body = new $(e.body, e, i);
2879
- else if (xe(e.declaration))
2871
+ else if (ge(e.declaration))
2880
2872
  this.header = U(e.declaration, t, i), this.header.prefix = "export ", this.body = new $(e.declaration.body, e, i);
2881
2873
  else
2882
2874
  throw new Error(`invalid type: ${JSON.stringify(e)}`);
@@ -2900,12 +2892,12 @@ class wt extends T {
2900
2892
  format(e = 0, t = "optimized") {
2901
2893
  let i = !1, r;
2902
2894
  if (t === "singleLine" || t === "optimized") {
2903
- const c = this.header.format("singleLine", e), d = I(this.node.consequent) ? 2 : 0;
2895
+ const c = this.header.format("singleLine", e), d = b(this.node.consequent) ? 2 : 0;
2904
2896
  (t === "singleLine" || this.canFitSingleLine(c, e, d)) && (r = c);
2905
2897
  }
2906
2898
  r || (i = !0, r = this.header.format("multiline", e));
2907
2899
  let s;
2908
- if (I(this.node.consequent)) {
2900
+ if (b(this.node.consequent)) {
2909
2901
  const c = this.consequent.format(e, "optimized");
2910
2902
  s = D.joinLines([r, " ", c]);
2911
2903
  } else if (i || ae(this.node.consequent)) {
@@ -2919,9 +2911,9 @@ class wt extends T {
2919
2911
  }
2920
2912
  if (!this.alternate)
2921
2913
  return this.addComments(s, e);
2922
- const a = bt(this.node.consequent) || !I(this.node.consequent);
2914
+ const a = It(this.node.consequent) || !b(this.node.consequent);
2923
2915
  let o;
2924
- if (this.alternate.externalOffset = 0, I(this.node.alternate) || ae(this.node.alternate))
2916
+ if (this.alternate.externalOffset = 0, b(this.node.alternate) || ae(this.node.alternate))
2925
2917
  this.alternate.indentStatementFirstLine = !1, this.alternate.externalOffset = a ? 5 : s.lastLineLength + 6, o = this.alternate.format(e, "optimized"), o = D.joinLines(["else ", o]);
2926
2918
  else {
2927
2919
  const c = a ? 4 : s.lastLineLength + 4;
@@ -2948,7 +2940,7 @@ class kt extends T {
2948
2940
  }
2949
2941
  class Lt extends T {
2950
2942
  constructor(e, t, i) {
2951
- super(e, t, i), this.node = e, this.expression = E(e.expression, e, i);
2943
+ super(e, t, i), this.node = e, this.expression = C(e.expression, e, i);
2952
2944
  }
2953
2945
  format(e = 0, t = "optimized") {
2954
2946
  if (t === "singleLine" || t === "optimized") {
@@ -2961,7 +2953,7 @@ class Lt extends T {
2961
2953
  }
2962
2954
  class Tt extends T {
2963
2955
  constructor(e, t, i) {
2964
- super(e, t, i), this.node = e, this.argument = E(e.argument, e, i);
2956
+ super(e, t, i), this.node = e, this.argument = C(e.argument, e, i);
2965
2957
  }
2966
2958
  format(e = 0, t = "optimized") {
2967
2959
  if (t === "singleLine" || t === "optimized") {
@@ -2979,7 +2971,7 @@ class Tt extends T {
2979
2971
  }
2980
2972
  class vt extends T {
2981
2973
  constructor(e, t, i) {
2982
- super(e, t, i), this.node = e, this.libraryNamePrinter = E(e.specifiers[0].local, e, i), this.librarySourcePrinter = E(e.source, e, i);
2974
+ super(e, t, i), this.node = e, this.libraryNamePrinter = C(e.specifiers[0].local, e, i), this.librarySourcePrinter = C(e.source, e, i);
2983
2975
  }
2984
2976
  format(e = 0) {
2985
2977
  return this.addComments(
@@ -3009,13 +3001,13 @@ function Nt(n, e) {
3009
3001
  const t = de(e), i = Z.fromString(n, t), r = i.toString(), s = Re(r, {
3010
3002
  tolerant: !0,
3011
3003
  comments: !0
3012
- }), a = Dt(s, i);
3004
+ }), a = lt(s, i);
3013
3005
  return s.loc.start = a.start, s.loc.end = a.end, new $(s, null, t).format().toString();
3014
3006
  }
3015
- const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debugger", "switch", "try"], jt = Ut.map((n) => ({ label: n, kind: g.Constant })), zt = Mt.map((n) => ({ label: n, kind: g.Keyword })), Vt = [
3007
+ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debugger", "switch", "try"], jt = Ut.map((n) => ({ label: n, kind: x.Constant })), zt = Mt.map((n) => ({ label: n, kind: x.Keyword })), Vt = [
3016
3008
  {
3017
3009
  label: "exportfunction",
3018
- kind: g.Snippet,
3010
+ kind: x.Snippet,
3019
3011
  detail: "Export Function Statement",
3020
3012
  insertText: `export function \${1:functionName} ($2) {
3021
3013
  $0
@@ -3025,7 +3017,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
3025
3017
  },
3026
3018
  {
3027
3019
  label: "exportvar",
3028
- kind: g.Snippet,
3020
+ kind: x.Snippet,
3029
3021
  detail: "Export Variable Statement",
3030
3022
  insertText: "export var ${0:variableName}\n",
3031
3023
  insertTextMode: S.adjustIndentation,
@@ -3033,7 +3025,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
3033
3025
  },
3034
3026
  {
3035
3027
  label: "for",
3036
- kind: g.Snippet,
3028
+ kind: x.Snippet,
3037
3029
  detail: "For Loop Statement",
3038
3030
  insertText: "for (var ${1:i} = 0; ${1:i} < ${2:array.length}; ${1:i}++) {\n $0\n}",
3039
3031
  insertTextMode: S.adjustIndentation,
@@ -3041,7 +3033,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
3041
3033
  },
3042
3034
  {
3043
3035
  label: "forin",
3044
- kind: g.Snippet,
3036
+ kind: x.Snippet,
3045
3037
  detail: "For-In Loop Statement",
3046
3038
  insertText: "for (var ${1:i} in ${2:arrayOrObject}) {\n $0\n}",
3047
3039
  insertTextMode: S.adjustIndentation,
@@ -3049,7 +3041,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
3049
3041
  },
3050
3042
  {
3051
3043
  label: "forof",
3052
- kind: g.Snippet,
3044
+ kind: x.Snippet,
3053
3045
  detail: "For-Of Loop Statement",
3054
3046
  insertText: "for (var ${1:i} of ${2:arrayOrObject}) {\n $0\n}",
3055
3047
  insertTextMode: S.adjustIndentation,
@@ -3057,7 +3049,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
3057
3049
  },
3058
3050
  {
3059
3051
  label: "function",
3060
- kind: g.Snippet,
3052
+ kind: x.Snippet,
3061
3053
  detail: "Function Statement",
3062
3054
  insertText: `function \${1:functionName} ($2) {
3063
3055
  $0
@@ -3067,7 +3059,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
3067
3059
  },
3068
3060
  {
3069
3061
  label: "if",
3070
- kind: g.Snippet,
3062
+ kind: x.Snippet,
3071
3063
  detail: "If Statement",
3072
3064
  insertText: `if (\${1:1==1}) {
3073
3065
  $0
@@ -3077,7 +3069,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
3077
3069
  },
3078
3070
  {
3079
3071
  label: "ifelse",
3080
- kind: g.Snippet,
3072
+ kind: x.Snippet,
3081
3073
  detail: "If-Else Statement",
3082
3074
  insertText: `if (\${1:1==1}) {
3083
3075
  $0
@@ -3089,7 +3081,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
3089
3081
  },
3090
3082
  {
3091
3083
  label: "else",
3092
- kind: g.Snippet,
3084
+ kind: x.Snippet,
3093
3085
  detail: "Else Statement",
3094
3086
  insertText: `else {
3095
3087
  $0
@@ -3099,7 +3091,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
3099
3091
  },
3100
3092
  {
3101
3093
  label: "import",
3102
- kind: g.Snippet,
3094
+ kind: x.Snippet,
3103
3095
  detail: "Import Statement",
3104
3096
  insertText: 'import ${1:namespace} from "${0:uri}"',
3105
3097
  insertTextMode: S.adjustIndentation,
@@ -3107,7 +3099,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
3107
3099
  },
3108
3100
  {
3109
3101
  label: "while",
3110
- kind: g.Snippet,
3102
+ kind: x.Snippet,
3111
3103
  detail: "While Loop Statement",
3112
3104
  insertText: `while (\${1:false}) {
3113
3105
  $0
@@ -3126,10 +3118,10 @@ function $t(n, e) {
3126
3118
  function Rt(n, e) {
3127
3119
  return n.line < e.start.line;
3128
3120
  }
3129
- function qe(n, e) {
3121
+ function He(n, e) {
3130
3122
  return !(Rt(n, e) || $t(n, e) || n.line === e.start.line && n.column < e.start.column || n.line === e.end.line && n.column > e.end.column);
3131
3123
  }
3132
- const x = {
3124
+ const g = {
3133
3125
  None: 0,
3134
3126
  Keywords: 1,
3135
3127
  All: 255,
@@ -3144,27 +3136,27 @@ const x = {
3144
3136
  keywords: "c"
3145
3137
  };
3146
3138
  function Wt(n, e, t, i = {}) {
3147
- const r = n.getText({ start: { line: 0, character: 0 }, end: e }), { tokens: s, errors: a = [] } = ht(r, { loc: !0, tolerant: !0 });
3139
+ const r = n.getText({ start: { line: 0, character: 0 }, end: e }), { tokens: s, errors: a = [] } = ct(r, { loc: !0, tolerant: !0 });
3148
3140
  if (a.length)
3149
3141
  return { isIncomplete: !1, items: [] };
3150
3142
  let o = s.at(s.length - 1), c = "";
3151
3143
  const d = ni(e);
3152
- o?.type === "Identifier" && qe(d, o.loc) && (c = o.value, s.pop(), o = s[s.length - 1]);
3153
- const C = {
3144
+ o?.type === "Identifier" && He(d, o.loc) && (c = o.value, s.pop(), o = s[s.length - 1]);
3145
+ const E = {
3154
3146
  variables: i.profile?.variables ?? [],
3155
3147
  additionalCompletionItems: (i.snippets ?? []).map((F) => ({
3156
- kind: g.Snippet,
3148
+ kind: x.Snippet,
3157
3149
  insertTextMode: S.adjustIndentation,
3158
3150
  insertTextFormat: B.Snippet,
3159
3151
  ...F
3160
3152
  })),
3161
3153
  apiDatabase: t
3162
3154
  };
3163
- return o?.type === "Punctuator" && (o.value === "." || o.value === w) ? Ht(s, c, C) : Kt(s, c, d, C);
3155
+ return o?.type === "Punctuator" && (o.value === "." || o.value === w) ? Ht(s, c, E) : Kt(s, c, d, E);
3164
3156
  }
3165
3157
  function Kt(n, e, t, i) {
3166
3158
  const r = Jt(n, t);
3167
- if (r === x.None)
3159
+ if (r === g.None)
3168
3160
  return { isIncomplete: !1, items: [] };
3169
3161
  const s = Xt(n), a = [], o = new RegExp(e.replaceAll(Ce, "\\$&"), "i");
3170
3162
  return s.forEach((c, d) => {
@@ -3182,8 +3174,8 @@ function Kt(n, e, t, i) {
3182
3174
  }), i.apiDatabase.constantDefinitions.forEach((c, d) => {
3183
3175
  c.type === "constant" && c.disableDocumentation === !0 || !o.test(d) || a.push({ ...c.completion, sortText: v.constants });
3184
3176
  }), i.apiDatabase.functionDefinitions.forEach((c, d) => {
3185
- o.test(d) && c.overloads.forEach((C) => {
3186
- C.disableDocumentation || a.push({ ...C.completion, sortText: v.functions });
3177
+ o.test(d) && c.overloads.forEach((E) => {
3178
+ E.disableDocumentation || a.push({ ...E.completion, sortText: v.functions });
3187
3179
  });
3188
3180
  }), { isIncomplete: !1, items: a };
3189
3181
  }
@@ -3217,8 +3209,8 @@ function Gt(n, e, t, i) {
3217
3209
  return null;
3218
3210
  let r = n.shift(), s = i.variables;
3219
3211
  for (; r; ) {
3220
- const d = s.find((C) => C.name.toLowerCase() === r);
3221
- if (!Je(d))
3212
+ const d = s.find((E) => E.name.toLowerCase() === r);
3213
+ if (!Ge(d))
3222
3214
  return null;
3223
3215
  s = d.properties ?? [], r = n.shift();
3224
3216
  }
@@ -3228,40 +3220,40 @@ function Gt(n, e, t, i) {
3228
3220
  }), { isIncomplete: !1, items: a };
3229
3221
  }
3230
3222
  function ve(n) {
3231
- return (n & x.Keywords) === x.Keywords;
3223
+ return (n & g.Keywords) === g.Keywords;
3232
3224
  }
3233
3225
  function Jt(n, e) {
3234
3226
  if (!n.length)
3235
- return x.All;
3227
+ return g.All;
3236
3228
  const t = n[n.length - 1];
3237
3229
  switch (t.type) {
3238
3230
  case "Identifier":
3239
- return x.All;
3231
+ return g.All;
3240
3232
  case "Keyword":
3241
- return ["return", "in", "else"].includes(t.value) ? x.NoKeywords : x.None;
3233
+ return ["return", "in", "else"].includes(t.value) ? g.NoKeywords : g.None;
3242
3234
  case "Punctuator":
3243
3235
  return Qt(n);
3244
3236
  case "Template":
3245
- return t.value.endsWith("${") ? x.NoKeywords : x.All;
3237
+ return t.value.endsWith("${") ? g.NoKeywords : g.All;
3246
3238
  default:
3247
- return qe(e, t.loc) ? x.None : x.All;
3239
+ return He(e, t.loc) ? g.None : g.All;
3248
3240
  }
3249
3241
  }
3250
3242
  function Qt(n) {
3251
3243
  const e = [...n];
3252
3244
  let t = e.pop();
3253
3245
  if (!t)
3254
- return x.All;
3246
+ return g.All;
3255
3247
  if (t.type !== "Punctuator")
3256
- return x.None;
3248
+ return g.None;
3257
3249
  if (t.value !== "(" && t.value !== ",")
3258
- return x.All;
3250
+ return g.All;
3259
3251
  if (t.value === "(")
3260
3252
  return Pe(e);
3261
3253
  let i = 0;
3262
3254
  for (t = e.pop(); t; ) {
3263
3255
  if (t.type === "Keyword")
3264
- return x.None;
3256
+ return g.None;
3265
3257
  if (t.type !== "Punctuator") {
3266
3258
  t = e.pop();
3267
3259
  continue;
@@ -3272,7 +3264,7 @@ function Qt(n) {
3272
3264
  }
3273
3265
  if (t.value === "[") {
3274
3266
  if (i === 0)
3275
- return x.NoKeywords;
3267
+ return g.NoKeywords;
3276
3268
  i += 1, t = e.pop();
3277
3269
  continue;
3278
3270
  }
@@ -3284,12 +3276,12 @@ function Qt(n) {
3284
3276
  }
3285
3277
  t = e.pop();
3286
3278
  }
3287
- return x.None;
3279
+ return g.None;
3288
3280
  }
3289
3281
  function Pe(n) {
3290
3282
  const e = [...n];
3291
3283
  let t = e.pop();
3292
- return t ? t.type === "Keyword" ? t.value.toLowerCase() === "for" ? x.All : x.NoKeywords : t.type !== "Identifier" ? x.All : (t = e.pop(), t?.type === "Keyword" && t.value.toLowerCase() === "function" ? x.None : x.NoKeywords) : x.All;
3284
+ return t ? t.type === "Keyword" ? t.value.toLowerCase() === "for" ? g.All : g.NoKeywords : t.type !== "Identifier" ? g.All : (t = e.pop(), t?.type === "Keyword" && t.value.toLowerCase() === "function" ? g.None : g.NoKeywords) : g.All;
3293
3285
  }
3294
3286
  class Zt {
3295
3287
  constructor(e) {
@@ -3341,7 +3333,7 @@ function Yt(n, e) {
3341
3333
  const t = n.current.value, i = t.toLowerCase();
3342
3334
  e.set(i, {
3343
3335
  label: t,
3344
- kind: g.Variable,
3336
+ kind: x.Variable,
3345
3337
  detail: _(H.variableFormat, { name: t })
3346
3338
  });
3347
3339
  const r = n.increment();
@@ -3363,7 +3355,7 @@ function ei(n, e) {
3363
3355
  return;
3364
3356
  const t = n.current.value, i = t.toLowerCase(), r = {
3365
3357
  label: t,
3366
- kind: g.Function,
3358
+ kind: x.Function,
3367
3359
  detail: _(H.functionFormat, { name: t, paramsDetail: "" }),
3368
3360
  insertText: `${t}()`,
3369
3361
  insertTextMode: S.adjustIndentation,
@@ -3382,7 +3374,7 @@ function ei(n, e) {
3382
3374
  name: r.label,
3383
3375
  paramsDetail: a.join(", ")
3384
3376
  });
3385
- const d = a.map((C, F) => `\${${F + 1}:${C}}`).join(", ");
3377
+ const d = a.map((E, F) => `\${${F + 1}:${E}}`).join(", ");
3386
3378
  r.insertText = `${r.label}(${d})`;
3387
3379
  }
3388
3380
  if (!P(s, ")") || (s = n.increment(), !P(s, "{")))
@@ -3395,10 +3387,10 @@ function ei(n, e) {
3395
3387
  if (c === 0)
3396
3388
  return;
3397
3389
  n.currentIndex = o, a.forEach((d) => {
3398
- const C = d.toLowerCase();
3399
- e.set(C, {
3390
+ const E = d.toLowerCase();
3391
+ e.set(E, {
3400
3392
  label: d,
3401
- kind: g.Variable,
3393
+ kind: x.Variable,
3402
3394
  detail: _(H.parameterFormat, { name: d })
3403
3395
  });
3404
3396
  });
@@ -3598,7 +3590,7 @@ class si {
3598
3590
  const i = {
3599
3591
  severity: A.Error,
3600
3592
  ...t,
3601
- message: _(lt[t.code], t.data),
3593
+ message: _(ht[t.code], t.data),
3602
3594
  range: {
3603
3595
  start: { line: e.start.line - 1, character: e.start.column },
3604
3596
  end: { line: e.end.line - 1, character: e.end.column }
@@ -3662,7 +3654,7 @@ class si {
3662
3654
  }), this.inBlock(this.validateStatement, e.body);
3663
3655
  }
3664
3656
  validateForInOfStatement(e) {
3665
- if (b(e.left)) {
3657
+ if (I(e.left)) {
3666
3658
  const t = this._assignmentValidationMode;
3667
3659
  this._assignmentValidationMode = "left", this._identifierBeingAssigned = e.left.name.toLowerCase(), this.validateExpression(e.left), this._assignmentValidationMode = t;
3668
3660
  } else
@@ -3683,11 +3675,11 @@ class si {
3683
3675
  }
3684
3676
  validateAssignmentExpression(e) {
3685
3677
  const t = this._identifierBeingAssigned, i = this._assignmentValidationMode;
3686
- b(e.left) && (this._identifierBeingAssigned = e.left.name.toLowerCase(), this._assignmentValidationMode = "left"), this.validateExpression(e.left), b(e.left) && (this._assignmentValidationMode = "right"), this.validateExpression(e.right), this._identifierBeingAssigned = t, this._assignmentValidationMode = i;
3678
+ I(e.left) && (this._identifierBeingAssigned = e.left.name.toLowerCase(), this._assignmentValidationMode = "left"), this.validateExpression(e.left), I(e.left) && (this._assignmentValidationMode = "right"), this.validateExpression(e.right), this._identifierBeingAssigned = t, this._assignmentValidationMode = i;
3687
3679
  }
3688
3680
  validateCallExpression(e) {
3689
3681
  const t = this._isInCallExpression;
3690
- if (this._isInCallExpression = !0, this.validateExpression(e.callee), b(e.callee)) {
3682
+ if (this._isInCallExpression = !0, this.validateExpression(e.callee), I(e.callee)) {
3691
3683
  const i = e.callee.name.toLowerCase(), r = this.getIdentifierInfo(i), s = this._apiDatabase?.functionDefinitions.get(i);
3692
3684
  if (!r && s) {
3693
3685
  const a = ai(s, e.arguments.length);
@@ -3771,13 +3763,13 @@ class si {
3771
3763
  }
3772
3764
  validateMemberExpression(e) {
3773
3765
  const t = this.flattenMemberExpressionAndValidate(e), i = t[0].object;
3774
- this.disableRecordIdentifierAssignment(this.validateExpression, i), b(i) && (this.getIdentifierInfo(i.name.toLowerCase()) || this.validateMemberExpressionWithProfile(t) || this.validateConstantMemberExpression(t));
3766
+ this.disableRecordIdentifierAssignment(this.validateExpression, i), I(i) && (this.getIdentifierInfo(i.name.toLowerCase()) || this.validateMemberExpressionWithProfile(t) || this.validateConstantMemberExpression(t));
3775
3767
  }
3776
3768
  flattenMemberExpressionAndValidate(e) {
3777
3769
  switch (e.type) {
3778
3770
  case u.SafeMemberExpression:
3779
3771
  case u.MemberExpression:
3780
- return (!b(e.property) || e.computed) && this.validateExpression(e.property), [...this.flattenMemberExpressionAndValidate(e.object), e];
3772
+ return (!I(e.property) || e.computed) && this.validateExpression(e.property), [...this.flattenMemberExpressionAndValidate(e.object), e];
3781
3773
  default:
3782
3774
  return [];
3783
3775
  }
@@ -3794,7 +3786,7 @@ class si {
3794
3786
  }
3795
3787
  validateConstantMemberExpression(e) {
3796
3788
  const t = e[0];
3797
- if (!b(t.object))
3789
+ if (!I(t.object))
3798
3790
  return !1;
3799
3791
  const i = t.object.name.toLowerCase(), r = this._apiDatabase?.constantDefinitions.get(i);
3800
3792
  if (!r)
@@ -3856,7 +3848,7 @@ class si {
3856
3848
  );
3857
3849
  if (!c) {
3858
3850
  const d = s.properties.reduce(
3859
- (C, F) => `${C}${C ? " | " : ""}${F.name.split(".").pop()}`,
3851
+ (E, F) => `${E}${E ? " | " : ""}${F.name.split(".").pop()}`,
3860
3852
  ""
3861
3853
  );
3862
3854
  return this.logDiagnostic(e[a].property.loc, {
@@ -3949,7 +3941,7 @@ function ui(n) {
3949
3941
  return !!n && n.name === "ParsingError";
3950
3942
  }
3951
3943
  function j(n) {
3952
- return pe(n) || I(n) && !n.body.length;
3944
+ return pe(n) || b(n) && !n.body.length;
3953
3945
  }
3954
3946
  function ai(n, e) {
3955
3947
  const { min: t, max: i } = n.overloads.reduce(
@@ -3967,7 +3959,7 @@ function ci(n = "") {
3967
3959
  }
3968
3960
  class pi {
3969
3961
  configure(e) {
3970
- this.apiService = new Qe(e);
3962
+ this.apiService = new Je(e);
3971
3963
  }
3972
3964
  async doValidation(e, t) {
3973
3965
  if (!this.apiService)
@@ -3987,7 +3979,7 @@ export {
3987
3979
  pi as ArcadeLanguageService,
3988
3980
  Ut as ArcadeLiterals,
3989
3981
  Ot as ArcadeReservedKeywords,
3990
- lt as DiagnosticMessages,
3982
+ ht as DiagnosticMessages,
3991
3983
  fi as DiagnosticSeverity,
3992
3984
  p as ValidationDiagnosticCodes,
3993
3985
  Di as arcadeFormat,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/arcade-languageservice",
3
- "version": "5.1.0-next.9",
3
+ "version": "5.1.0-next.90",
4
4
  "description": "Arcade Language Service",
5
5
  "homepage": "https://developers.arcgis.com/javascript/latest/",
6
6
  "type": "module",
@@ -15,6 +15,6 @@
15
15
  "tslib": "^2.8.1",
16
16
  "vscode-languageserver-textdocument": "^1.0.11",
17
17
  "vscode-languageserver-types": "^3.17.5",
18
- "@arcgis/languages-api-utils": "5.1.0-next.9"
18
+ "@arcgis/languages-api-utils": "5.1.0-next.90"
19
19
  }
20
20
  }