@backendrelay/core 1.1.0 → 2.0.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 (598) hide show
  1. package/dist/standalone/index.js +1 -1
  2. package/dist/standalone/index.umd.cjs +1 -1
  3. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.d.ts +20 -0
  4. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
  5. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.js +5 -0
  6. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.js.map +1 -0
  7. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.d.ts +2 -0
  8. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
  9. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.js +88 -0
  10. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.js.map +1 -0
  11. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.d.ts +2 -0
  12. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.d.ts.map +1 -0
  13. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.js +131 -0
  14. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.js.map +1 -0
  15. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.d.ts +2 -0
  16. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.d.ts.map +1 -0
  17. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.js +65 -0
  18. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.js.map +1 -0
  19. package/node_modules/@backendrelay/admin/dist/commonjs/index.d.ts +725 -0
  20. package/node_modules/@backendrelay/admin/dist/commonjs/index.d.ts.map +1 -0
  21. package/node_modules/@backendrelay/admin/dist/commonjs/index.js +1159 -0
  22. package/node_modules/@backendrelay/admin/dist/commonjs/index.js.map +1 -0
  23. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.d.ts +2 -0
  24. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.d.ts.map +1 -0
  25. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.js +91 -0
  26. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.js.map +1 -0
  27. package/node_modules/@backendrelay/admin/dist/commonjs/package.json +3 -0
  28. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.d.ts +17 -0
  29. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.d.ts.map +1 -0
  30. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.js +26 -0
  31. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.js.map +1 -0
  32. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.d.ts +2 -0
  33. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.d.ts.map +1 -0
  34. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.js +50 -0
  35. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.js.map +1 -0
  36. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.d.ts +2 -0
  37. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.d.ts.map +1 -0
  38. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.js +33 -0
  39. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.js.map +1 -0
  40. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.d.ts +39 -0
  41. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.d.ts.map +1 -0
  42. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.js +306 -0
  43. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.js.map +1 -0
  44. package/node_modules/@backendrelay/admin/dist/commonjs/version.d.ts +3 -0
  45. package/node_modules/@backendrelay/admin/dist/commonjs/version.d.ts.map +1 -0
  46. package/node_modules/@backendrelay/admin/dist/commonjs/version.js +5 -0
  47. package/node_modules/@backendrelay/admin/dist/commonjs/version.js.map +1 -0
  48. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.d.ts +20 -0
  49. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.d.ts.map +1 -0
  50. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.js +4 -0
  51. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.js.map +1 -0
  52. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.d.ts +2 -0
  53. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.d.ts.map +1 -0
  54. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.js +86 -0
  55. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.js.map +1 -0
  56. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.d.ts +2 -0
  57. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.d.ts.map +1 -0
  58. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.js +129 -0
  59. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.js.map +1 -0
  60. package/node_modules/@backendrelay/admin/dist/esm/config.test.d.ts +2 -0
  61. package/node_modules/@backendrelay/admin/dist/esm/config.test.d.ts.map +1 -0
  62. package/node_modules/@backendrelay/admin/dist/esm/config.test.js +63 -0
  63. package/node_modules/@backendrelay/admin/dist/esm/config.test.js.map +1 -0
  64. package/node_modules/@backendrelay/admin/dist/esm/index.d.ts +725 -0
  65. package/node_modules/@backendrelay/admin/dist/esm/index.d.ts.map +1 -0
  66. package/node_modules/@backendrelay/admin/dist/esm/index.js +1146 -0
  67. package/node_modules/@backendrelay/admin/dist/esm/index.js.map +1 -0
  68. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.d.ts +2 -0
  69. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.d.ts.map +1 -0
  70. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.js +89 -0
  71. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.js.map +1 -0
  72. package/node_modules/@backendrelay/admin/dist/esm/package.json +3 -0
  73. package/node_modules/@backendrelay/admin/dist/esm/polyfill.d.ts +17 -0
  74. package/node_modules/@backendrelay/admin/dist/esm/polyfill.d.ts.map +1 -0
  75. package/node_modules/@backendrelay/admin/dist/esm/polyfill.js +22 -0
  76. package/node_modules/@backendrelay/admin/dist/esm/polyfill.js.map +1 -0
  77. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.d.ts +2 -0
  78. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.d.ts.map +1 -0
  79. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.js +48 -0
  80. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.js.map +1 -0
  81. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.d.ts +2 -0
  82. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.d.ts.map +1 -0
  83. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.js +31 -0
  84. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.js.map +1 -0
  85. package/node_modules/@backendrelay/admin/dist/esm/subscribe.d.ts +39 -0
  86. package/node_modules/@backendrelay/admin/dist/esm/subscribe.d.ts.map +1 -0
  87. package/node_modules/@backendrelay/admin/dist/esm/subscribe.js +300 -0
  88. package/node_modules/@backendrelay/admin/dist/esm/subscribe.js.map +1 -0
  89. package/node_modules/@backendrelay/admin/dist/esm/version.d.ts +3 -0
  90. package/node_modules/@backendrelay/admin/dist/esm/version.d.ts.map +1 -0
  91. package/{src/version.ts → node_modules/@backendrelay/admin/dist/esm/version.js} +1 -1
  92. package/node_modules/@backendrelay/admin/dist/esm/version.js.map +1 -0
  93. package/node_modules/@backendrelay/admin/package.json +52 -0
  94. package/node_modules/@backendrelay/functions/README.md +131 -0
  95. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.d.ts +3 -0
  96. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
  97. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.js +3 -0
  98. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.js.map +1 -0
  99. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.d.ts +2 -0
  100. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
  101. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.js +51 -0
  102. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.js.map +1 -0
  103. package/node_modules/@backendrelay/functions/dist/commonjs/index.d.ts +230 -0
  104. package/node_modules/@backendrelay/functions/dist/commonjs/index.d.ts.map +1 -0
  105. package/node_modules/@backendrelay/functions/dist/commonjs/index.js +415 -0
  106. package/node_modules/@backendrelay/functions/dist/commonjs/index.js.map +1 -0
  107. package/node_modules/@backendrelay/functions/dist/commonjs/package.json +3 -0
  108. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.d.ts +3 -0
  109. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.d.ts.map +1 -0
  110. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.js +2 -0
  111. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.js.map +1 -0
  112. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.d.ts +2 -0
  113. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.d.ts.map +1 -0
  114. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.js +49 -0
  115. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.js.map +1 -0
  116. package/node_modules/@backendrelay/functions/dist/esm/index.d.ts +230 -0
  117. package/node_modules/@backendrelay/functions/dist/esm/index.d.ts.map +1 -0
  118. package/node_modules/@backendrelay/functions/dist/esm/index.js +403 -0
  119. package/node_modules/@backendrelay/functions/dist/esm/index.js.map +1 -0
  120. package/node_modules/@backendrelay/functions/dist/esm/package.json +3 -0
  121. package/node_modules/@backendrelay/functions/package.json +49 -0
  122. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.d.ts +43 -0
  123. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.d.ts.map +1 -0
  124. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.js +63 -0
  125. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.js.map +1 -0
  126. package/node_modules/@backendrelay/hatchet/dist/commonjs/package.json +3 -0
  127. package/node_modules/@backendrelay/hatchet/dist/esm/index.d.ts +43 -0
  128. package/node_modules/@backendrelay/hatchet/dist/esm/index.d.ts.map +1 -0
  129. package/node_modules/@backendrelay/hatchet/dist/esm/index.js +59 -0
  130. package/node_modules/@backendrelay/hatchet/dist/esm/index.js.map +1 -0
  131. package/node_modules/@backendrelay/hatchet/dist/esm/package.json +3 -0
  132. package/node_modules/@backendrelay/hatchet/package.json +46 -0
  133. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.d.ts +18 -0
  134. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.d.ts.map +1 -0
  135. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.js +77 -0
  136. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.js.map +1 -0
  137. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.d.ts +99 -0
  138. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.d.ts.map +1 -0
  139. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.js +177 -0
  140. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.js.map +1 -0
  141. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.d.ts +7 -0
  142. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.d.ts.map +1 -0
  143. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.js +15 -0
  144. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.js.map +1 -0
  145. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.d.ts +3 -0
  146. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.d.ts.map +1 -0
  147. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.js +46 -0
  148. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.js.map +1 -0
  149. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.d.ts +13 -0
  150. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.d.ts.map +1 -0
  151. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.js +25 -0
  152. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.js.map +1 -0
  153. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.d.ts +285 -0
  154. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.d.ts.map +1 -0
  155. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.js +426 -0
  156. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.js.map +1 -0
  157. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.d.ts +24 -0
  158. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.d.ts.map +1 -0
  159. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.js +108 -0
  160. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.js.map +1 -0
  161. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.d.ts +188 -0
  162. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.d.ts.map +1 -0
  163. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.js +412 -0
  164. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.js.map +1 -0
  165. package/node_modules/@backendrelay/platform/dist/commonjs/api.d.ts +9 -0
  166. package/node_modules/@backendrelay/platform/dist/commonjs/api.d.ts.map +1 -0
  167. package/node_modules/@backendrelay/platform/dist/commonjs/api.js +12 -0
  168. package/node_modules/@backendrelay/platform/dist/commonjs/api.js.map +1 -0
  169. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.d.ts +89 -0
  170. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.d.ts.map +1 -0
  171. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.js +357 -0
  172. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.js.map +1 -0
  173. package/node_modules/@backendrelay/platform/dist/commonjs/backups.d.ts +146 -0
  174. package/node_modules/@backendrelay/platform/dist/commonjs/backups.d.ts.map +1 -0
  175. package/node_modules/@backendrelay/platform/dist/commonjs/backups.js +251 -0
  176. package/node_modules/@backendrelay/platform/dist/commonjs/backups.js.map +1 -0
  177. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.d.ts +2 -0
  178. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.d.ts.map +1 -0
  179. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.js +29 -0
  180. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.js.map +1 -0
  181. package/node_modules/@backendrelay/platform/dist/commonjs/consts.d.ts +11 -0
  182. package/node_modules/@backendrelay/platform/dist/commonjs/consts.d.ts.map +1 -0
  183. package/node_modules/@backendrelay/platform/dist/commonjs/consts.js +17 -0
  184. package/node_modules/@backendrelay/platform/dist/commonjs/consts.js.map +1 -0
  185. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.d.ts +4 -0
  186. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.d.ts.map +1 -0
  187. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.js +26 -0
  188. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.js.map +1 -0
  189. package/node_modules/@backendrelay/platform/dist/commonjs/index.d.ts +19 -0
  190. package/node_modules/@backendrelay/platform/dist/commonjs/index.d.ts.map +1 -0
  191. package/node_modules/@backendrelay/platform/dist/commonjs/index.js +76 -0
  192. package/node_modules/@backendrelay/platform/dist/commonjs/index.js.map +1 -0
  193. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.d.ts +4 -0
  194. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.d.ts.map +1 -0
  195. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.js +52 -0
  196. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.js.map +1 -0
  197. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.d.ts +99 -0
  198. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.d.ts.map +1 -0
  199. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.js +597 -0
  200. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.js.map +1 -0
  201. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.d.ts +98 -0
  202. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.d.ts.map +1 -0
  203. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.js +275 -0
  204. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.js.map +1 -0
  205. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.d.ts +12 -0
  206. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.d.ts.map +1 -0
  207. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.js +26 -0
  208. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.js.map +1 -0
  209. package/node_modules/@backendrelay/platform/dist/commonjs/package.json +3 -0
  210. package/node_modules/@backendrelay/platform/dist/commonjs/perms.d.ts +3 -0
  211. package/node_modules/@backendrelay/platform/dist/commonjs/perms.d.ts.map +1 -0
  212. package/node_modules/@backendrelay/platform/dist/commonjs/perms.js +66 -0
  213. package/node_modules/@backendrelay/platform/dist/commonjs/perms.js.map +1 -0
  214. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.d.ts +13 -0
  215. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.d.ts.map +1 -0
  216. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.js +31 -0
  217. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.js.map +1 -0
  218. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.d.ts +7 -0
  219. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.d.ts.map +1 -0
  220. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.js +46 -0
  221. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.js.map +1 -0
  222. package/node_modules/@backendrelay/platform/dist/commonjs/schema.d.ts +161 -0
  223. package/node_modules/@backendrelay/platform/dist/commonjs/schema.d.ts.map +1 -0
  224. package/node_modules/@backendrelay/platform/dist/commonjs/schema.js +174 -0
  225. package/node_modules/@backendrelay/platform/dist/commonjs/schema.js.map +1 -0
  226. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.d.ts +25 -0
  227. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.d.ts.map +1 -0
  228. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.js +68 -0
  229. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.js.map +1 -0
  230. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.d.ts +17 -0
  231. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.d.ts.map +1 -0
  232. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.js +314 -0
  233. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.js.map +1 -0
  234. package/node_modules/@backendrelay/platform/dist/commonjs/util.d.ts +13 -0
  235. package/node_modules/@backendrelay/platform/dist/commonjs/util.d.ts.map +1 -0
  236. package/node_modules/@backendrelay/platform/dist/commonjs/util.js +55 -0
  237. package/node_modules/@backendrelay/platform/dist/commonjs/util.js.map +1 -0
  238. package/node_modules/@backendrelay/platform/dist/commonjs/version.d.ts +3 -0
  239. package/node_modules/@backendrelay/platform/dist/commonjs/version.d.ts.map +1 -0
  240. package/node_modules/@backendrelay/platform/dist/commonjs/version.js +5 -0
  241. package/node_modules/@backendrelay/platform/dist/commonjs/version.js.map +1 -0
  242. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.d.ts +18 -0
  243. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.d.ts.map +1 -0
  244. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.js +73 -0
  245. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.js.map +1 -0
  246. package/node_modules/@backendrelay/platform/dist/esm/api/apps.d.ts +99 -0
  247. package/node_modules/@backendrelay/platform/dist/esm/api/apps.d.ts.map +1 -0
  248. package/node_modules/@backendrelay/platform/dist/esm/api/apps.js +165 -0
  249. package/node_modules/@backendrelay/platform/dist/esm/api/apps.js.map +1 -0
  250. package/node_modules/@backendrelay/platform/dist/esm/api/auth.d.ts +7 -0
  251. package/node_modules/@backendrelay/platform/dist/esm/api/auth.d.ts.map +1 -0
  252. package/node_modules/@backendrelay/platform/dist/esm/api/auth.js +12 -0
  253. package/node_modules/@backendrelay/platform/dist/esm/api/auth.js.map +1 -0
  254. package/node_modules/@backendrelay/platform/dist/esm/api/http.d.ts +3 -0
  255. package/node_modules/@backendrelay/platform/dist/esm/api/http.d.ts.map +1 -0
  256. package/node_modules/@backendrelay/platform/dist/esm/api/http.js +39 -0
  257. package/node_modules/@backendrelay/platform/dist/esm/api/http.js.map +1 -0
  258. package/node_modules/@backendrelay/platform/dist/esm/api/perms.d.ts +13 -0
  259. package/node_modules/@backendrelay/platform/dist/esm/api/perms.d.ts.map +1 -0
  260. package/node_modules/@backendrelay/platform/dist/esm/api/perms.js +21 -0
  261. package/node_modules/@backendrelay/platform/dist/esm/api/perms.js.map +1 -0
  262. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.d.ts +285 -0
  263. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.d.ts.map +1 -0
  264. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.js +421 -0
  265. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.js.map +1 -0
  266. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.d.ts +24 -0
  267. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.d.ts.map +1 -0
  268. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.js +99 -0
  269. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.js.map +1 -0
  270. package/node_modules/@backendrelay/platform/dist/esm/api/schema.d.ts +188 -0
  271. package/node_modules/@backendrelay/platform/dist/esm/api/schema.d.ts.map +1 -0
  272. package/node_modules/@backendrelay/platform/dist/esm/api/schema.js +393 -0
  273. package/node_modules/@backendrelay/platform/dist/esm/api/schema.js.map +1 -0
  274. package/node_modules/@backendrelay/platform/dist/esm/api.d.ts +9 -0
  275. package/node_modules/@backendrelay/platform/dist/esm/api.d.ts.map +1 -0
  276. package/node_modules/@backendrelay/platform/dist/esm/api.js +4 -0
  277. package/node_modules/@backendrelay/platform/dist/esm/api.js.map +1 -0
  278. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.d.ts +89 -0
  279. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.d.ts.map +1 -0
  280. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.js +354 -0
  281. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.js.map +1 -0
  282. package/node_modules/@backendrelay/platform/dist/esm/backups.d.ts +146 -0
  283. package/node_modules/@backendrelay/platform/dist/esm/backups.d.ts.map +1 -0
  284. package/node_modules/@backendrelay/platform/dist/esm/backups.js +240 -0
  285. package/node_modules/@backendrelay/platform/dist/esm/backups.js.map +1 -0
  286. package/node_modules/@backendrelay/platform/dist/esm/clerk.d.ts +2 -0
  287. package/node_modules/@backendrelay/platform/dist/esm/clerk.d.ts.map +1 -0
  288. package/node_modules/@backendrelay/platform/dist/esm/clerk.js +26 -0
  289. package/node_modules/@backendrelay/platform/dist/esm/clerk.js.map +1 -0
  290. package/node_modules/@backendrelay/platform/dist/esm/consts.d.ts +11 -0
  291. package/node_modules/@backendrelay/platform/dist/esm/consts.d.ts.map +1 -0
  292. package/node_modules/@backendrelay/platform/dist/esm/consts.js +13 -0
  293. package/node_modules/@backendrelay/platform/dist/esm/consts.js.map +1 -0
  294. package/node_modules/@backendrelay/platform/dist/esm/crypto.d.ts +4 -0
  295. package/node_modules/@backendrelay/platform/dist/esm/crypto.d.ts.map +1 -0
  296. package/node_modules/@backendrelay/platform/dist/esm/crypto.js +21 -0
  297. package/node_modules/@backendrelay/platform/dist/esm/crypto.js.map +1 -0
  298. package/node_modules/@backendrelay/platform/dist/esm/index.d.ts +19 -0
  299. package/node_modules/@backendrelay/platform/dist/esm/index.d.ts.map +1 -0
  300. package/node_modules/@backendrelay/platform/dist/esm/index.js +18 -0
  301. package/node_modules/@backendrelay/platform/dist/esm/index.js.map +1 -0
  302. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.d.ts +4 -0
  303. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.d.ts.map +1 -0
  304. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.js +47 -0
  305. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.js.map +1 -0
  306. package/node_modules/@backendrelay/platform/dist/esm/migrations.d.ts +99 -0
  307. package/node_modules/@backendrelay/platform/dist/esm/migrations.d.ts.map +1 -0
  308. package/node_modules/@backendrelay/platform/dist/esm/migrations.js +588 -0
  309. package/node_modules/@backendrelay/platform/dist/esm/migrations.js.map +1 -0
  310. package/node_modules/@backendrelay/platform/dist/esm/oauth.d.ts +98 -0
  311. package/node_modules/@backendrelay/platform/dist/esm/oauth.d.ts.map +1 -0
  312. package/node_modules/@backendrelay/platform/dist/esm/oauth.js +266 -0
  313. package/node_modules/@backendrelay/platform/dist/esm/oauth.js.map +1 -0
  314. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.d.ts +12 -0
  315. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.d.ts.map +1 -0
  316. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.js +22 -0
  317. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.js.map +1 -0
  318. package/node_modules/@backendrelay/platform/dist/esm/package.json +3 -0
  319. package/node_modules/@backendrelay/platform/dist/esm/perms.d.ts +3 -0
  320. package/node_modules/@backendrelay/platform/dist/esm/perms.d.ts.map +1 -0
  321. package/node_modules/@backendrelay/platform/dist/esm/perms.js +62 -0
  322. package/node_modules/@backendrelay/platform/dist/esm/perms.js.map +1 -0
  323. package/node_modules/@backendrelay/platform/dist/esm/privateFields.d.ts +13 -0
  324. package/node_modules/@backendrelay/platform/dist/esm/privateFields.d.ts.map +1 -0
  325. package/node_modules/@backendrelay/platform/dist/esm/privateFields.js +28 -0
  326. package/node_modules/@backendrelay/platform/dist/esm/privateFields.js.map +1 -0
  327. package/node_modules/@backendrelay/platform/dist/esm/relationships.d.ts +7 -0
  328. package/node_modules/@backendrelay/platform/dist/esm/relationships.d.ts.map +1 -0
  329. package/node_modules/@backendrelay/platform/dist/esm/relationships.js +43 -0
  330. package/node_modules/@backendrelay/platform/dist/esm/relationships.js.map +1 -0
  331. package/node_modules/@backendrelay/platform/dist/esm/schema.d.ts +161 -0
  332. package/node_modules/@backendrelay/platform/dist/esm/schema.d.ts.map +1 -0
  333. package/node_modules/@backendrelay/platform/dist/esm/schema.js +158 -0
  334. package/node_modules/@backendrelay/platform/dist/esm/schema.js.map +1 -0
  335. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.d.ts +25 -0
  336. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.d.ts.map +1 -0
  337. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.js +64 -0
  338. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.js.map +1 -0
  339. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.d.ts +17 -0
  340. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.d.ts.map +1 -0
  341. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.js +310 -0
  342. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.js.map +1 -0
  343. package/node_modules/@backendrelay/platform/dist/esm/util.d.ts +13 -0
  344. package/node_modules/@backendrelay/platform/dist/esm/util.d.ts.map +1 -0
  345. package/node_modules/@backendrelay/platform/dist/esm/util.js +46 -0
  346. package/node_modules/@backendrelay/platform/dist/esm/util.js.map +1 -0
  347. package/node_modules/@backendrelay/platform/dist/esm/version.d.ts +3 -0
  348. package/node_modules/@backendrelay/platform/dist/esm/version.d.ts.map +1 -0
  349. package/node_modules/@backendrelay/platform/dist/esm/version.js +3 -0
  350. package/node_modules/@backendrelay/platform/dist/esm/version.js.map +1 -0
  351. package/node_modules/@backendrelay/platform/dist/standalone/index.js +13738 -0
  352. package/node_modules/@backendrelay/platform/dist/standalone/index.umd.cjs +72 -0
  353. package/node_modules/@backendrelay/platform/package.json +51 -0
  354. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.d.ts +67 -0
  355. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.d.ts.map +1 -0
  356. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.js +129 -0
  357. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.js.map +1 -0
  358. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/package.json +3 -0
  359. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.d.ts +67 -0
  360. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.d.ts.map +1 -0
  361. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.js +126 -0
  362. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.js.map +1 -0
  363. package/node_modules/@backendrelay/resumable-stream/dist/esm/package.json +3 -0
  364. package/node_modules/@backendrelay/resumable-stream/dist/standalone/index.js +4354 -0
  365. package/node_modules/@backendrelay/resumable-stream/dist/standalone/index.umd.cjs +6 -0
  366. package/node_modules/@backendrelay/resumable-stream/package.json +47 -0
  367. package/node_modules/@backendrelay/rules/README.md +34 -0
  368. package/node_modules/@backendrelay/rules/dist/commonjs/index.d.ts +117 -0
  369. package/node_modules/@backendrelay/rules/dist/commonjs/index.d.ts.map +1 -0
  370. package/node_modules/@backendrelay/rules/dist/commonjs/index.js +68 -0
  371. package/node_modules/@backendrelay/rules/dist/commonjs/index.js.map +1 -0
  372. package/node_modules/@backendrelay/rules/dist/commonjs/package.json +3 -0
  373. package/node_modules/@backendrelay/rules/dist/esm/index.d.ts +117 -0
  374. package/node_modules/@backendrelay/rules/dist/esm/index.d.ts.map +1 -0
  375. package/node_modules/@backendrelay/rules/dist/esm/index.js +64 -0
  376. package/node_modules/@backendrelay/rules/dist/esm/index.js.map +1 -0
  377. package/node_modules/@backendrelay/rules/dist/esm/package.json +3 -0
  378. package/node_modules/@backendrelay/rules/package.json +46 -0
  379. package/node_modules/@backendrelay/test/README.md +75 -0
  380. package/node_modules/@backendrelay/test/dist/commonjs/index.d.ts +74 -0
  381. package/node_modules/@backendrelay/test/dist/commonjs/index.d.ts.map +1 -0
  382. package/node_modules/@backendrelay/test/dist/commonjs/index.js +197 -0
  383. package/node_modules/@backendrelay/test/dist/commonjs/index.js.map +1 -0
  384. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.d.ts +2 -0
  385. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.d.ts.map +1 -0
  386. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.js +45 -0
  387. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.js.map +1 -0
  388. package/node_modules/@backendrelay/test/dist/commonjs/package.json +3 -0
  389. package/node_modules/@backendrelay/test/dist/esm/index.d.ts +74 -0
  390. package/node_modules/@backendrelay/test/dist/esm/index.d.ts.map +1 -0
  391. package/node_modules/@backendrelay/test/dist/esm/index.js +192 -0
  392. package/node_modules/@backendrelay/test/dist/esm/index.js.map +1 -0
  393. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.d.ts +2 -0
  394. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.d.ts.map +1 -0
  395. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.js +43 -0
  396. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.js.map +1 -0
  397. package/node_modules/@backendrelay/test/dist/esm/package.json +3 -0
  398. package/node_modules/@backendrelay/test/package.json +49 -0
  399. package/node_modules/@backendrelay/version/dist/commonjs/index.d.ts +3 -0
  400. package/node_modules/@backendrelay/version/dist/commonjs/index.d.ts.map +1 -0
  401. package/node_modules/@backendrelay/version/dist/commonjs/index.js +6 -0
  402. package/node_modules/@backendrelay/version/dist/commonjs/index.js.map +1 -0
  403. package/node_modules/@backendrelay/version/dist/commonjs/package.json +3 -0
  404. package/node_modules/@backendrelay/version/dist/commonjs/version.d.ts +3 -0
  405. package/node_modules/@backendrelay/version/dist/commonjs/version.d.ts.map +1 -0
  406. package/node_modules/@backendrelay/version/dist/commonjs/version.js +10 -0
  407. package/node_modules/@backendrelay/version/dist/commonjs/version.js.map +1 -0
  408. package/node_modules/@backendrelay/version/dist/esm/index.d.ts +3 -0
  409. package/node_modules/@backendrelay/version/dist/esm/index.d.ts.map +1 -0
  410. package/node_modules/@backendrelay/version/dist/esm/index.js +3 -0
  411. package/node_modules/@backendrelay/version/dist/esm/index.js.map +1 -0
  412. package/node_modules/@backendrelay/version/dist/esm/package.json +3 -0
  413. package/node_modules/@backendrelay/version/dist/esm/version.d.ts +3 -0
  414. package/node_modules/@backendrelay/version/dist/esm/version.d.ts.map +1 -0
  415. package/node_modules/@backendrelay/version/dist/esm/version.js +7 -0
  416. package/node_modules/@backendrelay/version/dist/esm/version.js.map +1 -0
  417. package/node_modules/@backendrelay/version/dist/standalone/index.js +4 -0
  418. package/node_modules/@backendrelay/version/dist/standalone/index.umd.cjs +1 -0
  419. package/node_modules/@backendrelay/version/package.json +44 -0
  420. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.d.ts +12 -0
  421. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
  422. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.js +5 -0
  423. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.js.map +1 -0
  424. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.d.ts +2 -0
  425. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
  426. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.js +82 -0
  427. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.js.map +1 -0
  428. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.d.ts +607 -0
  429. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.d.ts.map +1 -0
  430. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.js +830 -0
  431. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.js.map +1 -0
  432. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.d.ts +2 -0
  433. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.d.ts.map +1 -0
  434. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.js +139 -0
  435. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.js.map +1 -0
  436. package/node_modules/@backendrelay/webhooks/dist/commonjs/package.json +3 -0
  437. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.d.ts +12 -0
  438. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.d.ts.map +1 -0
  439. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.js +4 -0
  440. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.js.map +1 -0
  441. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.d.ts +2 -0
  442. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.d.ts.map +1 -0
  443. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.js +80 -0
  444. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.js.map +1 -0
  445. package/node_modules/@backendrelay/webhooks/dist/esm/index.d.ts +607 -0
  446. package/node_modules/@backendrelay/webhooks/dist/esm/index.d.ts.map +1 -0
  447. package/node_modules/@backendrelay/webhooks/dist/esm/index.js +825 -0
  448. package/node_modules/@backendrelay/webhooks/dist/esm/index.js.map +1 -0
  449. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.d.ts +2 -0
  450. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.d.ts.map +1 -0
  451. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.js +137 -0
  452. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.js.map +1 -0
  453. package/node_modules/@backendrelay/webhooks/dist/esm/package.json +3 -0
  454. package/node_modules/@backendrelay/webhooks/package.json +46 -0
  455. package/package.json +129 -56
  456. package/subpaths/admin/index.cjs +1 -0
  457. package/subpaths/admin/index.d.ts +1 -0
  458. package/subpaths/admin/index.mjs +3 -0
  459. package/subpaths/functions/index.cjs +1 -0
  460. package/subpaths/functions/index.d.ts +1 -0
  461. package/subpaths/functions/index.mjs +3 -0
  462. package/subpaths/hatchet/index.cjs +1 -0
  463. package/subpaths/hatchet/index.d.ts +1 -0
  464. package/subpaths/hatchet/index.mjs +3 -0
  465. package/subpaths/platform/index.cjs +1 -0
  466. package/subpaths/platform/index.d.ts +1 -0
  467. package/subpaths/platform/index.mjs +3 -0
  468. package/subpaths/resumable-stream/index.cjs +1 -0
  469. package/subpaths/resumable-stream/index.d.ts +1 -0
  470. package/subpaths/resumable-stream/index.mjs +3 -0
  471. package/subpaths/rules/index.cjs +1 -0
  472. package/subpaths/rules/index.d.ts +1 -0
  473. package/subpaths/rules/index.mjs +3 -0
  474. package/subpaths/test/index.cjs +1 -0
  475. package/subpaths/test/index.d.ts +1 -0
  476. package/subpaths/test/index.mjs +3 -0
  477. package/subpaths/version/index.cjs +1 -0
  478. package/subpaths/version/index.d.ts +1 -0
  479. package/subpaths/version/index.mjs +3 -0
  480. package/subpaths/webhooks/index.cjs +1 -0
  481. package/subpaths/webhooks/index.d.ts +1 -0
  482. package/subpaths/webhooks/index.mjs +3 -0
  483. package/.tshy/build.json +0 -8
  484. package/.tshy/commonjs.json +0 -16
  485. package/.tshy/esm.json +0 -15
  486. package/__example__/standalone.esm.html +0 -23
  487. package/__example__/standalone.umd.html +0 -21
  488. package/__tests__/src/Connection.test.ts +0 -292
  489. package/__tests__/src/IndexedDBStorage.test.ts +0 -96
  490. package/__tests__/src/Reactor.test.ts +0 -1179
  491. package/__tests__/src/auth-extra-fields.e2e.test.ts +0 -160
  492. package/__tests__/src/byop.e2e.test.ts +0 -762
  493. package/__tests__/src/config.test.ts +0 -85
  494. package/__tests__/src/cookieSync.e2e.test.ts +0 -163
  495. package/__tests__/src/data/movies/attrs.json +0 -145
  496. package/__tests__/src/data/movies/triples.json +0 -1507
  497. package/__tests__/src/data/zeneca/attrs.json +0 -251
  498. package/__tests__/src/data/zeneca/triples.json +0 -15854
  499. package/__tests__/src/datalog.test.ts +0 -175
  500. package/__tests__/src/devtool.test.ts +0 -23
  501. package/__tests__/src/framework.test.ts +0 -173
  502. package/__tests__/src/infiniteQuery.e2e.test.ts +0 -467
  503. package/__tests__/src/instaml.test.ts +0 -1593
  504. package/__tests__/src/instaql.bench.ts +0 -34
  505. package/__tests__/src/instaql.test.ts +0 -1497
  506. package/__tests__/src/instaqlInference.test.ts +0 -243
  507. package/__tests__/src/presence.test.ts +0 -49
  508. package/__tests__/src/queryValidation.test.ts +0 -1101
  509. package/__tests__/src/schema.test.ts +0 -653
  510. package/__tests__/src/serializeSchema.test.ts +0 -123
  511. package/__tests__/src/simple.e2e.test.ts +0 -133
  512. package/__tests__/src/storage-upload.test.ts +0 -37
  513. package/__tests__/src/store.test.ts +0 -960
  514. package/__tests__/src/syncTable.e2e.test.ts +0 -245
  515. package/__tests__/src/syncTable.test.ts +0 -235
  516. package/__tests__/src/transactionValidation.test.ts +0 -450
  517. package/__tests__/src/typeUtils.ts +0 -39
  518. package/__tests__/src/upstream-improvements.e2e.test.ts +0 -54
  519. package/__tests__/src/utils/MutationStorage.test.ts +0 -77
  520. package/__tests__/src/utils/PersistedObject.test.ts +0 -569
  521. package/__tests__/src/utils/dates.test.ts +0 -111
  522. package/__tests__/src/utils/e2e.ts +0 -100
  523. package/__tests__/src/utils/msw.ts +0 -3
  524. package/__tests__/src/utils/object.test.ts +0 -78
  525. package/__tests__/src/utils/weakHash.test.ts +0 -68
  526. package/__tests__/src/utils/weakHashLegacy.test.ts +0 -22
  527. package/__tests__/src/vite.env.d.ts +0 -1
  528. package/src/BackendRelayError.ts +0 -50
  529. package/src/Connection.ts +0 -361
  530. package/src/InMemoryStorage.ts +0 -34
  531. package/src/IndexedDBStorage.ts +0 -398
  532. package/src/Reactor.js +0 -1541
  533. package/src/StorageAPI.ts +0 -147
  534. package/src/Stream.ts +0 -1252
  535. package/src/SyncTable.ts +0 -750
  536. package/src/WindowNetworkListener.js +0 -19
  537. package/src/__types__/fieldsTypeTest.ts +0 -111
  538. package/src/__types__/typeUtils.ts +0 -39
  539. package/src/__types__/useDatesTypeTest.ts +0 -66
  540. package/src/attrTypes.ts +0 -37
  541. package/src/authAPI.ts +0 -205
  542. package/src/clientTypes.ts +0 -28
  543. package/src/coreTypes.ts +0 -58
  544. package/src/createRouteHandler.ts +0 -68
  545. package/src/datalog.js +0 -116
  546. package/src/devtool.ts +0 -179
  547. package/src/framework.ts +0 -450
  548. package/src/helperTypes.ts +0 -117
  549. package/src/index.ts +0 -1293
  550. package/src/infiniteQuery.ts +0 -599
  551. package/src/instaml.ts +0 -676
  552. package/src/instaql.ts +0 -999
  553. package/src/instatx.ts +0 -265
  554. package/src/model/instaqlResult.js +0 -25
  555. package/src/parseSchemaFromJSON.ts +0 -176
  556. package/src/presence.ts +0 -123
  557. package/src/presenceTypes.ts +0 -19
  558. package/src/queryTypes.ts +0 -749
  559. package/src/queryValidation.ts +0 -598
  560. package/src/reactorAuth.js +0 -236
  561. package/src/reactorEvents.js +0 -414
  562. package/src/reactorMutations.js +0 -354
  563. package/src/reactorRooms.js +0 -297
  564. package/src/reactorStorage.js +0 -180
  565. package/src/reactorSubs.js +0 -275
  566. package/src/reactorTransport.js +0 -391
  567. package/src/reactorTypes.ts +0 -41
  568. package/src/routeHandlerProtocol.ts +0 -25
  569. package/src/rulesTypes.ts +0 -132
  570. package/src/sanityCheckQueries.ts +0 -191
  571. package/src/schema.ts +0 -206
  572. package/src/schemaTypes.ts +0 -664
  573. package/src/store.ts +0 -1165
  574. package/src/transactionValidation.ts +0 -204
  575. package/src/urls.ts +0 -50
  576. package/src/utils/Deferred.ts +0 -20
  577. package/src/utils/MutationStorage.ts +0 -89
  578. package/src/utils/PersistedObject.ts +0 -612
  579. package/src/utils/dates.ts +0 -269
  580. package/src/utils/error.ts +0 -9
  581. package/src/utils/fetch.ts +0 -131
  582. package/src/utils/flags.ts +0 -14
  583. package/src/utils/id.ts +0 -28
  584. package/src/utils/linkIndex.ts +0 -33
  585. package/src/utils/log.ts +0 -23
  586. package/src/utils/object.js +0 -180
  587. package/src/utils/pgtime.ts +0 -199
  588. package/src/utils/pick.js +0 -9
  589. package/src/utils/strings.ts +0 -19
  590. package/src/utils/weakHash.ts +0 -77
  591. package/src/utils/weakHashLegacy.ts +0 -75
  592. package/src/warningToggle.ts +0 -5
  593. package/tsconfig.cjs.dev.json +0 -15
  594. package/tsconfig.dev.json +0 -14
  595. package/tsconfig.json +0 -13
  596. package/tsconfig.test.json +0 -5
  597. package/vite.config.ts +0 -19
  598. package/vitest.config.ts +0 -54
@@ -0,0 +1,72 @@
1
+ (function(w,J){typeof exports=="object"&&typeof module<"u"?J(exports):typeof define=="function"&&define.amd?define(["exports"],J):(w=typeof globalThis<"u"?globalThis:w||self,J(w.instant={}))})(this,(function(w){"use strict";class J extends Error{error;errorDescription;constructor(t){super(t.message);const e=new.target.prototype;Object.setPrototypeOf&&Object.setPrototypeOf(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,J),this.name="BackendRelayOAuthError",this.error=t.error,this.errorDescription=t.errorDescription}get[Symbol.toStringTag](){return"BackendRelayOAuthError"}}const _={Remove:"remove",Replace:"replace",Add:"add"},ns=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),Xe=Symbol.iterator,Z={mutable:"mutable",immutable:"immutable"},gt={};function Be(r,t){return r instanceof Map?r.has(t):Object.prototype.hasOwnProperty.call(r,t)}function os(r,t){if(t in r){let e=Reflect.getPrototypeOf(r);for(;e;){const s=Reflect.getOwnPropertyDescriptor(e,t);if(s)return s;e=Reflect.getPrototypeOf(e)}}}function cs(r){return Object.getPrototypeOf(r)===Set.prototype}function hs(r){return Object.getPrototypeOf(r)===Map.prototype}function G(r){var t;return(t=r.copy)!==null&&t!==void 0?t:r.original}function wt(r){return!!v(r)}function v(r){return typeof r!="object"?null:r?.[ns]}function Tt(r){var t;const e=v(r);return e?(t=e.copy)!==null&&t!==void 0?t:e.original:r}function ge(r,t){if(!r||typeof r!="object")return!1;let e;return Object.getPrototypeOf(r)===Object.prototype||Array.isArray(r)||r instanceof Map||r instanceof Set||!!t?.mark&&((e=t.mark(r,Z))===Z.immutable||typeof e=="function")}function ls(r,t=[]){if(Object.hasOwnProperty.call(r,"key")){const e=r.parent.copy,s=v(de(e,r.key));if(s!==null&&s?.original!==r.original)return null;const i=r.parent.type===3,a=i?Array.from(r.parent.setMap.keys()).indexOf(r.key):r.key;if(!(i&&e.size>a||Be(e,a)))return null;t.push(a)}if(r.parent)return ls(r.parent,t);t.reverse();try{ji(r.copy,t)}catch{return null}return t}function _e(r){return Array.isArray(r)?1:r instanceof Map?2:r instanceof Set?3:0}function de(r,t){return _e(r)===2?r.get(t):r[t]}function At(r,t,e){_e(r)===2?r.set(t,e):r[t]=e}function St(r,t){const e=v(r);return(e?G(e):r)[t]}function we(r,t){return r===t?r!==0||1/r===1/t:r!==r&&t!==t}function Te(r,t){return t?r:[""].concat(r).map(e=>{const s=`${e}`;return s.indexOf("/")===-1&&s.indexOf("~")===-1?s:s.replace(/~/g,"~0").replace(/\//g,"~1")}).join("/")}function ji(r,t){for(let e=0;e<t.length-1;e+=1){const s=t[e];if(r=de(_e(r)===3?Array.from(r):r,s),typeof r!="object")throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}return r}function Ui(r){const t=Object.create(Object.getPrototypeOf(r));return Reflect.ownKeys(r).forEach(e=>{let s=Reflect.getOwnPropertyDescriptor(r,e);if(s.enumerable&&s.configurable&&s.writable){t[e]=r[e];return}s.writable||(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(s={configurable:!0,writable:!0,enumerable:s.enumerable,value:r[e]}),Reflect.defineProperty(t,e,s)}),t}const $i=Object.prototype.propertyIsEnumerable;function qi(r,t){let e;if(Array.isArray(r))return Array.prototype.concat.call(r);if(r instanceof Set){if(!cs(r)){const s=Object.getPrototypeOf(r).constructor;return new s(r.values())}return Set.prototype.difference?Set.prototype.difference.call(r,new Set):new Set(r.values())}else if(r instanceof Map){if(!hs(r)){const s=Object.getPrototypeOf(r).constructor;return new s(r)}return new Map(r)}else if(t?.mark&&(e=t.mark(r,Z),e!==void 0)&&e!==Z.mutable){if(e===Z.immutable)return Ui(r);if(typeof e=="function"){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return e()}throw new Error(`Unsupported mark result: ${e}`)}else if(typeof r=="object"&&Object.getPrototypeOf(r)===Object.prototype){const s={};return Object.keys(r).forEach(i=>{s[i]=r[i]}),Object.getOwnPropertySymbols(r).forEach(i=>{$i.call(r,i)&&(s[i]=r[i])}),s}else throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function K(r){r.copy||(r.copy=qi(r.original,r.options))}function je(r){if(!ge(r))return Tt(r);if(Array.isArray(r))return r.map(je);if(r instanceof Map){const e=Array.from(r.entries()).map(([s,i])=>[s,je(i)]);if(!hs(r)){const s=Object.getPrototypeOf(r).constructor;return new s(e)}return new Map(e)}if(r instanceof Set){const e=Array.from(r).map(je);if(!cs(r)){const s=Object.getPrototypeOf(r).constructor;return new s(e)}return new Set(e)}const t=Object.create(Object.getPrototypeOf(r));for(const e in r)t[e]=je(r[e]);return t}function Ye(r){return wt(r)?je(r):r}function se(r){var t;r.assignedMap=(t=r.assignedMap)!==null&&t!==void 0?t:new Map,r.operated||(r.operated=!0,r.parent&&se(r.parent))}function zi(r,t){const e=_e(r);if(e===0)Reflect.ownKeys(r).forEach(s=>{t(s,r[s],r)});else if(e===1){let s=0;for(const i of r)t(s,i,r),s+=1}else r.forEach((s,i)=>t(i,s,r))}function us(r,t,e){if(wt(r)||!ge(r,e)||t.has(r)||Object.isFrozen(r))return;const s=r instanceof Set,i=s?new Map:void 0;if(t.add(r),zi(r,(a,n)=>{var o;if(wt(n)){const c=v(n);K(c);const h=!((o=c.assignedMap)===null||o===void 0)&&o.size||c.operated?c.copy:c.original;At(s?i:r,a,h)}else us(n,t,e)}),i){const a=r,n=Array.from(a);a.clear(),n.forEach(o=>{a.add(i.has(o)?i.get(o):o)})}}function Vi(r,t){const e=r.type===3?r.setMap:r.copy;r.finalities.revoke.length>1&&r.assignedMap.get(t)&&e&&us(de(e,t),r.finalities.handledSet,r.options)}function It(r){r.type===3&&r.copy&&(r.copy.clear(),r.setMap.forEach(t=>{r.copy.add(Tt(t))}))}function Et(r,t,e,s){if(r.operated&&r.assignedMap&&r.assignedMap.size>0&&!r.finalized){if(e&&s){const a=ls(r);a&&t(r,a,e,s)}r.finalized=!0}}function Ct(r,t,e,s){const i=v(e);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((a,n)=>{var o;const c=r.type===3?r.setMap:r.copy;if(we(de(c,t),e)){let h=i.original;i.copy&&(h=i.copy),It(r),Et(r,s,a,n),r.options.enableAutoFreeze&&(r.options.updatedValues=(o=r.options.updatedValues)!==null&&o!==void 0?o:new WeakMap,r.options.updatedValues.set(h,i.original)),At(c,t,h)}}),r.options.enableAutoFreeze&&i.finalities!==r.finalities&&(r.options.enableAutoFreeze=!1)),ge(e,r.options)&&r.finalities.draft.push(()=>{const a=r.type===3?r.setMap:r.copy;we(de(a,t),e)&&Vi(r,t)})}function Hi(r,t,e,s,i){let{original:a,assignedMap:n,options:o}=r,c=r.copy;c.length<a.length&&([a,c]=[c,a],[e,s]=[s,e]);for(let h=0;h<a.length;h+=1)if(n.get(h.toString())&&c[h]!==a[h]){const l=t.concat([h]),p=Te(l,i);e.push({op:_.Replace,path:p,value:Ye(c[h])}),s.push({op:_.Replace,path:p,value:Ye(a[h])})}for(let h=a.length;h<c.length;h+=1){const l=t.concat([h]),p=Te(l,i);e.push({op:_.Add,path:p,value:Ye(c[h])})}if(a.length<c.length){const{arrayLengthAssignment:h=!0}=o.enablePatches;if(h){const l=t.concat(["length"]),p=Te(l,i);s.push({op:_.Replace,path:p,value:a.length})}else for(let l=c.length;a.length<l;l-=1){const p=t.concat([l-1]),d=Te(p,i);s.push({op:_.Remove,path:d})}}}function Ki({original:r,copy:t,assignedMap:e},s,i,a,n){e.forEach((o,c)=>{const h=de(r,c),l=Ye(de(t,c)),p=o?Be(r,c)?_.Replace:_.Add:_.Remove;if(we(h,l)&&p===_.Replace)return;const d=s.concat(c),f=Te(d,n);i.push(p===_.Remove?{op:p,path:f}:{op:p,path:f,value:l}),a.push(p===_.Add?{op:_.Remove,path:f}:p===_.Remove?{op:_.Add,path:f,value:h}:{op:_.Replace,path:f,value:h})})}function Wi({original:r,copy:t},e,s,i,a){let n=0;r.forEach(o=>{if(!t.has(o)){const c=e.concat([n]),h=Te(c,a);s.push({op:_.Remove,path:h,value:o}),i.unshift({op:_.Add,path:h,value:o})}n+=1}),n=0,t.forEach(o=>{if(!r.has(o)){const c=e.concat([n]),h=Te(c,a);s.push({op:_.Add,path:h,value:o}),i.unshift({op:_.Remove,path:h,value:o})}n+=1})}function Ue(r,t,e,s){const{pathAsArray:i=!0}=r.options.enablePatches;switch(r.type){case 0:case 2:return Ki(r,t,e,s,i);case 1:return Hi(r,t,e,s,i);case 3:return Wi(r,t,e,s,i)}}const Ze=(r,t,e=!1)=>{if(typeof r=="object"&&r!==null&&(!ge(r,t)||e))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},kt={get size(){return G(v(this)).size},has(r){return G(v(this)).has(r)},set(r,t){const e=v(this),s=G(e);return(!s.has(r)||!we(s.get(r),t))&&(K(e),se(e),e.assignedMap.set(r,!0),e.copy.set(r,t),Ct(e,r,t,Ue)),this},delete(r){if(!this.has(r))return!1;const t=v(this);return K(t),se(t),t.original.has(r)?t.assignedMap.set(r,!1):t.assignedMap.delete(r),t.copy.delete(r),!0},clear(){const r=v(this);if(this.size){K(r),se(r),r.assignedMap=new Map;for(const[t]of r.original)r.assignedMap.set(t,!1);r.copy.clear()}},forEach(r,t){const e=v(this);G(e).forEach((s,i)=>{r.call(t,this.get(i),i,this)})},get(r){var t,e;const s=v(this),i=G(s).get(r),a=((e=(t=s.options).mark)===null||e===void 0?void 0:e.call(t,i,Z))===Z.mutable;if(s.options.strict&&Ze(i,s.options,a),a||s.finalized||!ge(i,s.options)||i!==s.original.get(r))return i;const n=gt.createDraft({original:i,parentDraft:s,key:r,finalities:s.finalities,options:s.options});return K(s),s.copy.set(r,n),n},keys(){return G(v(this)).keys()},values(){const r=this.keys();return{[Xe]:()=>this.values(),next:()=>{const t=r.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const r=this.keys();return{[Xe]:()=>this.entries(),next:()=>{const t=r.next();if(t.done)return t;const e=this.get(t.value);return{done:!1,value:[t.value,e]}}}},[Xe](){return this.entries()}},Ji=Reflect.ownKeys(kt),ps=(r,t,{isValuesIterator:e})=>()=>{var s,i;const a=t.next();if(a.done)return a;const n=a.value;let o=r.setMap.get(n);const c=v(o),h=((i=(s=r.options).mark)===null||i===void 0?void 0:i.call(s,o,Z))===Z.mutable;if(r.options.strict&&Ze(n,r.options,h),!h&&!c&&ge(n,r.options)&&!r.finalized&&r.original.has(n)){const l=gt.createDraft({original:n,parentDraft:r,key:n,finalities:r.finalities,options:r.options});r.setMap.set(n,l),o=l}else c&&(o=c.proxy);return{done:!1,value:e?o:[o,o]}},Qe={get size(){return v(this).setMap.size},has(r){const t=v(this);if(t.setMap.has(r))return!0;K(t);const e=v(r);return!!(e&&t.setMap.has(e.original))},add(r){const t=v(this);return this.has(r)||(K(t),se(t),t.assignedMap.set(r,!0),t.setMap.set(r,r),Ct(t,r,r,Ue)),this},delete(r){if(!this.has(r))return!1;const t=v(this);K(t),se(t);const e=v(r);return e&&t.setMap.has(e.original)?(t.assignedMap.set(e.original,!1),t.setMap.delete(e.original)):(!e&&t.setMap.has(r)?t.assignedMap.set(r,!1):t.assignedMap.delete(r),t.setMap.delete(r))},clear(){if(!this.size)return;const r=v(this);K(r),se(r);for(const t of r.original)r.assignedMap.set(t,!1);r.setMap.clear()},values(){const r=v(this);K(r);const t=r.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ps(r,t,{isValuesIterator:!0})}},entries(){const r=v(this);K(r);const t=r.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ps(r,t,{isValuesIterator:!1})}},keys(){return this.values()},[Xe](){return this.values()},forEach(r,t){const e=this.values();let s=e.next();for(;!s.done;)r.call(t,s.value,s.value,this),s=e.next()}};Set.prototype.difference&&Object.assign(Qe,{intersection(r){return Set.prototype.intersection.call(new Set(this.values()),r)},union(r){return Set.prototype.union.call(new Set(this.values()),r)},difference(r){return Set.prototype.difference.call(new Set(this.values()),r)},symmetricDifference(r){return Set.prototype.symmetricDifference.call(new Set(this.values()),r)},isSubsetOf(r){return Set.prototype.isSubsetOf.call(new Set(this.values()),r)},isSupersetOf(r){return Set.prototype.isSupersetOf.call(new Set(this.values()),r)},isDisjointFrom(r){return Set.prototype.isDisjointFrom.call(new Set(this.values()),r)}});const Gi=Reflect.ownKeys(Qe),ds=new WeakSet,fs={get(r,t,e){var s,i;const a=(s=r.copy)===null||s===void 0?void 0:s[t];if(a&&ds.has(a))return a;if(t===ns)return r;let n;if(r.options.mark){const h=t==="size"&&(r.original instanceof Map||r.original instanceof Set)?Reflect.get(r.original,t):Reflect.get(r.original,t,e);if(n=r.options.mark(h,Z),n===Z.mutable)return r.options.strict&&Ze(h,r.options,!0),h}const o=G(r);if(o instanceof Map&&Ji.includes(t)){if(t==="size")return Object.getOwnPropertyDescriptor(kt,"size").get.call(r.proxy);const h=kt[t];if(h)return h.bind(r.proxy)}if(o instanceof Set&&Gi.includes(t)){if(t==="size")return Object.getOwnPropertyDescriptor(Qe,"size").get.call(r.proxy);const h=Qe[t];if(h)return h.bind(r.proxy)}if(!Be(o,t)){const h=os(o,t);return h?"value"in h?h.value:(i=h.get)===null||i===void 0?void 0:i.call(r.proxy):void 0}const c=o[t];if(r.options.strict&&Ze(c,r.options),r.finalized||!ge(c,r.options))return c;if(c===St(r.original,t)){if(K(r),r.copy[t]=ms({original:r.original[t],parentDraft:r,key:r.type===1?Number(t):t,finalities:r.finalities,options:r.options}),typeof n=="function"){const h=v(r.copy[t]);return K(h),se(h),h.copy}return r.copy[t]}return c},set(r,t,e){var s;if(r.type===3||r.type===2)throw new Error("Map/Set draft does not support any property assignment.");let i;if(r.type===1&&t!=="length"&&!(Number.isInteger(i=Number(t))&&i>=0&&(t===0||i===0||String(i)===String(t))))throw new Error("Only supports setting array indices and the 'length' property.");const a=os(G(r),t);if(a?.set)return a.set.call(r.proxy,e),!0;const n=St(G(r),t),o=v(n);return o&&we(o.original,e)?(r.copy[t]=e,r.assignedMap=(s=r.assignedMap)!==null&&s!==void 0?s:new Map,r.assignedMap.set(t,!1),!0):(we(e,n)&&(e!==void 0||Be(r.original,t))||(K(r),se(r),Be(r.original,t)&&we(e,r.original[t])?r.assignedMap.delete(t):r.assignedMap.set(t,!0),r.copy[t]=e,Ct(r,t,e,Ue)),!0)},has(r,t){return t in G(r)},ownKeys(r){return Reflect.ownKeys(G(r))},getOwnPropertyDescriptor(r,t){const e=G(r),s=Reflect.getOwnPropertyDescriptor(e,t);return s&&{writable:!0,configurable:r.type!==1||t!=="length",enumerable:s.enumerable,value:e[t]}},getPrototypeOf(r){return Reflect.getPrototypeOf(r.original)},setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(r,t){var e;return r.type===1?fs.set.call(this,r,t,void 0,r.proxy):(St(r.original,t)!==void 0||t in r.original?(K(r),se(r),r.assignedMap.set(t,!1)):(r.assignedMap=(e=r.assignedMap)!==null&&e!==void 0?e:new Map,r.assignedMap.delete(t)),r.copy&&delete r.copy[t],!0)}};function ms(r){const{original:t,parentDraft:e,key:s,finalities:i,options:a}=r,n=_e(t),o={type:n,finalized:!1,parent:e,original:t,copy:null,proxy:null,finalities:i,options:a,setMap:n===3?new Map(t.entries()):void 0};(s||"key"in r)&&(o.key=s);const{proxy:c,revoke:h}=Proxy.revocable(n===1?Object.assign([],o):o,fs);if(i.revoke.push(h),ds.add(c),o.proxy=c,e){const l=e;l.finalities.draft.push((p,d)=>{var f,P;const k=v(c);let O=l.type===3?l.setMap:l.copy;const T=de(O,s),I=v(T);if(I){let m=I.original;I.operated&&(m=Tt(T)),It(I),Et(I,Ue,p,d),l.options.enableAutoFreeze&&(l.options.updatedValues=(f=l.options.updatedValues)!==null&&f!==void 0?f:new WeakMap,l.options.updatedValues.set(m,I.original)),At(O,s,m)}(P=k.callbacks)===null||P===void 0||P.forEach(m=>{m(p,d)})})}else{const l=v(c);l.finalities.draft.push((p,d)=>{It(l),Et(l,Ue,p,d)})}return c}gt.createDraft=ms,Object.prototype.constructor.toString();function Xi(){const t={__etype:1,__ops:1,create:1,update:1,link:1,unlink:1,delete:1,merge:1,ruleParams:1};return new Set(Object.keys(t))}const Yi=Xi();function et(r,t,e){const s={__etype:r,__ops:e};return new Proxy(s,{get:(i,a)=>{if(a==="__ops")return e;if(a==="__etype")return r;if(Yi.has(a))return(n,o)=>et(r,t,[...e,o?[a,r,t,n,o]:[a,r,t,n]])}})}function Zi(r,t){return`lookup__${r}__${JSON.stringify(t)}`}function Qi(r){return r.startsWith("lookup__")}function ys(r){const[t,e,...s]=r.split("__");return[e,JSON.parse(s.join("__"))]}function er(r){return new Proxy({__etype:r},{get(t,e){if(e==="lookup")return(i,a)=>et(r,ys(Zi(i,a)),[]);if(e==="__etype")return r;const s=e;return Qi(s)?et(r,ys(s),[]):et(r,s,[])}})}function tr(){return new Proxy({},{get(r,t){return er(t)}})}tr();const j=[];for(let r=0;r<256;++r)j.push((r+256).toString(16).slice(1));function sr(r,t=0){return(j[r[t+0]]+j[r[t+1]]+j[r[t+2]]+j[r[t+3]]+"-"+j[r[t+4]]+j[r[t+5]]+"-"+j[r[t+6]]+j[r[t+7]]+"-"+j[r[t+8]]+j[r[t+9]]+"-"+j[r[t+10]]+j[r[t+11]]+j[r[t+12]]+j[r[t+13]]+j[r[t+14]]+j[r[t+15]]).toLowerCase()}let Nt;const ir=new Uint8Array(16);function rr(){if(!Nt){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Nt=crypto.getRandomValues.bind(crypto)}return Nt(ir)}const xs={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ar(r,t,e){if(xs.randomUUID&&!r)return xs.randomUUID();r=r||{};const s=r.random??r.rng?.()??rr();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,sr(s)}function Ps(){return ar()}class z extends Error{hint;traceId;constructor(t,e,s){super(t),this.hint=e,s&&(this.traceId=s);const i=new.target.prototype;Object.setPrototypeOf&&Object.setPrototypeOf(this,i),Error.captureStackTrace&&Error.captureStackTrace(this,z),this.name="BackendRelayError"}get[Symbol.toStringTag](){return"BackendRelayError"}}class ne extends z{body;status;constructor(t){const e=t.body?.message||`API Error (${t.status})`;super(e,t.body.hint,t.body?.traceId||t.body["trace-id"]);const s=new.target.prototype;Object.setPrototypeOf&&Object.setPrototypeOf(this,s),Error.captureStackTrace&&Error.captureStackTrace(this,ne),this.name="BackendRelayAPIError",this.status=t.status,this.body=t.body}get[Symbol.toStringTag](){return"BackendRelayAPIError"}}typeof window<"u"&&typeof window.localStorage<"u"&&(window.localStorage.getItem("devBackend"),window.localStorage.getItem("__instantLogging"),window.localStorage.getItem("__devtoolLocalDash"));const ie="v2.0.0";class X{valueType;required;isIndexed;config;metadata={};constructor(t,e,s,i={indexed:!1,unique:!1}){this.valueType=t,this.required=e,this.isIndexed=s,this.config=i}clientRequired(){return new X(this.valueType,!1,this.isIndexed,this.config)}optional(){return new X(this.valueType,!1,this.isIndexed,this.config)}private(){return new X(this.valueType,this.required,this.isIndexed,{...this.config,private:!0})}unique(){return new X(this.valueType,this.required,this.isIndexed,{...this.config,unique:!0})}indexed(){return new X(this.valueType,this.required,!0,{...this.config,indexed:!0})}}class tt{attrs;links;constructor(t,e){this.attrs=t,this.links=e}asType(){return new tt(this.attrs,this.links)}}class st{entities;links;rooms;constructor(t,e,s){this.entities=t,this.links=e,this.rooms=s}withRoomSchema(){return new st(this.entities,this.links,{})}}class nr extends Error{constructor(t){super(`${t} requires \`apiURI\`. Pass the BackendRelay API origin, for example init({ appId, apiURI: 'https://api.example.com' }). The SDK no longer falls back to backendrelay.com.`),this.name="MissingApiURIError"}}function $e(r,t="BackendRelay"){const e=r?.trim();if(!e)throw new nr(t);let s;try{s=new URL(e)}catch{throw new Error(`${t} \`apiURI\` must be an absolute http(s) URL. Received: ${e}`)}if(s.protocol!=="http:"&&s.protocol!=="https:")throw new Error(`${t} \`apiURI\` must use http:// or https://. Received: ${e}`);return e.replace(/\/+$/,"")}function or(r,t){return r.localeCompare(t)}function cr(){let r=or;if(typeof Intl=="object"&&Intl.hasOwnProperty("Collator"))try{r=Intl.Collator("en-US").compare}catch{}return r}cr();var bs;(function(r){r.InitialSyncBatch="InitialSyncBatch",r.InitialSyncComplete="InitialSyncComplete",r.LoadFromStorage="LoadFromStorage",r.SyncTransaction="SyncTransaction",r.Error="Error"})(bs||(bs={}));function hr(r,t){return new st(ws(r,t),t,void 0)}function lr(r){return new tt(r,{})}function ur(){return new X("string",!0,!1)}function pr(){return new X("number",!0,!1)}function dr(){return new X("boolean",!0,!1)}function fr(){return new X("date",!0,!1)}function gs(){return new X("json",!0,!1)}function mr(){return new X("json",!0,!1)}function yr(r){const t=gs();return t.metadata.vectorDim=r,t}function ws(r,t){const e={fwd:{},rev:{}};for(const i of Object.values(t))e.fwd[i.forward.on]||={},e.rev[i.reverse.on]||={},e.fwd[i.forward.on][i.forward.label]={entityName:i.reverse.on,cardinality:i.forward.has},e.rev[i.reverse.on][i.reverse.label]={entityName:i.forward.on,cardinality:i.reverse.has};return Object.fromEntries(Object.entries(r).map(([i,a])=>[i,new tt(a.attrs,{...e.fwd[i],...e.rev[i]})]))}function xr({entities:r,links:t,rooms:e}){const s=t??{},i=e??{};return new st(ws(r,s),s,i)}const U={graph:hr,schema:xr,entity:lr,string:ur,number:pr,boolean:dr,date:fr,json:gs,any:mr,vector:yr};function Pr(){return globalThis.__backendrelayDbSchemaHashStore=globalThis.__backendrelayDbSchemaHashStore??new WeakMap,globalThis.__backendrelayDbSchemaHashStore}function br(){return globalThis.__backendrelayDbStore=globalThis.__backendrelayDbStore??{},globalThis.__backendrelayDbStore}br(),Pr();function gr(){const r="0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-._~";let t="";for(const e of crypto.getRandomValues(new Uint8Array(64)))t=t+r[e%r.length];return t}function wr(r){return crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(r))}function Tr(r){return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ar(r){return wr(r).then(t=>Tr(btoa(String.fromCharCode(...Array.from(new Uint8Array(t))))))}function Sr(){const r=Math.min(800,Math.floor(window.outerWidth*.8)),t=Math.min(630,Math.floor(window.outerHeight*.5)),e={width:r,height:t,left:Math.round(window.screenX+(window.outerWidth-r)/2),top:Math.round(window.screenY+(window.outerHeight-t)/8)},s={width:e.width,height:e.height,left:e.left,top:e.top,toolbar:0,scrollbars:1,status:1,resizable:1,menuBar:0,rel:"opener"};return Object.keys(s).map(i=>`${i}=${s[i]}`).join(",")}let Ts=null;function Ir({clientId:r,state:t,codeChallenge:e,apiURI:s,redirectUri:i,scopes:a}){const n=new URL(`${s}/platform/oauth/start`);return n.searchParams.set("client_id",r),n.searchParams.set("redirect_uri",i),n.searchParams.set("scope",a.join(" ")),n.searchParams.set("state",t),n.searchParams.set("response_type","code"),n.searchParams.set("code_challenge",e),n.searchParams.set("code_challenge_method","S256"),n.toString()}async function Er({code:r,clientId:t,verifier:e,apiURI:s,redirectUri:i}){const a=await fetch(`${s}/platform/oauth/token`,{method:"POST",headers:{"Content-type":"application/json","BackendRelay-Platform-Version":ie,"BackendRelay-Core-Version":ie},body:JSON.stringify({grant_type:"authorization_code",code:r,redirect_uri:i,client_id:t,code_verifier:e})});if(!a.ok){const o=await a.text();let c;try{const h=JSON.parse(o);c={error:h.error,errorDescription:h.error_description,message:`OAuth error: ${h.error||"server_error"}`}}catch{c={error:"server_error",message:"OAuth error: server_error"}}throw new J(c)}const n=await a.json();return{token:n.access_token,expiresAt:new Date(Date.now()+(n.expires_in-30)*1e3)}}function Cr(){if(typeof window>"u")throw new Error("This function may only be used in a browser context.");const r=new URL(window.location.href).searchParams,t=r.get("state"),e=r.get("error"),s=r.get("error_description"),i=r.get("code");if(!t)throw new Error("Invalid redirect. The state param is missing.");const a=new BroadcastChannel(t);return a.addEventListener("message",n=>{n.data.type==="oauth-redirect-window-done"&&window.close()}),a.postMessage({type:"oauth-redirect",state:t,error:e,errorDescription:s,code:i}),()=>{a.close()}}function kr({clientId:r,apiURI:t,redirectUri:e,scopes:s}){if(typeof window>"u")throw new Error("OAuth flow can only be started on the client.");const i=Ts;i&&i.close();const a=crypto.randomUUID(),n=gr(),o=new BroadcastChannel(a),c=new Promise((l,p)=>{o.addEventListener("message",async d=>{if(d.data.type!=="oauth-redirect")return;const{state:f,error:P,code:k,errorDescription:O}=d.data;if(!(!f||f!==a)){if(k)try{const T=await Er({clientId:r,code:k,verifier:n,apiURI:t,redirectUri:e});l(T)}catch(T){T instanceof J&&p(T),p(new J({error:"server_error",message:"OAuth error exchanging code for token"}))}else p(typeof P=="string"?new J({error:P,errorDescription:O,message:`OAuth error: ${P}`}):new J({error:"server_error",message:"OAuth error: server_error"}));o.postMessage({type:"oauth-redirect-window-done"})}})}),h=window.open("",`backendrelay_oauth_${Math.random()}`.replace(".",""),Sr());return h?(Ts=h,Ar(n).then(l=>{const p=Ir({clientId:r,state:a,codeChallenge:l,apiURI:t,redirectUri:e,scopes:s});h.location.href=p}),c.finally(()=>o.close())):Promise.reject({error:"Could not open Auth window"})}class Nr{redirectUri;clientId;apiURI;constructor(t){this.redirectUri=t.redirectUri,this.apiURI=$e(t.apiURI,"BackendRelay OAuthHandler"),this.clientId=t.clientId}startClientOnlyFlow(t){return kr({clientId:this.clientId,apiURI:this.apiURI,redirectUri:this.redirectUri,scopes:t})}handleClientRedirect(){return Cr()}}function vr(r,t){if(r==null)return{};var e={};for(var s in r)if({}.hasOwnProperty.call(r,s)){if(t.indexOf(s)!==-1)continue;e[s]=r[s]}return e}class fe{line;column;index;constructor(t,e,s){this.line=t,this.column=e,this.index=s}}class it{start;end;filename;identifierName;constructor(t,e){this.start=t,this.end=e}}function Y(r,t){const{line:e,column:s,index:i}=r;return new fe(e,s+t,i+t)}const As="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";var Or={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:As},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:As}};const Ss={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},rt=r=>r.type==="UpdateExpression"?Ss.UpdateExpression[`${r.prefix}`]:Ss[r.type];var Dr={AccessorIsGenerator:({kind:r})=>`A ${r}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:r})=>`Missing initializer in ${r} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:r})=>`\`${r}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:r,exportName:t})=>`A string literal cannot be used as an exported binding without \`from\`.
2
+ - Did you mean \`export { '${r}' as '${t}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:r})=>`'${r==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:r})=>`Unsyntactic ${r==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:r})=>`A string literal cannot be used as an imported binding.
3
+ - Did you mean \`import { "${r}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:r})=>`Expected number in radix ${r}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:r})=>`Escape sequence in keyword ${r}.`,InvalidIdentifier:({identifierName:r})=>`Invalid identifier ${r}.`,InvalidLhs:({ancestor:r})=>`Invalid left-hand side in ${rt(r)}.`,InvalidLhsBinding:({ancestor:r})=>`Binding invalid left-hand side in ${rt(r)}.`,InvalidLhsOptionalChaining:({ancestor:r})=>`Invalid optional chaining in the left-hand side of ${rt(r)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:r})=>`Unexpected character '${r}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:r})=>`Private name #${r} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:r})=>`Label '${r}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:r})=>`This experimental syntax requires enabling the parser plugin: ${r.map(t=>JSON.stringify(t)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:r})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${r.map(t=>JSON.stringify(t)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:r})=>`Duplicate key "${r}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:r})=>`An export name cannot include a lone surrogate, found '\\u${r.toString(16)}'.`,ModuleExportUndefined:({localName:r})=>`Export '${r}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:r})=>`Private names are only allowed in property accesses (\`obj.#${r}\`) or in \`in\` expressions (\`#${r} in obj\`).`,PrivateNameRedeclaration:({identifierName:r})=>`Duplicate private name #${r}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:r})=>`Unexpected keyword '${r}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:r})=>`Unexpected reserved word '${r}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:r,unexpected:t})=>`Unexpected token${t?` '${t}'.`:""}${r?`, expected "${r}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:r,onlyValidPropertyName:t})=>`The only valid meta property for ${r} is ${r}.${t}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:r})=>`Identifier '${r}' has already been declared.`,YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},Lr={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:r})=>`Assigning to '${r}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:r})=>`Binding '${r}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},Mr={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:r})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(r)}\`.`};const Fr=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]);var Rr=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic references are only supported when using the `"proposal": "hack"` version of the pipeline proposal.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:r})=>`Invalid topic token ${r}. In order to use ${r} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${r}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:r})=>`Hack-style pipe body cannot be an unparenthesized ${rt({type:r})}; please wrap it in parentheses.`},{});const Br=["message"];function Is(r,t,e){Object.defineProperty(r,t,{enumerable:!1,configurable:!0,value:e})}function _r({toMessage:r,code:t,reasonCode:e,syntaxPlugin:s}){const i=e==="MissingPlugin"||e==="MissingOneOfPlugins";return function a(n,o){const c=new SyntaxError;return c.code=t,c.reasonCode=e,c.loc=n,c.pos=n.index,c.syntaxPlugin=s,i&&(c.missingPlugin=o.missingPlugin),Is(c,"clone",function(l={}){const{line:p,column:d,index:f}=l.loc??n;return a(new fe(p,d,f),Object.assign({},o,l.details))}),Is(c,"details",o),Object.defineProperty(c,"message",{configurable:!0,get(){const h=`${r(o)} (${n.line}:${n.column})`;return this.message=h,h},set(h){Object.defineProperty(this,"message",{value:h,writable:!0})}}),c}}function re(r,t){if(Array.isArray(r))return s=>re(s,r[0]);const e={};for(const s of Object.keys(r)){const i=r[s],a=typeof i=="string"?{message:()=>i}:typeof i=="function"?{message:i}:i,{message:n}=a,o=vr(a,Br),c=typeof n=="string"?()=>n:n;e[s]=_r(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:s,toMessage:c},t?{syntaxPlugin:t}:{},o))}return e}const u=Object.assign({},re(Or),re(Dr),re(Lr),re(Mr),re`pipelineOperator`(Rr));function jr(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:null,ranges:!1,tokens:!1,createImportExpressions:!0,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function Ur(r){const t=jr();if(r==null)return t;if(r.annexB!=null&&r.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(const e of Object.keys(t))r[e]!=null&&(t[e]=r[e]);if(t.startLine===1)r.startIndex==null&&t.startColumn>0?t.startIndex=t.startColumn:r.startColumn==null&&t.startIndex>0&&(t.startColumn=t.startIndex);else if(r.startColumn==null||r.startIndex==null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");return t}const{defineProperty:$r}=Object,Es=(r,t)=>{r&&$r(r,t,{enumerable:!1,value:r[t]})};function qe(r){return Es(r.loc.start,"index"),Es(r.loc.end,"index"),r}var qr=r=>class extends r{parse(){const e=qe(super.parse());return this.optionFlags&256&&(e.tokens=e.tokens.map(qe)),e}parseRegExpLiteral({pattern:e,flags:s}){let i=null;try{i=new RegExp(e,s)}catch{}const a=this.estreeParseLiteral(i);return a.regex={pattern:e,flags:s},a}parseBigIntLiteral(e){let s;try{s=BigInt(e)}catch{s=null}const i=this.estreeParseLiteral(s);return i.bigint=String(i.value||e),i}parseDecimalLiteral(e){const i=this.estreeParseLiteral(null);return i.decimal=String(i.value||e),i}estreeParseLiteral(e){return this.parseLiteral(e,"Literal")}parseStringLiteral(e){return this.estreeParseLiteral(e)}parseNumericLiteral(e){return this.estreeParseLiteral(e)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(e){return this.estreeParseLiteral(e)}estreeParseChainExpression(e,s){const i=this.startNodeAtNode(e);return i.expression=e,this.finishNodeAt(i,"ChainExpression",s)}directiveToStmt(e){const s=e.value;delete e.value,this.castNodeTo(s,"Literal"),s.raw=s.extra.raw,s.value=s.extra.expressionValue;const i=this.castNodeTo(e,"ExpressionStatement");return i.expression=s,i.directive=s.extra.rawValue,delete s.extra,i}fillOptionalPropertiesForTSESLint(e){}cloneEstreeStringLiteral(e){const{start:s,end:i,loc:a,range:n,raw:o,value:c}=e,h=Object.create(e.constructor.prototype);return h.type="Literal",h.start=s,h.end=i,h.loc=a,h.range=n,h.raw=o,h.value=c,h}initFunction(e,s){super.initFunction(e,s),e.expression=!1}checkDeclaration(e){e!=null&&this.isObjectProperty(e)?this.checkDeclaration(e.value):super.checkDeclaration(e)}getObjectOrClassMethodParams(e){return e.value.params}isValidDirective(e){return e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&!e.expression.extra?.parenthesized}parseBlockBody(e,s,i,a,n){super.parseBlockBody(e,s,i,a,n);const o=e.directives.map(c=>this.directiveToStmt(c));e.body=o.concat(e.body),delete e.directives}parsePrivateName(){const e=super.parsePrivateName();return this.convertPrivateNameToPrivateIdentifier(e)}convertPrivateNameToPrivateIdentifier(e){const s=super.getPrivateNameSV(e);return e=e,delete e.id,e.name=s,this.castNodeTo(e,"PrivateIdentifier")}isPrivateName(e){return e.type==="PrivateIdentifier"}getPrivateNameSV(e){return e.name}parseLiteral(e,s){const i=super.parseLiteral(e,s);return i.raw=i.extra.raw,delete i.extra,i}parseFunctionBody(e,s,i=!1){super.parseFunctionBody(e,s,i),e.expression=e.body.type!=="BlockStatement"}parseMethod(e,s,i,a,n,o,c=!1){let h=this.startNode();h.kind=e.kind,h=super.parseMethod(h,s,i,a,n,o,c),delete h.kind;const{typeParameters:l}=e;l&&(delete e.typeParameters,h.typeParameters=l,this.resetStartLocationFromNode(h,l));const p=this.castNodeTo(h,this.hasPlugin("typescript")&&!h.body?"TSEmptyBodyFunctionExpression":"FunctionExpression");return e.value=p,o==="ClassPrivateMethod"&&(e.computed=!1),this.hasPlugin("typescript")&&e.abstract?(delete e.abstract,this.finishNode(e,"TSAbstractMethodDefinition")):o==="ObjectMethod"?(e.kind==="method"&&(e.kind="init"),e.shorthand=!1,this.finishNode(e,"Property")):this.finishNode(e,"MethodDefinition")}nameIsConstructor(e){return e.type==="Literal"?e.value==="constructor":super.nameIsConstructor(e)}parseClassProperty(...e){const s=super.parseClassProperty(...e);return s.abstract&&this.hasPlugin("typescript")?(delete s.abstract,this.castNodeTo(s,"TSAbstractPropertyDefinition")):this.castNodeTo(s,"PropertyDefinition"),s}parseClassPrivateProperty(...e){const s=super.parseClassPrivateProperty(...e);return s.abstract&&this.hasPlugin("typescript")?this.castNodeTo(s,"TSAbstractPropertyDefinition"):this.castNodeTo(s,"PropertyDefinition"),s.computed=!1,s}parseClassAccessorProperty(e){const s=super.parseClassAccessorProperty(e);return s.abstract&&this.hasPlugin("typescript")?(delete s.abstract,this.castNodeTo(s,"TSAbstractAccessorProperty")):this.castNodeTo(s,"AccessorProperty"),s}parseObjectProperty(e,s,i,a){const n=super.parseObjectProperty(e,s,i,a);return n&&(n.kind="init",this.castNodeTo(n,"Property")),n}finishObjectProperty(e){return e.kind="init",this.finishNode(e,"Property")}isValidLVal(e,s,i){return e==="Property"?"value":super.isValidLVal(e,s,i)}isAssignable(e,s){return e!=null&&this.isObjectProperty(e)?this.isAssignable(e.value,s):super.isAssignable(e,s)}toAssignable(e,s=!1){if(e!=null&&this.isObjectProperty(e)){const{key:i,value:a}=e;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.loc.start),this.toAssignable(a,s)}else super.toAssignable(e,s)}toAssignableObjectExpressionProp(e,s,i){e.type==="Property"&&(e.kind==="get"||e.kind==="set")?this.raise(u.PatternHasAccessor,e.key):e.type==="Property"&&e.method?this.raise(u.PatternHasMethod,e.key):super.toAssignableObjectExpressionProp(e,s,i)}finishCallExpression(e,s){const i=super.finishCallExpression(e,s);return i.callee.type==="Import"?(this.castNodeTo(i,"ImportExpression"),i.source=i.arguments[0],i.options=i.arguments[1]??null,i.attributes=i.arguments[1]??null,delete i.arguments,delete i.callee):i.type==="OptionalCallExpression"?this.castNodeTo(i,"CallExpression"):i.optional=!1,i}toReferencedArguments(e){e.type!=="ImportExpression"&&super.toReferencedArguments(e)}parseExport(e,s){const i=this.state.lastTokStartLoc,a=super.parseExport(e,s);switch(a.type){case"ExportAllDeclaration":a.exported=null;break;case"ExportNamedDeclaration":a.specifiers.length===1&&a.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(a,"ExportAllDeclaration"),a.exported=a.specifiers[0].exported,delete a.specifiers);case"ExportDefaultDeclaration":{const{declaration:n}=a;n?.type==="ClassDeclaration"&&n.decorators?.length>0&&n.start===a.start&&this.resetStartLocation(a,i)}break}return a}stopParseSubscript(e,s){const i=super.stopParseSubscript(e,s);return s.optionalChainMember?this.estreeParseChainExpression(i,e.loc.end):i}parseMember(e,s,i,a,n){const o=super.parseMember(e,s,i,a,n);return o.type==="OptionalMemberExpression"?this.castNodeTo(o,"MemberExpression"):o.optional=!1,o}isOptionalMemberExpression(e){return e.type==="ChainExpression"?e.expression.type==="MemberExpression":super.isOptionalMemberExpression(e)}hasPropertyAsPrivateName(e){return e.type==="ChainExpression"&&(e=e.expression),super.hasPropertyAsPrivateName(e)}isObjectProperty(e){return e.type==="Property"&&e.kind==="init"&&!e.method}isObjectMethod(e){return e.type==="Property"&&(e.method||e.kind==="get"||e.kind==="set")}castNodeTo(e,s){const i=super.castNodeTo(e,s);return this.fillOptionalPropertiesForTSESLint(i),i}cloneIdentifier(e){const s=super.cloneIdentifier(e);return this.fillOptionalPropertiesForTSESLint(s),s}cloneStringLiteral(e){return e.type==="Literal"?this.cloneEstreeStringLiteral(e):super.cloneStringLiteral(e)}finishNodeAt(e,s,i){return qe(super.finishNodeAt(e,s,i))}finishNode(e,s){const i=super.finishNode(e,s);return this.fillOptionalPropertiesForTSESLint(i),i}resetStartLocation(e,s){super.resetStartLocation(e,s),qe(e)}resetEndLocation(e,s=this.state.lastTokEndLoc){super.resetEndLocation(e,s),qe(e)}};class at{constructor(t,e){this.token=t,this.preserveSpace=!!e}token;preserveSpace}const L={brace:new at("{"),j_oTag:new at("<tag"),j_cTag:new at("</tag"),j_expr:new at("<tag>...</tag>",!0)},A=!0,y=!0,vt=!0,ze=!0,me=!0,zr=!0;class Cs{label;keyword;beforeExpr;startsExpr;rightAssociative;isLoop;isAssign;prefix;postfix;binop;constructor(t,e={}){this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.rightAssociative=!!e.rightAssociative,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop!=null?e.binop:null}}const Ot=new Map;function E(r,t={}){t.keyword=r;const e=b(r,t);return Ot.set(r,e),e}function W(r,t){return b(r,{beforeExpr:A,binop:t})}let Ve=-1;const Dt=[],Lt=[],Mt=[],Ft=[],Rt=[],Bt=[];function b(r,t={}){return++Ve,Lt.push(r),Mt.push(t.binop??-1),Ft.push(t.beforeExpr??!1),Rt.push(t.startsExpr??!1),Bt.push(t.prefix??!1),Dt.push(new Cs(r,t)),Ve}function S(r,t={}){return++Ve,Ot.set(r,Ve),Lt.push(r),Mt.push(t.binop??-1),Ft.push(t.beforeExpr??!1),Rt.push(t.startsExpr??!1),Bt.push(t.prefix??!1),Dt.push(new Cs("name",t)),Ve}const Vr={bracketL:b("[",{beforeExpr:A,startsExpr:y}),bracketHashL:b("#[",{beforeExpr:A,startsExpr:y}),bracketBarL:b("[|",{beforeExpr:A,startsExpr:y}),bracketR:b("]"),bracketBarR:b("|]"),braceL:b("{",{beforeExpr:A,startsExpr:y}),braceBarL:b("{|",{beforeExpr:A,startsExpr:y}),braceHashL:b("#{",{beforeExpr:A,startsExpr:y}),braceR:b("}"),braceBarR:b("|}"),parenL:b("(",{beforeExpr:A,startsExpr:y}),parenR:b(")"),comma:b(",",{beforeExpr:A}),semi:b(";",{beforeExpr:A}),colon:b(":",{beforeExpr:A}),doubleColon:b("::",{beforeExpr:A}),dot:b("."),question:b("?",{beforeExpr:A}),questionDot:b("?."),arrow:b("=>",{beforeExpr:A}),template:b("template"),ellipsis:b("...",{beforeExpr:A}),backQuote:b("`",{startsExpr:y}),dollarBraceL:b("${",{beforeExpr:A,startsExpr:y}),templateTail:b("...`",{startsExpr:y}),templateNonTail:b("...${",{beforeExpr:A,startsExpr:y}),at:b("@"),hash:b("#",{startsExpr:y}),interpreterDirective:b("#!..."),eq:b("=",{beforeExpr:A,isAssign:ze}),assign:b("_=",{beforeExpr:A,isAssign:ze}),slashAssign:b("_=",{beforeExpr:A,isAssign:ze}),xorAssign:b("_=",{beforeExpr:A,isAssign:ze}),moduloAssign:b("_=",{beforeExpr:A,isAssign:ze}),incDec:b("++/--",{prefix:me,postfix:zr,startsExpr:y}),bang:b("!",{beforeExpr:A,prefix:me,startsExpr:y}),tilde:b("~",{beforeExpr:A,prefix:me,startsExpr:y}),doubleCaret:b("^^",{startsExpr:y}),doubleAt:b("@@",{startsExpr:y}),pipeline:W("|>",0),nullishCoalescing:W("??",1),logicalOR:W("||",1),logicalAND:W("&&",2),bitwiseOR:W("|",3),bitwiseXOR:W("^",4),bitwiseAND:W("&",5),equality:W("==/!=/===/!==",6),lt:W("</>/<=/>=",7),gt:W("</>/<=/>=",7),relational:W("</>/<=/>=",7),bitShift:W("<</>>/>>>",8),bitShiftL:W("<</>>/>>>",8),bitShiftR:W("<</>>/>>>",8),plusMin:b("+/-",{beforeExpr:A,binop:9,prefix:me,startsExpr:y}),modulo:b("%",{binop:10,startsExpr:y}),star:b("*",{binop:10}),slash:W("/",10),exponent:b("**",{beforeExpr:A,binop:11,rightAssociative:!0}),_in:E("in",{beforeExpr:A,binop:7}),_instanceof:E("instanceof",{beforeExpr:A,binop:7}),_break:E("break"),_case:E("case",{beforeExpr:A}),_catch:E("catch"),_continue:E("continue"),_debugger:E("debugger"),_default:E("default",{beforeExpr:A}),_else:E("else",{beforeExpr:A}),_finally:E("finally"),_function:E("function",{startsExpr:y}),_if:E("if"),_return:E("return",{beforeExpr:A}),_switch:E("switch"),_throw:E("throw",{beforeExpr:A,prefix:me,startsExpr:y}),_try:E("try"),_var:E("var"),_const:E("const"),_with:E("with"),_new:E("new",{beforeExpr:A,startsExpr:y}),_this:E("this",{startsExpr:y}),_super:E("super",{startsExpr:y}),_class:E("class",{startsExpr:y}),_extends:E("extends",{beforeExpr:A}),_export:E("export"),_import:E("import",{startsExpr:y}),_null:E("null",{startsExpr:y}),_true:E("true",{startsExpr:y}),_false:E("false",{startsExpr:y}),_typeof:E("typeof",{beforeExpr:A,prefix:me,startsExpr:y}),_void:E("void",{beforeExpr:A,prefix:me,startsExpr:y}),_delete:E("delete",{beforeExpr:A,prefix:me,startsExpr:y}),_do:E("do",{isLoop:vt,beforeExpr:A}),_for:E("for",{isLoop:vt}),_while:E("while",{isLoop:vt}),_as:S("as",{startsExpr:y}),_assert:S("assert",{startsExpr:y}),_async:S("async",{startsExpr:y}),_await:S("await",{startsExpr:y}),_defer:S("defer",{startsExpr:y}),_from:S("from",{startsExpr:y}),_get:S("get",{startsExpr:y}),_let:S("let",{startsExpr:y}),_meta:S("meta",{startsExpr:y}),_of:S("of",{startsExpr:y}),_sent:S("sent",{startsExpr:y}),_set:S("set",{startsExpr:y}),_source:S("source",{startsExpr:y}),_static:S("static",{startsExpr:y}),_using:S("using",{startsExpr:y}),_yield:S("yield",{startsExpr:y}),_asserts:S("asserts",{startsExpr:y}),_checks:S("checks",{startsExpr:y}),_exports:S("exports",{startsExpr:y}),_global:S("global",{startsExpr:y}),_implements:S("implements",{startsExpr:y}),_intrinsic:S("intrinsic",{startsExpr:y}),_infer:S("infer",{startsExpr:y}),_is:S("is",{startsExpr:y}),_mixins:S("mixins",{startsExpr:y}),_proto:S("proto",{startsExpr:y}),_require:S("require",{startsExpr:y}),_satisfies:S("satisfies",{startsExpr:y}),_keyof:S("keyof",{startsExpr:y}),_readonly:S("readonly",{startsExpr:y}),_unique:S("unique",{startsExpr:y}),_abstract:S("abstract",{startsExpr:y}),_declare:S("declare",{startsExpr:y}),_enum:S("enum",{startsExpr:y}),_module:S("module",{startsExpr:y}),_namespace:S("namespace",{startsExpr:y}),_interface:S("interface",{startsExpr:y}),_type:S("type",{startsExpr:y}),_opaque:S("opaque",{startsExpr:y}),name:b("name",{startsExpr:y}),placeholder:b("%%",{startsExpr:!0}),string:b("string",{startsExpr:y}),num:b("num",{startsExpr:y}),bigint:b("bigint",{startsExpr:y}),decimal:b("decimal",{startsExpr:y}),regexp:b("regexp",{startsExpr:y}),privateName:b("#name",{startsExpr:y}),eof:b("eof"),jsxName:b("jsxName"),jsxText:b("jsxText",{beforeExpr:!0}),jsxTagStart:b("jsxTagStart",{startsExpr:!0}),jsxTagEnd:b("jsxTagEnd")};function C(r){return r>=93&&r<=133}function Hr(r){return r<=92}function Q(r){return r>=58&&r<=133}function ks(r){return r>=58&&r<=137}function Kr(r){return Ft[r]}function He(r){return Rt[r]}function Wr(r){return r>=29&&r<=33}function Ns(r){return r>=129&&r<=131}function Jr(r){return r>=90&&r<=92}function _t(r){return r>=58&&r<=92}function Gr(r){return r>=39&&r<=59}function Xr(r){return r===34}function Yr(r){return Bt[r]}function Zr(r){return r>=121&&r<=123}function Qr(r){return r>=124&&r<=130}function ye(r){return Lt[r]}function nt(r){return Mt[r]}function ea(r){return r===57}function jt(r){return r>=24&&r<=25}function vs(r){return Dt[r]}let Ut="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Os="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・";const ta=new RegExp("["+Ut+"]"),sa=new RegExp("["+Ut+Os+"]");Ut=Os=null;const Ds=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],ia=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239];function $t(r,t){let e=65536;for(let s=0,i=t.length;s<i;s+=2){if(e+=t[s],e>r)return!1;if(e+=t[s+1],e>=r)return!0}return!1}function oe(r){return r<65?r===36:r<=90?!0:r<97?r===95:r<=122?!0:r<=65535?r>=170&&ta.test(String.fromCharCode(r)):$t(r,Ds)}function Ce(r){return r<48?r===36:r<58?!0:r<65?!1:r<=90?!0:r<97?r===95:r<=122?!0:r<=65535?r>=170&&sa.test(String.fromCharCode(r)):$t(r,Ds)||$t(r,ia)}const qt={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},ra=new Set(qt.keyword),aa=new Set(qt.strict),na=new Set(qt.strictBind);function Ls(r,t){return t&&r==="await"||r==="enum"}function Ms(r,t){return Ls(r,t)||aa.has(r)}function Fs(r){return na.has(r)}function Rs(r,t){return Ms(r,t)||Fs(r)}function oa(r){return ra.has(r)}function ca(r,t,e){return r===64&&t===64&&oe(e)}const ha=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function la(r){return ha.has(r)}class zt{flags=0;names=new Map;firstLexicalName="";constructor(t){this.flags=t}}class Vt{parser;scopeStack=[];inModule;undefinedExports=new Map;constructor(t,e){this.parser=t,this.inModule=e}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){const t=this.currentThisScopeFlags();return(t&64)>0&&(t&2)===0}get inStaticBlock(){for(let t=this.scopeStack.length-1;;t--){const{flags:e}=this.scopeStack[t];if(e&128)return!0;if(e&707)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(t){return new zt(t)}enter(t){this.scopeStack.push(this.createScope(t))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(t){return!!(t.flags&130||!this.parser.inModule&&t.flags&1)}declareName(t,e,s){let i=this.currentScope();if(e&8||e&16){this.checkRedeclarationInScope(i,t,e,s);let a=i.names.get(t)||0;e&16?a=a|4:(i.firstLexicalName||(i.firstLexicalName=t),a=a|2),i.names.set(t,a),e&8&&this.maybeExportDefined(i,t)}else if(e&4)for(let a=this.scopeStack.length-1;a>=0&&(i=this.scopeStack[a],this.checkRedeclarationInScope(i,t,e,s),i.names.set(t,(i.names.get(t)||0)|1),this.maybeExportDefined(i,t),!(i.flags&643));--a);this.parser.inModule&&i.flags&1&&this.undefinedExports.delete(t)}maybeExportDefined(t,e){this.parser.inModule&&t.flags&1&&this.undefinedExports.delete(e)}checkRedeclarationInScope(t,e,s,i){this.isRedeclaredInScope(t,e,s)&&this.parser.raise(u.VarRedeclaration,i,{identifierName:e})}isRedeclaredInScope(t,e,s){if(!(s&1))return!1;if(s&8)return t.names.has(e);const i=t.names.get(e);return s&16?(i&2)>0||!this.treatFunctionsAsVarInScope(t)&&(i&1)>0:(i&2)>0&&!(t.flags&8&&t.firstLexicalName===e)||!this.treatFunctionsAsVarInScope(t)&&(i&4)>0}checkLocalExport(t){const{name:e}=t;this.scopeStack[0].names.has(e)||this.undefinedExports.set(e,t.loc.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let t=this.scopeStack.length-1;;t--){const{flags:e}=this.scopeStack[t];if(e&643)return e}}currentThisScopeFlags(){for(let t=this.scopeStack.length-1;;t--){const{flags:e}=this.scopeStack[t];if(e&707&&!(e&4))return e}}}class ua extends zt{declareFunctions=new Set}class pa extends Vt{createScope(t){return new ua(t)}declareName(t,e,s){const i=this.currentScope();if(e&2048){this.checkRedeclarationInScope(i,t,e,s),this.maybeExportDefined(i,t),i.declareFunctions.add(t);return}super.declareName(t,e,s)}isRedeclaredInScope(t,e,s){if(super.isRedeclaredInScope(t,e,s))return!0;if(s&2048&&!t.declareFunctions.has(e)){const i=t.names.get(e);return(i&4)>0||(i&2)>0}return!1}checkLocalExport(t){this.scopeStack[0].declareFunctions.has(t.name)||super.checkLocalExport(t)}}const da=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),g=re`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:r})=>`Cannot overwrite reserved type ${r}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:r,enumName:t})=>`Boolean enum members need to be initialized. Use either \`${r} = true,\` or \`${r} = false,\` in enum \`${t}\`.`,EnumDuplicateMemberName:({memberName:r,enumName:t})=>`Enum member names need to be unique, but the name \`${r}\` has already been used before in enum \`${t}\`.`,EnumInconsistentMemberValues:({enumName:r})=>`Enum \`${r}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:r,enumName:t})=>`Enum type \`${r}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:r})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${r}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:r,memberName:t,explicitType:e})=>`Enum \`${r}\` has type \`${e}\`, so the initializer of \`${t}\` needs to be a ${e} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:r,memberName:t})=>`Symbol enum members cannot be initialized. Use \`${t},\` in enum \`${r}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:r,memberName:t})=>`The enum member initializer for \`${t}\` needs to be a literal (either a boolean, number, or string) in enum \`${r}\`.`,EnumInvalidMemberName:({enumName:r,memberName:t,suggestion:e})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${t}\`, consider using \`${e}\`, in enum \`${r}\`.`,EnumNumberMemberNotInitialized:({enumName:r,memberName:t})=>`Number enum members need to be initialized, e.g. \`${t} = 1\` in enum \`${r}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:r})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${r}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:r})=>`Unexpected reserved type ${r}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:r,suggestion:t})=>`\`declare export ${r}\` is not supported. Use \`${t}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function fa(r){return r.type==="DeclareExportAllDeclaration"||r.type==="DeclareExportDeclaration"&&(!r.declaration||r.declaration.type!=="TypeAlias"&&r.declaration.type!=="InterfaceDeclaration")}function Bs(r){return r.importKind==="type"||r.importKind==="typeof"}const ma={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function ya(r,t){const e=[],s=[];for(let i=0;i<r.length;i++)(t(r[i],i,r)?e:s).push(r[i]);return[e,s]}const xa=/\*?\s*@((?:no)?flow)\b/;var Pa=r=>class extends r{flowPragma=void 0;getScopeHandler(){return pa}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(e,s){e!==134&&e!==13&&e!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(e,s)}addComment(e){if(this.flowPragma===void 0){const s=xa.exec(e.value);if(s)if(s[1]==="flow")this.flowPragma="flow";else if(s[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(e)}flowParseTypeInitialiser(e){const s=this.state.inType;this.state.inType=!0,this.expect(e||14);const i=this.flowParseType();return this.state.inType=s,i}flowParsePredicate(){const e=this.startNode(),s=this.state.startLoc;return this.next(),this.expectContextual(110),this.state.lastTokStartLoc.index>s.index+1&&this.raise(g.UnexpectedSpaceBetweenModuloChecks,s),this.eat(10)?(e.value=super.parseExpression(),this.expect(11),this.finishNode(e,"DeclaredPredicate")):this.finishNode(e,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){const e=this.state.inType;this.state.inType=!0,this.expect(14);let s=null,i=null;return this.match(54)?(this.state.inType=e,i=this.flowParsePredicate()):(s=this.flowParseType(),this.state.inType=e,this.match(54)&&(i=this.flowParsePredicate())),[s,i]}flowParseDeclareClass(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")}flowParseDeclareFunction(e){this.next();const s=e.id=this.parseIdentifier(),i=this.startNode(),a=this.startNode();this.match(47)?i.typeParameters=this.flowParseTypeParameterDeclaration():i.typeParameters=null,this.expect(10);const n=this.flowParseFunctionTypeParams();return i.params=n.params,i.rest=n.rest,i.this=n._this,this.expect(11),[i.returnType,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),a.typeAnnotation=this.finishNode(i,"FunctionTypeAnnotation"),s.typeAnnotation=this.finishNode(a,"TypeAnnotation"),this.resetEndLocation(s),this.semicolon(),this.scope.declareName(e.id.name,2048,e.id.loc.start),this.finishNode(e,"DeclareFunction")}flowParseDeclare(e,s){if(this.match(80))return this.flowParseDeclareClass(e);if(this.match(68))return this.flowParseDeclareFunction(e);if(this.match(74))return this.flowParseDeclareVariable(e);if(this.eatContextual(127))return this.match(16)?this.flowParseDeclareModuleExports(e):(s&&this.raise(g.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(e));if(this.isContextual(130))return this.flowParseDeclareTypeAlias(e);if(this.isContextual(131))return this.flowParseDeclareOpaqueType(e);if(this.isContextual(129))return this.flowParseDeclareInterface(e);if(this.match(82))return this.flowParseDeclareExportDeclaration(e,s);this.unexpected()}flowParseDeclareVariable(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(!0),this.scope.declareName(e.id.name,5,e.id.loc.start),this.semicolon(),this.finishNode(e,"DeclareVariable")}flowParseDeclareModule(e){this.scope.enter(0),this.match(134)?e.id=super.parseExprAtom():e.id=this.parseIdentifier();const s=e.body=this.startNode(),i=s.body=[];for(this.expect(5);!this.match(8);){let o=this.startNode();this.match(83)?(this.next(),!this.isContextual(130)&&!this.match(87)&&this.raise(g.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),super.parseImport(o)):(this.expectContextual(125,g.UnsupportedStatementInDeclareModule),o=this.flowParseDeclare(o,!0)),i.push(o)}this.scope.exit(),this.expect(8),this.finishNode(s,"BlockStatement");let a=null,n=!1;return i.forEach(o=>{fa(o)?(a==="CommonJS"&&this.raise(g.AmbiguousDeclareModuleKind,o),a="ES"):o.type==="DeclareModuleExports"&&(n&&this.raise(g.DuplicateDeclareModuleExports,o),a==="ES"&&this.raise(g.AmbiguousDeclareModuleKind,o),a="CommonJS",n=!0)}),e.kind=a||"CommonJS",this.finishNode(e,"DeclareModule")}flowParseDeclareExportDeclaration(e,s){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?e.declaration=this.flowParseDeclare(this.startNode()):(e.declaration=this.flowParseType(),this.semicolon()),e.default=!0,this.finishNode(e,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!s){const i=this.state.value;throw this.raise(g.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:i,suggestion:ma[i]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131))return e.declaration=this.flowParseDeclare(this.startNode()),e.default=!1,this.finishNode(e,"DeclareExportDeclaration");if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131))return e=this.parseExport(e,null),e.type==="ExportNamedDeclaration"?(e.default=!1,delete e.exportKind,this.castNodeTo(e,"DeclareExportDeclaration")):this.castNodeTo(e,"DeclareExportAllDeclaration");this.unexpected()}flowParseDeclareModuleExports(e){return this.next(),this.expectContextual(111),e.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(e,"DeclareModuleExports")}flowParseDeclareTypeAlias(e){this.next();const s=this.flowParseTypeAlias(e);return this.castNodeTo(s,"DeclareTypeAlias"),s}flowParseDeclareOpaqueType(e){this.next();const s=this.flowParseOpaqueType(e,!0);return this.castNodeTo(s,"DeclareOpaqueType"),s}flowParseDeclareInterface(e){return this.next(),this.flowParseInterfaceish(e,!1),this.finishNode(e,"DeclareInterface")}flowParseInterfaceish(e,s){if(e.id=this.flowParseRestrictedIdentifier(!s,!0),this.scope.declareName(e.id.name,s?17:8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.extends=[],this.eat(81))do e.extends.push(this.flowParseInterfaceExtends());while(!s&&this.eat(12));if(s){if(e.implements=[],e.mixins=[],this.eatContextual(117))do e.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12));if(this.eatContextual(113))do e.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}e.body=this.flowParseObjectType({allowStatic:s,allowExact:!1,allowSpread:!1,allowProto:s,allowInexact:!1})}flowParseInterfaceExtends(){const e=this.startNode();return e.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"InterfaceExtends")}flowParseInterface(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")}checkNotUnderscore(e){e==="_"&&this.raise(g.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(e,s,i){da.has(e)&&this.raise(i?g.AssignReservedType:g.UnexpectedReservedType,s,{reservedType:e})}flowParseRestrictedIdentifier(e,s){return this.checkReservedType(this.state.value,this.state.startLoc,s),this.parseIdentifier(e)}flowParseTypeAlias(e){return e.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(e.id.name,8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(e,"TypeAlias")}flowParseOpaqueType(e,s){return this.expectContextual(130),e.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(e.id.name,8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.supertype=null,this.match(14)&&(e.supertype=this.flowParseTypeInitialiser(14)),e.impltype=null,s||(e.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(e,"OpaqueType")}flowParseTypeParameter(e=!1){const s=this.state.startLoc,i=this.startNode(),a=this.flowParseVariance(),n=this.flowParseTypeAnnotatableIdentifier();return i.name=n.name,i.variance=a,i.bound=n.typeAnnotation,this.match(29)?(this.eat(29),i.default=this.flowParseType()):e&&this.raise(g.MissingTypeParamDefault,s),this.finishNode(i,"TypeParameter")}flowParseTypeParameterDeclaration(){const e=this.state.inType,s=this.startNode();s.params=[],this.state.inType=!0,this.match(47)||this.match(143)?this.next():this.unexpected();let i=!1;do{const a=this.flowParseTypeParameter(i);s.params.push(a),a.default&&(i=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=e,this.finishNode(s,"TypeParameterDeclaration")}flowInTopLevelContext(e){if(this.curContext()!==L.brace){const s=this.state.context;this.state.context=[s[0]];try{return e()}finally{this.state.context=s}}else return e()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===47)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){const e=this.startNode(),s=this.state.inType;return this.state.inType=!0,e.params=[],this.flowInTopLevelContext(()=>{this.expect(47);const i=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)e.params.push(this.flowParseType()),this.match(48)||this.expect(12);this.state.noAnonFunctionType=i}),this.state.inType=s,!this.state.inType&&this.curContext()===L.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(e,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return;const e=this.startNode(),s=this.state.inType;for(e.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)e.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=s,this.finishNode(e,"TypeParameterInstantiation")}flowParseInterfaceType(){const e=this.startNode();if(this.expectContextual(129),e.extends=[],this.eat(81))do e.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return e.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(e,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(135)||this.match(134)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(e,s,i){return e.static=s,this.lookahead().type===14?(e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser()):(e.id=null,e.key=this.flowParseType()),this.expect(3),e.value=this.flowParseTypeInitialiser(),e.variance=i,this.finishNode(e,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(e,s){return e.static=s,e.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(e.method=!0,e.optional=!1,e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start))):(e.method=!1,this.eat(17)&&(e.optional=!0),e.value=this.flowParseTypeInitialiser()),this.finishNode(e,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(e){for(e.params=[],e.rest=null,e.typeParameters=null,e.this=null,this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(e.this=this.flowParseFunctionTypeParam(!0),e.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(e.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(e,s){const i=this.startNode();return e.static=s,e.value=this.flowParseObjectTypeMethodish(i),this.finishNode(e,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:e,allowExact:s,allowSpread:i,allowProto:a,allowInexact:n}){const o=this.state.inType;this.state.inType=!0;const c=this.startNode();c.callProperties=[],c.properties=[],c.indexers=[],c.internalSlots=[];let h,l,p=!1;for(s&&this.match(6)?(this.expect(6),h=9,l=!0):(this.expect(5),h=8,l=!1),c.exact=l;!this.match(h);){let f=!1,P=null,k=null;const O=this.startNode();if(a&&this.isContextual(118)){const I=this.lookahead();I.type!==14&&I.type!==17&&(this.next(),P=this.state.startLoc,e=!1)}if(e&&this.isContextual(106)){const I=this.lookahead();I.type!==14&&I.type!==17&&(this.next(),f=!0)}const T=this.flowParseVariance();if(this.eat(0))P!=null&&this.unexpected(P),this.eat(0)?(T&&this.unexpected(T.loc.start),c.internalSlots.push(this.flowParseObjectTypeInternalSlot(O,f))):c.indexers.push(this.flowParseObjectTypeIndexer(O,f,T));else if(this.match(10)||this.match(47))P!=null&&this.unexpected(P),T&&this.unexpected(T.loc.start),c.callProperties.push(this.flowParseObjectTypeCallProperty(O,f));else{let I="init";if(this.isContextual(99)||this.isContextual(104)){const D=this.lookahead();ks(D.type)&&(I=this.state.value,this.next())}const m=this.flowParseObjectTypeProperty(O,f,P,T,I,i,n??!l);m===null?(p=!0,k=this.state.lastTokStartLoc):c.properties.push(m)}this.flowObjectTypeSemicolon(),k&&!this.match(8)&&!this.match(9)&&this.raise(g.UnexpectedExplicitInexactInObject,k)}this.expect(h),i&&(c.inexact=p);const d=this.finishNode(c,"ObjectTypeAnnotation");return this.state.inType=o,d}flowParseObjectTypeProperty(e,s,i,a,n,o,c){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(o?c||this.raise(g.InexactInsideExact,this.state.lastTokStartLoc):this.raise(g.InexactInsideNonObject,this.state.lastTokStartLoc),a&&this.raise(g.InexactVariance,a),null):(o||this.raise(g.UnexpectedSpreadType,this.state.lastTokStartLoc),i!=null&&this.unexpected(i),a&&this.raise(g.SpreadVariance,a),e.argument=this.flowParseType(),this.finishNode(e,"ObjectTypeSpreadProperty"));{e.key=this.flowParseObjectPropertyKey(),e.static=s,e.proto=i!=null,e.kind=n;let h=!1;return this.match(47)||this.match(10)?(e.method=!0,i!=null&&this.unexpected(i),a&&this.unexpected(a.loc.start),e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start)),(n==="get"||n==="set")&&this.flowCheckGetterSetterParams(e),!o&&e.key.name==="constructor"&&e.value.this&&this.raise(g.ThisParamBannedInConstructor,e.value.this)):(n!=="init"&&this.unexpected(),e.method=!1,this.eat(17)&&(h=!0),e.value=this.flowParseTypeInitialiser(),e.variance=a),e.optional=h,this.finishNode(e,"ObjectTypeProperty")}}flowCheckGetterSetterParams(e){const s=e.kind==="get"?0:1,i=e.value.params.length+(e.value.rest?1:0);e.value.this&&this.raise(e.kind==="get"?g.GetterMayNotHaveThisParam:g.SetterMayNotHaveThisParam,e.value.this),i!==s&&this.raise(e.kind==="get"?u.BadGetterArity:u.BadSetterArity,e),e.kind==="set"&&e.value.rest&&this.raise(u.BadSetterRestParameter,e)}flowObjectTypeSemicolon(){!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)&&this.unexpected()}flowParseQualifiedTypeIdentifier(e,s){e??=this.state.startLoc;let i=s||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){const a=this.startNodeAt(e);a.qualification=i,a.id=this.flowParseRestrictedIdentifier(!0),i=this.finishNode(a,"QualifiedTypeIdentifier")}return i}flowParseGenericType(e,s){const i=this.startNodeAt(e);return i.typeParameters=null,i.id=this.flowParseQualifiedTypeIdentifier(e,s),this.match(47)&&(i.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(i,"GenericTypeAnnotation")}flowParseTypeofType(){const e=this.startNode();return this.expect(87),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")}flowParseTupleType(){const e=this.startNode();for(e.types=[],this.expect(0);this.state.pos<this.length&&!this.match(3)&&(e.types.push(this.flowParseType()),!this.match(3));)this.expect(12);return this.expect(3),this.finishNode(e,"TupleTypeAnnotation")}flowParseFunctionTypeParam(e){let s=null,i=!1,a=null;const n=this.startNode(),o=this.lookahead(),c=this.state.type===78;return o.type===14||o.type===17?(c&&!e&&this.raise(g.ThisParamMustBeFirst,n),s=this.parseIdentifier(c),this.eat(17)&&(i=!0,c&&this.raise(g.ThisParamMayNotBeOptional,n)),a=this.flowParseTypeInitialiser()):a=this.flowParseType(),n.name=s,n.optional=i,n.typeAnnotation=a,this.finishNode(n,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(e){const s=this.startNodeAt(e.loc.start);return s.name=null,s.optional=!1,s.typeAnnotation=e,this.finishNode(s,"FunctionTypeParam")}flowParseFunctionTypeParams(e=[]){let s=null,i=null;for(this.match(78)&&(i=this.flowParseFunctionTypeParam(!0),i.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(s=this.flowParseFunctionTypeParam(!1)),{params:e,rest:s,_this:i}}flowIdentToTypeAnnotation(e,s,i){switch(i.name){case"any":return this.finishNode(s,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(s,"BooleanTypeAnnotation");case"mixed":return this.finishNode(s,"MixedTypeAnnotation");case"empty":return this.finishNode(s,"EmptyTypeAnnotation");case"number":return this.finishNode(s,"NumberTypeAnnotation");case"string":return this.finishNode(s,"StringTypeAnnotation");case"symbol":return this.finishNode(s,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(i.name),this.flowParseGenericType(e,i)}}flowParsePrimaryType(){const e=this.state.startLoc,s=this.startNode();let i,a,n=!1;const o=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 6:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,a=this.flowParseTupleType(),this.state.noAnonFunctionType=o,a;case 47:{const c=this.startNode();return c.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(10),i=this.flowParseFunctionTypeParams(),c.params=i.params,c.rest=i.rest,c.this=i._this,this.expect(11),this.expect(19),c.returnType=this.flowParseType(),this.finishNode(c,"FunctionTypeAnnotation")}case 10:{const c=this.startNode();if(this.next(),!this.match(11)&&!this.match(21))if(C(this.state.type)||this.match(78)){const h=this.lookahead().type;n=h!==17&&h!==14}else n=!0;if(n){if(this.state.noAnonFunctionType=!1,a=this.flowParseType(),this.state.noAnonFunctionType=o,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),a;this.eat(12)}return a?i=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(a)]):i=this.flowParseFunctionTypeParams(),c.params=i.params,c.rest=i.rest,c.this=i._this,this.expect(11),this.expect(19),c.returnType=this.flowParseType(),c.typeParameters=null,this.finishNode(c,"FunctionTypeAnnotation")}case 134:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:return s.value=this.match(85),this.next(),this.finishNode(s,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){if(this.next(),this.match(135))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",s);if(this.match(136))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",s);throw this.raise(g.UnexpectedSubtractionOperand,this.state.startLoc)}this.unexpected();return;case 135:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 136:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:return this.next(),this.finishNode(s,"VoidTypeAnnotation");case 84:return this.next(),this.finishNode(s,"NullLiteralTypeAnnotation");case 78:return this.next(),this.finishNode(s,"ThisTypeAnnotation");case 55:return this.next(),this.finishNode(s,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(_t(this.state.type)){const c=ye(this.state.type);return this.next(),super.createIdentifier(s,c)}else if(C(this.state.type))return this.isContextual(129)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(e,s,this.parseIdentifier())}this.unexpected()}flowParsePostfixType(){const e=this.state.startLoc;let s=this.flowParsePrimaryType(),i=!1;for(;(this.match(0)||this.match(18))&&!this.canInsertSemicolon();){const a=this.startNodeAt(e),n=this.eat(18);i=i||n,this.expect(0),!n&&this.match(3)?(a.elementType=s,this.next(),s=this.finishNode(a,"ArrayTypeAnnotation")):(a.objectType=s,a.indexType=this.flowParseType(),this.expect(3),i?(a.optional=n,s=this.finishNode(a,"OptionalIndexedAccessType")):s=this.finishNode(a,"IndexedAccessType"))}return s}flowParsePrefixType(){const e=this.startNode();return this.eat(17)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){const e=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){const s=this.startNodeAt(e.loc.start);return s.params=[this.reinterpretTypeAsFunctionTypeParam(e)],s.rest=null,s.this=null,s.returnType=this.flowParseType(),s.typeParameters=null,this.finishNode(s,"FunctionTypeAnnotation")}return e}flowParseIntersectionType(){const e=this.startNode();this.eat(45);const s=this.flowParseAnonFunctionWithoutParens();for(e.types=[s];this.eat(45);)e.types.push(this.flowParseAnonFunctionWithoutParens());return e.types.length===1?s:this.finishNode(e,"IntersectionTypeAnnotation")}flowParseUnionType(){const e=this.startNode();this.eat(43);const s=this.flowParseIntersectionType();for(e.types=[s];this.eat(43);)e.types.push(this.flowParseIntersectionType());return e.types.length===1?s:this.finishNode(e,"UnionTypeAnnotation")}flowParseType(){const e=this.state.inType;this.state.inType=!0;const s=this.flowParseUnionType();return this.state.inType=e,s}flowParseTypeOrImplicitInstantiation(){if(this.state.type===132&&this.state.value==="_"){const e=this.state.startLoc,s=this.parseIdentifier();return this.flowParseGenericType(e,s)}else return this.flowParseType()}flowParseTypeAnnotation(){const e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(e){const s=e?this.parseIdentifier():this.flowParseRestrictedIdentifier();return this.match(14)&&(s.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(s)),s}typeCastToParameter(e){return e.expression.typeAnnotation=e.typeAnnotation,this.resetEndLocation(e.expression,e.typeAnnotation.loc.end),e.expression}flowParseVariance(){let e=null;return this.match(53)?(e=this.startNode(),this.state.value==="+"?e.kind="plus":e.kind="minus",this.next(),this.finishNode(e,"Variance")):e}parseFunctionBody(e,s,i=!1){if(s){this.forwardNoArrowParamsConversionAt(e,()=>super.parseFunctionBody(e,!0,i));return}super.parseFunctionBody(e,!1,i)}parseFunctionBodyAndFinish(e,s,i=!1){if(this.match(14)){const a=this.startNode();[a.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),e.returnType=a.typeAnnotation?this.finishNode(a,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(e,s,i)}parseStatementLike(e){if(this.state.strict&&this.isContextual(129)){const i=this.lookahead();if(Q(i.type)){const a=this.startNode();return this.next(),this.flowParseInterface(a)}}else if(this.isContextual(126)){const i=this.startNode();return this.next(),this.flowParseEnumDeclaration(i)}const s=super.parseStatementLike(e);return this.flowPragma===void 0&&!this.isValidDirective(s)&&(this.flowPragma=null),s}parseExpressionStatement(e,s,i){if(s.type==="Identifier"){if(s.name==="declare"){if(this.match(80)||C(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(e)}else if(C(this.state.type)){if(s.name==="interface")return this.flowParseInterface(e);if(s.name==="type")return this.flowParseTypeAlias(e);if(s.name==="opaque")return this.flowParseOpaqueType(e,!1)}}return super.parseExpressionStatement(e,s,i)}shouldParseExportDeclaration(){const{type:e}=this.state;return e===126||Ns(e)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){const{type:e}=this.state;return e===126||Ns(e)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){const e=this.startNode();return this.next(),this.flowParseEnumDeclaration(e)}return super.parseExportDefaultExpression()}parseConditional(e,s,i){if(!this.match(17))return e;if(this.state.maybeInArrowParameters){const d=this.lookaheadCharCode();if(d===44||d===61||d===58||d===41)return this.setOptionalParametersError(i),e}this.expect(17);const a=this.state.clone(),n=this.state.noArrowAt,o=this.startNodeAt(s);let{consequent:c,failed:h}=this.tryParseConditionalConsequent(),[l,p]=this.getArrowLikeExpressions(c);if(h||p.length>0){const d=[...n];if(p.length>0){this.state=a,this.state.noArrowAt=d;for(let f=0;f<p.length;f++)d.push(p[f].start);({consequent:c,failed:h}=this.tryParseConditionalConsequent()),[l,p]=this.getArrowLikeExpressions(c)}h&&l.length>1&&this.raise(g.AmbiguousConditionalArrow,a.startLoc),h&&l.length===1&&(this.state=a,d.push(l[0].start),this.state.noArrowAt=d,{consequent:c,failed:h}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(c,!0),this.state.noArrowAt=n,this.expect(14),o.test=e,o.consequent=c,o.alternate=this.forwardNoArrowParamsConversionAt(o,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(o,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);const e=this.parseMaybeAssignAllowIn(),s=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:e,failed:s}}getArrowLikeExpressions(e,s){const i=[e],a=[];for(;i.length!==0;){const n=i.pop();n.type==="ArrowFunctionExpression"&&n.body.type!=="BlockStatement"?(n.typeParameters||!n.returnType?this.finishArrowValidation(n):a.push(n),i.push(n.body)):n.type==="ConditionalExpression"&&(i.push(n.consequent),i.push(n.alternate))}return s?(a.forEach(n=>this.finishArrowValidation(n)),[a,[]]):ya(a,n=>n.params.every(o=>this.isAssignable(o,!0)))}finishArrowValidation(e){this.toAssignableList(e.params,e.extra?.trailingCommaLoc,!1),this.scope.enter(6),super.checkParams(e,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(e,s){let i;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),i=s(),this.state.noArrowParamsConversionAt.pop()):i=s(),i}parseParenItem(e,s){const i=super.parseParenItem(e,s);if(this.eat(17)&&(i.optional=!0,this.resetEndLocation(e)),this.match(14)){const a=this.startNodeAt(s);return a.expression=i,a.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(a,"TypeCastExpression")}return i}assertModuleNodeAllowed(e){e.type==="ImportDeclaration"&&(e.importKind==="type"||e.importKind==="typeof")||e.type==="ExportNamedDeclaration"&&e.exportKind==="type"||e.type==="ExportAllDeclaration"&&e.exportKind==="type"||super.assertModuleNodeAllowed(e)}parseExportDeclaration(e){if(this.isContextual(130)){e.exportKind="type";const s=this.startNode();return this.next(),this.match(5)?(e.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(e),null):this.flowParseTypeAlias(s)}else if(this.isContextual(131)){e.exportKind="type";const s=this.startNode();return this.next(),this.flowParseOpaqueType(s,!1)}else if(this.isContextual(129)){e.exportKind="type";const s=this.startNode();return this.next(),this.flowParseInterface(s)}else if(this.isContextual(126)){e.exportKind="value";const s=this.startNode();return this.next(),this.flowParseEnumDeclaration(s)}else return super.parseExportDeclaration(e)}eatExportStar(e){return super.eatExportStar(e)?!0:this.isContextual(130)&&this.lookahead().type===55?(e.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(e){const{startLoc:s}=this.state,i=super.maybeParseExportNamespaceSpecifier(e);return i&&e.exportKind==="type"&&this.unexpected(s),i}parseClassId(e,s,i){super.parseClassId(e,s,i),this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(e,s,i){const{startLoc:a}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(e,s))return;s.declare=!0}super.parseClassMember(e,s,i),s.declare&&(s.type!=="ClassProperty"&&s.type!=="ClassPrivateProperty"&&s.type!=="PropertyDefinition"?this.raise(g.DeclareClassElement,a):s.value&&this.raise(g.DeclareClassFieldInitializer,s.value))}isIterator(e){return e==="iterator"||e==="asyncIterator"}readIterator(){const e=super.readWord1(),s="@@"+e;(!this.isIterator(e)||!this.state.inType)&&this.raise(u.InvalidIdentifier,this.state.curPosition(),{identifierName:s}),this.finishToken(132,s)}getTokenFromCode(e){const s=this.input.charCodeAt(this.state.pos+1);e===123&&s===124?this.finishOp(6,2):this.state.inType&&(e===62||e===60)?this.finishOp(e===62?48:47,1):this.state.inType&&e===63?s===46?this.finishOp(18,2):this.finishOp(17,1):ca(e,s,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(e)}isAssignable(e,s){return e.type==="TypeCastExpression"?this.isAssignable(e.expression,s):super.isAssignable(e,s)}toAssignable(e,s=!1){!s&&e.type==="AssignmentExpression"&&e.left.type==="TypeCastExpression"&&(e.left=this.typeCastToParameter(e.left)),super.toAssignable(e,s)}toAssignableList(e,s,i){for(let a=0;a<e.length;a++){const n=e[a];n?.type==="TypeCastExpression"&&(e[a]=this.typeCastToParameter(n))}super.toAssignableList(e,s,i)}toReferencedList(e,s){for(let i=0;i<e.length;i++){const a=e[i];a&&a.type==="TypeCastExpression"&&!a.extra?.parenthesized&&(e.length>1||!s)&&this.raise(g.TypeCastInPattern,a.typeAnnotation)}return e}parseArrayLike(e,s,i,a){const n=super.parseArrayLike(e,s,i,a);return s&&!this.state.maybeInArrowParameters&&this.toReferencedList(n.elements),n}isValidLVal(e,s,i){return e==="TypeCastExpression"||super.isValidLVal(e,s,i)}parseClassProperty(e){return this.match(14)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(e)}parseClassPrivateProperty(e){return this.match(14)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(e){return!this.match(14)&&super.isNonstaticConstructor(e)}pushClassMethod(e,s,i,a,n,o){if(s.variance&&this.unexpected(s.variance.loc.start),delete s.variance,this.match(47)&&(s.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(e,s,i,a,n,o),s.params&&n){const c=s.params;c.length>0&&this.isThisParam(c[0])&&this.raise(g.ThisParamBannedInConstructor,s)}else if(s.type==="MethodDefinition"&&n&&s.value.params){const c=s.value.params;c.length>0&&this.isThisParam(c[0])&&this.raise(g.ThisParamBannedInConstructor,s)}}pushClassPrivateMethod(e,s,i,a){s.variance&&this.unexpected(s.variance.loc.start),delete s.variance,this.match(47)&&(s.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(e,s,i,a)}parseClassSuper(e){if(super.parseClassSuper(e),e.superClass&&(this.match(47)||this.match(51))&&(e.superTypeArguments=this.flowParseTypeParameterInstantiationInExpression()),this.isContextual(113)){this.next();const s=e.implements=[];do{const i=this.startNode();i.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?i.typeParameters=this.flowParseTypeParameterInstantiation():i.typeParameters=null,s.push(this.finishNode(i,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(e){super.checkGetterSetterParams(e);const s=this.getObjectOrClassMethodParams(e);if(s.length>0){const i=s[0];this.isThisParam(i)&&e.kind==="get"?this.raise(g.GetterMayNotHaveThisParam,i):this.isThisParam(i)&&this.raise(g.SetterMayNotHaveThisParam,i)}}parsePropertyNamePrefixOperator(e){e.variance=this.flowParseVariance()}parseObjPropValue(e,s,i,a,n,o,c){e.variance&&this.unexpected(e.variance.loc.start),delete e.variance;let h;this.match(47)&&!o&&(h=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());const l=super.parseObjPropValue(e,s,i,a,n,o,c);return h&&((l.value||l).typeParameters=h),l}parseFunctionParamType(e){return this.eat(17)&&(e.type!=="Identifier"&&this.raise(g.PatternIsOptional,e),this.isThisParam(e)&&this.raise(g.ThisParamMayNotBeOptional,e),e.optional=!0),this.match(14)?e.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(e)&&this.raise(g.ThisParamAnnotationRequired,e),this.match(29)&&this.isThisParam(e)&&this.raise(g.ThisParamNoDefault,e),this.resetEndLocation(e),e}parseMaybeDefault(e,s){const i=super.parseMaybeDefault(e,s);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(g.TypeBeforeInitializer,i.typeAnnotation),i}checkImportReflection(e){super.checkImportReflection(e),e.module&&e.importKind!=="value"&&this.raise(g.ImportReflectionHasImportType,e.specifiers[0].loc.start)}parseImportSpecifierLocal(e,s,i){s.local=Bs(e)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),e.specifiers.push(this.finishImportSpecifier(s,i))}isPotentialImportPhase(e){if(super.isPotentialImportPhase(e))return!0;if(this.isContextual(130)){if(!e)return!0;const s=this.lookaheadCharCode();return s===123||s===42}return!e&&this.isContextual(87)}applyImportPhase(e,s,i,a){if(super.applyImportPhase(e,s,i,a),s){if(!i&&this.match(65))return;e.exportKind=i==="type"?i:"value"}else i==="type"&&this.match(55)&&this.unexpected(),e.importKind=i==="type"||i==="typeof"?i:"value"}parseImportSpecifier(e,s,i,a,n){const o=e.imported;let c=null;o.type==="Identifier"&&(o.name==="type"?c="type":o.name==="typeof"&&(c="typeof"));let h=!1;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){const p=this.parseIdentifier(!0);c!==null&&!Q(this.state.type)?(e.imported=p,e.importKind=c,e.local=this.cloneIdentifier(p)):(e.imported=o,e.importKind=null,e.local=this.parseIdentifier())}else{if(c!==null&&Q(this.state.type))e.imported=this.parseIdentifier(!0),e.importKind=c;else{if(s)throw this.raise(u.ImportBindingIsString,e,{importName:o.value});e.imported=o,e.importKind=null}this.eatContextual(93)?e.local=this.parseIdentifier():(h=!0,e.local=this.cloneIdentifier(e.imported))}const l=Bs(e);return i&&l&&this.raise(g.ImportTypeShorthandOnlyInPureImport,e),(i||l)&&this.checkReservedType(e.local.name,e.local.loc.start,!0),h&&!i&&!l&&this.checkReservedWord(e.local.name,e.loc.start,!0,!0),this.finishImportSpecifier(e,"ImportSpecifier")}parseBindingAtom(){return this.state.type===78?this.parseIdentifier(!0):super.parseBindingAtom()}parseFunctionParams(e,s){const i=e.kind;i!=="get"&&i!=="set"&&this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(e,s)}parseVarId(e,s){super.parseVarId(e,s),this.match(14)&&(e.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(e.id))}parseAsyncArrowFromCallExpression(e,s){if(this.match(14)){const i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,e.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=i}return super.parseAsyncArrowFromCallExpression(e,s)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(e,s){let i=null,a;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(i=this.state.clone(),a=this.tryParse(()=>super.parseMaybeAssign(e,s),i),!a.error)return a.node;const{context:n}=this.state,o=n[n.length-1];(o===L.j_oTag||o===L.j_expr)&&n.pop()}if(a?.error||this.match(47)){i=i||this.state.clone();let n;const o=this.tryParse(h=>{n=this.flowParseTypeParameterDeclaration();const l=this.forwardNoArrowParamsConversionAt(n,()=>{const d=super.parseMaybeAssign(e,s);return this.resetStartLocationFromNode(d,n),d});l.extra?.parenthesized&&h();const p=this.maybeUnwrapTypeCastExpression(l);return p.type!=="ArrowFunctionExpression"&&h(),p.typeParameters=n,this.resetStartLocationFromNode(p,n),l},i);let c=null;if(o.node&&this.maybeUnwrapTypeCastExpression(o.node).type==="ArrowFunctionExpression"){if(!o.error&&!o.aborted)return o.node.async&&this.raise(g.UnexpectedTypeParameterBeforeAsyncArrowFunction,n),o.node;c=o.node}if(a?.node)return this.state=a.failState,a.node;if(c)return this.state=o.failState,c;throw a?.thrown?a.error:o.thrown?o.error:this.raise(g.UnexpectedTokenAfterTypeParameter,n)}return super.parseMaybeAssign(e,s)}parseArrow(e){if(this.match(14)){const s=this.tryParse(()=>{const i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;const a=this.startNode();return[a.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=i,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),a});if(s.thrown)return null;s.error&&(this.state=s.failState),e.returnType=s.node.typeAnnotation?this.finishNode(s.node,"TypeAnnotation"):null}return super.parseArrow(e)}shouldParseArrow(e){return this.match(14)||super.shouldParseArrow(e)}setArrowFunctionParameters(e,s){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start))?e.params=s:super.setArrowFunctionParameters(e,s)}checkParams(e,s,i,a=!0){if(!(i&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start)))){for(let n=0;n<e.params.length;n++)this.isThisParam(e.params[n])&&n>0&&this.raise(g.ThisParamMustBeFirst,e.params[n]);super.checkParams(e,s,i,a)}}parseParenAndDistinguishExpression(e){return super.parseParenAndDistinguishExpression(e&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(e,s,i){if(e.type==="Identifier"&&e.name==="async"&&this.state.noArrowAt.includes(s.index)){this.next();const a=this.startNodeAt(s);a.callee=e,a.arguments=super.parseCallExpressionArguments(11),e=this.finishNode(a,"CallExpression")}else if(e.type==="Identifier"&&e.name==="async"&&this.match(47)){const a=this.state.clone(),n=this.tryParse(c=>this.parseAsyncArrowWithTypeParameters(s)||c(),a);if(!n.error&&!n.aborted)return n.node;const o=this.tryParse(()=>super.parseSubscripts(e,s,i),a);if(o.node&&!o.error)return o.node;if(n.node)return this.state=n.failState,n.node;if(o.node)return this.state=o.failState,o.node;throw n.error||o.error}return super.parseSubscripts(e,s,i)}parseSubscript(e,s,i,a){if(this.match(18)&&this.isLookaheadToken_lt()){if(a.optionalChainMember=!0,i)return a.stop=!0,e;this.next();const n=this.startNodeAt(s);return n.callee=e,n.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),n.arguments=this.parseCallExpressionArguments(11),n.optional=!0,this.finishCallExpression(n,!0)}else if(!i&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){const n=this.startNodeAt(s);n.callee=e;const o=this.tryParse(()=>(n.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),n.arguments=super.parseCallExpressionArguments(11),a.optionalChainMember&&(n.optional=!1),this.finishCallExpression(n,a.optionalChainMember)));if(o.node)return o.error&&(this.state=o.failState),o.node}return super.parseSubscript(e,s,i,a)}parseNewCallee(e){super.parseNewCallee(e);let s=null;this.shouldParseTypes()&&this.match(47)&&(s=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),e.typeArguments=s}parseAsyncArrowWithTypeParameters(e){const s=this.startNodeAt(e);if(this.parseFunctionParams(s,!1),!!this.parseArrow(s))return super.parseArrowExpression(s,void 0,!0)}readToken_mult_modulo(e){const s=this.input.charCodeAt(this.state.pos+1);if(e===42&&s===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(e)}readToken_pipe_amp(e){const s=this.input.charCodeAt(this.state.pos+1);if(e===124&&s===125){this.finishOp(9,2);return}super.readToken_pipe_amp(e)}parseTopLevel(e,s){const i=super.parseTopLevel(e,s);return this.state.hasFlowComment&&this.raise(g.UnterminatedFlowComment,this.state.curPosition()),i}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(g.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();const e=this.skipFlowComment();e&&(this.state.pos+=e,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){const{pos:e}=this.state;let s=2;for(;[32,9].includes(this.input.charCodeAt(e+s));)s++;const i=this.input.charCodeAt(s+e),a=this.input.charCodeAt(s+e+1);return i===58&&a===58?s+2:this.input.slice(s+e,s+e+12)==="flow-include"?s+12:i===58&&a!==58?s:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(u.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(e,{enumName:s,memberName:i}){this.raise(g.EnumBooleanMemberNotInitialized,e,{memberName:i,enumName:s})}flowEnumErrorInvalidMemberInitializer(e,s){return this.raise(s.explicitType?s.explicitType==="symbol"?g.EnumInvalidMemberInitializerSymbolType:g.EnumInvalidMemberInitializerPrimaryType:g.EnumInvalidMemberInitializerUnknownType,e,s)}flowEnumErrorNumberMemberNotInitialized(e,s){this.raise(g.EnumNumberMemberNotInitialized,e,s)}flowEnumErrorStringMemberInconsistentlyInitialized(e,s){this.raise(g.EnumStringMemberInconsistentlyInitialized,e,s)}flowEnumMemberInit(){const e=this.state.startLoc,s=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{const i=this.parseNumericLiteral(this.state.value);return s()?{type:"number",loc:i.loc.start,value:i}:{type:"invalid",loc:e}}case 134:{const i=this.parseStringLiteral(this.state.value);return s()?{type:"string",loc:i.loc.start,value:i}:{type:"invalid",loc:e}}case 85:case 86:{const i=this.parseBooleanLiteral(this.match(85));return s()?{type:"boolean",loc:i.loc.start,value:i}:{type:"invalid",loc:e}}default:return{type:"invalid",loc:e}}}flowEnumMemberRaw(){const e=this.state.startLoc,s=this.parseIdentifier(!0),i=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:e};return{id:s,init:i}}flowEnumCheckExplicitTypeMismatch(e,s,i){const{explicitType:a}=s;a!==null&&a!==i&&this.flowEnumErrorInvalidMemberInitializer(e,s)}flowEnumMembers({enumName:e,explicitType:s}){const i=new Set,a={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]};let n=!1;for(;!this.match(8);){if(this.eat(21)){n=!0;break}const o=this.startNode(),{id:c,init:h}=this.flowEnumMemberRaw(),l=c.name;if(l==="")continue;/^[a-z]/.test(l)&&this.raise(g.EnumInvalidMemberName,c,{memberName:l,suggestion:l[0].toUpperCase()+l.slice(1),enumName:e}),i.has(l)&&this.raise(g.EnumDuplicateMemberName,c,{memberName:l,enumName:e}),i.add(l);const p={enumName:e,explicitType:s,memberName:l};switch(o.id=c,h.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(h.loc,p,"boolean"),o.init=h.value,a.booleanMembers.push(this.finishNode(o,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(h.loc,p,"number"),o.init=h.value,a.numberMembers.push(this.finishNode(o,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(h.loc,p,"string"),o.init=h.value,a.stringMembers.push(this.finishNode(o,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(h.loc,p);case"none":switch(s){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(h.loc,p);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(h.loc,p);break;default:a.defaultedMembers.push(this.finishNode(o,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:a,hasUnknownMembers:n}}flowEnumStringMembers(e,s,{enumName:i}){if(e.length===0)return s;if(s.length===0)return e;if(s.length>e.length){for(const a of e)this.flowEnumErrorStringMemberInconsistentlyInitialized(a,{enumName:i});return s}else{for(const a of s)this.flowEnumErrorStringMemberInconsistentlyInitialized(a,{enumName:i});return e}}flowEnumParseExplicitType({enumName:e}){if(!this.eatContextual(102))return null;if(!C(this.state.type))throw this.raise(g.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:e});const{value:s}=this.state;return this.next(),s!=="boolean"&&s!=="number"&&s!=="string"&&s!=="symbol"&&this.raise(g.EnumInvalidExplicitType,this.state.startLoc,{enumName:e,invalidEnumType:s}),s}flowEnumBody(e,s){const i=s.name,a=s.loc.start,n=this.flowEnumParseExplicitType({enumName:i});this.expect(5);const{members:o,hasUnknownMembers:c}=this.flowEnumMembers({enumName:i,explicitType:n});switch(e.hasUnknownMembers=c,n){case"boolean":return e.explicitType=!0,e.members=o.booleanMembers,this.expect(8),this.finishNode(e,"EnumBooleanBody");case"number":return e.explicitType=!0,e.members=o.numberMembers,this.expect(8),this.finishNode(e,"EnumNumberBody");case"string":return e.explicitType=!0,e.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(e,"EnumStringBody");case"symbol":return e.members=o.defaultedMembers,this.expect(8),this.finishNode(e,"EnumSymbolBody");default:{const h=()=>(e.members=[],this.expect(8),this.finishNode(e,"EnumStringBody"));e.explicitType=!1;const l=o.booleanMembers.length,p=o.numberMembers.length,d=o.stringMembers.length,f=o.defaultedMembers.length;if(!l&&!p&&!d&&!f)return h();if(!l&&!p)return e.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(e,"EnumStringBody");if(!p&&!d&&l>=f){for(const P of o.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(P.loc.start,{enumName:i,memberName:P.id.name});return e.members=o.booleanMembers,this.expect(8),this.finishNode(e,"EnumBooleanBody")}else if(!l&&!d&&p>=f){for(const P of o.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(P.loc.start,{enumName:i,memberName:P.id.name});return e.members=o.numberMembers,this.expect(8),this.finishNode(e,"EnumNumberBody")}else return this.raise(g.EnumInconsistentMemberValues,a,{enumName:i}),h()}}}flowParseEnumDeclaration(e){const s=this.parseIdentifier();return e.id=s,e.body=this.flowEnumBody(this.startNode(),s),this.finishNode(e,"EnumDeclaration")}jsxParseOpeningElementAfterName(e){return this.shouldParseTypes()&&(this.match(47)||this.match(51))&&(e.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(e)}isLookaheadToken_lt(){const e=this.nextTokenStart();if(this.input.charCodeAt(e)===60){const s=this.input.charCodeAt(e+1);return s!==60&&s!==61}return!1}reScan_lt_gt(){const{type:e}=this.state;e===47?(this.state.pos-=1,this.readToken_lt()):e===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){const{type:e}=this.state;return e===51?(this.state.pos-=2,this.finishOp(47,1),47):e}maybeUnwrapTypeCastExpression(e){return e.type==="TypeCastExpression"?e.expression:e}};const ba={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},ga=/\r\n|[\r\n\u2028\u2029]/,ot=new RegExp(ga.source,"g");function ke(r){switch(r){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function _s(r,t,e){for(let s=t;s<e;s++)if(ke(r.charCodeAt(s)))return!0;return!1}const Ht=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Kt=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function wa(r){switch(r){case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}const ce=re`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:r})=>`Expected corresponding JSX closing tag for <${r}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:r,HTMLEntity:t})=>`Unexpected token \`${r}\`. Did you mean \`${t}\` or \`{'${r}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"});function xe(r){return r?r.type==="JSXOpeningFragment"||r.type==="JSXClosingFragment":!1}function Ne(r){if(r.type==="JSXIdentifier")return r.name;if(r.type==="JSXNamespacedName")return r.namespace.name+":"+r.name.name;if(r.type==="JSXMemberExpression")return Ne(r.object)+"."+Ne(r.property);throw new Error("Node had unexpected type: "+r.type)}var Ta=r=>class extends r{jsxReadToken(){let e="",s=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(ce.UnterminatedJsxContent,this.state.startLoc);const i=this.input.charCodeAt(this.state.pos);switch(i){case 60:case 123:if(this.state.pos===this.state.start){i===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(143)):super.getTokenFromCode(i);return}e+=this.input.slice(s,this.state.pos),this.finishToken(142,e);return;case 38:e+=this.input.slice(s,this.state.pos),e+=this.jsxReadEntity(),s=this.state.pos;break;case 62:case 125:this.raise(ce.UnexpectedToken,this.state.curPosition(),{unexpected:this.input[this.state.pos],HTMLEntity:i===125?"&rbrace;":"&gt;"});default:ke(i)?(e+=this.input.slice(s,this.state.pos),e+=this.jsxReadNewLine(!0),s=this.state.pos):++this.state.pos}}}jsxReadNewLine(e){const s=this.input.charCodeAt(this.state.pos);let i;return++this.state.pos,s===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,i=e?`
4
+ `:`\r
5
+ `):i=String.fromCharCode(s),++this.state.curLine,this.state.lineStart=this.state.pos,i}jsxReadString(e){let s="",i=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(u.UnterminatedString,this.state.startLoc);const a=this.input.charCodeAt(this.state.pos);if(a===e)break;a===38?(s+=this.input.slice(i,this.state.pos),s+=this.jsxReadEntity(),i=this.state.pos):ke(a)?(s+=this.input.slice(i,this.state.pos),s+=this.jsxReadNewLine(!1),i=this.state.pos):++this.state.pos}s+=this.input.slice(i,this.state.pos++),this.finishToken(134,s)}jsxReadEntity(){const e=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let s=10;this.codePointAtPos(this.state.pos)===120&&(s=16,++this.state.pos);const i=this.readInt(s,void 0,!1,"bail");if(i!==null&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(i)}else{let s=0,i=!1;for(;s++<10&&this.state.pos<this.length&&!(i=this.codePointAtPos(this.state.pos)===59);)++this.state.pos;if(i){const a=this.input.slice(e,this.state.pos),n=ba[a];if(++this.state.pos,n)return n}}return this.state.pos=e,"&"}jsxReadWord(){let e;const s=this.state.pos;do e=this.input.charCodeAt(++this.state.pos);while(Ce(e)||e===45);this.finishToken(141,this.input.slice(s,this.state.pos))}jsxParseIdentifier(){const e=this.startNode();return this.match(141)?e.name=this.state.value:_t(this.state.type)?e.name=ye(this.state.type):this.unexpected(),this.next(),this.finishNode(e,"JSXIdentifier")}jsxParseNamespacedName(){const e=this.state.startLoc,s=this.jsxParseIdentifier();if(!this.eat(14))return s;const i=this.startNodeAt(e);return i.namespace=s,i.name=this.jsxParseIdentifier(),this.finishNode(i,"JSXNamespacedName")}jsxParseElementName(){const e=this.state.startLoc;let s=this.jsxParseNamespacedName();if(s.type==="JSXNamespacedName")return s;for(;this.eat(16);){const i=this.startNodeAt(e);i.object=s,i.property=this.jsxParseIdentifier(),s=this.finishNode(i,"JSXMemberExpression")}return s}jsxParseAttributeValue(){let e;switch(this.state.type){case 5:return e=this.startNode(),this.setContext(L.brace),this.next(),e=this.jsxParseExpressionContainer(e,L.j_oTag),e.expression.type==="JSXEmptyExpression"&&this.raise(ce.AttributeIsEmpty,e),e;case 143:case 134:return this.parseExprAtom();default:throw this.raise(ce.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){const e=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(e,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(e){return this.next(),e.expression=this.parseExpression(),this.setContext(L.j_expr),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(e,"JSXSpreadChild")}jsxParseExpressionContainer(e,s){if(this.match(8))e.expression=this.jsxParseEmptyExpression();else{const i=this.parseExpression();i.type==="SequenceExpression"&&!i.extra?.parenthesized&&this.raise(ce.UnexpectedSequenceExpression,i.expressions[1]),e.expression=i}return this.setContext(s),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(e,"JSXExpressionContainer")}jsxParseAttribute(){const e=this.startNode();return this.match(5)?(this.setContext(L.brace),this.next(),this.expect(21),e.argument=this.parseMaybeAssignAllowIn(),this.setContext(L.j_oTag),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(e,"JSXSpreadAttribute")):(e.name=this.jsxParseNamespacedName(),e.value=this.eat(29)?this.jsxParseAttributeValue():null,this.finishNode(e,"JSXAttribute"))}jsxParseOpeningElementAt(e){const s=this.startNodeAt(e);return this.eat(144)?this.finishNode(s,"JSXOpeningFragment"):(s.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(s))}jsxParseOpeningElementAfterName(e){const s=[];for(;!this.match(56)&&!this.match(144);)s.push(this.jsxParseAttribute());return e.attributes=s,e.selfClosing=this.eat(56),this.expect(144),this.finishNode(e,"JSXOpeningElement")}jsxParseClosingElementAt(e){const s=this.startNodeAt(e);return this.eat(144)?this.finishNode(s,"JSXClosingFragment"):(s.name=this.jsxParseElementName(),this.expect(144),this.finishNode(s,"JSXClosingElement"))}jsxParseElementAt(e){const s=this.startNodeAt(e),i=[],a=this.jsxParseOpeningElementAt(e);let n=null;if(!a.selfClosing){e:for(;;)switch(this.state.type){case 143:if(e=this.state.startLoc,this.next(),this.eat(56)){n=this.jsxParseClosingElementAt(e);break e}i.push(this.jsxParseElementAt(e));break;case 142:i.push(this.parseLiteral(this.state.value,"JSXText"));break;case 5:{const o=this.startNode();this.setContext(L.brace),this.next(),this.match(21)?i.push(this.jsxParseSpreadChild(o)):i.push(this.jsxParseExpressionContainer(o,L.j_expr));break}default:this.unexpected()}xe(a)&&!xe(n)&&n!==null?this.raise(ce.MissingClosingTagFragment,n):!xe(a)&&xe(n)?this.raise(ce.MissingClosingTagElement,n,{openingTagName:Ne(a.name)}):!xe(a)&&!xe(n)&&Ne(n.name)!==Ne(a.name)&&this.raise(ce.MissingClosingTagElement,n,{openingTagName:Ne(a.name)})}if(xe(a)?(s.openingFragment=a,s.closingFragment=n):(s.openingElement=a,s.closingElement=n),s.children=i,this.match(47))throw this.raise(ce.UnwrappedAdjacentJSXElements,this.state.startLoc);return xe(a)?this.finishNode(s,"JSXFragment"):this.finishNode(s,"JSXElement")}jsxParseElement(){const e=this.state.startLoc;return this.next(),this.jsxParseElementAt(e)}setContext(e){const{context:s}=this.state;s[s.length-1]=e}parseExprAtom(e){return this.match(143)?this.jsxParseElement():this.match(47)&&this.input.charCodeAt(this.state.pos)!==33?(this.replaceToken(143),this.jsxParseElement()):super.parseExprAtom(e)}skipSpace(){this.curContext().preserveSpace||super.skipSpace()}getTokenFromCode(e){const s=this.curContext();if(s===L.j_expr){this.jsxReadToken();return}if(s===L.j_oTag||s===L.j_cTag){if(oe(e)){this.jsxReadWord();return}if(e===62){++this.state.pos,this.finishToken(144);return}if((e===34||e===39)&&s===L.j_oTag){this.jsxReadString(e);return}}if(e===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos,this.finishToken(143);return}super.getTokenFromCode(e)}updateContext(e){const{context:s,type:i}=this.state;if(i===56&&e===143)s.splice(-2,2,L.j_cTag),this.state.canStartJSXElement=!1;else if(i===143)s.push(L.j_oTag);else if(i===144){const a=s[s.length-1];a===L.j_oTag&&e===56||a===L.j_cTag?(s.pop(),this.state.canStartJSXElement=s[s.length-1]===L.j_expr):(this.setContext(L.j_expr),this.state.canStartJSXElement=!0)}else this.state.canStartJSXElement=Kr(i)}};class Aa extends zt{tsNames=new Map}class Sa extends Vt{importsStack=[];createScope(t){return this.importsStack.push(new Set),new Aa(t)}enter(t){t===512&&this.importsStack.push(new Set),super.enter(t)}exit(){const t=super.exit();return t===512&&this.importsStack.pop(),t}hasImport(t,e){const s=this.importsStack.length;if(this.importsStack[s-1].has(t))return!0;if(!e&&s>1){for(let i=0;i<s-1;i++)if(this.importsStack[i].has(t))return!0}return!1}declareName(t,e,s){if(e&4096){this.hasImport(t,!0)&&this.parser.raise(u.VarRedeclaration,s,{identifierName:t}),this.importsStack[this.importsStack.length-1].add(t);return}const i=this.currentScope();let a=i.tsNames.get(t)||0;if(e&1024){this.maybeExportDefined(i,t),i.tsNames.set(t,a|16);return}super.declareName(t,e,s),e&2&&(e&1||(this.checkRedeclarationInScope(i,t,e,s),this.maybeExportDefined(i,t)),a=a|1),e&256&&(a=a|2),e&512&&(a=a|4),e&128&&(a=a|8),a&&i.tsNames.set(t,a)}isRedeclaredInScope(t,e,s){const i=t.tsNames.get(e);if((i&2)>0){if(s&256){const a=!!(s&512),n=(i&4)>0;return a!==n}return!0}return s&128&&(i&8)>0?t.names.get(e)&2?!!(s&1):!1:s&2&&(i&1)>0?!0:super.isRedeclaredInScope(t,e,s)}checkLocalExport(t){const{name:e}=t;if(this.hasImport(e))return;const s=this.scopeStack.length;for(let i=s-1;i>=0;i--){const n=this.scopeStack[i].tsNames.get(e);if((n&1)>0||(n&16)>0)return}super.checkLocalExport(t)}}class Ia{stacks=[];enter(t){this.stacks.push(t)}exit(){this.stacks.pop()}currentFlags(){return this.stacks[this.stacks.length-1]}get hasAwait(){return(this.currentFlags()&2)>0}get hasYield(){return(this.currentFlags()&1)>0}get hasReturn(){return(this.currentFlags()&4)>0}get hasIn(){return(this.currentFlags()&8)>0}}function ct(r,t){return(r?2:0)|(t?1:0)}class Ea{sawUnambiguousESM=!1;ambiguousScriptDifferentAst=!1;sourceToOffsetPos(t){return t+this.startIndex}offsetToSourcePos(t){return t-this.startIndex}hasPlugin(t){if(typeof t=="string")return this.plugins.has(t);{const[e,s]=t;if(!this.hasPlugin(e))return!1;const i=this.plugins.get(e);for(const a of Object.keys(s))if(i?.[a]!==s[a])return!1;return!0}}getPluginOption(t,e){return this.plugins.get(t)?.[e]}}function js(r,t){r.trailingComments===void 0?r.trailingComments=t:r.trailingComments.unshift(...t)}function Ca(r,t){r.leadingComments===void 0?r.leadingComments=t:r.leadingComments.unshift(...t)}function ve(r,t){r.innerComments===void 0?r.innerComments=t:r.innerComments.unshift(...t)}function Ae(r,t,e){let s=null,i=t.length;for(;s===null&&i>0;)s=t[--i];s===null||s.start>e.start?ve(r,e.comments):js(s,e.comments)}class ka extends Ea{addComment(t){this.filename&&(t.loc.filename=this.filename);const{commentsLen:e}=this.state;this.comments.length!==e&&(this.comments.length=e),this.comments.push(t),this.state.commentsLen++}processComment(t){const{commentStack:e}=this.state,s=e.length;if(s===0)return;let i=s-1;const a=e[i];a.start===t.end&&(a.leadingNode=t,i--);const{start:n}=t;for(;i>=0;i--){const o=e[i],c=o.end;if(c>n)o.containingNode=t,this.finalizeComment(o),e.splice(i,1);else{c===n&&(o.trailingNode=t);break}}}finalizeComment(t){const{comments:e}=t;if(t.leadingNode!==null||t.trailingNode!==null)t.leadingNode!==null&&js(t.leadingNode,e),t.trailingNode!==null&&Ca(t.trailingNode,e);else{const{containingNode:s,start:i}=t;if(this.input.charCodeAt(this.offsetToSourcePos(i)-1)===44)switch(s.type){case"ObjectExpression":case"ObjectPattern":case"RecordExpression":Ae(s,s.properties,t);break;case"CallExpression":case"OptionalCallExpression":Ae(s,s.arguments,t);break;case"ImportExpression":Ae(s,[s.source,s.options??null],t);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":Ae(s,s.params,t);break;case"ArrayExpression":case"ArrayPattern":case"TupleExpression":Ae(s,s.elements,t);break;case"ExportNamedDeclaration":case"ImportDeclaration":Ae(s,s.specifiers,t);break;case"TSEnumDeclaration":ve(s,e);break;case"TSEnumBody":Ae(s,s.members,t);break;default:ve(s,e)}else ve(s,e)}}finalizeRemainingComments(){const{commentStack:t}=this.state;for(let e=t.length-1;e>=0;e--)this.finalizeComment(t[e]);this.state.commentStack=[]}resetPreviousNodeTrailingComments(t){const{commentStack:e}=this.state,{length:s}=e;if(s===0)return;const i=e[s-1];i.leadingNode===t&&(i.leadingNode=null)}takeSurroundingComments(t,e,s){const{commentStack:i}=this.state,a=i.length;if(a===0)return;let n=a-1;for(;n>=0;n--){const o=i[n],c=o.end;if(o.start===s)o.leadingNode=t;else if(c===e)o.trailingNode=t;else if(c<e)break}}}class Wt{flags=1024;get strict(){return(this.flags&1)>0}set strict(t){t?this.flags|=1:this.flags&=-2}startIndex;curLine;lineStart;startLoc;endLoc;init({strictMode:t,sourceType:e,startIndex:s,startLine:i,startColumn:a}){this.strict=t===!1?!1:t===!0?!0:e==="module",this.startIndex=s,this.curLine=i,this.lineStart=-a,this.startLoc=this.endLoc=new fe(i,a,s)}errors=[];potentialArrowAt=-1;noArrowAt=[];noArrowParamsConversionAt=[];get maybeInArrowParameters(){return(this.flags&2)>0}set maybeInArrowParameters(t){t?this.flags|=2:this.flags&=-3}get inType(){return(this.flags&4)>0}set inType(t){t?this.flags|=4:this.flags&=-5}get noAnonFunctionType(){return(this.flags&8)>0}set noAnonFunctionType(t){t?this.flags|=8:this.flags&=-9}get hasFlowComment(){return(this.flags&16)>0}set hasFlowComment(t){t?this.flags|=16:this.flags&=-17}get isAmbientContext(){return(this.flags&32)>0}set isAmbientContext(t){t?this.flags|=32:this.flags&=-33}get inAbstractClass(){return(this.flags&64)>0}set inAbstractClass(t){t?this.flags|=64:this.flags&=-65}get inDisallowConditionalTypesContext(){return(this.flags&128)>0}set inDisallowConditionalTypesContext(t){t?this.flags|=128:this.flags&=-129}topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};get soloAwait(){return(this.flags&256)>0}set soloAwait(t){t?this.flags|=256:this.flags&=-257}get inFSharpPipelineDirectBody(){return(this.flags&512)>0}set inFSharpPipelineDirectBody(t){t?this.flags|=512:this.flags&=-513}labels=[];commentsLen=0;commentStack=[];pos=0;type=140;value=null;start=0;end=0;lastTokEndLoc=null;lastTokStartLoc=null;context=[L.brace];get canStartJSXElement(){return(this.flags&1024)>0}set canStartJSXElement(t){t?this.flags|=1024:this.flags&=-1025}get containsEsc(){return(this.flags&2048)>0}set containsEsc(t){t?this.flags|=2048:this.flags&=-2049}firstInvalidTemplateEscapePos=null;get hasTopLevelAwait(){return(this.flags&4096)>0}set hasTopLevelAwait(t){t?this.flags|=4096:this.flags&=-4097}strictErrors=new Map;tokensLength=0;curPosition(){return new fe(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex)}clone(){const t=new Wt;return t.flags=this.flags,t.startIndex=this.startIndex,t.curLine=this.curLine,t.lineStart=this.lineStart,t.startLoc=this.startLoc,t.endLoc=this.endLoc,t.errors=this.errors.slice(),t.potentialArrowAt=this.potentialArrowAt,t.noArrowAt=this.noArrowAt.slice(),t.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice(),t.topicContext=this.topicContext,t.labels=this.labels.slice(),t.commentsLen=this.commentsLen,t.commentStack=this.commentStack.slice(),t.pos=this.pos,t.type=this.type,t.value=this.value,t.start=this.start,t.end=this.end,t.lastTokEndLoc=this.lastTokEndLoc,t.lastTokStartLoc=this.lastTokStartLoc,t.context=this.context.slice(),t.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos,t.strictErrors=this.strictErrors,t.tokensLength=this.tokensLength,t}}var Na=function(t){return t>=48&&t<=57};const Us={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])},ht={bin:r=>r===48||r===49,oct:r=>r>=48&&r<=55,dec:r=>r>=48&&r<=57,hex:r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102};function $s(r,t,e,s,i,a){const n=e,o=s,c=i;let h="",l=null,p=e;const{length:d}=t;for(;;){if(e>=d){a.unterminated(n,o,c),h+=t.slice(p,e);break}const f=t.charCodeAt(e);if(va(r,f,t,e)){h+=t.slice(p,e);break}if(f===92){h+=t.slice(p,e);const P=Oa(t,e,s,i,r==="template",a);P.ch===null&&!l?l={pos:e,lineStart:s,curLine:i}:h+=P.ch,{pos:e,lineStart:s,curLine:i}=P,p=e}else f===8232||f===8233?(++e,++i,s=e):f===10||f===13?r==="template"?(h+=t.slice(p,e)+`
6
+ `,++e,f===13&&t.charCodeAt(e)===10&&++e,++i,p=s=e):a.unterminated(n,o,c):++e}return{pos:e,str:h,firstInvalidLoc:l,lineStart:s,curLine:i}}function va(r,t,e,s){return r==="template"?t===96||t===36&&e.charCodeAt(s+1)===123:t===(r==="double"?34:39)}function Oa(r,t,e,s,i,a){const n=!i;t++;const o=h=>({pos:t,ch:h,lineStart:e,curLine:s}),c=r.charCodeAt(t++);switch(c){case 110:return o(`
7
+ `);case 114:return o("\r");case 120:{let h;return{code:h,pos:t}=Jt(r,t,e,s,2,!1,n,a),o(h===null?null:String.fromCharCode(h))}case 117:{let h;return{code:h,pos:t}=zs(r,t,e,s,n,a),o(h===null?null:String.fromCodePoint(h))}case 116:return o(" ");case 98:return o("\b");case 118:return o("\v");case 102:return o("\f");case 13:r.charCodeAt(t)===10&&++t;case 10:e=t,++s;case 8232:case 8233:return o("");case 56:case 57:if(i)return o(null);a.strictNumericEscape(t-1,e,s);default:if(c>=48&&c<=55){const h=t-1;let p=/^[0-7]+/.exec(r.slice(h,t+2))[0],d=parseInt(p,8);d>255&&(p=p.slice(0,-1),d=parseInt(p,8)),t+=p.length-1;const f=r.charCodeAt(t);if(p!=="0"||f===56||f===57){if(i)return o(null);a.strictNumericEscape(h,e,s)}return o(String.fromCharCode(d))}return o(String.fromCharCode(c))}}function Jt(r,t,e,s,i,a,n,o){const c=t;let h;return{n:h,pos:t}=qs(r,t,e,s,16,i,a,!1,o,!n),h===null&&(n?o.invalidEscapeSequence(c,e,s):t=c-1),{code:h,pos:t}}function qs(r,t,e,s,i,a,n,o,c,h){const l=t,p=i===16?Us.hex:Us.decBinOct,d=i===16?ht.hex:i===10?ht.dec:i===8?ht.oct:ht.bin;let f=!1,P=0;for(let k=0,O=a??1/0;k<O;++k){const T=r.charCodeAt(t);let I;if(T===95&&o!=="bail"){const m=r.charCodeAt(t-1),D=r.charCodeAt(t+1);if(o){if(Number.isNaN(D)||!d(D)||p.has(m)||p.has(D)){if(h)return{n:null,pos:t};c.unexpectedNumericSeparator(t,e,s)}}else{if(h)return{n:null,pos:t};c.numericSeparatorInEscapeSequence(t,e,s)}++t;continue}if(T>=97?I=T-97+10:T>=65?I=T-65+10:Na(T)?I=T-48:I=1/0,I>=i){if(I<=9&&h)return{n:null,pos:t};if(I<=9&&c.invalidDigit(t,e,s,i))I=0;else if(n)I=0,f=!0;else break}++t,P=P*i+I}return t===l||a!=null&&t-l!==a||f?{n:null,pos:t}:{n:P,pos:t}}function zs(r,t,e,s,i,a){const n=r.charCodeAt(t);let o;if(n===123){if(++t,{code:o,pos:t}=Jt(r,t,e,s,r.indexOf("}",t)-t,!0,i,a),++t,o!==null&&o>1114111)if(i)a.invalidCodePoint(t,e,s);else return{code:null,pos:t}}else({code:o,pos:t}=Jt(r,t,e,s,4,!1,i,a));return{code:o,pos:t}}function Ke(r,t,e){return new fe(e,r-t,r)}const Da=new Set([103,109,115,105,121,117,100,118]);class La{constructor(t){const e=t.startIndex||0;this.type=t.type,this.value=t.value,this.start=e+t.start,this.end=e+t.end,this.loc=new it(t.startLoc,t.endLoc)}}class Ma extends ka{isLookahead;tokens=[];constructor(t,e){super(),this.state=new Wt,this.state.init(t),this.input=e,this.length=e.length,this.comments=[],this.isLookahead=!1}pushToken(t){this.tokens.length=this.state.tokensLength,this.tokens.push(t),++this.state.tokensLength}next(){this.checkKeywordEscapes(),this.optionFlags&256&&this.pushToken(new La(this.state)),this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(t){return this.match(t)?(this.next(),!0):!1}match(t){return this.state.type===t}createLookaheadState(t){return{pos:t.pos,value:null,type:t.type,start:t.start,end:t.end,context:[this.curContext()],inType:t.inType,startLoc:t.startLoc,lastTokEndLoc:t.lastTokEndLoc,curLine:t.curLine,lineStart:t.lineStart,curPosition:t.curPosition}}lookahead(){const t=this.state;this.state=this.createLookaheadState(t),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;const e=this.state;return this.state=t,e}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(t){return Ht.lastIndex=t,Ht.test(this.input)?Ht.lastIndex:t}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(t){return this.input.charCodeAt(this.nextTokenStartSince(t))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(t){return Kt.lastIndex=t,Kt.test(this.input)?Kt.lastIndex:t}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}codePointAtPos(t){let e=this.input.charCodeAt(t);if((e&64512)===55296&&++t<this.input.length){const s=this.input.charCodeAt(t);(s&64512)===56320&&(e=65536+((e&1023)<<10)+(s&1023))}return e}setStrict(t){this.state.strict=t,t&&(this.state.strictErrors.forEach(([e,s])=>this.raise(e,s)),this.state.strictErrors.clear())}curContext(){return this.state.context[this.state.context.length-1]}nextToken(){if(this.skipSpace(),this.state.start=this.state.pos,this.isLookahead||(this.state.startLoc=this.state.curPosition()),this.state.pos>=this.length){this.finishToken(140);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(t){let e;this.isLookahead||(e=this.state.curPosition());const s=this.state.pos,i=this.input.indexOf(t,s+2);if(i===-1)throw this.raise(u.UnterminatedComment,this.state.curPosition());for(this.state.pos=i+t.length,ot.lastIndex=s+2;ot.test(this.input)&&ot.lastIndex<=i;)++this.state.curLine,this.state.lineStart=ot.lastIndex;if(this.isLookahead)return;const a={type:"CommentBlock",value:this.input.slice(s+2,i),start:this.sourceToOffsetPos(s),end:this.sourceToOffsetPos(i+t.length),loc:new it(e,this.state.curPosition())};return this.optionFlags&256&&this.pushToken(a),a}skipLineComment(t){const e=this.state.pos;let s;this.isLookahead||(s=this.state.curPosition());let i=this.input.charCodeAt(this.state.pos+=t);if(this.state.pos<this.length)for(;!ke(i)&&++this.state.pos<this.length;)i=this.input.charCodeAt(this.state.pos);if(this.isLookahead)return;const a=this.state.pos,o={type:"CommentLine",value:this.input.slice(e+t,a),start:this.sourceToOffsetPos(e),end:this.sourceToOffsetPos(a),loc:new it(s,this.state.curPosition())};return this.optionFlags&256&&this.pushToken(o),o}skipSpace(){const t=this.state.pos,e=this.optionFlags&4096?[]:null;e:for(;this.state.pos<this.length;){const s=this.input.charCodeAt(this.state.pos);switch(s){case 32:case 160:case 9:++this.state.pos;break;case 13:this.input.charCodeAt(this.state.pos+1)===10&&++this.state.pos;case 10:case 8232:case 8233:++this.state.pos,++this.state.curLine,this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:{const i=this.skipBlockComment("*/");i!==void 0&&(this.addComment(i),e?.push(i));break}case 47:{const i=this.skipLineComment(2);i!==void 0&&(this.addComment(i),e?.push(i));break}default:break e}break;default:if(wa(s))++this.state.pos;else if(s===45&&!this.inModule&&this.optionFlags&8192){const i=this.state.pos;if(this.input.charCodeAt(i+1)===45&&this.input.charCodeAt(i+2)===62&&(t===0||this.state.lineStart>t)){const a=this.skipLineComment(3);a!==void 0&&(this.addComment(a),e?.push(a))}else break e}else if(s===60&&!this.inModule&&this.optionFlags&8192){const i=this.state.pos;if(this.input.charCodeAt(i+1)===33&&this.input.charCodeAt(i+2)===45&&this.input.charCodeAt(i+3)===45){const a=this.skipLineComment(4);a!==void 0&&(this.addComment(a),e?.push(a))}else break e}else break e}}if(e?.length>0){const s=this.state.pos,i={start:this.sourceToOffsetPos(t),end:this.sourceToOffsetPos(s),comments:e,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(i)}}finishToken(t,e){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();const s=this.state.type;this.state.type=t,this.state.value=e,this.isLookahead||this.updateContext(s)}replaceToken(t){this.state.type=t,this.updateContext()}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter())return;const t=this.state.pos+1,e=this.codePointAtPos(t);if(e>=48&&e<=57)throw this.raise(u.UnexpectedDigitAfterHash,this.state.curPosition());oe(e)?(++this.state.pos,this.finishToken(139,this.readWord1(e))):e===92?(++this.state.pos,this.finishToken(139,this.readWord1())):this.finishOp(27,1)}readToken_dot(){const t=this.input.charCodeAt(this.state.pos+1);if(t>=48&&t<=57){this.readNumber(!0);return}t===46&&this.input.charCodeAt(this.state.pos+2)===46?(this.state.pos+=3,this.finishToken(21)):(++this.state.pos,this.finishToken(16))}readToken_slash(){this.input.charCodeAt(this.state.pos+1)===61?this.finishOp(31,2):this.finishOp(56,1)}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return!1;let t=this.input.charCodeAt(this.state.pos+1);if(t!==33)return!1;const e=this.state.pos;for(this.state.pos+=1;!ke(t)&&++this.state.pos<this.length;)t=this.input.charCodeAt(this.state.pos);const s=this.input.slice(e+2,this.state.pos);return this.finishToken(28,s),!0}readToken_mult_modulo(t){let e=t===42?55:54,s=1,i=this.input.charCodeAt(this.state.pos+1);t===42&&i===42&&(s++,i=this.input.charCodeAt(this.state.pos+2),e=57),i===61&&!this.state.inType&&(s++,e=t===37?33:30),this.finishOp(e,s)}readToken_pipe_amp(t){const e=this.input.charCodeAt(this.state.pos+1);if(e===t){this.input.charCodeAt(this.state.pos+2)===61?this.finishOp(30,3):this.finishOp(t===124?41:42,2);return}if(t===124&&e===62){this.finishOp(39,2);return}if(e===61){this.finishOp(30,2);return}this.finishOp(t===124?43:45,1)}readToken_caret(){const t=this.input.charCodeAt(this.state.pos+1);t===61&&!this.state.inType?this.finishOp(32,2):t===94&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"^^"}])?(this.finishOp(37,2),this.input.codePointAt(this.state.pos)===94&&this.unexpected()):this.finishOp(44,1)}readToken_atSign(){this.input.charCodeAt(this.state.pos+1)===64&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"@@"}])?this.finishOp(38,2):this.finishOp(26,1)}readToken_plus_min(t){const e=this.input.charCodeAt(this.state.pos+1);if(e===t){this.finishOp(34,2);return}e===61?this.finishOp(30,2):this.finishOp(53,1)}readToken_lt(){const{pos:t}=this.state,e=this.input.charCodeAt(t+1);if(e===60){if(this.input.charCodeAt(t+2)===61){this.finishOp(30,3);return}this.finishOp(51,2);return}if(e===61){this.finishOp(49,2);return}this.finishOp(47,1)}readToken_gt(){const{pos:t}=this.state,e=this.input.charCodeAt(t+1);if(e===62){const s=this.input.charCodeAt(t+2)===62?3:2;if(this.input.charCodeAt(t+s)===61){this.finishOp(30,s+1);return}this.finishOp(52,s);return}if(e===61){this.finishOp(49,2);return}this.finishOp(48,1)}readToken_eq_excl(t){const e=this.input.charCodeAt(this.state.pos+1);if(e===61){this.finishOp(46,this.input.charCodeAt(this.state.pos+2)===61?3:2);return}if(t===61&&e===62){this.state.pos+=2,this.finishToken(19);return}this.finishOp(t===61?29:35,1)}readToken_question(){const t=this.input.charCodeAt(this.state.pos+1),e=this.input.charCodeAt(this.state.pos+2);t===63?e===61?this.finishOp(30,3):this.finishOp(40,2):t===46&&!(e>=48&&e<=57)?(this.state.pos+=2,this.finishToken(18)):(++this.state.pos,this.finishToken(17))}getTokenFromCode(t){switch(t){case 46:this.readToken_dot();return;case 40:++this.state.pos,this.finishToken(10);return;case 41:++this.state.pos,this.finishToken(11);return;case 59:++this.state.pos,this.finishToken(13);return;case 44:++this.state.pos,this.finishToken(12);return;case 91:++this.state.pos,this.finishToken(0);return;case 93:++this.state.pos,this.finishToken(3);return;case 123:++this.state.pos,this.finishToken(5);return;case 125:++this.state.pos,this.finishToken(8);return;case 58:this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58?this.finishOp(15,2):(++this.state.pos,this.finishToken(14));return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{const e=this.input.charCodeAt(this.state.pos+1);if(e===120||e===88){this.readRadixNumber(16);return}if(e===111||e===79){this.readRadixNumber(8);return}if(e===98||e===66){this.readRadixNumber(2);return}}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.readNumber(!1);return;case 34:case 39:this.readString(t);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(t);return;case 124:case 38:this.readToken_pipe_amp(t);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(t);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(t);return;case 126:this.finishOp(36,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(oe(t)){this.readWord(t);return}}throw this.raise(u.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(t)})}finishOp(t,e){const s=this.input.slice(this.state.pos,this.state.pos+e);this.state.pos+=e,this.finishToken(t,s)}readRegexp(){const t=this.state.startLoc,e=this.state.start+1;let s,i,{pos:a}=this.state;for(;;++a){if(a>=this.length)throw this.raise(u.UnterminatedRegExp,Y(t,1));const h=this.input.charCodeAt(a);if(ke(h))throw this.raise(u.UnterminatedRegExp,Y(t,1));if(s)s=!1;else{if(h===91)i=!0;else if(h===93&&i)i=!1;else if(h===47&&!i)break;s=h===92}}const n=this.input.slice(e,a);++a;let o="";const c=()=>Y(t,a+2-e);for(;a<this.length;){const h=this.codePointAtPos(a),l=String.fromCharCode(h);if(Da.has(h))h===118?o.includes("u")&&this.raise(u.IncompatibleRegExpUVFlags,c()):h===117&&o.includes("v")&&this.raise(u.IncompatibleRegExpUVFlags,c()),o.includes(l)&&this.raise(u.DuplicateRegExpFlags,c());else if(Ce(h)||h===92)this.raise(u.MalformedRegExpFlags,c());else break;++a,o+=l}this.state.pos=a,this.finishToken(138,{pattern:n,flags:o})}readInt(t,e,s=!1,i=!0){const{n:a,pos:n}=qs(this.input,this.state.pos,this.state.lineStart,this.state.curLine,t,e,s,i,this.errorHandlers_readInt,!1);return this.state.pos=n,a}readRadixNumber(t){const e=this.state.pos,s=this.state.curPosition();let i=!1;this.state.pos+=2;const a=this.readInt(t);a==null&&this.raise(u.InvalidDigit,Y(s,2),{radix:t});const n=this.input.charCodeAt(this.state.pos);if(n===110)++this.state.pos,i=!0;else if(n===109)throw this.raise(u.InvalidDecimal,s);if(oe(this.codePointAtPos(this.state.pos)))throw this.raise(u.NumberIdentifier,this.state.curPosition());if(i){const o=this.input.slice(e,this.state.pos).replace(/[_n]/g,"");this.finishToken(136,o);return}this.finishToken(135,a)}readNumber(t){const e=this.state.pos,s=this.state.curPosition();let i=!1,a=!1,n=!1;!t&&this.readInt(10)===null&&this.raise(u.InvalidNumber,this.state.curPosition());const o=this.state.pos-e>=2&&this.input.charCodeAt(e)===48;if(o){const p=this.input.slice(e,this.state.pos);if(this.recordStrictModeErrors(u.StrictOctalLiteral,s),!this.state.strict){const d=p.indexOf("_");d>0&&this.raise(u.ZeroDigitNumericSeparator,Y(s,d))}n=o&&!/[89]/.test(p)}let c=this.input.charCodeAt(this.state.pos);if(c===46&&!n&&(++this.state.pos,this.readInt(10),i=!0,c=this.input.charCodeAt(this.state.pos)),(c===69||c===101)&&!n&&(c=this.input.charCodeAt(++this.state.pos),(c===43||c===45)&&++this.state.pos,this.readInt(10)===null&&this.raise(u.InvalidOrMissingExponent,s),i=!0,c=this.input.charCodeAt(this.state.pos)),c===110&&((i||o)&&this.raise(u.InvalidBigIntLiteral,s),++this.state.pos,a=!0),oe(this.codePointAtPos(this.state.pos)))throw this.raise(u.NumberIdentifier,this.state.curPosition());const h=this.input.slice(e,this.state.pos).replace(/[_mn]/g,"");if(a){this.finishToken(136,h);return}const l=n?parseInt(h,8):parseFloat(h);this.finishToken(135,l)}readCodePoint(t){const{code:e,pos:s}=zs(this.input,this.state.pos,this.state.lineStart,this.state.curLine,t,this.errorHandlers_readCodePoint);return this.state.pos=s,e}readString(t){const{str:e,pos:s,curLine:i,lineStart:a}=$s(t===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=s+1,this.state.lineStart=a,this.state.curLine=i,this.finishToken(134,e)}readTemplateContinuation(){this.match(8)||this.unexpected(null,8),this.state.pos--,this.readTemplateToken()}readTemplateToken(){const t=this.input[this.state.pos],{str:e,firstInvalidLoc:s,pos:i,curLine:a,lineStart:n}=$s("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);this.state.pos=i+1,this.state.lineStart=n,this.state.curLine=a,s&&(this.state.firstInvalidTemplateEscapePos=new fe(s.curLine,s.pos-s.lineStart,this.sourceToOffsetPos(s.pos))),this.input.codePointAt(i)===96?this.finishToken(24,s?null:t+e+"`"):(this.state.pos++,this.finishToken(25,s?null:t+e+"${"))}recordStrictModeErrors(t,e){const s=e.index;this.state.strict&&!this.state.strictErrors.has(s)?this.raise(t,e):this.state.strictErrors.set(s,[t,e])}readWord1(t){this.state.containsEsc=!1;let e="";const s=this.state.pos;let i=this.state.pos;for(t!==void 0&&(this.state.pos+=t<=65535?1:2);this.state.pos<this.length;){const a=this.codePointAtPos(this.state.pos);if(Ce(a))this.state.pos+=a<=65535?1:2;else if(a===92){this.state.containsEsc=!0,e+=this.input.slice(i,this.state.pos);const n=this.state.curPosition(),o=this.state.pos===s?oe:Ce;if(this.input.charCodeAt(++this.state.pos)!==117){this.raise(u.MissingUnicodeEscape,this.state.curPosition()),i=this.state.pos-1;continue}++this.state.pos;const c=this.readCodePoint(!0);c!==null&&(o(c)||this.raise(u.EscapedCharNotAnIdentifier,n),e+=String.fromCodePoint(c)),i=this.state.pos}else break}return e+this.input.slice(i,this.state.pos)}readWord(t){const e=this.readWord1(t),s=Ot.get(e);s!==void 0?this.finishToken(s,ye(s)):this.finishToken(132,e)}checkKeywordEscapes(){const{type:t}=this.state;_t(t)&&this.state.containsEsc&&this.raise(u.InvalidEscapedReservedWord,this.state.startLoc,{reservedWord:ye(t)})}raise(t,e,s={}){const i=e instanceof fe?e:e.loc.start,a=t(i,s);if(!(this.optionFlags&2048))throw a;return this.isLookahead||this.state.errors.push(a),a}raiseOverwrite(t,e,s={}){const i=e instanceof fe?e:e.loc.start,a=i.index,n=this.state.errors;for(let o=n.length-1;o>=0;o--){const c=n[o];if(c.loc.index===a)return n[o]=t(i,s);if(c.loc.index<a)break}return this.raise(t,e,s)}updateContext(t){}unexpected(t,e){throw this.raise(u.UnexpectedToken,t??this.state.startLoc,{expected:e?ye(e):null})}expectPlugin(t,e){if(this.hasPlugin(t))return!0;throw this.raise(u.MissingPlugin,e??this.state.startLoc,{missingPlugin:[t]})}expectOnePlugin(t){if(!t.some(e=>this.hasPlugin(e)))throw this.raise(u.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:t})}errorBuilder(t){return(e,s,i)=>{this.raise(t,Ke(e,s,i))}}errorHandlers_readInt={invalidDigit:(t,e,s,i)=>this.optionFlags&2048?(this.raise(u.InvalidDigit,Ke(t,e,s),{radix:i}),!0):!1,numericSeparatorInEscapeSequence:this.errorBuilder(u.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(u.UnexpectedNumericSeparator)};errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(u.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(u.InvalidCodePoint)});errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(t,e,s)=>{this.recordStrictModeErrors(u.StrictNumericEscape,Ke(t,e,s))},unterminated:(t,e,s)=>{throw this.raise(u.UnterminatedString,Ke(t-1,e,s))}});errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(u.StrictNumericEscape),unterminated:(t,e,s)=>{throw this.raise(u.UnterminatedTemplate,Ke(t,e,s))}})}class Fa{privateNames=new Set;loneAccessors=new Map;undefinedPrivateNames=new Map}class Ra{parser;stack=[];undefinedPrivateNames=new Map;constructor(t){this.parser=t}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new Fa)}exit(){const t=this.stack.pop(),e=this.current();for(const[s,i]of Array.from(t.undefinedPrivateNames))e?e.undefinedPrivateNames.has(s)||e.undefinedPrivateNames.set(s,i):this.parser.raise(u.InvalidPrivateFieldResolution,i,{identifierName:s})}declarePrivateName(t,e,s){const{privateNames:i,loneAccessors:a,undefinedPrivateNames:n}=this.current();let o=i.has(t);if(e&3){const c=o&&a.get(t);if(c){const h=c&4,l=e&4,p=c&3,d=e&3;o=p===d||h!==l,o||a.delete(t)}else o||a.set(t,e)}o&&this.parser.raise(u.PrivateNameRedeclaration,s,{identifierName:t}),i.add(t),n.delete(t)}usePrivateName(t,e){let s;for(s of this.stack)if(s.privateNames.has(t))return;s?s.undefinedPrivateNames.set(t,e):this.parser.raise(u.InvalidPrivateFieldResolution,e,{identifierName:t})}}class lt{constructor(t=0){this.type=t}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}}class Vs extends lt{declarationErrors=new Map;constructor(t){super(t)}recordDeclarationError(t,e){const s=e.index;this.declarationErrors.set(s,[t,e])}clearDeclarationError(t){this.declarationErrors.delete(t)}iterateErrors(t){this.declarationErrors.forEach(t)}}class Ba{parser;stack=[new lt];constructor(t){this.parser=t}enter(t){this.stack.push(t)}exit(){this.stack.pop()}recordParameterInitializerError(t,e){const s=e.loc.start,{stack:i}=this;let a=i.length-1,n=i[a];for(;!n.isCertainlyParameterDeclaration();){if(n.canBeArrowParameterDeclaration())n.recordDeclarationError(t,s);else return;n=i[--a]}this.parser.raise(t,s)}recordArrowParameterBindingError(t,e){const{stack:s}=this,i=s[s.length-1],a=e.loc.start;if(i.isCertainlyParameterDeclaration())this.parser.raise(t,a);else if(i.canBeArrowParameterDeclaration())i.recordDeclarationError(t,a);else return}recordAsyncArrowParametersError(t){const{stack:e}=this;let s=e.length-1,i=e[s];for(;i.canBeArrowParameterDeclaration();)i.type===2&&i.recordDeclarationError(u.AwaitBindingIdentifier,t),i=e[--s]}validateAsPattern(){const{stack:t}=this,e=t[t.length-1];e.canBeArrowParameterDeclaration()&&e.iterateErrors(([s,i])=>{this.parser.raise(s,i);let a=t.length-2,n=t[a];for(;n.canBeArrowParameterDeclaration();)n.clearDeclarationError(i.index),n=t[--a]})}}function _a(){return new lt(3)}function ja(){return new Vs(1)}function Ua(){return new Vs(2)}function Hs(){return new lt}class $a extends Ma{addExtra(t,e,s,i=!0){if(!t)return;let{extra:a}=t;a==null&&(a={},t.extra=a),i?a[e]=s:Object.defineProperty(a,e,{enumerable:i,value:s})}isContextual(t){return this.state.type===t&&!this.state.containsEsc}isUnparsedContextual(t,e){const s=t+e.length;if(this.input.slice(t,s)===e){const i=this.input.charCodeAt(s);return!(Ce(i)||(i&64512)===55296)}return!1}isLookaheadContextual(t){const e=this.nextTokenStart();return this.isUnparsedContextual(e,t)}eatContextual(t){return this.isContextual(t)?(this.next(),!0):!1}expectContextual(t,e){if(!this.eatContextual(t)){if(e!=null)throw this.raise(e,this.state.startLoc);this.unexpected(null,t)}}canInsertSemicolon(){return this.match(140)||this.match(8)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return _s(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return _s(this.input,this.state.end,this.nextTokenStart())}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon()}semicolon(t=!0){(t?this.isLineTerminator():this.eat(13))||this.raise(u.MissingSemicolon,this.state.lastTokEndLoc)}expect(t,e){this.eat(t)||this.unexpected(e,t)}tryParse(t,e=this.state.clone()){const s={node:null};try{const i=t((a=null)=>{throw s.node=a,s});if(this.state.errors.length>e.errors.length){const a=this.state;return this.state=e,this.state.tokensLength=a.tokensLength,{node:i,error:a.errors[e.errors.length],thrown:!1,aborted:!1,failState:a}}return{node:i,error:null,thrown:!1,aborted:!1,failState:null}}catch(i){const a=this.state;if(this.state=e,i instanceof SyntaxError)return{node:null,error:i,thrown:!0,aborted:!1,failState:a};if(i===s)return{node:s.node,error:null,thrown:!1,aborted:!0,failState:a};throw i}}checkExpressionErrors(t,e){if(!t)return!1;const{shorthandAssignLoc:s,doubleProtoLoc:i,privateKeyLoc:a,optionalParametersLoc:n}=t,o=!!s||!!i||!!n||!!a;if(!e)return o;s!=null&&this.raise(u.InvalidCoverInitializedName,s),i!=null&&this.raise(u.DuplicateProto,i),a!=null&&this.raise(u.UnexpectedPrivateField,a),n!=null&&this.unexpected(n)}isLiteralPropertyName(){return ks(this.state.type)}isPrivateName(t){return t.type==="PrivateName"}getPrivateNameSV(t){return t.id.name}hasPropertyAsPrivateName(t){return(t.type==="MemberExpression"||t.type==="OptionalMemberExpression")&&this.isPrivateName(t.property)}isObjectProperty(t){return t.type==="ObjectProperty"}isObjectMethod(t){return t.type==="ObjectMethod"}initializeScopes(t=this.options.sourceType==="module"){const e=this.state.labels;this.state.labels=[];const s=this.exportedIdentifiers;this.exportedIdentifiers=new Set;const i=this.inModule;this.inModule=t;const a=this.scope,n=this.getScopeHandler();this.scope=new n(this,t);const o=this.prodParam;this.prodParam=new Ia;const c=this.classScope;this.classScope=new Ra(this);const h=this.expressionScope;return this.expressionScope=new Ba(this),()=>{this.state.labels=e,this.exportedIdentifiers=s,this.inModule=i,this.scope=a,this.prodParam=o,this.classScope=c,this.expressionScope=h}}enterInitialScopes(){let t=0;this.inModule&&(t|=2),this.optionFlags&32&&(t|=1),this.scope.enter(1),this.prodParam.enter(t)}checkDestructuringPrivate(t){const{privateKeyLoc:e}=t;e!==null&&this.expectPlugin("destructuringPrivate",e)}}class ut{shorthandAssignLoc=null;doubleProtoLoc=null;privateKeyLoc=null;optionalParametersLoc=null}class Gt{constructor(t,e,s){this.start=e,this.end=0,this.loc=new it(s),t?.optionFlags&128&&(this.range=[e,0]),t?.filename&&(this.loc.filename=t.filename)}type=""}const Ks=Gt.prototype;class qa extends $a{startNode(){const t=this.state.startLoc;return new Gt(this,t.index,t)}startNodeAt(t){return new Gt(this,t.index,t)}startNodeAtNode(t){return this.startNodeAt(t.loc.start)}finishNode(t,e){return this.finishNodeAt(t,e,this.state.lastTokEndLoc)}finishNodeAt(t,e,s){return t.type=e,t.end=s.index,t.loc.end=s,this.optionFlags&128&&(t.range[1]=s.index),this.optionFlags&4096&&this.processComment(t),t}resetStartLocation(t,e){t.start=e.index,t.loc.start=e,this.optionFlags&128&&(t.range[0]=e.index)}resetEndLocation(t,e=this.state.lastTokEndLoc){t.end=e.index,t.loc.end=e,this.optionFlags&128&&(t.range[1]=e.index)}resetStartLocationFromNode(t,e){this.resetStartLocation(t,e.loc.start)}castNodeTo(t,e){return t.type=e,t}cloneIdentifier(t){const{type:e,start:s,end:i,loc:a,range:n,name:o}=t,c=Object.create(Ks);return c.type=e,c.start=s,c.end=i,c.loc=a,c.range=n,c.name=o,t.extra&&(c.extra=t.extra),c}cloneStringLiteral(t){const{type:e,start:s,end:i,loc:a,range:n,extra:o}=t,c=Object.create(Ks);return c.type=e,c.start=s,c.end=i,c.loc=a,c.range=n,c.extra=o,c.value=t.value,c}}const Ws=r=>r.type==="ParenthesizedExpression"?Ws(r.expression):r;class za extends qa{toAssignable(t,e=!1){let s;switch((t.type==="ParenthesizedExpression"||t.extra?.parenthesized)&&(s=Ws(t),e?s.type==="Identifier"?this.expressionScope.recordArrowParameterBindingError(u.InvalidParenthesizedAssignment,t):s.type!=="MemberExpression"&&!this.isOptionalMemberExpression(s)&&this.raise(u.InvalidParenthesizedAssignment,t):this.raise(u.InvalidParenthesizedAssignment,t)),t.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":this.castNodeTo(t,"ObjectPattern");for(let i=0,a=t.properties.length,n=a-1;i<a;i++){const o=t.properties[i],c=i===n;this.toAssignableObjectExpressionProp(o,c,e),c&&o.type==="RestElement"&&t.extra?.trailingCommaLoc&&this.raise(u.RestTrailingComma,t.extra.trailingCommaLoc)}break;case"ObjectProperty":{const{key:i,value:a}=t;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.loc.start),this.toAssignable(a,e);break}case"SpreadElement":throw new Error("Internal @babel/parser error (this is a bug, please report it). SpreadElement should be converted by .toAssignable's caller.");case"ArrayExpression":this.castNodeTo(t,"ArrayPattern"),this.toAssignableList(t.elements,t.extra?.trailingCommaLoc,e);break;case"AssignmentExpression":t.operator!=="="&&this.raise(u.MissingEqInAssignment,t.left.loc.end),this.castNodeTo(t,"AssignmentPattern"),delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(s,e);break}}toAssignableObjectExpressionProp(t,e,s){if(t.type==="ObjectMethod")this.raise(t.kind==="get"||t.kind==="set"?u.PatternHasAccessor:u.PatternHasMethod,t.key);else if(t.type==="SpreadElement"){this.castNodeTo(t,"RestElement");const i=t.argument;this.checkToRestConversion(i,!1),this.toAssignable(i,s),e||this.raise(u.RestTrailingComma,t)}else this.toAssignable(t,s)}toAssignableList(t,e,s){const i=t.length-1;for(let a=0;a<=i;a++){const n=t[a];n&&(this.toAssignableListItem(t,a,s),n.type==="RestElement"&&(a<i?this.raise(u.RestTrailingComma,n):e&&this.raise(u.RestTrailingComma,e)))}}toAssignableListItem(t,e,s){const i=t[e];if(i.type==="SpreadElement"){this.castNodeTo(i,"RestElement");const a=i.argument;this.checkToRestConversion(a,!0),this.toAssignable(a,s)}else this.toAssignable(i,s)}isAssignable(t,e){switch(t.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":return!0;case"ObjectExpression":{const s=t.properties.length-1;return t.properties.every((i,a)=>i.type!=="ObjectMethod"&&(a===s||i.type!=="SpreadElement")&&this.isAssignable(i))}case"ObjectProperty":return this.isAssignable(t.value);case"SpreadElement":return this.isAssignable(t.argument);case"ArrayExpression":return t.elements.every(s=>s===null||this.isAssignable(s));case"AssignmentExpression":return t.operator==="=";case"ParenthesizedExpression":return this.isAssignable(t.expression);case"MemberExpression":case"OptionalMemberExpression":return!e;default:return!1}}toReferencedList(t,e){return t}toReferencedListDeep(t,e){this.toReferencedList(t,e);for(const s of t)s?.type==="ArrayExpression"&&this.toReferencedListDeep(s.elements)}parseSpread(t){const e=this.startNode();return this.next(),e.argument=this.parseMaybeAssignAllowIn(t,void 0),this.finishNode(e,"SpreadElement")}parseRestBinding(){const t=this.startNode();return this.next(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{const t=this.startNode();return this.next(),t.elements=this.parseBindingList(3,93,1),this.finishNode(t,"ArrayPattern")}case 5:return this.parseObjectLike(8,!0)}return this.parseIdentifier()}parseBindingList(t,e,s){const i=s&1,a=[];let n=!0;for(;!this.eat(t);)if(n?n=!1:this.expect(12),i&&this.match(12))a.push(null);else{if(this.eat(t))break;if(this.match(21)){let o=this.parseRestBinding();if(s&2&&(o=this.parseFunctionParamType(o)),a.push(o),!this.checkCommaAfterRest(e)){this.expect(t);break}}else{const o=[];if(s&2)for(this.match(26)&&this.hasPlugin("decorators")&&this.raise(u.UnsupportedParameterDecorator,this.state.startLoc);this.match(26);)o.push(this.parseDecorator());a.push(this.parseBindingElement(s,o))}}return a}parseBindingRestProperty(t){return this.next(),t.argument=this.parseIdentifier(),this.checkCommaAfterRest(125),this.finishNode(t,"RestElement")}parseBindingProperty(){const{type:t,startLoc:e}=this.state;if(t===21)return this.parseBindingRestProperty(this.startNode());const s=this.startNode();return t===139?(this.expectPlugin("destructuringPrivate",e),this.classScope.usePrivateName(this.state.value,e),s.key=this.parsePrivateName()):this.parsePropertyName(s),s.method=!1,this.parseObjPropValue(s,e,!1,!1,!0,!1)}parseBindingElement(t,e){const s=this.parseMaybeDefault();return t&2&&this.parseFunctionParamType(s),e.length&&(s.decorators=e,this.resetStartLocationFromNode(s,e[0])),this.parseMaybeDefault(s.loc.start,s)}parseFunctionParamType(t){return t}parseMaybeDefault(t,e){if(t??=this.state.startLoc,e=e??this.parseBindingAtom(),!this.eat(29))return e;const s=this.startNodeAt(t);return s.left=e,s.right=this.parseMaybeAssignAllowIn(),this.finishNode(s,"AssignmentPattern")}isValidLVal(t,e,s){switch(t){case"AssignmentPattern":return"left";case"RestElement":return"argument";case"ObjectProperty":return"value";case"ParenthesizedExpression":return"expression";case"ArrayPattern":return"elements";case"ObjectPattern":return"properties"}return!1}isOptionalMemberExpression(t){return t.type==="OptionalMemberExpression"}checkLVal(t,e,s=64,i=!1,a=!1,n=!1){const o=t.type;if(this.isObjectMethod(t))return;const c=this.isOptionalMemberExpression(t);if(c||o==="MemberExpression"){c&&(this.expectPlugin("optionalChainingAssign",t.loc.start),e.type!=="AssignmentExpression"&&this.raise(u.InvalidLhsOptionalChaining,t,{ancestor:e})),s!==64&&this.raise(u.InvalidPropertyBindingPattern,t);return}if(o==="Identifier"){this.checkIdentifier(t,s,a);const{name:P}=t;i&&(i.has(P)?this.raise(u.ParamDupe,t):i.add(P));return}const h=this.isValidLVal(o,!(n||t.extra?.parenthesized)&&e.type==="AssignmentExpression",s);if(h===!0)return;if(h===!1){const P=s===64?u.InvalidLhs:u.InvalidLhsBinding;this.raise(P,t,{ancestor:e});return}let l,p;typeof h=="string"?(l=h,p=o==="ParenthesizedExpression"):[l,p]=h;const d=o==="ArrayPattern"||o==="ObjectPattern"?{type:o}:e,f=t[l];if(Array.isArray(f))for(const P of f)P&&this.checkLVal(P,d,s,i,a,p);else f&&this.checkLVal(f,d,s,i,a,p)}checkIdentifier(t,e,s=!1){this.state.strict&&(s?Rs(t.name,this.inModule):Fs(t.name))&&(e===64?this.raise(u.StrictEvalArguments,t,{referenceName:t.name}):this.raise(u.StrictEvalArgumentsBinding,t,{bindingName:t.name})),e&8192&&t.name==="let"&&this.raise(u.LetInLexicalBinding,t),e&64||this.declareNameFromIdentifier(t,e)}declareNameFromIdentifier(t,e){this.scope.declareName(t.name,e,t.loc.start)}checkToRestConversion(t,e){switch(t.type){case"ParenthesizedExpression":this.checkToRestConversion(t.expression,e);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(e)break;default:this.raise(u.InvalidRestAssignmentPattern,t)}}checkCommaAfterRest(t){return this.match(12)?(this.raise(this.lookaheadCharCode()===t?u.RestTrailingComma:u.ElementAfterRest,this.state.startLoc),!0):!1}}function Va(r){if(r==null)throw new Error(`Unexpected ${r} value.`);return r}function Js(r){if(!r)throw new Error("Assert fail")}const x=re`typescript`({AbstractMethodHasImplementation:({methodName:r})=>`Method '${r}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:r})=>`Property '${r}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclareAccessor:({kind:r})=>`'declare' is not allowed in ${r}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:({modifier:r})=>`Accessibility modifier already seen: '${r}'.`,DuplicateModifier:({modifier:r})=>`Duplicate modifier: '${r}'.`,EmptyHeritageClauseType:({token:r})=>`'${r}' list cannot be empty.`,EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` modifier",IncompatibleModifiers:({modifiers:r})=>`'${r[0]}' modifier cannot be used with '${r[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:r})=>`Index signatures cannot have an accessibility modifier ('${r}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InvalidHeritageClauseType:({token:r})=>`'${r}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnTypeMember:({modifier:r})=>`'${r}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:r})=>`'${r}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:r})=>`'${r}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifiersOrder:({orderedModifiers:r})=>`'${r[0]}' modifier must precede '${r[1]}' modifier.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:r})=>`Private elements cannot have an accessibility modifier ('${r}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:r})=>`Single type parameter ${r} should have a trailing comma. Example usage: <${r},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type:r})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${r}.`});function Ha(r){switch(r){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return}}function Gs(r){return r==="private"||r==="public"||r==="protected"}function Ka(r){return r==="in"||r==="out"}function Xt(r){if(r.extra?.parenthesized)return!1;switch(r.type){case"Identifier":return!0;case"MemberExpression":return!r.computed&&Xt(r.object);case"TSInstantiationExpression":return Xt(r.expression);default:return!1}}var Wa=r=>class extends r{getScopeHandler(){return Sa}tsIsIdentifier(){return C(this.state.type)}tsTokenCanFollowModifier(){return this.match(0)||this.match(5)||this.match(55)||this.match(21)||this.match(139)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){return this.next(),this.hasPrecedingLineBreak()?!1:this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){return this.match(106)?(this.next(),this.tsTokenCanFollowModifier()):this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(e,s,i){if(!C(this.state.type)&&this.state.type!==58&&this.state.type!==75)return;const a=this.state.value;if(e.includes(a)){if(i&&this.match(106)||s&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return a}}tsParseModifiers({allowedModifiers:e,disallowedModifiers:s,stopOnStartOfClassStaticBlock:i,errorTemplate:a=x.InvalidModifierOnTypeMember},n){const o=(h,l,p,d)=>{l===p&&n[d]&&this.raise(x.InvalidModifiersOrder,h,{orderedModifiers:[p,d]})},c=(h,l,p,d)=>{(n[p]&&l===d||n[d]&&l===p)&&this.raise(x.IncompatibleModifiers,h,{modifiers:[p,d]})};for(;;){const{startLoc:h}=this.state,l=this.tsParseModifier(e.concat(s??[]),i,n.static);if(!l)break;Gs(l)?n.accessibility?this.raise(x.DuplicateAccessibilityModifier,h,{modifier:l}):(o(h,l,l,"override"),o(h,l,l,"static"),o(h,l,l,"readonly"),n.accessibility=l):Ka(l)?(n[l]&&this.raise(x.DuplicateModifier,h,{modifier:l}),n[l]=!0,o(h,l,"in","out")):(Object.hasOwn(n,l)?this.raise(x.DuplicateModifier,h,{modifier:l}):(o(h,l,"static","readonly"),o(h,l,"static","override"),o(h,l,"override","readonly"),o(h,l,"abstract","override"),c(h,l,"declare","override"),c(h,l,"static","abstract")),n[l]=!0),s?.includes(l)&&this.raise(a,h,{modifier:l})}}tsIsListTerminator(e){switch(e){case"EnumMembers":case"TypeMembers":return this.match(8);case"HeritageClauseElement":return this.match(5);case"TupleElementTypes":return this.match(3);case"TypeParametersOrArguments":return this.match(48)}}tsParseList(e,s){const i=[];for(;!this.tsIsListTerminator(e);)i.push(s());return i}tsParseDelimitedList(e,s,i){return Va(this.tsParseDelimitedListWorker(e,s,!0,i))}tsParseDelimitedListWorker(e,s,i,a){const n=[];let o=-1;for(;!this.tsIsListTerminator(e);){o=-1;const c=s();if(c==null)return;if(n.push(c),this.eat(12)){o=this.state.lastTokStartLoc.index;continue}if(this.tsIsListTerminator(e))break;i&&this.expect(12);return}return a&&(a.value=o),n}tsParseBracketedList(e,s,i,a,n){a||(i?this.expect(0):this.expect(47));const o=this.tsParseDelimitedList(e,s,n);return i?this.expect(3):this.expect(48),o}tsParseImportType(){const e=this.startNode();return this.expect(83),this.expect(10),this.match(134)?e.argument=this.tsParseLiteralTypeNode():(this.raise(x.UnsupportedImportTypeArgument,this.state.startLoc),e.argument=this.tsParseNonConditionalType()),this.eat(12)?e.options=this.tsParseImportTypeOptions():e.options=null,this.expect(11),this.eat(16)&&(e.qualifier=this.tsParseEntityName(3)),this.match(47)&&(e.typeArguments=this.tsParseTypeArguments()),this.finishNode(e,"TSImportType")}tsParseImportTypeOptions(){const e=this.startNode();this.expect(5);const s=this.startNode();return this.isContextual(76)?(s.method=!1,s.key=this.parseIdentifier(!0),s.computed=!1,s.shorthand=!1):this.unexpected(null,76),this.expect(14),s.value=this.tsParseImportTypeWithPropertyValue(),e.properties=[this.finishObjectProperty(s)],this.expect(8),this.finishNode(e,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){const e=this.startNode(),s=[];for(this.expect(5);!this.match(8);){const i=this.state.type;C(i)||i===134?s.push(super.parsePropertyDefinition(null)):this.unexpected(),this.eat(12)}return e.properties=s,this.next(),this.finishNode(e,"ObjectExpression")}tsParseEntityName(e){let s;if(e&1&&this.match(78))if(e&2)s=this.parseIdentifier(!0);else{const i=this.startNode();this.next(),s=this.finishNode(i,"ThisExpression")}else s=this.parseIdentifier(!!(e&1));for(;this.eat(16);){const i=this.startNodeAtNode(s);i.left=s,i.right=this.parseIdentifier(!!(e&1)),s=this.finishNode(i,"TSQualifiedName")}return s}tsParseTypeReference(){const e=this.startNode();return e.typeName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(47)&&(e.typeArguments=this.tsParseTypeArguments()),this.finishNode(e,"TSTypeReference")}tsParseThisTypePredicate(e){this.next();const s=this.startNodeAtNode(e);return s.parameterName=e,s.typeAnnotation=this.tsParseTypeAnnotation(!1),s.asserts=!1,this.finishNode(s,"TSTypePredicate")}tsParseThisTypeNode(){const e=this.startNode();return this.next(),this.finishNode(e,"TSThisType")}tsParseTypeQuery(){const e=this.startNode();return this.expect(87),this.match(83)?e.exprName=this.tsParseImportType():e.exprName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(47)&&(e.typeArguments=this.tsParseTypeArguments()),this.finishNode(e,"TSTypeQuery")}tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:x.InvalidModifierOnTypeParameter});tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:x.InvalidModifierOnTypeParameterPositions});tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:x.InvalidModifierOnTypeParameter});tsParseTypeParameter(e){const s=this.startNode();return e(s),s.name=this.tsParseTypeParameterName(),s.constraint=this.tsEatThenParseType(81),s.default=this.tsEatThenParseType(29),this.finishNode(s,"TSTypeParameter")}tsTryParseTypeParameters(e){if(this.match(47))return this.tsParseTypeParameters(e)}tsParseTypeParameters(e){const s=this.startNode();this.match(47)||this.match(143)?this.next():this.unexpected();const i={value:-1};return s.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,e),!1,!0,i),s.params.length===0&&this.raise(x.EmptyTypeParameters,s),i.value!==-1&&this.addExtra(s,"trailingComma",i.value),this.finishNode(s,"TSTypeParameterDeclaration")}tsFillSignature(e,s){const i=e===19,a="params",n="returnType";s.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(10),s[a]=this.tsParseBindingListForSignature(),i?s[n]=this.tsParseTypeOrTypePredicateAnnotation(e):this.match(e)&&(s[n]=this.tsParseTypeOrTypePredicateAnnotation(e))}tsParseBindingListForSignature(){const e=super.parseBindingList(11,41,2);for(const s of e){const{type:i}=s;(i==="AssignmentPattern"||i==="TSParameterProperty")&&this.raise(x.UnsupportedSignatureParameterKind,s,{type:i})}return e}tsParseTypeMemberSemicolon(){!this.eat(12)&&!this.isLineTerminator()&&this.expect(13)}tsParseSignatureMember(e,s){return this.tsFillSignature(14,s),this.tsParseTypeMemberSemicolon(),this.finishNode(s,e)}tsIsUnambiguouslyIndexSignature(){return this.next(),C(this.state.type)?(this.next(),this.match(14)):!1}tsTryParseIndexSignature(e){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);const s=this.parseIdentifier();s.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(s),this.expect(3),e.parameters=[s];const i=this.tsTryParseTypeAnnotation();return i&&(e.typeAnnotation=i),this.tsParseTypeMemberSemicolon(),this.finishNode(e,"TSIndexSignature")}tsParsePropertyOrMethodSignature(e,s){if(this.eat(17)&&(e.optional=!0),this.match(10)||this.match(47)){s&&this.raise(x.ReadonlyForMethodSignature,e);const i=e;i.kind&&this.match(47)&&this.raise(x.AccessorCannotHaveTypeParameters,this.state.curPosition()),this.tsFillSignature(14,i),this.tsParseTypeMemberSemicolon();const a="params",n="returnType";if(i.kind==="get")i[a].length>0&&(this.raise(u.BadGetterArity,this.state.curPosition()),this.isThisParam(i[a][0])&&this.raise(x.AccessorCannotDeclareThisParameter,this.state.curPosition()));else if(i.kind==="set"){if(i[a].length!==1)this.raise(u.BadSetterArity,this.state.curPosition());else{const o=i[a][0];this.isThisParam(o)&&this.raise(x.AccessorCannotDeclareThisParameter,this.state.curPosition()),o.type==="Identifier"&&o.optional&&this.raise(x.SetAccessorCannotHaveOptionalParameter,this.state.curPosition()),o.type==="RestElement"&&this.raise(x.SetAccessorCannotHaveRestParameter,this.state.curPosition())}i[n]&&this.raise(x.SetAccessorCannotHaveReturnType,i[n])}else i.kind="method";return this.finishNode(i,"TSMethodSignature")}else{const i=e;s&&(i.readonly=!0);const a=this.tsTryParseTypeAnnotation();return a&&(i.typeAnnotation=a),this.tsParseTypeMemberSemicolon(),this.finishNode(i,"TSPropertySignature")}}tsParseTypeMember(){const e=this.startNode();if(this.match(10)||this.match(47))return this.tsParseSignatureMember("TSCallSignatureDeclaration",e);if(this.match(77)){const i=this.startNode();return this.next(),this.match(10)||this.match(47)?this.tsParseSignatureMember("TSConstructSignatureDeclaration",e):(e.key=this.createIdentifier(i,"new"),this.tsParsePropertyOrMethodSignature(e,!1))}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},e);const s=this.tsTryParseIndexSignature(e);return s||(super.parsePropertyName(e),!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.tsTokenCanFollowModifier()&&(e.kind=e.key.name,super.parsePropertyName(e),!this.match(10)&&!this.match(47)&&this.unexpected(null,10)),this.tsParsePropertyOrMethodSignature(e,!!e.readonly))}tsParseTypeLiteral(){const e=this.startNode();return e.members=this.tsParseObjectTypeMembers(),this.finishNode(e,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(5);const e=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(8),e}tsIsStartOfMappedType(){return this.next(),this.eat(53)?this.isContextual(122):(this.isContextual(122)&&this.next(),!this.match(0)||(this.next(),!this.tsIsIdentifier())?!1:(this.next(),this.match(58)))}tsParseMappedType(){const e=this.startNode();return this.expect(5),this.match(53)?(e.readonly=this.state.value,this.next(),this.expectContextual(122)):this.eatContextual(122)&&(e.readonly=!0),this.expect(0),e.key=this.tsParseTypeParameterName(),e.constraint=this.tsExpectThenParseType(58),e.nameType=this.eatContextual(93)?this.tsParseType():null,this.expect(3),this.match(53)?(e.optional=this.state.value,this.next(),this.expect(17)):this.eat(17)&&(e.optional=!0),e.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(8),this.finishNode(e,"TSMappedType")}tsParseTupleType(){const e=this.startNode();e.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let s=!1;return e.elementTypes.forEach(i=>{const{type:a}=i;s&&a!=="TSRestType"&&a!=="TSOptionalType"&&!(a==="TSNamedTupleMember"&&i.optional)&&this.raise(x.OptionalTypeBeforeRequired,i),s||=a==="TSNamedTupleMember"&&i.optional||a==="TSOptionalType"}),this.finishNode(e,"TSTupleType")}tsParseTupleElementType(){const e=this.state.startLoc,s=this.eat(21),{startLoc:i}=this.state;let a,n,o,c;const l=Q(this.state.type)?this.lookaheadCharCode():null;if(l===58)a=!0,o=!1,n=this.parseIdentifier(!0),this.expect(14),c=this.tsParseType();else if(l===63){o=!0;const p=this.state.value,d=this.tsParseNonArrayType();this.lookaheadCharCode()===58?(a=!0,n=this.createIdentifier(this.startNodeAt(i),p),this.expect(17),this.expect(14),c=this.tsParseType()):(a=!1,c=d,this.expect(17))}else c=this.tsParseType(),o=this.eat(17),a=this.eat(14);if(a){let p;n?(p=this.startNodeAt(i),p.optional=o,p.label=n,p.elementType=c,this.eat(17)&&(p.optional=!0,this.raise(x.TupleOptionalAfterType,this.state.lastTokStartLoc))):(p=this.startNodeAt(i),p.optional=o,this.raise(x.InvalidTupleMemberLabel,c),p.label=c,p.elementType=this.tsParseType()),c=this.finishNode(p,"TSNamedTupleMember")}else if(o){const p=this.startNodeAt(i);p.typeAnnotation=c,c=this.finishNode(p,"TSOptionalType")}if(s){const p=this.startNodeAt(e);p.typeAnnotation=c,c=this.finishNode(p,"TSRestType")}return c}tsParseParenthesizedType(){const e=this.startNode();return this.expect(10),e.typeAnnotation=this.tsParseType(),this.expect(11),this.finishNode(e,"TSParenthesizedType")}tsParseFunctionOrConstructorType(e,s){const i=this.startNode();return e==="TSConstructorType"&&(i.abstract=!!s,s&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(19,i)),this.finishNode(i,e)}tsParseLiteralTypeNode(){const e=this.startNode();switch(this.state.type){case 135:case 136:case 134:case 85:case 86:e.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(e,"TSLiteralType")}tsParseTemplateLiteralType(){{const e=this.state.startLoc;let s=this.parseTemplateElement(!1);const i=[s];if(s.tail){const a=this.startNodeAt(e),n=this.startNodeAt(e);return n.expressions=[],n.quasis=i,a.literal=this.finishNode(n,"TemplateLiteral"),this.finishNode(a,"TSLiteralType")}else{const a=[];for(;!s.tail;)a.push(this.tsParseType()),this.readTemplateContinuation(),i.push(s=this.parseTemplateElement(!1));const n=this.startNodeAt(e);return n.types=a,n.quasis=i,this.finishNode(n,"TSTemplateLiteralType")}}}parseTemplateSubstitution(){return this.state.inType?this.tsParseType():super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){const e=this.tsParseThisTypeNode();return this.isContextual(116)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(e):e}tsParseNonArrayType(){switch(this.state.type){case 134:case 135:case 136:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value==="-"){const e=this.startNode(),s=this.lookahead();return s.type!==135&&s.type!==136&&this.unexpected(),e.literal=this.parseMaybeUnary(),this.finishNode(e,"TSLiteralType")}break;case 78:return this.tsParseThisTypeOrThisTypePredicate();case 87:return this.tsParseTypeQuery();case 83:return this.tsParseImportType();case 5:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 10:if(!(this.optionFlags&1024)){const e=this.state.startLoc;this.next();const s=this.tsParseType();return this.expect(11),this.addExtra(s,"parenthesized",!0),this.addExtra(s,"parenStart",e.index),s}return this.tsParseParenthesizedType();case 25:case 24:return this.tsParseTemplateLiteralType();default:{const{type:e}=this.state;if(C(e)||e===88||e===84){const s=e===88?"TSVoidKeyword":e===84?"TSNullKeyword":Ha(this.state.value);if(s!==void 0&&this.lookaheadCharCode()!==46){const i=this.startNode();return this.next(),this.finishNode(i,s)}return this.tsParseTypeReference()}}}this.unexpected()}tsParseArrayTypeOrHigher(){const{startLoc:e}=this.state;let s=this.tsParseNonArrayType();for(;!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(3)){const i=this.startNodeAt(e);i.elementType=s,this.expect(3),s=this.finishNode(i,"TSArrayType")}else{const i=this.startNodeAt(e);i.objectType=s,i.indexType=this.tsParseType(),this.expect(3),s=this.finishNode(i,"TSIndexedAccessType")}return s}tsParseTypeOperator(){const e=this.startNode(),s=this.state.value;return this.next(),e.operator=s,e.typeAnnotation=this.tsParseTypeOperatorOrHigher(),s==="readonly"&&this.tsCheckTypeAnnotationForReadOnly(e),this.finishNode(e,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(e){switch(e.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(x.UnexpectedReadonly,e)}}tsParseInferType(){const e=this.startNode();this.expectContextual(115);const s=this.startNode();return s.name=this.tsParseTypeParameterName(),s.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),e.typeParameter=this.finishNode(s,"TSTypeParameter"),this.finishNode(e,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(81)){const e=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(17))return e}}tsParseTypeOperatorOrHigher(){return Zr(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(115)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(e,s,i){const a=this.startNode(),n=this.eat(i),o=[];do o.push(s());while(this.eat(i));return o.length===1&&!n?o[0]:(a.types=o,this.finishNode(a,e))}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),45)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),43)}tsIsStartOfFunctionType(){return this.match(47)?!0:this.match(10)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(C(this.state.type)||this.match(78))return this.next(),!0;if(this.match(5)){const{errors:e}=this.state,s=e.length;try{return this.parseObjectLike(8,!0),e.length===s}catch{return!1}}if(this.match(0)){this.next();const{errors:e}=this.state,s=e.length;try{return super.parseBindingList(3,93,1),e.length===s}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){return this.next(),!!(this.match(11)||this.match(21)||this.tsSkipParameterStart()&&(this.match(14)||this.match(12)||this.match(17)||this.match(29)||this.match(11)&&(this.next(),this.match(19))))}tsParseTypeOrTypePredicateAnnotation(e){return this.tsInType(()=>{const s=this.startNode();this.expect(e);const i=this.startNode(),a=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(a&&this.match(78)){let c=this.tsParseThisTypeOrThisTypePredicate();return c.type==="TSThisType"?(i.parameterName=c,i.asserts=!0,i.typeAnnotation=null,c=this.finishNode(i,"TSTypePredicate")):(this.resetStartLocationFromNode(c,i),c.asserts=!0),s.typeAnnotation=c,this.finishNode(s,"TSTypeAnnotation")}const n=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!n)return a?(i.parameterName=this.parseIdentifier(),i.asserts=a,i.typeAnnotation=null,s.typeAnnotation=this.finishNode(i,"TSTypePredicate"),this.finishNode(s,"TSTypeAnnotation")):this.tsParseTypeAnnotation(!1,s);const o=this.tsParseTypeAnnotation(!1);return i.parameterName=n,i.typeAnnotation=o,i.asserts=a,s.typeAnnotation=this.finishNode(i,"TSTypePredicate"),this.finishNode(s,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(14))return this.tsParseTypeOrTypePredicateAnnotation(14)}tsTryParseTypeAnnotation(){if(this.match(14))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(14)}tsParseTypePredicatePrefix(){const e=this.parseIdentifier();if(this.isContextual(116)&&!this.hasPrecedingLineBreak())return this.next(),e}tsParseTypePredicateAsserts(){if(this.state.type!==109)return!1;const e=this.state.containsEsc;return this.next(),!C(this.state.type)&&!this.match(78)?!1:(e&&this.raise(u.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"}),!0)}tsParseTypeAnnotation(e=!0,s=this.startNode()){return this.tsInType(()=>{e&&this.expect(14),s.typeAnnotation=this.tsParseType()}),this.finishNode(s,"TSTypeAnnotation")}tsParseType(){Js(this.state.inType);const e=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(81))return e;const s=this.startNodeAtNode(e);return s.checkType=e,s.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(17),s.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(14),s.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(s,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(124)&&this.lookahead().type===77}tsParseNonConditionalType(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(77)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(x.ReservedTypeAssertion,this.state.startLoc);const e=this.startNode();return e.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?this.tsParseTypeReference():this.tsParseType())),this.expect(48),e.expression=this.parseMaybeUnary(),this.finishNode(e,"TSTypeAssertion")}tsParseHeritageClause(e){const s=this.state.startLoc,i=this.tsParseDelimitedList("HeritageClauseElement",()=>{{const a=super.parseExprSubscripts();Xt(a)||this.raise(x.InvalidHeritageClauseType,a.loc.start,{token:e});const n=e==="extends"?"TSInterfaceHeritage":"TSClassImplements";if(a.type==="TSInstantiationExpression")return a.type=n,a;const o=this.startNodeAtNode(a);return o.expression=a,(this.match(47)||this.match(51))&&(o.typeArguments=this.tsParseTypeArgumentsInExpression()),this.finishNode(o,n)}});return i.length||this.raise(x.EmptyHeritageClauseType,s,{token:e}),i}tsParseInterfaceDeclaration(e,s={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(129),s.declare&&(e.declare=!0),C(this.state.type)?(e.id=this.parseIdentifier(),this.checkIdentifier(e.id,130)):(e.id=null,this.raise(x.MissingInterfaceName,this.state.startLoc)),e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(81)&&(e.extends=this.tsParseHeritageClause("extends"));const i=this.startNode();return i.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),e.body=this.finishNode(i,"TSInterfaceBody"),this.finishNode(e,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(e){return e.id=this.parseIdentifier(),this.checkIdentifier(e.id,2),e.typeAnnotation=this.tsInType(()=>{if(e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(29),this.isContextual(114)&&this.lookahead().type!==16){const s=this.startNode();return this.next(),this.finishNode(s,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(e,"TSTypeAliasDeclaration")}tsInTopLevelContext(e){if(this.curContext()!==L.brace){const s=this.state.context;this.state.context=[s[0]];try{return e()}finally{this.state.context=s}}else return e()}tsInType(e){const s=this.state.inType;this.state.inType=!0;try{return e()}finally{this.state.inType=s}}tsInDisallowConditionalTypesContext(e){const s=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return e()}finally{this.state.inDisallowConditionalTypesContext=s}}tsInAllowConditionalTypesContext(e){const s=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return e()}finally{this.state.inDisallowConditionalTypesContext=s}}tsEatThenParseType(e){if(this.match(e))return this.tsNextThenParseType()}tsExpectThenParseType(e){return this.tsInType(()=>(this.expect(e),this.tsParseType()))}tsNextThenParseType(){return this.tsInType(()=>(this.next(),this.tsParseType()))}tsParseEnumMember(){const e=this.startNode();return e.id=this.match(134)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(29)&&(e.initializer=super.parseMaybeAssignAllowIn()),this.finishNode(e,"TSEnumMember")}tsParseEnumDeclaration(e,s={}){return s.const&&(e.const=!0),s.declare&&(e.declare=!0),this.expectContextual(126),e.id=this.parseIdentifier(),this.checkIdentifier(e.id,e.const?8971:8459),e.body=this.tsParseEnumBody(),this.finishNode(e,"TSEnumDeclaration")}tsParseEnumBody(){const e=this.startNode();return this.expect(5),e.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(e,"TSEnumBody")}tsParseModuleBlock(){const e=this.startNode();return this.scope.enter(0),this.expect(5),super.parseBlockOrModuleBlockBody(e.body=[],void 0,!0,8),this.scope.exit(),this.finishNode(e,"TSModuleBlock")}tsParseModuleOrNamespaceDeclaration(e,s=!1){return e.id=this.tsParseEntityName(1),e.id.type==="Identifier"&&this.checkIdentifier(e.id,1024),this.scope.enter(512),this.prodParam.enter(0),e.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit(),this.finishNode(e,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(e){return this.isContextual(112)?(e.kind="global",e.id=this.parseIdentifier()):this.match(134)?(e.kind="module",e.id=super.parseStringLiteral(this.state.value)):this.unexpected(),this.match(5)?(this.scope.enter(512),this.prodParam.enter(0),e.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit()):this.semicolon(),this.finishNode(e,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(e,s,i){e.id=s||this.parseIdentifier(),this.checkIdentifier(e.id,4096),this.expect(29);const a=this.tsParseModuleReference();return e.importKind==="type"&&a.type!=="TSExternalModuleReference"&&this.raise(x.ImportAliasHasImportType,a),e.moduleReference=a,this.semicolon(),this.finishNode(e,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(119)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){const e=this.startNode();return this.expectContextual(119),this.expect(10),this.match(134)||this.unexpected(),e.expression=super.parseExprAtom(),this.expect(11),this.sawUnambiguousESM=!0,this.finishNode(e,"TSExternalModuleReference")}tsLookAhead(e){const s=this.state.clone(),i=e();return this.state=s,i}tsTryParseAndCatch(e){const s=this.tryParse(i=>e()||i());if(!(s.aborted||!s.node))return s.error&&(this.state=s.failState),s.node}tsTryParse(e){const s=this.state.clone(),i=e();if(i!==void 0&&i!==!1)return i;this.state=s}tsTryParseDeclare(e){if(this.isLineTerminator())return;let s=this.state.type,i;return this.isContextual(100)&&(s=74,i="let"),this.tsInAmbientContext(()=>{switch(s){case 68:return e.declare=!0,super.parseFunctionStatement(e,!1,!1);case 80:return e.declare=!0,this.parseClass(e,!0,!1);case 126:return this.tsParseEnumDeclaration(e,{declare:!0});case 112:return this.tsParseAmbientExternalModuleDeclaration(e);case 75:case 74:return!this.match(75)||!this.isLookaheadContextual("enum")?(e.declare=!0,this.parseVarStatement(e,i||this.state.value,!0)):(this.expect(75),this.tsParseEnumDeclaration(e,{const:!0,declare:!0}));case 129:{const a=this.tsParseInterfaceDeclaration(e,{declare:!0});if(a)return a}default:if(C(s))return this.tsParseDeclaration(e,this.state.value,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.value,!0,null)}tsParseExpressionStatement(e,s,i){switch(s.name){case"declare":{const a=this.tsTryParseDeclare(e);return a&&(a.declare=!0),a}case"global":if(this.match(5)){this.scope.enter(512),this.prodParam.enter(0);const a=e;return a.kind="global",a.id=s,a.body=this.tsParseModuleBlock(),this.scope.exit(),this.prodParam.exit(),this.finishNode(a,"TSModuleDeclaration")}break;default:return this.tsParseDeclaration(e,s.name,!1,i)}}tsParseDeclaration(e,s,i,a){switch(s){case"abstract":if(this.tsCheckLineTerminator(i)&&(this.match(80)||C(this.state.type)))return this.tsParseAbstractDeclaration(e,a);break;case"module":if(this.tsCheckLineTerminator(i)){if(this.match(134))return this.tsParseAmbientExternalModuleDeclaration(e);if(C(this.state.type))return e.kind="module",this.tsParseModuleOrNamespaceDeclaration(e)}break;case"namespace":if(this.tsCheckLineTerminator(i)&&C(this.state.type))return e.kind="namespace",this.tsParseModuleOrNamespaceDeclaration(e);break;case"type":if(this.tsCheckLineTerminator(i)&&C(this.state.type))return this.tsParseTypeAliasDeclaration(e);break}}tsCheckLineTerminator(e){return e?this.hasFollowingLineBreak()?!1:(this.next(),!0):!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(e){if(!this.match(47))return;const s=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=!0;const i=this.tsTryParseAndCatch(()=>{const a=this.startNodeAt(e);return a.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(a),a.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(19),a});if(this.state.maybeInArrowParameters=s,!!i)return super.parseArrowExpression(i,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()===47)return this.tsParseTypeArguments()}tsParseTypeArguments(){const e=this.startNode();return e.params=this.tsInType(()=>this.tsInTopLevelContext(()=>(this.expect(47),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))))),e.params.length===0?this.raise(x.EmptyTypeArguments,e):!this.state.inType&&this.curContext()===L.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(e,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return Qr(this.state.type)}isExportDefaultSpecifier(){return this.tsIsDeclarationStart()?!1:super.isExportDefaultSpecifier()}parseBindingElement(e,s){const i=s.length?s[0].loc.start:this.state.startLoc,a={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},a);const n=a.accessibility,o=a.override,c=a.readonly;!(e&4)&&(n||c||o)&&this.raise(x.UnexpectedParameterModifier,i);const h=this.parseMaybeDefault();e&2&&this.parseFunctionParamType(h);const l=this.parseMaybeDefault(h.loc.start,h);if(n||c||o){const p=this.startNodeAt(i);return s.length&&(p.decorators=s),n&&(p.accessibility=n),c&&(p.readonly=c),o&&(p.override=o),l.type!=="Identifier"&&l.type!=="AssignmentPattern"&&this.raise(x.UnsupportedParameterPropertyKind,p),p.parameter=l,this.finishNode(p,"TSParameterProperty")}return s.length&&(h.decorators=s),l}isSimpleParameter(e){return e.type==="TSParameterProperty"&&super.isSimpleParameter(e.parameter)||super.isSimpleParameter(e)}tsDisallowOptionalPattern(e){for(const s of e.params)s.type!=="Identifier"&&s.optional&&!this.state.isAmbientContext&&this.raise(x.PatternIsOptional,s)}setArrowFunctionParameters(e,s,i){super.setArrowFunctionParameters(e,s,i),this.tsDisallowOptionalPattern(e)}parseFunctionBodyAndFinish(e,s,i=!1){this.match(14)&&(e.returnType=this.tsParseTypeOrTypePredicateAnnotation(14));const a=s==="FunctionDeclaration"?"TSDeclareFunction":s==="ClassMethod"||s==="ClassPrivateMethod"?"TSDeclareMethod":void 0;return a&&!this.match(5)&&this.isLineTerminator()?this.finishNode(e,a):a==="TSDeclareFunction"&&this.state.isAmbientContext&&(this.raise(x.DeclareFunctionHasImplementation,e),e.declare)?super.parseFunctionBodyAndFinish(e,a,i):(this.tsDisallowOptionalPattern(e),super.parseFunctionBodyAndFinish(e,s,i))}registerFunctionStatementId(e){!e.body&&e.id?this.checkIdentifier(e.id,1024):super.registerFunctionStatementId(e)}tsCheckForInvalidTypeCasts(e){e.forEach(s=>{s?.type==="TSTypeCastExpression"&&this.raise(x.UnexpectedTypeAnnotation,s.typeAnnotation)})}toReferencedList(e,s){return this.tsCheckForInvalidTypeCasts(e),e}parseArrayLike(e,s,i,a){const n=super.parseArrayLike(e,s,i,a);return n.type==="ArrayExpression"&&this.tsCheckForInvalidTypeCasts(n.elements),n}parseSubscript(e,s,i,a){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=!1,this.next();const o=this.startNodeAt(s);return o.expression=e,this.finishNode(o,"TSNonNullExpression")}let n=!1;if(this.match(18)&&this.lookaheadCharCode()===60){if(i)return a.stop=!0,e;a.optionalChainMember=n=!0,this.next()}if(this.match(47)||this.match(51)){let o;const c=this.tsTryParseAndCatch(()=>{if(!i&&this.atPossibleAsyncArrow(e)){const d=this.tsTryParseGenericAsyncArrowFunction(s);if(d)return d}const h=this.tsParseTypeArgumentsInExpression();if(!h)return;if(n&&!this.match(10)){o=this.state.curPosition();return}if(jt(this.state.type)){const d=super.parseTaggedTemplateExpression(e,s,a);return d.typeArguments=h,d}if(!i&&this.eat(10)){const d=this.startNodeAt(s);return d.callee=e,d.arguments=this.parseCallExpressionArguments(11),this.tsCheckForInvalidTypeCasts(d.arguments),d.typeArguments=h,a.optionalChainMember&&(d.optional=n),this.finishCallExpression(d,a.optionalChainMember)}const l=this.state.type;if(l===48||l===52||l!==10&&He(l)&&!this.hasPrecedingLineBreak())return;const p=this.startNodeAt(s);return p.expression=e,p.typeArguments=h,this.finishNode(p,"TSInstantiationExpression")});if(o&&this.unexpected(o,10),c)return c.type==="TSInstantiationExpression"&&((this.match(16)||this.match(18)&&this.lookaheadCharCode()!==40)&&this.raise(x.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc),!this.match(16)&&!this.match(18)&&(c.expression=super.stopParseSubscript(e,a))),c}return super.parseSubscript(e,s,i,a)}parseNewCallee(e){super.parseNewCallee(e);const{callee:s}=e;s.type==="TSInstantiationExpression"&&!s.extra?.parenthesized&&(e.typeArguments=s.typeArguments,e.callee=s.expression)}parseExprOp(e,s,i){let a;if(nt(58)>i&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(a=this.isContextual(120)))){const n=this.startNodeAt(s);return n.expression=e,n.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?(a&&this.raise(u.UnexpectedKeyword,this.state.startLoc,{keyword:"const"}),this.tsParseTypeReference()):this.tsParseType())),this.finishNode(n,a?"TSSatisfiesExpression":"TSAsExpression"),this.reScan_lt_gt(),this.parseExprOp(n,s,i)}return super.parseExprOp(e,s,i)}checkReservedWord(e,s,i,a){this.state.isAmbientContext||super.checkReservedWord(e,s,i,a)}checkImportReflection(e){super.checkImportReflection(e),e.module&&e.importKind!=="value"&&this.raise(x.ImportReflectionHasImportType,e.specifiers[0].loc.start)}checkDuplicateExports(){}isPotentialImportPhase(e){if(super.isPotentialImportPhase(e))return!0;if(this.isContextual(130)){const s=this.lookaheadCharCode();return e?s===123||s===42:s!==61}return!e&&this.isContextual(87)}applyImportPhase(e,s,i,a){super.applyImportPhase(e,s,i,a),s?e.exportKind=i==="type"?"type":"value":e.importKind=i==="type"||i==="typeof"?i:"value"}parseImport(e){if(this.match(134))return e.importKind="value",super.parseImport(e);let s;if(C(this.state.type)&&this.lookaheadCharCode()===61)return e.importKind="value",this.tsParseImportEqualsDeclaration(e);if(this.isContextual(130)){const i=this.parseMaybeImportPhase(e,!1);if(this.lookaheadCharCode()===61)return this.tsParseImportEqualsDeclaration(e,i);s=super.parseImportSpecifiersAndAfter(e,i)}else s=super.parseImport(e);return s.importKind==="type"&&s.specifiers.length>1&&s.specifiers[0].type==="ImportDefaultSpecifier"&&this.raise(x.TypeImportCannotSpecifyDefaultAndNamed,s),s}parseExport(e,s){if(this.match(83)){const i=this.startNode();this.next();let a=null;this.isContextual(130)&&this.isPotentialImportPhase(!1)?a=this.parseMaybeImportPhase(i,!1):i.importKind="value";const n=this.tsParseImportEqualsDeclaration(i,a,!0);return e.attributes=[],e.declaration=n,e.exportKind="value",e.source=null,e.specifiers=[],this.finishNode(e,"ExportNamedDeclaration")}else if(this.eat(29)){const i=e;return i.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(i,"TSExportAssignment")}else if(this.eatContextual(93)){const i=e;return this.expectContextual(128),i.id=this.parseIdentifier(),this.semicolon(),this.finishNode(i,"TSNamespaceExportDeclaration")}else return super.parseExport(e,s)}isAbstractClass(){return this.isContextual(124)&&this.lookahead().type===80}parseExportDefaultExpression(){if(this.isAbstractClass()){const e=this.startNode();return this.next(),e.abstract=!0,this.parseClass(e,!0,!0)}if(this.match(129)){const e=this.tsParseInterfaceDeclaration(this.startNode());if(e)return e}return super.parseExportDefaultExpression()}parseVarStatement(e,s,i=!1){const{isAmbientContext:a}=this.state,n=super.parseVarStatement(e,s,i||a);if(!a)return n;for(const{id:o,init:c}of n.declarations)c&&(s==="var"||s==="let"||o.typeAnnotation?this.raise(x.InitializerNotAllowedInAmbientContext,c):Ga(c,this.hasPlugin("estree"))||this.raise(x.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,c));return n}parseStatementContent(e,s){if(this.match(75)&&this.isLookaheadContextual("enum")){const i=this.startNode();return this.expect(75),this.tsParseEnumDeclaration(i,{const:!0})}if(this.isContextual(126))return this.tsParseEnumDeclaration(this.startNode());if(this.isContextual(129)){const i=this.tsParseInterfaceDeclaration(this.startNode());if(i)return i}return super.parseStatementContent(e,s)}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"])}tsHasSomeModifiers(e,s){return s.some(i=>Gs(i)?e.accessibility===i:!!e[i])}tsIsStartOfStaticBlocks(){return this.isContextual(106)&&this.lookaheadCharCode()===123}parseClassMember(e,s,i){const a=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:a,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:!0,errorTemplate:x.InvalidModifierOnTypeParameterPositions},s);const n=()=>{this.tsIsStartOfStaticBlocks()?(this.next(),this.next(),this.tsHasSomeModifiers(s,a)&&this.raise(x.StaticBlockCannotHaveModifier,this.state.curPosition()),super.parseClassStaticBlock(e,s)):this.parseClassMemberWithIsStatic(e,s,i,!!s.static)};s.declare?this.tsInAmbientContext(n):n()}parseClassMemberWithIsStatic(e,s,i,a){const n=this.tsTryParseIndexSignature(s);if(n){e.body.push(n),s.abstract&&this.raise(x.IndexSignatureHasAbstract,s),s.accessibility&&this.raise(x.IndexSignatureHasAccessibility,s,{modifier:s.accessibility}),s.declare&&this.raise(x.IndexSignatureHasDeclare,s),s.override&&this.raise(x.IndexSignatureHasOverride,s);return}!this.state.inAbstractClass&&s.abstract&&this.raise(x.NonAbstractClassHasAbstractMethod,s),s.override&&(i.hadSuperClass||this.raise(x.OverrideNotInSubClass,s)),super.parseClassMemberWithIsStatic(e,s,i,a)}parsePostMemberNameModifiers(e){this.eat(17)&&(e.optional=!0),e.readonly&&this.match(10)&&this.raise(x.ClassMethodHasReadonly,e),e.declare&&this.match(10)&&this.raise(x.ClassMethodHasDeclare,e)}parseExpressionStatement(e,s,i){return(s.type==="Identifier"?this.tsParseExpressionStatement(e,s,i):void 0)||super.parseExpressionStatement(e,s,i)}shouldParseExportDeclaration(){return this.tsIsDeclarationStart()?!0:super.shouldParseExportDeclaration()}parseConditional(e,s,i){if(!this.match(17))return e;if(this.state.maybeInArrowParameters){const a=this.lookaheadCharCode();if(a===44||a===61||a===58||a===41)return this.setOptionalParametersError(i),e}return super.parseConditional(e,s,i)}parseParenItem(e,s){const i=super.parseParenItem(e,s);if(this.eat(17)&&(i.optional=!0,this.resetEndLocation(e)),this.match(14)){const a=this.startNodeAt(s);return a.expression=e,a.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(a,"TSTypeCastExpression")}return e}parseExportDeclaration(e){if(!this.state.isAmbientContext&&this.isContextual(125))return this.tsInAmbientContext(()=>this.parseExportDeclaration(e));const s=this.state.startLoc,i=this.eatContextual(125);if(i&&(this.isContextual(125)||!this.shouldParseExportDeclaration()))throw this.raise(x.ExpectedAmbientAfterExportDeclare,this.state.startLoc);const n=C(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(e);return n?((n.type==="TSInterfaceDeclaration"||n.type==="TSTypeAliasDeclaration"||i)&&(e.exportKind="type"),i&&n.type!=="TSImportEqualsDeclaration"&&(this.resetStartLocation(n,s),n.declare=!0),n):null}parseClassId(e,s,i,a){if((!s||i)&&this.isContextual(113))return;super.parseClassId(e,s,i,e.declare?1024:8331);const n=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);n&&(e.typeParameters=n)}parseClassPropertyAnnotation(e){e.optional||(this.eat(35)?e.definite=!0:this.eat(17)&&(e.optional=!0));const s=this.tsTryParseTypeAnnotation();s&&(e.typeAnnotation=s)}parseClassProperty(e){if(this.parseClassPropertyAnnotation(e),this.state.isAmbientContext&&!(e.readonly&&!e.typeAnnotation)&&this.match(29)&&this.raise(x.DeclareClassFieldHasInitializer,this.state.startLoc),e.abstract&&this.match(29)){const{key:s}=e;this.raise(x.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:s.type==="Identifier"&&!e.computed?s.name:`[${this.input.slice(this.offsetToSourcePos(s.start),this.offsetToSourcePos(s.end))}]`})}return super.parseClassProperty(e)}parseClassPrivateProperty(e){return e.abstract&&this.raise(x.PrivateElementHasAbstract,e),e.accessibility&&this.raise(x.PrivateElementHasAccessibility,e,{modifier:e.accessibility}),this.parseClassPropertyAnnotation(e),super.parseClassPrivateProperty(e)}parseClassAccessorProperty(e){return this.parseClassPropertyAnnotation(e),e.optional&&this.raise(x.AccessorCannotBeOptional,e),super.parseClassAccessorProperty(e)}pushClassMethod(e,s,i,a,n,o){const c=this.tsTryParseTypeParameters(this.tsParseConstModifier);c&&n&&this.raise(x.ConstructorHasTypeParameters,c);const{declare:h=!1,kind:l}=s;h&&(l==="get"||l==="set")&&this.raise(x.DeclareAccessor,s,{kind:l}),c&&(s.typeParameters=c),super.pushClassMethod(e,s,i,a,n,o)}pushClassPrivateMethod(e,s,i,a){const n=this.tsTryParseTypeParameters(this.tsParseConstModifier);n&&(s.typeParameters=n),super.pushClassPrivateMethod(e,s,i,a)}declareClassPrivateMethodInScope(e,s){e.type!=="TSDeclareMethod"&&(e.type==="MethodDefinition"&&e.value.body==null||super.declareClassPrivateMethodInScope(e,s))}parseClassSuper(e){super.parseClassSuper(e),e.superClass&&(this.match(47)||this.match(51))&&(e.superTypeArguments=this.tsParseTypeArgumentsInExpression()),this.eatContextual(113)&&(e.implements=this.tsParseHeritageClause("implements"))}parseObjPropValue(e,s,i,a,n,o,c){const h=this.tsTryParseTypeParameters(this.tsParseConstModifier);return h&&(e.typeParameters=h),super.parseObjPropValue(e,s,i,a,n,o,c)}parseFunctionParams(e,s){const i=this.tsTryParseTypeParameters(this.tsParseConstModifier);i&&(e.typeParameters=i),super.parseFunctionParams(e,s)}parseVarId(e,s){super.parseVarId(e,s),e.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(35)&&(e.definite=!0);const i=this.tsTryParseTypeAnnotation();i&&(e.id.typeAnnotation=i,this.resetEndLocation(e.id))}parseAsyncArrowFromCallExpression(e,s){return this.match(14)&&(e.returnType=this.tsParseTypeAnnotation()),super.parseAsyncArrowFromCallExpression(e,s)}parseMaybeAssign(e,s){let i,a,n;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(i=this.state.clone(),a=this.tryParse(()=>super.parseMaybeAssign(e,s),i),!a.error)return a.node;const{context:h}=this.state,l=h[h.length-1];(l===L.j_oTag||l===L.j_expr)&&h.pop()}if(!a?.error&&!this.match(47))return super.parseMaybeAssign(e,s);(!i||i===this.state)&&(i=this.state.clone());let o;const c=this.tryParse(h=>{o=this.tsParseTypeParameters(this.tsParseConstModifier);const l=super.parseMaybeAssign(e,s);if((l.type!=="ArrowFunctionExpression"||l.extra?.parenthesized)&&h(),o?.params.length!==0&&this.resetStartLocationFromNode(l,o),l.typeParameters=o,this.hasPlugin("jsx")&&l.typeParameters.params.length===1&&!l.typeParameters.extra?.trailingComma){const p=l.typeParameters.params[0];p.constraint||this.raise(x.SingleTypeParameterWithoutTrailingComma,Y(p.loc.end,1),{typeParameterName:p.name.name})}return l},i);if(!c.error&&!c.aborted)return o&&this.reportReservedArrowTypeParam(o),c.node;if(!a&&(Js(!this.hasPlugin("jsx")),n=this.tryParse(()=>super.parseMaybeAssign(e,s),i),!n.error))return n.node;if(a?.node)return this.state=a.failState,a.node;if(c.node)return this.state=c.failState,o&&this.reportReservedArrowTypeParam(o),c.node;if(n?.node)return this.state=n.failState,n.node;throw a?.error||c.error||n?.error}reportReservedArrowTypeParam(e){e.params.length===1&&!e.params[0].constraint&&!e.extra?.trailingComma&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(x.ReservedArrowTypeParam,e)}parseMaybeUnary(e,s){return!this.hasPlugin("jsx")&&this.match(47)?this.tsParseTypeAssertion():super.parseMaybeUnary(e,s)}parseArrow(e){if(this.match(14)){const s=this.tryParse(i=>{const a=this.tsParseTypeOrTypePredicateAnnotation(14);return(this.canInsertSemicolon()||!this.match(19))&&i(),a});if(s.aborted)return;s.thrown||(s.error&&(this.state=s.failState),e.returnType=s.node)}return super.parseArrow(e)}parseFunctionParamType(e){this.eat(17)&&(e.optional=!0);const s=this.tsTryParseTypeAnnotation();return s&&(e.typeAnnotation=s),this.resetEndLocation(e),e}isAssignable(e,s){switch(e.type){case"TSTypeCastExpression":return this.isAssignable(e.expression,s);case"TSParameterProperty":return!0;default:return super.isAssignable(e,s)}}toAssignable(e,s=!1){switch(e.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(e,s);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":s?this.expressionScope.recordArrowParameterBindingError(x.UnexpectedTypeCastInParameter,e):this.raise(x.UnexpectedTypeCastInParameter,e),this.toAssignable(e.expression,s);break;case"AssignmentExpression":!s&&e.left.type==="TSTypeCastExpression"&&(e.left=this.typeCastToParameter(e.left));default:super.toAssignable(e,s)}}toAssignableParenthesizedExpression(e,s){switch(e.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(e.expression,s);break;default:super.toAssignable(e,s)}}checkToRestConversion(e,s){switch(e.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(e.expression,!1);break;default:super.checkToRestConversion(e,s)}}isValidLVal(e,s,i){switch(e){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(i!==64||!s)&&["expression",!0];default:return super.isValidLVal(e,s,i)}}parseBindingAtom(){return this.state.type===78?this.parseIdentifier(!0):super.parseBindingAtom()}parseMaybeDecoratorArguments(e,s){if(this.match(47)||this.match(51)){const i=this.tsParseTypeArgumentsInExpression();if(this.match(10)){const a=super.parseMaybeDecoratorArguments(e,s);return a.typeArguments=i,a}this.unexpected(null,10)}return super.parseMaybeDecoratorArguments(e,s)}checkCommaAfterRest(e){return this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===e?(this.next(),!1):super.checkCommaAfterRest(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty()}parseMaybeDefault(e,s){const i=super.parseMaybeDefault(e,s);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(x.TypeAnnotationAfterAssign,i.typeAnnotation),i}getTokenFromCode(e){if(this.state.inType){if(e===62){this.finishOp(48,1);return}if(e===60){this.finishOp(47,1);return}}super.getTokenFromCode(e)}reScan_lt_gt(){const{type:e}=this.state;e===47?(this.state.pos-=1,this.readToken_lt()):e===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){const{type:e}=this.state;return e===51?(this.state.pos-=2,this.finishOp(47,1),47):e}toAssignableListItem(e,s,i){const a=e[s];a.type==="TSTypeCastExpression"&&(e[s]=this.typeCastToParameter(a)),super.toAssignableListItem(e,s,i)}typeCastToParameter(e){return e.expression.typeAnnotation=e.typeAnnotation,this.resetEndLocation(e.expression,e.typeAnnotation.loc.end),e.expression}shouldParseArrow(e){return this.match(14)?e.every(s=>this.isAssignable(s,!0)):super.shouldParseArrow(e)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(e){if(this.match(47)||this.match(51)){const s=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());s&&(e.typeArguments=s)}return super.jsxParseOpeningElementAfterName(e)}getGetterSetterExpectedParamCount(e){const s=super.getGetterSetterExpectedParamCount(e),a=this.getObjectOrClassMethodParams(e)[0];return a&&this.isThisParam(a)?s+1:s}parseCatchClauseParam(){const e=super.parseCatchClauseParam(),s=this.tsTryParseTypeAnnotation();return s&&(e.typeAnnotation=s,this.resetEndLocation(e)),e}tsInAmbientContext(e){const{isAmbientContext:s,strict:i}=this.state;this.state.isAmbientContext=!0,this.state.strict=!1;try{return e()}finally{this.state.isAmbientContext=s,this.state.strict=i}}parseClass(e,s,i){const a=this.state.inAbstractClass;this.state.inAbstractClass=!!e.abstract;try{return super.parseClass(e,s,i)}finally{this.state.inAbstractClass=a}}tsParseAbstractDeclaration(e,s){if(this.match(80))return e.abstract=!0,this.maybeTakeDecorators(s,this.parseClass(e,!0,!1));if(this.isContextual(129)){if(!this.hasFollowingLineBreak())return e.abstract=!0,this.raise(x.NonClassMethodPropertyHasAbstractModifier,e),this.tsParseInterfaceDeclaration(e)}else this.unexpected(null,80)}parseMethod(e,s,i,a,n,o,c){const h=super.parseMethod(e,s,i,a,n,o,c);if((h.abstract||h.type==="TSAbstractMethodDefinition")&&(this.hasPlugin("estree")?h.value:h).body){const{key:d}=h;this.raise(x.AbstractMethodHasImplementation,h,{methodName:d.type==="Identifier"&&!h.computed?d.name:`[${this.input.slice(this.offsetToSourcePos(d.start),this.offsetToSourcePos(d.end))}]`})}return h}tsParseTypeParameterName(){return this.parseIdentifier()}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.parse()}getExpression(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.getExpression()}parseExportSpecifier(e,s,i,a){return!s&&a?(this.parseTypeOnlyImportExportSpecifier(e,!1,i),this.finishNode(e,"ExportSpecifier")):(e.exportKind="value",super.parseExportSpecifier(e,s,i,a))}parseImportSpecifier(e,s,i,a,n){return!s&&a?(this.parseTypeOnlyImportExportSpecifier(e,!0,i),this.finishNode(e,"ImportSpecifier")):(e.importKind="value",super.parseImportSpecifier(e,s,i,a,i?4098:4096))}parseTypeOnlyImportExportSpecifier(e,s,i){const a=s?"imported":"local",n=s?"local":"exported";let o=e[a],c,h=!1,l=!0;const p=o.loc.start;if(this.isContextual(93)){const f=this.parseIdentifier();if(this.isContextual(93)){const P=this.parseIdentifier();Q(this.state.type)?(h=!0,o=f,c=s?this.parseIdentifier():this.parseModuleExportName(),l=!1):(c=P,l=!1)}else Q(this.state.type)?(l=!1,c=s?this.parseIdentifier():this.parseModuleExportName()):(h=!0,o=f)}else Q(this.state.type)&&(h=!0,s?(o=this.parseIdentifier(!0),this.isContextual(93)||this.checkReservedWord(o.name,o.loc.start,!0,!0)):o=this.parseModuleExportName());h&&i&&this.raise(s?x.TypeModifierIsUsedInTypeImports:x.TypeModifierIsUsedInTypeExports,p),e[a]=o,e[n]=c;const d=s?"importKind":"exportKind";e[d]=h?"type":"value",l&&this.eatContextual(93)&&(e[n]=s?this.parseIdentifier():this.parseModuleExportName()),e[n]||(e[n]=this.cloneIdentifier(e[a])),s&&this.checkIdentifier(e[n],h?4098:4096)}fillOptionalPropertiesForTSESLint(e){switch(e.type){case"ExpressionStatement":e.directive??=void 0;return;case"RestElement":e.value=void 0;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":e.decorators??=[],e.optional??=!1,e.typeAnnotation??=void 0;return;case"TSParameterProperty":e.accessibility??=void 0,e.decorators??=[],e.override??=!1,e.readonly??=!1,e.static??=!1;return;case"TSEmptyBodyFunctionExpression":e.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":e.declare??=!1,e.returnType??=void 0,e.typeParameters??=void 0;return;case"Property":e.optional??=!1;return;case"TSMethodSignature":case"TSPropertySignature":e.optional??=!1;case"TSIndexSignature":e.accessibility??=void 0,e.readonly??=!1,e.static??=!1;return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":e.declare??=!1,e.definite??=!1,e.readonly??=!1,e.typeAnnotation??=void 0;case"TSAbstractMethodDefinition":case"MethodDefinition":e.accessibility??=void 0,e.decorators??=[],e.override??=!1,e.optional??=!1;return;case"ClassExpression":e.id??=null;case"ClassDeclaration":e.abstract??=!1,e.declare??=!1,e.decorators??=[],e.implements??=[],e.superTypeArguments??=void 0,e.typeParameters??=void 0;return;case"TSTypeAliasDeclaration":case"VariableDeclaration":e.declare??=!1;return;case"VariableDeclarator":e.definite??=!1;return;case"TSEnumDeclaration":e.const??=!1,e.declare??=!1;return;case"TSEnumMember":e.computed??=!1;return;case"TSImportType":e.qualifier??=null,e.options??=null,e.typeArguments??=null;return;case"TSInterfaceDeclaration":e.declare??=!1,e.extends??=[];return;case"TSModuleDeclaration":e.declare??=!1,e.global??=e.kind==="global";return;case"TSTypeParameter":e.const??=!1,e.in??=!1,e.out??=!1;return}}};function Ja(r){if(r.type!=="MemberExpression")return!1;const{computed:t,property:e}=r;return t&&e.type!=="StringLiteral"&&(e.type!=="TemplateLiteral"||e.expressions.length>0)?!1:Ys(r.object)}function Ga(r,t){const{type:e}=r;if(r.extra?.parenthesized)return!1;if(t){if(e==="Literal"){const{value:s}=r;if(typeof s=="string"||typeof s=="boolean")return!0}}else if(e==="StringLiteral"||e==="BooleanLiteral")return!0;return!!(Xs(r,t)||Xa(r,t)||e==="TemplateLiteral"&&r.expressions.length===0||Ja(r))}function Xs(r,t){return t?r.type==="Literal"&&(typeof r.value=="number"||"bigint"in r):r.type==="NumericLiteral"||r.type==="BigIntLiteral"}function Xa(r,t){if(r.type==="UnaryExpression"){const{operator:e,argument:s}=r;if(e==="-"&&Xs(s,t))return!0}return!1}function Ys(r){return r.type==="Identifier"?!0:r.type!=="MemberExpression"||r.computed?!1:Ys(r.object)}const Zs=re`placeholders`({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."});var Ya=r=>class extends r{parsePlaceholder(e){if(this.match(133)){const s=this.startNode();return this.next(),this.assertNoSpace(),s.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(133),this.finishPlaceholder(s,e)}}finishPlaceholder(e,s){let i=e;return(!i.expectedNode||!i.type)&&(i=this.finishNode(i,"Placeholder")),i.expectedNode=s,i}getTokenFromCode(e){e===37&&this.input.charCodeAt(this.state.pos+1)===37?this.finishOp(133,2):super.getTokenFromCode(e)}parseExprAtom(e){return this.parsePlaceholder("Expression")||super.parseExprAtom(e)}parseIdentifier(e){return this.parsePlaceholder("Identifier")||super.parseIdentifier(e)}checkReservedWord(e,s,i,a){e!==void 0&&super.checkReservedWord(e,s,i,a)}cloneIdentifier(e){const s=super.cloneIdentifier(e);return s.type==="Placeholder"&&(s.expectedNode=e.expectedNode),s}cloneStringLiteral(e){return e.type==="Placeholder"?this.cloneIdentifier(e):super.cloneStringLiteral(e)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(e,s,i){return e==="Placeholder"||super.isValidLVal(e,s,i)}toAssignable(e,s){e&&e.type==="Placeholder"&&e.expectedNode==="Expression"?e.expectedNode="Pattern":super.toAssignable(e,s)}chStartsBindingIdentifier(e,s){return!!(super.chStartsBindingIdentifier(e,s)||this.lookahead().type===133)}verifyBreakContinue(e,s){e.label&&e.label.type==="Placeholder"||super.verifyBreakContinue(e,s)}parseExpressionStatement(e,s){if(s.type!=="Placeholder"||s.extra?.parenthesized)return super.parseExpressionStatement(e,s);if(this.match(14)){const a=e;return a.label=this.finishPlaceholder(s,"Identifier"),this.next(),a.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(a,"LabeledStatement")}this.semicolon();const i=e;return i.name=s.name,this.finishPlaceholder(i,"Statement")}parseBlock(e,s,i){return this.parsePlaceholder("BlockStatement")||super.parseBlock(e,s,i)}parseFunctionId(e){return this.parsePlaceholder("Identifier")||super.parseFunctionId(e)}parseClass(e,s,i){const a=s?"ClassDeclaration":"ClassExpression";this.next();const n=this.state.strict,o=this.parsePlaceholder("Identifier");if(o)if(this.match(81)||this.match(133)||this.match(5))e.id=o;else{if(i||!s)return e.id=null,e.body=this.finishPlaceholder(o,"ClassBody"),this.finishNode(e,a);throw this.raise(Zs.ClassNameIsRequired,this.state.startLoc)}else this.parseClassId(e,s,i);return super.parseClassSuper(e),e.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!e.superClass,n),this.finishNode(e,a)}parseExport(e,s){const i=this.parsePlaceholder("Identifier");if(!i)return super.parseExport(e,s);const a=e;if(!this.isContextual(98)&&!this.match(12))return a.specifiers=[],a.source=null,a.declaration=this.finishPlaceholder(i,"Declaration"),this.finishNode(a,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");const n=this.startNode();return n.exported=i,a.specifiers=[this.finishNode(n,"ExportDefaultSpecifier")],super.parseExport(a,s)}isExportDefaultSpecifier(){if(this.match(65)){const e=this.nextTokenStart();if(this.isUnparsedContextual(e,"from")&&this.input.startsWith(ye(133),this.nextTokenStartSince(e+4)))return!0}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(e,s){return e.specifiers?.length?!0:super.maybeParseExportDefaultSpecifier(e,s)}checkExport(e){const{specifiers:s}=e;s?.length&&(e.specifiers=s.filter(i=>i.exported.type==="Placeholder")),super.checkExport(e),e.specifiers=s}parseImport(e){const s=this.parsePlaceholder("Identifier");if(!s)return super.parseImport(e);if(e.specifiers=[],!this.isContextual(98)&&!this.match(12))return e.source=this.finishPlaceholder(s,"StringLiteral"),this.semicolon(),this.finishNode(e,"ImportDeclaration");const i=this.startNodeAtNode(s);return i.local=s,e.specifiers.push(this.finishNode(i,"ImportDefaultSpecifier")),this.eat(12)&&(this.maybeParseStarImportSpecifier(e)||this.parseNamedImportSpecifiers(e)),this.expectContextual(98),e.source=this.parseImportSource(),this.semicolon(),this.finishNode(e,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index)&&this.raise(Zs.UnexpectedSpace,this.state.lastTokEndLoc)}},Za=r=>class extends r{parseV8Intrinsic(){if(this.match(54)){const e=this.state.startLoc,s=this.startNode();if(this.next(),C(this.state.type)){const i=this.parseIdentifierName(),a=this.createIdentifier(s,i);if(this.castNodeTo(a,"V8IntrinsicIdentifier"),this.match(10))return a}this.unexpected(e)}}parseExprAtom(e){return this.parseV8Intrinsic()||super.parseExprAtom(e)}};const Qs=["fsharp","hack"],ei=["^^","@@","^","%","#"];function Qa(r){if(r.has("decorators")){if(r.has("decorators-legacy"))throw new Error("Cannot use the decorators and decorators-legacy plugin together");const t=r.get("decorators").decoratorsBeforeExport;if(t!=null&&typeof t!="boolean")throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.");const e=r.get("decorators").allowCallParenthesized;if(e!=null&&typeof e!="boolean")throw new Error("'allowCallParenthesized' must be a boolean.")}if(r.has("flow")&&r.has("typescript"))throw new Error("Cannot combine flow and typescript plugins.");if(r.has("placeholders")&&r.has("v8intrinsic"))throw new Error("Cannot combine placeholders and v8intrinsic plugins.");if(r.has("pipelineOperator")){const t=r.get("pipelineOperator").proposal;if(!Qs.includes(t)){const e=Qs.map(s=>`"${s}"`).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${e}.`)}if(t==="hack"){if(r.has("placeholders"))throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");if(r.has("v8intrinsic"))throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");const e=r.get("pipelineOperator").topicToken;if(!ei.includes(e)){const s=ei.map(i=>`"${i}"`).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${s}.`)}}}if(r.has("moduleAttributes"))throw new Error("`moduleAttributes` has been removed in Babel 8, please migrate to import attributes instead.");if(r.has("importAssertions"))throw new Error("`importAssertions` has been removed in Babel 8, please use import attributes instead. To use the non-standard `assert` syntax you can enable the `deprecatedImportAssert` parser plugin.");if(!r.has("deprecatedImportAssert")&&r.has("importAttributes")&&r.get("importAttributes").deprecatedAssertSyntax)throw new Error("The 'importAttributes' plugin has been removed in Babel 8. If you need to enable support for the deprecated `assert` syntax, you can enable the `deprecatedImportAssert` parser plugin.");if(r.has("recordAndTuple"))throw new Error("The 'recordAndTuple' plugin has been removed in Babel 8. Please remove it from your configuration.");if(r.has("asyncDoExpressions")&&!r.has("doExpressions")){const t=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");throw t.missingPlugins="doExpressions",t}if(r.has("optionalChainingAssign")&&r.get("optionalChainingAssign").version!=="2023-07")throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is '2023-07'.");{if(r.has("decimal"))throw new Error("The 'decimal' plugin has been removed in Babel 8. Please remove it from your configuration.");if(r.has("importReflection"))throw new Error("The 'importReflection' plugin has been removed in Babel 8. Use 'sourcePhaseImports' instead, and replace 'import module' with 'import source' in your code.")}}const ti={estree:qr,jsx:Ta,flow:Pa,typescript:Wa,v8intrinsic:Za,placeholders:Ya},en=Object.keys(ti);class tn extends za{checkProto(t,e,s,i){if(t.type==="SpreadElement"||this.isObjectMethod(t)||t.computed||t.shorthand)return s;const a=t.key;return(a.type==="Identifier"?a.name:a.value)==="__proto__"?e?(this.raise(u.RecordNoProto,a),!0):(s&&(i?i.doubleProtoLoc===null&&(i.doubleProtoLoc=a.loc.start):this.raise(u.DuplicateProto,a)),!0):s}shouldExitDescending(t,e){return t.type==="ArrowFunctionExpression"&&this.offsetToSourcePos(t.start)===e}getExpression(){if(this.enterInitialScopes(),this.nextToken(),this.match(140))throw this.raise(u.ParseExpressionEmptyInput,this.state.startLoc);const t=this.parseExpression();if(!this.match(140))throw this.raise(u.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)});return this.finalizeRemainingComments(),t.comments=this.comments,t.errors=this.state.errors,this.optionFlags&256&&(t.tokens=this.tokens),t}parseExpression(t,e){return t?this.disallowInAnd(()=>this.parseExpressionBase(e)):this.allowInAnd(()=>this.parseExpressionBase(e))}parseExpressionBase(t){const e=this.state.startLoc,s=this.parseMaybeAssign(t);if(this.match(12)){const i=this.startNodeAt(e);for(i.expressions=[s];this.eat(12);)i.expressions.push(this.parseMaybeAssign(t));return this.toReferencedList(i.expressions),this.finishNode(i,"SequenceExpression")}return s}parseMaybeAssignDisallowIn(t,e){return this.disallowInAnd(()=>this.parseMaybeAssign(t,e))}parseMaybeAssignAllowIn(t,e){return this.allowInAnd(()=>this.parseMaybeAssign(t,e))}setOptionalParametersError(t){t.optionalParametersLoc=this.state.startLoc}parseMaybeAssign(t,e){const s=this.state.startLoc,i=this.isContextual(108);if(i&&this.prodParam.hasYield){this.next();let c=this.parseYield(s);return e&&(c=e.call(this,c,s)),c}let a;t?a=!1:(t=new ut,a=!0);const{type:n}=this.state;(n===10||C(n))&&(this.state.potentialArrowAt=this.state.start);let o=this.parseMaybeConditional(t);if(e&&(o=e.call(this,o,s)),Wr(this.state.type)){const c=this.startNodeAt(s),h=this.state.value;if(c.operator=h,this.match(29)){this.toAssignable(o,!0),c.left=o;const l=s.index;t.doubleProtoLoc!=null&&t.doubleProtoLoc.index>=l&&(t.doubleProtoLoc=null),t.shorthandAssignLoc!=null&&t.shorthandAssignLoc.index>=l&&(t.shorthandAssignLoc=null),t.privateKeyLoc!=null&&t.privateKeyLoc.index>=l&&(this.checkDestructuringPrivate(t),t.privateKeyLoc=null)}else c.left=o;return this.next(),c.right=this.parseMaybeAssign(),this.checkLVal(o,this.finishNode(c,"AssignmentExpression")),c}else a&&this.checkExpressionErrors(t,!0);if(i){const{type:c}=this.state;if((this.hasPlugin("v8intrinsic")?He(c):He(c)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(u.YieldNotInGeneratorFunction,s),this.parseYield(s)}return o}parseMaybeConditional(t){const e=this.state.startLoc,s=this.state.potentialArrowAt,i=this.parseExprOps(t);return this.shouldExitDescending(i,s)?i:this.parseConditional(i,e,t)}parseConditional(t,e,s){if(this.eat(17)){const i=this.startNodeAt(e);return i.test=t,i.consequent=this.parseMaybeAssignAllowIn(),this.expect(14),i.alternate=this.parseMaybeAssign(),this.finishNode(i,"ConditionalExpression")}return t}parseMaybeUnaryOrPrivate(t){return this.match(139)?this.parsePrivateName():this.parseMaybeUnary(t)}parseExprOps(t){const e=this.state.startLoc,s=this.state.potentialArrowAt,i=this.parseMaybeUnaryOrPrivate(t);return this.shouldExitDescending(i,s)?i:this.parseExprOp(i,e,-1)}parseExprOp(t,e,s){if(this.isPrivateName(t)){const a=this.getPrivateNameSV(t);(s>=nt(58)||!this.prodParam.hasIn||!this.match(58))&&this.raise(u.PrivateInExpectedIn,t,{identifierName:a}),this.classScope.usePrivateName(a,t.loc.start)}const i=this.state.type;if(Gr(i)&&(this.prodParam.hasIn||!this.match(58))){let a=nt(i);if(a>s){if(i===39){if(this.expectPlugin("pipelineOperator"),this.state.inFSharpPipelineDirectBody)return t;this.checkPipelineAtInfixOperator(t,e)}const n=this.startNodeAt(e);n.left=t,n.operator=this.state.value;const o=i===41||i===42,c=i===40;c&&(a=nt(42)),this.next(),n.right=this.parseExprOpRightExpr(i,a);const h=this.finishNode(n,o||c?"LogicalExpression":"BinaryExpression"),l=this.state.type;if(c&&(l===41||l===42)||o&&l===40)throw this.raise(u.MixingCoalesceWithLogical,this.state.startLoc);return this.parseExprOp(h,e,s)}}return t}parseExprOpRightExpr(t,e){switch(this.state.startLoc,t){case 39:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(()=>this.parseHackPipeBody());case"fsharp":return this.withSoloAwaitPermittingContext(()=>this.parseFSharpPipelineBody(e))}default:return this.parseExprOpBaseRightExpr(t,e)}}parseExprOpBaseRightExpr(t,e){const s=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),s,ea(t)?e-1:e)}parseHackPipeBody(){const{startLoc:t}=this.state,e=this.parseMaybeAssign();return Fr.has(e.type)&&!e.extra?.parenthesized&&this.raise(u.PipeUnparenthesizedBody,t,{type:e.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(u.PipeTopicUnused,t),e}checkExponentialAfterUnary(t){this.match(57)&&this.raise(u.UnexpectedTokenUnaryExponentiation,t.argument)}parseMaybeUnary(t,e){const s=this.state.startLoc,i=this.isContextual(96);if(i&&this.recordAwaitIfAllowed()){this.next();const c=this.parseAwait(s);return e||this.checkExponentialAfterUnary(c),c}const a=this.match(34),n=this.startNode();if(Yr(this.state.type)){n.operator=this.state.value,n.prefix=!0,this.match(72)&&this.expectPlugin("throwExpressions");const c=this.match(89);if(this.next(),n.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(t,!0),this.state.strict&&c){const h=n.argument;h.type==="Identifier"?this.raise(u.StrictDelete,n):this.hasPropertyAsPrivateName(h)&&this.raise(u.DeletePrivateField,n)}if(!a)return e||this.checkExponentialAfterUnary(n),this.finishNode(n,"UnaryExpression")}const o=this.parseUpdate(n,a,t);if(i){const{type:c}=this.state;if((this.hasPlugin("v8intrinsic")?He(c):He(c)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(u.AwaitNotInAsyncContext,s),this.parseAwait(s)}return o}parseUpdate(t,e,s){if(e){const n=t;return this.checkLVal(n.argument,this.finishNode(n,"UpdateExpression")),t}const i=this.state.startLoc;let a=this.parseExprSubscripts(s);if(this.checkExpressionErrors(s,!1))return a;for(;Xr(this.state.type)&&!this.canInsertSemicolon();){const n=this.startNodeAt(i);n.operator=this.state.value,n.prefix=!1,n.argument=a,this.next(),this.checkLVal(a,a=this.finishNode(n,"UpdateExpression"))}return a}parseExprSubscripts(t){const e=this.state.startLoc,s=this.state.potentialArrowAt,i=this.parseExprAtom(t);return this.shouldExitDescending(i,s)?i:this.parseSubscripts(i,e)}parseSubscripts(t,e,s){const i={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(t),stop:!1};do t=this.parseSubscript(t,e,s,i),i.maybeAsyncArrow=!1;while(!i.stop);return t}parseSubscript(t,e,s,i){const{type:a}=this.state;if(!s&&a===15)return this.parseBind(t,e,s,i);if(jt(a))return this.parseTaggedTemplateExpression(t,e,i);let n=!1;if(a===18){if(s&&(this.raise(u.OptionalChainingNoNew,this.state.startLoc),this.lookaheadCharCode()===40))return this.stopParseSubscript(t,i);i.optionalChainMember=n=!0,this.next()}if(!s&&this.match(10))return this.parseCoverCallAndAsyncArrowHead(t,e,i,n);{const o=this.eat(0);return o||n||this.eat(16)?this.parseMember(t,e,i,o,n):this.stopParseSubscript(t,i)}}stopParseSubscript(t,e){return e.stop=!0,t}parseMember(t,e,s,i,a){const n=this.startNodeAt(e);return n.object=t,n.computed=i,i?(n.property=this.parseExpression(),this.expect(3)):this.match(139)?(t.type==="Super"&&this.raise(u.SuperPrivateField,e),this.classScope.usePrivateName(this.state.value,this.state.startLoc),n.property=this.parsePrivateName()):n.property=this.parseIdentifier(!0),s.optionalChainMember?(n.optional=a,this.finishNode(n,"OptionalMemberExpression")):this.finishNode(n,"MemberExpression")}parseBind(t,e,s,i){const a=this.startNodeAt(e);return a.object=t,this.next(),a.callee=this.parseNoCallExpr(),i.stop=!0,this.parseSubscripts(this.finishNode(a,"BindExpression"),e,s)}parseCoverCallAndAsyncArrowHead(t,e,s,i){const a=this.state.maybeInArrowParameters;let n=null;this.state.maybeInArrowParameters=!0,this.next();const o=this.startNodeAt(e);o.callee=t;const{maybeAsyncArrow:c,optionalChainMember:h}=s;c&&(this.expressionScope.enter(Ua()),n=new ut),h&&(o.optional=i),i?o.arguments=this.parseCallExpressionArguments(11):o.arguments=this.parseCallExpressionArguments(11,t.type!=="Super",o,n);let l=this.finishCallExpression(o,h);return c&&this.shouldParseAsyncArrow()&&!i?(s.stop=!0,this.checkDestructuringPrivate(n),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),l=this.parseAsyncArrowFromCallExpression(this.startNodeAt(e),l)):(c&&(this.checkExpressionErrors(n,!0),this.expressionScope.exit()),this.toReferencedArguments(l)),this.state.maybeInArrowParameters=a,l}toReferencedArguments(t,e){this.toReferencedListDeep(t.arguments,e)}parseTaggedTemplateExpression(t,e,s){const i=this.startNodeAt(e);return i.tag=t,i.quasi=this.parseTemplate(!0),s.optionalChainMember&&this.raise(u.OptionalChainingNoTemplate,e),this.finishNode(i,"TaggedTemplateExpression")}atPossibleAsyncArrow(t){return t.type==="Identifier"&&t.name==="async"&&this.state.lastTokEndLoc.index===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.offsetToSourcePos(t.start)===this.state.potentialArrowAt}finishCallExpression(t,e){if(t.callee.type==="Import")if(t.arguments.length===0||t.arguments.length>2)this.raise(u.ImportCallArity,t);else for(const s of t.arguments)s.type==="SpreadElement"&&this.raise(u.ImportCallSpreadArgument,s);return this.finishNode(t,e?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(t,e,s,i){const a=[];let n=!0;const o=this.state.inFSharpPipelineDirectBody;for(this.state.inFSharpPipelineDirectBody=!1;!this.eat(t);){if(n)n=!1;else if(this.expect(12),this.match(t)){s&&this.addTrailingCommaExtraToNode(s),this.next();break}a.push(this.parseExprListItem(!1,i,e))}return this.state.inFSharpPipelineDirectBody=o,a}shouldParseAsyncArrow(){return this.match(19)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(t,e){return this.resetPreviousNodeTrailingComments(e),this.expect(19),this.parseArrowExpression(t,e.arguments,!0,e.extra?.trailingCommaLoc),e.innerComments&&ve(t,e.innerComments),e.callee.trailingComments&&ve(t,e.callee.trailingComments),t}parseNoCallExpr(){const t=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),t,!0)}parseExprAtom(t){let e,s=null;const{type:i}=this.state;switch(i){case 79:return this.parseSuper();case 83:return e=this.startNode(),this.next(),this.match(16)?this.parseImportMetaPropertyOrPhaseCall(e):this.match(10)?this.optionFlags&512?this.parseImportCall(e):this.finishNode(e,"Import"):(this.raise(u.UnsupportedImport,this.state.lastTokStartLoc),this.finishNode(e,"Import"));case 78:return e=this.startNode(),this.next(),this.finishNode(e,"ThisExpression");case 90:return this.parseDo(this.startNode(),!1);case 56:case 31:return this.readRegexp(),this.parseRegExpLiteral(this.state.value);case 135:return this.parseNumericLiteral(this.state.value);case 136:return this.parseBigIntLiteral(this.state.value);case 134:return this.parseStringLiteral(this.state.value);case 84:return this.parseNullLiteral();case 85:return this.parseBooleanLiteral(!0);case 86:return this.parseBooleanLiteral(!1);case 10:{const a=this.state.potentialArrowAt===this.state.start;return this.parseParenAndDistinguishExpression(a)}case 0:return this.parseArrayLike(3,!0,!1,t);case 5:return this.parseObjectLike(8,!1,!1,t);case 68:return this.parseFunctionOrFunctionSent();case 26:s=this.parseDecorators();case 80:return this.parseClass(this.maybeTakeDecorators(s,this.startNode()),!1);case 77:return this.parseNewOrNewTarget();case 25:case 24:return this.parseTemplate(!1);case 15:{e=this.startNode(),this.next(),e.object=null;const a=e.callee=this.parseNoCallExpr();if(a.type==="MemberExpression")return this.finishNode(e,"BindExpression");throw this.raise(u.UnsupportedBind,a)}case 139:return this.raise(u.PrivateInExpectedIn,this.state.startLoc,{identifierName:this.state.value}),this.parsePrivateName();case 33:return this.parseTopicReferenceThenEqualsSign(54,"%");case 32:return this.parseTopicReferenceThenEqualsSign(44,"^");case 37:case 38:return this.parseTopicReference("hack");case 44:case 54:case 27:{const a=this.getPluginOption("pipelineOperator","proposal");if(a)return this.parseTopicReference(a);this.unexpected();break}case 47:{const a=this.input.codePointAt(this.nextTokenStart());oe(a)||a===62?this.expectOnePlugin(["jsx","flow","typescript"]):this.unexpected();break}default:if(C(i)){if(this.isContextual(127)&&this.lookaheadInLineCharCode()===123)return this.parseModuleExpression();const a=this.state.potentialArrowAt===this.state.start,n=this.state.containsEsc,o=this.parseIdentifier();if(!n&&o.name==="async"&&!this.canInsertSemicolon()){const{type:c}=this.state;if(c===68)return this.resetPreviousNodeTrailingComments(o),this.next(),this.parseAsyncFunctionExpression(this.startNodeAtNode(o));if(C(c))return this.lookaheadCharCode()===61?this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(o)):o;if(c===90)return this.resetPreviousNodeTrailingComments(o),this.parseDo(this.startNodeAtNode(o),!0)}return a&&this.match(19)&&!this.canInsertSemicolon()?(this.next(),this.parseArrowExpression(this.startNodeAtNode(o),[o],!1)):o}else this.unexpected()}}parseTopicReferenceThenEqualsSign(t,e){const s=this.getPluginOption("pipelineOperator","proposal");if(s)return this.state.type=t,this.state.value=e,this.state.pos--,this.state.end--,this.state.endLoc=Y(this.state.endLoc,-1),this.parseTopicReference(s);this.unexpected()}parseTopicReference(t){const e=this.startNode(),s=this.state.startLoc,i=this.state.type;return this.next(),this.finishTopicReference(e,s,t,i)}finishTopicReference(t,e,s,i){if(this.testTopicReferenceConfiguration(s,e,i))return this.topicReferenceIsAllowedInCurrentContext()||this.raise(u.PipeTopicUnbound,e),this.registerTopicReference(),this.finishNode(t,"TopicReference");throw this.raise(u.PipeTopicUnconfiguredToken,e,{token:ye(i)})}testTopicReferenceConfiguration(t,e,s){switch(t){case"hack":return this.hasPlugin(["pipelineOperator",{topicToken:ye(s)}]);case"smart":return s===27;default:throw this.raise(u.PipeTopicRequiresHackPipes,e)}}parseAsyncArrowUnaryFunction(t){this.prodParam.enter(ct(!0,this.prodParam.hasYield));const e=[this.parseIdentifier()];return this.prodParam.exit(),this.hasPrecedingLineBreak()&&this.raise(u.LineTerminatorBeforeArrow,this.state.curPosition()),this.expect(19),this.parseArrowExpression(t,e,!0)}parseDo(t,e){this.expectPlugin("doExpressions"),e&&this.expectPlugin("asyncDoExpressions"),t.async=e,this.next();const s=this.state.labels;return this.state.labels=[],e?(this.prodParam.enter(2),t.body=this.parseBlock(),this.prodParam.exit()):t.body=this.parseBlock(),this.state.labels=s,this.finishNode(t,"DoExpression")}parseSuper(){const t=this.startNode();return this.next(),this.match(10)&&!this.scope.allowDirectSuper&&!(this.optionFlags&16)?this.raise(u.SuperNotAllowed,t):!this.scope.allowSuper&&!(this.optionFlags&16)&&this.raise(u.UnexpectedSuper,t),!this.match(10)&&!this.match(0)&&!this.match(16)&&this.raise(u.UnsupportedSuper,t),this.finishNode(t,"Super")}parsePrivateName(){const t=this.startNode(),e=this.startNodeAt(Y(this.state.startLoc,1)),s=this.state.value;return this.next(),t.id=this.createIdentifier(e,s),this.finishNode(t,"PrivateName")}parseFunctionOrFunctionSent(){const t=this.startNode();if(this.next(),this.prodParam.hasYield&&this.match(16)){const e=this.createIdentifier(this.startNodeAtNode(t),"function");return this.next(),this.match(103)?this.expectPlugin("functionSent"):this.hasPlugin("functionSent")||this.unexpected(),this.parseMetaProperty(t,e,"sent")}return this.parseFunction(t)}parseMetaProperty(t,e,s){t.meta=e;const i=this.state.containsEsc;return t.property=this.parseIdentifier(!0),(t.property.name!==s||i)&&this.raise(u.UnsupportedMetaProperty,t.property,{target:e.name,onlyValidPropertyName:s}),this.finishNode(t,"MetaProperty")}parseImportMetaPropertyOrPhaseCall(t){if(this.next(),this.isContextual(105)||this.isContextual(97)){const e=this.isContextual(105);return this.expectPlugin(e?"sourcePhaseImports":"deferredImportEvaluation"),this.next(),t.phase=e?"source":"defer",this.parseImportCall(t)}else{const e=this.createIdentifierAt(this.startNodeAtNode(t),"import",this.state.lastTokStartLoc);return this.isContextual(101)&&(this.inModule||this.raise(u.ImportMetaOutsideModule,e),this.sawUnambiguousESM=!0),this.parseMetaProperty(t,e,"meta")}}parseLiteralAtNode(t,e,s){return this.addExtra(s,"rawValue",t),this.addExtra(s,"raw",this.input.slice(this.offsetToSourcePos(s.start),this.state.end)),s.value=t,this.next(),this.finishNode(s,e)}parseLiteral(t,e){const s=this.startNode();return this.parseLiteralAtNode(t,e,s)}parseStringLiteral(t){return this.parseLiteral(t,"StringLiteral")}parseNumericLiteral(t){return this.parseLiteral(t,"NumericLiteral")}parseBigIntLiteral(t){return this.parseLiteral(t,"BigIntLiteral")}parseDecimalLiteral(t){return this.parseLiteral(t,"DecimalLiteral")}parseRegExpLiteral(t){const e=this.startNode();return this.addExtra(e,"raw",this.input.slice(this.offsetToSourcePos(e.start),this.state.end)),e.pattern=t.pattern,e.flags=t.flags,this.next(),this.finishNode(e,"RegExpLiteral")}parseBooleanLiteral(t){const e=this.startNode();return e.value=t,this.next(),this.finishNode(e,"BooleanLiteral")}parseNullLiteral(){const t=this.startNode();return this.next(),this.finishNode(t,"NullLiteral")}parseParenAndDistinguishExpression(t){const e=this.state.startLoc;let s;this.next(),this.expressionScope.enter(ja());const i=this.state.maybeInArrowParameters,a=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=!0,this.state.inFSharpPipelineDirectBody=!1;const n=this.state.startLoc,o=[],c=new ut;let h=!0,l,p;for(;!this.match(11);){if(h)h=!1;else if(this.expect(12,c.optionalParametersLoc===null?null:c.optionalParametersLoc),this.match(11)){p=this.state.startLoc;break}if(this.match(21)){const P=this.state.startLoc;if(l=this.state.startLoc,o.push(this.parseParenItem(this.parseRestBinding(),P)),!this.checkCommaAfterRest(41))break}else o.push(this.parseMaybeAssignAllowIn(c,this.parseParenItem))}const d=this.state.lastTokEndLoc;this.expect(11),this.state.maybeInArrowParameters=i,this.state.inFSharpPipelineDirectBody=a;let f=this.startNodeAt(e);return t&&this.shouldParseArrow(o)&&(f=this.parseArrow(f))?(this.checkDestructuringPrivate(c),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),this.parseArrowExpression(f,o,!1),f):(this.expressionScope.exit(),o.length||this.unexpected(this.state.lastTokStartLoc),p&&this.unexpected(p),l&&this.unexpected(l),this.checkExpressionErrors(c,!0),this.toReferencedListDeep(o,!0),o.length>1?(s=this.startNodeAt(n),s.expressions=o,this.finishNode(s,"SequenceExpression"),this.resetEndLocation(s,d)):s=o[0],this.wrapParenthesis(e,s))}wrapParenthesis(t,e){if(!(this.optionFlags&1024))return this.addExtra(e,"parenthesized",!0),this.addExtra(e,"parenStart",t.index),this.takeSurroundingComments(e,t.index,this.state.lastTokEndLoc.index),e;const s=this.startNodeAt(t);return s.expression=e,this.finishNode(s,"ParenthesizedExpression")}shouldParseArrow(t){return!this.canInsertSemicolon()}parseArrow(t){if(this.eat(19))return t}parseParenItem(t,e){return t}parseNewOrNewTarget(){const t=this.startNode();if(this.next(),this.match(16)){const e=this.createIdentifier(this.startNodeAtNode(t),"new");this.next();const s=this.parseMetaProperty(t,e,"target");return!this.scope.inNonArrowFunction&&!this.scope.inClass&&!(this.optionFlags&4)&&this.raise(u.UnexpectedNewTarget,s),s}return this.parseNew(t)}parseNew(t){if(this.parseNewCallee(t),this.eat(10)){const e=this.parseExprList(11);this.toReferencedList(e),t.arguments=e}else t.arguments=[];return this.finishNode(t,"NewExpression")}parseNewCallee(t){const e=this.match(83),s=this.parseNoCallExpr();t.callee=s,e&&(s.type==="Import"||s.type==="ImportExpression")&&this.raise(u.ImportCallNotNewExpression,s)}parseTemplateElement(t){const{start:e,startLoc:s,end:i,value:a}=this.state,n=e+1,o=this.startNodeAt(Y(s,1));a===null&&(t||this.raise(u.InvalidEscapeSequenceTemplate,Y(this.state.firstInvalidTemplateEscapePos,1)));const c=this.match(24),h=c?-1:-2,l=i+h;o.value={raw:this.input.slice(n,l).replace(/\r\n?/g,`
8
+ `),cooked:a===null?null:a.slice(1,h)},o.tail=c,this.next();const p=this.finishNode(o,"TemplateElement");return this.resetEndLocation(p,Y(this.state.lastTokEndLoc,h)),p}parseTemplate(t){const e=this.startNode();let s=this.parseTemplateElement(t);const i=[s],a=[];for(;!s.tail;)a.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),i.push(s=this.parseTemplateElement(t));return e.expressions=a,e.quasis=i,this.finishNode(e,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(t,e,s,i){s&&this.expectPlugin("recordAndTuple");const a=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let n=!1,o=!0;const c=this.startNode();for(c.properties=[],this.next();!this.match(t);){if(o)o=!1;else if(this.expect(12),this.match(t)){this.addTrailingCommaExtraToNode(c);break}let l;e?l=this.parseBindingProperty():(l=this.parsePropertyDefinition(i),n=this.checkProto(l,s,n,i)),s&&!this.isObjectProperty(l)&&l.type!=="SpreadElement"&&this.raise(u.InvalidRecordProperty,l),c.properties.push(l)}this.next(),this.state.inFSharpPipelineDirectBody=a;let h="ObjectExpression";return e?h="ObjectPattern":s&&(h="RecordExpression"),this.finishNode(c,h)}addTrailingCommaExtraToNode(t){this.addExtra(t,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(t,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(t){return!t.computed&&t.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))}parsePropertyDefinition(t){let e=[];if(this.match(26))for(this.hasPlugin("decorators")&&this.raise(u.UnsupportedPropertyDecorator,this.state.startLoc);this.match(26);)e.push(this.parseDecorator());const s=this.startNode();let i=!1,a=!1,n;if(this.match(21))return e.length&&this.unexpected(),this.parseSpread();e.length&&(s.decorators=e,e=[]),s.method=!1,t&&(n=this.state.startLoc);let o=this.eat(55);this.parsePropertyNamePrefixOperator(s);const c=this.state.containsEsc;if(this.parsePropertyName(s,t),!o&&!c&&this.maybeAsyncOrAccessorProp(s)){const{key:h}=s,l=h.name;l==="async"&&!this.hasPrecedingLineBreak()&&(i=!0,this.resetPreviousNodeTrailingComments(h),o=this.eat(55),this.parsePropertyName(s)),(l==="get"||l==="set")&&(a=!0,this.resetPreviousNodeTrailingComments(h),s.kind=l,this.match(55)&&(o=!0,this.raise(u.AccessorIsGenerator,this.state.curPosition(),{kind:l}),this.next()),this.parsePropertyName(s))}return this.parseObjPropValue(s,n,o,i,!1,a,t)}getGetterSetterExpectedParamCount(t){return t.kind==="get"?0:1}getObjectOrClassMethodParams(t){return t.params}checkGetterSetterParams(t){const e=this.getGetterSetterExpectedParamCount(t),s=this.getObjectOrClassMethodParams(t);s.length!==e&&this.raise(t.kind==="get"?u.BadGetterArity:u.BadSetterArity,t),t.kind==="set"&&s[s.length-1]?.type==="RestElement"&&this.raise(u.BadSetterRestParameter,t)}parseObjectMethod(t,e,s,i,a){if(a){const n=this.parseMethod(t,e,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(n),n}if(s||e||this.match(10))return i&&this.unexpected(),t.kind="method",t.method=!0,this.parseMethod(t,e,s,!1,!1,"ObjectMethod")}parseObjectProperty(t,e,s,i){if(t.shorthand=!1,this.eat(14))return t.value=s?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowIn(i),this.finishObjectProperty(t);if(!t.computed&&t.key.type==="Identifier"){if(this.checkReservedWord(t.key.name,t.key.loc.start,!0,!1),s)t.value=this.parseMaybeDefault(e,this.cloneIdentifier(t.key));else if(this.match(29)){const a=this.state.startLoc;i!=null?i.shorthandAssignLoc===null&&(i.shorthandAssignLoc=a):this.raise(u.InvalidCoverInitializedName,a),t.value=this.parseMaybeDefault(e,this.cloneIdentifier(t.key))}else t.value=this.cloneIdentifier(t.key);return t.shorthand=!0,this.finishObjectProperty(t)}}finishObjectProperty(t){return this.finishNode(t,"ObjectProperty")}parseObjPropValue(t,e,s,i,a,n,o){const c=this.parseObjectMethod(t,s,i,a,n)||this.parseObjectProperty(t,e,a,o);return c||this.unexpected(),c}parsePropertyName(t,e){if(this.eat(0))t.computed=!0,t.key=this.parseMaybeAssignAllowIn(),this.expect(3);else{const{type:s,value:i}=this.state;let a;if(Q(s))a=this.parseIdentifier(!0);else switch(s){case 135:a=this.parseNumericLiteral(i);break;case 134:a=this.parseStringLiteral(i);break;case 136:a=this.parseBigIntLiteral(i);break;case 139:{const n=this.state.startLoc;e!=null?e.privateKeyLoc===null&&(e.privateKeyLoc=n):this.raise(u.UnexpectedPrivateField,n),a=this.parsePrivateName();break}default:this.unexpected()}t.key=a,s!==139&&(t.computed=!1)}}initFunction(t,e){t.id=null,t.generator=!1,t.async=e}parseMethod(t,e,s,i,a,n,o=!1){this.initFunction(t,s),t.generator=e,this.scope.enter(18|(o?64:0)|(a?32:0)),this.prodParam.enter(ct(s,t.generator)),this.parseFunctionParams(t,i);const c=this.parseFunctionBodyAndFinish(t,n,!0);return this.prodParam.exit(),this.scope.exit(),c}parseArrayLike(t,e,s,i){s&&this.expectPlugin("recordAndTuple");const a=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;const n=this.startNode();return this.next(),n.elements=this.parseExprList(t,!s,i,n),this.state.inFSharpPipelineDirectBody=a,this.finishNode(n,s?"TupleExpression":"ArrayExpression")}parseArrowExpression(t,e,s,i){this.scope.enter(6);let a=ct(s,!1);!this.match(5)&&this.prodParam.hasIn&&(a|=8),this.prodParam.enter(a),this.initFunction(t,s);const n=this.state.maybeInArrowParameters;return e&&(this.state.maybeInArrowParameters=!0,this.setArrowFunctionParameters(t,e,i)),this.state.maybeInArrowParameters=!1,this.parseFunctionBody(t,!0),this.prodParam.exit(),this.scope.exit(),this.state.maybeInArrowParameters=n,this.finishNode(t,"ArrowFunctionExpression")}setArrowFunctionParameters(t,e,s){this.toAssignableList(e,s,!1),t.params=e}parseFunctionBodyAndFinish(t,e,s=!1){return this.parseFunctionBody(t,!1,s),this.finishNode(t,e)}parseFunctionBody(t,e,s=!1){const i=e&&!this.match(5);if(this.expressionScope.enter(Hs()),i)t.body=this.parseMaybeAssign(),this.checkParams(t,!1,e,!1);else{const a=this.state.strict,n=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),t.body=this.parseBlock(!0,!1,o=>{const c=!this.isSimpleParamList(t.params);o&&c&&this.raise(u.IllegalLanguageModeDirective,(t.kind==="method"||t.kind==="constructor")&&t.key?t.key.loc.end:t);const h=!a&&this.state.strict;this.checkParams(t,!this.state.strict&&!e&&!s&&!c,e,h),this.state.strict&&t.id&&this.checkIdentifier(t.id,65,h)}),this.prodParam.exit(),this.state.labels=n}this.expressionScope.exit()}isSimpleParameter(t){return t.type==="Identifier"}isSimpleParamList(t){for(let e=0,s=t.length;e<s;e++)if(!this.isSimpleParameter(t[e]))return!1;return!0}checkParams(t,e,s,i=!0){const a=!e&&new Set,n={type:"FormalParameters"};for(const o of t.params)this.checkLVal(o,n,5,a,i)}parseExprList(t,e,s,i){const a=[];let n=!0;for(;!this.eat(t);){if(n)n=!1;else if(this.expect(12),this.match(t)){i&&this.addTrailingCommaExtraToNode(i),this.next();break}a.push(this.parseExprListItem(e,s))}return a}parseExprListItem(t,e,s){let i;if(this.match(12))t||this.raise(u.UnexpectedToken,this.state.curPosition(),{unexpected:","}),i=null;else if(this.match(21)){const a=this.state.startLoc;i=this.parseParenItem(this.parseSpread(e),a)}else if(this.match(17)){this.expectPlugin("partialApplication"),s||this.raise(u.UnexpectedArgumentPlaceholder,this.state.startLoc);const a=this.startNode();this.next(),i=this.finishNode(a,"ArgumentPlaceholder")}else i=this.parseMaybeAssignAllowIn(e,this.parseParenItem);return i}parseIdentifier(t){const e=this.startNode(),s=this.parseIdentifierName(t);return this.createIdentifier(e,s)}createIdentifier(t,e){return t.name=e,t.loc.identifierName=e,this.finishNode(t,"Identifier")}createIdentifierAt(t,e,s){return t.name=e,t.loc.identifierName=e,this.finishNodeAt(t,"Identifier",s)}parseIdentifierName(t){let e;const{startLoc:s,type:i}=this.state;Q(i)?e=this.state.value:this.unexpected();const a=Hr(i);return t?a&&this.replaceToken(132):this.checkReservedWord(e,s,a,!1),this.next(),e}checkReservedWord(t,e,s,i){if(t.length>10||!la(t))return;if(s&&oa(t)){this.raise(u.UnexpectedKeyword,e,{keyword:t});return}if((this.state.strict?i?Rs:Ms:Ls)(t,this.inModule)){this.raise(u.UnexpectedReservedWord,e,{reservedWord:t});return}else if(t==="yield"){if(this.prodParam.hasYield){this.raise(u.YieldBindingIdentifier,e);return}}else if(t==="await"){if(this.prodParam.hasAwait){this.raise(u.AwaitBindingIdentifier,e);return}if(this.scope.inStaticBlock){this.raise(u.AwaitBindingIdentifierInStaticBlock,e);return}this.expressionScope.recordAsyncArrowParametersError(e)}else if(t==="arguments"&&this.scope.inClassAndNotInNonArrowFunction){this.raise(u.ArgumentsInClass,e);return}}recordAwaitIfAllowed(){const t=this.prodParam.hasAwait||this.optionFlags&1&&!this.scope.inFunction;return t&&!this.scope.inFunction&&(this.state.hasTopLevelAwait=!0),t}parseAwait(t){const e=this.startNodeAt(t);return this.expressionScope.recordParameterInitializerError(u.AwaitExpressionFormalParameter,e),this.eat(55)&&this.raise(u.ObsoleteAwaitStar,e),!this.scope.inFunction&&!(this.optionFlags&1)&&(this.isAmbiguousPrefixOrIdentifier()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),this.state.soloAwait||(e.argument=this.parseMaybeUnary(null,!0)),this.finishNode(e,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return!0;const{type:t}=this.state;return t===53||t===10||t===0||jt(t)||t===102&&!this.state.containsEsc||t===138||t===56||this.hasPlugin("v8intrinsic")&&t===54}parseYield(t){const e=this.startNodeAt(t);this.expressionScope.recordParameterInitializerError(u.YieldInParameter,e);let s=!1,i=null;if(!this.hasPrecedingLineBreak())switch(s=this.eat(55),this.state.type){case 13:case 140:case 8:case 11:case 3:case 9:case 14:case 12:if(!s)break;default:i=this.parseMaybeAssign()}return e.delegate=s,e.argument=i,this.finishNode(e,"YieldExpression")}parseImportCall(t){if(this.next(),t.source=this.parseMaybeAssignAllowIn(),t.options=null,this.eat(12)){if(this.match(11))this.addTrailingCommaExtraToNode(t.source);else if(t.options=this.parseMaybeAssignAllowIn(),this.eat(12)&&(this.addTrailingCommaExtraToNode(t.options),!this.match(11))){do this.parseMaybeAssignAllowIn();while(this.eat(12)&&!this.match(11));this.raise(u.ImportCallArity,t)}}return this.expect(11),this.finishNode(t,"ImportExpression")}checkPipelineAtInfixOperator(t,e){this.hasPlugin(["pipelineOperator",{proposal:"smart"}])&&t.type==="SequenceExpression"&&this.raise(u.PipelineHeadSequenceExpression,e)}parseSmartPipelineBodyInStyle(t,e){if(this.isSimpleReference(t)){const s=this.startNodeAt(e);return s.callee=t,this.finishNode(s,"PipelineBareFunction")}else{const s=this.startNodeAt(e);return this.checkSmartPipeTopicBodyEarlyErrors(e),s.expression=t,this.finishNode(s,"PipelineTopicExpression")}}isSimpleReference(t){switch(t.type){case"MemberExpression":return!t.computed&&this.isSimpleReference(t.object);case"Identifier":return!0;default:return!1}}checkSmartPipeTopicBodyEarlyErrors(t){if(this.match(19))throw this.raise(u.PipelineBodyNoArrow,this.state.startLoc);this.topicReferenceWasUsedInCurrentContext()||this.raise(u.PipelineTopicUnused,t)}withTopicBindingContext(t){const e=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return t()}finally{this.state.topicContext=e}}withSmartMixTopicForbiddingContext(t){return t()}withSoloAwaitPermittingContext(t){const e=this.state.soloAwait;this.state.soloAwait=!0;try{return t()}finally{this.state.soloAwait=e}}allowInAnd(t){const e=this.prodParam.currentFlags();if(8&~e){this.prodParam.enter(e|8);try{return t()}finally{this.prodParam.exit()}}return t()}disallowInAnd(t){const e=this.prodParam.currentFlags();if(8&e){this.prodParam.enter(e&-9);try{return t()}finally{this.prodParam.exit()}}return t()}registerTopicReference(){this.state.topicContext.maxTopicIndex=0}topicReferenceIsAllowedInCurrentContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1}topicReferenceWasUsedInCurrentContext(){return this.state.topicContext.maxTopicIndex!=null&&this.state.topicContext.maxTopicIndex>=0}parseFSharpPipelineBody(t){const e=this.state.startLoc;this.state.potentialArrowAt=this.state.start;const s=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!0;const i=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),e,t);return this.state.inFSharpPipelineDirectBody=s,i}parseModuleExpression(){this.expectPlugin("moduleBlocks");const t=this.startNode();this.next(),this.match(5)||this.unexpected(null,5);const e=this.startNodeAt(this.state.endLoc);this.next();const s=this.initializeScopes(!0);this.enterInitialScopes();try{t.body=this.parseProgram(e,8,"module")}finally{s()}return this.finishNode(t,"ModuleExpression")}parsePropertyNamePrefixOperator(t){}}const Yt={kind:1},sn={kind:2},rn=/[\uD800-\uDFFF]/u,Zt=/in(?:stanceof)?/y;function an(r,t,e){for(let s=0;s<r.length;s++){const i=r[s],{type:a}=i;typeof a=="number"&&(i.type=vs(a))}return r}class nn extends tn{parseTopLevel(t,e){return t.program=this.parseProgram(e),t.comments=this.comments,this.optionFlags&256&&(t.tokens=an(this.tokens,this.input,this.startIndex)),this.finishNode(t,"File")}parseProgram(t,e=140,s=this.options.sourceType){if(t.sourceType=s,t.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(t,!0,!0,e),this.inModule){if(!(this.optionFlags&64)&&this.scope.undefinedExports.size>0)for(const[a,n]of Array.from(this.scope.undefinedExports))this.raise(u.ModuleExportUndefined,n,{localName:a});this.addExtra(t,"topLevelAwait",this.state.hasTopLevelAwait)}let i;return e===140?i=this.finishNode(t,"Program"):i=this.finishNodeAt(t,"Program",Y(this.state.startLoc,-1)),i}stmtToDirective(t){const e=this.castNodeTo(t,"Directive"),s=this.castNodeTo(t.expression,"DirectiveLiteral"),i=s.value,a=this.input.slice(this.offsetToSourcePos(s.start),this.offsetToSourcePos(s.end)),n=s.value=a.slice(1,-1);return this.addExtra(s,"raw",a),this.addExtra(s,"rawValue",n),this.addExtra(s,"expressionValue",i),e.value=s,delete t.expression,e}parseInterpreterDirective(){if(!this.match(28))return null;const t=this.startNode();return t.value=this.state.value,this.next(),this.finishNode(t,"InterpreterDirective")}isLet(){return this.isContextual(100)?this.hasFollowingBindingAtom():!1}chStartsBindingIdentifier(t,e){if(oe(t)){if(Zt.lastIndex=e,Zt.test(this.input)){const s=this.codePointAtPos(Zt.lastIndex);if(!Ce(s)&&s!==92)return!1}return!0}else return t===92}chStartsBindingPattern(t){return t===91||t===123}hasFollowingBindingAtom(){const t=this.nextTokenStart(),e=this.codePointAtPos(t);return this.chStartsBindingPattern(e)||this.chStartsBindingIdentifier(e,t)}hasInLineFollowingBindingIdentifierOrBrace(){const t=this.nextTokenInLineStart(),e=this.codePointAtPos(t);return e===123||this.chStartsBindingIdentifier(e,t)}allowsForUsing(){const{type:t,containsEsc:e,end:s}=this.lookahead();if(t===102&&!e){const i=this.lookaheadCharCodeSince(s);if(i!==61&&i!==58&&i!==59)return!1}return C(t)&&!this.hasFollowingLineBreak()?(this.expectPlugin("explicitResourceManagement"),!0):!1}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}startsAwaitUsing(){let t=this.nextTokenInLineStart();if(this.isUnparsedContextual(t,"using")){t=this.nextTokenInLineStartSince(t+5);const e=this.codePointAtPos(t);if(this.chStartsBindingIdentifier(e,t))return this.expectPlugin("explicitResourceManagement"),!0}return!1}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(t=!1){let e=0;return this.options.annexB&&!this.state.strict&&(e|=4,t&&(e|=8)),this.parseStatementLike(e)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(t){let e=null;return this.match(26)&&(e=this.parseDecorators(!0)),this.parseStatementContent(t,e)}parseStatementContent(t,e){const s=this.state.type,i=this.startNode(),a=!!(t&2),n=!!(t&4),o=t&1;switch(s){case 60:return this.parseBreakContinueStatement(i,!0);case 63:return this.parseBreakContinueStatement(i,!1);case 64:return this.parseDebuggerStatement(i);case 90:return this.parseDoWhileStatement(i);case 91:return this.parseForStatement(i);case 68:if(this.lookaheadCharCode()===46)break;return n||this.raise(this.state.strict?u.StrictFunction:this.options.annexB?u.SloppyFunctionAnnexB:u.SloppyFunction,this.state.startLoc),this.parseFunctionStatement(i,!1,!a&&n);case 80:return a||this.unexpected(),this.parseClass(this.maybeTakeDecorators(e,i),!0);case 69:return this.parseIfStatement(i);case 70:return this.parseReturnStatement(i);case 71:return this.parseSwitchStatement(i);case 72:return this.parseThrowStatement(i);case 73:return this.parseTryStatement(i);case 96:if(!this.state.containsEsc&&this.startsAwaitUsing())return this.allowsUsing()?a?this.recordAwaitIfAllowed()||this.raise(u.AwaitUsingNotInAsyncContext,i):this.raise(u.UnexpectedLexicalDeclaration,i):this.raise(u.UnexpectedUsingDeclaration,i),this.next(),this.parseVarStatement(i,"await using");break;case 107:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace())break;return this.expectPlugin("explicitResourceManagement"),this.allowsUsing()?a||this.raise(u.UnexpectedLexicalDeclaration,this.state.startLoc):this.raise(u.UnexpectedUsingDeclaration,this.state.startLoc),this.parseVarStatement(i,"using");case 100:{if(this.state.containsEsc)break;const l=this.nextTokenStart(),p=this.codePointAtPos(l);if(p!==91&&(!a&&this.hasFollowingLineBreak()||!this.chStartsBindingIdentifier(p,l)&&p!==123))break}case 75:a||this.raise(u.UnexpectedLexicalDeclaration,this.state.startLoc);case 74:{const l=this.state.value;return this.parseVarStatement(i,l)}case 92:return this.parseWhileStatement(i);case 76:return this.parseWithStatement(i);case 5:return this.parseBlock();case 13:return this.parseEmptyStatement(i);case 83:{const l=this.lookaheadCharCode();if(l===40||l===46)break}case 82:{!(this.optionFlags&8)&&!o&&this.raise(u.UnexpectedImportExport,this.state.startLoc),this.next();let l;return s===83?l=this.parseImport(i):l=this.parseExport(i,e),this.assertModuleNodeAllowed(l),l}default:if(this.isAsyncFunction())return a||this.raise(u.AsyncFunctionInSingleStatementContext,this.state.startLoc),this.next(),this.parseFunctionStatement(i,!0,!a&&n)}const c=this.state.value,h=this.parseExpression();return C(s)&&h.type==="Identifier"&&this.eat(14)?this.parseLabeledStatement(i,c,h,t):this.parseExpressionStatement(i,h,e)}assertModuleNodeAllowed(t){!(this.optionFlags&8)&&!this.inModule&&this.raise(u.ImportOutsideModule,t)}decoratorsEnabledBeforeExport(){return this.hasPlugin("decorators-legacy")?!0:this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")!==!1}maybeTakeDecorators(t,e,s){return t&&(e.decorators?.length?(typeof this.getPluginOption("decorators","decoratorsBeforeExport")!="boolean"&&this.raise(u.DecoratorsBeforeAfterExport,e.decorators[0]),e.decorators.unshift(...t)):e.decorators=t,this.resetStartLocationFromNode(e,t[0]),s&&this.resetStartLocationFromNode(s,e)),e}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(t){const e=[];do e.push(this.parseDecorator());while(this.match(26));if(this.match(82))t||this.unexpected(),this.decoratorsEnabledBeforeExport()||this.raise(u.DecoratorExportClass,this.state.startLoc);else if(!this.canHaveLeadingDecorator())throw this.raise(u.UnexpectedLeadingDecorator,this.state.startLoc);return e}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);const t=this.startNode();if(this.next(),this.hasPlugin("decorators")){const e=this.state.startLoc;let s;if(this.match(10)){const i=this.state.startLoc;this.next(),s=this.parseExpression(),this.expect(11),s=this.wrapParenthesis(i,s);const a=this.state.startLoc;t.expression=this.parseMaybeDecoratorArguments(s,i),this.getPluginOption("decorators","allowCallParenthesized")===!1&&t.expression!==s&&this.raise(u.DecoratorArgumentsOutsideParentheses,a)}else{for(s=this.parseIdentifier(!1);this.eat(16);){const i=this.startNodeAt(e);i.object=s,this.match(139)?(this.classScope.usePrivateName(this.state.value,this.state.startLoc),i.property=this.parsePrivateName()):i.property=this.parseIdentifier(!0),i.computed=!1,s=this.finishNode(i,"MemberExpression")}t.expression=this.parseMaybeDecoratorArguments(s,e)}}else t.expression=this.parseExprSubscripts();return this.finishNode(t,"Decorator")}parseMaybeDecoratorArguments(t,e){if(this.eat(10)){const s=this.startNodeAt(e);return s.callee=t,s.arguments=this.parseCallExpressionArguments(11),this.toReferencedList(s.arguments),this.finishNode(s,"CallExpression")}return t}parseBreakContinueStatement(t,e){return this.next(),this.isLineTerminator()?t.label=null:(t.label=this.parseIdentifier(),this.semicolon()),this.verifyBreakContinue(t,e),this.finishNode(t,e?"BreakStatement":"ContinueStatement")}verifyBreakContinue(t,e){let s;for(s=0;s<this.state.labels.length;++s){const i=this.state.labels[s];if((t.label==null||i.name===t.label.name)&&(i.kind!=null&&(e||i.kind===1)||t.label&&e))break}if(s===this.state.labels.length){const i=e?"BreakStatement":"ContinueStatement";this.raise(u.IllegalBreakContinue,t,{type:i})}}parseDebuggerStatement(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")}parseHeaderExpression(){this.expect(10);const t=this.parseExpression();return this.expect(11),t}parseDoWhileStatement(t){return this.next(),this.state.labels.push(Yt),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.expect(92),t.test=this.parseHeaderExpression(),this.eat(13),this.finishNode(t,"DoWhileStatement")}parseForStatement(t){this.next(),this.state.labels.push(Yt);let e=null;if(this.isContextual(96)&&this.recordAwaitIfAllowed()&&(e=this.state.startLoc,this.next()),this.scope.enter(0),this.expect(10),this.match(13))return e!==null&&this.unexpected(e),this.parseFor(t,null);const s=this.isContextual(100);{const c=this.isContextual(96)&&this.startsAwaitUsing(),h=c||this.isContextual(107)&&this.allowsForUsing(),l=s&&this.hasFollowingBindingAtom()||h;if(this.match(74)||this.match(75)||l){const p=this.startNode();let d;c?(d="await using",this.recordAwaitIfAllowed()||this.raise(u.AwaitUsingNotInAsyncContext,this.state.startLoc),this.next()):d=this.state.value,this.next(),this.parseVar(p,!0,d);const f=this.finishNode(p,"VariableDeclaration"),P=this.match(58);return P&&h&&this.raise(u.ForInUsing,f),(P||this.isContextual(102))&&f.declarations.length===1?this.parseForIn(t,f,e):(e!==null&&this.unexpected(e),this.parseFor(t,f))}}const i=this.isContextual(95),a=new ut,n=this.parseExpression(!0,a),o=this.isContextual(102);if(o&&(s&&this.raise(u.ForOfLet,n),e===null&&i&&n.type==="Identifier"&&this.raise(u.ForOfAsync,n)),o||this.match(58)){this.checkDestructuringPrivate(a),this.toAssignable(n,!0);const c=o?"ForOfStatement":"ForInStatement";return this.checkLVal(n,{type:c}),this.parseForIn(t,n,e)}else this.checkExpressionErrors(a,!0);return e!==null&&this.unexpected(e),this.parseFor(t,n)}parseFunctionStatement(t,e,s){return this.next(),this.parseFunction(t,1|(s?2:0)|(e?8:0))}parseIfStatement(t){return this.next(),t.test=this.parseHeaderExpression(),t.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),t.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(t,"IfStatement")}parseReturnStatement(t){return!this.prodParam.hasReturn&&!(this.optionFlags&2)&&this.raise(u.IllegalReturn,this.state.startLoc),this.next(),this.isLineTerminator()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")}parseSwitchStatement(t){this.next(),t.discriminant=this.parseHeaderExpression();const e=t.cases=[];this.expect(5),this.state.labels.push(sn),this.scope.enter(256);let s;for(let i;!this.match(8);)if(this.match(61)||this.match(65)){const a=this.match(61);s&&this.finishNode(s,"SwitchCase"),e.push(s=this.startNode()),s.consequent=[],this.next(),a?s.test=this.parseExpression():(i&&this.raise(u.MultipleDefaultsInSwitch,this.state.lastTokStartLoc),i=!0,s.test=null),this.expect(14)}else s?s.consequent.push(this.parseStatementListItem()):this.unexpected();return this.scope.exit(),s&&this.finishNode(s,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(t,"SwitchStatement")}parseThrowStatement(t){return this.next(),this.hasPrecedingLineBreak()&&this.raise(u.NewlineAfterThrow,this.state.lastTokEndLoc),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")}parseCatchClauseParam(){const t=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&t.type==="Identifier"?8:0),this.checkLVal(t,{type:"CatchClause"},9),t}parseTryStatement(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.match(62)){const e=this.startNode();this.next(),this.match(10)?(this.expect(10),e.param=this.parseCatchClauseParam(),this.expect(11)):(e.param=null,this.scope.enter(0)),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseBlock(!1,!1)),this.scope.exit(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(67)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(u.NoCatchOrFinally,t),this.finishNode(t,"TryStatement")}parseVarStatement(t,e,s=!1){return this.next(),this.parseVar(t,!1,e,s),this.semicolon(),this.finishNode(t,"VariableDeclaration")}parseWhileStatement(t){return this.next(),t.test=this.parseHeaderExpression(),this.state.labels.push(Yt),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.finishNode(t,"WhileStatement")}parseWithStatement(t){return this.state.strict&&this.raise(u.StrictWith,this.state.startLoc),this.next(),t.object=this.parseHeaderExpression(),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.finishNode(t,"WithStatement")}parseEmptyStatement(t){return this.next(),this.finishNode(t,"EmptyStatement")}parseLabeledStatement(t,e,s,i){for(const n of this.state.labels)n.name===e&&this.raise(u.LabelRedeclaration,s,{labelName:e});const a=Jr(this.state.type)?1:this.match(71)?2:null;for(let n=this.state.labels.length-1;n>=0;n--){const o=this.state.labels[n];if(o.statementStart===t.start)o.statementStart=this.sourceToOffsetPos(this.state.start),o.kind=a;else break}return this.state.labels.push({name:e,kind:a,statementStart:this.sourceToOffsetPos(this.state.start)}),t.body=i&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")}parseExpressionStatement(t,e,s){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")}parseBlock(t=!1,e=!0,s){const i=this.startNode();return t&&this.state.strictErrors.clear(),this.expect(5),e&&this.scope.enter(0),this.parseBlockBody(i,t,!1,8,s),e&&this.scope.exit(),this.finishNode(i,"BlockStatement")}isValidDirective(t){return t.type==="ExpressionStatement"&&t.expression.type==="StringLiteral"&&!t.expression.extra.parenthesized}parseBlockBody(t,e,s,i,a){const n=t.body=[],o=t.directives=[];this.parseBlockOrModuleBlockBody(n,e?o:void 0,s,i,a)}parseBlockOrModuleBlockBody(t,e,s,i,a){const n=this.state.strict;let o=!1,c=!1;for(;!this.match(i);){const h=s?this.parseModuleItem():this.parseStatementListItem();if(e&&!c){if(this.isValidDirective(h)){const l=this.stmtToDirective(h);e.push(l),!o&&l.value.value==="use strict"&&(o=!0,this.setStrict(!0));continue}c=!0,this.state.strictErrors.clear()}t.push(h)}a?.call(this,o),n||this.setStrict(!1),this.next()}parseFor(t,e){return t.init=e,this.semicolon(!1),t.test=this.match(13)?null:this.parseExpression(),this.semicolon(!1),t.update=this.match(11)?null:this.parseExpression(),this.expect(11),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(t,"ForStatement")}parseForIn(t,e,s){const i=this.match(58);return this.next(),i?s!==null&&this.unexpected(s):t.await=s!==null,e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!i||!this.options.annexB||this.state.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(u.ForInOfLoopInitializer,e,{type:i?"ForInStatement":"ForOfStatement"}),e.type==="AssignmentPattern"&&this.raise(u.InvalidLhs,e,{ancestor:{type:"ForStatement"}}),t.left=e,t.right=i?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(11),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(t,i?"ForInStatement":"ForOfStatement")}parseVar(t,e,s,i=!1){const a=t.declarations=[];for(t.kind=s;;){const n=this.startNode();if(this.parseVarId(n,s),n.init=this.eat(29)?e?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,n.init===null&&!i&&(n.id.type!=="Identifier"&&!(e&&(this.match(58)||this.isContextual(102)))?this.raise(u.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"}):(s==="const"||s==="using"||s==="await using")&&!(this.match(58)||this.isContextual(102))&&this.raise(u.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:s})),a.push(this.finishNode(n,"VariableDeclarator")),!this.eat(12))break}return t}parseVarId(t,e){const s=this.parseBindingAtom();(e==="using"||e==="await using")&&(s.type==="ArrayPattern"||s.type==="ObjectPattern")&&this.raise(u.UsingDeclarationHasBindingPattern,s.loc.start),this.checkLVal(s,{type:"VariableDeclarator"},e==="var"?5:8201),t.id=s}parseAsyncFunctionExpression(t){return this.parseFunction(t,8)}parseFunction(t,e=0){const s=e&2,i=!!(e&1),a=i&&!(e&4),n=!!(e&8);this.initFunction(t,n),this.match(55)&&(s&&this.raise(u.GeneratorInSingleStatementContext,this.state.startLoc),this.next(),t.generator=!0),i&&(t.id=this.parseFunctionId(a));const o=this.state.maybeInArrowParameters;return this.state.maybeInArrowParameters=!1,this.scope.enter(2),this.prodParam.enter(ct(n,t.generator)),i||(t.id=this.parseFunctionId()),this.parseFunctionParams(t,!1),this.withSmartMixTopicForbiddingContext(()=>{this.parseFunctionBodyAndFinish(t,i?"FunctionDeclaration":"FunctionExpression")}),this.prodParam.exit(),this.scope.exit(),i&&!s&&this.registerFunctionStatementId(t),this.state.maybeInArrowParameters=o,t}parseFunctionId(t){return t||C(this.state.type)?this.parseIdentifier():null}parseFunctionParams(t,e){this.expect(10),this.expressionScope.enter(_a()),t.params=this.parseBindingList(11,41,2|(e?4:0)),this.expressionScope.exit()}registerFunctionStatementId(t){t.id&&this.scope.declareName(t.id.name,!this.options.annexB||this.state.strict||t.generator||t.async?this.scope.treatFunctionsAsVar?5:8201:17,t.id.loc.start)}parseClass(t,e,s){this.next();const i=this.state.strict;return this.state.strict=!0,this.parseClassId(t,e,s),this.parseClassSuper(t),t.body=this.parseClassBody(!!t.superClass,i),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(29)||this.match(13)||this.match(8)}isClassMethod(){return this.match(10)}nameIsConstructor(t){return t.type==="Identifier"&&t.name==="constructor"||t.type==="StringLiteral"&&t.value==="constructor"}isNonstaticConstructor(t){return!t.computed&&!t.static&&this.nameIsConstructor(t.key)}parseClassBody(t,e){this.classScope.enter();const s={hadConstructor:!1,hadSuperClass:t};let i=[];const a=this.startNode();if(a.body=[],this.expect(5),this.withSmartMixTopicForbiddingContext(()=>{for(;!this.match(8);){if(this.eat(13)){if(i.length>0)throw this.raise(u.DecoratorSemicolon,this.state.lastTokEndLoc);continue}if(this.match(26)){i.push(this.parseDecorator());continue}const n=this.startNode();i.length&&(n.decorators=i,this.resetStartLocationFromNode(n,i[0]),i=[]),this.parseClassMember(a,n,s),n.kind==="constructor"&&n.decorators&&n.decorators.length>0&&this.raise(u.DecoratorConstructor,n)}}),this.state.strict=e,this.next(),i.length)throw this.raise(u.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(a,"ClassBody")}parseClassMemberFromModifier(t,e){const s=this.parseIdentifier(!0);if(this.isClassMethod()){const i=e;return i.kind="method",i.computed=!1,i.key=s,i.static=!1,this.pushClassMethod(t,i,!1,!1,!1,!1),!0}else if(this.isClassProperty()){const i=e;return i.computed=!1,i.key=s,i.static=!1,t.body.push(this.parseClassProperty(i)),!0}return this.resetPreviousNodeTrailingComments(s),!1}parseClassMember(t,e,s){const i=this.isContextual(106);if(i){if(this.parseClassMemberFromModifier(t,e))return;if(this.eat(5)){this.parseClassStaticBlock(t,e);return}}this.parseClassMemberWithIsStatic(t,e,s,i)}parseClassMemberWithIsStatic(t,e,s,i){const a=e,n=e,o=e,c=e,h=e,l=a,p=a;if(e.static=i,this.parsePropertyNamePrefixOperator(e),this.eat(55)){l.kind="method";const T=this.match(139);if(this.parseClassElementName(l),this.parsePostMemberNameModifiers(l),T){this.pushClassPrivateMethod(t,n,!0,!1);return}this.isNonstaticConstructor(a)&&this.raise(u.ConstructorIsGenerator,a.key),this.pushClassMethod(t,a,!0,!1,!1,!1);return}const d=!this.state.containsEsc&&C(this.state.type),f=this.parseClassElementName(e),P=d?f.name:null,k=this.isPrivateName(f),O=this.state.startLoc;if(this.parsePostMemberNameModifiers(p),this.isClassMethod()){if(l.kind="method",k){this.pushClassPrivateMethod(t,n,!1,!1);return}const T=this.isNonstaticConstructor(a);let I=!1;T&&(a.kind="constructor",s.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(u.DuplicateConstructor,f),T&&this.hasPlugin("typescript")&&e.override&&this.raise(u.OverrideOnConstructor,f),s.hadConstructor=!0,I=s.hadSuperClass),this.pushClassMethod(t,a,!1,!1,T,I)}else if(this.isClassProperty())k?this.pushClassPrivateProperty(t,c):this.pushClassProperty(t,o);else if(P==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(f);const T=this.eat(55);p.optional&&this.unexpected(O),l.kind="method";const I=this.match(139);this.parseClassElementName(l),this.parsePostMemberNameModifiers(p),I?this.pushClassPrivateMethod(t,n,T,!0):(this.isNonstaticConstructor(a)&&this.raise(u.ConstructorIsAsync,a.key),this.pushClassMethod(t,a,T,!0,!1,!1))}else if((P==="get"||P==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(f),l.kind=P;const T=this.match(139);this.parseClassElementName(a),T?this.pushClassPrivateMethod(t,n,!1,!1):(this.isNonstaticConstructor(a)&&this.raise(u.ConstructorIsAccessor,a.key),this.pushClassMethod(t,a,!1,!1,!1,!1)),this.checkGetterSetterParams(a)}else if(P==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(f);const T=this.match(139);this.parseClassElementName(o),this.pushClassAccessorProperty(t,h,T)}else this.isLineTerminator()?k?this.pushClassPrivateProperty(t,c):this.pushClassProperty(t,o):this.unexpected()}parseClassElementName(t){const{type:e,value:s}=this.state;if((e===132||e===134)&&t.static&&s==="prototype"&&this.raise(u.StaticPrototype,this.state.startLoc),e===139){s==="constructor"&&this.raise(u.ConstructorClassPrivateField,this.state.startLoc);const i=this.parsePrivateName();return t.key=i,i}return this.parsePropertyName(t),t.key}parseClassStaticBlock(t,e){this.scope.enter(208);const s=this.state.labels;this.state.labels=[],this.prodParam.enter(0);const i=e.body=[];this.parseBlockOrModuleBlockBody(i,void 0,!1,8),this.prodParam.exit(),this.scope.exit(),this.state.labels=s,t.body.push(this.finishNode(e,"StaticBlock")),e.decorators?.length&&this.raise(u.DecoratorStaticBlock,e)}pushClassProperty(t,e){!e.computed&&this.nameIsConstructor(e.key)&&this.raise(u.ConstructorClassField,e.key),t.body.push(this.parseClassProperty(e))}pushClassPrivateProperty(t,e){const s=this.parseClassPrivateProperty(e);t.body.push(s),this.classScope.declarePrivateName(this.getPrivateNameSV(s.key),0,s.key.loc.start)}pushClassAccessorProperty(t,e,s){!s&&!e.computed&&this.nameIsConstructor(e.key)&&this.raise(u.ConstructorClassField,e.key);const i=this.parseClassAccessorProperty(e);t.body.push(i),s&&this.classScope.declarePrivateName(this.getPrivateNameSV(i.key),0,i.key.loc.start)}pushClassMethod(t,e,s,i,a,n){t.body.push(this.parseMethod(e,s,i,a,n,"ClassMethod",!0))}pushClassPrivateMethod(t,e,s,i){const a=this.parseMethod(e,s,i,!1,!1,"ClassPrivateMethod",!0);t.body.push(a);const n=a.kind==="get"?a.static?6:2:a.kind==="set"?a.static?5:1:0;this.declareClassPrivateMethodInScope(a,n)}declareClassPrivateMethodInScope(t,e){this.classScope.declarePrivateName(this.getPrivateNameSV(t.key),e,t.key.loc.start)}parsePostMemberNameModifiers(t){}parseClassPrivateProperty(t){return this.parseInitializer(t),this.semicolon(),this.finishNode(t,"ClassPrivateProperty")}parseClassProperty(t){return this.parseInitializer(t),this.semicolon(),this.finishNode(t,"ClassProperty")}parseClassAccessorProperty(t){return this.parseInitializer(t),this.semicolon(),this.finishNode(t,"ClassAccessorProperty")}parseInitializer(t){this.scope.enter(80),this.expressionScope.enter(Hs()),this.prodParam.enter(0),t.value=this.eat(29)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(t,e,s,i=8331){if(C(this.state.type))t.id=this.parseIdentifier(),e&&this.declareNameFromIdentifier(t.id,i);else if(s||!e)t.id=null;else throw this.raise(u.MissingClassName,this.state.startLoc)}parseClassSuper(t){t.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(t,e){const s=this.parseMaybeImportPhase(t,!0),i=this.maybeParseExportDefaultSpecifier(t,s),a=!i||this.eat(12),n=a&&this.eatExportStar(t),o=n&&this.maybeParseExportNamespaceSpecifier(t),c=a&&(!o||this.eat(12)),h=i||n;if(n&&!o){if(i&&this.unexpected(),e)throw this.raise(u.UnsupportedDecoratorExport,t);return this.parseExportFrom(t,!0),this.sawUnambiguousESM=!0,this.finishNode(t,"ExportAllDeclaration")}const l=this.maybeParseExportNamedSpecifiers(t);i&&a&&!n&&!l&&this.unexpected(null,5),o&&c&&this.unexpected(null,98);let p;if(h||l){if(p=!1,e)throw this.raise(u.UnsupportedDecoratorExport,t);this.parseExportFrom(t,h)}else p=this.maybeParseExportDeclaration(t);if(h||l||p){const d=t;if(this.checkExport(d,!0,!1,!!d.source),d.declaration?.type==="ClassDeclaration")this.maybeTakeDecorators(e,d.declaration,d);else if(e)throw this.raise(u.UnsupportedDecoratorExport,t);return this.sawUnambiguousESM=!0,this.finishNode(d,"ExportNamedDeclaration")}if(this.eat(65)){const d=t,f=this.parseExportDefaultExpression();if(d.declaration=f,f.type==="ClassDeclaration")this.maybeTakeDecorators(e,f,d);else if(e)throw this.raise(u.UnsupportedDecoratorExport,t);return this.checkExport(d,!0,!0),this.sawUnambiguousESM=!0,this.finishNode(d,"ExportDefaultDeclaration")}this.unexpected(null,5)}eatExportStar(t){return this.eat(55)}maybeParseExportDefaultSpecifier(t,e){if(e||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",e?.loc.start);const s=e||this.parseIdentifier(!0),i=this.startNodeAtNode(s);return i.exported=s,t.specifiers=[this.finishNode(i,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(t){if(this.isContextual(93)){t.specifiers??=[];const e=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),e.exported=this.parseModuleExportName(),t.specifiers.push(this.finishNode(e,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(t){if(this.match(5)){const e=t;e.specifiers||(e.specifiers=[]);const s=e.exportKind==="type";return e.specifiers.push(...this.parseExportSpecifiers(s)),e.source=null,e.attributes=[],e.declaration=null,!0}return!1}maybeParseExportDeclaration(t){return this.shouldParseExportDeclaration()?(t.specifiers=[],t.source=null,t.attributes=[],t.declaration=this.parseExportDeclaration(t),!0):!1}isAsyncFunction(){if(!this.isContextual(95))return!1;const t=this.nextTokenInLineStart();return this.isUnparsedContextual(t,"function")}parseExportDefaultExpression(){const t=this.startNode();if(this.match(68))return this.next(),this.parseFunction(t,5);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(t,13);if(this.match(80))return this.parseClass(t,!0,!0);if(this.match(26))return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(u.DecoratorBeforeExport,this.state.startLoc),this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(75)||this.match(74)||this.isLet())throw this.raise(u.UnsupportedDefaultExport,this.state.startLoc);const e=this.parseMaybeAssignAllowIn();return this.semicolon(),e}parseExportDeclaration(t){return this.match(80)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()}isExportDefaultSpecifier(){const{type:t}=this.state;if(C(t)){if(t===95&&!this.state.containsEsc||t===100)return!1;if((t===130||t===129)&&!this.state.containsEsc){const{type:i}=this.lookahead();if(C(i)&&i!==98||i===5)return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(65))return!1;const e=this.nextTokenStart(),s=this.isUnparsedContextual(e,"from");if(this.input.charCodeAt(e)===44||C(this.state.type)&&s)return!0;if(this.match(65)&&s){const i=this.input.charCodeAt(this.nextTokenStartSince(e+4));return i===34||i===39}return!1}parseExportFrom(t,e){this.eatContextual(98)?(t.source=this.parseImportSource(),this.checkExport(t),this.maybeParseImportAttributes(t),this.checkJSONModuleImport(t)):e&&this.unexpected(),this.semicolon()}shouldParseExportDeclaration(){const{type:t}=this.state;return t===26&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))?(this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(u.DecoratorBeforeExport,this.state.startLoc),!0):this.isContextual(107)?(this.raise(u.UsingDeclarationExport,this.state.startLoc),!0):this.isContextual(96)&&this.startsAwaitUsing()?(this.raise(u.UsingDeclarationExport,this.state.startLoc),!0):t===74||t===75||t===68||t===80||this.isLet()||this.isAsyncFunction()}checkExport(t,e,s,i){if(e){if(s){if(this.checkDuplicateExports(t,"default"),this.hasPlugin("exportDefaultFrom")){const a=t.declaration;a.type==="Identifier"&&a.name==="from"&&a.end-a.start===4&&!a.extra?.parenthesized&&this.raise(u.ExportDefaultFromAsIdentifier,a)}}else if(t.specifiers?.length)for(const a of t.specifiers){const{exported:n}=a,o=n.type==="Identifier"?n.name:n.value;if(this.checkDuplicateExports(a,o),!i&&a.local){const{local:c}=a;c.type!=="Identifier"?this.raise(u.ExportBindingIsString,a,{localName:c.value,exportName:o}):(this.checkReservedWord(c.name,c.loc.start,!0,!1),this.scope.checkLocalExport(c))}}else if(t.declaration){const a=t.declaration;if(a.type==="FunctionDeclaration"||a.type==="ClassDeclaration"){const{id:n}=a;if(!n)throw new Error("Assertion failure");this.checkDuplicateExports(t,n.name)}else if(a.type==="VariableDeclaration")for(const n of a.declarations)this.checkDeclaration(n.id)}}}checkDeclaration(t){if(t.type==="Identifier")this.checkDuplicateExports(t,t.name);else if(t.type==="ObjectPattern")for(const e of t.properties)this.checkDeclaration(e);else if(t.type==="ArrayPattern")for(const e of t.elements)e&&this.checkDeclaration(e);else t.type==="ObjectProperty"?this.checkDeclaration(t.value):t.type==="RestElement"?this.checkDeclaration(t.argument):t.type==="AssignmentPattern"&&this.checkDeclaration(t.left)}checkDuplicateExports(t,e){this.exportedIdentifiers.has(e)&&(e==="default"?this.raise(u.DuplicateDefaultExport,t):this.raise(u.DuplicateExport,t,{exportName:e})),this.exportedIdentifiers.add(e)}parseExportSpecifiers(t){const e=[];let s=!0;for(this.expect(5);!this.eat(8);){if(s)s=!1;else if(this.expect(12),this.eat(8))break;const i=this.isContextual(130),a=this.match(134),n=this.startNode();n.local=this.parseModuleExportName(),e.push(this.parseExportSpecifier(n,a,t,i))}return e}parseExportSpecifier(t,e,s,i){return this.eatContextual(93)?t.exported=this.parseModuleExportName():e?t.exported=this.cloneStringLiteral(t.local):t.exported||(t.exported=this.cloneIdentifier(t.local)),this.finishNode(t,"ExportSpecifier")}parseModuleExportName(){if(this.match(134)){const t=this.parseStringLiteral(this.state.value),e=rn.exec(t.value);return e&&this.raise(u.ModuleExportNameHasLoneSurrogate,t,{surrogateCharCode:e[0].charCodeAt(0)}),t}return this.parseIdentifier(!0)}isJSONModuleImport(t){return t.assertions!=null?t.assertions.some(({key:e,value:s})=>s.value==="json"&&(e.type==="Identifier"?e.name==="type":e.value==="type")):!1}checkImportReflection(t){const{specifiers:e}=t,s=e.length===1?e[0].type:null;t.phase==="source"?s!=="ImportDefaultSpecifier"&&this.raise(u.SourcePhaseImportRequiresDefault,e[0].loc.start):t.phase==="defer"?s!=="ImportNamespaceSpecifier"&&this.raise(u.DeferImportRequiresNamespace,e[0].loc.start):t.module&&(s!=="ImportDefaultSpecifier"&&this.raise(u.ImportReflectionNotBinding,e[0].loc.start),t.assertions?.length>0&&this.raise(u.ImportReflectionHasAssertion,e[0].loc.start))}checkJSONModuleImport(t){if(this.isJSONModuleImport(t)&&t.type!=="ExportAllDeclaration"){const{specifiers:e}=t;if(e!=null){const s=e.find(i=>{let a;if(i.type==="ExportSpecifier"?a=i.local:i.type==="ImportSpecifier"&&(a=i.imported),a!==void 0)return a.type==="Identifier"?a.name!=="default":a.value!=="default"});s!==void 0&&this.raise(u.ImportJSONBindingNotDefault,s.loc.start)}}}isPotentialImportPhase(t){return t?!1:this.isContextual(105)||this.isContextual(97)}applyImportPhase(t,e,s,i){e||(this.hasPlugin("importReflection")&&(t.module=!1),s==="source"?(this.expectPlugin("sourcePhaseImports",i),t.phase="source"):s==="defer"?(this.expectPlugin("deferredImportEvaluation",i),t.phase="defer"):this.hasPlugin("sourcePhaseImports")&&(t.phase=null))}parseMaybeImportPhase(t,e){if(!this.isPotentialImportPhase(e))return this.applyImportPhase(t,e,null),null;const s=this.startNode(),i=this.parseIdentifierName(!0),{type:a}=this.state;return(Q(a)?a!==98||this.lookaheadCharCode()===102:a!==12)?(this.applyImportPhase(t,e,i,s.loc.start),null):(this.applyImportPhase(t,e,null),this.createIdentifier(s,i))}isPrecedingIdImportPhase(t){const{type:e}=this.state;return C(e)?e!==98||this.lookaheadCharCode()===102:e!==12}parseImport(t){return this.match(134)?this.parseImportSourceAndAttributes(t):this.parseImportSpecifiersAndAfter(t,this.parseMaybeImportPhase(t,!1))}parseImportSpecifiersAndAfter(t,e){t.specifiers=[];const i=!this.maybeParseDefaultImportSpecifier(t,e)||this.eat(12),a=i&&this.maybeParseStarImportSpecifier(t);return i&&!a&&this.parseNamedImportSpecifiers(t),this.expectContextual(98),this.parseImportSourceAndAttributes(t)}parseImportSourceAndAttributes(t){return t.specifiers??=[],t.source=this.parseImportSource(),this.maybeParseImportAttributes(t),this.checkImportReflection(t),this.checkJSONModuleImport(t),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.match(134)||this.unexpected(),this.parseExprAtom()}parseImportSpecifierLocal(t,e,s){e.local=this.parseIdentifier(),t.specifiers.push(this.finishImportSpecifier(e,s))}finishImportSpecifier(t,e,s=8201){return this.checkLVal(t.local,{type:e},s),this.finishNode(t,e)}parseImportAttributes(){this.expect(5);const t=[],e=new Set;do{if(this.match(8))break;const s=this.startNode(),i=this.state.value;if(e.has(i)&&this.raise(u.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:i}),e.add(i),this.match(134)?s.key=this.parseStringLiteral(i):s.key=this.parseIdentifier(!0),this.expect(14),!this.match(134))throw this.raise(u.ModuleAttributeInvalidValue,this.state.startLoc);s.value=this.parseStringLiteral(this.state.value),t.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(12));return this.expect(8),t}parseModuleAttributes(){const t=[],e=new Set;do{const s=this.startNode();if(s.key=this.parseIdentifier(!0),s.key.name!=="type"&&this.raise(u.ModuleAttributeDifferentFromType,s.key),e.has(s.key.name)&&this.raise(u.ModuleAttributesWithDuplicateKeys,s.key,{key:s.key.name}),e.add(s.key.name),this.expect(14),!this.match(134))throw this.raise(u.ModuleAttributeInvalidValue,this.state.startLoc);s.value=this.parseStringLiteral(this.state.value),t.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(12));return t}maybeParseImportAttributes(t){let e;if(this.match(76)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),e=this.parseImportAttributes()}else this.isContextual(94)&&!this.hasPrecedingLineBreak()?(this.hasPlugin("deprecatedImportAssert")||this.raise(u.ImportAttributesUseAssert,this.state.startLoc),this.addExtra(t,"deprecatedAssertSyntax",!0),this.next(),e=this.parseImportAttributes()):e=[];t.attributes=e}maybeParseDefaultImportSpecifier(t,e){if(e){const s=this.startNodeAtNode(e);return s.local=e,t.specifiers.push(this.finishImportSpecifier(s,"ImportDefaultSpecifier")),!0}else if(Q(this.state.type))return this.parseImportSpecifierLocal(t,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(t){if(this.match(55)){const e=this.startNode();return this.next(),this.expectContextual(93),this.parseImportSpecifierLocal(t,e,"ImportNamespaceSpecifier"),!0}return!1}parseNamedImportSpecifiers(t){let e=!0;for(this.expect(5);!this.eat(8);){if(e)e=!1;else{if(this.eat(14))throw this.raise(u.DestructureNamedImport,this.state.startLoc);if(this.expect(12),this.eat(8))break}const s=this.startNode(),i=this.match(134),a=this.isContextual(130);s.imported=this.parseModuleExportName();const n=this.parseImportSpecifier(s,i,t.importKind==="type"||t.importKind==="typeof",a,void 0);t.specifiers.push(n)}}parseImportSpecifier(t,e,s,i,a){if(this.eatContextual(93))t.local=this.parseIdentifier();else{const{imported:n}=t;if(e)throw this.raise(u.ImportBindingIsString,t,{importName:n.value});this.checkReservedWord(n.name,t.loc.start,!0,!0),t.local||(t.local=this.cloneIdentifier(n))}return this.finishImportSpecifier(t,"ImportSpecifier",a)}isThisParam(t){return t.type==="Identifier"&&t.name==="this"}}class si extends nn{constructor(t,e,s){t=Ur(t),super(t,e),this.options=t,this.initializeScopes(),this.plugins=s,this.filename=t.sourceFilename,this.startIndex=t.startIndex;let i=0;t.allowAwaitOutsideFunction&&(i|=1),t.allowReturnOutsideFunction&&(i|=2),t.allowImportExportEverywhere&&(i|=8),t.allowSuperOutsideMethod&&(i|=16),t.allowUndeclaredExports&&(i|=64),t.allowNewTargetOutsideFunction&&(i|=4),t.allowYieldOutsideFunction&&(i|=32),t.ranges&&(i|=128),t.tokens&&(i|=256),t.createImportExpressions&&(i|=512),t.createParenthesizedExpressions&&(i|=1024),t.errorRecovery&&(i|=2048),t.attachComment&&(i|=4096),t.annexB&&(i|=8192),this.optionFlags=i}getScopeHandler(){return Vt}parse(){this.enterInitialScopes();const t=this.startNode(),e=this.startNode();return this.nextToken(),t.errors=null,this.parseTopLevel(t,e),t.errors=this.state.errors,t.comments.length=this.state.commentsLen,t}}function ii(r,t){if(t?.sourceType==="unambiguous"){t=Object.assign({},t);try{t.sourceType="module";const e=pt(t,r),s=e.parse();if(e.sawUnambiguousESM)return s;if(e.ambiguousScriptDifferentAst)try{return t.sourceType="script",pt(t,r).parse()}catch{}else s.program.sourceType="script";return s}catch(e){try{return t.sourceType="script",pt(t,r).parse()}catch{}throw e}}else return pt(t,r).parse()}function on(r){const t={};for(const e of Object.keys(r))t[e]=vs(r[e]);return t}on(Vr);function pt(r,t){let e=si;const s=new Map;if(r?.plugins){for(const i of r.plugins){let a,n;typeof i=="string"?a=i:[a,n]=i,s.has(a)||s.set(a,n||{})}Qa(s),e=cn(s)}return new e(r,t,s)}const ri=new Map;function cn(r){const t=[];for(const i of en)r.has(i)&&t.push(i);const e=t.join("|");let s=ri.get(e);if(!s){s=si;for(const i of t)s=ti[i](s);ri.set(e,s)}return s}function We(r){if(!r)return null;switch(r.type){case"ObjectExpression":return r.properties.reduce((n,o)=>{if(o.type==="ObjectProperty"){const c=o;let h;if(c.key.type==="Identifier")h=c.key.name;else if(c.key.type==="StringLiteral"||c.key.type==="NumericLiteral")h=c.key.value;else throw new Error(`Unsupported key type in ObjectProperty: ${c.key.type}`);n[h]=We(c.value)}else if(o.type!=="SpreadElement"&&o.type!=="ObjectMethod")throw new Error(`Unsupported property type in ObjectExpression: ${o.type}`);return n},{});case"ArrayExpression":return r.elements.map(n=>{if(!(n&&n.type==="SpreadElement"))return We(n)}).filter(n=>n!==void 0);case"ObjectProperty":const s=r;let i;if(s.key.type==="Identifier")i=s.key.name;else if(s.key.type==="StringLiteral"||s.key.type==="NumericLiteral")i=s.key.value;else throw new Error(`Unsupported key type for standalone ObjectProperty: ${s.key.type}`);const a={};return a[i]=We(s.value),a;case"StringLiteral":case"NumericLiteral":case"BooleanLiteral":return r.value;case"NullLiteral":return null;default:throw new Error(`Unsupported AST node type for JSON conversion: ${r.type}`)}}function Oe(r){switch(r.key.type){case"Identifier":return r.key.name;case"StringLiteral":return r.key.value;default:throw new Error(`Could not extract entities, expected object key to be an \`Identifier\` or \`StringLiteral\`, got \`${r.key.type}\`.`)}}function ai(r,t){const e={};for(const s of t.properties){if(s.type!=="ObjectProperty")throw new Error(`Expected i.entity for \`${r}\` to contain only \`ObjectProperty\`, got \`${s.type}\`.`);const i=Oe(s),a=[];if(s.value.type!=="CallExpression")throw new Error(`Could not extract \`${r}.${i}\`. Expected a call to \`i.string()\`, \`i.number()\`, etc. Got something else.`);let n=s.value,o=null;for(;n;){if(n.callee.type!=="MemberExpression"||n.callee.property.type!=="Identifier"||!(n.callee.object.type==="CallExpression"||n.callee.object.type==="Identifier"&&n.callee.object.name==="i"))throw new Error(`Could not extract \`${r}.${i}\`. Expected a call to \`i.string()\`, \`i.number()\`, etc. Got something else.`);if(n.callee.object.type==="CallExpression")a.push(n.callee.property.name),n=n.callee.object;else{switch(n.callee.property.name){case"string":{o=U.string();break}case"number":{o=U.number();break}case"boolean":{o=U.boolean();break}case"date":{o=U.date();break}case"json":{o=U.json();break}case"any":{o=U.any();break}}n=null}}if(!o)throw new Error(`Could not extract \`${r}.${i}\`. Found no call to \`i.string()\`, \`i.number()\`, etc.`);for(const c of a.reverse())switch(c){case"indexed":{o=o.indexed();break}case"unique":{o=o.unique();break}case"optional":{o=o.optional();break}case"clientRequired":{o=o.clientRequired();break}default:throw new Error(`Could not extract \`${r}.${i}\`. Found a call to \`${c}()\` that is not recognized.`)}e[i]=o}return U.entity(e)}function ni(r){const t={};for(const e of r.properties){if(e.type!=="ObjectProperty")throw new Error(`Expected entities to contain only \`ObjectProperty\`, got \`${e.type}\`.`);const s=Oe(e);if(e.value.type!=="CallExpression"||e.value.callee.type!=="MemberExpression"||e.value.callee.object.type!=="Identifier"||e.value.callee.object.name!=="i"||e.value.arguments.length!==1||e.value.arguments[0].type!=="ObjectExpression")throw new Error(`Could not extract entity \`${s}\`. Expected a call to \`i.entity()\`, got something else.`);t[s]=ai(s,e.value.arguments[0])}return t}function hn(r,t){let e=null,s;for(const i of t.properties){if(i.type!=="ObjectProperty")throw new Error(`Expected entities to contain only \`ObjectProperty\`, got \`${i.type}\`.`);const a=Oe(i);switch(a){case"topics":{if(i.value.type!=="ObjectExpression")throw new Error(`Could not exxtract \`rooms.${r}.topics\`. Expected an object, got \`${i.value.type}\`.`);s=ni(i.value);break}case"presence":{if(i.value.type!=="CallExpression"||i.value.callee.type!=="MemberExpression"||i.value.callee.object.type!=="Identifier"||i.value.callee.object.name!=="i"||i.value.arguments.length!==1||i.value.arguments[0].type!=="ObjectExpression")throw new Error(`Could not extract \`rooms.${r}.presence\`. Expected a call to \`i.entity()\`, got something else.`);e=ai(r,i.value.arguments[0]);break}default:throw new Error(`Could not extract \`rooms.${r}\`. Unexpected property \`${a}\`.`)}}if(!e)throw new Error(`Could not extract room ${r}, \`presence\` key was missing from room definition.`);return{presence:e,topics:s}}function ln(r){const t={};for(const e of r.properties){if(e.type!=="ObjectProperty")throw new Error(`Expected entities to contain only \`ObjectProperty\`, got \`${e.type}\`.`);const s=Oe(e);if(e.value.type!=="ObjectExpression")throw new Error(`Could not extract room \`${s}\`. Expected an object with topics and presence keys, got \`${e.value.type}\`.`);t[s]=hn(s,e.value)}return t}function un(r){let t=null,e={},s={};for(const i of r.program.body){if(i.type!=="VariableDeclaration"||i.declarations.length!==1||i.declarations[0].id.type!=="Identifier"||i.declarations[0].id.name!=="_schema")continue;const a=i.declarations[0];if(!a.init||a.init.type!=="CallExpression"||a.init.callee.type!=="MemberExpression"||a.init.callee.object.type!=="Identifier"||a.init.callee.object.name!=="i"||a.init.arguments.length!==1||a.init.arguments[0].type!=="ObjectExpression")throw new Error("Could not extract schema. Expected a call to `i.schema()`, got something else.");for(const n of a.init.arguments[0].properties){if(n.type!=="ObjectProperty")throw new Error(`Could not extra schema property, expected an \`ObjectProperty\`, got \`${n.type}'.`);const o=Oe(n);if(n.value.type!=="ObjectExpression")throw new Error(`Failed to extract ${o}, expected an \`ObjectExpression\`, got \`${n.value.type}\`.`);switch(Oe(n)){case"entities":{t=ni(n.value);break}case"links":{e=We(n.value)||{};break}case"rooms":{s=ln(n.value);break}}}}if(!t)throw new Error("Could not extract schema, did not find any entities.");return U.schema({entities:t,links:e,rooms:s})}function pn(r,t="backendrelay.schema.ts"){const e=ii(r,{sourceFilename:t,sourceType:"module",errorRecovery:!1,plugins:["typescript"]});if(e.errors?.length)throw new Error(`Could not parse schema file. ${e.errors[0].reasonCode}.`);return un(e)}function dn(r,t){const e=r&&Object.keys(r).length?JSON.stringify(r,null,2):`{
9
+ /**
10
+ * Welcome to BackendRelay's permission system!
11
+ * Right now your rules are empty. To start filling them in, check out the docs:
12
+ * https://www.backendrelay.com/docs/permissions
13
+ *
14
+ * Here's an example to give you a feel:
15
+ * posts: {
16
+ * allow: {
17
+ * view: "true",
18
+ * create: "isOwner",
19
+ * update: "isOwner",
20
+ * delete: "isOwner",
21
+ * },
22
+ * bind: {"isOwner": "auth.id != null && auth.id == data.ownerId"},
23
+ * },
24
+ */
25
+ }
26
+ `.trim();return`// Docs: https://www.backendrelay.com/docs/permissions
27
+
28
+ import type { BackendRelayRules } from "${t??"@backendrelay/core"}";
29
+
30
+ const rules = ${e} satisfies BackendRelayRules;
31
+
32
+ export default rules;
33
+ `}function fn(r){for(const t of r.program.body){if(t.type!=="VariableDeclaration"||t.declarations.length!==1||t.declarations[0].id.type!=="Identifier"||t.declarations[0].id.name!=="rules")continue;const e=t.declarations[0];if(!e.init||e.init.type!=="TSSatisfiesExpression")throw new Error("Could not extract rules");return We(e.init.expression)}throw new Error("Could not extract rules, did not find the rules variable declaration.")}function mn(r,t){const e=ii(r,{sourceFilename:t,sourceType:"module",errorRecovery:!1,plugins:["typescript"]});if(e.errors?.length)throw new Error(`Could not parse perms file. ${e.errors[0].reasonCode}.`);return fn(e)}function Se(r){return Object.entries(r).sort(([t],[e])=>t.localeCompare(e))}function yn(r){return r.charAt(0).toUpperCase()+r.slice(1)}const xn={"many-false":["many","many"],"one-true":["one","one"],"many-true":["many","one"],"one-false":["one","many"]};function Je(r,t=2){if(!r)return r;const e=" ".repeat(t);return r.split(`
34
+ `).map(s=>`${e}${s}`).join(`
35
+ `)}function oi(r,t,e=t){const s=r.join(t);return r.length?s+e:s}function Pn(r){return r["checked-data-type"]?{type:r["checked-data-type"],origin:"checked"}:{type:"any",origin:"unknown"}}function Qt(r){return`"${r}"`}function bn([r,t]){const e=t.metadata.derivedType?.type||t.valueType||"any",s=t.config.unique?".unique()":"",i=t.config.indexed?".indexed()":"",a=t.required?"":".optional()";return`${Qt(r)}: i.${e}()${s}${i}${a}`}function es(r,t){const e=oi(Se(t.attrs).map(bn),`,
36
+ `,",");return`${Qt(r)}: i.entity({${e.length?`
37
+ `:""}${Je(e,2)}${e.length?`
38
+ `:""}})`}function gn(r){return r[1]}function wn(r){return r[2]}function he(r){return`${gn(r)}.${wn(r)}`}function ci(r){return r["forward-identity"]?.[2]}function Tn(r){return r["forward-identity"]?.[1]}function An(r){return r["reverse-identity"]?.[2]}function Sn(r){return r["reverse-identity"]?.[1]}function hi(r){return`${Tn(r)}.${ci(r)}`}function In(r){if(r["reverse-identity"])return`${Sn(r)}.${An(r)}`}function En(r){let t="{";if(r.presence&&(t+=`
39
+ ${Je(es("presence",r.presence),4)},`),r.topics){t+=`
40
+ "topics": {`;for(const[e,s]of Object.entries(r.topics))t+=`
41
+ ${Je(es(e,s),6)},`;t+=`
42
+ }`}return t+=t==="{"?"}":`
43
+ }`,t}function Cn(r){let t="{";for(const[e,s]of Object.entries(r))t+=`
44
+ ${Qt(e)}: ${En(s)},`;return t+=t==="{"?"}":`
45
+ }`,t}function kn(r,t,e){const s=oi(Se(t.entities).map(([l,p])=>es(l,p)),`,
46
+ `,","),i=`{
47
+ ${Je(s,2)}
48
+ }`,a=JSON.stringify(t.links,null,2).trim(),n=r?.rooms||{},o=Cn(n),c=(l,p)=>Je(`${l}: ${p}`,2);return`// Docs: https://www.backendrelay.com/docs/modeling-data
49
+
50
+ import { i } from "${e??"@backendrelay/core"}";
51
+
52
+ const _schema = i.schema({
53
+ ${c("entities",i)},
54
+ ${c("links",a)},
55
+ ${c("rooms",o)}
56
+ });
57
+
58
+ // This helps TypeScript display nicer intellisense
59
+ type _AppSchema = typeof _schema;
60
+ interface AppSchema extends _AppSchema {}
61
+ const schema: AppSchema = _schema;
62
+
63
+ export type { AppSchema }
64
+ export default schema;
65
+ `}class Pe extends Error{constructor(t){super(t),this.name="SchemaValidationError"}}function li(r){const t=r.filter(s=>s.catalog==="system").flatMap(s=>[s["forward-identity"],s["reverse-identity"]].filter(Boolean)).filter(s=>!!s);let e={};for(const[s,i,a]of t)e[i]=e[i]||new Set,e[i].add(a);return e}const ui=(r,t)=>{const e=Object.keys(r.entities);for(const[s,i]of Object.entries(r.entities))if(s.startsWith("$")){if(!t[s])throw new Pe(`The $ keyword is reserved for system namespaces.
66
+ You can't create '${s}'. Perhaps call it '${s.slice(1)}' instead?`);for(const[a,n]of Object.entries(i.attrs))if(!t[s].has(a)&&n.required)throw new Pe(`The '${s}' namespace is managed by the system and can't modify required constraints yet.
67
+ Make sure to set ${s}.${a} as optional.
68
+ i.e { ${a}: i.${n.valueType}().optional() }`)}for(const s of Object.values(r.links)){if(t[s.forward.on]&&!t[s.forward.on].has(s.forward.label)&&s.forward.required)throw new Pe(`The ${s.forward.on} namespace is managed by the system and can't modify required constraints yet.
69
+ Make sure to set ${s.forward.on}${s.forward.label} as 'optional'.
70
+ i.e { 'on': '${s.forward.on}', 'label': ${s.forward.label}, 'required': false }`);if(s.forward.has==="many"&&s.forward.onDelete==="cascade")throw new Pe(`${s.forward.on}${s.forward.label} -> ${s.reverse.on}${s.reverse.label} has onDelete: "cascade" with has: "many"`);if(s.reverse.has==="many"&&s.reverse.onDelete==="cascade")throw new Pe(`${s.forward.on}${s.forward.label} -> ${s.reverse.on}${s.reverse.label} has onDelete: "cascade" with has: "many"`);const i=`${s.forward.on}${s.forward.label} -> ${s.reverse.on}${s.reverse.label}`;if(!e.includes(s.forward.on))throw new Pe(`${i} connects to non existing entity "${s.forward.on}".`);if(!e.includes(s.reverse.on))throw new Pe(`${i} connects to non existing entity "${s.forward.on}".`)}};class dt{#e=[];#t=null;constructor(t){t(this.#s,this.#a,this.#r)}#s=t=>{if(!this.#t)for(const e of this.#e)try{e.next&&e.next(t)}catch{}};#r=t=>{if(!this.#t){this.#t={type:"error",error:t};for(const e of this.#e)try{e.error&&e.error(t)}catch{}this.#e=[]}};#a=t=>{if(!this.#t){this.#t={type:"complete",result:t};for(const e of this.#e)try{e.complete&&e.complete(t)}catch{}this.#e=[]}};subscribe(t){if(this.#t){const e={unsubscribe:()=>null};if(this.#t.type==="error")return t.error&&t.error(this.#t.error),e;if(this.#t.type==="complete")return t.complete&&t.complete(this.#t.result),e}return this.#e.push(t),{unsubscribe:()=>{this.#e=this.#e.filter(e=>e!==t)}}}then(t,e){this.subscribe({error:e,complete:t})}catch(t){this.subscribe({error:t})}finally(t){this.subscribe({error:()=>t(),complete:()=>t()})}}const ft={"many-many":{cardinality:"many","unique?":!1},"one-one":{cardinality:"one","unique?":!0},"many-one":{cardinality:"many","unique?":!0},"one-many":{cardinality:"one","unique?":!1}};Object.fromEntries(Object.entries(ft).map(([r,t])=>[`${t.cardinality}-${t["unique?"]}`,r]));const pi=(r,t,e)=>({type:"add-attr","unique?":r.config.unique,"value-type":"blob",cardinality:"one",identifier:{namespace:t,attrName:e},"required?":r.required,"forward-identity":{attrName:e,namespace:t},"index?":r.config.indexed,"checked-data-type":r.valueType!=="json"?r.valueType:null}),Nn=r=>{const t=`${r.forward.has}-${r.reverse.has}`;return{"checked-data-type":null,"index?":!1,...ft[t],"required?":!!r.forward.required,identifier:{attrName:r.forward.label,namespace:r.forward.on},"value-type":"ref",type:"add-attr","forward-identity":{attrName:r.forward.label,namespace:r.forward.on},"on-delete":r.forward.onDelete,"on-delete-reverse":r.reverse.onDelete,"reverse-identity":{attrName:r.reverse.label,namespace:r.reverse.on}}},mt=(r,t)=>{const e=t.find(s=>s["forward-identity"][1]===r.namespace&&s["forward-identity"][2]===r.attrName)||null;if(!e)throw new Error(`Attribute ${r.namespace}.${r.attrName} not found`);return e},Ie=(r,t)=>{const e=mt(r.identifier,t);return{"attr-id":e.id,"forward-identity":e["forward-identity"]}},vn={index:Ie,unique:Ie,required:Ie,"remove-index":Ie,"remove-unique":Ie,"remove-required":Ie,"delete-attr":(r,t)=>mt(r.identifier,t).id,"update-attr":(r,t)=>{const e=mt(r.identifier,t);return{id:e.id,"forward-identity":r.partialAttr["forward-identity"]?[e.id,r.partialAttr["forward-identity"].namespace,r.partialAttr["forward-identity"].attrName]:void 0,"reverse-identity":r.partialAttr["reverse-identity"]?[e.id,r.partialAttr["reverse-identity"].namespace,r.partialAttr["reverse-identity"].attrName]:void 0,cardinality:r.partialAttr.cardinality?r.partialAttr.cardinality:void 0,"on-delete":r.partialAttr["on-delete"]?r.partialAttr["on-delete"]:void 0,"on-delete-reverse":r.partialAttr["on-delete-reverse"]?r.partialAttr["on-delete-reverse"]:void 0}},"add-attr":(r,t)=>{const e=Ps(),s=[e,r.identifier.namespace,r.identifier.attrName],i=[];return i.push(["add-attr",{"forward-identity":s,"reverse-identity":r["reverse-identity"]?[Ps(),r["reverse-identity"].namespace,r["reverse-identity"].attrName]:null,"inferred-types":null,"value-type":r["value-type"],id:e,cardinality:r.cardinality,"index?":!1,"required?":!1,"unique?":!1,catalog:"user","on-delete":r["on-delete"],"on-delete-reverse":r["on-delete-reverse"],"checked-data-type":r["checked-data-type"]}]),r["unique?"]&&i.push(["unique",{"attr-id":e,"forward-identity":s}]),r["required?"]&&i.push(["required",{"attr-id":e,"forward-identity":s}]),r["index?"]&&i.push(["index",{"attr-id":e,"forward-identity":s}]),i},"remove-data-type":Ie,"check-data-type":(r,t)=>{const e=mt(r.identifier,t);return{"attr-id":e.id,"checked-data-type":r["checked-data-type"],"forward-identity":e["forward-identity"]}}};function le(r,t,e){return!!r[t]?.has(e)}const di=(r,t)=>{if(!t)throw new Error("Existing attributes are required");const e=[];return r.forEach(s=>{const i=vn[s.type];if(!i)throw new Error(`Unknown transaction type: ${s.type}`);const a=i(s,t);Array.isArray(a)?e.push(...a):e.push([s.type,a])}),e},fi=async(r,t,e,s)=>{const i=[],a=r.entities,n=t.entities,o=Object.keys(a),c=Object.keys(n),h=o.filter(m=>!c.includes(m));for(const m of h)Object.keys(a[m].attrs).forEach(D=>{le(s,m,D)||i.push({type:"delete-attr",identifier:{attrName:D,namespace:m}})}),!le(s,m,"id")&&i.push({type:"delete-attr",identifier:{attrName:"id",namespace:m}});const l=c.filter(m=>!o.includes(m));for(const m of l){le(s,m,"id")||i.push({type:"add-attr","forward-identity":{namespace:m,attrName:"id"},identifier:{attrName:"id",namespace:m},"index?":!1,"required?":!0,cardinality:"one","unique?":!0,"value-type":"blob"});for(const D of Object.keys(n[m].attrs)){if(le(s,m,D))continue;const $=n[m].attrs[D];i.push(pi($,m,D))}}const p=o.filter(m=>c.includes(m));for(const m of p){const D=Object.keys(n[m].attrs).filter(N=>le(s,m,N)?!1:!Object.keys(a[m].attrs).includes(N)),$=Object.keys(a[m].attrs).filter(N=>le(s,m,N)?!1:!Object.keys(n[m].attrs).includes(N)),ee=await Pi(D,$,e,{type:"attribute",entityName:m});Object.keys(a[m].attrs).filter(N=>Object.keys(n[m].attrs).includes(N)).forEach(N=>{le(s,m,N)||i.push(...mi({attrName:N,namespace:m},a[m].attrs[N],n[m].attrs[N]))}),ee.deleted.forEach(N=>{i.push({type:"delete-attr",identifier:{attrName:N,namespace:m}})}),ee.created.forEach(N=>{const ae=t.entities[m].attrs[N];i.push(pi(ae,m,N))}),ee.renamed.forEach(N=>{i.push({type:"update-attr",identifier:{attrName:N.from,namespace:m},partialAttr:{"value-type":"blob",cardinality:"one","forward-identity":{attrName:N.to,namespace:m}}}),i.push(...mi({attrName:N.from,namespace:m},a[m].attrs[N.from],n[m].attrs[N.to]))})}const d=Object.values(r.links).filter(m=>!le(s,m.forward.on,m.forward.label)),f=Object.values(t.links).filter(m=>!le(s,m.forward.on,m.forward.label)),P=m=>`${m.forward.on}<->${m.reverse.on}`,k=m=>`${m.forward.on}.${m.forward.label}<->${m.reverse.on}.${m.reverse.label}`,O=new Map,T=new Map;for(const m of f){const D=P(m),$=O.get(D)||[];$.push(m),O.set(D,$)}for(const m of d){const D=P(m),$=T.get(D)||[];$.push(m),T.set(D,$)}const I=new Set([...T.keys(),...O.keys()]);for(const m of I){const D=T.get(m)||[],$=O.get(m)||[],ee=D.map(M=>k(M)),Ee=$.map(M=>k(M)),N=Ee.filter(M=>!ee.includes(M)),ae=ee.filter(M=>!Ee.includes(M));ee.filter(M=>Ee.includes(M)).forEach(M=>{const R=D.find(pe=>k(pe)===M),H=$.find(pe=>k(pe)===M);!R||!H||i.push(...yi({namespace:R.forward.on,attrName:R.forward.label},R,H))});const ue=await Pi(N,ae,e,{type:"link",forwardEntityName:D[0]?.forward.on,reverseEntityName:D[0]?.reverse.on});ue.deleted.forEach(M=>{const R=D.find(H=>k(H)===M);R&&i.push({type:"delete-attr",identifier:{attrName:R.forward.label,namespace:R.forward.on}})}),ue.created.forEach(M=>{const R=$.find(H=>k(H)===M);R&&i.push(Nn(R))}),ue.renamed.forEach(M=>{const R=D.find(pe=>k(pe)===M.from),H=$.find(pe=>k(pe)===M.to);!R||!H||(i.push({type:"update-attr",identifier:{attrName:R.forward.label,namespace:R.forward.on},partialAttr:{"value-type":"ref",cardinality:H.forward.has==="one"?"one":"many","forward-identity":{attrName:H.forward.label,namespace:H.forward.on},"reverse-identity":{attrName:H.reverse.label,namespace:H.reverse.on}}}),i.push(...yi({attrName:R.forward.label,namespace:R.forward.on},R,H)))})}return i},mi=(r,t,e)=>{const s=[],i=a=>{s.push({type:a,identifier:r})};return t.isIndexed===!1&&e.isIndexed===!0&&i("index"),t.isIndexed===!0&&e.isIndexed===!1&&i("remove-index"),t.config.unique===!1&&e.config.unique===!0&&i("unique"),t.config.unique===!0&&e.config.unique===!1&&i("remove-unique"),t.required===!1&&e.required===!0&&i("required"),t.required===!0&&e.required===!1&&i("remove-required"),t.valueType!=="json"&&e.valueType==="json"?s.push({type:"remove-data-type",identifier:r}):t.valueType!==e.valueType&&e.valueType!=="json"&&s.push({type:"check-data-type",identifier:r,"checked-data-type":e.valueType}),s},yi=(r,t,e)=>{const s=[],i=`${t.forward.has}-${t.reverse.has}`,{cardinality:a,"unique?":n}=ft[i],o=!!t.forward.required,c=`${e.forward.has}-${e.reverse.has}`,{cardinality:h,"unique?":l}=ft[c],p=!!e.forward.required;return!n&&l&&s.push({type:"unique",identifier:r}),!l&&l!==n&&s.push({type:"remove-unique",identifier:r}),p!==o&&s.push({type:p?"required":"remove-required",identifier:r}),(t.reverse.onDelete!==e.reverse.onDelete||t.forward.onDelete!==e.forward.onDelete||a!==h)&&s.push({type:"update-attr",identifier:r,partialAttr:{"value-type":"ref","on-delete-reverse":e.reverse.onDelete,"on-delete":e.forward.onDelete,cardinality:h}}),s},xi=r=>typeof r=="object",Pi=async(r,t,e,s)=>{if(t.length===0||r.length===0)return{created:r,deleted:t,renamed:[]};const i={created:[],renamed:[],deleted:[]};let a=0,n=[...t];do{const o=r[a],c=n.map(p=>({from:p,to:o})),h=[o,...c],l=await e(o,h,s);xi(l)?(l.from!==l.to&&i.renamed.push(l),delete n[n.indexOf(l.from)],n=n.filter(Boolean)):i.created.push(o),a+=1}while(a<r.length);return i.deleted.push(...n),i};function bi(r){const[t,e]=r.split(".").map(s=>s.trim());if(!t||!e)throw new Error(`Invalid lookup. Got '${r}'. We expect a pattern like 'entityname.columname;.For example: posts.title`)}function On(r){const t=new Map;for(const e of r){let[s,i]=e.split(":").map(a=>a.trim());if(!s||!i)throw new Error(`Invalid rename command: ${e}. We could not parse a distinct 'from' and 'to'. The structure should look like 'from:to'. For example: 'posts.name:posts.title'`);bi(s),bi(i),t.set(i.trim(),s.trim())}return t}function gi(r){const t=On(r);return async function(s,i,a){let n=[];if(a?.type==="attribute"&&a?.entityName)n=[`${a.entityName}.${s}`];else if(a?.type==="link"){const c=s.split("<->");n=[c[0],c[1]]}else return s;let o=null;for(const c of n)if(t.has(c)){o=t.get(c)||null;break}if(o){let c;if(a?.type==="attribute")c=o.split(".").pop();else{const l=i.find(p=>{const f=(typeof p=="string"?p:p.from).split("<->");return f[0]===o||f[1]===o});if(l)c=typeof l=="string"?l:l.from;else return s}const h=i.some(l=>typeof l=="string"?l===c:l.from?l.from===c:!1);if(c&&h)return{from:c,to:s}}return s}}const Dn=1e4;async function V(r,t){const e={...t?.headers||{},"BackendRelay-Platform-Version":ie,"BackendRelay-Core-Version":ie,"X-BackendRelay-Source":"platform-sdk","X-BackendRelay-Version":ie},s=new AbortController,i=setTimeout(()=>s.abort(),Dn);let a;try{a=await fetch(r,{...t,headers:e,signal:s.signal})}finally{clearTimeout(i)}if(a.status===200){const o=await a.json();return Promise.resolve(o)}const n=await a.text();try{const o=JSON.parse(n);return Promise.reject(new ne({status:a.status,body:o}))}catch{return Promise.reject(new ne({status:a.status,body:{type:void 0,message:n}}))}}function Ln(r){switch(r){case"string":return U.string();case"any":return U.any();case"json":return U.json();case"boolean":return U.boolean();case"date":return U.date();case"number":return U.number();default:{const t=r;throw new Error(`Unknown type ${t}.`)}}}function Mn(r){const t=Pn(r);let e=Ln(t.type);return r["unique?"]&&(e=e.unique()),r["index?"]&&(e=e.indexed()),r["required?"]||(e=e.optional()),e.metadata.derivedType=t,e}function Fn(r){const t={};for(const[e,s]of Se(r))e!=="id"&&(t[e]=Mn(s));return U.entity(t)}function Rn(r){const[,t,e]=r["forward-identity"];return`${t}${yn(e)}`}function Bn(r){const[,t,e]=r["forward-identity"],[,s,i]=r["reverse-identity"],[a,n]=xn[`${r.cardinality}-${r["unique?"]}`];return{forward:{on:t,has:a,label:e,required:r["required?"]||void 0,onDelete:r["on-delete"]==="cascade"?"cascade":void 0},reverse:{on:s,has:n,label:i,onDelete:r["on-delete-reverse"]==="cascade"?"cascade":void 0}}}function wi(r){let t=[];for(const[e,s]of Se(r.blobs))Object.values(s).forEach(i=>{t.push(i)});for(const[e,s]of Se(r.refs))t.push(s);return t}function De(r){const t={};for(const[s,i]of Se(r.blobs))t[s]=Fn(i);const e={};for(const[s,i]of Se(r.refs)){const a=Bn(i),n=Rn(i);e[n]=a}return U.schema({entities:t,links:e})}async function ts(r,t,e){const{schema:s}=await V(`${r}/superadmin/apps/${e}/schema`,{method:"GET",headers:{Authorization:`Bearer ${t}`}});return s}async function yt(r,t,e){const s=await ts(r,t,e);return{schema:De(s)}}function ss(r,t){const[e,s]=r;switch(e){case"add-attr":{const i=s,a=hi(i);return{type:"add-attr",friendlyDescription:i["value-type"]==="blob"?ci(i)==="id"?`Create new entity ${a}.`:`Add attribute ${a}.`:`Link ${a} to ${In(i)}.`,attr:i}}case"update-attr":{const i=s;return{type:"update-attr",friendlyDescription:`Update attribute ${hi(i)}.`,attr:i}}case"index":return{type:"index",friendlyDescription:`Add index to ${he(s["forward-identity"])}.`,attrId:s["attr-id"],forwardIdentity:s["forward-identity"]};case"remove-index":return{type:"remove-index",friendlyDescription:`Remove index from ${he(s["forward-identity"])}.`,attrId:s["attr-id"],forwardIdentity:s["forward-identity"]};case"unique":return{type:"unique",friendlyDescription:`Ensure that ${he(s["forward-identity"])} is unique.`,attrId:s["attr-id"],forwardIdentity:s["forward-identity"]};case"remove-unique":return{type:"remove-unique",friendlyDescription:`Remove uniqueness constraint from ${he(s["forward-identity"])}.`,attrId:s["attr-id"],forwardIdentity:s["forward-identity"]};case"required":return{type:"required",friendlyDescription:`Make ${he(s["forward-identity"])} a required attribute.`,attrId:s["attr-id"],forwardIdentity:s["forward-identity"]};case"remove-required":return{type:"remove-required",friendlyDescription:`Allow ${he(s["forward-identity"])} to be missing or null.`,attrId:s["attr-id"],forwardIdentity:s["forward-identity"]};case"check-data-type":{const i=s["forward-identity"],a=s["checked-data-type"];return{type:"check-data-type",friendlyDescription:`Enforce data type of ${he(i)} as type ${a}.`,attrId:s["attr-id"],forwardIdentity:i,checkedDataType:a}}case"remove-data-type":{const i=s["forward-identity"];return{type:"remove-data-type",friendlyDescription:`Stop enforcing data type of ${he(i)}.`,attrId:s["attr-id"],forwardIdentity:s["forward-identity"]}}case"delete-attr":{const i=s,a=t.find(o=>o.id===i),n=a?he(a["forward-identity"]):i;return{type:"delete-attr",attrId:s,friendlyDescription:`Delete attribute ${n}.`}}default:{const i=e;throw new Error(`Unknown schema operation ${i}.`)}}}function is(r,t){return r.map(e=>ss(e,t))}function _n(r,t,e){const[s,i]=r;if(s==="add-attr"||s==="update-attr"||s==="delete-attr"){const h=ss(r,e);if(h.type!=="add-attr"&&h.type!=="update-attr"&&h.type!=="delete-attr")throw new Error("Invalid step.");return h}const a=i["job-id"],n=t.find(h=>h.id===a),o=ss(r,e),c=$n(n);if(o.type!==c.type)throw new Error("Invalid type");return{...o,backgroundJob:c}}function Le(r,t,e){return r.map(s=>_n(s,t,e))}function Ti(r){if("renames"in r&&!r.overwrite)throw new Error("If you pass in `renames`, you _must_ pass in `overwrite: true`");return!!r.overwrite}async function jn(r,t,e,s){const i=await V(`${r}/superadmin/apps/${e}/schema/push/plan`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({...s,check_types:!0,supports_background_updates:!0})}),a=i["current-attrs"];return{newSchema:De(i["new-schema"]),currentSchema:De(i["current-schema"]),steps:is(i.steps,a)}}async function Ai(r,t,e,s){const i=await ts(r,t,e),a=De(i),n=wi(i),o=li(n),c=s.schema;ui(c,o);const h=("renames"in s?s.renames:null)||[],l=gi(h),p=await fi(a,c,l,o),d=di(p,n);return{currentSchema:a,currentAttrs:n,txSteps:d,steps:is(d,n)}}async function Un(r,t,e,s){const{currentSchema:i,steps:a}=await Ai(r,t,e,s);return{newSchema:s.schema,currentSchema:i,steps:a}}function Si(r){return r.length===0?!0:r.every(t=>t.job_status==="completed"||t.job_status==="errored")}function Ii(r){return r.reduce((e,s)=>{if(s.updated_at){const i=new Date(s.updated_at);if(!e||i>e)return i}return e},null)}async function Ei(r,t,e,s,i,a){let n=100,o=i,c=0;for(;!Si(o);){await new Promise(h=>setTimeout(h,n));try{const h=(await V(`${r}/dash/apps/${e}/indexing-jobs/group/${s}`,{method:"GET",headers:{Authorization:`Bearer ${t}`}})).jobs;if(a(h),Si(h))return h;c=0;const l=Ii(o),p=Ii(h);o=h,n=p===null||l&&l>=p?Math.min(n*2,1e4):100}catch(h){if(c>3)throw h;c++,n=Math.min(n*2,1e4)}}return o}function $n(r){const t={id:r.id,createdAt:new Date(r.created_at),updatedAt:new Date(r.updated_at),status:r.job_status,workEstimate:r.work_estimate,workCompleted:r.work_completed,error:r.error,invalidTriplesSample:r.invalid_triples_sample?.map(e=>({entityId:e.entity_id,value:e.value,jsonType:e.json_type}))};switch(r.job_type){case"remove-data-type":case"index":case"remove-index":case"required":case"remove-required":case"remove-unique":return{...t,type:r.job_type};case"check-data-type":return{...t,type:r.job_type,checkedDataType:r.checked_data_type};case"unique":return{...t,type:r.job_type,invalidUniqueValue:r.invalid_unique_value};default:{const e=r.job_type;throw new Error(`Unknown job type: ${e}.`)}}}function xt(r){const t=r.filter(i=>"backgroundJob"in i&&(i.backgroundJob.status==="processing"||i.backgroundJob.status==="waiting")),e=r.filter(i=>!("backgroundJob"in i)||i.backgroundJob.status==="completed"),s=r.filter(i=>"backgroundJob"in i&&i.backgroundJob.status==="errored");return{friendlyDescription:t.length?`Completing ${t.length} of ${r.length} schema operations.`:`Finished ${r.length} schema operation${r.length===1?"":"s"}${s.length?`, with ${s.length} error${s.length>1?"s":""}`:"."}`,totalCount:r.length,inProgressCount:t.length,completedCount:e.length,errorCount:s.length,steps:r,inProgressSteps:t,completedSteps:e,erroredSteps:s}}function qn(r,t,e,s){return new dt(async(i,a,n)=>{try{const o=await ts(r,t,e),c=wi(o),h=await V(`${r}/superadmin/apps/${e}/schema/push/apply`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({...s,check_types:!0,supports_background_updates:!0})}),l=h["indexing-jobs"],p=l?await Ei(r,t,e,l["group-id"],l.jobs,f=>{i(xt(Le(h.steps,f,c)))}):[],d=await yt(r,t,e);a({newSchema:d.schema,steps:Le(h.steps,p,c),summary:xt(Le(h.steps,p,c))})}catch(o){n(o)}})}function zn(r,t,e,s){return new dt(async(i,a,n)=>{try{const{currentAttrs:o,txSteps:c}=await Ai(r,t,e,s),h=await V(`${r}/dash/apps/${e}/schema/steps/apply`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({steps:c})}),l=h["indexing-jobs"],p=l?await Ei(r,t,e,l["group-id"],l.jobs,f=>{i(xt(Le(h.steps,f,o)))}):[],d=await yt(r,t,e);a({newSchema:d.schema,steps:Le(h.steps,p,o),summary:xt(Le(h.steps,p,o))})}catch(o){n(o)}})}const Vn={"https://api.backendrelay.com":{keys:[{kty:"OKP",crv:"Ed25519",alg:"EdDSA",use:"sig",kid:"1034696293",x:"N-C41432STKAKkXAWmeIOXMnZcGRR1b9u1L3bTVqI_o"}]},"http://localhost:8888":{keys:[{kty:"OKP",crv:"Ed25519",alg:"EdDSA",use:"sig",kid:"503090235",x:"qrSkwDaMITRMF9nOgpueqxgaAiuFmJperYE3mkyl8Ow"}]}};function Hn(r){if(r.kty==="OKP"&&r.crv==="Ed25519")return{name:"Ed25519"};if(r.kty==="EC")return{name:"ECDSA",namedCurve:r.crv};if(r.kty==="RSA")return{name:"RSASSA-PKCS1-v1_5",hash:{RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"}[r.alg]||"SHA-256"};throw new Error(`Unsupported JWK configuration: kty=${r.kty}, crv=${r.crv}`)}async function Kn(r){const t=Hn(r),e=await crypto.subtle.importKey("jwk",r,t,!1,["verify"]);return{alg:t,key:e}}function Wn(r,t,e,s){return crypto.subtle.verify(r,t,e,s)}function Jn(r){const t=new Uint8Array(Math.ceil(r.length/2));for(let e=0;e<t.length;e++)t[e]=parseInt(r.substring(e*2,e*2+2),16);return t}function Gn(r){let t,e,s;for(const a of r.split(",")){const[n,o]=a.split("=");switch(n){case"t":{t=o;break}case"kid":{e=o;break}case"v1":{s=o;break}}}const i=[];if(t||i.push("t"),e||i.push("kid"),s||i.push("v1"),i.length||!t||!e||!s)throw new z("Invalid BackendRelay-Signature header.",{header:r,missingKeys:i});return{t,kid:e,v1:s}}function Xn(r,t,e){if(Math.floor(r.getTime()/1e3)-parseInt(t,10)>e)throw new z("Webhook signature is too old",{tolerance:e,receivedAt:r,t})}const Ge=new Map,Me=new Map,Ci=6e4,Yn=32;function Zn(r){let t=Me.get(r);if(t?Me.delete(r):t={keys:null,fetchedAt:0,failedAt:0,inflight:null},Me.set(r,t),Me.size>Yn){const e=Me.keys().next().value;if(e!==void 0){Me.delete(e);const s=`${e}:`;for(const i of Ge.keys())i.startsWith(s)&&Ge.delete(i)}}return t}const Qn=300;async function eo(r,t){const e=await t.text();try{const s=JSON.parse(e);return r(new ne({status:t.status,body:s}))}catch{return r(new ne({status:t.status,body:{type:void 0,message:e}}))}}const to=async(r,t)=>{const e={...t?.headers||{},"BackendRelay-Core-Version":ie},s=await fetch(r,{...t,headers:e});return s.status===200?s.json():eo(i=>Promise.reject(i),s)};function ki(r){return r?new Date(r):null}function Fe(r){return{id:r.id,sink:r.sink,namespaces:r.namespaces??[],actions:r.actions,status:r.status,disabledReason:r.disabled_reason??null,createdAt:new Date(r.created_at),updatedAt:new Date(r.updated_at)}}function so(r){return{attemptAt:ki(r["attempt-at"]),durationMs:r["duration-ms"]??null,success:r["success?"]??null,statusCode:r["status-code"]??null,responseText:r["response-text"]??null,errorType:r["error-type"]??null,errorMessage:r["error-message"]??null}}function rs(r){return{isn:r.isn,status:r.status,attempts:r.attempts?r.attempts.map(so):null,nextAttemptAfter:ki(r.next_attempt_after),createdAt:new Date(r.created_at),updatedAt:new Date(r.updated_at)}}class Ni{#e;#t;#s;#r;#a;constructor(t){this.#e=t.appId,this.#t=t.apiURI,this.#s=t.token,this.#r=t.withAuth,this.#a=t.jsonFetch}#i(t,e){if(!this.#e)throw new z("appId is required to manage webhooks. Pass it to the Webhooks constructor.");const s=i=>{const a={method:e?.method,headers:{authorization:`Bearer ${i}`,"content-type":"application/json"}};return e?.body!==void 0&&(a.body=JSON.stringify(e.body)),this.#a(`${this.#t}${t}`,a)};if(this.#r)return this.#r(s);if(!this.#s)throw new z("A token is required to manage webhooks. Pass `adminToken` or `token` to the Webhooks constructor.");return s(this.#s)}async list(){return((await this.#i(`/dash/apps/${this.#e}/webhooks`)).webhooks||[]).map(Fe)}async create(t){const e=await this.#i(`/dash/apps/${this.#e}/webhooks`,{method:"POST",body:t});return Fe(e.webhook)}async update(t,e){const s=await this.#i(`/dash/apps/${this.#e}/webhooks/${t}`,{method:"POST",body:e});return Fe(s.webhook)}async delete(t){const e=await this.#i(`/dash/apps/${this.#e}/webhooks/${t}`,{method:"DELETE"});return Fe(e.webhook)}async enable(t){const e=await this.#i(`/dash/apps/${this.#e}/webhooks/${t}/enable`,{method:"POST",body:{}});return Fe(e.webhook)}async disable(t,e){const s=e?.reason?{reason:e.reason}:{},i=await this.#i(`/dash/apps/${this.#e}/webhooks/${t}/disable`,{method:"POST",body:s});return Fe(i.webhook)}async listEvents(t,e){const s=e?.after?`?after=${encodeURIComponent(e.after)}`:"",i=await this.#i(`/dash/apps/${this.#e}/webhooks/${t}/events${s}`);return{events:(i.events||[]).map(rs),pageInfo:{startCursor:i.pageInfo?.startCursor??null,endCursor:i.pageInfo?.endCursor??null,hasNextPage:!!i.pageInfo?.hasNextPage}}}async getEvent(t,e){const s=await this.#i(`/dash/apps/${this.#e}/webhooks/${t}/events/${e}`);return rs(s.event)}async getPayload(t,e){return this.#i(`/webhooks/payload/${this.#e}/${t}/${e}`)}async resendEvent(t,e){const s=await this.#i(`/dash/apps/${this.#e}/webhooks/${t}/events/${e}`,{method:"POST",body:{}});return rs(s.event)}}class Pt{appId;schema;#e;apiURI;#t;manager;static helpers(){function t(...s){if(s.length===2)return{$default:s[1]};const[i,a,n]=s;return{[i]:{[a]:n}}}function e(...s){const i={};for(const a of s)for(const n of Object.keys(a))n==="$default"?i.$default=a.$default:i[n]={...i[n],...a[n]};return i}return{typedHandlers:t,combineHandlers:e}}helpers(){return Pt.helpers()}constructor(t,e){this.appId=t.appId,this.schema=t.schema,this.#e=t.adminToken||t.token,this.apiURI=$e(t.apiURI,"BackendRelay webhooks"),this.#t=e||to,this.manager=new Ni({appId:this.appId,apiURI:this.apiURI,token:this.#e,withAuth:t.withAuth,jsonFetch:this.#t})}async fetchJwks(){return await this.#t(`${this.apiURI}/.well-known/webhooks/jwks.json`)}async keyOfKid(t){const e=`${this.apiURI}:${t}`,s=Ge.get(e);if(s&&(s.exp===null||Date.now()<s.exp))return s;s&&Ge.delete(e);const i=Vn[this.apiURI]?.keys.find(o=>o.kid===t)||(await this.#s(s!==void 0)).find(o=>o.kid===t);if(!i)throw new z("Could not find matching signing key",{kid:t});const a=await Kn(i),n=typeof i.exp=="number"?i.exp*1e3:null;return Ge.set(e,{...a,exp:n}),a}async#s(t=!1){const e=Zn(this.apiURI),s=Date.now();if(!t&&e.keys&&s-e.fetchedAt<Ci)return e.keys;if(s-e.failedAt<Ci)throw new z("Could not fetch issuer signing keys",{issuer:this.apiURI});return e.inflight||(e.inflight=this.fetchJwks().then(i=>{const a=i?.keys??[];return e.keys=a,e.fetchedAt=Date.now(),a}).catch(i=>{throw e.failedAt=Date.now(),i}).finally(()=>{e.inflight=null})),e.inflight}async validate(t,e,s){const i=s?.receivedAt||new Date,{t:a,kid:n,v1:o}=Gn(t),c=s?.tolerance??Qn;Xn(i,a,c);const{alg:h,key:l}=await this.keyOfKid(n),p=typeof e=="function"?await e():e,d=new TextEncoder().encode(`${a}.${p}`);if(!await Wn(h,l,Jn(o),d))throw new z("BackendRelay Signature did not validate",{header:t});const P=JSON.parse(p);if(typeof P!="object"||typeof P.payloadUrl!="string"||typeof P.token!="string")throw new z("Invalid webhook body, expected an object with payloadUrl and token fields",{body:P});return P}async validateRequest(t,e){const s=t.headers.get("BackendRelay-Signature");if(!s)throw new z("Request is missing BackendRelay-Signature header");return this.validate(s,()=>t.text(),e)}fetchPayloads({payloadUrl:t,token:e}){return this.#t(t,{headers:{Authorization:`Bearer ${e}`,accept:"application/json"}})}async processPayload(t,e){const s=[];for(const i of e.data){const{namespace:a,action:n}=i,o=t?.[a]?.[n]||t?.[a]?.$default||t?.$default;o&&s.push(o(i))}await Promise.all(s)}async processRequest(t,e,s){const i=await this.validateRequest(e,s),a=await this.fetchPayloads(i);await this.processPayload(t,a)}async processNodeRequest(t,e,s){let i,a=!1,n=s?.body??e.rawBody??e.body;if(n!=null&&typeof n.then=="function"&&(n=await n),typeof n=="string")i=n;else if(n instanceof Uint8Array)i=new TextDecoder("utf-8").decode(n);else if(n!=null&&typeof n=="object")try{i=JSON.stringify(n),a=!0}catch{throw new z("Webhook request body has already been parsed and could not be re-serialized. Configure this route to receive the raw request body instead of parsed JSON.")}else if(e[Symbol.asyncIterator]){const p=new TextEncoder,d=[];for await(const O of e)d.push(typeof O=="string"?p.encode(O):O);let f=0;for(const O of d)f+=O.byteLength;const P=new Uint8Array(f);let k=0;for(const O of d)P.set(O,k),k+=O.byteLength;i=new TextDecoder("utf-8").decode(P)}else throw new z("Could not read the webhook request body. Pass a Node IncomingMessage with an unconsumed stream, or set `req.body` to the raw bytes (Buffer/Uint8Array) or string.");const o=typeof e.headers.host=="string"?e.headers.host:"localhost",c=new URL(e.url??"/",`https://${o}`),h=new Headers;for(const[p,d]of Object.entries(e.headers))typeof d=="string"?h.set(p,d):Array.isArray(d)&&h.set(p,d.join(", "));const l=new Request(c,{method:e.method??"POST",headers:h,body:i});try{await this.processRequest(t,l,s)}catch(p){throw a&&p instanceof z&&p.message==="BackendRelay Signature did not validate"?new z("Webhook signature did not validate. The request body was re-serialized from a parsed JSON object, which can produce different bytes than the server signed. Configure this route to receive the raw request body instead of parsed JSON.",{hint:p.hint}):p}}}const io=3,ro=500,ao=5e3,no=(r,t)=>r!=null&&Number.isInteger(r)&&r>0?r:t,oo=(r,t)=>r!=null&&Number.isFinite(r)&&r>=0?r:t,vi=r=>r?.name==="AbortError",Oi=r=>r instanceof Error?r.message:String(r),co=(r,t)=>new Promise((e,s)=>{const i=()=>{clearTimeout(a),s(t.reason??new DOMException("Aborted","AbortError"))},a=setTimeout(()=>{t.removeEventListener("abort",i),e()},r);t.addEventListener("abort",i,{once:!0})});function ho(r,t){let e=!1;return new ReadableStream({async pull(s){if(!e){if(e=!0,r.done){s.close();return}s.enqueue(r.value);return}const{done:i,value:a}=await t.read();i?s.close():s.enqueue(a)},async cancel(s){await t.cancel(s)}})}async function Di(r,t){let e;for(let s=1;s<=t.attempts;s++){t.signal.throwIfAborted();let i;try{i=(await r()).getReader();const n=await i.read();return ho(n,i)}catch(a){if(i&&i.cancel().catch(()=>{}),vi(a))throw a;if(e=a,s<t.attempts){const n=Math.min(t.delayMs*2**(s-1),ao);await co(n,t.signal)}}}throw new Error(t.describe(e))}async function lo(r){const{manager:t,backup:e,fetchBody:s,createWriter:i,onProgress:a}=r,n=new AbortController;r.signal?.aborted?n.abort():r.signal?.addEventListener("abort",()=>n.abort(),{once:!0});const o=n.signal;let c=0,h=null,l=0,p=null,d=0,f=0,P="",k="";const O=e.uncompressedSize!=null?e.uncompressedSize+(e.filesSize??0):null,T=no(r.retry?.attempts,io),I=oo(r.retry?.delayMs,ro),m=()=>a?.({entitiesCompleted:c,entitiesTotal:h,filesCompleted:l,filesTotal:p,zipBytes:d,bytesRead:f,bytesTotal:O,currentEntity:P,currentFile:k}),D=100;let $=0;const ee=()=>{const B=Date.now();B-$>=D&&($=B,m())},Ee=B=>B.pipeThrough(new TransformStream({transform(F,q){f+=F.byteLength,ee(),q.enqueue(F)}})),N=[];let ae=0,as=!1,ue=null,M=null;const R=()=>{const B=M;M=null,B?.()},H=(async()=>{let B=!1;try{for await(const F of t.streamStorageFiles(e.id,{signal:o}))N.push(F),p=(p??0)+1,ee(),R();B=!0}catch(F){vi(F)||(ue=F)}finally{B&&p==null&&(p=0),as=!0,m(),R()}})(),pe=(async function*(){const B=await t.listFiles(e.id,{signal:o});if(B.length===0)throw new Error("No files found for this backup.");if(B[0].name!=="config.json")throw new Error(`Backup files came back in an unexpected order (expected config.json first, got "${B[0].name}").`);h=B.filter(F=>F.name!=="config.json").length,m();for(const F of B)yield async()=>{const q=await Di(async()=>{const te=await t.getFileUrl(e.id,F.name,{signal:o});return s(te,o)},{signal:o,attempts:T,delayMs:I,describe:te=>`Failed to fetch ${F.name}: ${Oi(te)}.`});return{name:F.name,input:Ee(q),onWriting:()=>{P=F.name,k="",m()},onAdded:()=>{F.name!=="config.json"&&c++,m()}}};for(;;){if(ue)throw ue;o.throwIfAborted();let F;if(ae<N.length&&(F=N[ae],N[ae]=void 0,ae++),F){const q=F,te=q.path||q.locationId;yield async()=>{const qo=await Di(()=>s(q.url,o),{signal:o,attempts:T,delayMs:I,describe:zo=>`Couldn't download storage file "${te}" (${Oi(zo)}).`});return{name:`files/${q.locationId}`,input:Ee(qo),onWriting:()=>{P="",k=te,m()},onAdded:()=>{l++,m()}}}}else{if(as)break;await new Promise(q=>{M=q})}}if(ue)throw ue})(),bt=r.sink.getWriter();try{const B=new WritableStream({async write(q){d+=q.byteLength,ee(),await bt.write(q)},async close(){await bt.close(),m()},async abort(q){await bt.abort(q)}}),F=await i(B,o);for await(const q of pe){const te=await q();te.onWriting(),await F.add(te.name,te.input,{lastModDate:e.backupAt}),te.onAdded()}return P="",k="",m(),o.throwIfAborted(),await F.close(),await H,m(),{entities:c,files:l,zipBytes:d}}catch(B){throw n.abort(),await bt.abort(B).catch(()=>{}),B}}function Li(r){return{id:r.id,isn:r.isn,backupAt:new Date(r.backup_at),filesSize:r.files_size,dbSize:r.db_size,uncompressedSize:r.uncompressed_size,description:r.description,expiresAt:r.expires_at?new Date(r.expires_at):null}}function uo(r){return`backendrelay-backup-${r.backupAt.toISOString().replace(/[:.]/g,"-")}.zip`}function po(r){if(r<1e3)return`${r} B`;const t=["KB","MB","GB","TB"];let e=-1,s=r;do s/=1e3,e++;while(s>=1e3&&e<t.length-1);let i=s<10?2:s<100?1:0;return Number(s.toFixed(i))>=1e3&&e<t.length-1&&(s/=1e3,e++,i=2),`${s.toFixed(i)} ${t[e]}`}function fo(r){const t=r.uncompressedSize??r.dbSize;if(t==null||r.filesSize==null)return null;const e=t+r.filesSize;return{min:Math.round(e/4),max:e}}function Mi(r){return{authorization:`Bearer ${r}`,"BackendRelay-Platform-Version":ie,"BackendRelay-Core-Version":ie,"X-BackendRelay-Source":"platform-sdk","X-BackendRelay-Version":ie}}async function Fi(r){const t=await r.text();try{return new ne({status:r.status,body:JSON.parse(t)})}catch{return new ne({status:r.status,body:{type:void 0,message:t}})}}async function*mo(r){const t=r.getReader();try{const e=new TextDecoder;let s="";for(;;){const{done:a,value:n}=await t.read();if(a)break;s+=e.decode(n,{stream:!0});let o=s.indexOf(`
71
+ `);for(;o!==-1;){const c=s.slice(0,o).trim();s=s.slice(o+1),c.length>0&&(yield JSON.parse(c)),o=s.indexOf(`
72
+ `)}}const i=s.trim();i.length>0&&(yield JSON.parse(i))}finally{await t.cancel().catch(()=>{})}}class Ri{#e;#t;#s;constructor(t){this.#e=t.appId,this.#t=t.apiURI,this.#s=t.withAuth}#r(t,e){return this.#s(async s=>{const i=await fetch(`${this.#t}${t}`,{headers:Mi(s),signal:e});if(i.status!==200)throw await Fi(i);return i.json()})}async list(t){return((await this.#r(`/dash/apps/${this.#e}/backups`,t?.signal)).backups||[]).map(Li)}async listFiles(t,e){return(await this.#r(`/dash/apps/${this.#e}/backups/${t}/files`,e?.signal)).files||[]}async getFileUrl(t,e,s){return(await this.#r(`/dash/apps/${this.#e}/backups/${t}/file-url?name=${encodeURIComponent(e)}`,s?.signal)).url}async*streamStorageFiles(t,e){const s=await this.#s(async a=>{const n=await fetch(`${this.#t}/dash/apps/${this.#e}/backups/${t}/storage-files`,{headers:Mi(a),signal:e?.signal});if(n.status!==200)throw await Fi(n);return n});if(!s.body)throw new Error("Storage file listing returned no body.");let i=!1;for await(const a of mo(s.body)){if(a.done===!0){i=!0;break}if(typeof a.locationId!="string"||a.locationId.length===0||/[/\\\u0000-\u001f\u007f]/.test(a.locationId)||a.locationId==="."||a.locationId===".."||typeof a.url!="string"||a.url.length===0)throw new Error("Storage file listing returned a malformed record. Please retry the download.");yield{locationId:a.locationId,path:a.path??null,url:a.url}}if(!i)throw new Error("Storage file listing ended before it finished. Please retry the download.")}downloadArchive(t){return lo({manager:this,...t})}}async function yo({code:r,clientId:t,clientSecret:e,redirectUri:s,apiURI:i}){const a=$e(i,"BackendRelay OAuth token exchange"),n=await fetch(`${a}/platform/oauth/token`,{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:r,redirect_uri:s,client_id:t,client_secret:e})});if(!n.ok){const c=await n.text();let h;try{const l=JSON.parse(c);h={error:l.error,errorDescription:l.error_description,message:`OAuth error: ${l.error||"server_error"}`}}catch{h={error:"server_error",message:"OAuth error: server_error"}}throw new J(h)}const o=await n.json();return{accessToken:o.access_token,expiresAt:new Date(Date.now()+(o.expires_in-30)*1e3),refreshToken:o.refresh_token,scopes:o.scopes,tokenType:o.token_type}}async function Bi({clientId:r,clientSecret:t,refreshToken:e,apiURI:s}){const i=$e(s,"BackendRelay OAuth token refresh"),n=await(await fetch(`${i}/platform/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:e,client_id:r,client_secret:t})})).json();return{accessToken:n.access_token,expiresAt:new Date((n.expires_in-30)*1e3),scopes:n.scopes,tokenType:n.token_type}}async function _i(r,t,e){return await V(`${r}/superadmin/apps/${e}/perms`,{method:"GET",headers:{Authorization:`Bearer ${t}`}})}async function xo(r,t,e,s){return{perms:(await V(`${r}/superadmin/apps/${e}/perms`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({code:s.perms})})).rules.code}}function be(r){const t={id:r.id,title:r.title,createdAt:new Date(r.created_at),orgId:r.org_id,...r["admin-token"]?{adminToken:r["admin-token"]}:{}},e="perms"in r?{perms:r.perms}:{},s="schema"in r?{schema:De(r.schema)}:{};return{...t,...e,...s}}function Po(r){return{id:r.id,title:r.title,createdAt:new Date(r.created_at)}}async function bo(r,t,e){const s=new URL(`${r}/superadmin/apps`),i=[];return e?.includePerms&&i.push("perms"),e?.includeSchema&&i.push("schema"),i.length&&s.searchParams.set("include",i.join(",")),{apps:(await V(s.toString(),{method:"GET",headers:{Authorization:`Bearer ${t}`}})).apps.map(be)}}async function go(r,t){const e=new URL(`${r}/superadmin/orgs`);return{orgs:(await V(e.toString(),{method:"GET",headers:{Authorization:`Bearer ${t}`}})).orgs.map(Po)}}async function wo(r,t,e,s){const i=new URL(`${r}/superadmin/orgs/${e}/apps`),a=[];return s?.includePerms&&a.push("perms"),s?.includeSchema&&a.push("schema"),a.length&&i.searchParams.set("include",a.join(",")),{apps:(await V(i.toString(),{method:"GET",headers:{Authorization:`Bearer ${t}`}})).apps.map(be)}}async function To(r,t,e,s){let i=null,a=null;s?.includePerms&&(i=_i(r,t,e)),s?.includeSchema&&(a=yt(r,t,e));const{app:n}=await V(`${r}/superadmin/apps/${e}`,{method:"GET",headers:{Authorization:`Bearer ${t}`}});return!i&&!a?{app:be(n)}:{app:{...be(n),...i?{perms:(await i).perms}:{},...a?{schema:(await a).schema}:{}}}}async function Ao(r,t,e){const s=e;s.org_id=e.orgId;const{app:i}=await V(`${r}/superadmin/apps`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(s)});return{app:{...be(i),adminToken:i["admin-token"]}}}async function So(r,t){const e=await V(`${r}/dash/apps/ephemeral`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return{app:{...be(e.app),adminToken:e.app["admin-token"]},expiresMs:e.expires_ms}}async function Io(r,t,e,s){const{app:i}=await V(`${r}/superadmin/apps/${e}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(s)});return{app:be(i)}}async function Eo(r,t,e){const{app:s}=await V(`${r}/superadmin/apps/${e}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return{app:be(s)}}async function Co(r,t){const e=await V(`${r}/platform/oauth/token-info?access_token=${t}`,{method:"GET"});return{tokenType:e.token_type,scopes:e.scopes,expiresAt:new Date(Date.now()+(e.expires_in-60)*1e3)}}class Re extends Error{constructor(){super("PlatformApi was not provided auth.")}}class ko{#e;#t;constructor(t){this.#e=t?.auth,this.#t=$e(t?.apiURI,"BackendRelay PlatformApi")}token(){if(!this.#e)throw new Re;return"token"in this.#e?this.#e.token:this.#e.accessToken}canRefreshToken(){if(!this.#e)throw new Re;return"refreshToken"in this.#e&&"clientId"in this.#e&&"clientSecret"in this.#e&&this.#e.refreshToken!=null&&this.#e.clientId!=null&&this.#e.clientSecret!=null}async refreshToken(){if(!this.#e)throw new Re;if(!this.canRefreshToken()||!("clientId"in this.#e))return null;const t=await Bi({apiURI:this.#t,clientId:this.#e.clientId,clientSecret:this.#e.clientSecret,refreshToken:this.#e.refreshToken});return this.#e.accessToken=t.accessToken,this.#e.onRefresh&&await this.#e.onRefresh(t),t}async withRetry(t,e){let s=0;const[i,a,...n]=e;let o=a;for(;s<2;)try{return await t(i,o,...n)}catch(c){if(c instanceof ne&&(c.status===401||c.body?.type==="record-expired"||c.body?.type==="record-not-found"&&c.body.hint["record-type"].match(/token/i))&&this.canRefreshToken()){const h=await this.refreshToken();if(h){o=h.accessToken,s++;continue}}throw c}}async getApp(t,e){return this.withRetry(To,[this.#t,this.token(),t,e])}async getApps(t){return this.withRetry(bo,[this.#t,this.token(),t])}async getOrgs(){return this.withRetry(go,[this.#t,this.token()])}async getAppsForOrg(t,e){return this.withRetry(wo,[this.#t,this.token(),t,e])}async getSchema(t){return this.withRetry(yt,[this.#t,this.token(),t])}async getPerms(t){return this.withRetry(_i,[this.#t,this.token(),t])}async createApp(t){return this.withRetry(Ao,[this.#t,this.token(),t])}async createTemporaryApp(t){return So(this.#t,t)}async updateApp(t,e){return this.withRetry(Io,[this.#t,this.token(),t,e])}async deleteApp(t){return this.withRetry(Eo,[this.#t,this.token(),t])}async planSchemaPush(t,e){const s=Ti(e);return this.withRetry(s?Un:jn,[this.#t,this.token(),t,e])}schemaPush(t,e){if(!this.#e)throw new Re;return new dt(async(s,i,a)=>{try{const o=Ti(e)?zn:qn;if(this.canRefreshToken())try{await this.refreshToken()}catch{}o(this.#t,this.token(),t,e).subscribe({complete(c){i(c)},error(c){a(c)},next(c){s(c)}})}catch(n){a(n)}})}async pushPerms(t,e){if(!this.#e)throw new Re;return this.withRetry(xo,[this.#t,this.token(),t,e])}async tokenInfo(){if(!this.#e)throw new Re;return this.withRetry(Co,[this.#t,this.token()])}webhooks(t,e){const s=i=>this.withRetry((a,n)=>i(n),[this.#t,this.token()]);return new Pt({appId:t,apiURI:this.#t,schema:e?.schema,withAuth:s})}backups(t){const e=s=>this.withRetry((i,a)=>s(a),[this.#t,this.token()]);return new Ri({appId:t,apiURI:this.#t,withAuth:e})}}function No(r){try{return Buffer.from(r,"base64").toString("utf-8")}catch{return Buffer.from(r,"base64url").toString("utf-8")}}function vo(r){try{const t=r.split("_"),e=t[t.length-1];return No(e).replace("$","")}catch(t){return console.error("Error getting domain from clerk key",t),null}}function Oo(r){return`${r.replace(/\/+$/,"")}/runtime/oauth/callback`}const Do="https://accounts.google.com/o/oauth2/v2/auth",Lo="https://oauth2.googleapis.com/token",Mo="https://accounts.google.com/.well-known/openid-configuration",Fo="https://appleid.apple.com/auth/authorize",Ro="https://appleid.apple.com/auth/token",Bo="https://appleid.apple.com/.well-known/openid-configuration",_o="https://www.linkedin.com/oauth/v2/authorization",jo="https://www.linkedin.com/oauth/v2/accessToken",Uo="https://www.linkedin.com/oauth/.well-known/openid-configuration";function $o(r,t){const e=structuredClone(t),s=r.entities;for(const[i,a]of Object.entries(s))if(!i.startsWith("$"))for(const[n,o]of Object.entries(a.attrs)){if(!o.config?.private)continue;const c=e[i]??={},h=c.fields??={};h[n]===void 0&&(h[n]="false")}return e}w.APPLE_AUTHORIZATION_ENDPOINT=Fo,w.APPLE_DISCOVERY_ENDPOINT=Bo,w.APPLE_TOKEN_ENDPOINT=Ro,w.BackendRelayOAuthError=J,w.BackupsManager=Ri,w.GOOGLE_AUTHORIZATION_ENDPOINT=Do,w.GOOGLE_DISCOVERY_ENDPOINT=Mo,w.GOOGLE_TOKEN_ENDPOINT=Lo,w.LINKEDIN_AUTHORIZATION_ENDPOINT=_o,w.LINKEDIN_DISCOVERY_ENDPOINT=Uo,w.LINKEDIN_TOKEN_ENDPOINT=jo,w.OAuthHandler=Nr,w.PlatformApi=ko,w.ProgressPromise=dt,w.SchemaValidationError=Pe,w.Webhooks=Pt,w.WebhooksManager=Ni,w.apiSchemaToBackendRelaySchemaDef=De,w.applyPrivateFieldRules=$o,w.backupZipName=uo,w.buildAutoRenameSelector=gi,w.clerkDomainFromPublishableKey=vo,w.collectSystemCatalogIdentNames=li,w.convertTxSteps=di,w.diffSchemas=fi,w.estimateZipSize=fo,w.exchangeCodeForToken=yo,w.exchangeRefreshToken=Bi,w.formatFileSize=po,w.generatePermsTypescriptFile=dn,w.generateSchemaTypescriptFile=kn,w.i=U,w.isRenamePromptItem=xi,w.oauthCallbackURL=Oo,w.permsTypescriptFileToCode=mn,w.schemaTypescriptFileToBackendRelaySchema=pn,w.toAppBackup=Li,w.translatePlanSteps=is,w.validateSchema=ui,w.version=ie,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})}));