@drjoshcsimmons/scl 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -0
  3. package/dist/components/ui/accordion/accordion.d.ts +8 -0
  4. package/dist/components/ui/accordion/accordion.d.ts.map +1 -0
  5. package/dist/components/ui/accordion/index.d.ts +2 -0
  6. package/dist/components/ui/accordion/index.d.ts.map +1 -0
  7. package/dist/components/ui/alert/alert.d.ts +9 -0
  8. package/dist/components/ui/alert/alert.d.ts.map +1 -0
  9. package/dist/components/ui/alert/index.d.ts +2 -0
  10. package/dist/components/ui/alert/index.d.ts.map +1 -0
  11. package/dist/components/ui/alert-dialog/alert-dialog.d.ts +21 -0
  12. package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +1 -0
  13. package/dist/components/ui/alert-dialog/index.d.ts +2 -0
  14. package/dist/components/ui/alert-dialog/index.d.ts.map +1 -0
  15. package/dist/components/ui/avatar/avatar.d.ts +7 -0
  16. package/dist/components/ui/avatar/avatar.d.ts.map +1 -0
  17. package/dist/components/ui/avatar/index.d.ts +2 -0
  18. package/dist/components/ui/avatar/index.d.ts.map +1 -0
  19. package/dist/components/ui/badge/badge.d.ts +10 -0
  20. package/dist/components/ui/badge/badge.d.ts.map +1 -0
  21. package/dist/components/ui/badge/index.d.ts +2 -0
  22. package/dist/components/ui/badge/index.d.ts.map +1 -0
  23. package/dist/components/ui/button/button.d.ts +12 -0
  24. package/dist/components/ui/button/button.d.ts.map +1 -0
  25. package/dist/components/ui/button/index.d.ts +2 -0
  26. package/dist/components/ui/button/index.d.ts.map +1 -0
  27. package/dist/components/ui/card/card.d.ts +9 -0
  28. package/dist/components/ui/card/card.d.ts.map +1 -0
  29. package/dist/components/ui/card/index.d.ts +2 -0
  30. package/dist/components/ui/card/index.d.ts.map +1 -0
  31. package/dist/components/ui/checkbox/checkbox.d.ts +5 -0
  32. package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -0
  33. package/dist/components/ui/checkbox/index.d.ts +2 -0
  34. package/dist/components/ui/checkbox/index.d.ts.map +1 -0
  35. package/dist/components/ui/collapsible/collapsible.d.ts +6 -0
  36. package/dist/components/ui/collapsible/collapsible.d.ts.map +1 -0
  37. package/dist/components/ui/collapsible/index.d.ts +2 -0
  38. package/dist/components/ui/collapsible/index.d.ts.map +1 -0
  39. package/dist/components/ui/dialog/dialog.d.ts +20 -0
  40. package/dist/components/ui/dialog/dialog.d.ts.map +1 -0
  41. package/dist/components/ui/dialog/index.d.ts +2 -0
  42. package/dist/components/ui/dialog/index.d.ts.map +1 -0
  43. package/dist/components/ui/dithered-image/dithered-image.d.ts +17 -0
  44. package/dist/components/ui/dithered-image/dithered-image.d.ts.map +1 -0
  45. package/dist/components/ui/dithered-image/index.d.ts +3 -0
  46. package/dist/components/ui/dithered-image/index.d.ts.map +1 -0
  47. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +28 -0
  48. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -0
  49. package/dist/components/ui/dropdown-menu/index.d.ts +2 -0
  50. package/dist/components/ui/dropdown-menu/index.d.ts.map +1 -0
  51. package/dist/components/ui/input/index.d.ts +2 -0
  52. package/dist/components/ui/input/index.d.ts.map +1 -0
  53. package/dist/components/ui/input/input.d.ts +5 -0
  54. package/dist/components/ui/input/input.d.ts.map +1 -0
  55. package/dist/components/ui/label/index.d.ts +2 -0
  56. package/dist/components/ui/label/index.d.ts.map +1 -0
  57. package/dist/components/ui/label/label.d.ts +6 -0
  58. package/dist/components/ui/label/label.d.ts.map +1 -0
  59. package/dist/components/ui/popover/index.d.ts +2 -0
  60. package/dist/components/ui/popover/index.d.ts.map +1 -0
  61. package/dist/components/ui/popover/popover.d.ts +8 -0
  62. package/dist/components/ui/popover/popover.d.ts.map +1 -0
  63. package/dist/components/ui/progress/index.d.ts +2 -0
  64. package/dist/components/ui/progress/index.d.ts.map +1 -0
  65. package/dist/components/ui/progress/progress.d.ts +19 -0
  66. package/dist/components/ui/progress/progress.d.ts.map +1 -0
  67. package/dist/components/ui/radio-group/index.d.ts +2 -0
  68. package/dist/components/ui/radio-group/index.d.ts.map +1 -0
  69. package/dist/components/ui/radio-group/radio-group.d.ts +6 -0
  70. package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -0
  71. package/dist/components/ui/scroll-area/index.d.ts +2 -0
  72. package/dist/components/ui/scroll-area/index.d.ts.map +1 -0
  73. package/dist/components/ui/scroll-area/scroll-area.d.ts +6 -0
  74. package/dist/components/ui/scroll-area/scroll-area.d.ts.map +1 -0
  75. package/dist/components/ui/select/index.d.ts +2 -0
  76. package/dist/components/ui/select/index.d.ts.map +1 -0
  77. package/dist/components/ui/select/select.d.ts +14 -0
  78. package/dist/components/ui/select/select.d.ts.map +1 -0
  79. package/dist/components/ui/separator/index.d.ts +2 -0
  80. package/dist/components/ui/separator/index.d.ts.map +1 -0
  81. package/dist/components/ui/separator/separator.d.ts +5 -0
  82. package/dist/components/ui/separator/separator.d.ts.map +1 -0
  83. package/dist/components/ui/sheet/index.d.ts +2 -0
  84. package/dist/components/ui/sheet/index.d.ts.map +1 -0
  85. package/dist/components/ui/sheet/sheet.d.ts +26 -0
  86. package/dist/components/ui/sheet/sheet.d.ts.map +1 -0
  87. package/dist/components/ui/skeleton/index.d.ts +2 -0
  88. package/dist/components/ui/skeleton/index.d.ts.map +1 -0
  89. package/dist/components/ui/skeleton/skeleton.d.ts +3 -0
  90. package/dist/components/ui/skeleton/skeleton.d.ts.map +1 -0
  91. package/dist/components/ui/slider/index.d.ts +2 -0
  92. package/dist/components/ui/slider/index.d.ts.map +1 -0
  93. package/dist/components/ui/slider/slider.d.ts +5 -0
  94. package/dist/components/ui/slider/slider.d.ts.map +1 -0
  95. package/dist/components/ui/statusline/index.d.ts +2 -0
  96. package/dist/components/ui/statusline/index.d.ts.map +1 -0
  97. package/dist/components/ui/statusline/statusline.d.ts +40 -0
  98. package/dist/components/ui/statusline/statusline.d.ts.map +1 -0
  99. package/dist/components/ui/switch/index.d.ts +2 -0
  100. package/dist/components/ui/switch/index.d.ts.map +1 -0
  101. package/dist/components/ui/switch/switch.d.ts +5 -0
  102. package/dist/components/ui/switch/switch.d.ts.map +1 -0
  103. package/dist/components/ui/table/index.d.ts +2 -0
  104. package/dist/components/ui/table/index.d.ts.map +1 -0
  105. package/dist/components/ui/table/table.d.ts +11 -0
  106. package/dist/components/ui/table/table.d.ts.map +1 -0
  107. package/dist/components/ui/tabs/index.d.ts +2 -0
  108. package/dist/components/ui/tabs/index.d.ts.map +1 -0
  109. package/dist/components/ui/tabs/tabs.d.ts +8 -0
  110. package/dist/components/ui/tabs/tabs.d.ts.map +1 -0
  111. package/dist/components/ui/terminal-textarea/index.d.ts +2 -0
  112. package/dist/components/ui/terminal-textarea/index.d.ts.map +1 -0
  113. package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts +27 -0
  114. package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts.map +1 -0
  115. package/dist/components/ui/textarea/index.d.ts +2 -0
  116. package/dist/components/ui/textarea/index.d.ts.map +1 -0
  117. package/dist/components/ui/textarea/textarea.d.ts +5 -0
  118. package/dist/components/ui/textarea/textarea.d.ts.map +1 -0
  119. package/dist/components/ui/toggle/index.d.ts +2 -0
  120. package/dist/components/ui/toggle/index.d.ts.map +1 -0
  121. package/dist/components/ui/toggle/toggle.d.ts +13 -0
  122. package/dist/components/ui/toggle/toggle.d.ts.map +1 -0
  123. package/dist/components/ui/tooltip/index.d.ts +2 -0
  124. package/dist/components/ui/tooltip/index.d.ts.map +1 -0
  125. package/dist/components/ui/tooltip/tooltip.d.ts +11 -0
  126. package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -0
  127. package/dist/index.d.ts +34 -0
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +165 -0
  130. package/dist/index10.js +61 -0
  131. package/dist/index100.js +32 -0
  132. package/dist/index101.js +17 -0
  133. package/dist/index102.js +137 -0
  134. package/dist/index103.js +52 -0
  135. package/dist/index104.js +11 -0
  136. package/dist/index105.js +6 -0
  137. package/dist/index106.js +183 -0
  138. package/dist/index107.js +652 -0
  139. package/dist/index108.js +109 -0
  140. package/dist/index109.js +93 -0
  141. package/dist/index11.js +27 -0
  142. package/dist/index110.js +69 -0
  143. package/dist/index111.js +161 -0
  144. package/dist/index112.js +399 -0
  145. package/dist/index113.js +1682 -0
  146. package/dist/index114.js +280 -0
  147. package/dist/index115.js +134 -0
  148. package/dist/index116.js +34 -0
  149. package/dist/index117.js +1613 -0
  150. package/dist/index118.js +300 -0
  151. package/dist/index119.js +637 -0
  152. package/dist/index12.js +7 -0
  153. package/dist/index120.js +146 -0
  154. package/dist/index121.js +23 -0
  155. package/dist/index122.js +11 -0
  156. package/dist/index123.js +40 -0
  157. package/dist/index124.js +20 -0
  158. package/dist/index125.js +8 -0
  159. package/dist/index126.js +14 -0
  160. package/dist/index127.js +208 -0
  161. package/dist/index128.js +24 -0
  162. package/dist/index129.js +402 -0
  163. package/dist/index13.js +100 -0
  164. package/dist/index130.js +1308 -0
  165. package/dist/index131.js +620 -0
  166. package/dist/index132.js +4 -0
  167. package/dist/index133.js +55 -0
  168. package/dist/index134.js +67 -0
  169. package/dist/index135.js +27 -0
  170. package/dist/index136.js +31 -0
  171. package/dist/index137.js +7 -0
  172. package/dist/index138.js +4 -0
  173. package/dist/index139.js +4 -0
  174. package/dist/index14.js +226 -0
  175. package/dist/index140.js +7 -0
  176. package/dist/index141.js +5 -0
  177. package/dist/index142.js +26 -0
  178. package/dist/index143.js +115 -0
  179. package/dist/index144.js +18 -0
  180. package/dist/index145.js +527 -0
  181. package/dist/index146.js +130 -0
  182. package/dist/index147.js +136 -0
  183. package/dist/index148.js +67 -0
  184. package/dist/index149.js +71 -0
  185. package/dist/index15.js +146 -0
  186. package/dist/index150.js +11 -0
  187. package/dist/index151.js +16 -0
  188. package/dist/index152.js +68 -0
  189. package/dist/index153.js +6 -0
  190. package/dist/index154.js +25 -0
  191. package/dist/index155.js +25 -0
  192. package/dist/index156.js +15 -0
  193. package/dist/index157.js +30 -0
  194. package/dist/index158.js +7 -0
  195. package/dist/index16.js +21 -0
  196. package/dist/index17.js +19 -0
  197. package/dist/index18.js +24 -0
  198. package/dist/index19.js +58 -0
  199. package/dist/index2.js +8 -0
  200. package/dist/index20.js +31 -0
  201. package/dist/index21.js +38 -0
  202. package/dist/index22.js +123 -0
  203. package/dist/index23.js +24 -0
  204. package/dist/index24.js +72 -0
  205. package/dist/index25.js +17 -0
  206. package/dist/index26.js +34 -0
  207. package/dist/index27.js +81 -0
  208. package/dist/index28.js +27 -0
  209. package/dist/index29.js +90 -0
  210. package/dist/index3.js +22 -0
  211. package/dist/index30.js +46 -0
  212. package/dist/index31.js +234 -0
  213. package/dist/index32.js +20 -0
  214. package/dist/index33.js +37 -0
  215. package/dist/index34.js +25 -0
  216. package/dist/index35.js +105 -0
  217. package/dist/index36.js +68 -0
  218. package/dist/index37.js +51 -0
  219. package/dist/index38.js +102 -0
  220. package/dist/index39.js +13 -0
  221. package/dist/index4.js +46 -0
  222. package/dist/index40.js +17 -0
  223. package/dist/index41.js +2265 -0
  224. package/dist/index42.js +35 -0
  225. package/dist/index43.js +20 -0
  226. package/dist/index44.js +239 -0
  227. package/dist/index45.js +13 -0
  228. package/dist/index46.js +75 -0
  229. package/dist/index47.js +251 -0
  230. package/dist/index48.js +11 -0
  231. package/dist/index49.js +338 -0
  232. package/dist/index5.js +51 -0
  233. package/dist/index50.js +62 -0
  234. package/dist/index51.js +243 -0
  235. package/dist/index52.js +862 -0
  236. package/dist/index53.js +11 -0
  237. package/dist/index54.js +120 -0
  238. package/dist/index55.js +227 -0
  239. package/dist/index56.js +13 -0
  240. package/dist/index57.js +13 -0
  241. package/dist/index58.js +238 -0
  242. package/dist/index59.js +262 -0
  243. package/dist/index6.js +51 -0
  244. package/dist/index60.js +14 -0
  245. package/dist/index61.js +24 -0
  246. package/dist/index62.js +532 -0
  247. package/dist/index63.js +6157 -0
  248. package/dist/index64.js +2635 -0
  249. package/dist/index65.js +300 -0
  250. package/dist/index66.js +674 -0
  251. package/dist/index67.js +832 -0
  252. package/dist/index68.js +27 -0
  253. package/dist/index69.js +330 -0
  254. package/dist/index7.js +42 -0
  255. package/dist/index70.js +4901 -0
  256. package/dist/index71.js +831 -0
  257. package/dist/index72.js +1260 -0
  258. package/dist/index73.js +536 -0
  259. package/dist/index74.js +127 -0
  260. package/dist/index75.js +163 -0
  261. package/dist/index76.js +33 -0
  262. package/dist/index77.js +437 -0
  263. package/dist/index78.js +132 -0
  264. package/dist/index79.js +83 -0
  265. package/dist/index8.js +31 -0
  266. package/dist/index80.js +70 -0
  267. package/dist/index81.js +48 -0
  268. package/dist/index82.js +29 -0
  269. package/dist/index83.js +9 -0
  270. package/dist/index84.js +54 -0
  271. package/dist/index85.js +36 -0
  272. package/dist/index86.js +13 -0
  273. package/dist/index87.js +10 -0
  274. package/dist/index88.js +32 -0
  275. package/dist/index89.js +57 -0
  276. package/dist/index9.js +54 -0
  277. package/dist/index90.js +13 -0
  278. package/dist/index91.js +6 -0
  279. package/dist/index92.js +15 -0
  280. package/dist/index93.js +8 -0
  281. package/dist/index94.js +27 -0
  282. package/dist/index95.js +71 -0
  283. package/dist/index96.js +127 -0
  284. package/dist/index97.js +221 -0
  285. package/dist/index98.js +16 -0
  286. package/dist/index99.js +56 -0
  287. package/dist/lib/utils.d.ts +14 -0
  288. package/dist/lib/utils.d.ts.map +1 -0
  289. package/dist/tokens/animations.d.ts +174 -0
  290. package/dist/tokens/animations.d.ts.map +1 -0
  291. package/dist/tokens/colors.d.ts +92 -0
  292. package/dist/tokens/colors.d.ts.map +1 -0
  293. package/dist/tokens/index.d.ts +403 -0
  294. package/dist/tokens/index.d.ts.map +1 -0
  295. package/dist/tokens/shadows.d.ts +15 -0
  296. package/dist/tokens/shadows.d.ts.map +1 -0
  297. package/dist/tokens/spacing.d.ts +55 -0
  298. package/dist/tokens/spacing.d.ts.map +1 -0
  299. package/dist/tokens/typography.d.ts +80 -0
  300. package/dist/tokens/typography.d.ts.map +1 -0
  301. package/package.json +128 -0
@@ -0,0 +1,1308 @@
1
+ import { Parser as M, NodeSet as L, NodeType as $, DefaultBufferLength as E, NodeProp as y, Tree as S, IterMode as j } from "./index113.js";
2
+ class v {
3
+ /**
4
+ @internal
5
+ */
6
+ constructor(t, e, s, i, h, r, n, o, a, u = 0, f) {
7
+ this.p = t, this.stack = e, this.state = s, this.reducePos = i, this.pos = h, this.score = r, this.buffer = n, this.bufferBase = o, this.curContext = a, this.lookAhead = u, this.parent = f;
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
+ // Start an empty stack
16
+ /**
17
+ @internal
18
+ */
19
+ static start(t, e, s = 0) {
20
+ let i = t.parser.context;
21
+ return new v(t, [], e, s, s, 0, [], 0, i ? new N(i, i.start) : null, 0, null);
22
+ }
23
+ /**
24
+ The stack's current [context](#lr.ContextTracker) value, if
25
+ any. Its type will depend on the context tracker's type
26
+ parameter, or it will be `null` if there is no context
27
+ tracker.
28
+ */
29
+ get context() {
30
+ return this.curContext ? this.curContext.context : null;
31
+ }
32
+ // Push a state onto the stack, tracking its start position as well
33
+ // as the buffer base at that point.
34
+ /**
35
+ @internal
36
+ */
37
+ pushState(t, e) {
38
+ this.stack.push(this.state, e, this.bufferBase + this.buffer.length), this.state = t;
39
+ }
40
+ // Apply a reduce action
41
+ /**
42
+ @internal
43
+ */
44
+ reduce(t) {
45
+ var e;
46
+ let s = t >> 19, i = t & 65535, { parser: h } = this.p, r = this.reducePos < this.pos - 25 && this.setLookAhead(this.pos), n = h.dynamicPrecedence(i);
47
+ if (n && (this.score += n), s == 0) {
48
+ this.pushState(h.getGoto(this.state, i, !0), this.reducePos), i < h.minRepeatTerm && this.storeNode(i, this.reducePos, this.reducePos, r ? 8 : 4, !0), this.reduceContext(i, this.reducePos);
49
+ return;
50
+ }
51
+ let o = this.stack.length - (s - 1) * 3 - (t & 262144 ? 6 : 0), a = o ? this.stack[o - 2] : this.p.ranges[0].from, u = this.reducePos - a;
52
+ u >= 2e3 && !(!((e = this.p.parser.nodeSet.types[i]) === null || e === void 0) && e.isAnonymous) && (a == this.p.lastBigReductionStart ? (this.p.bigReductionCount++, this.p.lastBigReductionSize = u) : this.p.lastBigReductionSize < u && (this.p.bigReductionCount = 1, this.p.lastBigReductionStart = a, this.p.lastBigReductionSize = u));
53
+ let f = o ? this.stack[o - 1] : 0, p = this.bufferBase + this.buffer.length - f;
54
+ if (i < h.minRepeatTerm || t & 131072) {
55
+ let c = h.stateFlag(
56
+ this.state,
57
+ 1
58
+ /* StateFlag.Skipped */
59
+ ) ? this.pos : this.reducePos;
60
+ this.storeNode(i, a, c, p + 4, !0);
61
+ }
62
+ if (t & 262144)
63
+ this.state = this.stack[o];
64
+ else {
65
+ let c = this.stack[o - 3];
66
+ this.state = h.getGoto(c, i, !0);
67
+ }
68
+ for (; this.stack.length > o; )
69
+ this.stack.pop();
70
+ this.reduceContext(i, a);
71
+ }
72
+ // Shift a value into the buffer
73
+ /**
74
+ @internal
75
+ */
76
+ storeNode(t, e, s, i = 4, h = !1) {
77
+ if (t == 0 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) {
78
+ let r = this, n = this.buffer.length;
79
+ if (n == 0 && r.parent && (n = r.bufferBase - r.parent.bufferBase, r = r.parent), n > 0 && r.buffer[n - 4] == 0 && r.buffer[n - 1] > -1) {
80
+ if (e == s)
81
+ return;
82
+ if (r.buffer[n - 2] >= e) {
83
+ r.buffer[n - 2] = s;
84
+ return;
85
+ }
86
+ }
87
+ }
88
+ if (!h || this.pos == s)
89
+ this.buffer.push(t, e, s, i);
90
+ else {
91
+ let r = this.buffer.length;
92
+ if (r > 0 && (this.buffer[r - 4] != 0 || this.buffer[r - 1] < 0)) {
93
+ let n = !1;
94
+ for (let o = r; o > 0 && this.buffer[o - 2] > s; o -= 4)
95
+ if (this.buffer[o - 1] >= 0) {
96
+ n = !0;
97
+ break;
98
+ }
99
+ if (n)
100
+ for (; r > 0 && this.buffer[r - 2] > s; )
101
+ this.buffer[r] = this.buffer[r - 4], this.buffer[r + 1] = this.buffer[r - 3], this.buffer[r + 2] = this.buffer[r - 2], this.buffer[r + 3] = this.buffer[r - 1], r -= 4, i > 4 && (i -= 4);
102
+ }
103
+ this.buffer[r] = t, this.buffer[r + 1] = e, this.buffer[r + 2] = s, this.buffer[r + 3] = i;
104
+ }
105
+ }
106
+ // Apply a shift action
107
+ /**
108
+ @internal
109
+ */
110
+ shift(t, e, s, i) {
111
+ if (t & 131072)
112
+ this.pushState(t & 65535, this.pos);
113
+ else if (t & 262144)
114
+ this.pos = i, this.shiftContext(e, s), e <= this.p.parser.maxNode && this.buffer.push(e, s, i, 4);
115
+ else {
116
+ let h = t, { parser: r } = this.p;
117
+ (i > this.pos || e <= r.maxNode) && (this.pos = i, r.stateFlag(
118
+ h,
119
+ 1
120
+ /* StateFlag.Skipped */
121
+ ) || (this.reducePos = i)), this.pushState(h, s), this.shiftContext(e, s), e <= r.maxNode && this.buffer.push(e, s, i, 4);
122
+ }
123
+ }
124
+ // Apply an action
125
+ /**
126
+ @internal
127
+ */
128
+ apply(t, e, s, i) {
129
+ t & 65536 ? this.reduce(t) : this.shift(t, e, s, i);
130
+ }
131
+ // Add a prebuilt (reused) node into the buffer.
132
+ /**
133
+ @internal
134
+ */
135
+ useNode(t, e) {
136
+ let s = this.p.reused.length - 1;
137
+ (s < 0 || this.p.reused[s] != t) && (this.p.reused.push(t), s++);
138
+ let i = this.pos;
139
+ this.reducePos = this.pos = i + t.length, this.pushState(e, i), this.buffer.push(
140
+ s,
141
+ i,
142
+ this.reducePos,
143
+ -1
144
+ /* size == -1 means this is a reused value */
145
+ ), this.curContext && this.updateContext(this.curContext.tracker.reuse(this.curContext.context, t, this, this.p.stream.reset(this.pos - t.length)));
146
+ }
147
+ // Split the stack. Due to the buffer sharing and the fact
148
+ // that `this.stack` tends to stay quite shallow, this isn't very
149
+ // expensive.
150
+ /**
151
+ @internal
152
+ */
153
+ split() {
154
+ let t = this, e = t.buffer.length;
155
+ for (; e > 0 && t.buffer[e - 2] > t.reducePos; )
156
+ e -= 4;
157
+ let s = t.buffer.slice(e), i = t.bufferBase + e;
158
+ for (; t && i == t.bufferBase; )
159
+ t = t.parent;
160
+ return new v(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, s, i, this.curContext, this.lookAhead, t);
161
+ }
162
+ // Try to recover from an error by 'deleting' (ignoring) one token.
163
+ /**
164
+ @internal
165
+ */
166
+ recoverByDelete(t, e) {
167
+ let s = t <= this.p.parser.maxNode;
168
+ s && this.storeNode(t, this.pos, e, 4), this.storeNode(0, this.pos, e, s ? 8 : 4), this.pos = this.reducePos = e, this.score -= 190;
169
+ }
170
+ /**
171
+ Check if the given term would be able to be shifted (optionally
172
+ after some reductions) on this stack. This can be useful for
173
+ external tokenizers that want to make sure they only provide a
174
+ given token when it applies.
175
+ */
176
+ canShift(t) {
177
+ for (let e = new G(this); ; ) {
178
+ let s = this.p.parser.stateSlot(
179
+ e.state,
180
+ 4
181
+ /* ParseState.DefaultReduce */
182
+ ) || this.p.parser.hasAction(e.state, t);
183
+ if (s == 0)
184
+ return !1;
185
+ if (!(s & 65536))
186
+ return !0;
187
+ e.reduce(s);
188
+ }
189
+ }
190
+ // Apply up to Recover.MaxNext recovery actions that conceptually
191
+ // inserts some missing token or rule.
192
+ /**
193
+ @internal
194
+ */
195
+ recoverByInsert(t) {
196
+ if (this.stack.length >= 300)
197
+ return [];
198
+ let e = this.p.parser.nextStates(this.state);
199
+ if (e.length > 8 || this.stack.length >= 120) {
200
+ let i = [];
201
+ for (let h = 0, r; h < e.length; h += 2)
202
+ (r = e[h + 1]) != this.state && this.p.parser.hasAction(r, t) && i.push(e[h], r);
203
+ if (this.stack.length < 120)
204
+ for (let h = 0; i.length < 8 && h < e.length; h += 2) {
205
+ let r = e[h + 1];
206
+ i.some((n, o) => o & 1 && n == r) || i.push(e[h], r);
207
+ }
208
+ e = i;
209
+ }
210
+ let s = [];
211
+ for (let i = 0; i < e.length && s.length < 4; i += 2) {
212
+ let h = e[i + 1];
213
+ if (h == this.state)
214
+ continue;
215
+ let r = this.split();
216
+ r.pushState(h, this.pos), r.storeNode(0, r.pos, r.pos, 4, !0), r.shiftContext(e[i], this.pos), r.reducePos = this.pos, r.score -= 200, s.push(r);
217
+ }
218
+ return s;
219
+ }
220
+ // Force a reduce, if possible. Return false if that can't
221
+ // be done.
222
+ /**
223
+ @internal
224
+ */
225
+ forceReduce() {
226
+ let { parser: t } = this.p, e = t.stateSlot(
227
+ this.state,
228
+ 5
229
+ /* ParseState.ForcedReduce */
230
+ );
231
+ if (!(e & 65536))
232
+ return !1;
233
+ if (!t.validAction(this.state, e)) {
234
+ let s = e >> 19, i = e & 65535, h = this.stack.length - s * 3;
235
+ if (h < 0 || t.getGoto(this.stack[h], i, !1) < 0) {
236
+ let r = this.findForcedReduction();
237
+ if (r == null)
238
+ return !1;
239
+ e = r;
240
+ }
241
+ this.storeNode(0, this.pos, this.pos, 4, !0), this.score -= 100;
242
+ }
243
+ return this.reducePos = this.pos, this.reduce(e), !0;
244
+ }
245
+ /**
246
+ Try to scan through the automaton to find some kind of reduction
247
+ that can be applied. Used when the regular ForcedReduce field
248
+ isn't a valid action. @internal
249
+ */
250
+ findForcedReduction() {
251
+ let { parser: t } = this.p, e = [], s = (i, h) => {
252
+ if (!e.includes(i))
253
+ return e.push(i), t.allActions(i, (r) => {
254
+ if (!(r & 393216)) if (r & 65536) {
255
+ let n = (r >> 19) - h;
256
+ if (n > 1) {
257
+ let o = r & 65535, a = this.stack.length - n * 3;
258
+ if (a >= 0 && t.getGoto(this.stack[a], o, !1) >= 0)
259
+ return n << 19 | 65536 | o;
260
+ }
261
+ } else {
262
+ let n = s(r, h + 1);
263
+ if (n != null)
264
+ return n;
265
+ }
266
+ });
267
+ };
268
+ return s(this.state, 0);
269
+ }
270
+ /**
271
+ @internal
272
+ */
273
+ forceAll() {
274
+ for (; !this.p.parser.stateFlag(
275
+ this.state,
276
+ 2
277
+ /* StateFlag.Accepting */
278
+ ); )
279
+ if (!this.forceReduce()) {
280
+ this.storeNode(0, this.pos, this.pos, 4, !0);
281
+ break;
282
+ }
283
+ return this;
284
+ }
285
+ /**
286
+ Check whether this state has no further actions (assumed to be a direct descendant of the
287
+ top state, since any other states must be able to continue
288
+ somehow). @internal
289
+ */
290
+ get deadEnd() {
291
+ if (this.stack.length != 3)
292
+ return !1;
293
+ let { parser: t } = this.p;
294
+ return t.data[t.stateSlot(
295
+ this.state,
296
+ 1
297
+ /* ParseState.Actions */
298
+ )] == 65535 && !t.stateSlot(
299
+ this.state,
300
+ 4
301
+ /* ParseState.DefaultReduce */
302
+ );
303
+ }
304
+ /**
305
+ Restart the stack (put it back in its start state). Only safe
306
+ when this.stack.length == 3 (state is directly below the top
307
+ state). @internal
308
+ */
309
+ restart() {
310
+ this.storeNode(0, this.pos, this.pos, 4, !0), this.state = this.stack[0], this.stack.length = 0;
311
+ }
312
+ /**
313
+ @internal
314
+ */
315
+ sameState(t) {
316
+ if (this.state != t.state || this.stack.length != t.stack.length)
317
+ return !1;
318
+ for (let e = 0; e < this.stack.length; e += 3)
319
+ if (this.stack[e] != t.stack[e])
320
+ return !1;
321
+ return !0;
322
+ }
323
+ /**
324
+ Get the parser used by this stack.
325
+ */
326
+ get parser() {
327
+ return this.p.parser;
328
+ }
329
+ /**
330
+ Test whether a given dialect (by numeric ID, as exported from
331
+ the terms file) is enabled.
332
+ */
333
+ dialectEnabled(t) {
334
+ return this.p.parser.dialect.flags[t];
335
+ }
336
+ shiftContext(t, e) {
337
+ this.curContext && this.updateContext(this.curContext.tracker.shift(this.curContext.context, t, this, this.p.stream.reset(e)));
338
+ }
339
+ reduceContext(t, e) {
340
+ this.curContext && this.updateContext(this.curContext.tracker.reduce(this.curContext.context, t, this, this.p.stream.reset(e)));
341
+ }
342
+ /**
343
+ @internal
344
+ */
345
+ emitContext() {
346
+ let t = this.buffer.length - 1;
347
+ (t < 0 || this.buffer[t] != -3) && this.buffer.push(this.curContext.hash, this.pos, this.pos, -3);
348
+ }
349
+ /**
350
+ @internal
351
+ */
352
+ emitLookAhead() {
353
+ let t = this.buffer.length - 1;
354
+ (t < 0 || this.buffer[t] != -4) && this.buffer.push(this.lookAhead, this.pos, this.pos, -4);
355
+ }
356
+ updateContext(t) {
357
+ if (t != this.curContext.context) {
358
+ let e = new N(this.curContext.tracker, t);
359
+ e.hash != this.curContext.hash && this.emitContext(), this.curContext = e;
360
+ }
361
+ }
362
+ /**
363
+ @internal
364
+ */
365
+ setLookAhead(t) {
366
+ return t <= this.lookAhead ? !1 : (this.emitLookAhead(), this.lookAhead = t, !0);
367
+ }
368
+ /**
369
+ @internal
370
+ */
371
+ close() {
372
+ this.curContext && this.curContext.tracker.strict && this.emitContext(), this.lookAhead > 0 && this.emitLookAhead();
373
+ }
374
+ }
375
+ class N {
376
+ constructor(t, e) {
377
+ this.tracker = t, this.context = e, this.hash = t.strict ? t.hash(e) : 0;
378
+ }
379
+ }
380
+ class G {
381
+ constructor(t) {
382
+ this.start = t, this.state = t.state, this.stack = t.stack, this.base = this.stack.length;
383
+ }
384
+ reduce(t) {
385
+ let e = t & 65535, s = t >> 19;
386
+ s == 0 ? (this.stack == this.start.stack && (this.stack = this.stack.slice()), this.stack.push(this.state, 0, 0), this.base += 3) : this.base -= (s - 1) * 3;
387
+ let i = this.start.p.parser.getGoto(this.stack[this.base - 3], e, !0);
388
+ this.state = i;
389
+ }
390
+ }
391
+ class A {
392
+ constructor(t, e, s) {
393
+ this.stack = t, this.pos = e, this.index = s, this.buffer = t.buffer, this.index == 0 && this.maybeNext();
394
+ }
395
+ static create(t, e = t.bufferBase + t.buffer.length) {
396
+ return new A(t, e, e - t.bufferBase);
397
+ }
398
+ maybeNext() {
399
+ let t = this.stack.parent;
400
+ t != null && (this.index = this.stack.bufferBase - t.bufferBase, this.stack = t, this.buffer = t.buffer);
401
+ }
402
+ get id() {
403
+ return this.buffer[this.index - 4];
404
+ }
405
+ get start() {
406
+ return this.buffer[this.index - 3];
407
+ }
408
+ get end() {
409
+ return this.buffer[this.index - 2];
410
+ }
411
+ get size() {
412
+ return this.buffer[this.index - 1];
413
+ }
414
+ next() {
415
+ this.index -= 4, this.pos -= 4, this.index == 0 && this.maybeNext();
416
+ }
417
+ fork() {
418
+ return new A(this.stack, this.pos, this.index);
419
+ }
420
+ }
421
+ function x(l, t = Uint16Array) {
422
+ if (typeof l != "string")
423
+ return l;
424
+ let e = null;
425
+ for (let s = 0, i = 0; s < l.length; ) {
426
+ let h = 0;
427
+ for (; ; ) {
428
+ let r = l.charCodeAt(s++), n = !1;
429
+ if (r == 126) {
430
+ h = 65535;
431
+ break;
432
+ }
433
+ r >= 92 && r--, r >= 34 && r--;
434
+ let o = r - 32;
435
+ if (o >= 46 && (o -= 46, n = !0), h += o, n)
436
+ break;
437
+ h *= 46;
438
+ }
439
+ e ? e[i++] = h : e = new t(h);
440
+ }
441
+ return e;
442
+ }
443
+ class P {
444
+ constructor() {
445
+ this.start = -1, this.value = -1, this.end = -1, this.extended = -1, this.lookAhead = 0, this.mask = 0, this.context = 0;
446
+ }
447
+ }
448
+ const R = new P();
449
+ class U {
450
+ /**
451
+ @internal
452
+ */
453
+ constructor(t, e) {
454
+ this.input = t, this.ranges = e, this.chunk = "", this.chunkOff = 0, this.chunk2 = "", this.chunk2Pos = 0, this.next = -1, this.token = R, this.rangeIndex = 0, this.pos = this.chunkPos = e[0].from, this.range = e[0], this.end = e[e.length - 1].to, this.readNext();
455
+ }
456
+ /**
457
+ @internal
458
+ */
459
+ resolveOffset(t, e) {
460
+ let s = this.range, i = this.rangeIndex, h = this.pos + t;
461
+ for (; h < s.from; ) {
462
+ if (!i)
463
+ return null;
464
+ let r = this.ranges[--i];
465
+ h -= s.from - r.to, s = r;
466
+ }
467
+ for (; e < 0 ? h > s.to : h >= s.to; ) {
468
+ if (i == this.ranges.length - 1)
469
+ return null;
470
+ let r = this.ranges[++i];
471
+ h += r.from - s.to, s = r;
472
+ }
473
+ return h;
474
+ }
475
+ /**
476
+ @internal
477
+ */
478
+ clipPos(t) {
479
+ if (t >= this.range.from && t < this.range.to)
480
+ return t;
481
+ for (let e of this.ranges)
482
+ if (e.to > t)
483
+ return Math.max(t, e.from);
484
+ return this.end;
485
+ }
486
+ /**
487
+ Look at a code unit near the stream position. `.peek(0)` equals
488
+ `.next`, `.peek(-1)` gives you the previous character, and so
489
+ on.
490
+
491
+ Note that looking around during tokenizing creates dependencies
492
+ on potentially far-away content, which may reduce the
493
+ effectiveness incremental parsing—when looking forward—or even
494
+ cause invalid reparses when looking backward more than 25 code
495
+ units, since the library does not track lookbehind.
496
+ */
497
+ peek(t) {
498
+ let e = this.chunkOff + t, s, i;
499
+ if (e >= 0 && e < this.chunk.length)
500
+ s = this.pos + t, i = this.chunk.charCodeAt(e);
501
+ else {
502
+ let h = this.resolveOffset(t, 1);
503
+ if (h == null)
504
+ return -1;
505
+ if (s = h, s >= this.chunk2Pos && s < this.chunk2Pos + this.chunk2.length)
506
+ i = this.chunk2.charCodeAt(s - this.chunk2Pos);
507
+ else {
508
+ let r = this.rangeIndex, n = this.range;
509
+ for (; n.to <= s; )
510
+ n = this.ranges[++r];
511
+ this.chunk2 = this.input.chunk(this.chunk2Pos = s), s + this.chunk2.length > n.to && (this.chunk2 = this.chunk2.slice(0, n.to - s)), i = this.chunk2.charCodeAt(0);
512
+ }
513
+ }
514
+ return s >= this.token.lookAhead && (this.token.lookAhead = s + 1), i;
515
+ }
516
+ /**
517
+ Accept a token. By default, the end of the token is set to the
518
+ current stream position, but you can pass an offset (relative to
519
+ the stream position) to change that.
520
+ */
521
+ acceptToken(t, e = 0) {
522
+ let s = e ? this.resolveOffset(e, -1) : this.pos;
523
+ if (s == null || s < this.token.start)
524
+ throw new RangeError("Token end out of bounds");
525
+ this.token.value = t, this.token.end = s;
526
+ }
527
+ /**
528
+ Accept a token ending at a specific given position.
529
+ */
530
+ acceptTokenTo(t, e) {
531
+ this.token.value = t, this.token.end = e;
532
+ }
533
+ getChunk() {
534
+ if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) {
535
+ let { chunk: t, chunkPos: e } = this;
536
+ this.chunk = this.chunk2, this.chunkPos = this.chunk2Pos, this.chunk2 = t, this.chunk2Pos = e, this.chunkOff = this.pos - this.chunkPos;
537
+ } else {
538
+ this.chunk2 = this.chunk, this.chunk2Pos = this.chunkPos;
539
+ let t = this.input.chunk(this.pos), e = this.pos + t.length;
540
+ this.chunk = e > this.range.to ? t.slice(0, this.range.to - this.pos) : t, this.chunkPos = this.pos, this.chunkOff = 0;
541
+ }
542
+ }
543
+ readNext() {
544
+ return this.chunkOff >= this.chunk.length && (this.getChunk(), this.chunkOff == this.chunk.length) ? this.next = -1 : this.next = this.chunk.charCodeAt(this.chunkOff);
545
+ }
546
+ /**
547
+ Move the stream forward N (defaults to 1) code units. Returns
548
+ the new value of [`next`](#lr.InputStream.next).
549
+ */
550
+ advance(t = 1) {
551
+ for (this.chunkOff += t; this.pos + t >= this.range.to; ) {
552
+ if (this.rangeIndex == this.ranges.length - 1)
553
+ return this.setDone();
554
+ t -= this.range.to - this.pos, this.range = this.ranges[++this.rangeIndex], this.pos = this.range.from;
555
+ }
556
+ return this.pos += t, this.pos >= this.token.lookAhead && (this.token.lookAhead = this.pos + 1), this.readNext();
557
+ }
558
+ setDone() {
559
+ return this.pos = this.chunkPos = this.end, this.range = this.ranges[this.rangeIndex = this.ranges.length - 1], this.chunk = "", this.next = -1;
560
+ }
561
+ /**
562
+ @internal
563
+ */
564
+ reset(t, e) {
565
+ if (e ? (this.token = e, e.start = t, e.lookAhead = t + 1, e.value = e.extended = -1) : this.token = R, this.pos != t) {
566
+ if (this.pos = t, t == this.end)
567
+ return this.setDone(), this;
568
+ for (; t < this.range.from; )
569
+ this.range = this.ranges[--this.rangeIndex];
570
+ for (; t >= this.range.to; )
571
+ this.range = this.ranges[++this.rangeIndex];
572
+ t >= this.chunkPos && t < this.chunkPos + this.chunk.length ? this.chunkOff = t - this.chunkPos : (this.chunk = "", this.chunkOff = 0), this.readNext();
573
+ }
574
+ return this;
575
+ }
576
+ /**
577
+ @internal
578
+ */
579
+ read(t, e) {
580
+ if (t >= this.chunkPos && e <= this.chunkPos + this.chunk.length)
581
+ return this.chunk.slice(t - this.chunkPos, e - this.chunkPos);
582
+ if (t >= this.chunk2Pos && e <= this.chunk2Pos + this.chunk2.length)
583
+ return this.chunk2.slice(t - this.chunk2Pos, e - this.chunk2Pos);
584
+ if (t >= this.range.from && e <= this.range.to)
585
+ return this.input.read(t, e);
586
+ let s = "";
587
+ for (let i of this.ranges) {
588
+ if (i.from >= e)
589
+ break;
590
+ i.to > t && (s += this.input.read(Math.max(i.from, t), Math.min(i.to, e)));
591
+ }
592
+ return s;
593
+ }
594
+ }
595
+ class m {
596
+ constructor(t, e) {
597
+ this.data = t, this.id = e;
598
+ }
599
+ token(t, e) {
600
+ let { parser: s } = e.p;
601
+ F(this.data, t, e, this.id, s.data, s.tokenPrecTable);
602
+ }
603
+ }
604
+ m.prototype.contextual = m.prototype.fallback = m.prototype.extend = !1;
605
+ class H {
606
+ constructor(t, e, s) {
607
+ this.precTable = e, this.elseToken = s, this.data = typeof t == "string" ? x(t) : t;
608
+ }
609
+ token(t, e) {
610
+ let s = t.pos, i = 0;
611
+ for (; ; ) {
612
+ let h = t.next < 0, r = t.resolveOffset(1, 1);
613
+ if (F(this.data, t, e, 0, this.data, this.precTable), t.token.value > -1)
614
+ break;
615
+ if (this.elseToken == null)
616
+ return;
617
+ if (h || i++, r == null)
618
+ break;
619
+ t.reset(r, t.token);
620
+ }
621
+ i && (t.reset(s, t.token), t.acceptToken(this.elseToken, i));
622
+ }
623
+ }
624
+ H.prototype.contextual = m.prototype.fallback = m.prototype.extend = !1;
625
+ class Y {
626
+ /**
627
+ Create a tokenizer. The first argument is the function that,
628
+ given an input stream, scans for the types of tokens it
629
+ recognizes at the stream's position, and calls
630
+ [`acceptToken`](#lr.InputStream.acceptToken) when it finds
631
+ one.
632
+ */
633
+ constructor(t, e = {}) {
634
+ this.token = t, this.contextual = !!e.contextual, this.fallback = !!e.fallback, this.extend = !!e.extend;
635
+ }
636
+ }
637
+ function F(l, t, e, s, i, h) {
638
+ let r = 0, n = 1 << s, { dialect: o } = e.p.parser;
639
+ t: for (; n & l[r]; ) {
640
+ let a = l[r + 1];
641
+ for (let c = r + 3; c < a; c += 2)
642
+ if ((l[c + 1] & n) > 0) {
643
+ let d = l[c];
644
+ if (o.allows(d) && (t.token.value == -1 || t.token.value == d || W(d, t.token.value, i, h))) {
645
+ t.acceptToken(d);
646
+ break;
647
+ }
648
+ }
649
+ let u = t.next, f = 0, p = l[r + 2];
650
+ if (t.next < 0 && p > f && l[a + p * 3 - 3] == 65535) {
651
+ r = l[a + p * 3 - 1];
652
+ continue t;
653
+ }
654
+ for (; f < p; ) {
655
+ let c = f + p >> 1, d = a + c + (c << 1), b = l[d], O = l[d + 1] || 65536;
656
+ if (u < b)
657
+ p = c;
658
+ else if (u >= O)
659
+ f = c + 1;
660
+ else {
661
+ r = l[d + 2], t.advance();
662
+ continue t;
663
+ }
664
+ }
665
+ break;
666
+ }
667
+ }
668
+ function z(l, t, e) {
669
+ for (let s = t, i; (i = l[s]) != 65535; s++)
670
+ if (i == e)
671
+ return s - t;
672
+ return -1;
673
+ }
674
+ function W(l, t, e, s) {
675
+ let i = z(e, s, t);
676
+ return i < 0 || z(e, s, l) < i;
677
+ }
678
+ const g = typeof process < "u" && process.env && /\bparse\b/.test(process.env.LOG);
679
+ let T = null;
680
+ function I(l, t, e) {
681
+ let s = l.cursor(j.IncludeAnonymous);
682
+ for (s.moveTo(t); ; )
683
+ if (!(e < 0 ? s.childBefore(t) : s.childAfter(t)))
684
+ for (; ; ) {
685
+ if ((e < 0 ? s.to < t : s.from > t) && !s.type.isError)
686
+ return e < 0 ? Math.max(0, Math.min(
687
+ s.to - 1,
688
+ t - 25
689
+ /* Lookahead.Margin */
690
+ )) : Math.min(l.length, Math.max(
691
+ s.from + 1,
692
+ t + 25
693
+ /* Lookahead.Margin */
694
+ ));
695
+ if (e < 0 ? s.prevSibling() : s.nextSibling())
696
+ break;
697
+ if (!s.parent())
698
+ return e < 0 ? 0 : l.length;
699
+ }
700
+ }
701
+ class q {
702
+ constructor(t, e) {
703
+ this.fragments = t, this.nodeSet = e, this.i = 0, this.fragment = null, this.safeFrom = -1, this.safeTo = -1, this.trees = [], this.start = [], this.index = [], this.nextFragment();
704
+ }
705
+ nextFragment() {
706
+ let t = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++];
707
+ if (t) {
708
+ for (this.safeFrom = t.openStart ? I(t.tree, t.from + t.offset, 1) - t.offset : t.from, this.safeTo = t.openEnd ? I(t.tree, t.to + t.offset, -1) - t.offset : t.to; this.trees.length; )
709
+ this.trees.pop(), this.start.pop(), this.index.pop();
710
+ this.trees.push(t.tree), this.start.push(-t.offset), this.index.push(0), this.nextStart = this.safeFrom;
711
+ } else
712
+ this.nextStart = 1e9;
713
+ }
714
+ // `pos` must be >= any previously given `pos` for this cursor
715
+ nodeAt(t) {
716
+ if (t < this.nextStart)
717
+ return null;
718
+ for (; this.fragment && this.safeTo <= t; )
719
+ this.nextFragment();
720
+ if (!this.fragment)
721
+ return null;
722
+ for (; ; ) {
723
+ let e = this.trees.length - 1;
724
+ if (e < 0)
725
+ return this.nextFragment(), null;
726
+ let s = this.trees[e], i = this.index[e];
727
+ if (i == s.children.length) {
728
+ this.trees.pop(), this.start.pop(), this.index.pop();
729
+ continue;
730
+ }
731
+ let h = s.children[i], r = this.start[e] + s.positions[i];
732
+ if (r > t)
733
+ return this.nextStart = r, null;
734
+ if (h instanceof S) {
735
+ if (r == t) {
736
+ if (r < this.safeFrom)
737
+ return null;
738
+ let n = r + h.length;
739
+ if (n <= this.safeTo) {
740
+ let o = h.prop(y.lookAhead);
741
+ if (!o || n + o < this.fragment.to)
742
+ return h;
743
+ }
744
+ }
745
+ this.index[e]++, r + h.length >= Math.max(this.safeFrom, t) && (this.trees.push(h), this.start.push(r), this.index.push(0));
746
+ } else
747
+ this.index[e]++, this.nextStart = r + h.length;
748
+ }
749
+ }
750
+ }
751
+ class J {
752
+ constructor(t, e) {
753
+ this.stream = e, this.tokens = [], this.mainToken = null, this.actions = [], this.tokens = t.tokenizers.map((s) => new P());
754
+ }
755
+ getActions(t) {
756
+ let e = 0, s = null, { parser: i } = t.p, { tokenizers: h } = i, r = i.stateSlot(
757
+ t.state,
758
+ 3
759
+ /* ParseState.TokenizerMask */
760
+ ), n = t.curContext ? t.curContext.hash : 0, o = 0;
761
+ for (let a = 0; a < h.length; a++) {
762
+ if (!(1 << a & r))
763
+ continue;
764
+ let u = h[a], f = this.tokens[a];
765
+ if (!(s && !u.fallback) && ((u.contextual || f.start != t.pos || f.mask != r || f.context != n) && (this.updateCachedToken(f, u, t), f.mask = r, f.context = n), f.lookAhead > f.end + 25 && (o = Math.max(f.lookAhead, o)), f.value != 0)) {
766
+ let p = e;
767
+ if (f.extended > -1 && (e = this.addActions(t, f.extended, f.end, e)), e = this.addActions(t, f.value, f.end, e), !u.extend && (s = f, e > p))
768
+ break;
769
+ }
770
+ }
771
+ for (; this.actions.length > e; )
772
+ this.actions.pop();
773
+ return o && t.setLookAhead(o), !s && t.pos == this.stream.end && (s = new P(), s.value = t.p.parser.eofTerm, s.start = s.end = t.pos, e = this.addActions(t, s.value, s.end, e)), this.mainToken = s, this.actions;
774
+ }
775
+ getMainToken(t) {
776
+ if (this.mainToken)
777
+ return this.mainToken;
778
+ let e = new P(), { pos: s, p: i } = t;
779
+ return e.start = s, e.end = Math.min(s + 1, i.stream.end), e.value = s == i.stream.end ? i.parser.eofTerm : 0, e;
780
+ }
781
+ updateCachedToken(t, e, s) {
782
+ let i = this.stream.clipPos(s.pos);
783
+ if (e.token(this.stream.reset(i, t), s), t.value > -1) {
784
+ let { parser: h } = s.p;
785
+ for (let r = 0; r < h.specialized.length; r++)
786
+ if (h.specialized[r] == t.value) {
787
+ let n = h.specializers[r](this.stream.read(t.start, t.end), s);
788
+ if (n >= 0 && s.p.parser.dialect.allows(n >> 1)) {
789
+ n & 1 ? t.extended = n >> 1 : t.value = n >> 1;
790
+ break;
791
+ }
792
+ }
793
+ } else
794
+ t.value = 0, t.end = this.stream.clipPos(i + 1);
795
+ }
796
+ putAction(t, e, s, i) {
797
+ for (let h = 0; h < i; h += 3)
798
+ if (this.actions[h] == t)
799
+ return i;
800
+ return this.actions[i++] = t, this.actions[i++] = e, this.actions[i++] = s, i;
801
+ }
802
+ addActions(t, e, s, i) {
803
+ let { state: h } = t, { parser: r } = t.p, { data: n } = r;
804
+ for (let o = 0; o < 2; o++)
805
+ for (let a = r.stateSlot(
806
+ h,
807
+ o ? 2 : 1
808
+ /* ParseState.Actions */
809
+ ); ; a += 3) {
810
+ if (n[a] == 65535)
811
+ if (n[a + 1] == 1)
812
+ a = k(n, a + 2);
813
+ else {
814
+ i == 0 && n[a + 1] == 2 && (i = this.putAction(k(n, a + 2), e, s, i));
815
+ break;
816
+ }
817
+ n[a] == e && (i = this.putAction(k(n, a + 1), e, s, i));
818
+ }
819
+ return i;
820
+ }
821
+ }
822
+ class K {
823
+ constructor(t, e, s, i) {
824
+ this.parser = t, this.input = e, 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 U(e, i), this.tokens = new J(t, this.stream), this.topTerm = t.top[1];
825
+ let { from: h } = i[0];
826
+ this.stacks = [v.start(this, t.top[0], h)], this.fragments = s.length && this.stream.end - h > t.bufferLength * 4 ? new q(s, t.nodeSet) : null;
827
+ }
828
+ get parsedPos() {
829
+ return this.minStackPos;
830
+ }
831
+ // Move the parser forward. This will process all parse stacks at
832
+ // `this.pos` and try to advance them to a further position. If no
833
+ // stack for such a position is found, it'll start error-recovery.
834
+ //
835
+ // When the parse is finished, this will return a syntax tree. When
836
+ // not, it returns `null`.
837
+ advance() {
838
+ let t = this.stacks, e = this.minStackPos, s = this.stacks = [], i, h;
839
+ if (this.bigReductionCount > 300 && t.length == 1) {
840
+ let [r] = t;
841
+ for (; r.forceReduce() && r.stack.length && r.stack[r.stack.length - 2] >= this.lastBigReductionStart; )
842
+ ;
843
+ this.bigReductionCount = this.lastBigReductionSize = 0;
844
+ }
845
+ for (let r = 0; r < t.length; r++) {
846
+ let n = t[r];
847
+ for (; ; ) {
848
+ if (this.tokens.mainToken = null, n.pos > e)
849
+ s.push(n);
850
+ else {
851
+ if (this.advanceStack(n, s, t))
852
+ continue;
853
+ {
854
+ i || (i = [], h = []), i.push(n);
855
+ let o = this.tokens.getMainToken(n);
856
+ h.push(o.value, o.end);
857
+ }
858
+ }
859
+ break;
860
+ }
861
+ }
862
+ if (!s.length) {
863
+ let r = i && V(i);
864
+ if (r)
865
+ return g && console.log("Finish with " + this.stackID(r)), this.stackToTree(r);
866
+ if (this.parser.strict)
867
+ throw g && i && console.log("Stuck with token " + (this.tokens.mainToken ? this.parser.getName(this.tokens.mainToken.value) : "none")), new SyntaxError("No parse at " + e);
868
+ this.recovering || (this.recovering = 5);
869
+ }
870
+ if (this.recovering && i) {
871
+ let r = this.stoppedAt != null && i[0].pos > this.stoppedAt ? i[0] : this.runRecovery(i, h, s);
872
+ if (r)
873
+ return g && console.log("Force-finish " + this.stackID(r)), this.stackToTree(r.forceAll());
874
+ }
875
+ if (this.recovering) {
876
+ let r = this.recovering == 1 ? 1 : this.recovering * 3;
877
+ if (s.length > r)
878
+ for (s.sort((n, o) => o.score - n.score); s.length > r; )
879
+ s.pop();
880
+ s.some((n) => n.reducePos > e) && this.recovering--;
881
+ } else if (s.length > 1) {
882
+ t: for (let r = 0; r < s.length - 1; r++) {
883
+ let n = s[r];
884
+ for (let o = r + 1; o < s.length; o++) {
885
+ let a = s[o];
886
+ if (n.sameState(a) || n.buffer.length > 500 && a.buffer.length > 500)
887
+ if ((n.score - a.score || n.buffer.length - a.buffer.length) > 0)
888
+ s.splice(o--, 1);
889
+ else {
890
+ s.splice(r--, 1);
891
+ continue t;
892
+ }
893
+ }
894
+ }
895
+ s.length > 12 && (s.sort((r, n) => n.score - r.score), s.splice(
896
+ 12,
897
+ s.length - 12
898
+ /* Rec.MaxStackCount */
899
+ ));
900
+ }
901
+ this.minStackPos = s[0].pos;
902
+ for (let r = 1; r < s.length; r++)
903
+ s[r].pos < this.minStackPos && (this.minStackPos = s[r].pos);
904
+ return null;
905
+ }
906
+ stopAt(t) {
907
+ if (this.stoppedAt != null && this.stoppedAt < t)
908
+ throw new RangeError("Can't move stoppedAt forward");
909
+ this.stoppedAt = t;
910
+ }
911
+ // Returns an updated version of the given stack, or null if the
912
+ // stack can't advance normally. When `split` and `stacks` are
913
+ // given, stacks split off by ambiguous operations will be pushed to
914
+ // `split`, or added to `stacks` if they move `pos` forward.
915
+ advanceStack(t, e, s) {
916
+ let i = t.pos, { parser: h } = this, r = g ? this.stackID(t) + " -> " : "";
917
+ if (this.stoppedAt != null && i > this.stoppedAt)
918
+ return t.forceReduce() ? t : null;
919
+ if (this.fragments) {
920
+ let a = t.curContext && t.curContext.tracker.strict, u = a ? t.curContext.hash : 0;
921
+ for (let f = this.fragments.nodeAt(i); f; ) {
922
+ let p = this.parser.nodeSet.types[f.type.id] == f.type ? h.getGoto(t.state, f.type.id) : -1;
923
+ if (p > -1 && f.length && (!a || (f.prop(y.contextHash) || 0) == u))
924
+ return t.useNode(f, p), g && console.log(r + this.stackID(t) + ` (via reuse of ${h.getName(f.type.id)})`), !0;
925
+ if (!(f instanceof S) || f.children.length == 0 || f.positions[0] > 0)
926
+ break;
927
+ let c = f.children[0];
928
+ if (c instanceof S && f.positions[0] == 0)
929
+ f = c;
930
+ else
931
+ break;
932
+ }
933
+ }
934
+ let n = h.stateSlot(
935
+ t.state,
936
+ 4
937
+ /* ParseState.DefaultReduce */
938
+ );
939
+ if (n > 0)
940
+ return t.reduce(n), g && console.log(r + this.stackID(t) + ` (via always-reduce ${h.getName(
941
+ n & 65535
942
+ /* Action.ValueMask */
943
+ )})`), !0;
944
+ if (t.stack.length >= 8400)
945
+ for (; t.stack.length > 6e3 && t.forceReduce(); )
946
+ ;
947
+ let o = this.tokens.getActions(t);
948
+ for (let a = 0; a < o.length; ) {
949
+ let u = o[a++], f = o[a++], p = o[a++], c = a == o.length || !s, d = c ? t : t.split(), b = this.tokens.mainToken;
950
+ if (d.apply(u, f, b ? b.start : d.pos, p), g && console.log(r + this.stackID(d) + ` (via ${u & 65536 ? `reduce of ${h.getName(
951
+ u & 65535
952
+ /* Action.ValueMask */
953
+ )}` : "shift"} for ${h.getName(f)} @ ${i}${d == t ? "" : ", split"})`), c)
954
+ return !0;
955
+ d.pos > i ? e.push(d) : s.push(d);
956
+ }
957
+ return !1;
958
+ }
959
+ // Advance a given stack forward as far as it will go. Returns the
960
+ // (possibly updated) stack if it got stuck, or null if it moved
961
+ // forward and was given to `pushStackDedup`.
962
+ advanceFully(t, e) {
963
+ let s = t.pos;
964
+ for (; ; ) {
965
+ if (!this.advanceStack(t, null, null))
966
+ return !1;
967
+ if (t.pos > s)
968
+ return D(t, e), !0;
969
+ }
970
+ }
971
+ runRecovery(t, e, s) {
972
+ let i = null, h = !1;
973
+ for (let r = 0; r < t.length; r++) {
974
+ let n = t[r], o = e[r << 1], a = e[(r << 1) + 1], u = g ? this.stackID(n) + " -> " : "";
975
+ if (n.deadEnd && (h || (h = !0, n.restart(), g && console.log(u + this.stackID(n) + " (restarted)"), this.advanceFully(n, s))))
976
+ continue;
977
+ let f = n.split(), p = u;
978
+ for (let c = 0; c < 10 && f.forceReduce() && (g && console.log(p + this.stackID(f) + " (via force-reduce)"), !this.advanceFully(f, s)); c++)
979
+ g && (p = this.stackID(f) + " -> ");
980
+ for (let c of n.recoverByInsert(o))
981
+ g && console.log(u + this.stackID(c) + " (via recover-insert)"), this.advanceFully(c, s);
982
+ this.stream.end > n.pos ? (a == n.pos && (a++, o = 0), n.recoverByDelete(o, a), g && console.log(u + this.stackID(n) + ` (via recover-delete ${this.parser.getName(o)})`), D(n, s)) : (!i || i.score < n.score) && (i = n);
983
+ }
984
+ return i;
985
+ }
986
+ // Convert the stack's buffer to a syntax tree.
987
+ stackToTree(t) {
988
+ return t.close(), S.build({
989
+ buffer: A.create(t),
990
+ nodeSet: this.parser.nodeSet,
991
+ topID: this.topTerm,
992
+ maxBufferLength: this.parser.bufferLength,
993
+ reused: this.reused,
994
+ start: this.ranges[0].from,
995
+ length: t.pos - this.ranges[0].from,
996
+ minRepeatType: this.parser.minRepeatTerm
997
+ });
998
+ }
999
+ stackID(t) {
1000
+ let e = (T || (T = /* @__PURE__ */ new WeakMap())).get(t);
1001
+ return e || T.set(t, e = String.fromCodePoint(this.nextStackID++)), e + t;
1002
+ }
1003
+ }
1004
+ function D(l, t) {
1005
+ for (let e = 0; e < t.length; e++) {
1006
+ let s = t[e];
1007
+ if (s.pos == l.pos && s.sameState(l)) {
1008
+ t[e].score < l.score && (t[e] = l);
1009
+ return;
1010
+ }
1011
+ }
1012
+ t.push(l);
1013
+ }
1014
+ class Q {
1015
+ constructor(t, e, s) {
1016
+ this.source = t, this.flags = e, this.disabled = s;
1017
+ }
1018
+ allows(t) {
1019
+ return !this.disabled || this.disabled[t] == 0;
1020
+ }
1021
+ }
1022
+ const C = (l) => l;
1023
+ class Z {
1024
+ /**
1025
+ Define a context tracker.
1026
+ */
1027
+ constructor(t) {
1028
+ this.start = t.start, this.shift = t.shift || C, this.reduce = t.reduce || C, this.reuse = t.reuse || C, this.hash = t.hash || (() => 0), this.strict = t.strict !== !1;
1029
+ }
1030
+ }
1031
+ class w extends M {
1032
+ /**
1033
+ @internal
1034
+ */
1035
+ constructor(t) {
1036
+ if (super(), this.wrappers = [], t.version != 14)
1037
+ throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);
1038
+ let e = t.nodeNames.split(" ");
1039
+ this.minRepeatTerm = e.length;
1040
+ for (let n = 0; n < t.repeatNodeCount; n++)
1041
+ e.push("");
1042
+ let s = Object.keys(t.topRules).map((n) => t.topRules[n][1]), i = [];
1043
+ for (let n = 0; n < e.length; n++)
1044
+ i.push([]);
1045
+ function h(n, o, a) {
1046
+ i[n].push([o, o.deserialize(String(a))]);
1047
+ }
1048
+ if (t.nodeProps)
1049
+ for (let n of t.nodeProps) {
1050
+ let o = n[0];
1051
+ typeof o == "string" && (o = y[o]);
1052
+ for (let a = 1; a < n.length; ) {
1053
+ let u = n[a++];
1054
+ if (u >= 0)
1055
+ h(u, o, n[a++]);
1056
+ else {
1057
+ let f = n[a + -u];
1058
+ for (let p = -u; p > 0; p--)
1059
+ h(n[a++], o, f);
1060
+ a++;
1061
+ }
1062
+ }
1063
+ }
1064
+ this.nodeSet = new L(e.map((n, o) => $.define({
1065
+ name: o >= this.minRepeatTerm ? void 0 : n,
1066
+ id: o,
1067
+ props: i[o],
1068
+ top: s.indexOf(o) > -1,
1069
+ error: o == 0,
1070
+ skipped: t.skippedNodes && t.skippedNodes.indexOf(o) > -1
1071
+ }))), t.propSources && (this.nodeSet = this.nodeSet.extend(...t.propSources)), this.strict = !1, this.bufferLength = E;
1072
+ let r = x(t.tokenData);
1073
+ this.context = t.context, this.specializerSpecs = t.specialized || [], this.specialized = new Uint16Array(this.specializerSpecs.length);
1074
+ for (let n = 0; n < this.specializerSpecs.length; n++)
1075
+ this.specialized[n] = this.specializerSpecs[n].term;
1076
+ 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((n) => typeof n == "number" ? new m(r, n) : n), 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]];
1077
+ }
1078
+ createParse(t, e, s) {
1079
+ let i = new K(this, t, e, s);
1080
+ for (let h of this.wrappers)
1081
+ i = h(i, t, e, s);
1082
+ return i;
1083
+ }
1084
+ /**
1085
+ Get a goto table entry @internal
1086
+ */
1087
+ getGoto(t, e, s = !1) {
1088
+ let i = this.goto;
1089
+ if (e >= i[0])
1090
+ return -1;
1091
+ for (let h = i[e + 1]; ; ) {
1092
+ let r = i[h++], n = r & 1, o = i[h++];
1093
+ if (n && s)
1094
+ return o;
1095
+ for (let a = h + (r >> 1); h < a; h++)
1096
+ if (i[h] == t)
1097
+ return o;
1098
+ if (n)
1099
+ return -1;
1100
+ }
1101
+ }
1102
+ /**
1103
+ Check if this state has an action for a given terminal @internal
1104
+ */
1105
+ hasAction(t, e) {
1106
+ let s = this.data;
1107
+ for (let i = 0; i < 2; i++)
1108
+ for (let h = this.stateSlot(
1109
+ t,
1110
+ i ? 2 : 1
1111
+ /* ParseState.Actions */
1112
+ ), r; ; h += 3) {
1113
+ if ((r = s[h]) == 65535)
1114
+ if (s[h + 1] == 1)
1115
+ r = s[h = k(s, h + 2)];
1116
+ else {
1117
+ if (s[h + 1] == 2)
1118
+ return k(s, h + 2);
1119
+ break;
1120
+ }
1121
+ if (r == e || r == 0)
1122
+ return k(s, h + 1);
1123
+ }
1124
+ return 0;
1125
+ }
1126
+ /**
1127
+ @internal
1128
+ */
1129
+ stateSlot(t, e) {
1130
+ return this.states[t * 6 + e];
1131
+ }
1132
+ /**
1133
+ @internal
1134
+ */
1135
+ stateFlag(t, e) {
1136
+ return (this.stateSlot(
1137
+ t,
1138
+ 0
1139
+ /* ParseState.Flags */
1140
+ ) & e) > 0;
1141
+ }
1142
+ /**
1143
+ @internal
1144
+ */
1145
+ validAction(t, e) {
1146
+ return !!this.allActions(t, (s) => s == e ? !0 : null);
1147
+ }
1148
+ /**
1149
+ @internal
1150
+ */
1151
+ allActions(t, e) {
1152
+ let s = this.stateSlot(
1153
+ t,
1154
+ 4
1155
+ /* ParseState.DefaultReduce */
1156
+ ), i = s ? e(s) : void 0;
1157
+ for (let h = this.stateSlot(
1158
+ t,
1159
+ 1
1160
+ /* ParseState.Actions */
1161
+ ); i == null; h += 3) {
1162
+ if (this.data[h] == 65535)
1163
+ if (this.data[h + 1] == 1)
1164
+ h = k(this.data, h + 2);
1165
+ else
1166
+ break;
1167
+ i = e(k(this.data, h + 1));
1168
+ }
1169
+ return i;
1170
+ }
1171
+ /**
1172
+ Get the states that can follow this one through shift actions or
1173
+ goto jumps. @internal
1174
+ */
1175
+ nextStates(t) {
1176
+ let e = [];
1177
+ for (let s = this.stateSlot(
1178
+ t,
1179
+ 1
1180
+ /* ParseState.Actions */
1181
+ ); ; s += 3) {
1182
+ if (this.data[s] == 65535)
1183
+ if (this.data[s + 1] == 1)
1184
+ s = k(this.data, s + 2);
1185
+ else
1186
+ break;
1187
+ if (!(this.data[s + 2] & 1)) {
1188
+ let i = this.data[s + 1];
1189
+ e.some((h, r) => r & 1 && h == i) || e.push(this.data[s], i);
1190
+ }
1191
+ }
1192
+ return e;
1193
+ }
1194
+ /**
1195
+ Configure the parser. Returns a new parser instance that has the
1196
+ given settings modified. Settings not provided in `config` are
1197
+ kept from the original parser.
1198
+ */
1199
+ configure(t) {
1200
+ let e = Object.assign(Object.create(w.prototype), this);
1201
+ if (t.props && (e.nodeSet = this.nodeSet.extend(...t.props)), t.top) {
1202
+ let s = this.topRules[t.top];
1203
+ if (!s)
1204
+ throw new RangeError(`Invalid top rule name ${t.top}`);
1205
+ e.top = s;
1206
+ }
1207
+ return t.tokenizers && (e.tokenizers = this.tokenizers.map((s) => {
1208
+ let i = t.tokenizers.find((h) => h.from == s);
1209
+ return i ? i.to : s;
1210
+ })), t.specializers && (e.specializers = this.specializers.slice(), e.specializerSpecs = this.specializerSpecs.map((s, i) => {
1211
+ let h = t.specializers.find((n) => n.from == s.external);
1212
+ if (!h)
1213
+ return s;
1214
+ let r = Object.assign(Object.assign({}, s), { external: h.to });
1215
+ return e.specializers[i] = B(r), r;
1216
+ })), 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;
1217
+ }
1218
+ /**
1219
+ Tells you whether any [parse wrappers](#lr.ParserConfig.wrap)
1220
+ are registered for this parser.
1221
+ */
1222
+ hasWrappers() {
1223
+ return this.wrappers.length > 0;
1224
+ }
1225
+ /**
1226
+ Returns the name associated with a given term. This will only
1227
+ work for all terms when the parser was generated with the
1228
+ `--names` option. By default, only the names of tagged terms are
1229
+ stored.
1230
+ */
1231
+ getName(t) {
1232
+ return this.termNames ? this.termNames[t] : String(t <= this.maxNode && this.nodeSet.types[t].name || t);
1233
+ }
1234
+ /**
1235
+ The eof term id is always allocated directly after the node
1236
+ types. @internal
1237
+ */
1238
+ get eofTerm() {
1239
+ return this.maxNode + 1;
1240
+ }
1241
+ /**
1242
+ The type of top node produced by the parser.
1243
+ */
1244
+ get topNode() {
1245
+ return this.nodeSet.types[this.top[1]];
1246
+ }
1247
+ /**
1248
+ @internal
1249
+ */
1250
+ dynamicPrecedence(t) {
1251
+ let e = this.dynamicPrecedences;
1252
+ return e == null ? 0 : e[t] || 0;
1253
+ }
1254
+ /**
1255
+ @internal
1256
+ */
1257
+ parseDialect(t) {
1258
+ let e = Object.keys(this.dialects), s = e.map(() => !1);
1259
+ if (t)
1260
+ for (let h of t.split(" ")) {
1261
+ let r = e.indexOf(h);
1262
+ r >= 0 && (s[r] = !0);
1263
+ }
1264
+ let i = null;
1265
+ for (let h = 0; h < e.length; h++)
1266
+ if (!s[h])
1267
+ for (let r = this.dialects[e[h]], n; (n = this.data[r++]) != 65535; )
1268
+ (i || (i = new Uint8Array(this.maxTerm + 1)))[n] = 1;
1269
+ return new Q(t, s, i);
1270
+ }
1271
+ /**
1272
+ Used by the output of the parser generator. Not available to
1273
+ user code. @hide
1274
+ */
1275
+ static deserialize(t) {
1276
+ return new w(t);
1277
+ }
1278
+ }
1279
+ function k(l, t) {
1280
+ return l[t] | l[t + 1] << 16;
1281
+ }
1282
+ function V(l) {
1283
+ let t = null;
1284
+ for (let e of l) {
1285
+ let s = e.p.stoppedAt;
1286
+ (e.pos == e.p.stream.end || s != null && e.pos > s) && e.p.parser.stateFlag(
1287
+ e.state,
1288
+ 2
1289
+ /* StateFlag.Accepting */
1290
+ ) && (!t || t.score < e.score) && (t = e);
1291
+ }
1292
+ return t;
1293
+ }
1294
+ function B(l) {
1295
+ if (l.external) {
1296
+ let t = l.extend ? 1 : 0;
1297
+ return (e, s) => l.external(e, s) << 1 | t;
1298
+ }
1299
+ return l.get;
1300
+ }
1301
+ export {
1302
+ Z as ContextTracker,
1303
+ Y as ExternalTokenizer,
1304
+ U as InputStream,
1305
+ w as LRParser,
1306
+ H as LocalTokenGroup,
1307
+ v as Stack
1308
+ };