toiljs 0.0.3 → 0.0.5

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 (360) hide show
  1. package/.idea/prettier.xml +1 -0
  2. package/as-pect.config.js +1 -1
  3. package/build/backend/.tsbuildinfo +1 -1
  4. package/build/backend/index.js +1 -2
  5. package/build/cli/.tsbuildinfo +1 -1
  6. package/build/cli/configure.d.ts +15 -0
  7. package/build/cli/configure.js +201 -0
  8. package/build/cli/create.d.ts +4 -0
  9. package/build/cli/create.js +169 -56
  10. package/build/cli/features.d.ts +23 -0
  11. package/build/cli/features.js +85 -0
  12. package/build/cli/index.js +42 -2
  13. package/build/cli/proc.d.ts +1 -0
  14. package/build/cli/proc.js +11 -0
  15. package/build/cli/ui.js +1 -2
  16. package/build/cli/validate.d.ts +4 -0
  17. package/build/cli/validate.js +19 -0
  18. package/build/client/.tsbuildinfo +1 -1
  19. package/build/client/Link.d.ts +8 -0
  20. package/build/client/Link.js +44 -0
  21. package/build/client/NavLink.d.ts +14 -0
  22. package/build/client/NavLink.js +37 -0
  23. package/build/client/Router.d.ts +7 -0
  24. package/build/client/Router.js +55 -0
  25. package/build/client/error-boundary.d.ts +16 -0
  26. package/build/client/error-boundary.js +19 -0
  27. package/build/client/head.d.ts +26 -0
  28. package/build/client/head.js +87 -0
  29. package/build/client/hooks.d.ts +17 -0
  30. package/build/client/hooks.js +48 -0
  31. package/build/client/index.d.ts +14 -2
  32. package/build/client/index.js +8 -1
  33. package/build/client/lazy.d.ts +16 -0
  34. package/build/client/lazy.js +53 -0
  35. package/build/client/match.js +7 -0
  36. package/build/client/mount.d.ts +2 -0
  37. package/build/client/mount.js +13 -0
  38. package/build/client/navigation.d.ts +13 -0
  39. package/build/client/navigation.js +97 -0
  40. package/build/client/params-context.d.ts +2 -0
  41. package/build/client/params-context.js +2 -0
  42. package/build/client/prefetch.d.ts +11 -0
  43. package/build/client/prefetch.js +100 -0
  44. package/build/client/scroll.d.ts +8 -0
  45. package/build/client/scroll.js +36 -0
  46. package/build/client/types.d.ts +27 -0
  47. package/build/client/types.js +1 -0
  48. package/build/compiler/.tsbuildinfo +1 -1
  49. package/build/compiler/config.d.ts +2 -0
  50. package/build/compiler/config.js +4 -1
  51. package/build/compiler/docs.d.ts +10 -0
  52. package/build/compiler/docs.js +59 -0
  53. package/build/compiler/generate.d.ts +1 -0
  54. package/build/compiler/generate.js +139 -21
  55. package/build/compiler/index.d.ts +5 -2
  56. package/build/compiler/index.js +5 -3
  57. package/build/compiler/plugin.js +2 -1
  58. package/build/compiler/routes.js +5 -1
  59. package/build/compiler/vite.d.ts +1 -1
  60. package/build/compiler/vite.js +17 -1
  61. package/build/io/.tsbuildinfo +1 -1
  62. package/build/io/BinaryWriter.js +2 -2
  63. package/eslint.config.js +1 -1
  64. package/examples/basic/.toil/docs/cli.md +3 -0
  65. package/examples/basic/.toil/docs/client.md +3 -0
  66. package/examples/basic/.toil/docs/index.md +3 -0
  67. package/examples/basic/.toil/docs/routing.md +3 -0
  68. package/examples/basic/.toil/docs/server.md +3 -0
  69. package/examples/basic/.toil/docs/styling.md +3 -0
  70. package/examples/basic/.toil/entry.tsx +3 -8
  71. package/examples/basic/.toil/globals.ts +6 -0
  72. package/examples/basic/.toil/index.html +16 -12
  73. package/examples/basic/.toil/public/images/.gitkeep +1 -0
  74. package/examples/basic/.toil/public/images/logo.svg +37 -0
  75. package/examples/basic/.toil/public/robots.txt +2 -0
  76. package/examples/basic/.toil/routes.ts +9 -7
  77. package/examples/basic/build/client/assets/404-Bq0jNTUo.js +1 -0
  78. package/examples/basic/build/client/assets/_...slug_-CXKf6qnB.js +1 -0
  79. package/examples/basic/build/client/assets/_id_-BadAyQnb.js +1 -0
  80. package/examples/basic/build/client/assets/about-BOhoEcEO.js +1 -0
  81. package/examples/basic/build/client/assets/get-started-BIXpcjkT.js +9 -0
  82. package/examples/basic/build/client/assets/index-BmqcTaBB.js +1 -0
  83. package/examples/basic/build/client/assets/io-DEVjjaJj.js +1 -0
  84. package/examples/basic/build/client/assets/layout-DJegirdz.js +1 -0
  85. package/examples/basic/build/client/assets/react-DEQrz1q7.js +9 -0
  86. package/examples/basic/build/client/assets/rolldown-runtime-KL5VtC6j.js +1 -0
  87. package/examples/basic/build/client/assets/routes-BYWn6TxK.js +1 -0
  88. package/examples/basic/build/client/css/style.css +2 -0
  89. package/examples/basic/build/client/images/.gitkeep +1 -0
  90. package/examples/basic/build/client/images/logo.svg +37 -0
  91. package/examples/basic/build/client/index.html +17 -0
  92. package/examples/basic/build/client/robots.txt +2 -0
  93. package/examples/basic/client/404.tsx +2 -5
  94. package/examples/basic/client/components/.gitkeep +1 -0
  95. package/examples/basic/client/components/Footer.tsx +8 -0
  96. package/examples/basic/client/layout.tsx +39 -26
  97. package/examples/basic/client/public/images/.gitkeep +1 -0
  98. package/examples/basic/client/public/images/logo.svg +37 -0
  99. package/examples/basic/client/public/index.html +15 -0
  100. package/examples/basic/client/public/robots.txt +2 -0
  101. package/examples/basic/client/routes/about.tsx +1 -3
  102. package/examples/basic/client/routes/blog/[id].tsx +2 -4
  103. package/examples/basic/client/routes/docs/[...slug].tsx +3 -6
  104. package/examples/basic/client/routes/get-started.tsx +84 -0
  105. package/examples/basic/client/routes/index.tsx +74 -7
  106. package/examples/basic/client/routes/io.tsx +3 -7
  107. package/examples/basic/client/styles/main.css +461 -0
  108. package/examples/basic/client/toil.tsx +7 -0
  109. package/examples/basic/node_modules/.bin/toilinit +16 -0
  110. package/examples/basic/node_modules/.bin/toilinit.cmd +17 -0
  111. package/examples/basic/node_modules/.bin/toilinit.ps1 +28 -0
  112. package/examples/basic/node_modules/.bin/toilscript +16 -0
  113. package/examples/basic/node_modules/.bin/toilscript.cmd +17 -0
  114. package/examples/basic/node_modules/.bin/toilscript.ps1 +28 -0
  115. package/examples/basic/node_modules/.bin/wasm-as +16 -0
  116. package/examples/basic/node_modules/.bin/wasm-as.cmd +17 -0
  117. package/examples/basic/node_modules/.bin/wasm-as.ps1 +28 -0
  118. package/examples/basic/node_modules/.bin/wasm-ctor-eval +16 -0
  119. package/examples/basic/node_modules/.bin/wasm-ctor-eval.cmd +17 -0
  120. package/examples/basic/node_modules/.bin/wasm-ctor-eval.ps1 +28 -0
  121. package/examples/basic/node_modules/.bin/wasm-dis +16 -0
  122. package/examples/basic/node_modules/.bin/wasm-dis.cmd +17 -0
  123. package/examples/basic/node_modules/.bin/wasm-dis.ps1 +28 -0
  124. package/examples/basic/node_modules/.bin/wasm-merge +16 -0
  125. package/examples/basic/node_modules/.bin/wasm-merge.cmd +17 -0
  126. package/examples/basic/node_modules/.bin/wasm-merge.ps1 +28 -0
  127. package/examples/basic/node_modules/.bin/wasm-metadce +16 -0
  128. package/examples/basic/node_modules/.bin/wasm-metadce.cmd +17 -0
  129. package/examples/basic/node_modules/.bin/wasm-metadce.ps1 +28 -0
  130. package/examples/basic/node_modules/.bin/wasm-opt +16 -0
  131. package/examples/basic/node_modules/.bin/wasm-opt.cmd +17 -0
  132. package/examples/basic/node_modules/.bin/wasm-opt.ps1 +28 -0
  133. package/examples/basic/node_modules/.bin/wasm-reduce +16 -0
  134. package/examples/basic/node_modules/.bin/wasm-reduce.cmd +17 -0
  135. package/examples/basic/node_modules/.bin/wasm-reduce.ps1 +28 -0
  136. package/examples/basic/node_modules/.bin/wasm-shell +16 -0
  137. package/examples/basic/node_modules/.bin/wasm-shell.cmd +17 -0
  138. package/examples/basic/node_modules/.bin/wasm-shell.ps1 +28 -0
  139. package/examples/basic/node_modules/.bin/wasm2js +16 -0
  140. package/examples/basic/node_modules/.bin/wasm2js.cmd +17 -0
  141. package/examples/basic/node_modules/.bin/wasm2js.ps1 +28 -0
  142. package/examples/basic/node_modules/.package-lock.json +49 -1
  143. package/examples/basic/node_modules/.vite/deps/_metadata.json +9 -9
  144. package/examples/basic/node_modules/binaryen/LICENSE +201 -0
  145. package/examples/basic/node_modules/binaryen/README.md +1362 -0
  146. package/examples/basic/node_modules/binaryen/bin/package.json +3 -0
  147. package/examples/basic/node_modules/binaryen/bin/wasm-as +0 -0
  148. package/examples/basic/node_modules/binaryen/bin/wasm-ctor-eval +0 -0
  149. package/examples/basic/node_modules/binaryen/bin/wasm-dis +0 -0
  150. package/examples/basic/node_modules/binaryen/bin/wasm-merge +0 -0
  151. package/examples/basic/node_modules/binaryen/bin/wasm-metadce +0 -0
  152. package/examples/basic/node_modules/binaryen/bin/wasm-opt +0 -0
  153. package/examples/basic/node_modules/binaryen/bin/wasm-reduce +0 -0
  154. package/examples/basic/node_modules/binaryen/bin/wasm-shell +0 -0
  155. package/examples/basic/node_modules/binaryen/bin/wasm2js +0 -0
  156. package/examples/basic/node_modules/binaryen/index.d.ts +2371 -0
  157. package/examples/basic/node_modules/binaryen/index.js +30552 -0
  158. package/examples/basic/node_modules/binaryen/package.json +50 -0
  159. package/examples/basic/node_modules/long/LICENSE +202 -0
  160. package/examples/basic/node_modules/long/README.md +286 -0
  161. package/examples/basic/node_modules/long/index.d.ts +2 -0
  162. package/examples/basic/node_modules/long/index.js +1581 -0
  163. package/examples/basic/node_modules/long/package.json +58 -0
  164. package/examples/basic/node_modules/long/types.d.ts +474 -0
  165. package/examples/basic/node_modules/long/umd/index.d.ts +3 -0
  166. package/examples/basic/node_modules/long/umd/index.js +1622 -0
  167. package/examples/basic/node_modules/long/umd/package.json +3 -0
  168. package/examples/basic/node_modules/long/umd/types.d.ts +474 -0
  169. package/examples/basic/node_modules/toilscript/LICENSE +201 -0
  170. package/examples/basic/node_modules/toilscript/NOTICE +94 -0
  171. package/examples/basic/node_modules/toilscript/README.md +66 -0
  172. package/examples/basic/node_modules/toilscript/bin/toilinit.js +468 -0
  173. package/examples/basic/node_modules/toilscript/bin/toilscript.js +35 -0
  174. package/examples/basic/node_modules/toilscript/dist/cli.d.ts +4 -0
  175. package/examples/basic/node_modules/toilscript/dist/cli.generated.d.ts +10027 -0
  176. package/examples/basic/node_modules/toilscript/dist/cli.js +24474 -0
  177. package/examples/basic/node_modules/toilscript/dist/cli.js.map +7 -0
  178. package/examples/basic/node_modules/toilscript/dist/importmap.json +9 -0
  179. package/examples/basic/node_modules/toilscript/dist/toilscript.d.ts +4 -0
  180. package/examples/basic/node_modules/toilscript/dist/toilscript.generated.d.ts +11242 -0
  181. package/examples/basic/node_modules/toilscript/dist/toilscript.js +337 -0
  182. package/examples/basic/node_modules/toilscript/dist/toilscript.js.map +7 -0
  183. package/examples/basic/node_modules/toilscript/dist/transform.cjs +1 -0
  184. package/examples/basic/node_modules/toilscript/dist/transform.d.ts +1 -0
  185. package/examples/basic/node_modules/toilscript/dist/transform.js +1 -0
  186. package/examples/basic/node_modules/toilscript/dist/web.js +22 -0
  187. package/examples/basic/node_modules/toilscript/lib/binaryen.d.ts +2 -0
  188. package/examples/basic/node_modules/toilscript/lib/binaryen.js +2 -0
  189. package/examples/basic/node_modules/toilscript/package.json +115 -0
  190. package/examples/basic/node_modules/toilscript/std/README.md +6 -0
  191. package/examples/basic/node_modules/toilscript/std/assembly/array.ts +550 -0
  192. package/examples/basic/node_modules/toilscript/std/assembly/arraybuffer.ts +77 -0
  193. package/examples/basic/node_modules/toilscript/std/assembly/atomics.ts +127 -0
  194. package/examples/basic/node_modules/toilscript/std/assembly/bindings/asyncify.ts +16 -0
  195. package/examples/basic/node_modules/toilscript/std/assembly/bindings/dom.ts +291 -0
  196. package/examples/basic/node_modules/toilscript/std/assembly/bindings/node.ts +6 -0
  197. package/examples/basic/node_modules/toilscript/std/assembly/bitflags.ts +53 -0
  198. package/examples/basic/node_modules/toilscript/std/assembly/builtins.ts +2650 -0
  199. package/examples/basic/node_modules/toilscript/std/assembly/byteslice.ts +177 -0
  200. package/examples/basic/node_modules/toilscript/std/assembly/compat.ts +2 -0
  201. package/examples/basic/node_modules/toilscript/std/assembly/console.ts +42 -0
  202. package/examples/basic/node_modules/toilscript/std/assembly/crypto.ts +9 -0
  203. package/examples/basic/node_modules/toilscript/std/assembly/dataview.ts +181 -0
  204. package/examples/basic/node_modules/toilscript/std/assembly/date.ts +375 -0
  205. package/examples/basic/node_modules/toilscript/std/assembly/diagnostics.ts +11 -0
  206. package/examples/basic/node_modules/toilscript/std/assembly/encoding.ts +151 -0
  207. package/examples/basic/node_modules/toilscript/std/assembly/endian.ts +45 -0
  208. package/examples/basic/node_modules/toilscript/std/assembly/error.ts +44 -0
  209. package/examples/basic/node_modules/toilscript/std/assembly/fixedarray.ts +173 -0
  210. package/examples/basic/node_modules/toilscript/std/assembly/fixedmap.ts +326 -0
  211. package/examples/basic/node_modules/toilscript/std/assembly/fixedset.ts +275 -0
  212. package/examples/basic/node_modules/toilscript/std/assembly/function.ts +42 -0
  213. package/examples/basic/node_modules/toilscript/std/assembly/index.d.ts +2892 -0
  214. package/examples/basic/node_modules/toilscript/std/assembly/iterator.ts +35 -0
  215. package/examples/basic/node_modules/toilscript/std/assembly/map.ts +269 -0
  216. package/examples/basic/node_modules/toilscript/std/assembly/math.ts +3289 -0
  217. package/examples/basic/node_modules/toilscript/std/assembly/memory.ts +123 -0
  218. package/examples/basic/node_modules/toilscript/std/assembly/number.ts +388 -0
  219. package/examples/basic/node_modules/toilscript/std/assembly/object.ts +36 -0
  220. package/examples/basic/node_modules/toilscript/std/assembly/performance.ts +9 -0
  221. package/examples/basic/node_modules/toilscript/std/assembly/pointer.ts +80 -0
  222. package/examples/basic/node_modules/toilscript/std/assembly/polyfills.ts +27 -0
  223. package/examples/basic/node_modules/toilscript/std/assembly/process.ts +50 -0
  224. package/examples/basic/node_modules/toilscript/std/assembly/reference.ts +48 -0
  225. package/examples/basic/node_modules/toilscript/std/assembly/regexp.ts +12 -0
  226. package/examples/basic/node_modules/toilscript/std/assembly/rt/README.md +83 -0
  227. package/examples/basic/node_modules/toilscript/std/assembly/rt/common.ts +81 -0
  228. package/examples/basic/node_modules/toilscript/std/assembly/rt/index-incremental.ts +2 -0
  229. package/examples/basic/node_modules/toilscript/std/assembly/rt/index-memory.ts +1 -0
  230. package/examples/basic/node_modules/toilscript/std/assembly/rt/index-minimal.ts +2 -0
  231. package/examples/basic/node_modules/toilscript/std/assembly/rt/index-stub.ts +1 -0
  232. package/examples/basic/node_modules/toilscript/std/assembly/rt/index.d.ts +37 -0
  233. package/examples/basic/node_modules/toilscript/std/assembly/rt/itcms.ts +419 -0
  234. package/examples/basic/node_modules/toilscript/std/assembly/rt/memory-runtime.ts +94 -0
  235. package/examples/basic/node_modules/toilscript/std/assembly/rt/rtrace.ts +15 -0
  236. package/examples/basic/node_modules/toilscript/std/assembly/rt/stub.ts +133 -0
  237. package/examples/basic/node_modules/toilscript/std/assembly/rt/tcms.ts +254 -0
  238. package/examples/basic/node_modules/toilscript/std/assembly/rt/tlsf.ts +592 -0
  239. package/examples/basic/node_modules/toilscript/std/assembly/rt.ts +90 -0
  240. package/examples/basic/node_modules/toilscript/std/assembly/set.ts +225 -0
  241. package/examples/basic/node_modules/toilscript/std/assembly/shared/feature.ts +68 -0
  242. package/examples/basic/node_modules/toilscript/std/assembly/shared/runtime.ts +13 -0
  243. package/examples/basic/node_modules/toilscript/std/assembly/shared/target.ts +11 -0
  244. package/examples/basic/node_modules/toilscript/std/assembly/shared/tsconfig.json +11 -0
  245. package/examples/basic/node_modules/toilscript/std/assembly/shared/typeinfo.ts +72 -0
  246. package/examples/basic/node_modules/toilscript/std/assembly/staticarray.ts +423 -0
  247. package/examples/basic/node_modules/toilscript/std/assembly/string.ts +850 -0
  248. package/examples/basic/node_modules/toilscript/std/assembly/symbol.ts +114 -0
  249. package/examples/basic/node_modules/toilscript/std/assembly/table.ts +16 -0
  250. package/examples/basic/node_modules/toilscript/std/assembly/toilscript.ts +16 -0
  251. package/examples/basic/node_modules/toilscript/std/assembly/tsconfig.json +6 -0
  252. package/examples/basic/node_modules/toilscript/std/assembly/typedarray.ts +1954 -0
  253. package/examples/basic/node_modules/toilscript/std/assembly/uri.ts +17 -0
  254. package/examples/basic/node_modules/toilscript/std/assembly/util/bytes.ts +107 -0
  255. package/examples/basic/node_modules/toilscript/std/assembly/util/casemap.ts +497 -0
  256. package/examples/basic/node_modules/toilscript/std/assembly/util/error.ts +58 -0
  257. package/examples/basic/node_modules/toilscript/std/assembly/util/hash.ts +117 -0
  258. package/examples/basic/node_modules/toilscript/std/assembly/util/math.ts +1922 -0
  259. package/examples/basic/node_modules/toilscript/std/assembly/util/memory.ts +290 -0
  260. package/examples/basic/node_modules/toilscript/std/assembly/util/number.ts +873 -0
  261. package/examples/basic/node_modules/toilscript/std/assembly/util/sort.ts +313 -0
  262. package/examples/basic/node_modules/toilscript/std/assembly/util/string.ts +1202 -0
  263. package/examples/basic/node_modules/toilscript/std/assembly/util/uri.ts +275 -0
  264. package/examples/basic/node_modules/toilscript/std/assembly/vector.ts +4 -0
  265. package/examples/basic/node_modules/toilscript/std/assembly.json +16 -0
  266. package/examples/basic/node_modules/toilscript/std/portable/index.d.ts +461 -0
  267. package/examples/basic/node_modules/toilscript/std/portable/index.js +416 -0
  268. package/examples/basic/node_modules/toilscript/std/portable.json +11 -0
  269. package/examples/basic/node_modules/toilscript/std/types/assembly/index.d.ts +1 -0
  270. package/examples/basic/node_modules/toilscript/std/types/assembly/package.json +3 -0
  271. package/examples/basic/node_modules/toilscript/std/types/portable/index.d.ts +1 -0
  272. package/examples/basic/node_modules/toilscript/std/types/portable/package.json +3 -0
  273. package/examples/basic/node_modules/toilscript/tsconfig-base.json +13 -0
  274. package/examples/basic/node_modules/toilscript/util/README.md +23 -0
  275. package/examples/basic/node_modules/toilscript/util/browser/fs.js +1 -0
  276. package/examples/basic/node_modules/toilscript/util/browser/module.js +5 -0
  277. package/examples/basic/node_modules/toilscript/util/browser/path.js +520 -0
  278. package/examples/basic/node_modules/toilscript/util/browser/process.js +59 -0
  279. package/examples/basic/node_modules/toilscript/util/browser/url.js +23 -0
  280. package/examples/basic/node_modules/toilscript/util/cpu.d.ts +9 -0
  281. package/examples/basic/node_modules/toilscript/util/cpu.js +42 -0
  282. package/examples/basic/node_modules/toilscript/util/find.d.ts +6 -0
  283. package/examples/basic/node_modules/toilscript/util/find.js +20 -0
  284. package/examples/basic/node_modules/toilscript/util/node.d.ts +21 -0
  285. package/examples/basic/node_modules/toilscript/util/node.js +34 -0
  286. package/examples/basic/node_modules/toilscript/util/options.d.ts +70 -0
  287. package/examples/basic/node_modules/toilscript/util/options.js +262 -0
  288. package/examples/basic/node_modules/toilscript/util/terminal.d.ts +52 -0
  289. package/examples/basic/node_modules/toilscript/util/terminal.js +35 -0
  290. package/examples/basic/node_modules/toilscript/util/text.d.ts +26 -0
  291. package/examples/basic/node_modules/toilscript/util/text.js +114 -0
  292. package/examples/basic/node_modules/toilscript/util/tsconfig.json +9 -0
  293. package/examples/basic/node_modules/toilscript/util/web.d.ts +11 -0
  294. package/examples/basic/node_modules/toilscript/util/web.js +33 -0
  295. package/examples/basic/package-lock.json +50 -1
  296. package/examples/basic/package.json +5 -2
  297. package/examples/basic/server/index.ts +3 -0
  298. package/examples/basic/server/main.ts +6 -0
  299. package/examples/basic/server/tsconfig.json +7 -0
  300. package/examples/basic/toil-env.d.ts +20 -1
  301. package/examples/basic/toil.config.ts +2 -5
  302. package/examples/basic/toilconfig.json +30 -0
  303. package/package.json +1 -1
  304. package/presets/eslint.js +2 -7
  305. package/presets/no-uint8array-tostring.js +4 -5
  306. package/presets/prettier.json +8 -1
  307. package/src/backend/index.ts +11 -18
  308. package/src/cli/configure.ts +272 -0
  309. package/src/cli/create.ts +228 -67
  310. package/src/cli/features.ts +128 -0
  311. package/src/cli/index.ts +44 -3
  312. package/src/cli/proc.ts +20 -0
  313. package/src/cli/ui.ts +4 -6
  314. package/src/cli/validate.ts +31 -0
  315. package/src/client/Link.tsx +99 -0
  316. package/src/client/NavLink.tsx +86 -0
  317. package/src/client/Router.tsx +95 -0
  318. package/src/client/error-boundary.tsx +43 -0
  319. package/src/client/head.ts +140 -0
  320. package/src/client/hooks.ts +115 -0
  321. package/src/client/index.ts +35 -5
  322. package/src/client/lazy.ts +93 -0
  323. package/src/client/match.ts +11 -3
  324. package/src/client/mount.tsx +28 -0
  325. package/src/client/navigation.ts +142 -0
  326. package/src/client/params-context.ts +10 -0
  327. package/src/client/prefetch.ts +130 -0
  328. package/src/client/scroll.ts +53 -0
  329. package/src/client/types.ts +36 -0
  330. package/src/compiler/config.ts +15 -8
  331. package/src/compiler/docs.ts +87 -0
  332. package/src/compiler/generate.ts +180 -33
  333. package/src/compiler/index.ts +7 -4
  334. package/src/compiler/plugin.ts +3 -1
  335. package/src/compiler/routes.ts +13 -7
  336. package/src/compiler/vite.ts +28 -5
  337. package/src/io/BinaryReader.ts +1 -5
  338. package/src/io/BinaryWriter.ts +3 -3
  339. package/src/server/index.ts +3 -4
  340. package/src/server/tsconfig.json +4 -0
  341. package/test/configure.test.ts +90 -0
  342. package/test/features.test.ts +111 -0
  343. package/test/head.test.ts +35 -0
  344. package/test/io.test.ts +8 -0
  345. package/test/navlink.test.ts +28 -0
  346. package/test/routes.test.ts +15 -0
  347. package/test/validate.test.ts +42 -0
  348. package/vitest.config.ts +1 -1
  349. package/examples/basic/dist/assets/404-D1bS2aH_.js +0 -1
  350. package/examples/basic/dist/assets/_...slug_-wR3shlWn.js +0 -1
  351. package/examples/basic/dist/assets/_id_-EWYvHfi2.js +0 -1
  352. package/examples/basic/dist/assets/about-Ddvj1tjF.js +0 -1
  353. package/examples/basic/dist/assets/index-CdG0me90.js +0 -1
  354. package/examples/basic/dist/assets/io-CODNJU57.js +0 -1
  355. package/examples/basic/dist/assets/layout-C15ZTPYI.js +0 -1
  356. package/examples/basic/dist/assets/react-JbAfoxYe.js +0 -9
  357. package/examples/basic/dist/assets/rolldown-runtime-1VNLd2iN.js +0 -1
  358. package/examples/basic/dist/assets/routes-GoydenoY.js +0 -1
  359. package/examples/basic/dist/index.html +0 -12
  360. package/src/client/runtime.tsx +0 -190
@@ -0,0 +1,1202 @@
1
+ import {
2
+ itoa32,
3
+ utoa32,
4
+ itoa64,
5
+ utoa64,
6
+ dtoa,
7
+ itoa_buffered,
8
+ dtoa_buffered,
9
+ MAX_DOUBLE_LENGTH
10
+ } from "./number";
11
+
12
+ import {
13
+ ipow32
14
+ } from "../math";
15
+
16
+ // All tables are stored as two staged lookup tables (static tries)
17
+ // because the full range of Unicode symbols can't be efficiently
18
+ // represented as-is in memory (see Unicode spec ch 5, p.196):
19
+ // https://www.unicode.org/versions/Unicode12.0.0/ch05.pdf
20
+ // Tables have been generated using these forked musl tools:
21
+ // https://github.com/MaxGraey/musl-chartable-tools/tree/case-ignorable
22
+
23
+ // Lookup table to check if a character is alphanumeric or not
24
+ // See: https://git.musl-libc.org/cgit/musl/tree/src/ctype/alpha.h
25
+ // size: 3904 bytes
26
+ // @ts-ignore
27
+ @inline @lazy const ALPHA_TABLE = memory.data<u8>([
28
+ 18,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,17,34,35,36,17,37,38,39,40,
29
+ 41,42,43,44,17,45,46,47,16,16,48,16,16,16,16,16,16,16,49,50,51,16,52,53,16,16,
30
+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,54,
31
+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
32
+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
33
+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
34
+ 17,17,17,55,17,17,17,17,56,17,57,58,59,60,61,62,17,17,17,17,17,17,17,17,17,17,
35
+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
36
+ 17,17,17,17,17,17,17,63,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
37
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,64,65,17,66,67,
38
+ 68,69,70,71,72,73,74,17,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,
39
+ 93,94,16,95,96,97,98,17,17,17,99,100,101,16,16,16,16,16,16,16,16,16,16,17,17,
40
+ 17,17,102,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,103,16,16,16,16,
41
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
42
+ 16,16,16,17,17,104,105,16,16,106,107,17,17,17,17,17,17,17,17,17,17,17,17,17,
43
+ 17,17,17,17,17,17,17,17,17,17,108,17,17,17,17,109,110,16,16,16,16,16,16,16,16,
44
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
45
+ 17,111,112,16,16,16,16,16,16,16,16,16,113,16,16,16,16,16,16,16,16,16,16,16,16,
46
+ 16,16,16,16,16,16,16,16,16,16,16,114,115,116,117,16,16,16,16,16,16,16,16,118,
47
+ 119,120,16,16,16,16,16,121,122,16,16,16,16,123,16,16,124,16,16,16,16,16,16,16,
48
+ 16,16,125,16,16,16,
49
+ 16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,
50
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
51
+ 255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,254,255,255,7,254,
52
+ 255,255,7,0,0,0,0,0,4,32,4,255,255,127,255,255,255,127,255,255,255,255,255,
53
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
54
+ 255,195,255,3,0,31,80,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,223,188,64,215,255,255,
55
+ 251,255,255,255,255,255,255,255,255,255,191,255,255,255,255,255,255,255,255,
56
+ 255,255,255,255,255,255,255,255,255,3,252,255,255,255,255,255,255,255,255,255,
57
+ 255,255,255,255,255,255,255,255,255,255,255,254,255,255,255,127,2,255,255,255,
58
+ 255,255,1,0,0,0,0,255,191,182,0,255,255,255,135,7,0,0,0,255,7,255,255,255,255,
59
+ 255,255,255,254,255,195,255,255,255,255,255,255,255,255,255,255,255,255,239,
60
+ 31,254,225,255,
61
+ 159,0,0,255,255,255,255,255,255,0,224,255,255,255,255,255,255,255,255,255,255,
62
+ 255,255,3,0,255,255,255,255,255,7,48,4,255,255,255,252,255,31,0,0,255,255,255,
63
+ 1,255,7,0,0,0,0,0,0,255,255,223,255,255,0,240,255,248,3,255,255,255,255,255,
64
+ 255,255,255,255,239,255,223,225,255,207,255,254,255,239,159,249,255,255,253,
65
+ 197,227,159,89,128,176,207,255,3,16,238,135,249,255,255,253,109,195,135,25,2,
66
+ 94,192,255,63,0,238,191,251,255,255,253,237,227,191,27,1,0,207,255,0,30,238,
67
+ 159,249,255,255,253,237,227,159,25,192,176,207,255,2,0,236,199,61,214,24,199,
68
+ 255,195,199,29,129,0,192,255,0,0,239,223,253,255,255,253,255,227,223,29,96,7,
69
+ 207,255,0,0,239,223,253,255,255,253,239,227,223,29,96,64,207,255,6,0,255,223,
70
+ 253,255,255,255,255,231,223,93,240,128,207,255,0,252,238,255,127,252,255,255,
71
+ 251,47,127,128,95,255,192,255,12,0,254,255,255,255,255,127,255,7,63,32,255,3,
72
+ 0,0,0,0,214,247,255,255,175,255,255,59,95,32,255,243,0,0,0,
73
+ 0,1,0,0,0,255,3,0,0,255,254,255,255,255,31,254,255,3,255,255,254,255,255,255,
74
+ 31,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,249,255,3,255,255,255,255,255,
75
+ 255,255,255,255,63,255,255,255,255,191,32,255,255,255,255,255,247,255,255,255,
76
+ 255,255,255,255,255,255,61,127,61,255,255,255,255,255,61,255,255,255,255,61,
77
+ 127,61,255,127,255,255,255,255,255,255,255,61,255,255,255,255,255,255,255,255,
78
+ 7,0,0,0,0,255,255,0,0,255,255,255,255,255,255,255,255,255,255,63,63,254,255,
79
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
80
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
81
+ 255,255,255,255,255,159,255,255,254,255,255,7,255,255,255,255,255,255,255,255,
82
+ 255,199,255,1,255,223,15,0,255,255,15,0,255,255,15,0,255,223,13,0,255,255,255,
83
+ 255,255,255,207,255,255,1,128,16,255,3,0,0,0,0,255,3,255,255,255,255,255,255,
84
+ 255,255,255,255,255,1,255,255,255,255,255,7,255,255,255,255,255,255,255,255,
85
+ 63,
86
+ 0,255,255,255,127,255,15,255,1,192,255,255,255,255,63,31,0,255,255,255,255,
87
+ 255,15,255,255,255,3,255,3,0,0,0,0,255,255,255,15,255,255,255,255,255,255,255,
88
+ 127,254,255,31,0,255,3,255,3,128,0,0,128,1,0,0,0,0,0,0,0,255,255,255,255,255,
89
+ 255,239,255,239,15,255,3,0,0,0,0,255,255,255,255,255,243,255,255,255,255,255,
90
+ 255,191,255,3,0,255,255,255,255,255,255,127,0,255,227,255,255,255,255,255,63,
91
+ 255,1,255,255,255,255,255,231,0,0,0,0,0,222,111,4,255,255,255,255,255,255,255,
92
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,
93
+ 128,255,31,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,63,255,
94
+ 255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,0,0,0,
95
+ 0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,132,252,47,62,80,189,255,243,
96
+ 224,67,0,0,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
97
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,255,255,255,255,255,255,3,0,
98
+ 0,255,255,255,255,255,127,255,255,255,255,255,127,255,255,255,255,255,255,255,
99
+ 255,255,255,255,255,255,255,255,255,31,120,12,0,255,255,255,255,191,32,255,
100
+ 255,255,255,255,255,255,128,0,0,255,255,127,0,127,127,127,127,127,127,127,127,
101
+ 255,255,255,255,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
102
+ 0,0,224,0,0,0,254,3,62,31,254,255,255,255,255,255,255,255,255,255,127,224,254,
103
+ 255,255,255,255,255,255,255,255,255,255,247,224,255,255,255,255,255,254,255,
104
+ 255,255,255,255,255,255,255,255,255,127,0,0,255,255,255,255,0,0,0,0,0,0,255,
105
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
106
+ 255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,
107
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
108
+ 255,255,255,
109
+ 31,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,
110
+ 0,0,0,0,0,0,255,255,255,255,255,63,255,31,255,255,255,15,0,0,255,255,255,255,
111
+ 255,127,240,143,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,
112
+ 0,128,255,252,255,255,255,255,255,255,255,255,255,255,255,255,249,255,255,255,
113
+ 255,255,255,252,7,0,0,0,0,224,255,191,255,255,255,255,0,0,0,255,255,255,255,
114
+ 255,255,15,0,255,255,255,255,255,255,255,255,47,0,255,3,0,0,252,232,255,255,
115
+ 255,255,255,7,255,255,255,255,7,0,255,255,255,31,255,255,255,255,255,255,247,
116
+ 255,0,128,255,3,255,255,255,127,255,255,255,255,255,255,127,0,255,63,255,3,
117
+ 255,255,127,252,255,255,255,255,255,255,255,127,5,0,0,56,255,255,60,0,126,126,
118
+ 126,0,127,127,255,255,255,255,255,247,255,3,255,255,255,255,255,255,255,255,
119
+ 255,255,255,255,255,255,255,7,255,3,255,255,255,255,255,255,255,255,255,255,
120
+ 255,255,255,255,255,255,255,255,255,255,15,0,255,255,127,248,255,255,255,255,
121
+ 255,
122
+ 15,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,255,255,
123
+ 255,255,255,255,255,255,255,255,3,0,0,0,0,127,0,248,224,255,253,127,95,219,
124
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,248,255,255,255,
125
+ 255,255,255,255,255,255,255,255,255,63,0,0,255,255,255,255,255,255,255,255,
126
+ 252,255,255,255,255,255,255,0,0,0,0,0,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,
127
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,255,3,
128
+ 254,255,255,7,254,255,255,7,192,255,255,255,255,255,255,255,255,255,255,127,
129
+ 252,252,252,28,0,0,0,0,255,239,255,255,127,255,255,183,255,63,255,63,0,0,0,0,
130
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,
131
+ 255,255,255,255,255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
132
+ 0,0,0,0,0,0,0,0,255,255,255,31,255,255,255,255,255,255,1,0,0,0,0,
133
+ 0,255,255,255,255,0,224,255,255,255,7,255,255,255,255,255,7,255,255,255,63,
134
+ 255,255,255,255,15,255,62,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,
135
+ 255,255,255,255,255,255,255,255,255,63,255,3,255,255,255,255,15,255,255,255,
136
+ 255,15,255,255,255,255,255,0,255,255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,
137
+ 0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,0,255,255,63,0,255,0,0,0,0,0,0,0,
138
+ 0,0,0,0,0,0,0,0,0,0,0,0,63,253,255,255,255,255,191,145,255,255,63,0,255,255,
139
+ 127,0,255,255,255,127,0,0,0,0,0,0,0,0,255,255,55,0,255,255,63,0,255,255,255,3,
140
+ 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,192,0,0,0,0,0,0,0,0,111,240,239,
141
+ 254,255,255,63,0,0,0,0,0,255,255,255,31,255,255,255,31,0,0,0,0,255,254,255,
142
+ 255,31,0,0,0,255,255,255,255,255,255,63,0,255,255,63,0,255,255,7,0,255,255,3,
143
+ 0,0,0,0,0,0,0,0,0,0,0,0,
144
+ 0,255,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,255,255,255,255,255,255,7,
145
+ 0,255,255,255,255,255,255,7,0,255,255,255,255,255,0,255,3,0,0,0,0,0,0,0,0,0,0,
146
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,
147
+ 255,27,3,0,0,0,0,0,0,0,0,0,255,255,255,31,128,0,255,255,63,0,0,0,0,0,0,0,0,0,
148
+ 0,0,0,0,255,255,31,0,0,0,255,255,127,0,255,255,255,255,255,255,255,255,63,0,0,
149
+ 0,192,255,0,0,252,255,255,255,255,255,255,1,0,0,255,255,255,1,255,3,255,255,
150
+ 255,255,255,255,199,255,240,0,255,255,255,255,71,0,255,255,255,255,255,255,
151
+ 255,255,30,192,255,23,0,0,0,0,255,255,251,255,255,255,159,64,0,0,0,0,0,0,0,0,
152
+ 127,189,255,191,255,1,255,255,255,255,255,255,255,1,255,3,239,159,249,255,255,
153
+ 253,237,227,159,25,129,224,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
154
+ 0,255,255,255,255,255,255,255,255,187,7,255,131,3,0,0,0,255,255,255,255,255,
155
+ 255,255,255,179,0,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,
156
+ 255,255,255,63,127,0,0,0,63,0,0,0,0,255,255,255,255,255,255,255,127,17,0,255,
157
+ 3,0,0,0,0,255,255,255,255,255,255,63,1,255,3,0,0,0,0,0,0,255,255,255,231,255,
158
+ 7,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,
159
+ 255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,3,0,128,
160
+ 127,242,111,255,255,255,191,153,7,0,255,3,0,0,0,0,0,0,0,0,255,252,255,255,255,
161
+ 255,255,252,26,0,0,0,255,255,255,255,255,255,231,127,0,0,255,255,255,255,255,
162
+ 255,255,255,255,32,0,0,0,0,255,255,255,255,255,255,255,1,255,253,255,255,255,
163
+ 255,127,127,1,0,255,3,0,0,252,255,255,255,252,255,255,254,127,0,0,0,0,0,0,0,0,
164
+ 0,127,251,255,255,255,255,127,180,203,0,255,3,191,253,255,255,255,127,123,1,
165
+ 255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
166
+ 0,0,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
167
+ 0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
168
+ 255,3,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,
169
+ 255,127,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
170
+ 255,255,255,255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
171
+ 0,0,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
172
+ 0,255,255,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
173
+ 0,0,
174
+ 0,255,255,255,255,255,255,255,1,255,255,255,127,255,3,0,0,0,0,0,0,0,0,0,0,0,0,
175
+ 255,255,255,63,0,0,255,255,255,255,255,255,0,0,15,0,255,3,248,255,255,224,255,
176
+ 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,
177
+ 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,135,
178
+ 255,255,255,255,255,255,255,128,255,255,0,0,0,0,0,0,0,0,11,0,3,0,255,255,255,
179
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
180
+ 255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,
181
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,0,0,
182
+ 255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,
183
+ 127,0,0,0,0,0,0,7,0,240,0,255,255,255,255,255,255,255,255,255,255,255,255,255,
184
+ 255,255,255,255,
185
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
186
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,15,255,255,255,255,255,
187
+ 255,255,255,255,255,255,255,255,7,255,31,255,1,255,67,0,0,0,0,0,0,0,0,0,0,0,0,
188
+ 255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,255,255,255,
189
+ 223,100,222,255,235,239,255,255,255,255,255,255,255,191,231,223,223,255,255,
190
+ 255,123,95,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
191
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
192
+ 255,255,255,255,255,255,255,255,63,255,255,255,253,255,255,247,255,255,255,
193
+ 247,255,255,223,255,255,255,223,255,255,127,255,255,255,127,255,255,255,253,
194
+ 255,255,255,253,255,255,247,207,255,255,255,255,255,255,127,255,255,249,219,7,
195
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,31,
196
+ 128,63,255,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
197
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,15,255,
198
+ 3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
199
+ 255,255,255,255,255,31,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,143,8,
200
+ 255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,239,255,255,255,150,254,247,10,
201
+ 132,234,150,170,150,247,247,94,255,251,255,15,238,251,255,15,0,0,0,0,0,0,0,0,
202
+ 0,0,0,0,0,0,255,255,255,3,255,255,255,3,255,255,255,3,0,0,0,0,0,0,0,0,0,0,0,0,
203
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,3
204
+ ]);
205
+
206
+ // size: 1568 bytes (compressed to ~1380 bytes after binaryen)
207
+ // @ts-ignore: decorator
208
+ @lazy @inline const CASED = memory.data<u8>([
209
+ 18,19,20,21,22,23,16,16,16,16,16,16,16,16,16,16,
210
+ 24,16,16,25,16,16,16,16,16,16,16,16,26,27,17,28,
211
+ 29,30,16,16,31,16,16,16,16,16,16,16,32,33,16,16,
212
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
213
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
214
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
215
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
216
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
217
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
218
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
219
+ 16,16,16,16,16,16,34,35,16,16,16,36,16,16,16,16,
220
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
221
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
222
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
223
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
224
+ 16,16,16,16,16,16,16,16,16,16,16,37,16,16,16,38,
225
+ 16,16,16,16,39,16,16,16,16,16,16,16,40,16,16,16,
226
+ 16,16,16,16,16,16,16,16,41,16,16,16,16,16,16,16,
227
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
228
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
229
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
230
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
231
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,42,16,
232
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
233
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
234
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
235
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
236
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
237
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
238
+ 16,16,16,16,43,44,45,46,16,16,16,16,16,16,16,16,
239
+ 16,16,16,16,16,16,16,16,16,47,16,16,16,16,16,16,
240
+ 16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
241
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
242
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
243
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
244
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
245
+ 0,0,0,0,0,0,0,0,254,255,255,7,254,255,255,7,0,0,0,0,0,4,32,4,
246
+ 255,255,127,255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
247
+ 255,255,255,255,255,255,255,247,240,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
248
+ 255,255,255,255,255,255,255,255,255,255,239,255,255,255,255,1,3,0,0,0,31,0,0,0,
249
+ 0,0,0,0,0,0,0,0,32,0,0,0,0,0,207,188,64,215,255,255,251,255,255,255,
250
+ 255,255,255,255,255,255,191,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
251
+ 3,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,
252
+ 255,255,127,0,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
253
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,
254
+ 191,32,255,255,255,255,255,231,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
255
+ 0,0,0,0,255,255,255,255,255,255,255,255,255,255,63,63,0,0,0,0,0,0,0,0,
256
+ 0,0,0,0,0,0,0,0,255,1,255,255,255,255,255,231,0,0,0,0,0,0,0,0,
257
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
258
+ 0,0,0,0,0,0,0,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,63,
259
+ 255,255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,
260
+ 0,0,0,0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,
261
+ 132,252,47,62,80,189,31,242,224,67,0,0,255,255,255,255,24,0,0,0,0,0,0,0,
262
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
263
+ 0,0,0,0,0,0,192,255,255,255,255,255,255,3,0,0,255,255,255,255,255,127,255,255,
264
+ 255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,120,12,0,
265
+ 255,255,255,255,191,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
266
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,63,0,0,
267
+ 255,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,255,255,255,
268
+ 255,255,255,255,255,255,255,255,255,120,255,255,255,255,255,255,252,7,0,0,0,0,96,7,
269
+ 0,0,0,0,0,0,255,255,255,255,255,247,255,1,255,255,255,255,255,255,255,255,255,255,
270
+ 0,0,0,0,0,0,0,0,127,0,248,0,0,0,0,0,0,0,0,0,0,0,0,0,
271
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,255,255,7,
272
+ 254,255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
273
+ 255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,
274
+ 255,255,15,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
275
+ 255,255,255,255,255,255,7,0,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,0,
276
+ 0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,
277
+ 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,
278
+ 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,
279
+ 255,255,255,223,100,222,255,235,239,255,255,255,255,255,255,255,191,231,223,223,255,255,255,123,
280
+ 95,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
281
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,
282
+ 253,255,255,247,255,255,255,247,255,255,223,255,255,255,223,255,255,127,255,255,255,127,255,255,
283
+ 255,253,255,255,255,253,255,255,247,15,0,0,0,0,0,0,255,255,255,255,255,255,255,255,
284
+ 15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
285
+ 0,0,0,0,0,0,255,255,255,3,255,255,255,3,255,255,255,3,0,0,0,0,0,0,
286
+ 0,0,0,0,0,0,0,0
287
+ ]);
288
+
289
+ // size: 2976 bytes (compressed to ~2050 bytes after binaryen)
290
+ // @ts-ignore: decorator
291
+ @lazy @inline const CASE_IGNORABLES = memory.data<u8>([
292
+ 18,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
293
+ 33,16,16,34,16,16,16,35,36,37,38,39,40,41,16,42,
294
+ 43,16,16,16,16,16,16,16,16,16,16,16,44,45,46,16,
295
+ 47,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
296
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
297
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
298
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
299
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
300
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
301
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
302
+ 48,16,16,16,49,16,50,51,52,53,54,55,16,16,16,16,
303
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
304
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
305
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
306
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
307
+ 16,16,16,16,16,16,16,16,16,16,16,56,16,16,57,58,
308
+ 16,59,60,61,16,16,16,16,16,16,62,16,16,63,64,65,
309
+ 66,67,68,69,70,71,72,73,74,75,76,16,77,78,79,16,
310
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
311
+ 16,16,16,16,80,16,16,16,16,16,16,16,16,16,16,16,
312
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
313
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
314
+ 16,16,16,16,16,16,16,16,16,16,81,82,16,16,16,83,
315
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
316
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
317
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
318
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
319
+ 16,16,16,16,16,16,16,16,16,16,16,16,84,16,16,16,
320
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
321
+ 16,85,86,16,16,16,16,16,16,16,87,16,16,16,16,16,
322
+ 88,89,90,16,16,16,16,16,91,92,16,16,16,16,16,16,
323
+ 16,16,16,93,16,16,16,16,16,16,16,16,16,16,16,16,
324
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
325
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
326
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
327
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
328
+ 0,0,0,0,128,64,0,4,0,0,0,64,1,0,0,0,0,0,0,0,0,161,144,1,
329
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
330
+ 0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
331
+ 255,255,255,255,255,255,48,4,176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
332
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,3,0,0,0,0,0,0,
333
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,0,0,0,0,
334
+ 0,0,254,255,255,255,255,191,182,0,0,0,0,0,16,0,63,0,255,23,0,0,0,0,
335
+ 1,248,255,255,0,0,1,0,0,0,0,0,0,0,0,0,0,0,192,191,255,61,0,0,
336
+ 0,128,2,0,0,0,255,255,255,7,0,0,0,0,0,0,0,0,0,0,192,255,1,0,
337
+ 0,0,0,0,0,248,63,36,0,0,192,255,255,63,0,0,0,0,0,14,0,0,0,0,
338
+ 0,0,0,0,0,0,0,0,0,0,248,255,255,255,255,255,7,0,0,0,0,0,0,20,
339
+ 254,33,254,0,12,0,2,0,2,0,0,0,0,0,0,16,30,32,0,0,12,0,0,64,
340
+ 6,0,0,0,0,0,0,16,134,57,2,0,0,0,35,0,6,0,0,0,0,0,0,16,
341
+ 190,33,0,0,12,0,0,252,2,0,0,0,0,0,0,144,30,32,96,0,12,0,0,0,
342
+ 4,0,0,0,0,0,0,0,1,32,0,0,0,0,0,0,17,0,0,0,0,0,0,192,
343
+ 193,61,96,0,12,0,0,0,2,0,0,0,0,0,0,144,64,48,0,0,12,0,0,0,
344
+ 3,0,0,0,0,0,0,24,30,32,0,0,12,0,0,0,2,0,0,0,0,0,0,0,
345
+ 0,4,92,0,0,0,0,0,0,0,0,0,0,0,242,7,192,127,0,0,0,0,0,0,
346
+ 0,0,0,0,0,0,242,31,64,63,0,0,0,0,0,0,0,0,0,3,0,0,160,2,
347
+ 0,0,0,0,0,0,254,127,223,224,255,254,255,255,255,31,64,0,0,0,0,0,0,0,
348
+ 0,0,0,0,0,224,253,102,0,0,0,195,1,0,30,0,100,32,0,32,0,0,0,0,
349
+ 0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,0,
350
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,0,0,0,28,0,
351
+ 0,0,12,0,0,0,12,0,0,0,0,0,0,0,176,63,64,254,143,32,0,0,0,0,
352
+ 0,120,0,0,0,0,0,0,8,0,0,0,0,0,0,0,96,0,0,0,0,2,0,0,
353
+ 0,0,0,0,0,0,0,0,0,0,0,0,135,1,4,14,0,0,0,0,0,0,0,0,
354
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,9,0,0,0,0,
355
+ 0,0,64,127,229,31,248,159,0,0,0,0,128,0,255,255,1,0,0,0,0,0,0,0,
356
+ 15,0,0,0,0,0,208,23,4,0,0,0,0,248,15,0,3,0,0,0,60,59,0,0,
357
+ 0,0,0,0,64,163,3,0,0,0,0,0,0,240,207,0,0,0,0,0,0,0,0,63,
358
+ 0,0,0,0,0,0,0,0,0,0,247,255,253,33,16,3,0,0,0,0,0,240,255,255,
359
+ 255,255,255,255,255,7,0,1,0,0,0,248,255,255,255,255,255,255,255,255,255,255,255,251,
360
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,
361
+ 3,224,0,224,0,224,0,96,0,248,0,3,144,124,0,0,0,0,0,0,223,255,2,128,
362
+ 0,0,255,31,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,
363
+ 0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,0,
364
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,128,0,0,0,0,0,0,0,0,
365
+ 0,0,0,0,255,255,255,255,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,
366
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,60,62,8,
367
+ 0,0,0,0,0,0,0,0,0,0,0,126,0,0,0,0,0,0,0,0,0,0,0,112,
368
+ 0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
369
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
370
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,0,16,0,0,0,0,0,0,
371
+ 0,0,0,0,0,128,247,191,0,0,0,240,0,0,0,0,0,0,0,0,0,0,3,0,
372
+ 255,255,255,255,3,0,0,0,0,0,0,0,0,0,1,0,0,7,0,0,0,0,0,0,
373
+ 0,0,0,0,0,0,0,3,68,8,0,0,96,16,0,0,0,0,0,0,0,0,0,0,
374
+ 0,0,0,0,0,0,0,0,48,0,0,0,255,255,3,128,0,0,0,0,192,63,0,0,
375
+ 128,255,3,0,0,0,0,0,7,0,0,0,0,0,200,51,0,128,0,0,96,0,0,0,
376
+ 0,0,0,0,0,126,102,0,8,16,0,0,0,0,1,16,0,0,0,0,0,0,157,193,
377
+ 2,0,0,32,0,48,88,0,0,0,0,0,0,0,0,0,0,0,0,248,0,14,0,0,
378
+ 0,0,0,0,0,0,0,0,0,0,0,0,32,33,0,0,0,0,0,64,0,0,0,0,
379
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,0,
380
+ 255,255,8,0,255,255,0,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,
381
+ 0,0,0,0,0,0,0,128,128,64,0,4,0,0,0,64,1,0,0,0,0,0,1,0,
382
+ 0,0,0,192,0,0,0,0,0,0,0,0,8,0,0,14,0,0,0,0,0,0,0,0,
383
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,
384
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
385
+ 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,7,
386
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,240,0,0,0,0,0,135,
387
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,
388
+ 0,0,0,0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
389
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
390
+ 0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
391
+ 192,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
392
+ 2,0,0,0,0,0,0,255,127,0,0,0,0,0,0,128,3,0,0,0,0,0,120,38,
393
+ 0,32,0,0,0,0,0,0,7,0,0,0,128,239,31,0,0,0,0,0,0,0,8,0,
394
+ 3,0,0,0,0,0,192,127,0,158,0,0,0,0,0,0,0,0,0,0,0,128,211,64,
395
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,248,7,0,0,
396
+ 3,0,0,0,0,0,0,24,1,0,0,0,192,31,31,0,0,0,0,0,0,0,0,0,
397
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,92,0,0,64,0,0,0,0,
398
+ 0,0,0,0,0,0,248,133,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
399
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,176,1,0,0,48,0,0,0,0,
400
+ 0,0,0,0,0,0,248,167,1,0,0,0,0,0,0,0,0,0,0,0,0,40,191,0,
401
+ 0,0,0,0,0,0,0,0,0,0,0,224,188,15,0,0,0,0,0,0,0,0,0,0,
402
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,6,
403
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
404
+ 0,0,0,0,0,0,0,88,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
405
+ 0,0,240,12,1,0,0,0,254,7,0,0,0,0,248,121,128,0,126,14,0,0,0,0,
406
+ 0,252,127,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,191,
407
+ 0,0,0,0,0,0,0,0,0,0,252,255,255,252,109,0,0,0,0,0,0,0,0,0,
408
+ 0,0,0,0,0,0,126,180,191,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,
409
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
410
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,255,1,
411
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
412
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
413
+ 0,0,0,0,0,0,31,0,0,0,0,0,0,0,127,0,15,0,0,0,0,0,0,0,
414
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
415
+ 0,128,0,0,0,0,0,0,0,128,255,255,0,0,0,0,0,0,0,0,27,0,0,0,
416
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,15,0,0,0,
417
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,248,255,
418
+ 231,15,0,0,0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
419
+ 28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
420
+ 255,255,255,255,255,255,127,248,255,255,255,255,255,31,32,0,16,0,0,248,254,255,0,0,
421
+ 0,0,0,0,0,0,0,0,127,255,255,249,219,7,0,0,0,0,0,0,0,0,0,0,
422
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,63,
423
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
424
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
425
+ 0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
426
+ 0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,
427
+ 240,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
428
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
429
+ 0,0,0,0,0,0,0,248
430
+ ]);
431
+
432
+ // @ts-ignore: decorator
433
+ @lazy @inline const LOWER127 = memory.data<u8>([
434
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
435
+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
436
+ 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
437
+ 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
438
+ 64,
439
+ 97,98,99,100,101,102,103,104,105,106,107,108,109,
440
+ 110,111,112,113,114,115,116,117,118,119,120,121,122,
441
+ 91,92,93,94,95,96,
442
+ 97,98,99,100,101,102,103,104,105,106,107,108,109,
443
+ 110,111,112,113,114,115,116,117,118,119,120,121,122,
444
+ 123,124,125,126,127
445
+ ]);
446
+
447
+ // @ts-ignore: decorator
448
+ @lazy @inline const UPPER127 = memory.data<u8>([
449
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
450
+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
451
+ 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
452
+ 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
453
+ 64,
454
+ 65,66,67,68,69,70,71,72,73,74,75,76,77,
455
+ 78,79,80,81,82,83,84,85,86,87,88,89,90,
456
+ 91,92,93,94,95,96,
457
+ 65,66,67,68,69,70,71,72,73,74,75,76,77,
458
+ 78,79,80,81,82,83,84,85,86,87,88,89,90,
459
+ 123,124,125,126,127
460
+ ]);
461
+
462
+ // 23 * 8 = 184 bytes
463
+ // @ts-ignore: decorator
464
+ @lazy @inline const POWERS10 = memory.data<f64>([
465
+ 1e00, 1e01, 1e02, 1e03, 1e04, 1e05, 1e06, 1e07, 1e08, 1e09,
466
+ 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
467
+ 1e20, 1e21, 1e22
468
+ ]);
469
+
470
+ // @ts-ignore: decorator
471
+ @inline
472
+ export const enum CharCode {
473
+ PERCENT = 0x25,
474
+ PLUS = 0x2B,
475
+ MINUS = 0x2D,
476
+ DOT = 0x2E,
477
+ _0 = 0x30,
478
+ _1 = 0x31,
479
+ _2 = 0x32,
480
+ _3 = 0x33,
481
+ _4 = 0x34,
482
+ _5 = 0x35,
483
+ _6 = 0x36,
484
+ _7 = 0x37,
485
+ _8 = 0x38,
486
+ _9 = 0x39,
487
+ A = 0x41,
488
+ B = 0x42,
489
+ E = 0x45,
490
+ I = 0x49,
491
+ N = 0x4E,
492
+ O = 0x4F,
493
+ X = 0x58,
494
+ Z = 0x5A,
495
+ a = 0x61,
496
+ b = 0x62,
497
+ e = 0x65,
498
+ n = 0x6E,
499
+ o = 0x6F,
500
+ u = 0x75,
501
+ x = 0x78,
502
+ z = 0x7A
503
+ }
504
+
505
+ // @ts-ignore: decorator
506
+ @inline
507
+ export function isAscii(c: u32): bool {
508
+ return !(c >> 7);
509
+ }
510
+
511
+ // @ts-ignore: decorator
512
+ @inline
513
+ export function isLower8(c: u32): bool {
514
+ return c - CharCode.a < 26;
515
+ }
516
+
517
+ // @ts-ignore: decorator
518
+ @inline
519
+ export function isUpper8(c: u32): bool {
520
+ return c - CharCode.A < 26;
521
+ }
522
+
523
+ export function isSpace(c: u32): bool {
524
+ if (c < 0x1680) { // < <LS> (1)
525
+ // <SP>, <TAB>, <LF>, <VT>, <FF>, <CR> and <NBSP>
526
+ // (c == 0x20 || c == 0xA0) was optimized to (c | 0x80) == 0xA0
527
+ return ((c | 0x80) == 0xA0) || (c - 0x09 <= 0x0D - 0x09);
528
+ }
529
+ if (c - 0x2000 <= 0x200A - 0x2000) return true;
530
+ switch (c) {
531
+ case 0x1680: // <LS> (1)
532
+ case 0x2028: // <LS> (2)
533
+ case 0x2029: // <PS>
534
+ case 0x202F: // <NNS>
535
+ case 0x205F: // <MMSP>
536
+ case 0x3000: // <IS>
537
+ case 0xFEFF: return true; // <ZWNBSP>
538
+ }
539
+ return false;
540
+ }
541
+
542
+ export function isAlpha(c: u32): bool {
543
+ if (isAscii(c)) return (c | 32) - CharCode.a < 26;
544
+ if (c < 0x20000) {
545
+ // @ts-ignore: cast
546
+ return stagedBinaryLookup(ALPHA_TABLE, c);
547
+ }
548
+ return c < 0x2FFFE;
549
+ }
550
+
551
+ // @ts-ignore: decorator
552
+ @inline
553
+ export function isCased(c: u32): bool {
554
+ // @ts-ignore: cast
555
+ return c < 0x1F18A && stagedBinaryLookup(CASED, c);
556
+ }
557
+
558
+ // @ts-ignore: decorator
559
+ @inline
560
+ export function isCaseIgnorable(c: u32): bool {
561
+ // @ts-ignore: cast
562
+ return c < 0xE01F0 && stagedBinaryLookup(CASE_IGNORABLES, c);
563
+ }
564
+
565
+ // @ts-ignore: decorator
566
+ @inline
567
+ export function isFinalSigma(buffer: usize, index: isize, len: isize): bool {
568
+ const lookaheadLimit = 30; // max lookahead limit
569
+ let found = false;
570
+ let pos = index;
571
+ let minPos = max(0, pos - lookaheadLimit);
572
+ while (pos > minPos) {
573
+ let c = codePointBefore(buffer, pos);
574
+ if (!isCaseIgnorable(c)) {
575
+ if (isCased(c)) {
576
+ found = true;
577
+ } else {
578
+ return false;
579
+ }
580
+ }
581
+ pos -= isize(c >= 0x10000) + 1;
582
+ }
583
+ if (!found) return false;
584
+ pos = index + 1;
585
+ let maxPos = min(pos + lookaheadLimit, len);
586
+ while (pos < maxPos) {
587
+ let c = <u32>load<u16>(buffer + (pos << 1));
588
+ if (u32((c & 0xFC00) == 0xD800) & u32(pos + 1 != len)) {
589
+ let c1 = <u32>load<u16>(buffer + (pos << 1), 2);
590
+ if ((c1 & 0xFC00) == 0xDC00) {
591
+ c = (c - 0xD800 << 10) + (c1 - 0xDC00) + 0x10000;
592
+ }
593
+ }
594
+ if (!isCaseIgnorable(c)) {
595
+ return !isCased(c);
596
+ }
597
+ pos += isize(c >= 0x10000) + 1;
598
+ }
599
+ return true;
600
+ }
601
+
602
+ // @ts-ignore: decorator
603
+ @inline
604
+ function codePointBefore(buffer: usize, index: isize): i32 {
605
+ if (index <= 0) return -1;
606
+ let c = <u32>load<u16>(buffer + (index - 1 << 1));
607
+ if (u32((c & 0xFC00) == 0xDC00) & u32(index - 2 >= 0)) {
608
+ let c1 = <u32>load<u16>(buffer + (index - 2 << 1));
609
+ if ((c1 & 0xFC00) == 0xD800) {
610
+ return ((c1 & 0x3FF) << 10) + (c & 0x3FF) + 0x10000;
611
+ }
612
+ }
613
+ return (c & 0xF800) == 0xD800 ? 0xFFFD : c;
614
+ }
615
+
616
+ // Search routine for two-staged lookup tables
617
+ function stagedBinaryLookup(table: usize, c: u32): bool {
618
+ return <bool>((load<u8>(table + (<u32>load<u8>(table + (c >>> 8)) << 5) + ((c & 255) >> 3)) >>> (c & 7)) & 1);
619
+ }
620
+
621
+ export function compareImpl(str1: string, index1: usize, str2: string, index2: usize, len: usize): i32 {
622
+ let ptr1 = changetype<usize>(str1) + (index1 << 1);
623
+ let ptr2 = changetype<usize>(str2) + (index2 << 1);
624
+ if (ASC_SHRINK_LEVEL < 2) {
625
+ if (len >= 4 && !((ptr1 & 7) | (ptr2 & 7))) {
626
+ do {
627
+ if (load<u64>(ptr1) != load<u64>(ptr2)) break;
628
+ ptr1 += 8;
629
+ ptr2 += 8;
630
+ len -= 4;
631
+ } while (len >= 4);
632
+ }
633
+ }
634
+ while (len--) {
635
+ let a = <i32>load<u16>(ptr1);
636
+ let b = <i32>load<u16>(ptr2);
637
+ if (a != b) return a - b;
638
+ ptr1 += 2;
639
+ ptr2 += 2;
640
+ }
641
+ return 0;
642
+ }
643
+
644
+ // @ts-ignore: decorator
645
+ @inline
646
+ export function toLower8(c: u32): u32 {
647
+ if (ASC_SHRINK_LEVEL > 0) {
648
+ return c | u32(isUpper8(c)) << 5;
649
+ } else {
650
+ return <u32>load<u8>(LOWER127 + c);
651
+ }
652
+ }
653
+
654
+ // @ts-ignore: decorator
655
+ @inline
656
+ export function toUpper8(c: u32): u32 {
657
+ if (ASC_SHRINK_LEVEL > 0) {
658
+ return c & ~(u32(isLower8(c)) << 5);
659
+ } else {
660
+ return <u32>load<u8>(UPPER127 + c);
661
+ }
662
+ }
663
+
664
+ /** Parses a string to an integer (usually), using the specified radix. */
665
+ export function strtol<T>(str: string, radix: i32 = 0): T {
666
+ let len = str.length;
667
+ if (!len) {
668
+ if (isFloat<T>()) {
669
+ // @ts-ignore: cast
670
+ return <T>NaN;
671
+ } else {
672
+ // @ts-ignore: cast
673
+ return <T>0;
674
+ }
675
+ }
676
+
677
+ let ptr = changetype<usize>(str) /* + HEAD -> offset */;
678
+ let code = <u32>load<u16>(ptr);
679
+
680
+ // trim white spaces
681
+ while (isSpace(code)) {
682
+ code = <u32>load<u16>(ptr += 2);
683
+ --len;
684
+ }
685
+ // determine sign
686
+ // @ts-ignore
687
+ let sign: T = 1;
688
+ if (code == CharCode.MINUS || code == CharCode.PLUS) {
689
+ if (!--len) {
690
+ if (isFloat<T>()) {
691
+ // @ts-ignore: cast
692
+ return <T>NaN;
693
+ } else {
694
+ // @ts-ignore: cast
695
+ return <T>0;
696
+ }
697
+ }
698
+ if (code == CharCode.MINUS) {
699
+ // @ts-ignore: type
700
+ sign = -1;
701
+ }
702
+ code = <u32>load<u16>(ptr += 2);
703
+ }
704
+
705
+ // See https://tc39.es/ecma262/#sec-parseint-string-radix
706
+ if (radix) {
707
+ if (radix < 2 || radix > 36) {
708
+ if (isFloat<T>()) {
709
+ // @ts-ignore: cast
710
+ return <T>NaN;
711
+ } else {
712
+ // @ts-ignore: cast
713
+ return <T>0;
714
+ }
715
+ }
716
+ // handle case as parseInt("0xFF", 16) by spec
717
+ if (radix == 16) {
718
+ if (
719
+ len > 2 &&
720
+ code == CharCode._0 &&
721
+ (<u32>load<u16>(ptr, 2) | 32) == CharCode.x
722
+ ) {
723
+ ptr += 4; len -= 2;
724
+ }
725
+ }
726
+ } else {
727
+ // determine radix by literal prefix
728
+ if (code == CharCode._0 && len > 2) {
729
+ switch (<u32>load<u16>(ptr, 2) | 32) {
730
+ case CharCode.b: {
731
+ ptr += 4; len -= 2;
732
+ radix = 2;
733
+ break;
734
+ }
735
+ case CharCode.o: {
736
+ ptr += 4; len -= 2;
737
+ radix = 8;
738
+ break;
739
+ }
740
+ case CharCode.x: {
741
+ ptr += 4; len -= 2;
742
+ radix = 16;
743
+ break;
744
+ }
745
+ }
746
+ }
747
+ if (!radix) radix = 10;
748
+ }
749
+
750
+ // calculate value
751
+ // @ts-ignore: type
752
+ let num: T = 0;
753
+ let initial = len - 1;
754
+ while (len--) {
755
+ code = <u32>load<u16>(ptr);
756
+ if (code - CharCode._0 < 10) {
757
+ code -= CharCode._0;
758
+ } else if (code - CharCode.A <= <u32>(CharCode.Z - CharCode.A)) {
759
+ code -= CharCode.A - 10;
760
+ } else if (code - CharCode.a <= <u32>(CharCode.z - CharCode.a)) {
761
+ code -= CharCode.a - 10;
762
+ }
763
+ if (code >= <u32>radix) {
764
+ if (initial == len) {
765
+ if (isFloat<T>()) {
766
+ // @ts-ignore: cast
767
+ return <T>NaN;
768
+ } else {
769
+ // @ts-ignore: cast
770
+ return <T>0;
771
+ }
772
+ }
773
+ break;
774
+ }
775
+ // @ts-ignore: type
776
+ num = num * radix + code;
777
+ ptr += 2;
778
+ }
779
+ // @ts-ignore: type
780
+ return sign * num;
781
+ }
782
+
783
+ export function strtod(str: string): f64 {
784
+ let len = str.length;
785
+ if (!len) return NaN;
786
+
787
+ let ptr = changetype<usize>(str);
788
+ let code = <u32>load<u16>(ptr);
789
+
790
+ let sign = 1.0;
791
+ // skip white spaces
792
+ while (len && isSpace(code)) {
793
+ code = <u32>load<u16>(ptr += 2);
794
+ --len;
795
+ }
796
+ if (!len) return NaN;
797
+
798
+ // try parse '-' or '+'
799
+ if (code == CharCode.MINUS) {
800
+ if (!--len) return NaN;
801
+ code = <u32>load<u16>(ptr += 2);
802
+ sign = -1;
803
+ } else if (code == CharCode.PLUS) {
804
+ if (!--len) return NaN;
805
+ code = <u32>load<u16>(ptr += 2);
806
+ }
807
+
808
+ // try parse Infinity
809
+ if (len >= 8 && code == CharCode.I) {
810
+ if (
811
+ load<u64>(ptr, 0) == 0x690066006E0049 && // ifnI
812
+ load<u64>(ptr, 8) == 0x7900740069006E // ytin
813
+ ) {
814
+ return Infinity * sign;
815
+ }
816
+ return NaN;
817
+ }
818
+ // validate next symbol
819
+ if (code != CharCode.DOT && <u32>(code - CharCode._0) >= 10) {
820
+ return NaN;
821
+ }
822
+ let savedPtr = ptr;
823
+ // skip zeros
824
+ while (code == CharCode._0) {
825
+ code = <u32>load<u16>(ptr += 2);
826
+ --len;
827
+ }
828
+ if (len <= 0) return 0.0 * sign;
829
+ const capacity = 19; // int(64 * 0.3010)
830
+ let pointed = false;
831
+ let consumed = 0;
832
+ let position = 0;
833
+ let x: u64 = 0;
834
+ if (code == CharCode.DOT) {
835
+ let noDigits = !(savedPtr - ptr);
836
+ ptr += 2; --len;
837
+ if (!len && noDigits) return NaN;
838
+ for (pointed = true; (code = <u32>load<u16>(ptr)) == CharCode._0; --position, ptr += 2) --len;
839
+ if (len <= 0) return 0.0 * sign;
840
+ if (!position && noDigits && code - CharCode._0 >= 10) return NaN;
841
+ }
842
+ for (let digit = code - CharCode._0; digit < 10 || (code == CharCode.DOT && !pointed); digit = code - CharCode._0) {
843
+ if (digit < 10) {
844
+ x = consumed < capacity ? 10 * x + digit : x | u64(!!digit);
845
+ ++consumed;
846
+ } else {
847
+ position = consumed;
848
+ pointed = true;
849
+ }
850
+ if (!--len) break;
851
+ code = <u32>load<u16>(ptr += 2);
852
+ }
853
+
854
+ if (!pointed) position = consumed;
855
+ return copysign<f64>(scientific(x, position - min(capacity, consumed) + parseExp(ptr, len)), sign);
856
+ }
857
+
858
+ export function strtob(str: string): bool {
859
+ let size: usize = str.length << 1;
860
+ let offset: usize = 0;
861
+ if (size > 8) {
862
+ // try trim end whitespaces first
863
+ while (size && isSpace(load<u16>(changetype<usize>(str) + size - 2))) size -= 2;
864
+ if (size > 8) {
865
+ // trim start whitespaces
866
+ while (offset < size && isSpace(load<u16>(changetype<usize>(str) + offset))) offset += 2;
867
+ size -= offset;
868
+ }
869
+ }
870
+ if (size != 8) return false;
871
+ // "true" represents as \00\e\00\u\00\e\00\t (00 65 00 75 00 72 00 74)
872
+ return load<u64>(changetype<usize>(str) + offset) == 0x0065_0075_0072_0074;
873
+ }
874
+
875
+ export function joinBooleanArray(dataStart: usize, length: i32, separator: string): string {
876
+ let lastIndex = length - 1;
877
+ if (lastIndex < 0) return "";
878
+ if (!lastIndex) return select("true", "false", load<bool>(dataStart));
879
+
880
+ let sepLen = separator.length;
881
+ let valueLen = 5; // max possible length of element len("false")
882
+ let estLen = (valueLen + sepLen) * lastIndex + valueLen;
883
+ let result = changetype<string>(__new(estLen << 1, idof<string>()));
884
+ let offset = 0;
885
+ let value: bool;
886
+ for (let i = 0; i < lastIndex; ++i) {
887
+ value = load<bool>(dataStart + i);
888
+ valueLen = 4 + i32(!value);
889
+ memory.copy(
890
+ changetype<usize>(result) + (<usize>offset << 1),
891
+ changetype<usize>(select("true", "false", value)),
892
+ <usize>valueLen << 1
893
+ );
894
+ offset += valueLen;
895
+ if (sepLen) {
896
+ memory.copy(
897
+ changetype<usize>(result) + (<usize>offset << 1),
898
+ changetype<usize>(separator),
899
+ <usize>sepLen << 1
900
+ );
901
+ offset += sepLen;
902
+ }
903
+ }
904
+ value = load<bool>(dataStart + <usize>lastIndex);
905
+ valueLen = 4 + i32(!value);
906
+ memory.copy(
907
+ changetype<usize>(result) + (<usize>offset << 1),
908
+ changetype<usize>(select("true", "false", value)),
909
+ valueLen << 1
910
+ );
911
+ offset += valueLen;
912
+
913
+ if (estLen > offset) return result.substring(0, offset);
914
+ return result;
915
+ }
916
+
917
+ export function joinIntegerArray<T>(dataStart: usize, length: i32, separator: string): string {
918
+ let lastIndex = length - 1;
919
+ if (lastIndex < 0) return "";
920
+ if (!lastIndex) {
921
+ let value = load<T>(dataStart);
922
+ if (isSigned<T>()) {
923
+ if (sizeof<T>() <= 4) {
924
+ // @ts-ignore: type
925
+ return changetype<string>(itoa32(<i32>value, 10));
926
+ } else {
927
+ // @ts-ignore: type
928
+ return changetype<string>(itoa64(<i32>value, 10));
929
+ }
930
+ } else {
931
+ if (sizeof<T>() <= 4) {
932
+ // @ts-ignore: type
933
+ return changetype<string>(utoa32(<u32>value, 10));
934
+ } else {
935
+ // @ts-ignore: type
936
+ return changetype<string>(utoa64(<u64>value, 10));
937
+ }
938
+ }
939
+ }
940
+
941
+ let sepLen = separator.length;
942
+ const valueLen = (sizeof<T>() <= 4 ? 10 : 20) + i32(isSigned<T>());
943
+ let estLen = (valueLen + sepLen) * lastIndex + valueLen;
944
+ let result = changetype<string>(__new(estLen << 1, idof<string>()));
945
+ let offset = 0;
946
+ let value: T;
947
+ for (let i = 0; i < lastIndex; ++i) {
948
+ value = load<T>(dataStart + (<usize>i << alignof<T>()));
949
+ // @ts-ignore: type
950
+ offset += itoa_buffered<T>(changetype<usize>(result) + (<usize>offset << 1), value);
951
+ if (sepLen) {
952
+ memory.copy(
953
+ changetype<usize>(result) + (<usize>offset << 1),
954
+ changetype<usize>(separator),
955
+ <usize>sepLen << 1
956
+ );
957
+ offset += sepLen;
958
+ }
959
+ }
960
+ value = load<T>(dataStart + (<usize>lastIndex << alignof<T>()));
961
+ // @ts-ignore: type
962
+ offset += itoa_buffered<T>(changetype<usize>(result) + (<usize>offset << 1), value);
963
+ if (estLen > offset) return result.substring(0, offset);
964
+ return result;
965
+ }
966
+
967
+ export function joinFloatArray<T>(dataStart: usize, length: i32, separator: string): string {
968
+ let lastIndex = length - 1;
969
+ if (lastIndex < 0) return "";
970
+ if (!lastIndex) {
971
+ return changetype<string>(dtoa(
972
+ // @ts-ignore: type
973
+ load<T>(dataStart))
974
+ );
975
+ }
976
+
977
+ const valueLen = MAX_DOUBLE_LENGTH;
978
+ let sepLen = separator.length;
979
+ let estLen = (valueLen + sepLen) * lastIndex + valueLen;
980
+ let result = changetype<string>(__new(estLen << 1, idof<string>()));
981
+ let offset = 0;
982
+ let value: T;
983
+ for (let i = 0; i < lastIndex; ++i) {
984
+ value = load<T>(dataStart + (<usize>i << alignof<T>()));
985
+ // @ts-ignore: type
986
+ offset += dtoa_buffered(changetype<usize>(result) + (<usize>offset << 1), value);
987
+ if (sepLen) {
988
+ memory.copy(
989
+ changetype<usize>(result) + (<usize>offset << 1),
990
+ changetype<usize>(separator),
991
+ <usize>sepLen << 1
992
+ );
993
+ offset += sepLen;
994
+ }
995
+ }
996
+ value = load<T>(dataStart + (<usize>lastIndex << alignof<T>()));
997
+ // @ts-ignore: type
998
+ offset += dtoa_buffered(changetype<usize>(result) + (<usize>offset << 1), value);
999
+ if (estLen > offset) return result.substring(0, offset);
1000
+ return result;
1001
+ }
1002
+
1003
+ export function joinStringArray(dataStart: usize, length: i32, separator: string): string {
1004
+ let lastIndex = length - 1;
1005
+ if (lastIndex < 0) return "";
1006
+ if (!lastIndex) {
1007
+ // @ts-ignore: type
1008
+ return load<string>(dataStart) || "";
1009
+ }
1010
+ let estLen = 0;
1011
+ let value: string;
1012
+ for (let i = 0; i < length; ++i) {
1013
+ value = load<string>(dataStart + (<usize>i << alignof<string>()));
1014
+ if (changetype<usize>(value) != 0) estLen += value.length;
1015
+ }
1016
+ let offset = 0;
1017
+ let sepLen = separator.length;
1018
+ let result = changetype<string>(__new((estLen + sepLen * lastIndex) << 1, idof<string>()));
1019
+ for (let i = 0; i < lastIndex; ++i) {
1020
+ value = load<string>(dataStart + (<usize>i << alignof<string>()));
1021
+ if (changetype<usize>(value) != 0) {
1022
+ let valueLen = value.length;
1023
+ memory.copy(
1024
+ changetype<usize>(result) + (<usize>offset << 1),
1025
+ changetype<usize>(value),
1026
+ <usize>valueLen << 1
1027
+ );
1028
+ offset += valueLen;
1029
+ }
1030
+ if (sepLen) {
1031
+ memory.copy(
1032
+ changetype<usize>(result) + (<usize>offset << 1),
1033
+ changetype<usize>(separator),
1034
+ <usize>sepLen << 1
1035
+ );
1036
+ offset += sepLen;
1037
+ }
1038
+ }
1039
+ value = load<string>(dataStart + (<usize>lastIndex << alignof<string>()));
1040
+ if (changetype<usize>(value) != 0) {
1041
+ memory.copy(
1042
+ changetype<usize>(result) + (<usize>offset << 1),
1043
+ changetype<usize>(value),
1044
+ <usize>value.length << 1
1045
+ );
1046
+ }
1047
+ return result;
1048
+ }
1049
+
1050
+ export function joinReferenceArray<T>(dataStart: usize, length: i32, separator: string): string {
1051
+ let lastIndex = length - 1;
1052
+ if (lastIndex < 0) return "";
1053
+ let value: T;
1054
+ if (!lastIndex) {
1055
+ value = load<T>(dataStart);
1056
+ // @ts-ignore: type
1057
+ return value != null ? value.toString() : "";
1058
+ }
1059
+ let result = "";
1060
+ let sepLen = separator.length;
1061
+ for (let i = 0; i < lastIndex; ++i) {
1062
+ value = load<T>(dataStart + (<usize>i << alignof<T>()));
1063
+ // @ts-ignore: type
1064
+ if (value != null) result += value.toString();
1065
+ if (sepLen) result += separator;
1066
+ }
1067
+ value = load<T>(dataStart + (<usize>lastIndex << alignof<T>()));
1068
+ // @ts-ignore: type
1069
+ if (value != null) result += value.toString();
1070
+ return result;
1071
+ }
1072
+
1073
+ // @ts-ignore: decorator
1074
+ @inline
1075
+ function scientific(significand: u64, exp: i32): f64 {
1076
+ if (!significand || exp < -342) return 0;
1077
+ if (exp > 308) return Infinity;
1078
+ // Try use fast path
1079
+ // Use fast path for string-to-double conversion if possible
1080
+ // see http://www.exploringbinary.com/fast-path-decimal-to-floating-point-conversion
1081
+ // Simple integer
1082
+ let significandf = <f64>significand;
1083
+ if (!exp) return significandf;
1084
+ if (exp > 22 && exp <= 22 + 15) {
1085
+ significandf *= pow10(exp - 22);
1086
+ exp = 22;
1087
+ }
1088
+ if (significand <= 9007199254740991 && abs(exp) <= 22) {
1089
+ if (exp > 0) return significandf * pow10(exp);
1090
+ return significandf / pow10(-exp);
1091
+ } else if (exp < 0) {
1092
+ return scaledown(significand, exp);
1093
+ } else {
1094
+ return scaleup(significand, exp);
1095
+ }
1096
+ }
1097
+
1098
+ // Adopted from metallic lib:
1099
+ // https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h
1100
+ // @ts-ignore: decorator
1101
+ @inline
1102
+ function scaledown(significand: u64, exp: i32): f64 {
1103
+ const denom: u64 = 6103515625; // 1e14 * 0x1p-14
1104
+ const scale = reinterpret<f64>(0x3F06849B86A12B9B); // 1e-14 * 0x1p32
1105
+
1106
+ let shift = clz(significand);
1107
+ significand <<= shift;
1108
+ shift = exp - shift;
1109
+
1110
+ for (; exp <= -14; exp += 14) {
1111
+ let q = significand / denom;
1112
+ let r = significand % denom;
1113
+ let s = clz(q);
1114
+ significand = (q << s) + <u64>nearest(scale * <f64>(r << (s - 18)));
1115
+ shift -= s;
1116
+ }
1117
+ let b = <u64>ipow32(5, -exp);
1118
+ let q = significand / b;
1119
+ let r = significand % b;
1120
+ let s = clz(q);
1121
+ significand = (q << s) + <u64>(reinterpret<f64>(reinterpret<u64>(<f64>r) + (s << 52)) / <f64>b);
1122
+ shift -= s;
1123
+
1124
+ return NativeMath.scalbn(<f64>significand, <i32>shift);
1125
+ }
1126
+
1127
+ // Adopted from metallic lib:
1128
+ // https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h
1129
+ // @ts-ignore: decorator
1130
+ @inline
1131
+ function scaleup(significand: u64, exp: i32): f64 {
1132
+ const coeff: u32 = 1220703125; // 1e13 * 0x1p-13;
1133
+ let shift = ctz(significand);
1134
+ significand >>= shift;
1135
+ shift += exp;
1136
+
1137
+ __fixmulShift = shift;
1138
+ for (; exp >= 13; exp -= 13) {
1139
+ significand = fixmul(significand, coeff);
1140
+ }
1141
+ significand = fixmul(significand, <u32>ipow32(5, exp));
1142
+ shift = __fixmulShift;
1143
+ return NativeMath.scalbn(<f64>significand, <i32>shift);
1144
+ }
1145
+
1146
+ // Adopted from metallic lib:
1147
+ // https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h
1148
+ // @ts-ignore: decorator
1149
+ @inline
1150
+ function parseExp(ptr: usize, len: i32): i32 {
1151
+ let sign = 1, magnitude = 0;
1152
+ let code = <u32>load<u16>(ptr);
1153
+ // check code is 'e' or 'E'
1154
+ if ((code | 32) != CharCode.e) return 0;
1155
+
1156
+ if (!--len) return 0;
1157
+ code = <u32>load<u16>(ptr += 2);
1158
+ if (code == CharCode.MINUS) {
1159
+ if (!--len) return 0;
1160
+ code = <u32>load<u16>(ptr += 2);
1161
+ sign = -1;
1162
+ } else if (code == CharCode.PLUS) {
1163
+ if (!--len) return 0;
1164
+ code = <u32>load<u16>(ptr += 2);
1165
+ }
1166
+ // skip zeros
1167
+ while (code == CharCode._0) {
1168
+ if (!--len) return 0;
1169
+ code = <u32>load<u16>(ptr += 2);
1170
+ }
1171
+ for (let digit: u32 = code - CharCode._0; len && digit < 10; digit = code - CharCode._0) {
1172
+ if (magnitude >= 3200) return sign * 3200;
1173
+ magnitude = 10 * magnitude + digit;
1174
+ code = <u32>load<u16>(ptr += 2);
1175
+ --len;
1176
+ }
1177
+ return sign * magnitude;
1178
+ }
1179
+
1180
+ // @ts-ignore: decorator
1181
+ @lazy let __fixmulShift: u64 = 0;
1182
+
1183
+ // Adopted from metallic lib:
1184
+ // https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h
1185
+ // @ts-ignore: decorator
1186
+ @inline
1187
+ function fixmul(a: u64, b: u32): u64 {
1188
+ let low = (a & 0xFFFFFFFF) * b;
1189
+ let high = (a >> 32) * b + (low >> 32);
1190
+ let overflow = <u32>(high >> 32);
1191
+ let space = clz(overflow);
1192
+ let revspace: u64 = 32 - space;
1193
+ __fixmulShift += revspace;
1194
+ return (high << space | (low & 0xFFFFFFFF) >> revspace) + (low << space >> 31 & 1);
1195
+ }
1196
+
1197
+ // @ts-ignore: decorator
1198
+ @inline
1199
+ function pow10(n: i32): f64 {
1200
+ // argument `n` should bounds in [0, 22] range
1201
+ return load<f64>(POWERS10 + (n << alignof<f64>()));
1202
+ }