@bagelink/vue 1.20.72 → 1.20.78

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.
Files changed (71) hide show
  1. package/dist/StructuredEditor-HFOfODf9.cjs +2 -0
  2. package/dist/StructuredEditor-w0UY60b7.js +2431 -0
  3. package/dist/StructuredEditor.css +1 -0
  4. package/dist/babel-BVvTH0ev.js +10053 -0
  5. package/dist/babel-BzIDwrmk.cjs +16 -0
  6. package/dist/components/form/inputs/CodeEditor/Index.vue.d.ts +45 -28
  7. package/dist/components/form/inputs/CodeEditor/Index.vue.d.ts.map +1 -1
  8. package/dist/components/form/inputs/CodeEditor/SearchPanel.vue.d.ts +10 -0
  9. package/dist/components/form/inputs/CodeEditor/SearchPanel.vue.d.ts.map +1 -0
  10. package/dist/components/form/inputs/CodeEditor/StructuredEditor.vue.d.ts +27 -0
  11. package/dist/components/form/inputs/CodeEditor/StructuredEditor.vue.d.ts.map +1 -0
  12. package/dist/components/form/inputs/CodeEditor/formatCode.d.ts +4 -0
  13. package/dist/components/form/inputs/CodeEditor/formatCode.d.ts.map +1 -0
  14. package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
  15. package/dist/components/form/inputs/RichText/index.vue.d.ts.map +1 -1
  16. package/dist/components/form/inputs/Upload/AssetUploadInput.vue.d.ts.map +1 -1
  17. package/dist/core.css +3 -1
  18. package/dist/dist-B-MCiFKR.cjs +10 -0
  19. package/dist/dist-B0uc2InW.js +6 -0
  20. package/dist/dist-BIAEQGHn.cjs +1 -0
  21. package/dist/dist-BLxHnfU6.js +1071 -0
  22. package/dist/dist-BRA2DQF2.cjs +1 -0
  23. package/dist/dist-BnLdfA7w.js +69 -0
  24. package/dist/dist-CL50Ff42.cjs +1 -0
  25. package/dist/dist-CwUttjIh.js +1100 -0
  26. package/dist/dist-CzY35u4H.cjs +1 -0
  27. package/dist/dist-D8OWrPLr.js +1336 -0
  28. package/dist/dist-DSCI9g6w.cjs +13 -0
  29. package/dist/dist-DsBgijLf.cjs +1 -0
  30. package/dist/dist-GbVY_Jpv.cjs +1 -0
  31. package/dist/dist-IV7z-zur.js +11909 -0
  32. package/dist/dist-Mr0UMyoK.js +1063 -0
  33. package/dist/dist-jq7acmcZ.js +6 -0
  34. package/dist/estree-CKgw47OZ.js +8211 -0
  35. package/dist/estree-HqeJuE3g.cjs +44 -0
  36. package/dist/form-flow/form-flow.d.ts.map +1 -1
  37. package/dist/html-B-hsQYII.js +7289 -0
  38. package/dist/html-BrqW5pT-.cjs +25 -0
  39. package/dist/index.cjs +1 -764
  40. package/dist/index.mjs +308 -65600
  41. package/dist/postcss-Bk65KKdh.js +6703 -0
  42. package/dist/postcss-BxY0xtVZ.cjs +61 -0
  43. package/dist/src-BACj3hjY.cjs +764 -0
  44. package/dist/src-SwfYbKT-.js +65571 -0
  45. package/dist/src.css +1 -0
  46. package/dist/standalone-CAcRm_h6.cjs +29 -0
  47. package/dist/standalone-D-HcbQmf.js +3549 -0
  48. package/dist/style.css +3 -1
  49. package/dist/utils/calendarDate.d.ts +6 -0
  50. package/dist/utils/calendarDate.d.ts.map +1 -0
  51. package/dist/utils/date.d.ts.map +1 -1
  52. package/package.json +13 -2
  53. package/src/components/form/inputs/CodeEditor/Index.vue +70 -310
  54. package/src/components/form/inputs/CodeEditor/SearchPanel.vue +124 -0
  55. package/src/components/form/inputs/CodeEditor/StructuredEditor.vue +266 -0
  56. package/src/components/form/inputs/CodeEditor/formatCode.ts +34 -0
  57. package/src/components/form/inputs/DatePicker.vue +4 -1
  58. package/src/components/form/inputs/RichText/index.vue +2 -1
  59. package/src/components/form/inputs/Upload/AssetUploadInput.vue +28 -5
  60. package/src/form-flow/form-flow.ts +2 -0
  61. package/src/utils/calendarDate.ts +16 -0
  62. package/src/utils/date.ts +2 -1
  63. package/vite.config.ts +5 -3
  64. package/dist/components/form/inputs/CodeEditor/useHighlight.d.ts +0 -33
  65. package/dist/components/form/inputs/CodeEditor/useHighlight.d.ts.map +0 -1
  66. package/dist/index.css +0 -1
  67. package/src/components/form/inputs/CodeEditor/useHighlight.ts +0 -123
  68. /package/dist/{page-flip.browser-BXnk8BM6.js → page-flip.browser-0kqlwcC8.js} +0 -0
  69. /package/dist/{page-flip.browser-ByKQXhqK.cjs → page-flip.browser-Dfy5mAgM.cjs} +0 -0
  70. /package/dist/{pdf-CV7M2d0x.cjs → pdf-BBd7GH-5.cjs} +0 -0
  71. /package/dist/{pdf-DuN3_wNN.js → pdf-scP2ZqGZ.js} +0 -0
@@ -0,0 +1,1063 @@
1
+ import { dt as R, ft as L, gt as S, ht as M, lt as $, pt as E, ut as j } from "./dist-IV7z-zur.js";
2
+ var G = class T {
3
+ /**
4
+ @internal
5
+ */
6
+ constructor(t, e, i, h, r, n, o, a, f, l = 0, p) {
7
+ this.p = t, this.stack = e, this.state = i, this.reducePos = h, this.pos = r, this.score = n, this.buffer = o, this.bufferBase = a, this.curContext = f, this.lookAhead = l, this.parent = p;
8
+ }
9
+ /**
10
+ @internal
11
+ */
12
+ toString() {
13
+ return `[${this.stack.filter((t, e) => e % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`;
14
+ }
15
+ /**
16
+ @internal
17
+ */
18
+ static start(t, e, i = 0) {
19
+ let h = t.parser.context;
20
+ return new T(t, [], e, i, i, 0, [], 0, h ? new w(h, h.start) : null, 0, null);
21
+ }
22
+ /**
23
+ The stack's current [context](#lr.ContextTracker) value, if
24
+ any. Its type will depend on the context tracker's type
25
+ parameter, or it will be `null` if there is no context
26
+ tracker.
27
+ */
28
+ get context() {
29
+ return this.curContext ? this.curContext.context : null;
30
+ }
31
+ /**
32
+ @internal
33
+ */
34
+ pushState(t, e) {
35
+ this.stack.push(this.state, e, this.bufferBase + this.buffer.length), this.state = t;
36
+ }
37
+ /**
38
+ @internal
39
+ */
40
+ reduce(t) {
41
+ var e;
42
+ let i = t >> 19, h = t & 65535, { parser: r } = this.p, n = this.reducePos < this.pos - 25 && this.setLookAhead(this.pos), o = r.dynamicPrecedence(h);
43
+ if (o && (this.score += o), i == 0) {
44
+ h < r.minRepeatTerm && this.reducePos < this.pos && (this.reducePos = this.pos), this.pushState(r.getGoto(this.state, h, !0), this.reducePos), h < r.minRepeatTerm && this.storeNode(h, this.reducePos, this.reducePos, n ? 8 : 4, !0), this.reduceContext(h, this.reducePos);
45
+ return;
46
+ }
47
+ let a = this.stack.length - (i - 1) * 3 - (t & 262144 ? 6 : 0), f = a ? this.stack[a - 2] : this.p.ranges[0].from;
48
+ h < r.minRepeatTerm && f == this.reducePos && this.reducePos < this.pos && (this.reducePos = this.pos);
49
+ let l = this.reducePos - f;
50
+ l >= 2e3 && !(!((e = this.p.parser.nodeSet.types[h]) === null || e === void 0) && e.isAnonymous) && (f == this.p.lastBigReductionStart ? (this.p.bigReductionCount++, this.p.lastBigReductionSize = l) : this.p.lastBigReductionSize < l && (this.p.bigReductionCount = 1, this.p.lastBigReductionStart = f, this.p.lastBigReductionSize = l));
51
+ let p = a ? this.stack[a - 1] : 0, u = this.bufferBase + this.buffer.length - p;
52
+ if (h < r.minRepeatTerm || t & 131072) {
53
+ let c = r.stateFlag(this.state, 1) ? this.pos : this.reducePos;
54
+ this.storeNode(h, f, c, u + 4, !0);
55
+ }
56
+ if (t & 262144) this.state = this.stack[a];
57
+ else {
58
+ let c = this.stack[a - 3];
59
+ this.state = r.getGoto(c, h, !0);
60
+ }
61
+ for (; this.stack.length > a; ) this.stack.pop();
62
+ this.reduceContext(h, f);
63
+ }
64
+ /**
65
+ @internal
66
+ */
67
+ storeNode(t, e, i, h = 4, r = !1) {
68
+ if (t == 0 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) {
69
+ let n = this.buffer.length;
70
+ if (n > 0 && this.buffer[n - 4] == 0 && this.buffer[n - 1] > -1) {
71
+ if (e == i) return;
72
+ if (this.buffer[n - 2] >= e) {
73
+ this.buffer[n - 2] = i;
74
+ return;
75
+ }
76
+ }
77
+ }
78
+ if (!r || this.pos == i) this.buffer.push(t, e, i, h);
79
+ else {
80
+ let n = this.buffer.length;
81
+ if (n > 0 && (this.buffer[n - 4] != 0 || this.buffer[n - 1] < 0)) {
82
+ let o = !1;
83
+ for (let a = n; a > 0 && this.buffer[a - 2] > i; a -= 4) if (this.buffer[a - 1] >= 0) {
84
+ o = !0;
85
+ break;
86
+ }
87
+ if (o) for (; n > 0 && this.buffer[n - 2] > i; )
88
+ this.buffer[n] = this.buffer[n - 4], this.buffer[n + 1] = this.buffer[n - 3], this.buffer[n + 2] = this.buffer[n - 2], this.buffer[n + 3] = this.buffer[n - 1], n -= 4, h > 4 && (h -= 4);
89
+ }
90
+ this.buffer[n] = t, this.buffer[n + 1] = e, this.buffer[n + 2] = i, this.buffer[n + 3] = h;
91
+ }
92
+ }
93
+ /**
94
+ @internal
95
+ */
96
+ shift(t, e, i, h) {
97
+ if (t & 131072) this.pushState(t & 65535, this.pos);
98
+ else if ((t & 262144) == 0) {
99
+ let r = t, { parser: n } = this.p;
100
+ this.pos = h;
101
+ let o = n.stateFlag(r, 1);
102
+ !o && (h > i || e <= n.maxNode) && (this.reducePos = h), this.pushState(r, o ? i : Math.min(i, this.reducePos)), this.shiftContext(e, i), e <= n.maxNode && this.buffer.push(e, i, h, 4);
103
+ } else
104
+ this.pos = h, this.shiftContext(e, i), e <= this.p.parser.maxNode && this.buffer.push(e, i, h, 4);
105
+ }
106
+ /**
107
+ @internal
108
+ */
109
+ apply(t, e, i, h) {
110
+ t & 65536 ? this.reduce(t) : this.shift(t, e, i, h);
111
+ }
112
+ /**
113
+ @internal
114
+ */
115
+ useNode(t, e, i) {
116
+ let h = this.p.reused.length - 1;
117
+ (h < 0 || this.p.reused[h] != t) && (this.p.reused.push(t), h++);
118
+ let r = this.reducePos = this.pos = i + t.length;
119
+ this.pushState(e, i), this.buffer.push(h, i, r, -1), this.curContext && this.updateContext(this.curContext.tracker.reuse(this.curContext.context, t, this, this.p.stream.reset(this.pos - t.length)));
120
+ }
121
+ /**
122
+ @internal
123
+ */
124
+ split() {
125
+ let t = this, e = t.buffer.length;
126
+ for (e && t.buffer[e - 4] == 0 && (e -= 4); e > 0 && t.buffer[e - 2] > t.reducePos; ) e -= 4;
127
+ let i = t.buffer.slice(e), h = t.bufferBase + e;
128
+ for (; t && h == t.bufferBase; ) t = t.parent;
129
+ return new T(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, i, h, this.curContext, this.lookAhead, t);
130
+ }
131
+ /**
132
+ @internal
133
+ */
134
+ recoverByDelete(t, e) {
135
+ let i = t <= this.p.parser.maxNode;
136
+ i && this.storeNode(t, this.pos, e, 4), this.storeNode(0, this.pos, e, i ? 8 : 4), this.pos = this.reducePos = e, this.score -= 190;
137
+ }
138
+ /**
139
+ Check if the given term would be able to be shifted (optionally
140
+ after some reductions) on this stack. This can be useful for
141
+ external tokenizers that want to make sure they only provide a
142
+ given token when it applies.
143
+ */
144
+ canShift(t) {
145
+ for (let e = new U(this); ; ) {
146
+ let i = this.p.parser.stateSlot(e.state, 4) || this.p.parser.hasAction(e.state, t);
147
+ if (i == 0) return !1;
148
+ if ((i & 65536) == 0) return !0;
149
+ e.reduce(i);
150
+ }
151
+ }
152
+ /**
153
+ @internal
154
+ */
155
+ recoverByInsert(t) {
156
+ if (this.stack.length >= 300) return [];
157
+ let e = this.p.parser.nextStates(this.state);
158
+ if (e.length > 8 || this.stack.length >= 120) {
159
+ let h = [];
160
+ for (let r = 0, n; r < e.length; r += 2) (n = e[r + 1]) != this.state && this.p.parser.hasAction(n, t) && h.push(e[r], n);
161
+ if (this.stack.length < 120) for (let r = 0; h.length < 8 && r < e.length; r += 2) {
162
+ let n = e[r + 1];
163
+ h.some((o, a) => a & 1 && o == n) || h.push(e[r], n);
164
+ }
165
+ e = h;
166
+ }
167
+ let i = [];
168
+ for (let h = 0; h < e.length && i.length < 4; h += 2) {
169
+ let r = e[h + 1];
170
+ if (r == this.state) continue;
171
+ let n = this.split();
172
+ n.pushState(r, this.pos), n.storeNode(0, n.pos, n.pos, 4, !0), n.shiftContext(e[h], this.pos), n.reducePos = this.pos, n.score -= 200, i.push(n);
173
+ }
174
+ return i;
175
+ }
176
+ /**
177
+ @internal
178
+ */
179
+ forceReduce() {
180
+ let { parser: t } = this.p, e = t.stateSlot(this.state, 5);
181
+ if ((e & 65536) == 0) return !1;
182
+ if (!t.validAction(this.state, e)) {
183
+ let i = e >> 19, h = e & 65535, r = this.stack.length - i * 3;
184
+ if (r < 0 || t.getGoto(this.stack[r], h, !1) < 0) {
185
+ let n = this.findForcedReduction();
186
+ if (n == null) return !1;
187
+ e = n;
188
+ }
189
+ this.storeNode(0, this.pos, this.pos, 4, !0), this.score -= 100;
190
+ }
191
+ return this.reducePos = this.pos, this.reduce(e), !0;
192
+ }
193
+ /**
194
+ Try to scan through the automaton to find some kind of reduction
195
+ that can be applied. Used when the regular ForcedReduce field
196
+ isn't a valid action. @internal
197
+ */
198
+ findForcedReduction() {
199
+ let { parser: t } = this.p, e = [], i = (h, r) => {
200
+ if (!e.includes(h))
201
+ return e.push(h), t.allActions(h, (n) => {
202
+ if (!(n & 393216)) if (n & 65536) {
203
+ let o = (n >> 19) - r;
204
+ if (o > 1) {
205
+ let a = n & 65535, f = this.stack.length - o * 3;
206
+ if (f >= 0 && t.getGoto(this.stack[f], a, !1) >= 0) return o << 19 | 65536 | a;
207
+ }
208
+ } else {
209
+ let o = i(n, r + 1);
210
+ if (o != null) return o;
211
+ }
212
+ });
213
+ };
214
+ return i(this.state, 0);
215
+ }
216
+ /**
217
+ @internal
218
+ */
219
+ forceAll() {
220
+ for (; !this.p.parser.stateFlag(this.state, 2); ) if (!this.forceReduce()) {
221
+ this.storeNode(0, this.pos, this.pos, 4, !0);
222
+ break;
223
+ }
224
+ return this;
225
+ }
226
+ /**
227
+ Check whether this state has no further actions (assumed to be a direct descendant of the
228
+ top state, since any other states must be able to continue
229
+ somehow). @internal
230
+ */
231
+ get deadEnd() {
232
+ if (this.stack.length != 3) return !1;
233
+ let { parser: t } = this.p;
234
+ return t.data[t.stateSlot(this.state, 1)] == 65535 && !t.stateSlot(this.state, 4);
235
+ }
236
+ /**
237
+ Restart the stack (put it back in its start state). Only safe
238
+ when this.stack.length == 3 (state is directly below the top
239
+ state). @internal
240
+ */
241
+ restart() {
242
+ this.storeNode(0, this.pos, this.pos, 4, !0), this.state = this.stack[0], this.stack.length = 0;
243
+ }
244
+ /**
245
+ @internal
246
+ */
247
+ sameState(t) {
248
+ if (this.state != t.state || this.stack.length != t.stack.length) return !1;
249
+ for (let e = 0; e < this.stack.length; e += 3) if (this.stack[e] != t.stack[e]) return !1;
250
+ return !0;
251
+ }
252
+ /**
253
+ Get the parser used by this stack.
254
+ */
255
+ get parser() {
256
+ return this.p.parser;
257
+ }
258
+ /**
259
+ Test whether a given dialect (by numeric ID, as exported from
260
+ the terms file) is enabled.
261
+ */
262
+ dialectEnabled(t) {
263
+ return this.p.parser.dialect.flags[t];
264
+ }
265
+ shiftContext(t, e) {
266
+ this.curContext && this.updateContext(this.curContext.tracker.shift(this.curContext.context, t, this, this.p.stream.reset(e)));
267
+ }
268
+ reduceContext(t, e) {
269
+ this.curContext && this.updateContext(this.curContext.tracker.reduce(this.curContext.context, t, this, this.p.stream.reset(e)));
270
+ }
271
+ /**
272
+ @internal
273
+ */
274
+ emitContext() {
275
+ let t = this.buffer.length - 1;
276
+ (t < 0 || this.buffer[t] != -3) && this.storeNode(this.curContext.hash, this.reducePos, this.reducePos, -3, !0);
277
+ }
278
+ /**
279
+ @internal
280
+ */
281
+ emitLookAhead() {
282
+ let t = this.buffer.length - 1;
283
+ (t < 0 || this.buffer[t] != -4) && this.buffer.push(this.lookAhead, this.pos, this.pos, -4);
284
+ }
285
+ updateContext(t) {
286
+ if (t != this.curContext.context) {
287
+ let e = new w(this.curContext.tracker, t);
288
+ e.hash != this.curContext.hash && this.emitContext(), this.curContext = e;
289
+ }
290
+ }
291
+ /**
292
+ @internal
293
+ */
294
+ setLookAhead(t) {
295
+ return t <= this.lookAhead ? !1 : (this.emitLookAhead(), this.lookAhead = t, !0);
296
+ }
297
+ /**
298
+ @internal
299
+ */
300
+ close() {
301
+ this.curContext && this.curContext.tracker.strict && this.emitContext(), this.lookAhead > 0 && this.emitLookAhead();
302
+ }
303
+ }, w = class {
304
+ constructor(s, t) {
305
+ this.tracker = s, this.context = t, this.hash = s.strict ? s.hash(t) : 0;
306
+ }
307
+ }, U = class {
308
+ constructor(s) {
309
+ this.start = s, this.state = s.state, this.stack = s.stack, this.base = this.stack.length;
310
+ }
311
+ reduce(s) {
312
+ let t = s & 65535, e = s >> 19;
313
+ e == 0 ? (this.stack == this.start.stack && (this.stack = this.stack.slice()), this.stack.push(this.state, 0, 0), this.base += 3) : this.base -= (e - 1) * 3, this.state = this.start.p.parser.getGoto(this.stack[this.base - 3], t, !0);
314
+ }
315
+ }, H = class A {
316
+ constructor(t, e, i) {
317
+ this.stack = t, this.pos = e, this.index = i, this.buffer = t.buffer, this.index == 0 && this.maybeNext();
318
+ }
319
+ static create(t, e = t.bufferBase + t.buffer.length) {
320
+ return new A(t, e, e - t.bufferBase);
321
+ }
322
+ maybeNext() {
323
+ let t = this.stack.parent;
324
+ t != null && (this.index = this.stack.bufferBase - t.bufferBase, this.stack = t, this.buffer = t.buffer);
325
+ }
326
+ get id() {
327
+ return this.buffer[this.index - 4];
328
+ }
329
+ get start() {
330
+ return this.buffer[this.index - 3];
331
+ }
332
+ get end() {
333
+ return this.buffer[this.index - 2];
334
+ }
335
+ get size() {
336
+ return this.buffer[this.index - 1];
337
+ }
338
+ next() {
339
+ this.index -= 4, this.pos -= 4, this.index == 0 && this.maybeNext();
340
+ }
341
+ fork() {
342
+ return new A(this.stack, this.pos, this.index);
343
+ }
344
+ };
345
+ function x(s, t = Uint16Array) {
346
+ if (typeof s != "string") return s;
347
+ let e = null;
348
+ for (let i = 0, h = 0; i < s.length; ) {
349
+ let r = 0;
350
+ for (; ; ) {
351
+ let n = s.charCodeAt(i++), o = !1;
352
+ if (n == 126) {
353
+ r = 65535;
354
+ break;
355
+ }
356
+ n >= 92 && n--, n >= 34 && n--;
357
+ let a = n - 32;
358
+ if (a >= 46 && (a -= 46, o = !0), r += a, o) break;
359
+ r *= 46;
360
+ }
361
+ e ? e[h++] = r : e = new t(r);
362
+ }
363
+ return e;
364
+ }
365
+ var b = class {
366
+ constructor() {
367
+ this.start = -1, this.value = -1, this.end = -1, this.extended = -1, this.lookAhead = 0, this.mask = 0, this.context = 0;
368
+ }
369
+ }, y = new b(), W = class {
370
+ /**
371
+ @internal
372
+ */
373
+ constructor(s, t) {
374
+ this.input = s, this.ranges = t, this.chunk = "", this.chunkOff = 0, this.chunk2 = "", this.chunk2Pos = 0, this.next = -1, this.token = y, this.rangeIndex = 0, this.pos = this.chunkPos = t[0].from, this.range = t[0], this.end = t[t.length - 1].to, this.readNext();
375
+ }
376
+ /**
377
+ @internal
378
+ */
379
+ resolveOffset(s, t) {
380
+ let e = this.range, i = this.rangeIndex, h = this.pos + s;
381
+ for (; h < e.from; ) {
382
+ if (!i) return null;
383
+ let r = this.ranges[--i];
384
+ h -= e.from - r.to, e = r;
385
+ }
386
+ for (; t < 0 ? h > e.to : h >= e.to; ) {
387
+ if (i == this.ranges.length - 1) return null;
388
+ let r = this.ranges[++i];
389
+ h += r.from - e.to, e = r;
390
+ }
391
+ return h;
392
+ }
393
+ /**
394
+ @internal
395
+ */
396
+ clipPos(s) {
397
+ if (s >= this.range.from && s < this.range.to) return s;
398
+ for (let t of this.ranges) if (t.to > s) return Math.max(s, t.from);
399
+ return this.end;
400
+ }
401
+ /**
402
+ Look at a code unit near the stream position. `.peek(0)` equals
403
+ `.next`, `.peek(-1)` gives you the previous character, and so
404
+ on.
405
+
406
+ Note that looking around during tokenizing creates dependencies
407
+ on potentially far-away content, which may reduce the
408
+ effectiveness incremental parsing—when looking forward—or even
409
+ cause invalid reparses when looking backward more than 25 code
410
+ units, since the library does not track lookbehind.
411
+ */
412
+ peek(s) {
413
+ let t = this.chunkOff + s, e, i;
414
+ if (t >= 0 && t < this.chunk.length)
415
+ e = this.pos + s, i = this.chunk.charCodeAt(t);
416
+ else {
417
+ let h = this.resolveOffset(s, 1);
418
+ if (h == null) return -1;
419
+ if (e = h, e >= this.chunk2Pos && e < this.chunk2Pos + this.chunk2.length) i = this.chunk2.charCodeAt(e - this.chunk2Pos);
420
+ else {
421
+ let r = this.rangeIndex, n = this.range;
422
+ for (; n.to <= e; ) n = this.ranges[++r];
423
+ this.chunk2 = this.input.chunk(this.chunk2Pos = e), e + this.chunk2.length > n.to && (this.chunk2 = this.chunk2.slice(0, n.to - e)), i = this.chunk2.charCodeAt(0);
424
+ }
425
+ }
426
+ return e >= this.token.lookAhead && (this.token.lookAhead = e + 1), i;
427
+ }
428
+ /**
429
+ Accept a token. By default, the end of the token is set to the
430
+ current stream position, but you can pass an offset (relative to
431
+ the stream position) to change that.
432
+ */
433
+ acceptToken(s, t = 0) {
434
+ let e = t ? this.resolveOffset(t, -1) : this.pos;
435
+ if (e == null || e < this.token.start) throw new RangeError("Token end out of bounds");
436
+ this.token.value = s, this.token.end = e;
437
+ }
438
+ /**
439
+ Accept a token ending at a specific given position.
440
+ */
441
+ acceptTokenTo(s, t) {
442
+ this.token.value = s, this.token.end = t;
443
+ }
444
+ getChunk() {
445
+ if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) {
446
+ let { chunk: s, chunkPos: t } = this;
447
+ this.chunk = this.chunk2, this.chunkPos = this.chunk2Pos, this.chunk2 = s, this.chunk2Pos = t, this.chunkOff = this.pos - this.chunkPos;
448
+ } else {
449
+ this.chunk2 = this.chunk, this.chunk2Pos = this.chunkPos;
450
+ let s = this.input.chunk(this.pos);
451
+ this.chunk = this.pos + s.length > this.range.to ? s.slice(0, this.range.to - this.pos) : s, this.chunkPos = this.pos, this.chunkOff = 0;
452
+ }
453
+ }
454
+ readNext() {
455
+ return this.chunkOff >= this.chunk.length && (this.getChunk(), this.chunkOff == this.chunk.length) ? this.next = -1 : this.next = this.chunk.charCodeAt(this.chunkOff);
456
+ }
457
+ /**
458
+ Move the stream forward N (defaults to 1) code units. Returns
459
+ the new value of [`next`](#lr.InputStream.next).
460
+ */
461
+ advance(s = 1) {
462
+ for (this.chunkOff += s; this.pos + s >= this.range.to; ) {
463
+ if (this.rangeIndex == this.ranges.length - 1) return this.setDone();
464
+ s -= this.range.to - this.pos, this.range = this.ranges[++this.rangeIndex], this.pos = this.range.from;
465
+ }
466
+ return this.pos += s, this.pos >= this.token.lookAhead && (this.token.lookAhead = this.pos + 1), this.readNext();
467
+ }
468
+ setDone() {
469
+ return this.pos = this.chunkPos = this.end, this.range = this.ranges[this.rangeIndex = this.ranges.length - 1], this.chunk = "", this.next = -1;
470
+ }
471
+ /**
472
+ @internal
473
+ */
474
+ reset(s, t) {
475
+ if (t ? (this.token = t, t.start = s, t.lookAhead = s + 1, t.value = t.extended = -1) : this.token = y, this.pos != s) {
476
+ if (this.pos = s, s == this.end)
477
+ return this.setDone(), this;
478
+ for (; s < this.range.from; ) this.range = this.ranges[--this.rangeIndex];
479
+ for (; s >= this.range.to; ) this.range = this.ranges[++this.rangeIndex];
480
+ s >= this.chunkPos && s < this.chunkPos + this.chunk.length ? this.chunkOff = s - this.chunkPos : (this.chunk = "", this.chunkOff = 0), this.readNext();
481
+ }
482
+ return this;
483
+ }
484
+ /**
485
+ @internal
486
+ */
487
+ read(s, t) {
488
+ if (s >= this.chunkPos && t <= this.chunkPos + this.chunk.length) return this.chunk.slice(s - this.chunkPos, t - this.chunkPos);
489
+ if (s >= this.chunk2Pos && t <= this.chunk2Pos + this.chunk2.length) return this.chunk2.slice(s - this.chunk2Pos, t - this.chunk2Pos);
490
+ if (s >= this.range.from && t <= this.range.to) return this.input.read(s, t);
491
+ let e = "";
492
+ for (let i of this.ranges) {
493
+ if (i.from >= t) break;
494
+ i.to > s && (e += this.input.read(Math.max(i.from, s), Math.min(i.to, t)));
495
+ }
496
+ return e;
497
+ }
498
+ }, m = class {
499
+ constructor(s, t) {
500
+ this.data = s, this.id = t;
501
+ }
502
+ token(s, t) {
503
+ let { parser: e } = t.p;
504
+ D(this.data, s, t, this.id, e.data, e.tokenPrecTable);
505
+ }
506
+ };
507
+ m.prototype.contextual = m.prototype.fallback = m.prototype.extend = !1;
508
+ var q = class {
509
+ constructor(s, t, e) {
510
+ this.precTable = t, this.elseToken = e, this.data = typeof s == "string" ? x(s) : s;
511
+ }
512
+ token(s, t) {
513
+ let e = s.pos, i = 0;
514
+ for (; ; ) {
515
+ let h = s.next < 0, r = s.resolveOffset(1, 1);
516
+ if (D(this.data, s, t, 0, this.data, this.precTable), s.token.value > -1) break;
517
+ if (this.elseToken == null) return;
518
+ if (h || i++, r == null) break;
519
+ s.reset(r, s.token);
520
+ }
521
+ i && (s.reset(e, s.token), s.acceptToken(this.elseToken, i));
522
+ }
523
+ };
524
+ q.prototype.contextual = m.prototype.fallback = m.prototype.extend = !1;
525
+ var _ = class {
526
+ /**
527
+ Create a tokenizer. The first argument is the function that,
528
+ given an input stream, scans for the types of tokens it
529
+ recognizes at the stream's position, and calls
530
+ [`acceptToken`](#lr.InputStream.acceptToken) when it finds
531
+ one.
532
+ */
533
+ constructor(s, t = {}) {
534
+ this.token = s, this.contextual = !!t.contextual, this.fallback = !!t.fallback, this.extend = !!t.extend;
535
+ }
536
+ };
537
+ function D(s, t, e, i, h, r) {
538
+ let n = 0, o = 1 << i, { dialect: a } = e.p.parser;
539
+ t: for (; (o & s[n]) != 0; ) {
540
+ let f = s[n + 1];
541
+ for (let c = n + 3; c < f; c += 2) if ((s[c + 1] & o) > 0) {
542
+ let k = s[c];
543
+ if (a.allows(k) && (t.token.value == -1 || t.token.value == k || J(k, t.token.value, h, r))) {
544
+ t.acceptToken(k);
545
+ break;
546
+ }
547
+ }
548
+ let l = t.next, p = 0, u = s[n + 2];
549
+ if (t.next < 0 && u > p && s[f + u * 3 - 3] == 65535) {
550
+ n = s[f + u * 3 - 1];
551
+ continue t;
552
+ }
553
+ for (; p < u; ) {
554
+ let c = p + u >> 1, k = f + c + (c << 1), F = s[k], O = s[k + 1] || 65536;
555
+ if (l < F) u = c;
556
+ else if (l >= O) p = c + 1;
557
+ else {
558
+ n = s[k + 2], t.advance();
559
+ continue t;
560
+ }
561
+ }
562
+ break;
563
+ }
564
+ }
565
+ function N(s, t, e) {
566
+ for (let i = t, h; (h = s[i]) != 65535; i++) if (h == e) return i - t;
567
+ return -1;
568
+ }
569
+ function J(s, t, e, i) {
570
+ let h = N(e, i, t);
571
+ return h < 0 || N(e, i, s) < h;
572
+ }
573
+ var d = typeof process < "u" && process.env && /\bparse\b/.test(process.env.LOG), v = null;
574
+ function z(s, t, e) {
575
+ let i = s.cursor(j.IncludeAnonymous);
576
+ for (i.moveTo(t); ; ) if (!(e < 0 ? i.childBefore(t) : i.childAfter(t))) for (; ; ) {
577
+ if ((e < 0 ? i.to < t : i.from > t) && !i.type.isError) return e < 0 ? Math.max(0, Math.min(i.to - 1, t - 25)) : Math.min(s.length, Math.max(i.from + 1, t + 25));
578
+ if (e < 0 ? i.prevSibling() : i.nextSibling()) break;
579
+ if (!i.parent()) return e < 0 ? 0 : s.length;
580
+ }
581
+ }
582
+ var K = class {
583
+ constructor(s, t) {
584
+ this.fragments = s, this.minRepeat = t, this.i = 0, this.fragment = null, this.safeFrom = -1, this.safeTo = -1, this.trees = [], this.start = [], this.index = [], this.lastRepeat = null, this.lastRepeatPos = -1, this.nextFragment();
585
+ }
586
+ nextFragment() {
587
+ let s = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++];
588
+ if (s) {
589
+ for (this.safeFrom = s.openStart ? z(s.tree, s.from + s.offset, 1) - s.offset : s.from, this.safeTo = s.openEnd ? z(s.tree, s.to + s.offset, -1) - s.offset : s.to; this.trees.length; )
590
+ this.trees.pop(), this.start.pop(), this.index.pop();
591
+ this.trees.push(s.tree), this.start.push(-s.offset), this.index.push(0), this.nextStart = this.safeFrom;
592
+ } else this.nextStart = 1e9;
593
+ }
594
+ nodeAt(s) {
595
+ if (s < this.nextStart) return null;
596
+ for (; this.fragment && this.safeTo <= s; ) this.nextFragment();
597
+ if (!this.fragment) return null;
598
+ for (; ; ) {
599
+ let t = this.trees.length - 1;
600
+ if (t < 0)
601
+ return this.nextFragment(), null;
602
+ if (s < this.safeFrom) return null;
603
+ let e = this.trees[t], i = this.index[t];
604
+ if (i == e.children.length) {
605
+ this.trees.pop(), this.start.pop(), this.index.pop();
606
+ continue;
607
+ }
608
+ let h = e.children[i], r = this.start[t] + e.positions[i];
609
+ if (r > s)
610
+ return this.nextStart = r, null;
611
+ if (h instanceof S) {
612
+ let n = r > this.lastRepeatPos && h.type.id >= this.minRepeat;
613
+ if (r == s || n) {
614
+ let o = r + h.length, a;
615
+ if (r >= this.safeFrom && o <= this.safeTo && (!(a = h.prop(R.lookAhead)) || o + a < this.fragment.to) && (n && (this.lastRepeat = h, this.lastRepeatPos = r), r == s))
616
+ return h;
617
+ }
618
+ this.index[t]++, r + h.length >= Math.max(this.safeFrom, s) && (this.trees.push(h), this.start.push(r), this.index.push(0));
619
+ } else
620
+ this.index[t]++, this.nextStart = r + h.length;
621
+ }
622
+ }
623
+ }, Q = class {
624
+ constructor(s, t) {
625
+ this.stream = t, this.tokens = [], this.mainToken = null, this.actions = [], this.tokens = s.tokenizers.map((e) => new b());
626
+ }
627
+ getActions(s) {
628
+ let t = 0, e = null, { parser: i } = s.p, { tokenizers: h } = i, r = i.stateSlot(s.state, 3), n = s.curContext ? s.curContext.hash : 0, o = 0;
629
+ for (let a = 0; a < h.length; a++) {
630
+ if ((1 << a & r) == 0) continue;
631
+ let f = h[a], l = this.tokens[a];
632
+ if (!(e && !f.fallback) && ((f.contextual || l.start != s.pos || l.mask != r || l.context != n) && (this.updateCachedToken(l, f, s), l.mask = r, l.context = n), l.lookAhead > l.end + 25 && (o = Math.max(l.lookAhead, o)), l.value != 0)) {
633
+ let p = t;
634
+ if (l.extended > -1 && (t = this.addActions(s, l.extended, l.end, t)), t = this.addActions(s, l.value, l.end, t), !f.extend && (e = l, t > p))
635
+ break;
636
+ }
637
+ }
638
+ for (; this.actions.length > t; ) this.actions.pop();
639
+ return o && s.setLookAhead(o), !e && s.pos == this.stream.end && (e = new b(), e.value = s.p.parser.eofTerm, e.start = e.end = s.pos, t = this.addActions(s, e.value, e.end, t)), this.mainToken = e, this.actions;
640
+ }
641
+ getMainToken(s) {
642
+ if (this.mainToken) return this.mainToken;
643
+ let t = new b(), { pos: e, p: i } = s;
644
+ return t.start = e, t.end = Math.min(e + 1, i.stream.end), t.value = e == i.stream.end ? i.parser.eofTerm : 0, t;
645
+ }
646
+ updateCachedToken(s, t, e) {
647
+ let i = this.stream.clipPos(e.pos);
648
+ if (t.token(this.stream.reset(i, s), e), s.value > -1) {
649
+ let { parser: h } = e.p;
650
+ for (let r = 0; r < h.specialized.length; r++) if (h.specialized[r] == s.value) {
651
+ let n = h.specializers[r](this.stream.read(s.start, s.end), e);
652
+ if (n >= 0 && e.p.parser.dialect.allows(n >> 1)) {
653
+ (n & 1) == 0 ? s.value = n >> 1 : s.extended = n >> 1;
654
+ break;
655
+ }
656
+ }
657
+ } else
658
+ s.value = 0, s.end = this.stream.clipPos(i + 1);
659
+ }
660
+ putAction(s, t, e, i) {
661
+ for (let h = 0; h < i; h += 3) if (this.actions[h] == s) return i;
662
+ return this.actions[i++] = s, this.actions[i++] = t, this.actions[i++] = e, i;
663
+ }
664
+ addActions(s, t, e, i) {
665
+ let { state: h } = s, { parser: r } = s.p, { data: n } = r;
666
+ for (let o = 0; o < 2; o++) for (let a = r.stateSlot(h, o ? 2 : 1); ; a += 3) {
667
+ if (n[a] == 65535) if (n[a + 1] == 1) a = g(n, a + 2);
668
+ else {
669
+ i == 0 && n[a + 1] == 2 && (i = this.putAction(g(n, a + 2), t, e, i));
670
+ break;
671
+ }
672
+ n[a] == t && (i = this.putAction(g(n, a + 1), t, e, i));
673
+ }
674
+ return i;
675
+ }
676
+ }, V = class {
677
+ constructor(s, t, e, i) {
678
+ this.parser = s, this.input = t, this.ranges = i, this.recovering = 0, this.nextStackID = 9812, this.minStackPos = 0, this.reused = [], this.stoppedAt = null, this.lastBigReductionStart = -1, this.lastBigReductionSize = 0, this.bigReductionCount = 0, this.stream = new W(t, i), this.tokens = new Q(s, this.stream), this.topTerm = s.top[1];
679
+ let { from: h } = i[0];
680
+ this.stacks = [G.start(this, s.top[0], h)], this.fragments = e.length && this.stream.end - h > s.bufferLength * 4 ? new K(e, s.minRepeatTerm) : null;
681
+ }
682
+ get parsedPos() {
683
+ return this.minStackPos;
684
+ }
685
+ advance() {
686
+ let s = this.stacks, t = this.minStackPos, e = this.stacks = [], i, h;
687
+ if (this.bigReductionCount > 300 && s.length == 1) {
688
+ let [r] = s;
689
+ for (; r.forceReduce() && r.stack.length && r.stack[r.stack.length - 2] >= this.lastBigReductionStart; ) ;
690
+ this.bigReductionCount = this.lastBigReductionSize = 0;
691
+ }
692
+ for (let r = 0; r < s.length; r++) {
693
+ let n = s[r];
694
+ for (; ; ) {
695
+ if (this.tokens.mainToken = null, n.pos > t) e.push(n);
696
+ else {
697
+ if (this.advanceStack(n, e, s)) continue;
698
+ {
699
+ i || (i = [], h = []), i.push(n);
700
+ let o = this.tokens.getMainToken(n);
701
+ h.push(o.value, o.end);
702
+ }
703
+ }
704
+ break;
705
+ }
706
+ }
707
+ if (!e.length) {
708
+ let r = i && Y(i);
709
+ if (r)
710
+ return this.stackToTree(r);
711
+ if (this.parser.strict)
712
+ throw new SyntaxError("No parse at " + t);
713
+ this.recovering || (this.recovering = 5);
714
+ }
715
+ if (this.recovering && i) {
716
+ let r = this.stoppedAt != null && i[0].pos > this.stoppedAt ? i[0] : this.runRecovery(i, h, e);
717
+ if (r)
718
+ return this.stackToTree(r.forceAll());
719
+ }
720
+ if (this.recovering) {
721
+ let r = this.recovering == 1 ? 1 : this.recovering * 3;
722
+ if (e.length > r)
723
+ for (e.sort((n, o) => o.score - n.score); e.length > r; ) e.pop();
724
+ e.some((n) => n.reducePos > t) && this.recovering--;
725
+ } else if (e.length > 1) {
726
+ t: for (let r = 0; r < e.length - 1; r++) {
727
+ let n = e[r];
728
+ for (let o = r + 1; o < e.length; o++) {
729
+ let a = e[o];
730
+ if (n.sameState(a) || n.buffer.length > 500 && a.buffer.length > 500) if ((n.score - a.score || n.buffer.length - a.buffer.length) > 0) e.splice(o--, 1);
731
+ else {
732
+ e.splice(r--, 1);
733
+ continue t;
734
+ }
735
+ }
736
+ }
737
+ e.length > 12 && (e.sort((r, n) => n.score - r.score), e.splice(12, e.length - 12));
738
+ }
739
+ this.minStackPos = e[0].pos;
740
+ for (let r = 1; r < e.length; r++) e[r].pos < this.minStackPos && (this.minStackPos = e[r].pos);
741
+ return null;
742
+ }
743
+ stopAt(s) {
744
+ if (this.stoppedAt != null && this.stoppedAt < s) throw new RangeError("Can't move stoppedAt forward");
745
+ this.stoppedAt = s;
746
+ }
747
+ tryReuse(s, t, e, i) {
748
+ if (!e) return null;
749
+ let h = s.curContext && s.curContext.tracker.strict, r = h ? s.curContext.hash : 0;
750
+ for (; e; ) {
751
+ let n = this.parser.nodeSet.types[e.type.id] != e.type ? -1 : this.parser.getGoto(s.state, e.type.id);
752
+ if (n > -1 && e.length && (!h || (e.prop(R.contextHash) || 0) == r))
753
+ return s.useNode(e, n, t), e;
754
+ if (e.children.length == 0 || e.positions[0] > 0) break;
755
+ let o = e.children[0];
756
+ if (o instanceof S && (!i || o.type.id >= this.parser.minRepeatTerm)) e = o;
757
+ else break;
758
+ }
759
+ return null;
760
+ }
761
+ advanceStack(s, t, e) {
762
+ let i = s.pos, { parser: h } = this, r = d ? this.stackID(s) + " -> " : "";
763
+ if (this.stoppedAt != null && i > this.stoppedAt) return s.forceReduce() ? s : null;
764
+ if (this.fragments && (s.reducePos < i && s.buffer.length && s.buffer[s.buffer.length - 2] <= s.reducePos && this.fragments.lastRepeatPos == s.reducePos && this.tryReuse(s, s.reducePos, this.fragments.lastRepeat, !0) || this.tryReuse(s, i, this.fragments.nodeAt(i), !1)))
765
+ return !0;
766
+ let n = h.stateSlot(s.state, 4);
767
+ if (n > 0)
768
+ return s.reduce(n), !0;
769
+ if (s.stack.length >= 8400) for (; s.stack.length > 6e3 && s.forceReduce(); ) ;
770
+ let o = this.tokens.getActions(s);
771
+ for (let a = 0; a < o.length; ) {
772
+ let f = o[a++], l = o[a++], p = o[a++], u = a == o.length || !e, c = u ? s : s.split(), k = this.tokens.mainToken;
773
+ if (c.apply(f, l, k ? k.start : c.pos, p), u) return !0;
774
+ c.pos > i ? t.push(c) : e.push(c);
775
+ }
776
+ return !1;
777
+ }
778
+ advanceFully(s, t) {
779
+ let e = s.pos;
780
+ for (; ; ) {
781
+ if (!this.advanceStack(s, null, null)) return !1;
782
+ if (s.pos > e)
783
+ return I(s, t), !0;
784
+ }
785
+ }
786
+ runRecovery(s, t, e) {
787
+ let i = null, h = !1;
788
+ for (let r = 0; r < s.length; r++) {
789
+ let n = s[r], o = t[r << 1], a = t[(r << 1) + 1], f = d ? this.stackID(n) + " -> " : "";
790
+ if (n.deadEnd && (h || (h = !0, n.restart(), this.advanceFully(n, e))))
791
+ continue;
792
+ let l = n.split(), p = f;
793
+ for (let u = 0; u < 10 && l.forceReduce() && !this.advanceFully(l, e); u++)
794
+ d && (p = this.stackID(l) + " -> ");
795
+ for (let u of n.recoverByInsert(o))
796
+ this.advanceFully(u, e);
797
+ this.stream.end > n.pos ? (a == n.pos && (a++, o = 0), n.recoverByDelete(o, a), I(n, e)) : (!i || i.score < l.score) && (i = l);
798
+ }
799
+ return i;
800
+ }
801
+ stackToTree(s) {
802
+ return s.close(), S.build({
803
+ buffer: H.create(s),
804
+ nodeSet: this.parser.nodeSet,
805
+ topID: this.topTerm,
806
+ maxBufferLength: this.parser.bufferLength,
807
+ reused: this.reused,
808
+ start: this.ranges[0].from,
809
+ length: s.pos - this.ranges[0].from,
810
+ minRepeatType: this.parser.minRepeatTerm
811
+ });
812
+ }
813
+ stackID(s) {
814
+ let t = (v || (v = /* @__PURE__ */ new WeakMap())).get(s);
815
+ return t || v.set(s, t = String.fromCodePoint(this.nextStackID++)), t + s;
816
+ }
817
+ };
818
+ function I(s, t) {
819
+ for (let e = 0; e < t.length; e++) {
820
+ let i = t[e];
821
+ if (i.pos == s.pos && i.sameState(s)) {
822
+ t[e].score < s.score && (t[e] = s);
823
+ return;
824
+ }
825
+ }
826
+ t.push(s);
827
+ }
828
+ var X = class {
829
+ constructor(s, t, e) {
830
+ this.source = s, this.flags = t, this.disabled = e;
831
+ }
832
+ allows(s) {
833
+ return !this.disabled || this.disabled[s] == 0;
834
+ }
835
+ }, P = (s) => s, tt = class {
836
+ /**
837
+ Define a context tracker.
838
+ */
839
+ constructor(s) {
840
+ this.start = s.start, this.shift = s.shift || P, this.reduce = s.reduce || P, this.reuse = s.reuse || P, this.hash = s.hash || (() => 0), this.strict = s.strict !== !1;
841
+ }
842
+ }, et = class C extends M {
843
+ /**
844
+ @internal
845
+ */
846
+ constructor(t) {
847
+ if (super(), this.wrappers = [], t.version != 14) throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);
848
+ let e = t.nodeNames.split(" ");
849
+ this.minRepeatTerm = e.length;
850
+ for (let o = 0; o < t.repeatNodeCount; o++) e.push("");
851
+ let i = Object.keys(t.topRules).map((o) => t.topRules[o][1]), h = [];
852
+ for (let o = 0; o < e.length; o++) h.push([]);
853
+ function r(o, a, f) {
854
+ h[o].push([a, a.deserialize(String(f))]);
855
+ }
856
+ if (t.nodeProps) for (let o of t.nodeProps) {
857
+ let a = o[0];
858
+ typeof a == "string" && (a = R[a]);
859
+ for (let f = 1; f < o.length; ) {
860
+ let l = o[f++];
861
+ if (l >= 0) r(l, a, o[f++]);
862
+ else {
863
+ let p = o[f + -l];
864
+ for (let u = -l; u > 0; u--) r(o[f++], a, p);
865
+ f++;
866
+ }
867
+ }
868
+ }
869
+ this.nodeSet = new L(e.map((o, a) => E.define({
870
+ name: a >= this.minRepeatTerm ? void 0 : o,
871
+ id: a,
872
+ props: h[a],
873
+ top: i.indexOf(a) > -1,
874
+ error: a == 0,
875
+ skipped: t.skippedNodes && t.skippedNodes.indexOf(a) > -1
876
+ }))), t.propSources && (this.nodeSet = this.nodeSet.extend(...t.propSources)), this.strict = !1, this.bufferLength = $;
877
+ let n = x(t.tokenData);
878
+ this.context = t.context, this.specializerSpecs = t.specialized || [], this.specialized = new Uint16Array(this.specializerSpecs.length);
879
+ for (let o = 0; o < this.specializerSpecs.length; o++) this.specialized[o] = this.specializerSpecs[o].term;
880
+ this.specializers = this.specializerSpecs.map(B), this.states = x(t.states, Uint32Array), this.data = x(t.stateData), this.goto = x(t.goto), this.maxTerm = t.maxTerm, this.tokenizers = t.tokenizers.map((o) => typeof o == "number" ? new m(n, o) : o), this.topRules = t.topRules, this.dialects = t.dialects || {}, this.dynamicPrecedences = t.dynamicPrecedences || null, this.tokenPrecTable = t.tokenPrec, this.termNames = t.termNames || null, this.maxNode = this.nodeSet.types.length - 1, this.dialect = this.parseDialect(), this.top = this.topRules[Object.keys(this.topRules)[0]];
881
+ }
882
+ createParse(t, e, i) {
883
+ let h = new V(this, t, e, i);
884
+ for (let r of this.wrappers) h = r(h, t, e, i);
885
+ return h;
886
+ }
887
+ /**
888
+ Get a goto table entry @internal
889
+ */
890
+ getGoto(t, e, i = !1) {
891
+ let h = this.goto;
892
+ if (e >= h[0]) return -1;
893
+ for (let r = h[e + 1]; ; ) {
894
+ let n = h[r++], o = n & 1, a = h[r++];
895
+ if (o && i) return a;
896
+ for (let f = r + (n >> 1); r < f; r++) if (h[r] == t) return a;
897
+ if (o) return -1;
898
+ }
899
+ }
900
+ /**
901
+ Check if this state has an action for a given terminal @internal
902
+ */
903
+ hasAction(t, e) {
904
+ let i = this.data;
905
+ for (let h = 0; h < 2; h++) for (let r = this.stateSlot(t, h ? 2 : 1), n; ; r += 3) {
906
+ if ((n = i[r]) == 65535) if (i[r + 1] == 1) n = i[r = g(i, r + 2)];
907
+ else {
908
+ if (i[r + 1] == 2) return g(i, r + 2);
909
+ break;
910
+ }
911
+ if (n == e || n == 0) return g(i, r + 1);
912
+ }
913
+ return 0;
914
+ }
915
+ /**
916
+ @internal
917
+ */
918
+ stateSlot(t, e) {
919
+ return this.states[t * 6 + e];
920
+ }
921
+ /**
922
+ @internal
923
+ */
924
+ stateFlag(t, e) {
925
+ return (this.stateSlot(t, 0) & e) > 0;
926
+ }
927
+ /**
928
+ @internal
929
+ */
930
+ validAction(t, e) {
931
+ return !!this.allActions(t, (i) => i == e ? !0 : null);
932
+ }
933
+ /**
934
+ @internal
935
+ */
936
+ allActions(t, e) {
937
+ let i = this.stateSlot(t, 4), h = i ? e(i) : void 0;
938
+ for (let r = this.stateSlot(t, 1); h == null; r += 3) {
939
+ if (this.data[r] == 65535) if (this.data[r + 1] == 1) r = g(this.data, r + 2);
940
+ else break;
941
+ h = e(g(this.data, r + 1));
942
+ }
943
+ return h;
944
+ }
945
+ /**
946
+ Get the states that can follow this one through shift actions or
947
+ goto jumps. @internal
948
+ */
949
+ nextStates(t) {
950
+ let e = [];
951
+ for (let i = this.stateSlot(t, 1); ; i += 3) {
952
+ if (this.data[i] == 65535) if (this.data[i + 1] == 1) i = g(this.data, i + 2);
953
+ else break;
954
+ if ((this.data[i + 2] & 1) == 0) {
955
+ let h = this.data[i + 1];
956
+ e.some((r, n) => n & 1 && r == h) || e.push(this.data[i], h);
957
+ }
958
+ }
959
+ return e;
960
+ }
961
+ /**
962
+ Configure the parser. Returns a new parser instance that has the
963
+ given settings modified. Settings not provided in `config` are
964
+ kept from the original parser.
965
+ */
966
+ configure(t) {
967
+ let e = Object.assign(Object.create(C.prototype), this);
968
+ if (t.props && (e.nodeSet = this.nodeSet.extend(...t.props)), t.top) {
969
+ let i = this.topRules[t.top];
970
+ if (!i) throw new RangeError(`Invalid top rule name ${t.top}`);
971
+ e.top = i;
972
+ }
973
+ return t.tokenizers && (e.tokenizers = this.tokenizers.map((i) => {
974
+ let h = t.tokenizers.find((r) => r.from == i);
975
+ return h ? h.to : i;
976
+ })), t.specializers && (e.specializers = this.specializers.slice(), e.specializerSpecs = this.specializerSpecs.map((i, h) => {
977
+ let r = t.specializers.find((o) => o.from == i.external);
978
+ if (!r) return i;
979
+ let n = Object.assign(Object.assign({}, i), { external: r.to });
980
+ return e.specializers[h] = B(n), n;
981
+ })), t.contextTracker && (e.context = t.contextTracker), t.dialect && (e.dialect = this.parseDialect(t.dialect)), t.strict != null && (e.strict = t.strict), t.wrap && (e.wrappers = e.wrappers.concat(t.wrap)), t.bufferLength != null && (e.bufferLength = t.bufferLength), e;
982
+ }
983
+ /**
984
+ Tells you whether any [parse wrappers](#lr.ParserConfig.wrap)
985
+ are registered for this parser.
986
+ */
987
+ hasWrappers() {
988
+ return this.wrappers.length > 0;
989
+ }
990
+ /**
991
+ Returns the name associated with a given term. This will only
992
+ work for all terms when the parser was generated with the
993
+ `--names` option. By default, only the names of tagged terms are
994
+ stored.
995
+ */
996
+ getName(t) {
997
+ return this.termNames ? this.termNames[t] : String(t <= this.maxNode && this.nodeSet.types[t].name || t);
998
+ }
999
+ /**
1000
+ The eof term id is always allocated directly after the node
1001
+ types. @internal
1002
+ */
1003
+ get eofTerm() {
1004
+ return this.maxNode + 1;
1005
+ }
1006
+ /**
1007
+ The type of top node produced by the parser.
1008
+ */
1009
+ get topNode() {
1010
+ return this.nodeSet.types[this.top[1]];
1011
+ }
1012
+ /**
1013
+ @internal
1014
+ */
1015
+ dynamicPrecedence(t) {
1016
+ let e = this.dynamicPrecedences;
1017
+ return e == null ? 0 : e[t] || 0;
1018
+ }
1019
+ /**
1020
+ @internal
1021
+ */
1022
+ parseDialect(t) {
1023
+ let e = Object.keys(this.dialects), i = e.map(() => !1);
1024
+ if (t) for (let r of t.split(" ")) {
1025
+ let n = e.indexOf(r);
1026
+ n >= 0 && (i[n] = !0);
1027
+ }
1028
+ let h = null;
1029
+ for (let r = 0; r < e.length; r++) if (!i[r]) for (let n = this.dialects[e[r]], o; (o = this.data[n++]) != 65535; ) (h || (h = new Uint8Array(this.maxTerm + 1)))[o] = 1;
1030
+ return new X(t, i, h);
1031
+ }
1032
+ /**
1033
+ Used by the output of the parser generator. Not available to
1034
+ user code. @hide
1035
+ */
1036
+ static deserialize(t) {
1037
+ return new C(t);
1038
+ }
1039
+ };
1040
+ function g(s, t) {
1041
+ return s[t] | s[t + 1] << 16;
1042
+ }
1043
+ function Y(s) {
1044
+ let t = null;
1045
+ for (let e of s) {
1046
+ let i = e.p.stoppedAt;
1047
+ (e.pos == e.p.stream.end || i != null && e.pos > i) && e.p.parser.stateFlag(e.state, 2) && (!t || t.score < e.score) && (t = e);
1048
+ }
1049
+ return t;
1050
+ }
1051
+ function B(s) {
1052
+ if (s.external) {
1053
+ let t = s.extend ? 1 : 0;
1054
+ return (e, i) => s.external(e, i) << 1 | t;
1055
+ }
1056
+ return s.get;
1057
+ }
1058
+ export {
1059
+ q as i,
1060
+ _ as n,
1061
+ et as r,
1062
+ tt as t
1063
+ };