dorian 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +15 -0
  3. data/.github/workflows/ci.yml +38 -0
  4. data/.gitignore +30 -0
  5. data/.node-version +1 -0
  6. data/.prettierignore +2 -0
  7. data/.rubocop.yml +129 -0
  8. data/.ruby-version +1 -0
  9. data/.tool-versions +3 -0
  10. data/Gemfile +20 -0
  11. data/Gemfile.lock +186 -0
  12. data/LICENSE +19 -0
  13. data/README.md +24 -0
  14. data/VERSION +1 -1
  15. data/bin/bundle +123 -0
  16. data/bin/bundle-audit +31 -0
  17. data/bin/bundler-audit +31 -0
  18. data/bin/rspec +31 -0
  19. data/bin/rubocop +31 -0
  20. data/dorian.gemspec +35 -0
  21. data/lib/dorian/bin.rb +739 -81
  22. data/package-lock.json +39 -0
  23. data/package.json +11 -0
  24. data/samples/books.json +33 -0
  25. data/samples/books.jsonl +3 -0
  26. data/samples/config.yml +27 -0
  27. data/samples/config_2.yml +22 -0
  28. data/samples/maths.js +1 -0
  29. data/samples/numbers.raw +10 -0
  30. data/samples/people.csv +6 -0
  31. data/samples/people.yml +28 -0
  32. data/samples/query.sql +7 -0
  33. data/samples/user.json +31 -0
  34. data/spec/dorian_spec.rb +276 -0
  35. data/spec/spec_helper.rb +3 -0
  36. data/vendor/groovy-beautify/LICENSE.MD +21 -0
  37. data/vendor/groovy-beautify/README.md +65 -0
  38. data/vendor/groovy-beautify/dist/__tests__/index.test.d.ts +1 -0
  39. data/vendor/groovy-beautify/dist/cjs/index.js +573 -0
  40. data/vendor/groovy-beautify/dist/cjs/package.json +3 -0
  41. data/vendor/groovy-beautify/dist/es/index.js +682 -0
  42. data/vendor/groovy-beautify/dist/es/package.json +3 -0
  43. data/vendor/groovy-beautify/dist/formatter/FormatRule.d.ts +14 -0
  44. data/vendor/groovy-beautify/dist/formatter/Formatter.d.ts +11 -0
  45. data/vendor/groovy-beautify/dist/formatter/GroovyFormatRules.d.ts +3 -0
  46. data/vendor/groovy-beautify/dist/formatter/__tests__/formatter.test.d.ts +1 -0
  47. data/vendor/groovy-beautify/dist/index.d.ts +5 -0
  48. data/vendor/groovy-beautify/dist/parser/GroovyParseRules.d.ts +3 -0
  49. data/vendor/groovy-beautify/dist/parser/ParseRule.d.ts +23 -0
  50. data/vendor/groovy-beautify/dist/parser/Parser.d.ts +29 -0
  51. data/vendor/groovy-beautify/dist/parser/__tests__/parser.test.d.ts +1 -0
  52. data/vendor/groovy-beautify/dist/parser/types.d.ts +6 -0
  53. data/vendor/groovy-beautify/dist/utils/text.d.ts +4 -0
  54. data/vendor/groovy-beautify/package.json +55 -0
  55. data/vendor/prettier/LICENSE +4379 -0
  56. data/vendor/prettier/README.md +109 -0
  57. data/vendor/prettier/bin/prettier.cjs +71 -0
  58. data/vendor/prettier/doc.d.ts +243 -0
  59. data/vendor/prettier/doc.js +1545 -0
  60. data/vendor/prettier/doc.mjs +1503 -0
  61. data/vendor/prettier/index.cjs +825 -0
  62. data/vendor/prettier/index.d.ts +941 -0
  63. data/vendor/prettier/index.mjs +25899 -0
  64. data/vendor/prettier/internal/cli.mjs +4366 -0
  65. data/vendor/prettier/package.json +198 -0
  66. data/vendor/prettier/plugins/acorn.d.ts +6 -0
  67. data/vendor/prettier/plugins/acorn.js +6618 -0
  68. data/vendor/prettier/plugins/acorn.mjs +6456 -0
  69. data/vendor/prettier/plugins/angular.d.ts +8 -0
  70. data/vendor/prettier/plugins/angular.js +2435 -0
  71. data/vendor/prettier/plugins/angular.mjs +2375 -0
  72. data/vendor/prettier/plugins/babel.d.ts +18 -0
  73. data/vendor/prettier/plugins/babel.js +14271 -0
  74. data/vendor/prettier/plugins/babel.mjs +13986 -0
  75. data/vendor/prettier/plugins/estree.d.ts +1 -0
  76. data/vendor/prettier/plugins/estree.js +9487 -0
  77. data/vendor/prettier/plugins/estree.mjs +9279 -0
  78. data/vendor/prettier/plugins/flow.d.ts +5 -0
  79. data/vendor/prettier/plugins/flow.js +51477 -0
  80. data/vendor/prettier/plugins/flow.mjs +51219 -0
  81. data/vendor/prettier/plugins/glimmer.d.ts +5 -0
  82. data/vendor/prettier/plugins/glimmer.js +8534 -0
  83. data/vendor/prettier/plugins/glimmer.mjs +8421 -0
  84. data/vendor/prettier/plugins/graphql.d.ts +5 -0
  85. data/vendor/prettier/plugins/graphql.js +2421 -0
  86. data/vendor/prettier/plugins/graphql.mjs +2347 -0
  87. data/vendor/prettier/plugins/html.d.ts +8 -0
  88. data/vendor/prettier/plugins/html.js +8182 -0
  89. data/vendor/prettier/plugins/html.mjs +8077 -0
  90. data/vendor/prettier/plugins/markdown.d.ts +7 -0
  91. data/vendor/prettier/plugins/markdown.js +9068 -0
  92. data/vendor/prettier/plugins/markdown.mjs +8977 -0
  93. data/vendor/prettier/plugins/meriyah.d.ts +5 -0
  94. data/vendor/prettier/plugins/meriyah.js +5953 -0
  95. data/vendor/prettier/plugins/meriyah.mjs +5800 -0
  96. data/vendor/prettier/plugins/postcss.d.ts +7 -0
  97. data/vendor/prettier/plugins/postcss.js +9244 -0
  98. data/vendor/prettier/plugins/postcss.mjs +9046 -0
  99. data/vendor/prettier/plugins/typescript.d.ts +5 -0
  100. data/vendor/prettier/plugins/typescript.js +38058 -0
  101. data/vendor/prettier/plugins/typescript.mjs +37732 -0
  102. data/vendor/prettier/plugins/yaml.d.ts +5 -0
  103. data/vendor/prettier/plugins/yaml.js +7425 -0
  104. data/vendor/prettier/plugins/yaml.mjs +7329 -0
  105. data/vendor/prettier/standalone.d.ts +33 -0
  106. data/vendor/prettier/standalone.js +3984 -0
  107. data/vendor/prettier/standalone.mjs +3938 -0
  108. data/vendor/sql-formatter.js +18762 -0
  109. metadata +205 -2
@@ -0,0 +1,2375 @@
1
+ var Je = Object.defineProperty;
2
+ var ae = (r) => {
3
+ throw TypeError(r);
4
+ };
5
+ var oe = (r, t) => {
6
+ for (var e in t) Je(r, e, { get: t[e], enumerable: !0 });
7
+ };
8
+ var Ut = (r, t, e) => t.has(r) || ae("Cannot " + e);
9
+ var O = (r, t, e) => (
10
+ Ut(r, t, "read from private field"), e ? e.call(r) : t.get(r)
11
+ ),
12
+ P = (r, t, e) =>
13
+ t.has(r)
14
+ ? ae("Cannot add the same private member more than once")
15
+ : t instanceof WeakSet
16
+ ? t.add(r)
17
+ : t.set(r, e),
18
+ Y = (r, t, e, s) => (
19
+ Ut(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e
20
+ ),
21
+ c = (r, t, e) => (Ut(r, t, "access private method"), e);
22
+ var ne = {};
23
+ oe(ne, { parsers: () => ie });
24
+ var ie = {};
25
+ oe(ie, {
26
+ __ng_action: () => js,
27
+ __ng_binding: () => Ys,
28
+ __ng_directive: () => Js,
29
+ __ng_interpolation: () => Zs,
30
+ });
31
+ var Z = class {
32
+ constructor(t, e, s, i) {
33
+ (this.input = e),
34
+ (this.errLocation = s),
35
+ (this.ctxLocation = i),
36
+ (this.message = `Parser Error: ${t} ${s} [${e}] in ${i}`);
37
+ }
38
+ },
39
+ b = class {
40
+ constructor(t, e) {
41
+ (this.start = t), (this.end = e);
42
+ }
43
+ toAbsolute(t) {
44
+ return new L(t + this.start, t + this.end);
45
+ }
46
+ },
47
+ m = class {
48
+ constructor(t, e) {
49
+ (this.span = t), (this.sourceSpan = e);
50
+ }
51
+ toString() {
52
+ return "AST";
53
+ }
54
+ },
55
+ J = class extends m {
56
+ constructor(t, e, s) {
57
+ super(t, e), (this.nameSpan = s);
58
+ }
59
+ },
60
+ $ = class extends m {
61
+ visit(t, e = null) {}
62
+ },
63
+ K = class extends m {
64
+ visit(t, e = null) {
65
+ return t.visitImplicitReceiver(this, e);
66
+ }
67
+ },
68
+ Lt = class extends K {
69
+ visit(t, e = null) {
70
+ var s;
71
+ return (s = t.visitThisReceiver) == null ? void 0 : s.call(t, this, e);
72
+ }
73
+ },
74
+ X = class extends m {
75
+ constructor(t, e, s) {
76
+ super(t, e), (this.expressions = s);
77
+ }
78
+ visit(t, e = null) {
79
+ return t.visitChain(this, e);
80
+ }
81
+ },
82
+ tt = class extends m {
83
+ constructor(t, e, s, i, n) {
84
+ super(t, e),
85
+ (this.condition = s),
86
+ (this.trueExp = i),
87
+ (this.falseExp = n);
88
+ }
89
+ visit(t, e = null) {
90
+ return t.visitConditional(this, e);
91
+ }
92
+ },
93
+ M = class extends J {
94
+ constructor(t, e, s, i, n) {
95
+ super(t, e, s), (this.receiver = i), (this.name = n);
96
+ }
97
+ visit(t, e = null) {
98
+ return t.visitPropertyRead(this, e);
99
+ }
100
+ },
101
+ et = class extends J {
102
+ constructor(t, e, s, i, n, a) {
103
+ super(t, e, s), (this.receiver = i), (this.name = n), (this.value = a);
104
+ }
105
+ visit(t, e = null) {
106
+ return t.visitPropertyWrite(this, e);
107
+ }
108
+ },
109
+ _ = class extends J {
110
+ constructor(t, e, s, i, n) {
111
+ super(t, e, s), (this.receiver = i), (this.name = n);
112
+ }
113
+ visit(t, e = null) {
114
+ return t.visitSafePropertyRead(this, e);
115
+ }
116
+ },
117
+ st = class extends m {
118
+ constructor(t, e, s, i) {
119
+ super(t, e), (this.receiver = s), (this.key = i);
120
+ }
121
+ visit(t, e = null) {
122
+ return t.visitKeyedRead(this, e);
123
+ }
124
+ },
125
+ U = class extends m {
126
+ constructor(t, e, s, i) {
127
+ super(t, e), (this.receiver = s), (this.key = i);
128
+ }
129
+ visit(t, e = null) {
130
+ return t.visitSafeKeyedRead(this, e);
131
+ }
132
+ },
133
+ rt = class extends m {
134
+ constructor(t, e, s, i, n) {
135
+ super(t, e), (this.receiver = s), (this.key = i), (this.value = n);
136
+ }
137
+ visit(t, e = null) {
138
+ return t.visitKeyedWrite(this, e);
139
+ }
140
+ },
141
+ it = class extends J {
142
+ constructor(t, e, s, i, n, a) {
143
+ super(t, e, a), (this.exp = s), (this.name = i), (this.args = n);
144
+ }
145
+ visit(t, e = null) {
146
+ return t.visitPipe(this, e);
147
+ }
148
+ },
149
+ E = class extends m {
150
+ constructor(t, e, s) {
151
+ super(t, e), (this.value = s);
152
+ }
153
+ visit(t, e = null) {
154
+ return t.visitLiteralPrimitive(this, e);
155
+ }
156
+ },
157
+ nt = class extends m {
158
+ constructor(t, e, s) {
159
+ super(t, e), (this.expressions = s);
160
+ }
161
+ visit(t, e = null) {
162
+ return t.visitLiteralArray(this, e);
163
+ }
164
+ },
165
+ at = class extends m {
166
+ constructor(t, e, s, i) {
167
+ super(t, e), (this.keys = s), (this.values = i);
168
+ }
169
+ visit(t, e = null) {
170
+ return t.visitLiteralMap(this, e);
171
+ }
172
+ },
173
+ ot = class extends m {
174
+ constructor(t, e, s, i) {
175
+ super(t, e), (this.strings = s), (this.expressions = i);
176
+ }
177
+ visit(t, e = null) {
178
+ return t.visitInterpolation(this, e);
179
+ }
180
+ },
181
+ A = class extends m {
182
+ constructor(t, e, s, i, n) {
183
+ super(t, e), (this.operation = s), (this.left = i), (this.right = n);
184
+ }
185
+ visit(t, e = null) {
186
+ return t.visitBinary(this, e);
187
+ }
188
+ },
189
+ F = class r extends A {
190
+ static createMinus(t, e, s) {
191
+ return new r(t, e, "-", s, "-", new E(t, e, 0), s);
192
+ }
193
+ static createPlus(t, e, s) {
194
+ return new r(t, e, "+", s, "-", s, new E(t, e, 0));
195
+ }
196
+ constructor(t, e, s, i, n, a, o) {
197
+ super(t, e, n, a, o),
198
+ (this.operator = s),
199
+ (this.expr = i),
200
+ (this.left = null),
201
+ (this.right = null),
202
+ (this.operation = null);
203
+ }
204
+ visit(t, e = null) {
205
+ return t.visitUnary !== void 0
206
+ ? t.visitUnary(this, e)
207
+ : t.visitBinary(this, e);
208
+ }
209
+ },
210
+ ct = class extends m {
211
+ constructor(t, e, s) {
212
+ super(t, e), (this.expression = s);
213
+ }
214
+ visit(t, e = null) {
215
+ return t.visitPrefixNot(this, e);
216
+ }
217
+ },
218
+ ht = class extends m {
219
+ constructor(t, e, s) {
220
+ super(t, e), (this.expression = s);
221
+ }
222
+ visit(t, e = null) {
223
+ return t.visitNonNullAssert(this, e);
224
+ }
225
+ },
226
+ pt = class extends m {
227
+ constructor(t, e, s, i, n) {
228
+ super(t, e),
229
+ (this.receiver = s),
230
+ (this.args = i),
231
+ (this.argumentSpan = n);
232
+ }
233
+ visit(t, e = null) {
234
+ return t.visitCall(this, e);
235
+ }
236
+ },
237
+ D = class extends m {
238
+ constructor(t, e, s, i, n) {
239
+ super(t, e),
240
+ (this.receiver = s),
241
+ (this.args = i),
242
+ (this.argumentSpan = n);
243
+ }
244
+ visit(t, e = null) {
245
+ return t.visitSafeCall(this, e);
246
+ }
247
+ },
248
+ L = class {
249
+ constructor(t, e) {
250
+ (this.start = t), (this.end = e);
251
+ }
252
+ },
253
+ R = class extends m {
254
+ constructor(t, e, s, i, n) {
255
+ super(
256
+ new b(0, e === null ? 0 : e.length),
257
+ new L(i, e === null ? i : i + e.length),
258
+ ),
259
+ (this.ast = t),
260
+ (this.source = e),
261
+ (this.location = s),
262
+ (this.errors = n);
263
+ }
264
+ visit(t, e = null) {
265
+ return t.visitASTWithSource
266
+ ? t.visitASTWithSource(this, e)
267
+ : this.ast.visit(t, e);
268
+ }
269
+ toString() {
270
+ return `${this.source} in ${this.location}`;
271
+ }
272
+ },
273
+ W = class {
274
+ constructor(t, e, s) {
275
+ (this.sourceSpan = t), (this.key = e), (this.value = s);
276
+ }
277
+ },
278
+ ut = class {
279
+ constructor(t, e, s) {
280
+ (this.sourceSpan = t), (this.key = e), (this.value = s);
281
+ }
282
+ },
283
+ Rt = class {
284
+ visit(t, e) {
285
+ t.visit(this, e);
286
+ }
287
+ visitUnary(t, e) {
288
+ this.visit(t.expr, e);
289
+ }
290
+ visitBinary(t, e) {
291
+ this.visit(t.left, e), this.visit(t.right, e);
292
+ }
293
+ visitChain(t, e) {
294
+ this.visitAll(t.expressions, e);
295
+ }
296
+ visitConditional(t, e) {
297
+ this.visit(t.condition, e),
298
+ this.visit(t.trueExp, e),
299
+ this.visit(t.falseExp, e);
300
+ }
301
+ visitPipe(t, e) {
302
+ this.visit(t.exp, e), this.visitAll(t.args, e);
303
+ }
304
+ visitImplicitReceiver(t, e) {}
305
+ visitThisReceiver(t, e) {}
306
+ visitInterpolation(t, e) {
307
+ this.visitAll(t.expressions, e);
308
+ }
309
+ visitKeyedRead(t, e) {
310
+ this.visit(t.receiver, e), this.visit(t.key, e);
311
+ }
312
+ visitKeyedWrite(t, e) {
313
+ this.visit(t.receiver, e), this.visit(t.key, e), this.visit(t.value, e);
314
+ }
315
+ visitLiteralArray(t, e) {
316
+ this.visitAll(t.expressions, e);
317
+ }
318
+ visitLiteralMap(t, e) {
319
+ this.visitAll(t.values, e);
320
+ }
321
+ visitLiteralPrimitive(t, e) {}
322
+ visitPrefixNot(t, e) {
323
+ this.visit(t.expression, e);
324
+ }
325
+ visitNonNullAssert(t, e) {
326
+ this.visit(t.expression, e);
327
+ }
328
+ visitPropertyRead(t, e) {
329
+ this.visit(t.receiver, e);
330
+ }
331
+ visitPropertyWrite(t, e) {
332
+ this.visit(t.receiver, e), this.visit(t.value, e);
333
+ }
334
+ visitSafePropertyRead(t, e) {
335
+ this.visit(t.receiver, e);
336
+ }
337
+ visitSafeKeyedRead(t, e) {
338
+ this.visit(t.receiver, e), this.visit(t.key, e);
339
+ }
340
+ visitCall(t, e) {
341
+ this.visit(t.receiver, e), this.visitAll(t.args, e);
342
+ }
343
+ visitSafeCall(t, e) {
344
+ this.visit(t.receiver, e), this.visitAll(t.args, e);
345
+ }
346
+ visitAll(t, e) {
347
+ for (let s of t) this.visit(s, e);
348
+ }
349
+ };
350
+ var ce;
351
+ (function (r) {
352
+ (r[(r.DEFAULT = 0)] = "DEFAULT"),
353
+ (r[(r.LITERAL_ATTR = 1)] = "LITERAL_ATTR"),
354
+ (r[(r.ANIMATION = 2)] = "ANIMATION"),
355
+ (r[(r.TWO_WAY = 3)] = "TWO_WAY");
356
+ })(ce || (ce = {}));
357
+ var he;
358
+ (function (r) {
359
+ (r[(r.Regular = 0)] = "Regular"),
360
+ (r[(r.Animation = 1)] = "Animation"),
361
+ (r[(r.TwoWay = 2)] = "TwoWay");
362
+ })(he || (he = {}));
363
+ var pe;
364
+ (function (r) {
365
+ (r[(r.Property = 0)] = "Property"),
366
+ (r[(r.Attribute = 1)] = "Attribute"),
367
+ (r[(r.Class = 2)] = "Class"),
368
+ (r[(r.Style = 3)] = "Style"),
369
+ (r[(r.Animation = 4)] = "Animation"),
370
+ (r[(r.TwoWay = 5)] = "TwoWay");
371
+ })(pe || (pe = {}));
372
+ function ue(r) {
373
+ return (r >= 9 && r <= 32) || r == 160;
374
+ }
375
+ function B(r) {
376
+ return 48 <= r && r <= 57;
377
+ }
378
+ function le(r) {
379
+ return (r >= 97 && r <= 122) || (r >= 65 && r <= 90);
380
+ }
381
+ function Ft(r) {
382
+ return r === 39 || r === 34 || r === 96;
383
+ }
384
+ var l;
385
+ (function (r) {
386
+ (r[(r.Character = 0)] = "Character"),
387
+ (r[(r.Identifier = 1)] = "Identifier"),
388
+ (r[(r.PrivateIdentifier = 2)] = "PrivateIdentifier"),
389
+ (r[(r.Keyword = 3)] = "Keyword"),
390
+ (r[(r.String = 4)] = "String"),
391
+ (r[(r.Operator = 5)] = "Operator"),
392
+ (r[(r.Number = 6)] = "Number"),
393
+ (r[(r.Error = 7)] = "Error");
394
+ })(l || (l = {}));
395
+ var ks = [
396
+ "var",
397
+ "let",
398
+ "as",
399
+ "null",
400
+ "undefined",
401
+ "true",
402
+ "false",
403
+ "if",
404
+ "else",
405
+ "this",
406
+ ],
407
+ yt = class {
408
+ tokenize(t) {
409
+ let e = new Gt(t),
410
+ s = [],
411
+ i = e.scanToken();
412
+ for (; i != null; ) s.push(i), (i = e.scanToken());
413
+ return s;
414
+ }
415
+ },
416
+ I = class {
417
+ constructor(t, e, s, i, n) {
418
+ (this.index = t),
419
+ (this.end = e),
420
+ (this.type = s),
421
+ (this.numValue = i),
422
+ (this.strValue = n);
423
+ }
424
+ isCharacter(t) {
425
+ return this.type == l.Character && this.numValue == t;
426
+ }
427
+ isNumber() {
428
+ return this.type == l.Number;
429
+ }
430
+ isString() {
431
+ return this.type == l.String;
432
+ }
433
+ isOperator(t) {
434
+ return this.type == l.Operator && this.strValue == t;
435
+ }
436
+ isIdentifier() {
437
+ return this.type == l.Identifier;
438
+ }
439
+ isPrivateIdentifier() {
440
+ return this.type == l.PrivateIdentifier;
441
+ }
442
+ isKeyword() {
443
+ return this.type == l.Keyword;
444
+ }
445
+ isKeywordLet() {
446
+ return this.type == l.Keyword && this.strValue == "let";
447
+ }
448
+ isKeywordAs() {
449
+ return this.type == l.Keyword && this.strValue == "as";
450
+ }
451
+ isKeywordNull() {
452
+ return this.type == l.Keyword && this.strValue == "null";
453
+ }
454
+ isKeywordUndefined() {
455
+ return this.type == l.Keyword && this.strValue == "undefined";
456
+ }
457
+ isKeywordTrue() {
458
+ return this.type == l.Keyword && this.strValue == "true";
459
+ }
460
+ isKeywordFalse() {
461
+ return this.type == l.Keyword && this.strValue == "false";
462
+ }
463
+ isKeywordThis() {
464
+ return this.type == l.Keyword && this.strValue == "this";
465
+ }
466
+ isError() {
467
+ return this.type == l.Error;
468
+ }
469
+ toNumber() {
470
+ return this.type == l.Number ? this.numValue : -1;
471
+ }
472
+ toString() {
473
+ switch (this.type) {
474
+ case l.Character:
475
+ case l.Identifier:
476
+ case l.Keyword:
477
+ case l.Operator:
478
+ case l.PrivateIdentifier:
479
+ case l.String:
480
+ case l.Error:
481
+ return this.strValue;
482
+ case l.Number:
483
+ return this.numValue.toString();
484
+ default:
485
+ return null;
486
+ }
487
+ }
488
+ };
489
+ function ge(r, t, e) {
490
+ return new I(r, t, l.Character, e, String.fromCharCode(e));
491
+ }
492
+ function Ns(r, t, e) {
493
+ return new I(r, t, l.Identifier, 0, e);
494
+ }
495
+ function Ls(r, t, e) {
496
+ return new I(r, t, l.PrivateIdentifier, 0, e);
497
+ }
498
+ function Rs(r, t, e) {
499
+ return new I(r, t, l.Keyword, 0, e);
500
+ }
501
+ function Wt(r, t, e) {
502
+ return new I(r, t, l.Operator, 0, e);
503
+ }
504
+ function Ps(r, t, e) {
505
+ return new I(r, t, l.String, 0, e);
506
+ }
507
+ function bs(r, t, e) {
508
+ return new I(r, t, l.Number, e, "");
509
+ }
510
+ function Ks(r, t, e) {
511
+ return new I(r, t, l.Error, 0, e);
512
+ }
513
+ var Bt = new I(-1, -1, l.Character, 0, ""),
514
+ Gt = class {
515
+ constructor(t) {
516
+ (this.input = t),
517
+ (this.peek = 0),
518
+ (this.index = -1),
519
+ (this.length = t.length),
520
+ this.advance();
521
+ }
522
+ advance() {
523
+ this.peek =
524
+ ++this.index >= this.length ? 0 : this.input.charCodeAt(this.index);
525
+ }
526
+ scanToken() {
527
+ let t = this.input,
528
+ e = this.length,
529
+ s = this.peek,
530
+ i = this.index;
531
+ for (; s <= 32; )
532
+ if (++i >= e) {
533
+ s = 0;
534
+ break;
535
+ } else s = t.charCodeAt(i);
536
+ if (((this.peek = s), (this.index = i), i >= e)) return null;
537
+ if (me(s)) return this.scanIdentifier();
538
+ if (B(s)) return this.scanNumber(i);
539
+ let n = i;
540
+ switch (s) {
541
+ case 46:
542
+ return (
543
+ this.advance(),
544
+ B(this.peek) ? this.scanNumber(n) : ge(n, this.index, 46)
545
+ );
546
+ case 40:
547
+ case 41:
548
+ case 123:
549
+ case 125:
550
+ case 91:
551
+ case 93:
552
+ case 44:
553
+ case 58:
554
+ case 59:
555
+ return this.scanCharacter(n, s);
556
+ case 39:
557
+ case 34:
558
+ return this.scanString();
559
+ case 35:
560
+ return this.scanPrivateIdentifier();
561
+ case 43:
562
+ case 45:
563
+ case 42:
564
+ case 47:
565
+ case 37:
566
+ case 94:
567
+ return this.scanOperator(n, String.fromCharCode(s));
568
+ case 63:
569
+ return this.scanQuestion(n);
570
+ case 60:
571
+ case 62:
572
+ return this.scanComplexOperator(n, String.fromCharCode(s), 61, "=");
573
+ case 33:
574
+ case 61:
575
+ return this.scanComplexOperator(
576
+ n,
577
+ String.fromCharCode(s),
578
+ 61,
579
+ "=",
580
+ 61,
581
+ "=",
582
+ );
583
+ case 38:
584
+ return this.scanComplexOperator(n, "&", 38, "&");
585
+ case 124:
586
+ return this.scanComplexOperator(n, "|", 124, "|");
587
+ case 160:
588
+ for (; ue(this.peek); ) this.advance();
589
+ return this.scanToken();
590
+ }
591
+ return (
592
+ this.advance(),
593
+ this.error(`Unexpected character [${String.fromCharCode(s)}]`, 0)
594
+ );
595
+ }
596
+ scanCharacter(t, e) {
597
+ return this.advance(), ge(t, this.index, e);
598
+ }
599
+ scanOperator(t, e) {
600
+ return this.advance(), Wt(t, this.index, e);
601
+ }
602
+ scanComplexOperator(t, e, s, i, n, a) {
603
+ this.advance();
604
+ let o = e;
605
+ return (
606
+ this.peek == s && (this.advance(), (o += i)),
607
+ n != null && this.peek == n && (this.advance(), (o += a)),
608
+ Wt(t, this.index, o)
609
+ );
610
+ }
611
+ scanIdentifier() {
612
+ let t = this.index;
613
+ for (this.advance(); Se(this.peek); ) this.advance();
614
+ let e = this.input.substring(t, this.index);
615
+ return ks.indexOf(e) > -1 ? Rs(t, this.index, e) : Ns(t, this.index, e);
616
+ }
617
+ scanPrivateIdentifier() {
618
+ let t = this.index;
619
+ if ((this.advance(), !me(this.peek)))
620
+ return this.error("Invalid character [#]", -1);
621
+ for (; Se(this.peek); ) this.advance();
622
+ let e = this.input.substring(t, this.index);
623
+ return Ls(t, this.index, e);
624
+ }
625
+ scanNumber(t) {
626
+ let e = this.index === t,
627
+ s = !1;
628
+ for (this.advance(); ; ) {
629
+ if (!B(this.peek))
630
+ if (this.peek === 95) {
631
+ if (
632
+ !B(this.input.charCodeAt(this.index - 1)) ||
633
+ !B(this.input.charCodeAt(this.index + 1))
634
+ )
635
+ return this.error("Invalid numeric separator", 0);
636
+ s = !0;
637
+ } else if (this.peek === 46) e = !1;
638
+ else if (Bs(this.peek)) {
639
+ if (
640
+ (this.advance(), Ts(this.peek) && this.advance(), !B(this.peek))
641
+ )
642
+ return this.error("Invalid exponent", -1);
643
+ e = !1;
644
+ } else break;
645
+ this.advance();
646
+ }
647
+ let i = this.input.substring(t, this.index);
648
+ s && (i = i.replace(/_/g, ""));
649
+ let n = e ? _s(i) : parseFloat(i);
650
+ return bs(t, this.index, n);
651
+ }
652
+ scanString() {
653
+ let t = this.index,
654
+ e = this.peek;
655
+ this.advance();
656
+ let s = "",
657
+ i = this.index,
658
+ n = this.input;
659
+ for (; this.peek != e; )
660
+ if (this.peek == 92) {
661
+ s += n.substring(i, this.index);
662
+ let o;
663
+ if ((this.advance(), this.peek == 117)) {
664
+ let p = n.substring(this.index + 1, this.index + 5);
665
+ if (/^[0-9a-f]+$/i.test(p)) o = parseInt(p, 16);
666
+ else return this.error(`Invalid unicode escape [\\u${p}]`, 0);
667
+ for (let u = 0; u < 5; u++) this.advance();
668
+ } else (o = Ms(this.peek)), this.advance();
669
+ (s += String.fromCharCode(o)), (i = this.index);
670
+ } else {
671
+ if (this.peek == 0) return this.error("Unterminated quote", 0);
672
+ this.advance();
673
+ }
674
+ let a = n.substring(i, this.index);
675
+ return this.advance(), Ps(t, this.index, s + a);
676
+ }
677
+ scanQuestion(t) {
678
+ this.advance();
679
+ let e = "?";
680
+ return (
681
+ (this.peek === 63 || this.peek === 46) &&
682
+ ((e += this.peek === 46 ? "." : "?"), this.advance()),
683
+ Wt(t, this.index, e)
684
+ );
685
+ }
686
+ error(t, e) {
687
+ let s = this.index + e;
688
+ return Ks(
689
+ s,
690
+ this.index,
691
+ `Lexer Error: ${t} at column ${s} in expression [${this.input}]`,
692
+ );
693
+ }
694
+ };
695
+ function me(r) {
696
+ return (97 <= r && r <= 122) || (65 <= r && r <= 90) || r == 95 || r == 36;
697
+ }
698
+ function Se(r) {
699
+ return le(r) || B(r) || r == 95 || r == 36;
700
+ }
701
+ function Bs(r) {
702
+ return r == 101 || r == 69;
703
+ }
704
+ function Ts(r) {
705
+ return r == 45 || r == 43;
706
+ }
707
+ function Ms(r) {
708
+ switch (r) {
709
+ case 110:
710
+ return 10;
711
+ case 102:
712
+ return 12;
713
+ case 114:
714
+ return 13;
715
+ case 116:
716
+ return 9;
717
+ case 118:
718
+ return 11;
719
+ default:
720
+ return r;
721
+ }
722
+ }
723
+ function _s(r) {
724
+ let t = parseInt(r);
725
+ if (isNaN(t)) throw new Error("Invalid integer literal when parsing " + r);
726
+ return t;
727
+ }
728
+ var Us = [/@/, /^\s*$/, /[<>]/, /^[{}]$/, /&(#|[a-z])/i, /^\/\//];
729
+ function Ee(r, t) {
730
+ if (t != null && !(Array.isArray(t) && t.length == 2))
731
+ throw new Error(`Expected '${r}' to be an array, [start, end].`);
732
+ if (t != null) {
733
+ let e = t[0],
734
+ s = t[1];
735
+ Us.forEach((i) => {
736
+ if (i.test(e) || i.test(s))
737
+ throw new Error(
738
+ `['${e}', '${s}'] contains unusable interpolation symbol.`,
739
+ );
740
+ });
741
+ }
742
+ }
743
+ var Qt = class r {
744
+ static fromArray(t) {
745
+ return t ? (Ee("interpolation", t), new r(t[0], t[1])) : Q;
746
+ }
747
+ constructor(t, e) {
748
+ (this.start = t), (this.end = e);
749
+ }
750
+ },
751
+ Q = new Qt("{{", "}}");
752
+ var zt = class {
753
+ constructor(t, e, s) {
754
+ (this.strings = t), (this.expressions = e), (this.offsets = s);
755
+ }
756
+ },
757
+ qt = class {
758
+ constructor(t, e, s) {
759
+ (this.templateBindings = t), (this.warnings = e), (this.errors = s);
760
+ }
761
+ },
762
+ mt = class {
763
+ constructor(t) {
764
+ (this._lexer = t), (this.errors = []);
765
+ }
766
+ parseAction(t, e, s, i = Q) {
767
+ this._checkNoInterpolation(t, e, i);
768
+ let n = this._stripComments(t),
769
+ a = this._lexer.tokenize(n),
770
+ o = new z(t, e, s, a, 1, this.errors, 0).parseChain();
771
+ return new R(o, t, e, s, this.errors);
772
+ }
773
+ parseBinding(t, e, s, i = Q) {
774
+ let n = this._parseBindingAst(t, e, s, i);
775
+ return new R(n, t, e, s, this.errors);
776
+ }
777
+ checkSimpleExpression(t) {
778
+ let e = new Ht();
779
+ return t.visit(e), e.errors;
780
+ }
781
+ parseSimpleBinding(t, e, s, i = Q) {
782
+ let n = this._parseBindingAst(t, e, s, i),
783
+ a = this.checkSimpleExpression(n);
784
+ return (
785
+ a.length > 0 &&
786
+ this._reportError(
787
+ `Host binding expression cannot contain ${a.join(" ")}`,
788
+ t,
789
+ e,
790
+ ),
791
+ new R(n, t, e, s, this.errors)
792
+ );
793
+ }
794
+ _reportError(t, e, s, i) {
795
+ this.errors.push(new Z(t, e, s, i));
796
+ }
797
+ _parseBindingAst(t, e, s, i) {
798
+ this._checkNoInterpolation(t, e, i);
799
+ let n = this._stripComments(t),
800
+ a = this._lexer.tokenize(n);
801
+ return new z(t, e, s, a, 0, this.errors, 0).parseChain();
802
+ }
803
+ parseTemplateBindings(t, e, s, i, n) {
804
+ let a = this._lexer.tokenize(e);
805
+ return new z(e, s, n, a, 0, this.errors, 0).parseTemplateBindings({
806
+ source: t,
807
+ span: new L(i, i + t.length),
808
+ });
809
+ }
810
+ parseInterpolation(t, e, s, i, n = Q) {
811
+ let {
812
+ strings: a,
813
+ expressions: o,
814
+ offsets: p,
815
+ } = this.splitInterpolation(t, e, i, n);
816
+ if (o.length === 0) return null;
817
+ let u = [];
818
+ for (let f = 0; f < o.length; ++f) {
819
+ let S = o[f].text,
820
+ g = this._stripComments(S),
821
+ y = this._lexer.tokenize(g),
822
+ w = new z(t, e, s, y, 0, this.errors, p[f]).parseChain();
823
+ u.push(w);
824
+ }
825
+ return this.createInterpolationAst(
826
+ a.map((f) => f.text),
827
+ u,
828
+ t,
829
+ e,
830
+ s,
831
+ );
832
+ }
833
+ parseInterpolationExpression(t, e, s) {
834
+ let i = this._stripComments(t),
835
+ n = this._lexer.tokenize(i),
836
+ a = new z(t, e, s, n, 0, this.errors, 0).parseChain(),
837
+ o = ["", ""];
838
+ return this.createInterpolationAst(o, [a], t, e, s);
839
+ }
840
+ createInterpolationAst(t, e, s, i, n) {
841
+ let a = new b(0, s.length),
842
+ o = new ot(a, a.toAbsolute(n), t, e);
843
+ return new R(o, s, i, n, this.errors);
844
+ }
845
+ splitInterpolation(t, e, s, i = Q) {
846
+ let n = [],
847
+ a = [],
848
+ o = [],
849
+ p = s ? Fs(s) : null,
850
+ u = 0,
851
+ f = !1,
852
+ S = !1,
853
+ { start: g, end: y } = i;
854
+ for (; u < t.length; )
855
+ if (f) {
856
+ let w = u,
857
+ H = w + g.length,
858
+ j = this._getInterpolationEndIndex(t, y, H);
859
+ if (j === -1) {
860
+ (f = !1), (S = !0);
861
+ break;
862
+ }
863
+ let T = j + y.length,
864
+ Nt = t.substring(H, j);
865
+ Nt.trim().length === 0 &&
866
+ this._reportError(
867
+ "Blank expressions are not allowed in interpolated strings",
868
+ t,
869
+ `at column ${u} in`,
870
+ e,
871
+ ),
872
+ a.push({ text: Nt, start: w, end: T });
873
+ let Ze = ((p == null ? void 0 : p.get(w)) ?? w) + g.length;
874
+ o.push(Ze), (u = T), (f = !1);
875
+ } else {
876
+ let w = u;
877
+ (u = t.indexOf(g, u)), u === -1 && (u = t.length);
878
+ let H = t.substring(w, u);
879
+ n.push({ text: H, start: w, end: u }), (f = !0);
880
+ }
881
+ if (!f)
882
+ if (S) {
883
+ let w = n[n.length - 1];
884
+ (w.text += t.substring(u)), (w.end = t.length);
885
+ } else n.push({ text: t.substring(u), start: u, end: t.length });
886
+ return new zt(n, a, o);
887
+ }
888
+ wrapLiteralPrimitive(t, e, s) {
889
+ let i = new b(0, t == null ? 0 : t.length);
890
+ return new R(new E(i, i.toAbsolute(s), t), t, e, s, this.errors);
891
+ }
892
+ _stripComments(t) {
893
+ let e = this._commentStart(t);
894
+ return e != null ? t.substring(0, e) : t;
895
+ }
896
+ _commentStart(t) {
897
+ let e = null;
898
+ for (let s = 0; s < t.length - 1; s++) {
899
+ let i = t.charCodeAt(s),
900
+ n = t.charCodeAt(s + 1);
901
+ if (i === 47 && n == 47 && e == null) return s;
902
+ e === i ? (e = null) : e == null && Ft(i) && (e = i);
903
+ }
904
+ return null;
905
+ }
906
+ _checkNoInterpolation(t, e, { start: s, end: i }) {
907
+ let n = -1,
908
+ a = -1;
909
+ for (let o of this._forEachUnquotedChar(t, 0))
910
+ if (n === -1) t.startsWith(s) && (n = o);
911
+ else if (((a = this._getInterpolationEndIndex(t, i, o)), a > -1)) break;
912
+ n > -1 &&
913
+ a > -1 &&
914
+ this._reportError(
915
+ `Got interpolation (${s}${i}) where expression was expected`,
916
+ t,
917
+ `at column ${n} in`,
918
+ e,
919
+ );
920
+ }
921
+ _getInterpolationEndIndex(t, e, s) {
922
+ for (let i of this._forEachUnquotedChar(t, s)) {
923
+ if (t.startsWith(e, i)) return i;
924
+ if (t.startsWith("//", i)) return t.indexOf(e, i);
925
+ }
926
+ return -1;
927
+ }
928
+ *_forEachUnquotedChar(t, e) {
929
+ let s = null,
930
+ i = 0;
931
+ for (let n = e; n < t.length; n++) {
932
+ let a = t[n];
933
+ Ft(t.charCodeAt(n)) && (s === null || s === a) && i % 2 === 0
934
+ ? (s = s === null ? a : null)
935
+ : s === null && (yield n),
936
+ (i = a === "\\" ? i + 1 : 0);
937
+ }
938
+ }
939
+ },
940
+ gt;
941
+ (function (r) {
942
+ (r[(r.None = 0)] = "None"), (r[(r.Writable = 1)] = "Writable");
943
+ })(gt || (gt = {}));
944
+ var z = class {
945
+ constructor(t, e, s, i, n, a, o) {
946
+ (this.input = t),
947
+ (this.location = e),
948
+ (this.absoluteOffset = s),
949
+ (this.tokens = i),
950
+ (this.parseFlags = n),
951
+ (this.errors = a),
952
+ (this.offset = o),
953
+ (this.rparensExpected = 0),
954
+ (this.rbracketsExpected = 0),
955
+ (this.rbracesExpected = 0),
956
+ (this.context = gt.None),
957
+ (this.sourceSpanCache = new Map()),
958
+ (this.index = 0);
959
+ }
960
+ peek(t) {
961
+ let e = this.index + t;
962
+ return e < this.tokens.length ? this.tokens[e] : Bt;
963
+ }
964
+ get next() {
965
+ return this.peek(0);
966
+ }
967
+ get atEOF() {
968
+ return this.index >= this.tokens.length;
969
+ }
970
+ get inputIndex() {
971
+ return this.atEOF ? this.currentEndIndex : this.next.index + this.offset;
972
+ }
973
+ get currentEndIndex() {
974
+ return this.index > 0
975
+ ? this.peek(-1).end + this.offset
976
+ : this.tokens.length === 0
977
+ ? this.input.length + this.offset
978
+ : this.next.index + this.offset;
979
+ }
980
+ get currentAbsoluteOffset() {
981
+ return this.absoluteOffset + this.inputIndex;
982
+ }
983
+ span(t, e) {
984
+ let s = this.currentEndIndex;
985
+ if ((e !== void 0 && e > this.currentEndIndex && (s = e), t > s)) {
986
+ let i = s;
987
+ (s = t), (t = i);
988
+ }
989
+ return new b(t, s);
990
+ }
991
+ sourceSpan(t, e) {
992
+ let s = `${t}@${this.inputIndex}:${e}`;
993
+ return (
994
+ this.sourceSpanCache.has(s) ||
995
+ this.sourceSpanCache.set(
996
+ s,
997
+ this.span(t, e).toAbsolute(this.absoluteOffset),
998
+ ),
999
+ this.sourceSpanCache.get(s)
1000
+ );
1001
+ }
1002
+ advance() {
1003
+ this.index++;
1004
+ }
1005
+ withContext(t, e) {
1006
+ this.context |= t;
1007
+ let s = e();
1008
+ return (this.context ^= t), s;
1009
+ }
1010
+ consumeOptionalCharacter(t) {
1011
+ return this.next.isCharacter(t) ? (this.advance(), !0) : !1;
1012
+ }
1013
+ peekKeywordLet() {
1014
+ return this.next.isKeywordLet();
1015
+ }
1016
+ peekKeywordAs() {
1017
+ return this.next.isKeywordAs();
1018
+ }
1019
+ expectCharacter(t) {
1020
+ this.consumeOptionalCharacter(t) ||
1021
+ this.error(`Missing expected ${String.fromCharCode(t)}`);
1022
+ }
1023
+ consumeOptionalOperator(t) {
1024
+ return this.next.isOperator(t) ? (this.advance(), !0) : !1;
1025
+ }
1026
+ expectOperator(t) {
1027
+ this.consumeOptionalOperator(t) ||
1028
+ this.error(`Missing expected operator ${t}`);
1029
+ }
1030
+ prettyPrintToken(t) {
1031
+ return t === Bt ? "end of input" : `token ${t}`;
1032
+ }
1033
+ expectIdentifierOrKeyword() {
1034
+ let t = this.next;
1035
+ return !t.isIdentifier() && !t.isKeyword()
1036
+ ? (t.isPrivateIdentifier()
1037
+ ? this._reportErrorForPrivateIdentifier(
1038
+ t,
1039
+ "expected identifier or keyword",
1040
+ )
1041
+ : this.error(
1042
+ `Unexpected ${this.prettyPrintToken(t)}, expected identifier or keyword`,
1043
+ ),
1044
+ null)
1045
+ : (this.advance(), t.toString());
1046
+ }
1047
+ expectIdentifierOrKeywordOrString() {
1048
+ let t = this.next;
1049
+ return !t.isIdentifier() && !t.isKeyword() && !t.isString()
1050
+ ? (t.isPrivateIdentifier()
1051
+ ? this._reportErrorForPrivateIdentifier(
1052
+ t,
1053
+ "expected identifier, keyword or string",
1054
+ )
1055
+ : this.error(
1056
+ `Unexpected ${this.prettyPrintToken(t)}, expected identifier, keyword, or string`,
1057
+ ),
1058
+ "")
1059
+ : (this.advance(), t.toString());
1060
+ }
1061
+ parseChain() {
1062
+ let t = [],
1063
+ e = this.inputIndex;
1064
+ for (; this.index < this.tokens.length; ) {
1065
+ let s = this.parsePipe();
1066
+ if ((t.push(s), this.consumeOptionalCharacter(59)))
1067
+ for (
1068
+ this.parseFlags & 1 ||
1069
+ this.error("Binding expression cannot contain chained expression");
1070
+ this.consumeOptionalCharacter(59);
1071
+
1072
+ );
1073
+ else if (this.index < this.tokens.length) {
1074
+ let i = this.index;
1075
+ if ((this.error(`Unexpected token '${this.next}'`), this.index === i))
1076
+ break;
1077
+ }
1078
+ }
1079
+ if (t.length === 0) {
1080
+ let s = this.offset,
1081
+ i = this.offset + this.input.length;
1082
+ return new $(this.span(s, i), this.sourceSpan(s, i));
1083
+ }
1084
+ return t.length == 1 ? t[0] : new X(this.span(e), this.sourceSpan(e), t);
1085
+ }
1086
+ parsePipe() {
1087
+ let t = this.inputIndex,
1088
+ e = this.parseExpression();
1089
+ if (this.consumeOptionalOperator("|")) {
1090
+ this.parseFlags & 1 &&
1091
+ this.error("Cannot have a pipe in an action expression");
1092
+ do {
1093
+ let s = this.inputIndex,
1094
+ i = this.expectIdentifierOrKeyword(),
1095
+ n,
1096
+ a;
1097
+ i !== null
1098
+ ? (n = this.sourceSpan(s))
1099
+ : ((i = ""),
1100
+ (a =
1101
+ this.next.index !== -1
1102
+ ? this.next.index
1103
+ : this.input.length + this.offset),
1104
+ (n = new b(a, a).toAbsolute(this.absoluteOffset)));
1105
+ let o = [];
1106
+ for (; this.consumeOptionalCharacter(58); )
1107
+ o.push(this.parseExpression());
1108
+ e = new it(this.span(t), this.sourceSpan(t, a), e, i, o, n);
1109
+ } while (this.consumeOptionalOperator("|"));
1110
+ }
1111
+ return e;
1112
+ }
1113
+ parseExpression() {
1114
+ return this.parseConditional();
1115
+ }
1116
+ parseConditional() {
1117
+ let t = this.inputIndex,
1118
+ e = this.parseLogicalOr();
1119
+ if (this.consumeOptionalOperator("?")) {
1120
+ let s = this.parsePipe(),
1121
+ i;
1122
+ if (this.consumeOptionalCharacter(58)) i = this.parsePipe();
1123
+ else {
1124
+ let n = this.inputIndex,
1125
+ a = this.input.substring(t, n);
1126
+ this.error(`Conditional expression ${a} requires all 3 expressions`),
1127
+ (i = new $(this.span(t), this.sourceSpan(t)));
1128
+ }
1129
+ return new tt(this.span(t), this.sourceSpan(t), e, s, i);
1130
+ } else return e;
1131
+ }
1132
+ parseLogicalOr() {
1133
+ let t = this.inputIndex,
1134
+ e = this.parseLogicalAnd();
1135
+ for (; this.consumeOptionalOperator("||"); ) {
1136
+ let s = this.parseLogicalAnd();
1137
+ e = new A(this.span(t), this.sourceSpan(t), "||", e, s);
1138
+ }
1139
+ return e;
1140
+ }
1141
+ parseLogicalAnd() {
1142
+ let t = this.inputIndex,
1143
+ e = this.parseNullishCoalescing();
1144
+ for (; this.consumeOptionalOperator("&&"); ) {
1145
+ let s = this.parseNullishCoalescing();
1146
+ e = new A(this.span(t), this.sourceSpan(t), "&&", e, s);
1147
+ }
1148
+ return e;
1149
+ }
1150
+ parseNullishCoalescing() {
1151
+ let t = this.inputIndex,
1152
+ e = this.parseEquality();
1153
+ for (; this.consumeOptionalOperator("??"); ) {
1154
+ let s = this.parseEquality();
1155
+ e = new A(this.span(t), this.sourceSpan(t), "??", e, s);
1156
+ }
1157
+ return e;
1158
+ }
1159
+ parseEquality() {
1160
+ let t = this.inputIndex,
1161
+ e = this.parseRelational();
1162
+ for (; this.next.type == l.Operator; ) {
1163
+ let s = this.next.strValue;
1164
+ switch (s) {
1165
+ case "==":
1166
+ case "===":
1167
+ case "!=":
1168
+ case "!==":
1169
+ this.advance();
1170
+ let i = this.parseRelational();
1171
+ e = new A(this.span(t), this.sourceSpan(t), s, e, i);
1172
+ continue;
1173
+ }
1174
+ break;
1175
+ }
1176
+ return e;
1177
+ }
1178
+ parseRelational() {
1179
+ let t = this.inputIndex,
1180
+ e = this.parseAdditive();
1181
+ for (; this.next.type == l.Operator; ) {
1182
+ let s = this.next.strValue;
1183
+ switch (s) {
1184
+ case "<":
1185
+ case ">":
1186
+ case "<=":
1187
+ case ">=":
1188
+ this.advance();
1189
+ let i = this.parseAdditive();
1190
+ e = new A(this.span(t), this.sourceSpan(t), s, e, i);
1191
+ continue;
1192
+ }
1193
+ break;
1194
+ }
1195
+ return e;
1196
+ }
1197
+ parseAdditive() {
1198
+ let t = this.inputIndex,
1199
+ e = this.parseMultiplicative();
1200
+ for (; this.next.type == l.Operator; ) {
1201
+ let s = this.next.strValue;
1202
+ switch (s) {
1203
+ case "+":
1204
+ case "-":
1205
+ this.advance();
1206
+ let i = this.parseMultiplicative();
1207
+ e = new A(this.span(t), this.sourceSpan(t), s, e, i);
1208
+ continue;
1209
+ }
1210
+ break;
1211
+ }
1212
+ return e;
1213
+ }
1214
+ parseMultiplicative() {
1215
+ let t = this.inputIndex,
1216
+ e = this.parsePrefix();
1217
+ for (; this.next.type == l.Operator; ) {
1218
+ let s = this.next.strValue;
1219
+ switch (s) {
1220
+ case "*":
1221
+ case "%":
1222
+ case "/":
1223
+ this.advance();
1224
+ let i = this.parsePrefix();
1225
+ e = new A(this.span(t), this.sourceSpan(t), s, e, i);
1226
+ continue;
1227
+ }
1228
+ break;
1229
+ }
1230
+ return e;
1231
+ }
1232
+ parsePrefix() {
1233
+ if (this.next.type == l.Operator) {
1234
+ let t = this.inputIndex,
1235
+ e = this.next.strValue,
1236
+ s;
1237
+ switch (e) {
1238
+ case "+":
1239
+ return (
1240
+ this.advance(),
1241
+ (s = this.parsePrefix()),
1242
+ F.createPlus(this.span(t), this.sourceSpan(t), s)
1243
+ );
1244
+ case "-":
1245
+ return (
1246
+ this.advance(),
1247
+ (s = this.parsePrefix()),
1248
+ F.createMinus(this.span(t), this.sourceSpan(t), s)
1249
+ );
1250
+ case "!":
1251
+ return (
1252
+ this.advance(),
1253
+ (s = this.parsePrefix()),
1254
+ new ct(this.span(t), this.sourceSpan(t), s)
1255
+ );
1256
+ }
1257
+ }
1258
+ return this.parseCallChain();
1259
+ }
1260
+ parseCallChain() {
1261
+ let t = this.inputIndex,
1262
+ e = this.parsePrimary();
1263
+ for (;;)
1264
+ if (this.consumeOptionalCharacter(46))
1265
+ e = this.parseAccessMember(e, t, !1);
1266
+ else if (this.consumeOptionalOperator("?."))
1267
+ this.consumeOptionalCharacter(40)
1268
+ ? (e = this.parseCall(e, t, !0))
1269
+ : (e = this.consumeOptionalCharacter(91)
1270
+ ? this.parseKeyedReadOrWrite(e, t, !0)
1271
+ : this.parseAccessMember(e, t, !0));
1272
+ else if (this.consumeOptionalCharacter(91))
1273
+ e = this.parseKeyedReadOrWrite(e, t, !1);
1274
+ else if (this.consumeOptionalCharacter(40))
1275
+ e = this.parseCall(e, t, !1);
1276
+ else if (this.consumeOptionalOperator("!"))
1277
+ e = new ht(this.span(t), this.sourceSpan(t), e);
1278
+ else return e;
1279
+ }
1280
+ parsePrimary() {
1281
+ let t = this.inputIndex;
1282
+ if (this.consumeOptionalCharacter(40)) {
1283
+ this.rparensExpected++;
1284
+ let e = this.parsePipe();
1285
+ return this.rparensExpected--, this.expectCharacter(41), e;
1286
+ } else {
1287
+ if (this.next.isKeywordNull())
1288
+ return this.advance(), new E(this.span(t), this.sourceSpan(t), null);
1289
+ if (this.next.isKeywordUndefined())
1290
+ return (
1291
+ this.advance(), new E(this.span(t), this.sourceSpan(t), void 0)
1292
+ );
1293
+ if (this.next.isKeywordTrue())
1294
+ return this.advance(), new E(this.span(t), this.sourceSpan(t), !0);
1295
+ if (this.next.isKeywordFalse())
1296
+ return this.advance(), new E(this.span(t), this.sourceSpan(t), !1);
1297
+ if (this.next.isKeywordThis())
1298
+ return this.advance(), new Lt(this.span(t), this.sourceSpan(t));
1299
+ if (this.consumeOptionalCharacter(91)) {
1300
+ this.rbracketsExpected++;
1301
+ let e = this.parseExpressionList(93);
1302
+ return (
1303
+ this.rbracketsExpected--,
1304
+ this.expectCharacter(93),
1305
+ new nt(this.span(t), this.sourceSpan(t), e)
1306
+ );
1307
+ } else {
1308
+ if (this.next.isCharacter(123)) return this.parseLiteralMap();
1309
+ if (this.next.isIdentifier())
1310
+ return this.parseAccessMember(
1311
+ new K(this.span(t), this.sourceSpan(t)),
1312
+ t,
1313
+ !1,
1314
+ );
1315
+ if (this.next.isNumber()) {
1316
+ let e = this.next.toNumber();
1317
+ return this.advance(), new E(this.span(t), this.sourceSpan(t), e);
1318
+ } else if (this.next.isString()) {
1319
+ let e = this.next.toString();
1320
+ return this.advance(), new E(this.span(t), this.sourceSpan(t), e);
1321
+ } else
1322
+ return this.next.isPrivateIdentifier()
1323
+ ? (this._reportErrorForPrivateIdentifier(this.next, null),
1324
+ new $(this.span(t), this.sourceSpan(t)))
1325
+ : this.index >= this.tokens.length
1326
+ ? (this.error(`Unexpected end of expression: ${this.input}`),
1327
+ new $(this.span(t), this.sourceSpan(t)))
1328
+ : (this.error(`Unexpected token ${this.next}`),
1329
+ new $(this.span(t), this.sourceSpan(t)));
1330
+ }
1331
+ }
1332
+ }
1333
+ parseExpressionList(t) {
1334
+ let e = [];
1335
+ do
1336
+ if (!this.next.isCharacter(t)) e.push(this.parsePipe());
1337
+ else break;
1338
+ while (this.consumeOptionalCharacter(44));
1339
+ return e;
1340
+ }
1341
+ parseLiteralMap() {
1342
+ let t = [],
1343
+ e = [],
1344
+ s = this.inputIndex;
1345
+ if ((this.expectCharacter(123), !this.consumeOptionalCharacter(125))) {
1346
+ this.rbracesExpected++;
1347
+ do {
1348
+ let i = this.inputIndex,
1349
+ n = this.next.isString(),
1350
+ a = this.expectIdentifierOrKeywordOrString(),
1351
+ o = { key: a, quoted: n };
1352
+ if ((t.push(o), n))
1353
+ this.expectCharacter(58), e.push(this.parsePipe());
1354
+ else if (this.consumeOptionalCharacter(58)) e.push(this.parsePipe());
1355
+ else {
1356
+ o.isShorthandInitialized = !0;
1357
+ let p = this.span(i),
1358
+ u = this.sourceSpan(i);
1359
+ e.push(new M(p, u, u, new K(p, u), a));
1360
+ }
1361
+ } while (
1362
+ this.consumeOptionalCharacter(44) &&
1363
+ !this.next.isCharacter(125)
1364
+ );
1365
+ this.rbracesExpected--, this.expectCharacter(125);
1366
+ }
1367
+ return new at(this.span(s), this.sourceSpan(s), t, e);
1368
+ }
1369
+ parseAccessMember(t, e, s) {
1370
+ let i = this.inputIndex,
1371
+ n = this.withContext(gt.Writable, () => {
1372
+ let p = this.expectIdentifierOrKeyword() ?? "";
1373
+ return (
1374
+ p.length === 0 &&
1375
+ this.error("Expected identifier for property access", t.span.end),
1376
+ p
1377
+ );
1378
+ }),
1379
+ a = this.sourceSpan(i),
1380
+ o;
1381
+ if (s)
1382
+ this.consumeOptionalOperator("=")
1383
+ ? (this.error("The '?.' operator cannot be used in the assignment"),
1384
+ (o = new $(this.span(e), this.sourceSpan(e))))
1385
+ : (o = new _(this.span(e), this.sourceSpan(e), a, t, n));
1386
+ else if (this.consumeOptionalOperator("=")) {
1387
+ if (!(this.parseFlags & 1))
1388
+ return (
1389
+ this.error("Bindings cannot contain assignments"),
1390
+ new $(this.span(e), this.sourceSpan(e))
1391
+ );
1392
+ let p = this.parseConditional();
1393
+ o = new et(this.span(e), this.sourceSpan(e), a, t, n, p);
1394
+ } else o = new M(this.span(e), this.sourceSpan(e), a, t, n);
1395
+ return o;
1396
+ }
1397
+ parseCall(t, e, s) {
1398
+ let i = this.inputIndex;
1399
+ this.rparensExpected++;
1400
+ let n = this.parseCallArguments(),
1401
+ a = this.span(i, this.inputIndex).toAbsolute(this.absoluteOffset);
1402
+ this.expectCharacter(41), this.rparensExpected--;
1403
+ let o = this.span(e),
1404
+ p = this.sourceSpan(e);
1405
+ return s ? new D(o, p, t, n, a) : new pt(o, p, t, n, a);
1406
+ }
1407
+ parseCallArguments() {
1408
+ if (this.next.isCharacter(41)) return [];
1409
+ let t = [];
1410
+ do t.push(this.parsePipe());
1411
+ while (this.consumeOptionalCharacter(44));
1412
+ return t;
1413
+ }
1414
+ expectTemplateBindingKey() {
1415
+ let t = "",
1416
+ e = !1,
1417
+ s = this.currentAbsoluteOffset;
1418
+ do
1419
+ (t += this.expectIdentifierOrKeywordOrString()),
1420
+ (e = this.consumeOptionalOperator("-")),
1421
+ e && (t += "-");
1422
+ while (e);
1423
+ return { source: t, span: new L(s, s + t.length) };
1424
+ }
1425
+ parseTemplateBindings(t) {
1426
+ let e = [];
1427
+ for (
1428
+ e.push(...this.parseDirectiveKeywordBindings(t));
1429
+ this.index < this.tokens.length;
1430
+
1431
+ ) {
1432
+ let s = this.parseLetBinding();
1433
+ if (s) e.push(s);
1434
+ else {
1435
+ let i = this.expectTemplateBindingKey(),
1436
+ n = this.parseAsBinding(i);
1437
+ n
1438
+ ? e.push(n)
1439
+ : ((i.source =
1440
+ t.source +
1441
+ i.source.charAt(0).toUpperCase() +
1442
+ i.source.substring(1)),
1443
+ e.push(...this.parseDirectiveKeywordBindings(i)));
1444
+ }
1445
+ this.consumeStatementTerminator();
1446
+ }
1447
+ return new qt(e, [], this.errors);
1448
+ }
1449
+ parseKeyedReadOrWrite(t, e, s) {
1450
+ return this.withContext(gt.Writable, () => {
1451
+ this.rbracketsExpected++;
1452
+ let i = this.parsePipe();
1453
+ if (
1454
+ (i instanceof $ && this.error("Key access cannot be empty"),
1455
+ this.rbracketsExpected--,
1456
+ this.expectCharacter(93),
1457
+ this.consumeOptionalOperator("="))
1458
+ )
1459
+ if (s)
1460
+ this.error("The '?.' operator cannot be used in the assignment");
1461
+ else {
1462
+ let n = this.parseConditional();
1463
+ return new rt(this.span(e), this.sourceSpan(e), t, i, n);
1464
+ }
1465
+ else
1466
+ return s
1467
+ ? new U(this.span(e), this.sourceSpan(e), t, i)
1468
+ : new st(this.span(e), this.sourceSpan(e), t, i);
1469
+ return new $(this.span(e), this.sourceSpan(e));
1470
+ });
1471
+ }
1472
+ parseDirectiveKeywordBindings(t) {
1473
+ let e = [];
1474
+ this.consumeOptionalCharacter(58);
1475
+ let s = this.getDirectiveBoundTarget(),
1476
+ i = this.currentAbsoluteOffset,
1477
+ n = this.parseAsBinding(t);
1478
+ n ||
1479
+ (this.consumeStatementTerminator(), (i = this.currentAbsoluteOffset));
1480
+ let a = new L(t.span.start, i);
1481
+ return e.push(new ut(a, t, s)), n && e.push(n), e;
1482
+ }
1483
+ getDirectiveBoundTarget() {
1484
+ if (this.next === Bt || this.peekKeywordAs() || this.peekKeywordLet())
1485
+ return null;
1486
+ let t = this.parsePipe(),
1487
+ { start: e, end: s } = t.span,
1488
+ i = this.input.substring(e, s);
1489
+ return new R(t, i, this.location, this.absoluteOffset + e, this.errors);
1490
+ }
1491
+ parseAsBinding(t) {
1492
+ if (!this.peekKeywordAs()) return null;
1493
+ this.advance();
1494
+ let e = this.expectTemplateBindingKey();
1495
+ this.consumeStatementTerminator();
1496
+ let s = new L(t.span.start, this.currentAbsoluteOffset);
1497
+ return new W(s, e, t);
1498
+ }
1499
+ parseLetBinding() {
1500
+ if (!this.peekKeywordLet()) return null;
1501
+ let t = this.currentAbsoluteOffset;
1502
+ this.advance();
1503
+ let e = this.expectTemplateBindingKey(),
1504
+ s = null;
1505
+ this.consumeOptionalOperator("=") &&
1506
+ (s = this.expectTemplateBindingKey()),
1507
+ this.consumeStatementTerminator();
1508
+ let i = new L(t, this.currentAbsoluteOffset);
1509
+ return new W(i, e, s);
1510
+ }
1511
+ consumeStatementTerminator() {
1512
+ this.consumeOptionalCharacter(59) || this.consumeOptionalCharacter(44);
1513
+ }
1514
+ error(t, e = null) {
1515
+ this.errors.push(
1516
+ new Z(t, this.input, this.locationText(e), this.location),
1517
+ ),
1518
+ this.skip();
1519
+ }
1520
+ locationText(t = null) {
1521
+ return (
1522
+ t == null && (t = this.index),
1523
+ t < this.tokens.length
1524
+ ? `at column ${this.tokens[t].index + 1} in`
1525
+ : "at the end of the expression"
1526
+ );
1527
+ }
1528
+ _reportErrorForPrivateIdentifier(t, e) {
1529
+ let s = `Private identifiers are not supported. Unexpected private identifier: ${t}`;
1530
+ e !== null && (s += `, ${e}`), this.error(s);
1531
+ }
1532
+ skip() {
1533
+ let t = this.next;
1534
+ for (
1535
+ ;
1536
+ this.index < this.tokens.length &&
1537
+ !t.isCharacter(59) &&
1538
+ !t.isOperator("|") &&
1539
+ (this.rparensExpected <= 0 || !t.isCharacter(41)) &&
1540
+ (this.rbracesExpected <= 0 || !t.isCharacter(125)) &&
1541
+ (this.rbracketsExpected <= 0 || !t.isCharacter(93)) &&
1542
+ (!(this.context & gt.Writable) || !t.isOperator("="));
1543
+
1544
+ )
1545
+ this.next.isError() &&
1546
+ this.errors.push(
1547
+ new Z(
1548
+ this.next.toString(),
1549
+ this.input,
1550
+ this.locationText(),
1551
+ this.location,
1552
+ ),
1553
+ ),
1554
+ this.advance(),
1555
+ (t = this.next);
1556
+ }
1557
+ },
1558
+ Ht = class extends Rt {
1559
+ constructor() {
1560
+ super(...arguments), (this.errors = []);
1561
+ }
1562
+ visitPipe() {
1563
+ this.errors.push("pipes");
1564
+ }
1565
+ };
1566
+ function Fs(r) {
1567
+ let t = new Map(),
1568
+ e = 0,
1569
+ s = 0,
1570
+ i = 0;
1571
+ for (; i < r.length; ) {
1572
+ let n = r[i];
1573
+ if (n.type === 9) {
1574
+ let [a, o] = n.parts;
1575
+ (e += o.length), (s += a.length);
1576
+ } else {
1577
+ let a = n.parts.reduce((o, p) => o + p.length, 0);
1578
+ (s += a), (e += a);
1579
+ }
1580
+ t.set(s, e), i++;
1581
+ }
1582
+ return t;
1583
+ }
1584
+ function Ce({ start: r, end: t }, e) {
1585
+ let s = r,
1586
+ i = t;
1587
+ for (; i !== s && /\s/.test(e[i - 1]); ) i--;
1588
+ for (; s !== i && /\s/.test(e[s]); ) s++;
1589
+ return { start: s, end: i };
1590
+ }
1591
+ function Ws({ start: r, end: t }, e) {
1592
+ let s = r,
1593
+ i = t;
1594
+ for (; i !== e.length && /\s/.test(e[i]); ) i++;
1595
+ for (; s !== 0 && /\s/.test(e[s - 1]); ) s--;
1596
+ return { start: s, end: i };
1597
+ }
1598
+ function Gs(r, t) {
1599
+ return t[r.start - 1] === "(" && t[r.end] === ")"
1600
+ ? { start: r.start - 1, end: r.end + 1 }
1601
+ : r;
1602
+ }
1603
+ function Ae(r, t, e) {
1604
+ let s = 0,
1605
+ i = { start: r.start, end: r.end };
1606
+ for (;;) {
1607
+ let n = Ws(i, t),
1608
+ a = Gs(n, t);
1609
+ if (n.start === a.start && n.end === a.end) break;
1610
+ (i.start = a.start), (i.end = a.end), s++;
1611
+ }
1612
+ return {
1613
+ hasParens: (e ? s - 1 : s) !== 0,
1614
+ outerSpan: Ce(e ? { start: i.start + 1, end: i.end - 1 } : i, t),
1615
+ innerSpan: Ce(r, t),
1616
+ };
1617
+ }
1618
+ function Oe(r) {
1619
+ return typeof r == "string" ? (t) => t === r : (t) => r.test(t);
1620
+ }
1621
+ function Ie(r, t, e) {
1622
+ let s = Oe(t);
1623
+ for (let i = e; i >= 0; i--) {
1624
+ let n = r[i];
1625
+ if (s(n)) return i;
1626
+ }
1627
+ throw new Error(
1628
+ `Cannot find front char ${t} from index ${e} in ${JSON.stringify(r)}`,
1629
+ );
1630
+ }
1631
+ function ke(r, t, e) {
1632
+ let s = Oe(t);
1633
+ for (let i = e; i < r.length; i++) {
1634
+ let n = r[i];
1635
+ if (s(n)) return i;
1636
+ }
1637
+ throw new Error(
1638
+ `Cannot find character ${t} from index ${e} in ${JSON.stringify(r)}`,
1639
+ );
1640
+ }
1641
+ function Ne(r) {
1642
+ return r.slice(0, 1).toLowerCase() + r.slice(1);
1643
+ }
1644
+ function Ct(r) {
1645
+ let { start: t, end: e } = r;
1646
+ return { start: t, end: e, range: [t, e] };
1647
+ }
1648
+ var Vs = (r) => mt.prototype._commentStart(r);
1649
+ function Qs(r, t) {
1650
+ let e = t ? Vs(r) : null;
1651
+ if (e === null) return { text: r, comments: [] };
1652
+ let s = {
1653
+ type: "CommentLine",
1654
+ value: r.slice(e + 2),
1655
+ ...Ct({ start: e, end: r.length }),
1656
+ };
1657
+ return { text: r.slice(0, e), comments: [s] };
1658
+ }
1659
+ function At(r, t = !0) {
1660
+ return (e) => {
1661
+ let s = new yt(),
1662
+ i = new mt(s),
1663
+ { text: n, comments: a } = Qs(e, t),
1664
+ o = r(n, i);
1665
+ if (o.errors.length !== 0) {
1666
+ let [{ message: p }] = o.errors;
1667
+ throw new SyntaxError(
1668
+ p.replace(/^Parser Error: | at column \d+ in [^]*$/g, ""),
1669
+ );
1670
+ }
1671
+ return { result: o, comments: a, text: n };
1672
+ };
1673
+ }
1674
+ var Le = At((r, t) => t.parseBinding(r, "", 0)),
1675
+ zs = At((r, t) => t.parseSimpleBinding(r, "", 0)),
1676
+ Re = At((r, t) => t.parseAction(r, "", 0)),
1677
+ Pe = At((r, t) => t.parseInterpolationExpression(r, "", 0)),
1678
+ be = At((r, t) => t.parseTemplateBindings("", r, "", 0, 0), !1);
1679
+ var Hs = (r, t, e) => {
1680
+ if (!(r && t == null))
1681
+ return Array.isArray(t) || typeof t == "string"
1682
+ ? t[e < 0 ? t.length + e : e]
1683
+ : t.at(e);
1684
+ },
1685
+ Tt = Hs;
1686
+ var jt = class {
1687
+ text;
1688
+ constructor(t) {
1689
+ this.text = t;
1690
+ }
1691
+ getCharacterIndex(t, e) {
1692
+ return ke(this.text, t, e);
1693
+ }
1694
+ getCharacterLastIndex(t, e) {
1695
+ return Ie(this.text, t, e);
1696
+ }
1697
+ transformSpan(t, { stripSpaces: e = !1, hasParentParens: s = !1 } = {}) {
1698
+ if (!e) return Ct(t);
1699
+ let { outerSpan: i, innerSpan: n, hasParens: a } = Ae(t, this.text, s),
1700
+ o = Ct(n);
1701
+ return (
1702
+ a &&
1703
+ (o.extra = {
1704
+ parenthesized: !0,
1705
+ parenStart: i.start,
1706
+ parenEnd: i.end,
1707
+ }),
1708
+ o
1709
+ );
1710
+ }
1711
+ createNode(t, { stripSpaces: e = !0, hasParentParens: s = !1 } = {}) {
1712
+ let { type: i, start: n, end: a } = t,
1713
+ o = {
1714
+ ...t,
1715
+ ...this.transformSpan(
1716
+ { start: n, end: a },
1717
+ { stripSpaces: e, hasParentParens: s },
1718
+ ),
1719
+ };
1720
+ switch (i) {
1721
+ case "NumericLiteral":
1722
+ case "StringLiteral": {
1723
+ let p = this.text.slice(o.start, o.end),
1724
+ { value: u } = o;
1725
+ o.extra = { ...o.extra, raw: p, rawValue: u };
1726
+ break;
1727
+ }
1728
+ case "ObjectProperty": {
1729
+ let { shorthand: p } = o;
1730
+ p && (o.extra = { ...o.extra, shorthand: p });
1731
+ break;
1732
+ }
1733
+ }
1734
+ return o;
1735
+ }
1736
+ },
1737
+ Ke = jt;
1738
+ function Zt(r) {
1739
+ var t;
1740
+ return !!((t = r.extra) != null && t.parenthesized);
1741
+ }
1742
+ function k(r) {
1743
+ return Zt(r) ? r.extra.parenStart : r.start;
1744
+ }
1745
+ function N(r) {
1746
+ return Zt(r) ? r.extra.parenEnd : r.end;
1747
+ }
1748
+ function Be(r) {
1749
+ return (
1750
+ (r.type === "OptionalCallExpression" ||
1751
+ r.type === "OptionalMemberExpression") &&
1752
+ !Zt(r)
1753
+ );
1754
+ }
1755
+ function Te(r, t) {
1756
+ let { start: e, end: s } = r.sourceSpan;
1757
+ return e >= s || /^\s+$/.test(t.slice(e, s));
1758
+ }
1759
+ var kt,
1760
+ St,
1761
+ h,
1762
+ d,
1763
+ Ot,
1764
+ v,
1765
+ Yt,
1766
+ It = class extends Ke {
1767
+ constructor(e, s) {
1768
+ super(s);
1769
+ P(this, h);
1770
+ P(this, kt);
1771
+ P(this, St);
1772
+ Y(this, kt, e), Y(this, St, s);
1773
+ }
1774
+ get node() {
1775
+ return c(this, h, v).call(this, O(this, kt));
1776
+ }
1777
+ transformNode(e) {
1778
+ return c(this, h, Yt).call(this, e);
1779
+ }
1780
+ };
1781
+ (kt = new WeakMap()),
1782
+ (St = new WeakMap()),
1783
+ (h = new WeakSet()),
1784
+ (d = function (e, { stripSpaces: s = !0, hasParentParens: i = !1 } = {}) {
1785
+ return this.createNode(e, { stripSpaces: s, hasParentParens: i });
1786
+ }),
1787
+ (Ot = function (
1788
+ e,
1789
+ s,
1790
+ { computed: i, optional: n, end: a = N(s), hasParentParens: o = !1 },
1791
+ ) {
1792
+ if (Te(e, O(this, St)) || e.sourceSpan.start === s.start) return s;
1793
+ let p = c(this, h, v).call(this, e),
1794
+ u = Be(p);
1795
+ return c(this, h, d).call(
1796
+ this,
1797
+ {
1798
+ type: n || u ? "OptionalMemberExpression" : "MemberExpression",
1799
+ object: p,
1800
+ property: s,
1801
+ computed: i,
1802
+ ...(n ? { optional: !0 } : u ? { optional: !1 } : void 0),
1803
+ start: k(p),
1804
+ end: a,
1805
+ },
1806
+ { hasParentParens: o },
1807
+ );
1808
+ }),
1809
+ (v = function (e, s = !1) {
1810
+ return c(this, h, Yt).call(this, e, s);
1811
+ }),
1812
+ (Yt = function (e, s = !1) {
1813
+ if (e instanceof ot) {
1814
+ let { expressions: i } = e;
1815
+ if (i.length !== 1) throw new Error("Unexpected 'Interpolation'");
1816
+ return c(this, h, v).call(this, i[0]);
1817
+ }
1818
+ if (e instanceof F)
1819
+ return c(this, h, d).call(
1820
+ this,
1821
+ {
1822
+ type: "UnaryExpression",
1823
+ prefix: !0,
1824
+ argument: c(this, h, v).call(this, e.expr),
1825
+ operator: e.operator,
1826
+ ...e.sourceSpan,
1827
+ },
1828
+ { hasParentParens: s },
1829
+ );
1830
+ if (e instanceof A) {
1831
+ let { left: i, operation: n, right: a } = e,
1832
+ o = c(this, h, v).call(this, i),
1833
+ p = c(this, h, v).call(this, a),
1834
+ u = k(o),
1835
+ f = N(p),
1836
+ S = { left: o, right: p, start: u, end: f };
1837
+ return n === "&&" || n === "||" || n === "??"
1838
+ ? c(this, h, d).call(
1839
+ this,
1840
+ { ...S, type: "LogicalExpression", operator: n },
1841
+ { hasParentParens: s },
1842
+ )
1843
+ : c(this, h, d).call(
1844
+ this,
1845
+ { ...S, type: "BinaryExpression", operator: n },
1846
+ { hasParentParens: s },
1847
+ );
1848
+ }
1849
+ if (e instanceof it) {
1850
+ let { exp: i, name: n, args: a } = e,
1851
+ o = c(this, h, v).call(this, i),
1852
+ p = k(o),
1853
+ u = N(o),
1854
+ f = this.getCharacterIndex(/\S/, this.getCharacterIndex("|", u) + 1),
1855
+ S = c(this, h, d).call(this, {
1856
+ type: "Identifier",
1857
+ name: n,
1858
+ start: f,
1859
+ end: f + n.length,
1860
+ }),
1861
+ g = a.map((y) => c(this, h, v).call(this, y));
1862
+ return c(this, h, d).call(
1863
+ this,
1864
+ {
1865
+ type: "NGPipeExpression",
1866
+ left: o,
1867
+ right: S,
1868
+ arguments: g,
1869
+ start: p,
1870
+ end: N(g.length === 0 ? S : Tt(!1, g, -1)),
1871
+ },
1872
+ { hasParentParens: s },
1873
+ );
1874
+ }
1875
+ if (e instanceof X)
1876
+ return c(this, h, d).call(
1877
+ this,
1878
+ {
1879
+ type: "NGChainedExpression",
1880
+ expressions: e.expressions.map((i) => c(this, h, v).call(this, i)),
1881
+ ...e.sourceSpan,
1882
+ },
1883
+ { hasParentParens: s },
1884
+ );
1885
+ if (e instanceof tt) {
1886
+ let { condition: i, trueExp: n, falseExp: a } = e,
1887
+ o = c(this, h, v).call(this, i),
1888
+ p = c(this, h, v).call(this, n),
1889
+ u = c(this, h, v).call(this, a);
1890
+ return c(this, h, d).call(
1891
+ this,
1892
+ {
1893
+ type: "ConditionalExpression",
1894
+ test: o,
1895
+ consequent: p,
1896
+ alternate: u,
1897
+ start: k(o),
1898
+ end: N(u),
1899
+ },
1900
+ { hasParentParens: s },
1901
+ );
1902
+ }
1903
+ if (e instanceof $)
1904
+ return c(this, h, d).call(
1905
+ this,
1906
+ { type: "NGEmptyExpression", ...e.sourceSpan },
1907
+ { hasParentParens: s },
1908
+ );
1909
+ if (e instanceof K)
1910
+ return c(this, h, d).call(
1911
+ this,
1912
+ { type: "ThisExpression", ...e.sourceSpan },
1913
+ { hasParentParens: s },
1914
+ );
1915
+ if (e instanceof st || e instanceof U)
1916
+ return c(this, h, Ot).call(
1917
+ this,
1918
+ e.receiver,
1919
+ c(this, h, v).call(this, e.key),
1920
+ {
1921
+ computed: !0,
1922
+ optional: e instanceof U,
1923
+ end: e.sourceSpan.end,
1924
+ hasParentParens: s,
1925
+ },
1926
+ );
1927
+ if (e instanceof nt)
1928
+ return c(this, h, d).call(
1929
+ this,
1930
+ {
1931
+ type: "ArrayExpression",
1932
+ elements: e.expressions.map((i) => c(this, h, v).call(this, i)),
1933
+ ...e.sourceSpan,
1934
+ },
1935
+ { hasParentParens: s },
1936
+ );
1937
+ if (e instanceof at) {
1938
+ let { keys: i, values: n } = e,
1939
+ a = n.map((p) => c(this, h, v).call(this, p)),
1940
+ o = i.map(({ key: p, quoted: u }, f) => {
1941
+ let S = a[f],
1942
+ g = k(S),
1943
+ y = N(S),
1944
+ w = this.getCharacterIndex(
1945
+ /\S/,
1946
+ f === 0
1947
+ ? e.sourceSpan.start + 1
1948
+ : this.getCharacterIndex(",", N(a[f - 1])) + 1,
1949
+ ),
1950
+ H =
1951
+ g === w
1952
+ ? y
1953
+ : this.getCharacterLastIndex(
1954
+ /\S/,
1955
+ this.getCharacterLastIndex(":", g - 1) - 1,
1956
+ ) + 1,
1957
+ j = { start: w, end: H },
1958
+ T = u
1959
+ ? c(this, h, d).call(this, {
1960
+ type: "StringLiteral",
1961
+ value: p,
1962
+ ...j,
1963
+ })
1964
+ : c(this, h, d).call(this, { type: "Identifier", name: p, ...j }),
1965
+ Nt = T.end < T.start || w === g;
1966
+ return c(this, h, d).call(this, {
1967
+ type: "ObjectProperty",
1968
+ key: T,
1969
+ value: S,
1970
+ shorthand: Nt,
1971
+ computed: !1,
1972
+ start: k(T),
1973
+ end: y,
1974
+ });
1975
+ });
1976
+ return c(this, h, d).call(
1977
+ this,
1978
+ { type: "ObjectExpression", properties: o, ...e.sourceSpan },
1979
+ { hasParentParens: s },
1980
+ );
1981
+ }
1982
+ if (e instanceof E) {
1983
+ let { value: i } = e;
1984
+ switch (typeof i) {
1985
+ case "boolean":
1986
+ return c(this, h, d).call(
1987
+ this,
1988
+ { type: "BooleanLiteral", value: i, ...e.sourceSpan },
1989
+ { hasParentParens: s },
1990
+ );
1991
+ case "number":
1992
+ return c(this, h, d).call(
1993
+ this,
1994
+ { type: "NumericLiteral", value: i, ...e.sourceSpan },
1995
+ { hasParentParens: s },
1996
+ );
1997
+ case "object":
1998
+ return c(this, h, d).call(
1999
+ this,
2000
+ { type: "NullLiteral", ...e.sourceSpan },
2001
+ { hasParentParens: s },
2002
+ );
2003
+ case "string":
2004
+ return c(this, h, d).call(
2005
+ this,
2006
+ { type: "StringLiteral", value: i, ...e.sourceSpan },
2007
+ { hasParentParens: s },
2008
+ );
2009
+ case "undefined":
2010
+ return c(this, h, d).call(
2011
+ this,
2012
+ { type: "Identifier", name: "undefined", ...e.sourceSpan },
2013
+ { hasParentParens: s },
2014
+ );
2015
+ default:
2016
+ throw new Error(`Unexpected LiteralPrimitive value type ${typeof i}`);
2017
+ }
2018
+ }
2019
+ if (e instanceof pt || e instanceof D) {
2020
+ let i = e instanceof D,
2021
+ { receiver: n, args: a } = e,
2022
+ o =
2023
+ a.length === 1
2024
+ ? [c(this, h, v).call(this, a[0], !0)]
2025
+ : a.map((S) => c(this, h, v).call(this, S)),
2026
+ p = c(this, h, v).call(this, n),
2027
+ u = Be(p),
2028
+ f = i || u ? "OptionalCallExpression" : "CallExpression";
2029
+ return c(this, h, d).call(
2030
+ this,
2031
+ {
2032
+ type: f,
2033
+ callee: p,
2034
+ arguments: o,
2035
+ optional: f === "OptionalCallExpression" ? i : void 0,
2036
+ start: k(p),
2037
+ end: e.sourceSpan.end,
2038
+ },
2039
+ { hasParentParens: s },
2040
+ );
2041
+ }
2042
+ if (e instanceof ht) {
2043
+ let i = c(this, h, v).call(this, e.expression);
2044
+ return c(this, h, d).call(
2045
+ this,
2046
+ {
2047
+ type: "TSNonNullExpression",
2048
+ expression: i,
2049
+ start: k(i),
2050
+ end: e.sourceSpan.end,
2051
+ },
2052
+ { hasParentParens: s },
2053
+ );
2054
+ }
2055
+ if (e instanceof ct) {
2056
+ let i = c(this, h, v).call(this, e.expression);
2057
+ return c(this, h, d).call(
2058
+ this,
2059
+ {
2060
+ type: "UnaryExpression",
2061
+ prefix: !0,
2062
+ operator: "!",
2063
+ argument: i,
2064
+ start: e.sourceSpan.start,
2065
+ end: N(i),
2066
+ },
2067
+ { hasParentParens: s },
2068
+ );
2069
+ }
2070
+ if (e instanceof M || e instanceof _) {
2071
+ let { receiver: i, name: n } = e,
2072
+ a = this.getCharacterLastIndex(/\S/, e.sourceSpan.end - 1) + 1,
2073
+ o = c(this, h, d).call(
2074
+ this,
2075
+ { type: "Identifier", name: n, start: a - n.length, end: a },
2076
+ Te(i, O(this, St)) ? { hasParentParens: s } : {},
2077
+ );
2078
+ return c(this, h, Ot).call(this, i, o, {
2079
+ computed: !1,
2080
+ optional: e instanceof _,
2081
+ hasParentParens: s,
2082
+ });
2083
+ }
2084
+ if (e instanceof rt) {
2085
+ let i = c(this, h, v).call(this, e.key),
2086
+ n = c(this, h, v).call(this, e.value),
2087
+ a = c(this, h, Ot).call(this, e.receiver, i, {
2088
+ computed: !0,
2089
+ optional: !1,
2090
+ end: this.getCharacterIndex("]", N(i)) + 1,
2091
+ });
2092
+ return c(this, h, d).call(
2093
+ this,
2094
+ {
2095
+ type: "AssignmentExpression",
2096
+ left: a,
2097
+ operator: "=",
2098
+ right: n,
2099
+ start: k(a),
2100
+ end: N(n),
2101
+ },
2102
+ { hasParentParens: s },
2103
+ );
2104
+ }
2105
+ if (e instanceof et) {
2106
+ let { receiver: i, name: n, value: a } = e,
2107
+ o = c(this, h, v).call(this, a),
2108
+ p =
2109
+ this.getCharacterLastIndex(
2110
+ /\S/,
2111
+ this.getCharacterLastIndex("=", k(o) - 1) - 1,
2112
+ ) + 1,
2113
+ u = c(this, h, d).call(this, {
2114
+ type: "Identifier",
2115
+ name: n,
2116
+ start: p - n.length,
2117
+ end: p,
2118
+ }),
2119
+ f = c(this, h, Ot).call(this, i, u, { computed: !1, optional: !1 });
2120
+ return c(this, h, d).call(
2121
+ this,
2122
+ {
2123
+ type: "AssignmentExpression",
2124
+ left: f,
2125
+ operator: "=",
2126
+ right: o,
2127
+ start: k(f),
2128
+ end: N(o),
2129
+ },
2130
+ { hasParentParens: s },
2131
+ );
2132
+ }
2133
+ throw Object.assign(new Error("Unexpected node"), { node: e });
2134
+ });
2135
+ function Me(r, t) {
2136
+ return new It(r, t).node;
2137
+ }
2138
+ function _e(r) {
2139
+ return r instanceof ut;
2140
+ }
2141
+ function Ue(r) {
2142
+ return r instanceof W;
2143
+ }
2144
+ var wt,
2145
+ q,
2146
+ x,
2147
+ Fe,
2148
+ C,
2149
+ Xt,
2150
+ te,
2151
+ ee,
2152
+ De,
2153
+ We,
2154
+ Ge,
2155
+ Ve,
2156
+ Jt = class extends It {
2157
+ constructor(e, s) {
2158
+ super(void 0, s);
2159
+ P(this, x);
2160
+ P(this, wt);
2161
+ P(this, q);
2162
+ Y(this, wt, e), Y(this, q, s);
2163
+ for (let i of e) c(this, x, De).call(this, i);
2164
+ }
2165
+ get expressions() {
2166
+ return c(this, x, Ge).call(this);
2167
+ }
2168
+ };
2169
+ (wt = new WeakMap()),
2170
+ (q = new WeakMap()),
2171
+ (x = new WeakSet()),
2172
+ (Fe = function () {
2173
+ return O(this, wt)[0].key;
2174
+ }),
2175
+ (C = function (e, { stripSpaces: s = !0 } = {}) {
2176
+ return this.createNode(e, { stripSpaces: s });
2177
+ }),
2178
+ (Xt = function (e) {
2179
+ return this.transformNode(e);
2180
+ }),
2181
+ (te = function (e) {
2182
+ return Ne(e.slice(O(this, x, Fe).source.length));
2183
+ }),
2184
+ (ee = function (e) {
2185
+ let s = O(this, q);
2186
+ if (s[e.start] !== '"' && s[e.start] !== "'") return;
2187
+ let i = s[e.start],
2188
+ n = !1;
2189
+ for (let a = e.start + 1; a < s.length; a++)
2190
+ switch (s[a]) {
2191
+ case i:
2192
+ if (!n) {
2193
+ e.end = a + 1;
2194
+ return;
2195
+ }
2196
+ default:
2197
+ n = !1;
2198
+ break;
2199
+ case "\\":
2200
+ n = !n;
2201
+ break;
2202
+ }
2203
+ }),
2204
+ (De = function (e) {
2205
+ c(this, x, ee).call(this, e.key.span),
2206
+ Ue(e) && e.value && c(this, x, ee).call(this, e.value.span);
2207
+ }),
2208
+ (We = function (e) {
2209
+ if (!e.value || e.value.source) return e.value;
2210
+ let s = this.getCharacterIndex(/\S/, e.sourceSpan.start);
2211
+ return { source: "$implicit", span: { start: s, end: s } };
2212
+ }),
2213
+ (Ge = function () {
2214
+ let e = O(this, wt),
2215
+ [s] = e,
2216
+ i =
2217
+ O(this, q).slice(s.sourceSpan.start, s.sourceSpan.end).trim().length ===
2218
+ 0
2219
+ ? e.slice(1)
2220
+ : e,
2221
+ n = [],
2222
+ a = null;
2223
+ for (let [o, p] of i.entries()) {
2224
+ if (a && _e(a) && Ue(p) && p.value && p.value.source === a.key.source) {
2225
+ let u = c(this, x, C).call(this, {
2226
+ type: "NGMicrosyntaxKey",
2227
+ name: p.key.source,
2228
+ ...p.key.span,
2229
+ }),
2230
+ f = (y, w) => ({
2231
+ ...y,
2232
+ ...this.transformSpan({ start: y.start, end: w }),
2233
+ }),
2234
+ S = (y) => ({ ...f(y, u.end), alias: u }),
2235
+ g = n.pop();
2236
+ if (g.type === "NGMicrosyntaxExpression") n.push(S(g));
2237
+ else if (g.type === "NGMicrosyntaxKeyedExpression") {
2238
+ let y = S(g.expression);
2239
+ n.push(f({ ...g, expression: y }, y.end));
2240
+ } else throw new Error(`Unexpected type ${g.type}`);
2241
+ } else n.push(c(this, x, Ve).call(this, p, o));
2242
+ a = p;
2243
+ }
2244
+ return c(this, x, C).call(this, {
2245
+ type: "NGMicrosyntax",
2246
+ body: n,
2247
+ ...(n.length === 0
2248
+ ? e[0].sourceSpan
2249
+ : { start: n[0].start, end: Tt(!1, n, -1).end }),
2250
+ });
2251
+ }),
2252
+ (Ve = function (e, s) {
2253
+ if (_e(e)) {
2254
+ let { key: i, value: n } = e;
2255
+ return n
2256
+ ? s === 0
2257
+ ? c(this, x, C).call(this, {
2258
+ type: "NGMicrosyntaxExpression",
2259
+ expression: c(this, x, Xt).call(this, n.ast),
2260
+ alias: null,
2261
+ ...n.sourceSpan,
2262
+ })
2263
+ : c(this, x, C).call(this, {
2264
+ type: "NGMicrosyntaxKeyedExpression",
2265
+ key: c(this, x, C).call(this, {
2266
+ type: "NGMicrosyntaxKey",
2267
+ name: c(this, x, te).call(this, i.source),
2268
+ ...i.span,
2269
+ }),
2270
+ expression: c(this, x, C).call(this, {
2271
+ type: "NGMicrosyntaxExpression",
2272
+ expression: c(this, x, Xt).call(this, n.ast),
2273
+ alias: null,
2274
+ ...n.sourceSpan,
2275
+ }),
2276
+ start: i.span.start,
2277
+ end: n.sourceSpan.end,
2278
+ })
2279
+ : c(this, x, C).call(this, {
2280
+ type: "NGMicrosyntaxKey",
2281
+ name: c(this, x, te).call(this, i.source),
2282
+ ...i.span,
2283
+ });
2284
+ } else {
2285
+ let { key: i, sourceSpan: n } = e;
2286
+ if (/^let\s$/.test(O(this, q).slice(n.start, n.start + 4))) {
2287
+ let { value: o } = e;
2288
+ return c(this, x, C).call(this, {
2289
+ type: "NGMicrosyntaxLet",
2290
+ key: c(this, x, C).call(this, {
2291
+ type: "NGMicrosyntaxKey",
2292
+ name: i.source,
2293
+ ...i.span,
2294
+ }),
2295
+ value: o
2296
+ ? c(this, x, C).call(this, {
2297
+ type: "NGMicrosyntaxKey",
2298
+ name: o.source,
2299
+ ...o.span,
2300
+ })
2301
+ : null,
2302
+ start: n.start,
2303
+ end: o ? o.span.end : i.span.end,
2304
+ });
2305
+ } else {
2306
+ let o = c(this, x, We).call(this, e);
2307
+ return c(this, x, C).call(this, {
2308
+ type: "NGMicrosyntaxAs",
2309
+ key: c(this, x, C).call(this, {
2310
+ type: "NGMicrosyntaxKey",
2311
+ name: o.source,
2312
+ ...o.span,
2313
+ }),
2314
+ alias: c(this, x, C).call(this, {
2315
+ type: "NGMicrosyntaxKey",
2316
+ name: i.source,
2317
+ ...i.span,
2318
+ }),
2319
+ start: o.span.start,
2320
+ end: i.span.end,
2321
+ });
2322
+ }
2323
+ }
2324
+ });
2325
+ function Qe(r, t) {
2326
+ return new Jt(r, t).expressions;
2327
+ }
2328
+ function Mt({ result: { ast: r }, text: t, comments: e }) {
2329
+ return Object.assign(Me(r, t), { comments: e });
2330
+ }
2331
+ function ze({ result: { templateBindings: r }, text: t }) {
2332
+ return Qe(r, t);
2333
+ }
2334
+ var qe = (r) => Mt(Le(r));
2335
+ var He = (r) => Mt(Pe(r)),
2336
+ se = (r) => Mt(Re(r)),
2337
+ je = (r) => ze(be(r));
2338
+ function re(r) {
2339
+ var s, i, n;
2340
+ let t = ((s = r.range) == null ? void 0 : s[0]) ?? r.start,
2341
+ e =
2342
+ (n =
2343
+ ((i = r.declaration) == null ? void 0 : i.decorators) ??
2344
+ r.decorators) == null
2345
+ ? void 0
2346
+ : n[0];
2347
+ return e ? Math.min(re(e), t) : t;
2348
+ }
2349
+ function Ye(r) {
2350
+ var t;
2351
+ return ((t = r.range) == null ? void 0 : t[1]) ?? r.end;
2352
+ }
2353
+ function _t(r) {
2354
+ return {
2355
+ astFormat: "estree",
2356
+ parse(t) {
2357
+ let e = r(t);
2358
+ return {
2359
+ type: "NGRoot",
2360
+ node:
2361
+ r === se && e.type !== "NGChainedExpression"
2362
+ ? { ...e, type: "NGChainedExpression", expressions: [e] }
2363
+ : e,
2364
+ };
2365
+ },
2366
+ locStart: re,
2367
+ locEnd: Ye,
2368
+ };
2369
+ }
2370
+ var js = _t(se),
2371
+ Ys = _t(qe),
2372
+ Zs = _t(He),
2373
+ Js = _t(je);
2374
+ var Ur = ne;
2375
+ export { Ur as default, ie as parsers };