@loaders.gl/pointclouds 0.0.0-stage → 5.0.0-beta.10

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 (511) hide show
  1. package/LAS-README.md +12 -0
  2. package/LICENSE +24 -0
  3. package/PCD-README.md +12 -0
  4. package/PLY-README.md +38 -0
  5. package/README.md +11 -2
  6. package/THIRD-PARTY-NOTICES.md +27 -0
  7. package/dist/dist.dev.js +31514 -0
  8. package/dist/dist.min.js +54 -0
  9. package/dist/index.cjs +55 -0
  10. package/dist/index.cjs.map +7 -0
  11. package/dist/index.d.ts +16 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +13 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/las/bundled.cjs +69 -0
  16. package/dist/las/bundled.cjs.map +7 -0
  17. package/dist/las/bundled.d.ts +11 -0
  18. package/dist/las/bundled.d.ts.map +1 -0
  19. package/dist/las/bundled.js +11 -0
  20. package/dist/las/bundled.js.map +1 -0
  21. package/dist/las/index.cjs +75 -0
  22. package/dist/las/index.cjs.map +7 -0
  23. package/dist/las/index.d.ts +15 -0
  24. package/dist/las/index.d.ts.map +1 -0
  25. package/dist/las/index.js +12 -0
  26. package/dist/las/index.js.map +1 -0
  27. package/dist/las/las-copc-loader-types.cjs +49 -0
  28. package/dist/las/las-copc-loader-types.cjs.map +7 -0
  29. package/dist/las/las-copc-loader-types.d.ts +67 -0
  30. package/dist/las/las-copc-loader-types.d.ts.map +1 -0
  31. package/dist/las/las-copc-loader-types.js +14 -0
  32. package/dist/las/las-copc-loader-types.js.map +1 -0
  33. package/dist/las/las-copc-loader.cjs +60 -0
  34. package/dist/las/las-copc-loader.cjs.map +7 -0
  35. package/dist/las/las-copc-loader.d.ts +39 -0
  36. package/dist/las/las-copc-loader.d.ts.map +1 -0
  37. package/dist/las/las-copc-loader.js +45 -0
  38. package/dist/las/las-copc-loader.js.map +1 -0
  39. package/dist/las/las-format.cjs +44 -0
  40. package/dist/las/las-format.cjs.map +7 -0
  41. package/dist/las/las-format.d.ts +16 -0
  42. package/dist/las/las-format.d.ts.map +1 -0
  43. package/dist/las/las-format.js +19 -0
  44. package/dist/las/las-format.js.map +1 -0
  45. package/dist/las/las-loader-shared.cjs +84 -0
  46. package/dist/las/las-loader-shared.cjs.map +7 -0
  47. package/dist/las/las-loader-shared.d.ts +68 -0
  48. package/dist/las/las-loader-shared.d.ts.map +1 -0
  49. package/dist/las/las-loader-shared.js +60 -0
  50. package/dist/las/las-loader-shared.js.map +1 -0
  51. package/dist/las/las-loader-types.cjs +51 -0
  52. package/dist/las/las-loader-types.cjs.map +7 -0
  53. package/dist/las/las-loader-types.d.ts +77 -0
  54. package/dist/las/las-loader-types.d.ts.map +1 -0
  55. package/dist/las/las-loader-types.js +17 -0
  56. package/dist/las/las-loader-types.js.map +1 -0
  57. package/dist/las/las-loader.cjs +128 -0
  58. package/dist/las/las-loader.cjs.map +7 -0
  59. package/dist/las/las-loader.d.ts +91 -0
  60. package/dist/las/las-loader.d.ts.map +1 -0
  61. package/dist/las/las-loader.js +108 -0
  62. package/dist/las/las-loader.js.map +1 -0
  63. package/dist/las/las-writer.cjs +1054 -0
  64. package/dist/las/las-writer.cjs.map +7 -0
  65. package/dist/las/las-writer.d.ts +70 -0
  66. package/dist/las/las-writer.d.ts.map +1 -0
  67. package/dist/las/las-writer.js +992 -0
  68. package/dist/las/las-writer.js.map +1 -0
  69. package/dist/las/laz-rs-loader-types.cjs +49 -0
  70. package/dist/las/laz-rs-loader-types.cjs.map +7 -0
  71. package/dist/las/laz-rs-loader-types.d.ts +69 -0
  72. package/dist/las/laz-rs-loader-types.d.ts.map +1 -0
  73. package/dist/las/laz-rs-loader-types.js +16 -0
  74. package/dist/las/laz-rs-loader-types.js.map +1 -0
  75. package/dist/las/laz-rs-loader.cjs +275 -0
  76. package/dist/las/laz-rs-loader.cjs.map +7 -0
  77. package/dist/las/laz-rs-loader.d.ts +39 -0
  78. package/dist/las/laz-rs-loader.d.ts.map +1 -0
  79. package/dist/las/laz-rs-loader.js +43 -0
  80. package/dist/las/laz-rs-loader.js.map +1 -0
  81. package/dist/las/lazperf-loader-types.cjs +49 -0
  82. package/dist/las/lazperf-loader-types.cjs.map +7 -0
  83. package/dist/las/lazperf-loader-types.d.ts +71 -0
  84. package/dist/las/lazperf-loader-types.d.ts.map +1 -0
  85. package/dist/las/lazperf-loader-types.js +17 -0
  86. package/dist/las/lazperf-loader-types.js.map +1 -0
  87. package/dist/las/lazperf-loader.cjs +63 -0
  88. package/dist/las/lazperf-loader.cjs.map +7 -0
  89. package/dist/las/lazperf-loader.d.ts +41 -0
  90. package/dist/las/lazperf-loader.d.ts.map +1 -0
  91. package/dist/las/lazperf-loader.js +49 -0
  92. package/dist/las/lazperf-loader.js.map +1 -0
  93. package/dist/las/lib/copc/parse-las.cjs +177 -0
  94. package/dist/las/lib/copc/parse-las.cjs.map +7 -0
  95. package/dist/las/lib/copc/parse-las.d.ts +17 -0
  96. package/dist/las/lib/copc/parse-las.d.ts.map +1 -0
  97. package/dist/las/lib/copc/parse-las.js +215 -0
  98. package/dist/las/lib/copc/parse-las.js.map +1 -0
  99. package/dist/las/lib/get-las-schema.cjs +67 -0
  100. package/dist/las/lib/get-las-schema.cjs.map +7 -0
  101. package/dist/las/lib/get-las-schema.d.ts +16 -0
  102. package/dist/las/lib/get-las-schema.d.ts.map +1 -0
  103. package/dist/las/lib/get-las-schema.js +52 -0
  104. package/dist/las/lib/get-las-schema.js.map +1 -0
  105. package/dist/las/lib/las-compatibility.cjs +110 -0
  106. package/dist/las/lib/las-compatibility.cjs.map +7 -0
  107. package/dist/las/lib/las-compatibility.d.ts +40 -0
  108. package/dist/las/lib/las-compatibility.d.ts.map +1 -0
  109. package/dist/las/lib/las-compatibility.js +115 -0
  110. package/dist/las/lib/las-compatibility.js.map +1 -0
  111. package/dist/las/lib/las-extra-bytes.cjs +228 -0
  112. package/dist/las/lib/las-extra-bytes.cjs.map +7 -0
  113. package/dist/las/lib/las-extra-bytes.d.ts +35 -0
  114. package/dist/las/lib/las-extra-bytes.d.ts.map +1 -0
  115. package/dist/las/lib/las-extra-bytes.js +197 -0
  116. package/dist/las/lib/las-extra-bytes.js.map +1 -0
  117. package/dist/las/lib/las-types.cjs +19 -0
  118. package/dist/las/lib/las-types.cjs.map +7 -0
  119. package/dist/las/lib/las-types.d.ts +194 -0
  120. package/dist/las/lib/las-types.d.ts.map +1 -0
  121. package/dist/las/lib/las-types.js +5 -0
  122. package/dist/las/lib/las-types.js.map +1 -0
  123. package/dist/las/lib/las-waveform.cjs +196 -0
  124. package/dist/las/lib/las-waveform.cjs.map +7 -0
  125. package/dist/las/lib/las-waveform.d.ts +89 -0
  126. package/dist/las/lib/las-waveform.d.ts.map +1 -0
  127. package/dist/las/lib/las-waveform.js +193 -0
  128. package/dist/las/lib/las-waveform.js.map +1 -0
  129. package/dist/las/lib/laz-perf/laslaz-decoder.cjs +382 -0
  130. package/dist/las/lib/laz-perf/laslaz-decoder.cjs.map +7 -0
  131. package/dist/las/lib/laz-perf/laslaz-decoder.d.ts +129 -0
  132. package/dist/las/lib/laz-perf/laslaz-decoder.d.ts.map +1 -0
  133. package/dist/las/lib/laz-perf/laslaz-decoder.js +377 -0
  134. package/dist/las/lib/laz-perf/laslaz-decoder.js.map +1 -0
  135. package/dist/las/lib/laz-perf/parse-las.cjs +271 -0
  136. package/dist/las/lib/laz-perf/parse-las.cjs.map +7 -0
  137. package/dist/las/lib/laz-perf/parse-las.d.ts +24 -0
  138. package/dist/las/lib/laz-perf/parse-las.d.ts.map +1 -0
  139. package/dist/las/lib/laz-perf/parse-las.js +308 -0
  140. package/dist/las/lib/laz-perf/parse-las.js.map +1 -0
  141. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.cjs +631 -0
  142. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.cjs.map +7 -0
  143. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.d.ts +129 -0
  144. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.d.ts.map +1 -0
  145. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.js +414 -0
  146. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.js.map +1 -0
  147. package/dist/las/lib/laz-rs-wasm/parse-las.cjs +271 -0
  148. package/dist/las/lib/laz-rs-wasm/parse-las.cjs.map +7 -0
  149. package/dist/las/lib/laz-rs-wasm/parse-las.d.ts +24 -0
  150. package/dist/las/lib/laz-rs-wasm/parse-las.d.ts.map +1 -0
  151. package/dist/las/lib/laz-rs-wasm/parse-las.js +308 -0
  152. package/dist/las/lib/laz-rs-wasm/parse-las.js.map +1 -0
  153. package/dist/las/lib/typescript/parse-las.cjs +2889 -0
  154. package/dist/las/lib/typescript/parse-las.cjs.map +7 -0
  155. package/dist/las/lib/typescript/parse-las.d.ts +39 -0
  156. package/dist/las/lib/typescript/parse-las.d.ts.map +1 -0
  157. package/dist/las/lib/typescript/parse-las.js +2703 -0
  158. package/dist/las/lib/typescript/parse-las.js.map +1 -0
  159. package/dist/las/libs/laz-perf/laz-perf.cjs +18093 -0
  160. package/dist/las/libs/laz-perf/laz-perf.cjs.map +7 -0
  161. package/dist/las/libs/laz-perf/laz-perf.d.ts +2 -0
  162. package/dist/las/libs/laz-perf/laz-perf.d.ts.map +1 -0
  163. package/dist/las/libs/laz-perf/laz-perf.js +19003 -0
  164. package/dist/las/libs/laz-perf/laz-perf.js.map +1 -0
  165. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.d.ts +95 -0
  166. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.d.ts.map +1 -0
  167. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.js +442 -0
  168. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.js.map +1 -0
  169. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm +0 -0
  170. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm.d.ts +38 -0
  171. package/dist/las/unbundled.cjs +69 -0
  172. package/dist/las/unbundled.cjs.map +7 -0
  173. package/dist/las/unbundled.d.ts +11 -0
  174. package/dist/las/unbundled.d.ts.map +1 -0
  175. package/dist/las/unbundled.js +11 -0
  176. package/dist/las/unbundled.js.map +1 -0
  177. package/dist/las/workers/las-worker.cjs +23 -0
  178. package/dist/las/workers/las-worker.cjs.map +7 -0
  179. package/dist/las/workers/las-worker.d.ts +2 -0
  180. package/dist/las/workers/las-worker.d.ts.map +1 -0
  181. package/dist/las/workers/las-worker.js +23 -0
  182. package/dist/las/workers/las-worker.js.map +1 -0
  183. package/dist/las-copc-loader-types.cjs +51 -0
  184. package/dist/las-copc-loader-types.cjs.map +7 -0
  185. package/dist/las-copc-loader-types.d.ts +2 -0
  186. package/dist/las-copc-loader-types.d.ts.map +1 -0
  187. package/dist/las-copc-loader-types.js +2 -0
  188. package/dist/las-copc-loader-types.js.map +1 -0
  189. package/dist/las-copc-loader.cjs +62 -0
  190. package/dist/las-copc-loader.cjs.map +7 -0
  191. package/dist/las-copc-loader.d.ts +2 -0
  192. package/dist/las-copc-loader.d.ts.map +1 -0
  193. package/dist/las-copc-loader.js +2 -0
  194. package/dist/las-copc-loader.js.map +1 -0
  195. package/dist/las-loader-types.cjs +53 -0
  196. package/dist/las-loader-types.cjs.map +7 -0
  197. package/dist/las-loader-types.d.ts +2 -0
  198. package/dist/las-loader-types.d.ts.map +1 -0
  199. package/dist/las-loader-types.js +2 -0
  200. package/dist/las-loader-types.js.map +1 -0
  201. package/dist/las-loader.cjs +130 -0
  202. package/dist/las-loader.cjs.map +7 -0
  203. package/dist/las-loader.d.ts +2 -0
  204. package/dist/las-loader.d.ts.map +1 -0
  205. package/dist/las-loader.js +2 -0
  206. package/dist/las-loader.js.map +1 -0
  207. package/dist/las-worker.js +24024 -0
  208. package/dist/las-writer.cjs +1056 -0
  209. package/dist/las-writer.cjs.map +7 -0
  210. package/dist/las-writer.d.ts +2 -0
  211. package/dist/las-writer.d.ts.map +1 -0
  212. package/dist/las-writer.js +2 -0
  213. package/dist/las-writer.js.map +1 -0
  214. package/dist/laz-rs-loader-types.cjs +51 -0
  215. package/dist/laz-rs-loader-types.cjs.map +7 -0
  216. package/dist/laz-rs-loader-types.d.ts +2 -0
  217. package/dist/laz-rs-loader-types.d.ts.map +1 -0
  218. package/dist/laz-rs-loader-types.js +2 -0
  219. package/dist/laz-rs-loader-types.js.map +1 -0
  220. package/dist/laz-rs-loader.cjs +277 -0
  221. package/dist/laz-rs-loader.cjs.map +7 -0
  222. package/dist/laz-rs-loader.d.ts +2 -0
  223. package/dist/laz-rs-loader.d.ts.map +1 -0
  224. package/dist/laz-rs-loader.js +2 -0
  225. package/dist/laz-rs-loader.js.map +1 -0
  226. package/dist/lazperf-loader-types.cjs +51 -0
  227. package/dist/lazperf-loader-types.cjs.map +7 -0
  228. package/dist/lazperf-loader-types.d.ts +2 -0
  229. package/dist/lazperf-loader-types.d.ts.map +1 -0
  230. package/dist/lazperf-loader-types.js +2 -0
  231. package/dist/lazperf-loader-types.js.map +1 -0
  232. package/dist/lazperf-loader.cjs +65 -0
  233. package/dist/lazperf-loader.cjs.map +7 -0
  234. package/dist/lazperf-loader.d.ts +2 -0
  235. package/dist/lazperf-loader.d.ts.map +1 -0
  236. package/dist/lazperf-loader.js +2 -0
  237. package/dist/lazperf-loader.js.map +1 -0
  238. package/dist/pcd/bundled.cjs +31 -0
  239. package/dist/pcd/bundled.cjs.map +7 -0
  240. package/dist/pcd/bundled.d.ts +3 -0
  241. package/dist/pcd/bundled.d.ts.map +1 -0
  242. package/dist/pcd/bundled.js +5 -0
  243. package/dist/pcd/bundled.js.map +1 -0
  244. package/dist/pcd/index.cjs +37 -0
  245. package/dist/pcd/index.cjs.map +7 -0
  246. package/dist/pcd/index.d.ts +6 -0
  247. package/dist/pcd/index.d.ts.map +1 -0
  248. package/dist/pcd/index.js +7 -0
  249. package/dist/pcd/index.js.map +1 -0
  250. package/dist/pcd/lib/decompress-lzf.cjs +80 -0
  251. package/dist/pcd/lib/decompress-lzf.cjs.map +7 -0
  252. package/dist/pcd/lib/decompress-lzf.d.ts +7 -0
  253. package/dist/pcd/lib/decompress-lzf.d.ts.map +1 -0
  254. package/dist/pcd/lib/decompress-lzf.js +62 -0
  255. package/dist/pcd/lib/decompress-lzf.js.map +1 -0
  256. package/dist/pcd/lib/get-pcd-schema.cjs +70 -0
  257. package/dist/pcd/lib/get-pcd-schema.cjs.map +7 -0
  258. package/dist/pcd/lib/get-pcd-schema.d.ts +10 -0
  259. package/dist/pcd/lib/get-pcd-schema.d.ts.map +1 -0
  260. package/dist/pcd/lib/get-pcd-schema.js +53 -0
  261. package/dist/pcd/lib/get-pcd-schema.js.map +1 -0
  262. package/dist/pcd/lib/parse-pcd.cjs +354 -0
  263. package/dist/pcd/lib/parse-pcd.cjs.map +7 -0
  264. package/dist/pcd/lib/parse-pcd.d.ts +20 -0
  265. package/dist/pcd/lib/parse-pcd.d.ts.map +1 -0
  266. package/dist/pcd/lib/parse-pcd.js +341 -0
  267. package/dist/pcd/lib/parse-pcd.js.map +1 -0
  268. package/dist/pcd/lib/pcd-types.cjs +19 -0
  269. package/dist/pcd/lib/pcd-types.cjs.map +7 -0
  270. package/dist/pcd/lib/pcd-types.d.ts +31 -0
  271. package/dist/pcd/lib/pcd-types.d.ts.map +1 -0
  272. package/dist/pcd/lib/pcd-types.js +5 -0
  273. package/dist/pcd/lib/pcd-types.js.map +1 -0
  274. package/dist/pcd/pcd-format.cjs +42 -0
  275. package/dist/pcd/pcd-format.cjs.map +7 -0
  276. package/dist/pcd/pcd-format.d.ts +16 -0
  277. package/dist/pcd/pcd-format.d.ts.map +1 -0
  278. package/dist/pcd/pcd-format.js +19 -0
  279. package/dist/pcd/pcd-format.js.map +1 -0
  280. package/dist/pcd/pcd-loader-types.cjs +63 -0
  281. package/dist/pcd/pcd-loader-types.cjs.map +7 -0
  282. package/dist/pcd/pcd-loader-types.d.ts +82 -0
  283. package/dist/pcd/pcd-loader-types.d.ts.map +1 -0
  284. package/dist/pcd/pcd-loader-types.js +35 -0
  285. package/dist/pcd/pcd-loader-types.js.map +1 -0
  286. package/dist/pcd/pcd-loader.cjs +201 -0
  287. package/dist/pcd/pcd-loader.cjs.map +7 -0
  288. package/dist/pcd/pcd-loader.d.ts +80 -0
  289. package/dist/pcd/pcd-loader.d.ts.map +1 -0
  290. package/dist/pcd/pcd-loader.js +179 -0
  291. package/dist/pcd/pcd-loader.js.map +1 -0
  292. package/dist/pcd/pcd-writer.cjs +134 -0
  293. package/dist/pcd/pcd-writer.cjs.map +7 -0
  294. package/dist/pcd/pcd-writer.d.ts +38 -0
  295. package/dist/pcd/pcd-writer.d.ts.map +1 -0
  296. package/dist/pcd/pcd-writer.js +115 -0
  297. package/dist/pcd/pcd-writer.js.map +1 -0
  298. package/dist/pcd/unbundled.cjs +31 -0
  299. package/dist/pcd/unbundled.cjs.map +7 -0
  300. package/dist/pcd/unbundled.d.ts +3 -0
  301. package/dist/pcd/unbundled.d.ts.map +1 -0
  302. package/dist/pcd/unbundled.js +5 -0
  303. package/dist/pcd/unbundled.js.map +1 -0
  304. package/dist/pcd/workers/pcd-worker.cjs +23 -0
  305. package/dist/pcd/workers/pcd-worker.cjs.map +7 -0
  306. package/dist/pcd/workers/pcd-worker.d.ts +2 -0
  307. package/dist/pcd/workers/pcd-worker.d.ts.map +1 -0
  308. package/dist/pcd/workers/pcd-worker.js +23 -0
  309. package/dist/pcd/workers/pcd-worker.js.map +1 -0
  310. package/dist/pcd-loader-types.cjs +65 -0
  311. package/dist/pcd-loader-types.cjs.map +7 -0
  312. package/dist/pcd-loader-types.d.ts +2 -0
  313. package/dist/pcd-loader-types.d.ts.map +1 -0
  314. package/dist/pcd-loader-types.js +2 -0
  315. package/dist/pcd-loader-types.js.map +1 -0
  316. package/dist/pcd-loader.cjs +203 -0
  317. package/dist/pcd-loader.cjs.map +7 -0
  318. package/dist/pcd-loader.d.ts +2 -0
  319. package/dist/pcd-loader.d.ts.map +1 -0
  320. package/dist/pcd-loader.js +2 -0
  321. package/dist/pcd-loader.js.map +1 -0
  322. package/dist/pcd-worker.js +18561 -0
  323. package/dist/pcd-writer.cjs +136 -0
  324. package/dist/pcd-writer.cjs.map +7 -0
  325. package/dist/pcd-writer.d.ts +2 -0
  326. package/dist/pcd-writer.d.ts.map +1 -0
  327. package/dist/pcd-writer.js +2 -0
  328. package/dist/pcd-writer.js.map +1 -0
  329. package/dist/ply/bundled.cjs +31 -0
  330. package/dist/ply/bundled.cjs.map +7 -0
  331. package/dist/ply/bundled.d.ts +3 -0
  332. package/dist/ply/bundled.d.ts.map +1 -0
  333. package/dist/ply/bundled.js +5 -0
  334. package/dist/ply/bundled.js.map +1 -0
  335. package/dist/ply/index.cjs +37 -0
  336. package/dist/ply/index.cjs.map +7 -0
  337. package/dist/ply/index.d.ts +6 -0
  338. package/dist/ply/index.d.ts.map +1 -0
  339. package/dist/ply/index.js +8 -0
  340. package/dist/ply/index.js.map +1 -0
  341. package/dist/ply/lib/get-ply-schema.cjs +128 -0
  342. package/dist/ply/lib/get-ply-schema.cjs.map +7 -0
  343. package/dist/ply/lib/get-ply-schema.d.ts +16 -0
  344. package/dist/ply/lib/get-ply-schema.d.ts.map +1 -0
  345. package/dist/ply/lib/get-ply-schema.js +117 -0
  346. package/dist/ply/lib/get-ply-schema.js.map +1 -0
  347. package/dist/ply/lib/normalize-ply.cjs +96 -0
  348. package/dist/ply/lib/normalize-ply.cjs.map +7 -0
  349. package/dist/ply/lib/normalize-ply.d.ts +8 -0
  350. package/dist/ply/lib/normalize-ply.d.ts.map +1 -0
  351. package/dist/ply/lib/normalize-ply.js +89 -0
  352. package/dist/ply/lib/normalize-ply.js.map +1 -0
  353. package/dist/ply/lib/parse-ply-arrow.cjs +552 -0
  354. package/dist/ply/lib/parse-ply-arrow.cjs.map +7 -0
  355. package/dist/ply/lib/parse-ply-arrow.d.ts +25 -0
  356. package/dist/ply/lib/parse-ply-arrow.d.ts.map +1 -0
  357. package/dist/ply/lib/parse-ply-arrow.js +493 -0
  358. package/dist/ply/lib/parse-ply-arrow.js.map +1 -0
  359. package/dist/ply/lib/parse-ply-in-batches.cjs +613 -0
  360. package/dist/ply/lib/parse-ply-in-batches.cjs.map +7 -0
  361. package/dist/ply/lib/parse-ply-in-batches.d.ts +9 -0
  362. package/dist/ply/lib/parse-ply-in-batches.d.ts.map +1 -0
  363. package/dist/ply/lib/parse-ply-in-batches.js +630 -0
  364. package/dist/ply/lib/parse-ply-in-batches.js.map +1 -0
  365. package/dist/ply/lib/parse-ply.cjs +758 -0
  366. package/dist/ply/lib/parse-ply.cjs.map +7 -0
  367. package/dist/ply/lib/parse-ply.d.ts +69 -0
  368. package/dist/ply/lib/parse-ply.d.ts.map +1 -0
  369. package/dist/ply/lib/parse-ply.js +855 -0
  370. package/dist/ply/lib/parse-ply.js.map +1 -0
  371. package/dist/ply/lib/ply-types.cjs +19 -0
  372. package/dist/ply/lib/ply-types.cjs.map +7 -0
  373. package/dist/ply/lib/ply-types.d.ts +37 -0
  374. package/dist/ply/lib/ply-types.d.ts.map +1 -0
  375. package/dist/ply/lib/ply-types.js +2 -0
  376. package/dist/ply/lib/ply-types.js.map +1 -0
  377. package/dist/ply/ply-format.cjs +43 -0
  378. package/dist/ply/ply-format.cjs.map +7 -0
  379. package/dist/ply/ply-format.d.ts +18 -0
  380. package/dist/ply/ply-format.d.ts.map +1 -0
  381. package/dist/ply/ply-format.js +22 -0
  382. package/dist/ply/ply-format.js.map +1 -0
  383. package/dist/ply/ply-loader-types.cjs +64 -0
  384. package/dist/ply/ply-loader-types.cjs.map +7 -0
  385. package/dist/ply/ply-loader-types.d.ts +88 -0
  386. package/dist/ply/ply-loader-types.d.ts.map +1 -0
  387. package/dist/ply/ply-loader-types.js +38 -0
  388. package/dist/ply/ply-loader-types.js.map +1 -0
  389. package/dist/ply/ply-loader.cjs +192 -0
  390. package/dist/ply/ply-loader.cjs.map +7 -0
  391. package/dist/ply/ply-loader.d.ts +81 -0
  392. package/dist/ply/ply-loader.d.ts.map +1 -0
  393. package/dist/ply/ply-loader.js +173 -0
  394. package/dist/ply/ply-loader.js.map +1 -0
  395. package/dist/ply/ply-writer.cjs +175 -0
  396. package/dist/ply/ply-writer.cjs.map +7 -0
  397. package/dist/ply/ply-writer.d.ts +38 -0
  398. package/dist/ply/ply-writer.d.ts.map +1 -0
  399. package/dist/ply/ply-writer.js +140 -0
  400. package/dist/ply/ply-writer.js.map +1 -0
  401. package/dist/ply/unbundled.cjs +31 -0
  402. package/dist/ply/unbundled.cjs.map +7 -0
  403. package/dist/ply/unbundled.d.ts +3 -0
  404. package/dist/ply/unbundled.d.ts.map +1 -0
  405. package/dist/ply/unbundled.js +5 -0
  406. package/dist/ply/unbundled.js.map +1 -0
  407. package/dist/ply/workers/ply-worker.cjs +34 -0
  408. package/dist/ply/workers/ply-worker.cjs.map +7 -0
  409. package/dist/ply/workers/ply-worker.d.ts +2 -0
  410. package/dist/ply/workers/ply-worker.d.ts.map +1 -0
  411. package/dist/ply/workers/ply-worker.js +37 -0
  412. package/dist/ply/workers/ply-worker.js.map +1 -0
  413. package/dist/ply-loader-types.cjs +66 -0
  414. package/dist/ply-loader-types.cjs.map +7 -0
  415. package/dist/ply-loader-types.d.ts +2 -0
  416. package/dist/ply-loader-types.d.ts.map +1 -0
  417. package/dist/ply-loader-types.js +2 -0
  418. package/dist/ply-loader-types.js.map +1 -0
  419. package/dist/ply-loader.cjs +194 -0
  420. package/dist/ply-loader.cjs.map +7 -0
  421. package/dist/ply-loader.d.ts +2 -0
  422. package/dist/ply-loader.d.ts.map +1 -0
  423. package/dist/ply-loader.js +2 -0
  424. package/dist/ply-loader.js.map +1 -0
  425. package/dist/ply-worker.js +20962 -0
  426. package/dist/ply-writer.cjs +177 -0
  427. package/dist/ply-writer.cjs.map +7 -0
  428. package/dist/ply-writer.d.ts +2 -0
  429. package/dist/ply-writer.d.ts.map +1 -0
  430. package/dist/ply-writer.js +2 -0
  431. package/dist/ply-writer.js.map +1 -0
  432. package/package.json +238 -4
  433. package/src/index.ts +19 -0
  434. package/src/las/bundled.ts +38 -0
  435. package/src/las/index.ts +66 -0
  436. package/src/las/las-copc-loader-types.ts +18 -0
  437. package/src/las/las-copc-loader.ts +61 -0
  438. package/src/las/las-format.ts +21 -0
  439. package/src/las/las-loader-shared.ts +126 -0
  440. package/src/las/las-loader-types.ts +24 -0
  441. package/src/las/las-loader.ts +163 -0
  442. package/src/las/las-writer.ts +1477 -0
  443. package/src/las/laz-rs-loader-types.ts +21 -0
  444. package/src/las/laz-rs-loader.ts +53 -0
  445. package/src/las/lazperf-loader-types.ts +22 -0
  446. package/src/las/lazperf-loader.ts +65 -0
  447. package/src/las/lib/LASZIP-LICENSE +202 -0
  448. package/src/las/lib/LASZIP-NOTICE +4 -0
  449. package/src/las/lib/copc/parse-las.ts +265 -0
  450. package/src/las/lib/get-las-schema.ts +55 -0
  451. package/src/las/lib/las-compatibility.ts +178 -0
  452. package/src/las/lib/las-extra-bytes.ts +276 -0
  453. package/src/las/lib/las-types.ts +206 -0
  454. package/src/las/lib/las-waveform.ts +292 -0
  455. package/src/las/lib/laz-perf/laslaz-decoder.ts +443 -0
  456. package/src/las/lib/laz-perf/parse-las.ts +411 -0
  457. package/src/las/lib/laz-rs-wasm/laslaz-decoder.ts +488 -0
  458. package/src/las/lib/laz-rs-wasm/parse-las.ts +411 -0
  459. package/src/las/lib/typescript/parse-las.ts +3862 -0
  460. package/src/las/libs/laz-perf/laz-perf.ts +20615 -0
  461. package/src/las/libs/laz-rs-wasm/README.md +5 -0
  462. package/src/las/libs/laz-rs-wasm/laz_rs_wasm.d.ts +89 -0
  463. package/src/las/libs/laz-rs-wasm/laz_rs_wasm.js +497 -0
  464. package/src/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm +0 -0
  465. package/src/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm.d.ts +38 -0
  466. package/src/las/libs/laz-rs-wasm/package.json +25 -0
  467. package/src/las/unbundled.ts +38 -0
  468. package/src/las/workers/las-worker.ts +24 -0
  469. package/src/las-copc-loader-types.ts +1 -0
  470. package/src/las-copc-loader.ts +1 -0
  471. package/src/las-loader-types.ts +1 -0
  472. package/src/las-loader.ts +1 -0
  473. package/src/las-writer.ts +1 -0
  474. package/src/laz-rs-loader-types.ts +1 -0
  475. package/src/laz-rs-loader.ts +1 -0
  476. package/src/lazperf-loader-types.ts +1 -0
  477. package/src/lazperf-loader.ts +1 -0
  478. package/src/pcd/bundled.ts +6 -0
  479. package/src/pcd/index.ts +9 -0
  480. package/src/pcd/lib/decompress-lzf.ts +68 -0
  481. package/src/pcd/lib/get-pcd-schema.ts +66 -0
  482. package/src/pcd/lib/parse-pcd.ts +474 -0
  483. package/src/pcd/lib/pcd-types.ts +34 -0
  484. package/src/pcd/pcd-format.ts +21 -0
  485. package/src/pcd/pcd-loader-types.ts +52 -0
  486. package/src/pcd/pcd-loader.ts +247 -0
  487. package/src/pcd/pcd-writer.ts +156 -0
  488. package/src/pcd/unbundled.ts +6 -0
  489. package/src/pcd/workers/pcd-worker.ts +24 -0
  490. package/src/pcd-loader-types.ts +1 -0
  491. package/src/pcd-loader.ts +1 -0
  492. package/src/pcd-writer.ts +1 -0
  493. package/src/ply/bundled.ts +6 -0
  494. package/src/ply/index.ts +11 -0
  495. package/src/ply/lib/get-ply-schema.ts +133 -0
  496. package/src/ply/lib/normalize-ply.ts +110 -0
  497. package/src/ply/lib/parse-ply-arrow.ts +676 -0
  498. package/src/ply/lib/parse-ply-in-batches.ts +832 -0
  499. package/src/ply/lib/parse-ply.ts +1084 -0
  500. package/src/ply/lib/ply-types.ts +47 -0
  501. package/src/ply/ply-format.ts +24 -0
  502. package/src/ply/ply-loader-types.ts +60 -0
  503. package/src/ply/ply-loader.ts +255 -0
  504. package/src/ply/ply-writer.ts +219 -0
  505. package/src/ply/unbundled.ts +6 -0
  506. package/src/ply/workers/ply-worker.ts +40 -0
  507. package/src/ply-loader-types.ts +1 -0
  508. package/src/ply-loader.ts +1 -0
  509. package/src/ply-writer.ts +1 -0
  510. package/third-party-licenses/plasio-LICENSE +21 -0
  511. package/third-party-licenses/three-LICENSE +21 -0
@@ -0,0 +1,54 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if (typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if (typeof define === 'function' && define.amd) define([], factory);
5
+ else if (typeof exports === 'object') exports['loaders'] = factory();
6
+ else root['loaders'] = factory();})(globalThis, function () {
7
+ "use strict";var __exports__=(()=>{var Vf=Object.defineProperty;var pA=Object.getOwnPropertyDescriptor;var mA=Object.getOwnPropertyNames;var yA=Object.prototype.hasOwnProperty;var d=(r,t,e)=>()=>{if(e)throw e[0];try{return r&&(t=r(r=0)),t}catch(n){throw e=[n],n}};var ze=(r,t)=>{for(var e in t)Vf(r,e,{get:t[e],enumerable:!0})},gA=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of mA(t))!yA.call(r,s)&&s!==e&&Vf(r,s,{get:()=>t[s],enumerable:!(n=pA(t,s))||n.enumerable});return r};var bA=r=>gA(Vf({},"__esModule",{value:!0}),r);var _T,LT,TT,MT,vy=d(()=>{_T=Math.PI/2,LT=Math.PI/4,TT=Math.PI/6,MT=Math.PI*2});var Sy=d(()=>{});var By=d(()=>{});var Iy=d(()=>{});var _y=d(()=>{});var Ly=d(()=>{});var Ty=d(()=>{});function Gc(){return bo??Uint16Array}var bo,My=d(()=>{bo=globalThis.Float16Array});var Dy=d(()=>{My()});var Cy=d(()=>{Dy()});var Fy=d(()=>{Iy()});var Ey=d(()=>{_y()});var Oy=d(()=>{Ty()});var Ny=d(()=>{Sy()});var Uy=d(()=>{By()});var Ry=d(()=>{Ly()});var Py=d(()=>{vy();Cy();Fy();Ey();Oy();Ny();Uy();Ry()});function jc(r){let t=Gc();return new t(r)}function Yn(r){return!!(bo&&r instanceof bo)}function $c(r,t,e){Yn(r)?r[t]=e:r[t]=ky(e)}function Gf(r,t){return Yn(r)?r[t]:TA(r[t])}function wa(r){return Yn(r)?new Uint16Array(r.buffer,r.byteOffset,r.length):r}function fi(r,t){let e=jc(r.length);for(let n=0;n<r.length;n++)$c(e,n,r[n]/t);return e}function xa(r,t){return Float32Array.from(r,e=>e/t)}function ky(r){if(!Number.isFinite(r))return r===1/0?31744:r===-1/0?64512:32256;let t=r<0||Object.is(r,-0)?32768:0,e=Math.abs(r);if(e===0)return t;if(e>=65520)return t|31744;if(e>=65504)return t|31743;let n=Math.floor(Math.log2(e));if(n<-14)return t|Math.round(e/2**-24);let s=n+15,i=Math.round((e/2**n-1)*1024);return i===1024?t|s+1<<10:t|s<<10|i}function TA(r){let t=r&32768?-1:1,e=r>>10&31,n=r&1023;return e===0?t*n*2**-24:e===31?n?NaN:t*(1/0):t*(1+n/1024)*2**(e-15)}var zy=d(()=>{"use strict";Py()});function Gy(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(e[n[s]]=r[n[s]]);return e}function _(r,t,e,n){function s(i){return i instanceof e?i:new e(function(o){o(i)})}return new(e||(e=Promise))(function(i,o){function a(u){try{l(n.next(u))}catch(f){o(f)}}function c(u){try{l(n.throw(u))}catch(f){o(f)}}function l(u){u.done?i(u.value):s(u.value).then(a,c)}l((n=n.apply(r,t||[])).next())})}function Vy(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(r){return this instanceof Y?(this.v=r,this):new Y(r)}function Ae(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(p){return function(y){return Promise.resolve(y).then(p,f)}}function a(p,y){n[p]&&(s[p]=function(g){return new Promise(function(w,S){i.push([p,g,w,S])>1||c(p,g)})},y&&(s[p]=y(s[p])))}function c(p,y){try{l(n[p](y))}catch(g){h(i[0][3],g)}}function l(p){p.value instanceof Y?Promise.resolve(p.value.v).then(u,f):h(i[0][2],p)}function u(p){c("next",p)}function f(p){c("throw",p)}function h(p,y){p(y),i.shift(),i.length&&c(i[0][0],i[0][1])}}function wo(r){var t,e;return t={},n("next"),n("throw",function(s){throw s}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(s,i){t[s]=r[s]?function(o){return(e=!e)?{value:Y(r[s](o)),done:!1}:i?i(o):o}:i}}function Je(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Vy=="function"?Vy(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(i){e[i]=r[i]&&function(o){return new Promise(function(a,c){o=r[i](o),s(a,c,o.done,o.value)})}}function s(i,o,a,c){Promise.resolve(c).then(function(l){i({value:l,done:a})},o)}}var Ve=d(()=>{});var jy,xo,MA,Qe,yn=d(()=>{jy=new TextDecoder("utf-8"),xo=jy.decode.bind(jy),MA=new TextEncoder,Qe=r=>MA.encode(r)});var DA,$y,Vt,ve,tr,Tr,dr,qc,Wc,Yc,Zc,Hc,qy,Aa,Wy,Xc,Yy,Zn=d(()=>{DA=r=>typeof r=="number",$y=r=>typeof r=="boolean",Vt=r=>typeof r=="function",ve=r=>r!=null&&Object(r)===r,tr=r=>ve(r)&&Vt(r.then),Tr=r=>ve(r)&&Vt(r[Symbol.iterator]),dr=r=>ve(r)&&Vt(r[Symbol.asyncIterator]),qc=r=>ve(r)&&ve(r.schema),Wc=r=>ve(r)&&"done"in r&&"value"in r,Yc=r=>ve(r)&&Vt(r.stat)&&DA(r.fd),Zc=r=>ve(r)&&Aa(r.body),Hc=r=>"_getDOMStream"in r&&"_getNodeStream"in r,qy=r=>ve(r)&&Vt(r.abort)&&Vt(r.getWriter)&&!Hc(r),Aa=r=>ve(r)&&Vt(r.cancel)&&Vt(r.getReader)&&!Hc(r),Wy=r=>ve(r)&&Vt(r.end)&&Vt(r.write)&&$y(r.writable)&&!Hc(r),Xc=r=>ve(r)&&Vt(r.read)&&Vt(r.pipe)&&$y(r.readable)&&!Hc(r),Yy=r=>ve(r)&&Vt(r.clear)&&Vt(r.bytes)&&Vt(r.position)&&Vt(r.setPosition)&&Vt(r.capacity)&&Vt(r.getBufferIdentifier)&&Vt(r.createLong)});var Zf={};ze(Zf,{compareArrayLike:()=>Yf,joinUint8Arrays:()=>er,memcpy:()=>va,rebaseValueOffsets:()=>Kc,toArrayBufferView:()=>J,toArrayBufferViewAsyncIterator:()=>Mr,toArrayBufferViewIterator:()=>Kr,toBigInt64Array:()=>Sa,toBigUint64Array:()=>UA,toFloat32Array:()=>RA,toFloat32ArrayAsyncIterator:()=>QA,toFloat32ArrayIterator:()=>qA,toFloat64Array:()=>PA,toFloat64ArrayAsyncIterator:()=>tv,toFloat64ArrayIterator:()=>WA,toInt16Array:()=>EA,toInt16ArrayAsyncIterator:()=>HA,toInt16ArrayIterator:()=>VA,toInt32Array:()=>hi,toInt32ArrayAsyncIterator:()=>XA,toInt32ArrayIterator:()=>GA,toInt8Array:()=>FA,toInt8ArrayAsyncIterator:()=>ZA,toInt8ArrayIterator:()=>zA,toUint16Array:()=>OA,toUint16ArrayAsyncIterator:()=>KA,toUint16ArrayIterator:()=>jA,toUint32Array:()=>NA,toUint32ArrayAsyncIterator:()=>JA,toUint32ArrayIterator:()=>$A,toUint8Array:()=>O,toUint8ArrayAsyncIterator:()=>Wf,toUint8ArrayIterator:()=>qf,toUint8ClampedArray:()=>kA,toUint8ClampedArrayAsyncIterator:()=>ev,toUint8ClampedArrayIterator:()=>YA});function CA(r){let t=r[0]?[r[0]]:[],e,n,s,i;for(let o,a,c=0,l=0,u=r.length;++c<u;){if(o=t[l],a=r[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:s}=o,{byteOffset:n,byteLength:i}=a,e+s<n||n+i<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,e,n-e+i)}return t}function va(r,t,e=0,n=t.byteLength){let s=r.byteLength,i=new Uint8Array(r.buffer,r.byteOffset,s),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,s));return i.set(o,e),r}function er(r,t){let e=CA(r),n=e.reduce((u,f)=>u+f.byteLength,0),s,i,o,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=e.length;++c<u;){if(s=e[c],i=s.subarray(0,Math.min(s.length,l-a)),l<=a+i.length){i.length<s.length?e[c]=s.subarray(i.length):i.length===s.length&&c++,o?va(o,i,a):o=i;break}va(o||(o=new Uint8Array(l)),i,a),a+=i.length}return[o||new Uint8Array(0),e.slice(c),n-(o?o.byteLength:0)]}function J(r,t){let e=Wc(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Qe(e)),e instanceof ArrayBuffer?new r(e):e instanceof $f?new r(e):Yy(e)?J(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}function*Kr(r,t){let e=function*(s){yield s},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof $f?e(t):Tr(t)?t:e(t);return yield*jf((function*(s){let i=null;do i=s.next(yield J(r,i));while(!i.done)})(n[Symbol.iterator]())),new r}function Mr(r,t){return Ae(this,arguments,function*(){if(tr(t))return yield Y(yield Y(yield*wo(Je(Mr(r,yield Y(t))))));let n=function(o){return Ae(this,arguments,function*(){yield yield Y(yield Y(o))})},s=function(o){return Ae(this,arguments,function*(){yield Y(yield*wo(Je(jf((function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)})(o[Symbol.iterator]())))))})},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof $f?n(t):Tr(t)?s(t):dr(t)?t:n(t);return yield Y(yield*wo(Je(jf((function(o){return Ae(this,arguments,function*(){let a=null;do a=yield Y(o.next(yield yield Y(J(r,a))));while(!a.done)})})(i[Symbol.asyncIterator]()))))),yield Y(new r)})}function Kc(r,t,e){if(r!==0){e=e.slice(0,t);let n=typeof e[0]=="bigint"?BigInt(r):r;for(let s=-1,i=e.length;++s<i;)e[s]+=n}return e.subarray(0,t)}function Yf(r,t){let e=0,n=r.length;if(n!==t.length)return!1;if(n>0)do if(r[e]!==t[e])return!1;while(++e<n);return!0}var $f,FA,EA,hi,Sa,O,OA,NA,UA,RA,PA,kA,jf,zA,VA,GA,qf,jA,$A,qA,WA,YA,ZA,HA,XA,Wf,KA,JA,QA,tv,ev,Gt=d(()=>{Ve();yn();Zn();$f=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;FA=r=>J(Int8Array,r),EA=r=>J(Int16Array,r),hi=r=>J(Int32Array,r),Sa=r=>J(BigInt64Array,r),O=r=>J(Uint8Array,r),OA=r=>J(Uint16Array,r),NA=r=>J(Uint32Array,r),UA=r=>J(BigUint64Array,r),RA=r=>J(Float32Array,r),PA=r=>J(Float64Array,r),kA=r=>J(Uint8ClampedArray,r),jf=r=>(r.next(),r);zA=r=>Kr(Int8Array,r),VA=r=>Kr(Int16Array,r),GA=r=>Kr(Int32Array,r),qf=r=>Kr(Uint8Array,r),jA=r=>Kr(Uint16Array,r),$A=r=>Kr(Uint32Array,r),qA=r=>Kr(Float32Array,r),WA=r=>Kr(Float64Array,r),YA=r=>Kr(Uint8ClampedArray,r);ZA=r=>Mr(Int8Array,r),HA=r=>Mr(Int16Array,r),XA=r=>Mr(Int32Array,r),Wf=r=>Mr(Uint8Array,r),KA=r=>Mr(Uint16Array,r),JA=r=>Mr(Uint32Array,r),QA=r=>Mr(Float32Array,r),tv=r=>Mr(Float64Array,r),ev=r=>Mr(Uint8ClampedArray,r)});function*rv(r){let t,e=!1,n=[],s,i,o,a=0;function c(){return i==="peek"?er(n,o)[0]:([s,n,a]=er(n,o),s)}({cmd:i,size:o}=(yield null)||{cmd:"read",size:0});let l=qf(r)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&s.byteLength>0&&(n.push(s),a+=s.byteLength),t||o<=a)do({cmd:i,size:o}=yield c());while(o<a);while(!t)}catch(u){e=!0,typeof l.throw=="function"&&l.throw(u)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function nv(r){return Ae(this,arguments,function*(){let e,n=!1,s=[],i,o,a,c=0;function l(){return o==="peek"?er(s,a)[0]:([i,s,c]=er(s,a),i)}({cmd:o,size:a}=(yield yield Y(null))||{cmd:"read",size:0});let u=Wf(r)[Symbol.asyncIterator]();try{do if({done:e,value:i}=Number.isNaN(a-c)?yield Y(u.next()):yield Y(u.next(a-c)),!e&&i.byteLength>0&&(s.push(i),c+=i.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield Y(l()));while(a<c);while(!e)}catch(f){n=!0,typeof u.throw=="function"&&(yield Y(u.throw(f)))}finally{n===!1&&typeof u.return=="function"&&(yield Y(u.return(new Uint8Array(0))))}return yield Y(null)})}function sv(r){return Ae(this,arguments,function*(){let e=!1,n=!1,s=[],i,o,a,c=0;function l(){return o==="peek"?er(s,a)[0]:([i,s,c]=er(s,a),i)}({cmd:o,size:a}=(yield yield Y(null))||{cmd:"read",size:0});let u=new Xf(r);try{do if({done:e,value:i}=Number.isNaN(a-c)?yield Y(u.read()):yield Y(u.read(a-c)),!e&&i.byteLength>0&&(s.push(O(i)),c+=i.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield Y(l()));while(a<c);while(!e)}catch(f){n=!0,yield Y(u.cancel(f))}finally{n===!1?yield Y(u.cancel()):r.locked&&u.releaseLock()}return yield Y(null)})}function iv(r){return Ae(this,arguments,function*(){let e=[],n="error",s=!1,i=null,o,a,c=0,l=[],u;function f(){return o==="peek"?er(l,a)[0]:([u,l,c]=er(l,a),u)}if({cmd:o,size:a}=(yield yield Y(null))||{cmd:"read",size:0},r.isTTY)return yield yield Y(new Uint8Array(0)),yield Y(null);try{e[0]=Hf(r,"end"),e[1]=Hf(r,"error");do{if(e[2]=Hf(r,"readable"),[n,i]=yield Y(Promise.race(e.map(p=>p[2]))),n==="error")break;if((s=n==="end")||(Number.isFinite(a-c)?(u=O(r.read(a-c)),u.byteLength<a-c&&(u=O(r.read()))):u=O(r.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),s||a<=c)do({cmd:o,size:a}=yield yield Y(f()));while(a<c)}while(!s)}finally{yield Y(h(e,n==="error"?i:null))}return yield Y(null);function h(p,y){return u=l=null,new Promise((g,w)=>{for(let[S,E]of p)r.off(S,E);try{let S=r.destroy;S&&S.call(r,y),y=void 0}catch(S){y=S||y}finally{y!=null?w(y):g()}})}})}var Zt,Jc,Xf,Hf,Ba=d(()=>{Ve();Gt();Zt={fromIterable(r){return Jc(rv(r))},fromAsyncIterable(r){return Jc(nv(r))},fromDOMStream(r){return Jc(sv(r))},fromNodeStream(r){return Jc(iv(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},Jc=r=>(r.next(),r);Xf=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return _(this,void 0,void 0,function*(){let{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return _(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=O(e)),e})}},Hf=(r,t)=>{let e=s=>n([t,s]),n;return[t,e,new Promise(s=>(n=s)&&r.once(t,e))]}});var ht,Qc=d(()=>{(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(ht||(ht={}))});var ut,Kf=d(()=>{(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(ut||(ut={}))});var ct,Jf=d(()=>{(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(ct||(ct={}))});var mt,Qf=d(()=>{(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(mt||(mt={}))});var A,Ia=d(()=>{(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(A||(A={}))});var nt,th=d(()=>{(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(nt||(nt={}))});var tl=d(()=>{});var Jr,el,rl,Ao,eh=d(()=>{Jr=new Int32Array(2),el=new Float32Array(Jr.buffer),rl=new Float64Array(Jr.buffer),Ao=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var _a,rh=d(()=>{(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(_a||(_a={}))});var Ht,nh=d(()=>{tl();rh();eh();Ht=class r{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new r(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Jr[0]=this.readInt32(t),el[0]}readFloat64(t){return Jr[Ao?0:1]=this.readInt32(t),Jr[Ao?1:0]=this.readInt32(t+4),rl[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){el[0]=e,this.writeInt32(t,Jr[0])}writeFloat64(t,e){rl[0]=e,this.writeInt32(t,Jr[Ao?0:1]),this.writeInt32(t+4,Jr[Ao?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let s=this.bytes_.subarray(t,t+n);return e===_a.UTF8_BYTES?s:this.text_decoder_.decode(s)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let s=0;s<e;++s){let i=t(s);i!==null&&n.push(i)}return n}createObjList(t,e){let n=[];for(let s=0;s<e;++s){let i=t(s);i!==null&&n.push(i.unpack())}return n}}});var di,Zy=d(()=>{nh();tl();di=class r{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=Ht.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){let s=this.bb.capacity();this.bb=r.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||e!==n)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=e<<1,s=Ht.allocate(n);return s.setPosition(n-e),s.bytes().set(t.bytes(),n-e),s}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let s=2;this.addInt16(t-this.object_start);let i=(n+s)*2;this.addInt16(i);let o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(c)){for(let l=2;l<i;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let s=n?4:0;if(e){let i=e;if(this.prep(this.minalign,8+s),i.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=3;o>=0;o--)this.writeInt8(i.charCodeAt(o))}this.prep(this.minalign,4+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,s=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(s)&&this.bb.readInt16(s+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let s=t[n];if(s!==null)e.push(this.createObjectOffset(s));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}}});var it=d(()=>{tl();eh();Zy();nh();rh()});var pi,sh=d(()=>{(function(r){r[r.BUFFER=0]="BUFFER"})(pi||(pi={}))});var Xt,vo=d(()=>{(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Xt||(Xt={}))});var gn,ih=d(()=>{it();sh();vo();gn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Xt.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):pi.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Xt.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,pi.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return r.startBodyCompression(t),r.addCodec(t,e),r.addMethod(t,n),r.endBodyCompression(t)}}});var So,oh=d(()=>{So=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}}});var Bo,ah=d(()=>{Bo=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}}});var oe,ch=d(()=>{it();ih();oh();ah();oe=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Bo).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new So).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new gn).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}variadicBufferCounts(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}variadicBufferCountsLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startRecordBatch(t){t.startObject(5)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static addVariadicBufferCounts(t,e){t.addFieldOffset(4,e,0)}static createVariadicBufferCountsVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startVariadicBufferCountsVector(t,e){t.startVector(8,e,8)}static endRecordBatch(t){return t.endObject()}}});var bn,Hy=d(()=>{it();ch();bn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new oe).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}}});var Hn,lh=d(()=>{(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Hn||(Hn={}))});var La,Xy=d(()=>{(function(r){r[r.DenseArray=0]="DenseArray"})(La||(La={}))});var Cr,sl=d(()=>{it();Cr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return r.startInt(t),r.addBitWidth(t,e),r.addIsSigned(t,n),r.endInt(t)}}});var Qr,uh=d(()=>{it();Xy();sl();Qr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Cr).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):La.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,La.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}});var Tt,Io=d(()=>{it();Tt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return r.startKeyValue(t),r.addKey(t,e),r.addValue(t,n),r.endKeyValue(t)}}});var Ta,Ky=d(()=>{it();Ta=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return r.startBinary(t),r.endBinary(t)}}});var Ma,Jy=d(()=>{it();Ma=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinaryView(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinaryView(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBinaryView(t){t.startObject(0)}static endBinaryView(t){return t.endObject()}static createBinaryView(t){return r.startBinaryView(t),r.endBinaryView(t)}}});var Da,Qy=d(()=>{it();Da=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return r.startBool(t),r.endBool(t)}}});var Xn,fh=d(()=>{it();Qf();Xn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):mt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,mt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}}});var tn,hh=d(()=>{it();tn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,s){return r.startDecimal(t),r.addPrecision(t,e),r.addScale(t,n),r.addBitWidth(t,s),r.endDecimal(t)}}});var Kn,dh=d(()=>{it();Ia();Kn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):A.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,A.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return r.startDuration(t),r.addUnit(t,e),r.endDuration(t)}}});var Jn,ph=d(()=>{it();Jn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return r.startFixedSizeBinary(t),r.addByteWidth(t,e),r.endFixedSizeBinary(t)}}});var Qn,mh=d(()=>{it();Qn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return r.startFixedSizeList(t),r.addListSize(t,e),r.endFixedSizeList(t)}}});var ts,yh=d(()=>{it();Jf();ts=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,ct.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}}});var es,gh=d(()=>{it();th();es=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):nt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,nt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}}});var Ca,tg=d(()=>{it();Ca=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return r.startLargeBinary(t),r.endLargeBinary(t)}}});var Fa,eg=d(()=>{it();Fa=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeList(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(t){t.startObject(0)}static endLargeList(t){return t.endObject()}static createLargeList(t){return r.startLargeList(t),r.endLargeList(t)}}});var Ea,rg=d(()=>{it();Ea=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return r.startLargeUtf8(t),r.endLargeUtf8(t)}}});var Oa,ng=d(()=>{it();Oa=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return r.startList(t),r.endList(t)}}});var rs,bh=d(()=>{it();rs=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return r.startMap(t),r.addKeysSorted(t,e),r.endMap(t)}}});var Na,sg=d(()=>{it();Na=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return r.startNull(t),r.endNull(t)}}});var Ua,ig=d(()=>{it();Ua=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return r.startStruct_(t),r.endStruct_(t)}}});var wn,wh=d(()=>{it();Ia();wn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):A.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,A.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return r.startTime(t),r.addUnit(t,e),r.addBitWidth(t,n),r.endTime(t)}}});var xn,xh=d(()=>{it();Ia();xn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):A.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,A.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return r.startTimestamp(t),r.addUnit(t,e),r.addTimezone(t,n),r.endTimestamp(t)}}});var Fr,Ah=d(()=>{it();Kf();Fr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ut.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,ut.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return r.startUnion(t),r.addMode(t,e),r.addTypeIds(t,n),r.endUnion(t)}}});var Ra,og=d(()=>{it();Ra=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return r.startUtf8(t),r.endUtf8(t)}}});var Pa,ag=d(()=>{it();Pa=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8View(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8View(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8View(t){t.startObject(0)}static endUtf8View(t){return t.endObject()}static createUtf8View(t){return r.startUtf8View(t),r.endUtf8View(t)}}});var V,il=d(()=>{(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded",r[r.BinaryView=23]="BinaryView",r[r.Utf8View=24]="Utf8View",r[r.ListView=25]="ListView",r[r.LargeListView=26]="LargeListView"})(V||(V={}))});var ae,vh=d(()=>{it();uh();Io();il();ae=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):V.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new Qr).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new r).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new Tt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,V.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}}});var Ge,Sh=d(()=>{it();lh();vh();Io();Ge=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Hn.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new ae).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Tt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,Hn.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static createSchema(t,e,n,s,i){return r.startSchema(t),r.addEndianness(t,e),r.addFields(t,n),r.addCustomMetadata(t,s),r.addFeatures(t,i),r.endSchema(t)}}});var et,ol=d(()=>{(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(et||(et={}))});var m,Z,Mt=d(()=>{Qc();Kf();Jf();Qf();Ia();th();ol();(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.BinaryView=23]="BinaryView",r[r.Utf8View=24]="Utf8View",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond",r[r.IntervalMonthDayNano=-31]="IntervalMonthDayNano"})(m||(m={}));(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Z||(Z={}))});var Bh={};ze(Bh,{valueToString:()=>Er});function Er(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>Er(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var ka=d(()=>{});function Q(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Ih(r,t){return Q(r/t)+Q(r%t)/Q(t)}var en=d(()=>{});var Th={};ze(Th,{BN:()=>mi,bigNumToBigInt:()=>lg,bigNumToNumber:()=>Lh,bigNumToString:()=>To,isArrowBigNumSymbol:()=>cg});function Or(r,...t){return t.length===0?Object.setPrototypeOf(J(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}function _o(...r){return Or.apply(this,r)}function Lo(...r){return Or.apply(this,r)}function za(...r){return Or.apply(this,r)}function Lh(r,t){let{buffer:e,byteOffset:n,byteLength:s,signed:i}=r,o=new BigUint64Array(e,n,s/8),a=i&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let u of o)c|=(u^av)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let u of o)c|=u*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"&&t>0){let u=BigInt("1".padEnd(t+1,"0")),f=c/u,h=a?-(c%u):c%u,p=Q(f),y=`${h}`.padStart(t,"0");return+`${a&&p===0?"-":""}${p}.${y}`}return Q(c)}function To(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return _h(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return _h(r);t=t.slice();let n=1;for(let i=0;i<t.length;i++){let o=t[i],a=~o+n;t[i]=a,n&=o===0?1:0}return`-${_h(t)}`}function lg(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:To(r)}function _h(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),s=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),i=-1,o=n.length-1;do{for(e[0]=n[i=0];i<o;)n[i++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[i];n[i]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(s[0]||s[1]||s[2]||s[3]);return t??"0"}var cg,ov,av,mi,al=d(()=>{Gt();en();cg=Symbol.for("isArrowBigNum");Or.prototype[cg]=!0;Or.prototype.toJSON=function(){return`"${To(this)}"`};Or.prototype.valueOf=function(r){return Lh(this,r)};Or.prototype.toString=function(){return To(this)};Or.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Lh(this);case"string":return To(this);case"default":return lg(this)}return To(this)};Object.setPrototypeOf(_o.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Lo.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(za.prototype,Object.create(Uint32Array.prototype));Object.assign(_o.prototype,Or.prototype,{constructor:_o,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Lo.prototype,Or.prototype,{constructor:Lo,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(za.prototype,Or.prototype,{constructor:za,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});ov=BigInt(4294967296)*BigInt(4294967296),av=ov-BigInt(1);mi=class r{static new(t,e){switch(e){case!0:return new _o(t);case!1:return new Lo(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new _o(t)}return t.byteLength===16?new za(t):new Lo(t)}static signed(t){return new _o(t)}static unsigned(t){return new Lo(t)}static decimal(t){return new za(t)}constructor(t,e){return r.new(t,e)}}});function sr(r){let t=r;switch(r.typeId){case m.Decimal:return r.bitWidth/32;case m.Interval:return t.unit===nt.MONTH_DAY_NANO?4:1+t.unit;case m.BinaryView:case m.Utf8View:return 16;case m.FixedSizeList:return t.listSize;case m.FixedSizeBinary:return t.byteWidth;default:return 1}}var ug,fg,hg,dg,pg,mg,yg,gg,bg,wg,xg,Ag,vg,Sg,Bg,Ig,_g,Lg,Tg,Mg,Dg,Cg,Fg,Eg,Og,Ng,x,Ot,Lt,Se,Be,Dt,rr,Ie,_e,qt,Nr,ce,Ur,Kt,Le,je,H,Rr,le,Te,Pr,ue,$e,Me,ns,ss,Jt,is,os,as,cs,Qt,ls,rn,us,fs,fe,hs,ds,Va,De,Ga,ja,$a,qa,Ct,nr,ot,Ce,An,ps,qe,gt,he,cv,Rt,yt=d(()=>{en();Mt();Ng=Symbol.for("apache-arrow/DataType"),x=class r{static isDataType(t){return t?.[Ng]===!0}static isNull(t){return t?.typeId===m.Null}static isInt(t){return t?.typeId===m.Int}static isFloat(t){return t?.typeId===m.Float}static isBinary(t){return t?.typeId===m.Binary}static isBinaryView(t){return t?.typeId===m.BinaryView}static isLargeBinary(t){return t?.typeId===m.LargeBinary}static isUtf8(t){return t?.typeId===m.Utf8}static isUtf8View(t){return t?.typeId===m.Utf8View}static isLargeUtf8(t){return t?.typeId===m.LargeUtf8}static isBool(t){return t?.typeId===m.Bool}static isDecimal(t){return t?.typeId===m.Decimal}static isDate(t){return t?.typeId===m.Date}static isTime(t){return t?.typeId===m.Time}static isTimestamp(t){return t?.typeId===m.Timestamp}static isInterval(t){return t?.typeId===m.Interval}static isDuration(t){return t?.typeId===m.Duration}static isList(t){return t?.typeId===m.List}static isLargeList(t){return t?.typeId===m.LargeList}static isStruct(t){return t?.typeId===m.Struct}static isUnion(t){return t?.typeId===m.Union}static isFixedSizeBinary(t){return t?.typeId===m.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===m.FixedSizeList}static isMap(t){return t?.typeId===m.Map}static isDictionary(t){return t?.typeId===m.Dictionary}static isDenseUnion(t){return r.isUnion(t)&&t.mode===ut.Dense}static isSparseUnion(t){return r.isUnion(t)&&t.mode===ut.Sparse}constructor(t){this.typeId=t}};ug=Symbol.toStringTag;x[ug]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Ng]=!0,r[Symbol.toStringTag]="DataType"))(x.prototype);Ot=class extends x{constructor(){super(m.Null)}toString(){return"Null"}};fg=Symbol.toStringTag;Ot[fg]=(r=>r[Symbol.toStringTag]="Null")(Ot.prototype);Lt=class extends x{constructor(t,e){super(m.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};hg=Symbol.toStringTag;Lt[hg]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Lt.prototype);Se=class extends Lt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Be=class extends Lt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Dt=class extends Lt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},rr=class extends Lt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Ie=class extends Lt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},_e=class extends Lt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},qt=class extends Lt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Nr=class extends Lt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Se.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Be.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Dt.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(rr.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Ie.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(_e.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(qt.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Nr.prototype,"ArrayType",{value:BigUint64Array});ce=class extends x{constructor(t){super(m.Float),this.precision=t}get ArrayType(){switch(this.precision){case ct.HALF:return Uint16Array;case ct.SINGLE:return Float32Array;case ct.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};dg=Symbol.toStringTag;ce[dg]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(ce.prototype);Ur=class extends ce{constructor(){super(ct.HALF)}},Kt=class extends ce{constructor(){super(ct.SINGLE)}},Le=class extends ce{constructor(){super(ct.DOUBLE)}};Object.defineProperty(Ur.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Kt.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Le.prototype,"ArrayType",{value:Float64Array});je=class extends x{constructor(){super(m.Binary)}toString(){return"Binary"}};pg=Symbol.toStringTag;je[pg]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(je.prototype);H=class extends x{constructor(){super(m.BinaryView)}toString(){return"BinaryView"}};mg=Symbol.toStringTag;H.ELEMENT_WIDTH=16;H.INLINE_CAPACITY=12;H.LENGTH_OFFSET=0;H.INLINE_OFFSET=4;H.BUFFER_INDEX_OFFSET=8;H.BUFFER_OFFSET_OFFSET=12;H[mg]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="BinaryView"))(H.prototype);Rr=class extends x{constructor(){super(m.LargeBinary)}toString(){return"LargeBinary"}};yg=Symbol.toStringTag;Rr[yg]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Rr.prototype);le=class extends x{constructor(){super(m.Utf8)}toString(){return"Utf8"}};gg=Symbol.toStringTag;le[gg]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(le.prototype);Te=class extends x{constructor(){super(m.Utf8View)}toString(){return"Utf8View"}};bg=Symbol.toStringTag;Te.ELEMENT_WIDTH=H.ELEMENT_WIDTH;Te.INLINE_CAPACITY=H.INLINE_CAPACITY;Te[bg]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8View"))(Te.prototype);Pr=class extends x{constructor(){super(m.LargeUtf8)}toString(){return"LargeUtf8"}};wg=Symbol.toStringTag;Pr[wg]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Pr.prototype);ue=class extends x{constructor(){super(m.Bool)}toString(){return"Bool"}};xg=Symbol.toStringTag;ue[xg]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(ue.prototype);$e=class extends x{constructor(t,e,n=128){super(m.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Ag=Symbol.toStringTag;$e[Ag]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))($e.prototype);Me=class extends x{constructor(t){super(m.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${mt[this.unit]}>`}get ArrayType(){return this.unit===mt.DAY?Int32Array:BigInt64Array}};vg=Symbol.toStringTag;Me[vg]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Me.prototype);ns=class extends Me{constructor(){super(mt.DAY)}},ss=class extends Me{constructor(){super(mt.MILLISECOND)}},Jt=class extends x{constructor(t,e){super(m.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${A[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Sg=Symbol.toStringTag;Jt[Sg]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Jt.prototype);is=class extends Jt{constructor(){super(A.SECOND,32)}},os=class extends Jt{constructor(){super(A.MILLISECOND,32)}},as=class extends Jt{constructor(){super(A.MICROSECOND,64)}},cs=class extends Jt{constructor(){super(A.NANOSECOND,64)}},Qt=class extends x{constructor(t,e){super(m.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${A[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Bg=Symbol.toStringTag;Qt[Bg]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(Qt.prototype);ls=class extends Qt{constructor(t){super(A.SECOND,t)}},rn=class extends Qt{constructor(t){super(A.MILLISECOND,t)}},us=class extends Qt{constructor(t){super(A.MICROSECOND,t)}},fs=class extends Qt{constructor(t){super(A.NANOSECOND,t)}},fe=class extends x{constructor(t){super(m.Interval),this.unit=t}toString(){return`Interval<${nt[this.unit]}>`}};Ig=Symbol.toStringTag;fe[Ig]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(fe.prototype);hs=class extends fe{constructor(){super(nt.DAY_TIME)}},ds=class extends fe{constructor(){super(nt.YEAR_MONTH)}},Va=class extends fe{constructor(){super(nt.MONTH_DAY_NANO)}},De=class extends x{constructor(t){super(m.Duration),this.unit=t}toString(){return`Duration<${A[this.unit]}>`}};_g=Symbol.toStringTag;De[_g]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(De.prototype);Ga=class extends De{constructor(){super(A.SECOND)}},ja=class extends De{constructor(){super(A.MILLISECOND)}},$a=class extends De{constructor(){super(A.MICROSECOND)}},qa=class extends De{constructor(){super(A.NANOSECOND)}},Ct=class extends x{constructor(t){super(m.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Lg=Symbol.toStringTag;Ct[Lg]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Ct.prototype);nr=class extends x{constructor(t){super(m.LargeList),this.children=[t]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Tg=Symbol.toStringTag;nr[Tg]=(r=>(r.children=null,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeList"))(nr.prototype);ot=class extends x{constructor(t){super(m.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Mg=Symbol.toStringTag;ot[Mg]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(ot.prototype);Ce=class extends x{constructor(t,e,n){super(m.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((s,i,o)=>(s[i]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Dg=Symbol.toStringTag;Ce[Dg]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Ce.prototype);An=class extends Ce{constructor(t,e){super(ut.Dense,t,e)}},ps=class extends Ce{constructor(t,e){super(ut.Sparse,t,e)}},qe=class extends x{constructor(t){super(m.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Cg=Symbol.toStringTag;qe[Cg]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(qe.prototype);gt=class extends x{constructor(t,e){super(m.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Fg=Symbol.toStringTag;gt[Fg]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(gt.prototype);he=class extends x{constructor(t,e=!1){var n,s,i;if(super(m.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let o=(s=t?.type)===null||s===void 0?void 0:s.children[0];o&&(o.name="key");let a=(i=t?.type)===null||i===void 0?void 0:i.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Eg=Symbol.toStringTag;he[Eg]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(he.prototype);cv=(r=>()=>++r)(-1),Rt=class extends x{constructor(t,e,n,s){super(m.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=s||!1,this.id=n==null?cv():Q(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Og=Symbol.toStringTag;Rt[Og]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Rt.prototype)});function lv(r,t,e=!0){return typeof t=="number"?Mo(r,t,e):typeof t=="string"&&t in m?Mo(r,m[t],e):t&&t instanceof x?Mo(r,Rg(t),e):t?.type&&t.type instanceof x?Mo(r,Rg(t.type),e):Mo(r,m.NONE,e)}function Mo(r,t,e=!0){let n=null;switch(t){case m.Null:n=r.visitNull;break;case m.Bool:n=r.visitBool;break;case m.Int:n=r.visitInt;break;case m.Int8:n=r.visitInt8||r.visitInt;break;case m.Int16:n=r.visitInt16||r.visitInt;break;case m.Int32:n=r.visitInt32||r.visitInt;break;case m.Int64:n=r.visitInt64||r.visitInt;break;case m.Uint8:n=r.visitUint8||r.visitInt;break;case m.Uint16:n=r.visitUint16||r.visitInt;break;case m.Uint32:n=r.visitUint32||r.visitInt;break;case m.Uint64:n=r.visitUint64||r.visitInt;break;case m.Float:n=r.visitFloat;break;case m.Float16:n=r.visitFloat16||r.visitFloat;break;case m.Float32:n=r.visitFloat32||r.visitFloat;break;case m.Float64:n=r.visitFloat64||r.visitFloat;break;case m.Utf8:n=r.visitUtf8;break;case m.LargeUtf8:n=r.visitLargeUtf8;break;case m.Utf8View:n=r.visitUtf8View||r.visitUtf8;break;case m.Binary:n=r.visitBinary;break;case m.LargeBinary:n=r.visitLargeBinary;break;case m.BinaryView:n=r.visitBinaryView||r.visitBinary;break;case m.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case m.Date:n=r.visitDate;break;case m.DateDay:n=r.visitDateDay||r.visitDate;break;case m.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case m.Timestamp:n=r.visitTimestamp;break;case m.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case m.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case m.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case m.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case m.Time:n=r.visitTime;break;case m.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case m.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case m.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case m.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case m.Decimal:n=r.visitDecimal;break;case m.List:n=r.visitList;break;case m.LargeList:n=r.visitLargeList;break;case m.Struct:n=r.visitStruct;break;case m.Union:n=r.visitUnion;break;case m.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case m.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case m.Dictionary:n=r.visitDictionary;break;case m.Interval:n=r.visitInterval;break;case m.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case m.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case m.IntervalMonthDayNano:n=r.visitIntervalMonthDayNano||r.visitInterval;break;case m.Duration:n=r.visitDuration;break;case m.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case m.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case m.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case m.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case m.FixedSizeList:n=r.visitFixedSizeList;break;case m.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${m[t]}'`)}function Rg(r){switch(r.typeId){case m.Null:return m.Null;case m.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?m.Int8:m.Uint8;case 16:return e?m.Int16:m.Uint16;case 32:return e?m.Int32:m.Uint32;case 64:return e?m.Int64:m.Uint64}return m.Int}case m.Float:switch(r.precision){case ct.HALF:return m.Float16;case ct.SINGLE:return m.Float32;case ct.DOUBLE:return m.Float64}return m.Float;case m.Binary:return m.Binary;case m.LargeBinary:return m.LargeBinary;case m.BinaryView:return m.BinaryView;case m.Utf8:return m.Utf8;case m.LargeUtf8:return m.LargeUtf8;case m.Utf8View:return m.Utf8View;case m.Bool:return m.Bool;case m.Decimal:return m.Decimal;case m.Time:switch(r.unit){case A.SECOND:return m.TimeSecond;case A.MILLISECOND:return m.TimeMillisecond;case A.MICROSECOND:return m.TimeMicrosecond;case A.NANOSECOND:return m.TimeNanosecond}return m.Time;case m.Timestamp:switch(r.unit){case A.SECOND:return m.TimestampSecond;case A.MILLISECOND:return m.TimestampMillisecond;case A.MICROSECOND:return m.TimestampMicrosecond;case A.NANOSECOND:return m.TimestampNanosecond}return m.Timestamp;case m.Date:switch(r.unit){case mt.DAY:return m.DateDay;case mt.MILLISECOND:return m.DateMillisecond}return m.Date;case m.Interval:switch(r.unit){case nt.DAY_TIME:return m.IntervalDayTime;case nt.YEAR_MONTH:return m.IntervalYearMonth;case nt.MONTH_DAY_NANO:return m.IntervalMonthDayNano}return m.Interval;case m.Duration:switch(r.unit){case A.SECOND:return m.DurationSecond;case A.MILLISECOND:return m.DurationMillisecond;case A.MICROSECOND:return m.DurationMicrosecond;case A.NANOSECOND:return m.DurationNanosecond}return m.Duration;case m.Map:return m.Map;case m.List:return m.List;case m.LargeList:return m.LargeList;case m.Struct:return m.Struct;case m.Union:switch(r.mode){case ut.Dense:return m.DenseUnion;case ut.Sparse:return m.SparseUnion}return m.Union;case m.FixedSizeBinary:return m.FixedSizeBinary;case m.FixedSizeList:return m.FixedSizeList;case m.Dictionary:return m.Dictionary}throw new Error(`Unrecognized type '${m[r.typeId]}'`)}var F,We=d(()=>{Mt();yt();F=class{visitMany(t,...e){return t.map((n,s)=>this.visit(n,...e.map(i=>i[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return lv(this,t,e)}getVisitFnByTypeId(t,e=!0){return Mo(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitUtf8View(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitBinaryView(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitLargeList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};F.prototype.visitInt8=null;F.prototype.visitInt16=null;F.prototype.visitInt32=null;F.prototype.visitInt64=null;F.prototype.visitUint8=null;F.prototype.visitUint16=null;F.prototype.visitUint32=null;F.prototype.visitUint64=null;F.prototype.visitFloat16=null;F.prototype.visitFloat32=null;F.prototype.visitFloat64=null;F.prototype.visitDateDay=null;F.prototype.visitDateMillisecond=null;F.prototype.visitTimestampSecond=null;F.prototype.visitTimestampMillisecond=null;F.prototype.visitTimestampMicrosecond=null;F.prototype.visitTimestampNanosecond=null;F.prototype.visitTimeSecond=null;F.prototype.visitTimeMillisecond=null;F.prototype.visitTimeMicrosecond=null;F.prototype.visitTimeNanosecond=null;F.prototype.visitDenseUnion=null;F.prototype.visitSparseUnion=null;F.prototype.visitIntervalDayTime=null;F.prototype.visitIntervalYearMonth=null;F.prototype.visitIntervalMonthDayNano=null;F.prototype.visitDuration=null;F.prototype.visitDurationSecond=null;F.prototype.visitDurationMillisecond=null;F.prototype.visitDurationMicrosecond=null;F.prototype.visitDurationNanosecond=null});var Mh={};ze(Mh,{float64ToUint16:()=>Wa,uint16ToFloat64:()=>cl});function cl(r){let t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function Wa(r){if(r!==r)return 32256;Pg[0]=r;let t=(Do[1]&2147483648)>>16&65535,e=Do[1]&2146435072,n=0;return e>=1089470464?Do[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Do[1]&1048575)>>10):e<=1056964608?(n=1048576+(Do[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Do[1]&1048575)+512>>10),t|e|n&65535}var Pg,Do,Ya=d(()=>{Pg=new Float64Array(1),Do=new Uint32Array(Pg.buffer)});function $(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var z,uv,kg,fv,vn,Dh,zg,hv,ll,ul,Ch,Vg,dv,Gg,pv,jg,mv,Fh,fl,hl,dl,pl,Eh,ml,yl,gl,bl,Oh,Nh,$g,yv,gv,bv,wv,xv,Av,vv,qg,Wg,Sv,Uh,wl,xl,Al,vl,Sl,Bl,Il,Rh,Bv,te,ir=d(()=>{de();We();en();yn();Ya();Mt();yt();z=class extends F{};uv=(r,t,e)=>{r[t]=Math.floor(e/864e5)},kg=(r,t,e,n)=>{if(e+1<t.length){let s=Q(t[e]),i=Q(t[e+1]);r.set(n.subarray(0,i-s),s)}},fv=({offset:r,values:t},e,n)=>{let s=r+e;n?t[s>>3]|=1<<s%8:t[s>>3]&=~(1<<s%8)},vn=({values:r},t,e)=>{r[t]=e},Dh=({values:r},t,e)=>{r[t]=e},zg=({values:r},t,e)=>{r[t]=Wa(e)},hv=(r,t,e)=>{switch(r.type.precision){case ct.HALF:return zg(r,t,e);case ct.SINGLE:case ct.DOUBLE:return Dh(r,t,e)}},ll=({values:r},t,e)=>{uv(r,t,e.valueOf())},ul=({values:r},t,e)=>{r[t]=BigInt(e)},Ch=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},Vg=({values:r,valueOffsets:t},e,n)=>kg(r,t,e,n),dv=r=>{let t=r.variadicBuffers;return(!Array.isArray(t)||Object.isFrozen(t))&&(t=Array.from(t),r.variadicBuffers=t),t},Gg=(r,t,e)=>{var n,s,i,o;let a=r.values;if(!a)throw new Error("BinaryView data is missing view buffer");let c=H.ELEMENT_WIDTH,l=t*c,u=l+c;if(l<0||u>a.length)throw new RangeError(`BinaryView index ${t} out of bounds`);a.fill(0,l,u);let f=new DataView(a.buffer,a.byteOffset+l,c),h=e.length;if(f.setInt32(H.LENGTH_OFFSET,h,!0),h<=H.INLINE_CAPACITY){a.set(e,l+H.INLINE_OFFSET);return}let p=((n=e[0])!==null&&n!==void 0?n:0)|((s=e[1])!==null&&s!==void 0?s:0)<<8|((i=e[2])!==null&&i!==void 0?i:0)<<16|((o=e[3])!==null&&o!==void 0?o:0)<<24;f.setUint32(H.INLINE_OFFSET,p>>>0,!0);let y=dv(r),g=e.slice(),w=y.push(g)-1;f.setInt32(H.BUFFER_INDEX_OFFSET,w,!0),f.setInt32(H.BUFFER_OFFSET_OFFSET,0,!0)},pv=(r,t,e)=>{let n=e instanceof Uint8Array?e:new Uint8Array(e);Gg(r,t,n)},jg=({values:r,valueOffsets:t},e,n)=>kg(r,t,e,Qe(n)),mv=(r,t,e)=>{let n=Qe(e);Gg(r,t,n)},Fh=(r,t,e)=>{r.type.unit===mt.DAY?ll(r,t,e):ul(r,t,e)},fl=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},hl=({values:r},t,e)=>{r[t]=BigInt(e)},dl=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},pl=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},Eh=(r,t,e)=>{switch(r.type.unit){case A.SECOND:return fl(r,t,e);case A.MILLISECOND:return hl(r,t,e);case A.MICROSECOND:return dl(r,t,e);case A.NANOSECOND:return pl(r,t,e)}},ml=({values:r},t,e)=>{r[t]=e},yl=({values:r},t,e)=>{r[t]=e},gl=({values:r},t,e)=>{r[t]=e},bl=({values:r},t,e)=>{r[t]=e},Oh=(r,t,e)=>{switch(r.type.unit){case A.SECOND:return ml(r,t,e);case A.MILLISECOND:return yl(r,t,e);case A.MICROSECOND:return gl(r,t,e);case A.NANOSECOND:return bl(r,t,e)}},Nh=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},$g=(r,t,e)=>{let n=r.children[0],s=r.valueOffsets,i=te.getVisitFn(n),o=Q(s[t]),a=Q(s[t+1]);if(Array.isArray(e))for(let c=-1,l=o;l<a;)i(n,l++,e[++c]);else for(let c=-1,l=o;l<a;)i(n,l++,e.get(++c))},yv=(r,t,e)=>{let n=r.children[0],{valueOffsets:s}=r,i=te.getVisitFn(n),{[t]:o,[t+1]:a}=s,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(i(n,o,l),++o>=a)break},gv=(r,t)=>(e,n,s,i)=>n&&e(n,r,t[i]),bv=(r,t)=>(e,n,s,i)=>n&&e(n,r,t.get(i)),wv=(r,t)=>(e,n,s,i)=>n&&e(n,r,t.get(s.name)),xv=(r,t)=>(e,n,s,i)=>n&&e(n,r,t[s.name]),Av=(r,t,e)=>{let n=r.type.children.map(i=>te.getVisitFn(i.type)),s=e instanceof Map?wv(t,e):e instanceof v?bv(t,e):Array.isArray(e)?gv(t,e):xv(t,e);r.type.children.forEach((i,o)=>s(n[o],r.children[o],i,o))},vv=(r,t,e)=>{r.type.mode===ut.Dense?qg(r,t,e):Wg(r,t,e)},qg=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],s=r.children[n];te.visit(s,r.valueOffsets[t],e)},Wg=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],s=r.children[n];te.visit(s,t,e)},Sv=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Uh=(r,t,e)=>{switch(r.type.unit){case nt.YEAR_MONTH:return xl(r,t,e);case nt.DAY_TIME:return wl(r,t,e);case nt.MONTH_DAY_NANO:return Al(r,t,e)}},wl=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},xl=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Al=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},vl=({values:r},t,e)=>{r[t]=e},Sl=({values:r},t,e)=>{r[t]=e},Bl=({values:r},t,e)=>{r[t]=e},Il=({values:r},t,e)=>{r[t]=e},Rh=(r,t,e)=>{switch(r.type.unit){case A.SECOND:return vl(r,t,e);case A.MILLISECOND:return Sl(r,t,e);case A.MICROSECOND:return Bl(r,t,e);case A.NANOSECOND:return Il(r,t,e)}},Bv=(r,t,e)=>{let{stride:n}=r,s=r.children[0],i=te.getVisitFn(s);if(Array.isArray(e))for(let o=-1,a=t*n;++o<n;)i(s,a+o,e[o]);else for(let o=-1,a=t*n;++o<n;)i(s,a+o,e.get(o))};z.prototype.visitBool=$(fv);z.prototype.visitInt=$(vn);z.prototype.visitInt8=$(vn);z.prototype.visitInt16=$(vn);z.prototype.visitInt32=$(vn);z.prototype.visitInt64=$(vn);z.prototype.visitUint8=$(vn);z.prototype.visitUint16=$(vn);z.prototype.visitUint32=$(vn);z.prototype.visitUint64=$(vn);z.prototype.visitFloat=$(hv);z.prototype.visitFloat16=$(zg);z.prototype.visitFloat32=$(Dh);z.prototype.visitFloat64=$(Dh);z.prototype.visitUtf8=$(jg);z.prototype.visitLargeUtf8=$(jg);z.prototype.visitUtf8View=$(mv);z.prototype.visitBinary=$(Vg);z.prototype.visitLargeBinary=$(Vg);z.prototype.visitBinaryView=$(pv);z.prototype.visitFixedSizeBinary=$(Ch);z.prototype.visitDate=$(Fh);z.prototype.visitDateDay=$(ll);z.prototype.visitDateMillisecond=$(ul);z.prototype.visitTimestamp=$(Eh);z.prototype.visitTimestampSecond=$(fl);z.prototype.visitTimestampMillisecond=$(hl);z.prototype.visitTimestampMicrosecond=$(dl);z.prototype.visitTimestampNanosecond=$(pl);z.prototype.visitTime=$(Oh);z.prototype.visitTimeSecond=$(ml);z.prototype.visitTimeMillisecond=$(yl);z.prototype.visitTimeMicrosecond=$(gl);z.prototype.visitTimeNanosecond=$(bl);z.prototype.visitDecimal=$(Nh);z.prototype.visitList=$($g);z.prototype.visitLargeList=$($g);z.prototype.visitStruct=$(Av);z.prototype.visitUnion=$(vv);z.prototype.visitDenseUnion=$(qg);z.prototype.visitSparseUnion=$(Wg);z.prototype.visitDictionary=$(Sv);z.prototype.visitInterval=$(Uh);z.prototype.visitIntervalDayTime=$(wl);z.prototype.visitIntervalYearMonth=$(xl);z.prototype.visitIntervalMonthDayNano=$(Al);z.prototype.visitDuration=$(Rh);z.prototype.visitDurationSecond=$(vl);z.prototype.visitDurationMillisecond=$(Sl);z.prototype.visitDurationMicrosecond=$(Bl);z.prototype.visitDurationNanosecond=$(Il);z.prototype.visitFixedSizeList=$(Bv);z.prototype.visitMap=$(yv);te=new z});var kr,Co,nn,Ph,kh,Iv,_l=d(()=>{ka();yi();ir();kr=Symbol.for("parent"),Co=Symbol.for("rowIndex"),nn=class{constructor(t,e){return this[kr]=t,this[Co]=e,new Proxy(this,Iv)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Co],e=this[kr],n=e.type.children,s={};for(let i=-1,o=n.length;++i<o;)s[n[i].name]=Pt.visit(e.children[i],t);return s}toString(){return`{${[...this].map(([t,e])=>`${Er(t)}: ${Er(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Ph(this[kr],this[Co])}},Ph=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Pt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(nn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[kr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Co]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});kh=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[kr].type.children.map(e=>e.name)}has(t,e){return t[kr].type.children.some(n=>n.name===e)}getOwnPropertyDescriptor(t,e){if(t[kr].type.children.some(n=>n.name===e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[kr].type.children.findIndex(s=>s.name===e);if(n!==-1){let s=Pt.visit(t[kr].children[n],t[Co]);return Reflect.set(t,e,s),s}}set(t,e,n){let s=t[kr].type.children.findIndex(i=>i.name===e);return s!==-1?(te.visit(t[kr].children[s],t[Co],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}},Iv=new kh});function G(r){return(t,e)=>t.getValid(e)?r(t,e):null}var N,_v,Fo,Lv,Tv,Yg,Mv,Zg,Hg,ms,Dv,Xg,Cv,Kg,Jg,Fv,Qg,Ev,Ov,Nv,Uv,t0,e0,r0,n0,Rv,s0,i0,o0,a0,Pv,kv,c0,zv,Vv,Gv,l0,u0,jv,$v,f0,h0,d0,p0,m0,y0,g0,qv,Wv,Pt,yi=d(()=>{al();de();We();Za();_l();en();yn();Ya();Mt();N=class extends F{};_v=(r,t)=>864e5*r[t],Fo=16,Lv=12,Tv=(r,t)=>null,Yg=(r,t,e)=>{if(e+1>=t.length)return null;let n=Q(t[e]),s=Q(t[e+1]);return r.subarray(n,s)},Mv=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Zg=({values:r},t)=>_v(r,t),Hg=({values:r},t)=>Q(r[t]),ms=({stride:r,values:t},e)=>t[r*e],Dv=({stride:r,values:t},e)=>cl(t[r*e]),Xg=({values:r},t)=>r[t],Cv=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Kg=({values:r,valueOffsets:t},e)=>Yg(r,t,e),Jg=(r,t)=>{var e;let n=r.values;if(!n)throw new Error("BinaryView data is missing view buffer");let s=t*Fo,i=s+Fo;if(s<0||i>n.length)throw new Error(`BinaryView data buffer is too short: expected ${Fo} bytes, got ${Math.max(0,n.length-s)}`);let o=n.subarray(s,i);if(o.length<Fo)throw new Error(`BinaryView data buffer is too short: expected ${Fo} bytes, got ${o.length}`);let a=new DataView(n.buffer,o.byteOffset,Fo),c=a.getInt32(0,!0);if(c<=0)return new Uint8Array(0);if(c<=Lv)return o.subarray(4,4+c);let l=a.getInt32(8,!0),u=a.getInt32(12,!0),f=(e=r.variadicBuffers)===null||e===void 0?void 0:e[l];if(!f)throw new Error(`BinaryView variadic buffer ${l} is missing`);return f.subarray(u,u+c)},Fv=(r,t)=>Jg(r,t),Qg=({values:r,valueOffsets:t},e)=>{let n=Yg(r,t,e);return n!==null?xo(n):null},Ev=(r,t)=>{let e=Jg(r,t);return xo(e)},Ov=({values:r},t)=>r[t],Nv=({type:r,values:t},e)=>r.precision!==ct.HALF?t[e]:cl(t[e]),Uv=(r,t)=>r.type.unit===mt.DAY?Zg(r,t):Hg(r,t),t0=({values:r},t)=>1e3*Q(r[t]),e0=({values:r},t)=>Q(r[t]),r0=({values:r},t)=>Ih(r[t],BigInt(1e3)),n0=({values:r},t)=>Ih(r[t],BigInt(1e6)),Rv=(r,t)=>{switch(r.type.unit){case A.SECOND:return t0(r,t);case A.MILLISECOND:return e0(r,t);case A.MICROSECOND:return r0(r,t);case A.NANOSECOND:return n0(r,t)}},s0=({values:r},t)=>r[t],i0=({values:r},t)=>r[t],o0=({values:r},t)=>r[t],a0=({values:r},t)=>r[t],Pv=(r,t)=>{switch(r.type.unit){case A.SECOND:return s0(r,t);case A.MILLISECOND:return i0(r,t);case A.MICROSECOND:return o0(r,t);case A.NANOSECOND:return a0(r,t)}},kv=({values:r,stride:t},e)=>mi.decimal(r.subarray(t*e,t*(e+1))),c0=(r,t)=>{let{valueOffsets:e,stride:n,children:s}=r,i=Q(e[t*n]),o=Q(e[t*n+1]),c=s[0].slice(i,o-i);return new v([c])},zv=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:s,[t+1]:i}=e,o=n[0];return new mr(o.slice(s,i-s))},Vv=(r,t)=>new nn(r,t),Gv=(r,t)=>r.type.mode===ut.Dense?l0(r,t):u0(r,t),l0=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Pt.visit(n,r.valueOffsets[t])},u0=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Pt.visit(n,t)},jv=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},$v=(r,t)=>r.type.unit===nt.MONTH_DAY_NANO?d0(r,t):r.type.unit===nt.DAY_TIME?f0(r,t):h0(r,t),f0=({values:r},t)=>r.subarray(2*t,2*(t+1)),h0=({values:r},t)=>{let e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},d0=({values:r},t)=>r.subarray(4*t,4*(t+1)),p0=({values:r},t)=>r[t],m0=({values:r},t)=>r[t],y0=({values:r},t)=>r[t],g0=({values:r},t)=>r[t],qv=(r,t)=>{switch(r.type.unit){case A.SECOND:return p0(r,t);case A.MILLISECOND:return m0(r,t);case A.MICROSECOND:return y0(r,t);case A.NANOSECOND:return g0(r,t)}},Wv=(r,t)=>{let{stride:e,children:n}=r,i=n[0].slice(t*e,e);return new v([i])};N.prototype.visitNull=G(Tv);N.prototype.visitBool=G(Mv);N.prototype.visitInt=G(Ov);N.prototype.visitInt8=G(ms);N.prototype.visitInt16=G(ms);N.prototype.visitInt32=G(ms);N.prototype.visitInt64=G(Xg);N.prototype.visitUint8=G(ms);N.prototype.visitUint16=G(ms);N.prototype.visitUint32=G(ms);N.prototype.visitUint64=G(Xg);N.prototype.visitFloat=G(Nv);N.prototype.visitFloat16=G(Dv);N.prototype.visitFloat32=G(ms);N.prototype.visitFloat64=G(ms);N.prototype.visitUtf8=G(Qg);N.prototype.visitLargeUtf8=G(Qg);N.prototype.visitUtf8View=G(Ev);N.prototype.visitBinary=G(Kg);N.prototype.visitLargeBinary=G(Kg);N.prototype.visitBinaryView=G(Fv);N.prototype.visitFixedSizeBinary=G(Cv);N.prototype.visitDate=G(Uv);N.prototype.visitDateDay=G(Zg);N.prototype.visitDateMillisecond=G(Hg);N.prototype.visitTimestamp=G(Rv);N.prototype.visitTimestampSecond=G(t0);N.prototype.visitTimestampMillisecond=G(e0);N.prototype.visitTimestampMicrosecond=G(r0);N.prototype.visitTimestampNanosecond=G(n0);N.prototype.visitTime=G(Pv);N.prototype.visitTimeSecond=G(s0);N.prototype.visitTimeMillisecond=G(i0);N.prototype.visitTimeMicrosecond=G(o0);N.prototype.visitTimeNanosecond=G(a0);N.prototype.visitDecimal=G(kv);N.prototype.visitList=G(c0);N.prototype.visitLargeList=G(c0);N.prototype.visitStruct=G(Vv);N.prototype.visitUnion=G(Gv);N.prototype.visitDenseUnion=G(l0);N.prototype.visitSparseUnion=G(u0);N.prototype.visitDictionary=G(jv);N.prototype.visitInterval=G($v);N.prototype.visitIntervalDayTime=G(f0);N.prototype.visitIntervalYearMonth=G(h0);N.prototype.visitIntervalMonthDayNano=G(d0);N.prototype.visitDuration=G(qv);N.prototype.visitDurationSecond=G(p0);N.prototype.visitDurationMillisecond=G(m0);N.prototype.visitDurationMicrosecond=G(y0);N.prototype.visitDurationNanosecond=G(g0);N.prototype.visitFixedSizeList=G(Wv);N.prototype.visitMap=G(zv);Pt=new N});var ys,Oo,Eo,zh,mr,Vh,Gh,Za=d(()=>{de();ka();yi();ir();ys=Symbol.for("keys"),Oo=Symbol.for("vals"),Eo=Symbol.for("kKeysAsStrings"),zh=Symbol.for("_kKeysAsStrings"),mr=class{constructor(t){return this[ys]=new v([t.children[0]]).memoize(),this[Oo]=t.children[1],new Proxy(this,new Gh)}get[Eo](){return this[zh]||(this[zh]=Array.from(this[ys].toArray(),String))}[Symbol.iterator](){return new Vh(this[ys],this[Oo])}get size(){return this[ys].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ys],e=this[Oo],n={};for(let s=-1,i=t.length;++s<i;)n[t.get(s)]=Pt.visit(e,s);return n}toString(){return`{${[...this].map(([t,e])=>`${Er(t)}: ${Er(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Vh=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Pt.visit(this.vals,t)]})}},Gh=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Eo]}has(t,e){return t[Eo].includes(e)}getOwnPropertyDescriptor(t,e){if(t[Eo].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Eo].indexOf(e);if(n!==-1){let s=Pt.visit(Reflect.get(t,Oo),n);return Reflect.set(t,e,s),s}}set(t,e,n){let s=t[Eo].indexOf(e);return s!==-1?(te.visit(Reflect.get(t,Oo),s,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(mr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ys]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Oo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[zh]:{writable:!0,enumerable:!1,configurable:!1,value:null}})});var jh={};ze(jh,{clampRange:()=>Ha,createElementComparator:()=>gs,wrapIndex:()=>gi});function Ha(r,t,e,n){let{length:s=0}=r,i=typeof t!="number"?0:t,o=typeof e!="number"?s:e;return i<0&&(i=(i%s+s)%s),o<0&&(o=(o%s+s)%s),o<i&&(b0=i,i=o,o=b0),o>s&&(o=s),n?n(r,i,o):[i,o]}function gs(r){if(typeof r!=="object"||r===null)return w0(r)?w0:e=>e===r;if(r instanceof Date){let e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?Yf(r,e):!1:r instanceof Map?Zv(r):Array.isArray(r)?Yv(r):r instanceof v?Hv(r):Xv(r,!0)}function Yv(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=gs(r[e]);return Ll(t)}function Zv(r){let t=-1,e=[];for(let n of r.values())e[++t]=gs(n);return Ll(e)}function Hv(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=gs(r.get(e));return Ll(t)}function Xv(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let s=-1,i=e.length;++s<i;)n[s]=gs(r[e[s]]);return Ll(n,e)}function Ll(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Kv(r,e);case Map:return x0(r,e,e.keys());case mr:case nn:case Object:case void 0:return x0(r,e,t||Object.keys(e))}return e instanceof v?Jv(r,e):!1}}function Kv(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t[n]))return!1;return!0}function Jv(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t.get(n)))return!1;return!0}function x0(r,t,e){let n=e[Symbol.iterator](),s=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),i=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=r.length,c=i.next(),l=n.next(),u=s.next();for(;o<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!r[o](c.value));++o,l=n.next(),u=s.next(),c=i.next());return o===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),s.return&&s.return(),i.return&&i.return(),!1)}var b0,gi,w0,No=d(()=>{de();Za();_l();Gt();gi=(r,t)=>r<0?t+r:r,w0=r=>r!==r});var $h={};ze($h,{BitIterator:()=>sn,getBit:()=>Ml,getBool:()=>Uo,packBools:()=>wi,popcnt_array:()=>A0,popcnt_bit_range:()=>Xa,popcnt_uint32:()=>Tl,setBool:()=>Qv,truncateBitmap:()=>bi});function Uo(r,t,e,n){return(e&1<<n)!==0}function Ml(r,t,e,n){return(e&1<<n)>>n}function Qv(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function bi(r,t,e){let n=e.byteLength+7&-8;if(r>0||e.byteLength<n){let s=new Uint8Array(n);return s.set(r%8===0?e.subarray(r>>3):wi(new sn(e,r,t,null,Uo)).subarray(0,n)),s}return e}function wi(r){let t=[],e=0,n=0,s=0;for(let o of r)o&&(s|=1<<n),++n===8&&(t[e++]=s,s=n=0);(e===0||n>0)&&(t[e++]=s);let i=new Uint8Array(t.length+7&-8);return i.set(t),i}function Xa(r,t,e){if(e-t<=0)return 0;if(e-t<8){let i=0;for(let o of new sn(r,t,e-t,r,Ml))i+=o;return i}let n=e>>3<<3,s=t+(t%8===0?0:8-t%8);return Xa(r,t,s)+Xa(r,n,e)+A0(r,s>>3,n-s>>3)}function A0(r,t,e){let n=0,s=Math.trunc(t),i=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:s+e;for(;o-s>=4;)n+=Tl(i.getUint32(s)),s+=4;for(;o-s>=2;)n+=Tl(i.getUint16(s)),s+=2;for(;o-s>=1;)n+=Tl(i.getUint8(s)),s+=1;return n}function Tl(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var sn,xi=d(()=>{sn=class{constructor(t,e,n,s,i){this.bytes=t,this.length=n,this.context=s,this.get=i,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}});function D(r){return eS.visit(r)}var tS,v0,M,qh,eS,yr=d(()=>{de();Mt();yt();xi();yt();We();Gt();tS=-1,v0=Symbol.for("apache-arrow/Data"),M=class r{static isData(t){return t?.[v0]===!0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return x.isSparseUnion(t)?this.children.some(e=>e.nullable):x.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:s,typeIds:i}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),i&&(t+=i.byteLength),t+=this.variadicBuffers.reduce((o,a)=>{var c;return o+((c=a?.byteLength)!==null&&c!==void 0?c:0)},0),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(x.isUnion(this.type))return this.children.reduce((n,s)=>n+s.nullCount,0);let t=this._nullCount,e;return t<=tS&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-Xa(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,s,i,o=[],a,c=[]){var l;this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let u;i instanceof r?(this.stride=i.stride,this.values=i.values,this.typeIds=i.typeIds,this.nullBitmap=i.nullBitmap,this.valueOffsets=i.valueOffsets,this.variadicBuffers=i.variadicBuffers):(this.stride=sr(t),i&&((u=i[0])&&(this.valueOffsets=u),(u=i[1])&&(this.values=u),(u=i[2])&&(this.nullBitmap=u),(u=i[3])&&(this.typeIds=u)),this.variadicBuffers=c),(l=this.variadicBuffers)!==null&&l!==void 0||(this.variadicBuffers=[])}getValid(t){let{type:e}=this;if(x.isUnion(e)){let n=e,s=this.typeIds[t],i=n.typeIdToChildIndex[s],o=this.children[i],a=this.valueOffsets,c=n.mode===ut.Dense&&a?Number(a[t]):t;return o.getValid(c)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n,{type:s}=this;if(x.isUnion(s)){let i=s,o=this.typeIds[t],a=i.typeIdToChildIndex[o],c=this.children[a],l=this.valueOffsets,u=i.mode===ut.Dense&&l?Number(l[t]):t;n=c.getValid(u),c.setValid(u,e)}else{let{nullBitmap:i}=this,{offset:o,length:a}=this,c=o+t,l=1<<c%8,u=c>>3;(!i||i.byteLength<=u)&&(i=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(i.set(bi(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:i})):Object.assign(this,{nullBitmap:i,_nullCount:0}));let f=i[u];n=(f&l)!==0,i[u]=e?f|l:f&~l}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,s=this._nullCount,i=this,o=this.children,a=this.variadicBuffers){return new r(t,e,n,s,i,o,this.dictionary,a)}slice(t,e){let{stride:n,typeId:s,children:i}=this,o=+(this._nullCount===0)-1,a=s===16?n:1,c=this._sliceBuffers(t,e,n,s);return this.clone(this.type,this.offset+t,e,o,c,i.length===0||this.valueOffsets?i:this._sliceChildren(i,a*t,a*e),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===m.Null)return this.clone(this.type,0,t,0,this.buffers,this.children,this.variadicBuffers);let{length:e,nullCount:n}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);s[e>>3]=(1<<e-(e&-8))-1,n>0&&s.set(bi(this.offset,e,this.nullBitmap),0);let i=this.buffers;return i[Z.VALIDITY]=s,this.clone(this.type,0,t,n+(t-e),i,this.children,this.variadicBuffers)}_sliceBuffers(t,e,n,s){let i,{buffers:o}=this;if((i=o[Z.TYPE])&&(o[Z.TYPE]=i.subarray(t,t+e)),x.isBinaryView(this.type)||x.isUtf8View(this.type)){let a=H.ELEMENT_WIDTH;(i=o[Z.DATA])&&(o[Z.DATA]=i.subarray(t*a,(t+e)*a))}else(i=o[Z.OFFSET])&&(o[Z.OFFSET]=i.subarray(t,t+e+1))||(i=o[Z.DATA])&&(o[Z.DATA]=s===6?i:i.subarray(n*t,n*(t+e)));return o}_sliceChildren(t,e,n){return t.map(s=>s.slice(e,n))}};M.prototype.children=Object.freeze([]);M.prototype[v0]=!0;Object.defineProperty(M,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===M&&M.isData(t)}});qh=class r extends F{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:s=0}=t;return new M(e,n,s,s)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.ArrayType,t.data),{["length"]:o=i.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,i,s])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.ArrayType,t.data),{["length"]:o=i.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,i,s])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.ArrayType,t.data),{["length"]:o=i.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,i,s])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.data),i=O(t.nullBitmap),o=hi(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,s,i])}visitUtf8View(t){var e;let{["type"]:n,["offset"]:s=0}=t,i=J(n.ArrayType,t.views),o=O(t.nullBitmap),a=(t.variadicBuffers||[]).map(u=>O(u)),c=(e=t.length)!==null&&e!==void 0?e:Math.trunc(i.length/Te.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new M(n,s,c,l,[void 0,i,o],[],void 0,a)}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.data),i=O(t.nullBitmap),o=Sa(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,s,i])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.data),i=O(t.nullBitmap),o=hi(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,s,i])}visitBinaryView(t){var e;let{["type"]:n,["offset"]:s=0}=t,i=J(n.ArrayType,t.views),o=O(t.nullBitmap),a=(t.variadicBuffers||[]).map(u=>O(u)),c=(e=t.length)!==null&&e!==void 0?e:Math.trunc(i.length/H.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new M(n,s,c,l,[void 0,i,o],[],void 0,a)}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.data),i=O(t.nullBitmap),o=Sa(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,s,i])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.ArrayType,t.data),{["length"]:o=i.length/sr(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,i,s])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.ArrayType,t.data),{["length"]:o=i.length/sr(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,i,s])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.ArrayType,t.data),{["length"]:o=i.length/sr(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,i,s])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.ArrayType,t.data),{["length"]:o=i.length/sr(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,i,s])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.ArrayType,t.data),{["length"]:o=i.length/sr(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,i,s])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:s}=t,i=O(t.nullBitmap),o=hi(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,void 0,i],[s])}visitLargeList(t){let{["type"]:e,["offset"]:n=0,["child"]:s}=t,i=O(t.nullBitmap),o=Sa(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,void 0,i],[s])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,i=O(t.nullBitmap),{length:o=s.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,void 0,i],s)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,i=J(e.ArrayType,t.typeIds),{["length"]:o=i.length,["nullCount"]:a=-1}=t;if(x.isSparseUnion(e))return new M(e,n,o,a,[void 0,void 0,void 0,i],s);let c=hi(t.valueOffsets);return new M(e,n,o,a,[c,void 0,void 0,i],s)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.indices.ArrayType,t.data),{["dictionary"]:o=new v([new r().visit({type:e.dictionary})])}=t,{["length"]:a=i.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[void 0,i,s],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.ArrayType,t.data),{["length"]:o=i.length/sr(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,i,s])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,s=O(t.nullBitmap),i=J(e.ArrayType,t.data),{["length"]:o=i.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,i,s])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:s=new r().visit({type:e.valueType})}=t,i=O(t.nullBitmap),{["length"]:o=s.length/sr(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,void 0,i],[s])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:s=new r().visit({type:e.childType})}=t,i=O(t.nullBitmap),o=hi(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,void 0,i],[s])}},eS=new qh});function S0(r){return r.some(t=>t.nullable)}function Dl(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Cl(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Fl(r,t,e,n){let s=[];for(let i=-1,o=r.length;++i<o;){let a=r[i],c=t[i],{length:l}=a;if(c>=n)break;if(e>=c+l)continue;if(c>=e&&c+l<=n){s.push(a);continue}let u=Math.max(0,e-c),f=Math.min(n-c,l);s.push(a.slice(u,f-u))}return s.length===0&&s.push(r[0].slice(0,0)),s}function Wh(r,t,e,n){let s=0,i=0,o=t.length-1;do{if(s>=o-1)return e<t[o]?n(r,s,e-t[s]):null;i=s+Math.trunc((o-s)*.5),e<t[i]?o=i:s=i}while(s<o)}function Ja(r,t){return r.getValid(t)}function Ro(r){function t(e,n,s){return r(e[n],s)}return function(e){let n=this.data;return Wh(n,this._offsets,e,t)}}function El(r){let t;function e(n,s,i){return r(n[s],i,t)}return function(n,s){let i=this.data;t=s;let o=Wh(i,this._offsets,n,e);return t=void 0,o}}function Ol(r){let t;function e(n,s,i){let o=i,a=0,c=0;for(let l=s-1,u=n.length;++l<u;){let f=n[l];if(~(a=r(f,t,o)))return c+a;o=0,c+=f.length}return-1}return function(n,s){t=n;let i=this.data,o=typeof s!="number"?e(i,0,0):Wh(i,this._offsets,s,e);return t=void 0,o}}var Ka,Nl=d(()=>{Ka=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}});function rS(r,t){return t===null&&r.length>0?0:-1}function nS(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let s of new sn(e,r.offset+(t||0),r.length,e,Uo)){if(!s)return n;++n}return-1}function W(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case m.Union:break;case m.Dictionary:break;default:return nS(r,e)}let n=Pt.getVisitFn(r),s=gs(t);for(let i=(e||0)-1,o=r.length;++i<o;)if(s(n(r,i)))return i;return-1}function B0(r,t,e){let n=Pt.getVisitFn(r),s=gs(t);for(let i=(e||0)-1,o=r.length;++i<o;)if(s(n(r,i)))return i;return-1}var U,Ai,Ul=d(()=>{Mt();We();yi();xi();No();U=class extends F{};U.prototype.visitNull=rS;U.prototype.visitBool=W;U.prototype.visitInt=W;U.prototype.visitInt8=W;U.prototype.visitInt16=W;U.prototype.visitInt32=W;U.prototype.visitInt64=W;U.prototype.visitUint8=W;U.prototype.visitUint16=W;U.prototype.visitUint32=W;U.prototype.visitUint64=W;U.prototype.visitFloat=W;U.prototype.visitFloat16=W;U.prototype.visitFloat32=W;U.prototype.visitFloat64=W;U.prototype.visitUtf8=W;U.prototype.visitLargeUtf8=W;U.prototype.visitUtf8View=W;U.prototype.visitBinary=W;U.prototype.visitLargeBinary=W;U.prototype.visitBinaryView=W;U.prototype.visitFixedSizeBinary=W;U.prototype.visitDate=W;U.prototype.visitDateDay=W;U.prototype.visitDateMillisecond=W;U.prototype.visitTimestamp=W;U.prototype.visitTimestampSecond=W;U.prototype.visitTimestampMillisecond=W;U.prototype.visitTimestampMicrosecond=W;U.prototype.visitTimestampNanosecond=W;U.prototype.visitTime=W;U.prototype.visitTimeSecond=W;U.prototype.visitTimeMillisecond=W;U.prototype.visitTimeMicrosecond=W;U.prototype.visitTimeNanosecond=W;U.prototype.visitDecimal=W;U.prototype.visitList=W;U.prototype.visitLargeList=W;U.prototype.visitStruct=W;U.prototype.visitUnion=W;U.prototype.visitDenseUnion=B0;U.prototype.visitSparseUnion=B0;U.prototype.visitDictionary=W;U.prototype.visitInterval=W;U.prototype.visitIntervalDayTime=W;U.prototype.visitIntervalYearMonth=W;U.prototype.visitIntervalMonthDayNano=W;U.prototype.visitDuration=W;U.prototype.visitDurationSecond=W;U.prototype.visitDurationMillisecond=W;U.prototype.visitDurationMicrosecond=W;U.prototype.visitDurationNanosecond=W;U.prototype.visitFixedSizeList=W;U.prototype.visitMap=W;Ai=new U});function j(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(x.isInt(t)&&t.bitWidth!==64||x.isTime(t)&&t.bitWidth!==64||x.isFloat(t)&&t.precision!==ct.HALF))return new Ka(r.data.length,n=>{let s=r.data[n];return s.values.subarray(0,s.length)[Symbol.iterator]()});let e=0;return new Ka(r.data.length,n=>{let i=r.data[n].length,o=r.slice(e,e+i);return e+=i,new Yh(o)})}var R,Yh,Po,Rl=d(()=>{We();Mt();yt();Nl();R=class extends F{};Yh=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};R.prototype.visitNull=j;R.prototype.visitBool=j;R.prototype.visitInt=j;R.prototype.visitInt8=j;R.prototype.visitInt16=j;R.prototype.visitInt32=j;R.prototype.visitInt64=j;R.prototype.visitUint8=j;R.prototype.visitUint16=j;R.prototype.visitUint32=j;R.prototype.visitUint64=j;R.prototype.visitFloat=j;R.prototype.visitFloat16=j;R.prototype.visitFloat32=j;R.prototype.visitFloat64=j;R.prototype.visitUtf8=j;R.prototype.visitLargeUtf8=j;R.prototype.visitUtf8View=j;R.prototype.visitBinary=j;R.prototype.visitLargeBinary=j;R.prototype.visitBinaryView=j;R.prototype.visitFixedSizeBinary=j;R.prototype.visitDate=j;R.prototype.visitDateDay=j;R.prototype.visitDateMillisecond=j;R.prototype.visitTimestamp=j;R.prototype.visitTimestampSecond=j;R.prototype.visitTimestampMillisecond=j;R.prototype.visitTimestampMicrosecond=j;R.prototype.visitTimestampNanosecond=j;R.prototype.visitTime=j;R.prototype.visitTimeSecond=j;R.prototype.visitTimeMillisecond=j;R.prototype.visitTimeMicrosecond=j;R.prototype.visitTimeNanosecond=j;R.prototype.visitDecimal=j;R.prototype.visitList=j;R.prototype.visitLargeList=j;R.prototype.visitStruct=j;R.prototype.visitUnion=j;R.prototype.visitDenseUnion=j;R.prototype.visitSparseUnion=j;R.prototype.visitDictionary=j;R.prototype.visitInterval=j;R.prototype.visitIntervalDayTime=j;R.prototype.visitIntervalYearMonth=j;R.prototype.visitIntervalMonthDayNano=j;R.prototype.visitDuration=j;R.prototype.visitDurationSecond=j;R.prototype.visitDurationMillisecond=j;R.prototype.visitDurationMicrosecond=j;R.prototype.visitDurationNanosecond=j;R.prototype.visitFixedSizeList=j;R.prototype.visitMap=j;Po=new R});function ee(r){if(r){if(r instanceof M)return new v([r]);if(r instanceof v)return new v(r.data);if(r.type instanceof x)return new v([D(r)]);if(Array.isArray(r))return new v(r.flatMap(t=>sS(t)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let t={offset:0,length:r.length,nullCount:-1,data:r};if(r instanceof Int8Array)return new v([D(Object.assign(Object.assign({},t),{type:new Se}))]);if(r instanceof Int16Array)return new v([D(Object.assign(Object.assign({},t),{type:new Be}))]);if(r instanceof Int32Array)return new v([D(Object.assign(Object.assign({},t),{type:new Dt}))]);if(r instanceof BigInt64Array)return new v([D(Object.assign(Object.assign({},t),{type:new rr}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new v([D(Object.assign(Object.assign({},t),{type:new Ie}))]);if(r instanceof Uint16Array)return new v([D(Object.assign(Object.assign({},t),{type:new _e}))]);if(r instanceof Uint32Array)return new v([D(Object.assign(Object.assign({},t),{type:new qt}))]);if(r instanceof BigUint64Array)return new v([D(Object.assign(Object.assign({},t),{type:new Nr}))]);if(r instanceof Float32Array)return new v([D(Object.assign(Object.assign({},t),{type:new Kt}))]);if(r instanceof Float64Array)return new v([D(Object.assign(Object.assign({},t),{type:new Le}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function sS(r){return r instanceof M?[r]:r instanceof v?r.data:ee(r).data}var I0,_0,L0,T0,v,Pl,de=d(()=>{Mt();No();yt();yr();Nl();yi();ir();Ul();Rl();yt();_0=Symbol.for("apache-arrow/Vector"),L0={},T0={},v=class r{static isVector(t){return t?.[_0]===!0}constructor(t){var e,n,s;let i=t[0]instanceof r?t.flatMap(a=>a.data):t;if(i.length===0||i.some(a=>!(a instanceof M)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=i[0])===null||e===void 0?void 0:e.type;switch(i.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=L0[o.typeId],u=i[0];this.isValid=f=>Ja(u,f),this.get=f=>a(u,f),this.set=(f,h)=>c(u,f,h),this.indexOf=f=>l(u,f),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,T0[o.typeId]),this._offsets=Cl(i);break}this.data=i,this.type=o,this.stride=sr(o),this.numChildren=(s=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return S0(this.data)}get nullCount(){return Dl(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${m[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(gi(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Po.visit(this)}concat(...t){return new r(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new r(Ha(this,t,e,({data:n,_offsets:s},i,o)=>Fl(n,s,i,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:s,ArrayType:i}=this;switch(t.typeId){case m.Int:case m.Float:case m.Decimal:case m.Time:case m.Timestamp:switch(e.length){case 0:return new i;case 1:return e[0].values.subarray(0,n*s);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*s),o.offset),o.offset+=c*s,o),{array:new i(n*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new r(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return x.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(x.isDictionary(this.type)){let t=new Pl(this.data[0].dictionary),e=this.data.map(n=>{let s=n.clone();return s.dictionary=t,s});return new r(e)}return new Pl(this)}unmemoize(){if(x.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{let s=n.clone();return s.dictionary=t,s});return new r(e)}return this}};I0=Symbol.toStringTag;v[I0]=(r=>{r.type=x.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0,r[_0]=!0;let t=Object.keys(m).map(e=>m[e]).filter(e=>typeof e=="number"&&e!==m.NONE);for(let e of t){let n=Pt.getVisitFnByTypeId(e),s=te.getVisitFnByTypeId(e),i=Ai.getVisitFnByTypeId(e);L0[e]={get:n,set:s,indexOf:i},T0[e]=Object.create(r,{isValid:{value:Ro(Ja)},get:{value:Ro(Pt.getVisitFnByTypeId(e))},set:{value:El(te.getVisitFnByTypeId(e))},indexOf:{value:Ol(Ai.getVisitFnByTypeId(e))}})}return"Vector"})(v.prototype);Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===v&&v.isVector(t)}});Pl=class r extends v{constructor(t){super(t.data);let e=this.get,n=this.set,s=this.slice,i=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=i[o];if(a!==void 0)return a;let c=e.call(this,o);return i[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),i[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new r(s.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new v(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}});function M0(r){if(!r||r.length<=0)return function(s){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t=`
8
+ switch (x) {${e.map(n=>`
9
+ case ${iS(n)}:`).join("")}
10
+ return false;
11
+ }`),r.length!==e.length&&(t=`if (x !== x) return false;
12
+ ${t}`),new Function("x",`${t}
13
+ return true;`)}function iS(r){return typeof r!="bigint"?Er(r):`${Er(r)}n`}var D0=d(()=>{ka()});function Zh(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function C0(r,t=0){return r.length>=t?r.subarray(0,t):va(new r.constructor(t),r,0)}var Ye,Sn,ko,bs,zr=d(()=>{Gt();Ye=class{constructor(t,e=0,n=1){this.length=Math.ceil(e/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let e=this.stride,n=this.length*e,s=this.buffer.length;n>=s&&this._resize(s===0?Zh(n*1,this.BYTES_PER_ELEMENT):Zh(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Zh(t*this.stride,this.BYTES_PER_ELEMENT);let e=C0(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=C0(this.buffer,t)}},Sn=class extends Ye{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}},ko=class extends Sn{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),s=t>>3,i=t%8,o=n[s]>>i&1;return e?o===0&&(n[s]|=1<<i,++this.numValid):o===1&&(n[s]&=~(1<<i),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},bs=class extends Sn{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,e){let n=this.length-1,s=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&s.fill(s[n],n,t),s[t]=s[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}}});var bt,kt,pe,At=d(()=>{de();yr();Za();yt();D0();zr();bt=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=sr(t),this._nulls=new ko,e&&e.length>0&&(this._isValid=M0(e))}toVector(){return new v([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:s,_typeIds:i,children:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),i&&(t+=i.byteLength),o.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,n)=>e+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,e,n,s,{type:i,length:o,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(e=c?.flush(o))?s=l?.flush(o):(s=l?.flush(o))?t=u?.flush(l.last()):t=u?.flush(o),a>0&&(n=f?.flush(o));let h=this.children.map(p=>p.flush());return this.clear(),D({type:i,length:o,nullCount:a,children:h,child:h[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:s})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,s;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(s=this._typeIds)===null||s===void 0||s.clear();for(let i of this.children)i.clear();return this}};bt.prototype.length=1;bt.prototype.stride=1;bt.prototype.children=null;bt.prototype.finished=!1;bt.prototype.nullValues=null;bt.prototype._isValid=()=>!0;kt=class extends bt{constructor(t){super(t),this._values=new Sn(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},pe=class extends bt{constructor(t){super(t),this._pendingLength=0,this._offsets=new bs(t.type)}setValue(t,e){let n=this._pending||(this._pending=new Map),s=n.get(t);s&&(this._pendingLength-=s.length),this._pendingLength+=e instanceof mr?e[ys].length:e.length,n.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}}});var vi,Hh=d(()=>{vi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}}});var or,F0=d(()=>{it();Hh();Io();Qc();Sh();or=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ht.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ge).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new vi).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let n=this.bb.__offset(this.bb_pos,10);return n?(e||new vi).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new Tt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,ht.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}});function kl(r,t){return new Map([...r||new Map,...t||new Map])}function Xh(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let i=r[e].type;if(x.isDictionary(i)){if(!t.has(i.id))t.set(i.id,i.dictionary);else if(t.get(i.id)!==i.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}i.children&&i.children.length>0&&Xh(i.children,t)}return t}var E0,O0,P,B,me=d(()=>{Mt();yt();E0=Symbol.for("apache-arrow/Schema"),O0=Symbol.for("apache-arrow/Field"),P=class r{static isSchema(t){return t?.[E0]===!0}constructor(t=[],e,n,s=ht.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=Xh(this.fields)),this.dictionaries=n,this.metadataVersion=s}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){let e=new Set(t),n=this.fields.filter(s=>e.has(s.name));return new r(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new r(e,this.metadata)}assign(...t){let e=t[0]instanceof r?t[0]:Array.isArray(t[0])?new r(t[0]):new r(t),n=[...this.fields],s=kl(kl(new Map,this.metadata),e.metadata),i=e.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:kl(kl(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=Xh(i,new Map);return new r([...n,...i],s,new Map([...this.dictionaries,...o]))}};P.prototype.fields=null;P.prototype.metadata=null;P.prototype.dictionaries=null;P.prototype[E0]=!0;Object.defineProperty(P,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===P&&P.isSchema(t)}});B=class r{static isField(t){return t?.[O0]===!0}static new(...t){let[e,n,s,i]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),s===void 0&&(s=t[0].nullable),i===void 0&&(i=t[0].metadata)),new r(`${e}`,n,s,i)}constructor(t,e,n=!1,s){this.name=t,this.type=e,this.nullable=n,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,s,i]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,s=this.nullable,i=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:s=this.nullable,metadata:i=this.metadata}=t[0],r.new(e,n,s,i)}};B.prototype.type=null;B.prototype.name=null;B.prototype.nullable=null;B.prototype.metadata=null;B.prototype[O0]=!0;Object.defineProperty(B,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===B&&B.isField(t)}})});var oS,aS,Bn,Kh,Vr,Jh=d(()=>{Hh();F0();it();me();Mt();Gt();en();oS=di,aS=Ht,Bn=class{static decode(t){t=new aS(O(t));let e=or.getRootAsFooter(t),n=P.decode(e.schema(),new Map,e.version());return new Kh(n,e)}static encode(t){let e=new oS,n=P.encode(e,t.schema);or.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Vr.encode(e,o);let s=e.endVector();or.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Vr.encode(e,o);let i=e.endVector();return or.startFooter(e),or.addSchema(e,n),or.addVersion(e,ht.V5),or.addRecordBatches(e,s),or.addDictionaries(e,i),or.finishFooterBuffer(e,or.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=ht.V5,n,s){this.schema=t,this.version=e,n&&(this._recordBatches=n),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}},Kh=class extends Bn{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Vr.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Vr.decode(e)}return null}},Vr=class r{static decode(t){return new r(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,s=BigInt(e.offset),i=BigInt(e.bodyLength);return vi.createBlock(t,s,n,i)}constructor(t,e,n){this.metaDataLength=t,this.offset=Q(n),this.bodyLength=Q(e)}}});var ar,N0=d(()=>{it();Io();ol();Qc();ar=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ht.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):et.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new Tt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,ht.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,et.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,s,i,o){return r.startMessage(t),r.addVersion(t,e),r.addHeaderType(t,n),r.addHeader(t,s),r.addBodyLength(t,i),r.addCustomMetadata(t,o),r.endMessage(t)}}});var Qh,zl,U0=d(()=>{We();sg();sl();yh();Ky();Jy();tg();Qy();og();ag();rg();hh();fh();wh();xh();gh();dh();ng();eg();ig();Ah();uh();ph();mh();bh();Qh=class extends F{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Na.startNull(e),Na.endNull(e)}visitInt(t,e){return Cr.startInt(e),Cr.addBitWidth(e,t.bitWidth),Cr.addIsSigned(e,t.isSigned),Cr.endInt(e)}visitFloat(t,e){return ts.startFloatingPoint(e),ts.addPrecision(e,t.precision),ts.endFloatingPoint(e)}visitBinary(t,e){return Ta.startBinary(e),Ta.endBinary(e)}visitBinaryView(t,e){return Ma.startBinaryView(e),Ma.endBinaryView(e)}visitLargeBinary(t,e){return Ca.startLargeBinary(e),Ca.endLargeBinary(e)}visitBool(t,e){return Da.startBool(e),Da.endBool(e)}visitUtf8(t,e){return Ra.startUtf8(e),Ra.endUtf8(e)}visitUtf8View(t,e){return Pa.startUtf8View(e),Pa.endUtf8View(e)}visitLargeUtf8(t,e){return Ea.startLargeUtf8(e),Ea.endLargeUtf8(e)}visitDecimal(t,e){return tn.startDecimal(e),tn.addScale(e,t.scale),tn.addPrecision(e,t.precision),tn.addBitWidth(e,t.bitWidth),tn.endDecimal(e)}visitDate(t,e){return Xn.startDate(e),Xn.addUnit(e,t.unit),Xn.endDate(e)}visitTime(t,e){return wn.startTime(e),wn.addUnit(e,t.unit),wn.addBitWidth(e,t.bitWidth),wn.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return xn.startTimestamp(e),xn.addUnit(e,t.unit),n!==void 0&&xn.addTimezone(e,n),xn.endTimestamp(e)}visitInterval(t,e){return es.startInterval(e),es.addUnit(e,t.unit),es.endInterval(e)}visitDuration(t,e){return Kn.startDuration(e),Kn.addUnit(e,t.unit),Kn.endDuration(e)}visitList(t,e){return Oa.startList(e),Oa.endList(e)}visitLargeList(t,e){return Fa.startLargeList(e),Fa.endLargeList(e)}visitStruct(t,e){return Ua.startStruct_(e),Ua.endStruct_(e)}visitUnion(t,e){Fr.startTypeIdsVector(e,t.typeIds.length);let n=Fr.createTypeIdsVector(e,t.typeIds);return Fr.startUnion(e),Fr.addMode(e,t.mode),Fr.addTypeIds(e,n),Fr.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return Qr.startDictionaryEncoding(e),Qr.addId(e,BigInt(t.id)),Qr.addIsOrdered(e,t.isOrdered),n!==void 0&&Qr.addIndexType(e,n),Qr.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Jn.startFixedSizeBinary(e),Jn.addByteWidth(e,t.byteWidth),Jn.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Qn.startFixedSizeList(e),Qn.addListSize(e,t.listSize),Qn.endFixedSizeList(e)}visitMap(t,e){return rs.startMap(e),rs.addKeysSorted(e,t.keysSorted),rs.endMap(e)}},zl=new Qh});function z0(r,t=new Map){return new P(cS(r,t),Vl(r.metadata),t)}function td(r){return new zt(r.count,G0(r.columns),j0(r.columns),null,$0(r.columns))}function V0(r){return new ye(td(r.data),r.id,r.isDelta)}function cS(r,t){return(r.fields||[]).filter(Boolean).map(e=>B.fromJSON(e,t))}function R0(r,t){return(r.children||[]).filter(Boolean).map(e=>B.fromJSON(e,t))}function G0(r){return(r||[]).reduce((t,e)=>[...t,new gr(e.count,lS(e.VALIDITY)),...G0(e.children)],[])}function j0(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let s=r[e];if(s.VALIDITY&&t.push(new Nt(t.length,s.VALIDITY.length)),s.TYPE_ID&&t.push(new Nt(t.length,s.TYPE_ID.length)),s.OFFSET&&t.push(new Nt(t.length,s.OFFSET.length)),s.DATA&&t.push(new Nt(t.length,s.DATA.length)),s.VIEWS&&t.push(new Nt(t.length,s.VIEWS.length)),s.VARIADIC_DATA_BUFFERS)for(let i of s.VARIADIC_DATA_BUFFERS)t.push(new Nt(t.length,i.length));t=j0(s.children,t)}return t}function lS(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function $0(r){return(r||[]).reduce((t,e)=>[...t,...e.VARIADIC_DATA_BUFFERS?[e.VARIADIC_DATA_BUFFERS.length]:[],...$0(e.children)],[])}function q0(r,t){let e,n,s,i,o,a;return!t||!(i=r.dictionary)?(o=k0(r,R0(r,t)),s=new B(r.name,o,r.nullable,Vl(r.metadata))):t.has(e=i.id)?(n=(n=i.indexType)?P0(n):new Dt,a=new Rt(t.get(e),n,e,i.isOrdered),s=new B(r.name,a,r.nullable,Vl(r.metadata))):(n=(n=i.indexType)?P0(n):new Dt,t.set(e,o=k0(r,R0(r,t))),a=new Rt(o,n,e,i.isOrdered),s=new B(r.name,a,r.nullable,Vl(r.metadata))),s||null}function Vl(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function P0(r){return new Lt(r.isSigned,r.bitWidth)}function k0(r,t){let e=r.type.name;switch(e){case"NONE":return new Ot;case"null":return new Ot;case"binary":return new je;case"largebinary":return new Rr;case"binaryview":return new H;case"utf8":return new le;case"largeutf8":return new Pr;case"utf8view":return new Te;case"bool":return new ue;case"list":return new Ct((t||[])[0]);case"largelist":return new nr((t||[])[0]);case"struct":return new ot(t||[]);case"struct_":return new ot(t||[])}switch(e){case"int":{let n=r.type;return new Lt(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new ce(ct[n.precision])}case"decimal":{let n=r.type;return new $e(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Me(mt[n.unit])}case"time":{let n=r.type;return new Jt(A[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Qt(A[n.unit],n.timezone)}case"interval":{let n=r.type;return new fe(nt[n.unit])}case"duration":{let n=r.type;return new De(A[n.unit])}case"union":{let n=r.type,[s,...i]=(n.mode+"").toLowerCase(),o=s.toUpperCase()+i.join("");return new Ce(ut[o],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new qe(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new gt(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new he((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var W0=d(()=>{me();yt();ws();Mt()});function hS(r,t){return(()=>{switch(t){case et.Schema:return P.fromJSON(r);case et.RecordBatch:return zt.fromJSON(r);case et.DictionaryBatch:return ye.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${et[t]}, type: ${t} }`)})}function dS(r,t){return(()=>{switch(t){case et.Schema:return P.decode(r.header(new Ge),new Map,r.version());case et.RecordBatch:return zt.decode(r.header(new oe),r.version());case et.DictionaryBatch:return ye.decode(r.header(new bn),r.version())}throw new Error(`Unrecognized Message type: { name: ${et[t]}, type: ${t} }`)})}function pS(r,t=new Map,e=ht.V5){let n=vS(r,t);return new P(n,Gl(r),t,e)}function mS(r,t=ht.V5){return new zt(r.length(),wS(r),xS(r,t),X0(r.compression()),AS(r))}function yS(r,t=ht.V5){return new ye(zt.decode(r.data(),t),r.id(),r.isDelta())}function gS(r){return new Nt(r.offset(),r.length())}function bS(r){return new gr(r.length(),r.nullCount())}function wS(r){let t=[];for(let e,n=-1,s=-1,i=r.nodesLength();++n<i;)(e=r.nodes(n))&&(t[++s]=gr.decode(e));return t}function xS(r,t){let e=[];for(let n,s=-1,i=-1,o=r.buffersLength();++s<o;)(n=r.buffers(s))&&(t<ht.V4&&(n.bb_pos+=8*(s+1)),e[++i]=Nt.decode(n));return e}function AS(r){let t=[],e=Math.trunc(r.variadicBufferCountsLength());for(let n=0;n<e;++n)t.push(Q(r.variadicBufferCounts(n)));return t}function vS(r,t){let e=[];for(let n,s=-1,i=-1,o=r.fieldsLength();++s<o;)(n=r.fields(s))&&(e[++i]=B.decode(n,t));return e}function Y0(r,t){let e=[];for(let n,s=-1,i=-1,o=r.childrenLength();++s<o;)(n=r.children(s))&&(e[++i]=B.decode(n,t));return e}function SS(r,t){let e,n,s,i,o,a;return!t||!(a=r.dictionary())?(s=H0(r,Y0(r,t)),n=new B(r.name(),s,r.nullable(),Gl(r))):t.has(e=Q(a.id()))?(i=(i=a.indexType())?Z0(i):new Dt,o=new Rt(t.get(e),i,e,a.isOrdered()),n=new B(r.name(),o,r.nullable(),Gl(r))):(i=(i=a.indexType())?Z0(i):new Dt,t.set(e,s=H0(r,Y0(r,t))),o=new Rt(s,i,e,a.isOrdered()),n=new B(r.name(),o,r.nullable(),Gl(r))),n||null}function Gl(r){let t=new Map;if(r)for(let e,n,s=-1,i=Math.trunc(r.customMetadataLength());++s<i;)(e=r.customMetadata(s))&&(n=e.key())!=null&&t.set(n,e.value());return t}function BS(r){let t=new Map;for(let e,n,s=-1,i=Math.trunc(r.customMetadataLength());++s<i;)(e=r.customMetadata(s))&&(n=e.key())!=null&&t.set(n,e.value());return t}function Z0(r){return new Lt(r.isSigned(),r.bitWidth())}function H0(r,t){let e=r.typeType();switch(e){case V.NONE:return new Ot;case V.Null:return new Ot;case V.Binary:return new je;case V.LargeBinary:return new Rr;case V.BinaryView:return new H;case V.Utf8:return new le;case V.LargeUtf8:return new Pr;case V.Utf8View:return new Te;case V.Bool:return new ue;case V.List:return new Ct((t||[])[0]);case V.LargeList:return new nr((t||[])[0]);case V.Struct_:return new ot(t||[])}switch(e){case V.Int:{let n=r.type(new Cr);return new Lt(n.isSigned(),n.bitWidth())}case V.FloatingPoint:{let n=r.type(new ts);return new ce(n.precision())}case V.Decimal:{let n=r.type(new tn);return new $e(n.scale(),n.precision(),n.bitWidth())}case V.Date:{let n=r.type(new Xn);return new Me(n.unit())}case V.Time:{let n=r.type(new wn);return new Jt(n.unit(),n.bitWidth())}case V.Timestamp:{let n=r.type(new xn);return new Qt(n.unit(),n.timezone())}case V.Interval:{let n=r.type(new es);return new fe(n.unit())}case V.Duration:{let n=r.type(new Kn);return new De(n.unit())}case V.Union:{let n=r.type(new Fr);return new Ce(n.mode(),n.typeIdsArray()||[],t||[])}case V.FixedSizeBinary:{let n=r.type(new Jn);return new qe(n.byteWidth())}case V.FixedSizeList:{let n=r.type(new Qn);return new gt(n.listSize(),(t||[])[0])}case V.Map:{let n=r.type(new rs);return new he((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${V[e]}" (${e})`)}function X0(r){return r?new Si(r.codec(),r.method()):null}function IS(r,t){let e=t.fields.map(i=>B.encode(r,i));Ge.startFieldsVector(r,e.length);let n=Ge.createFieldsVector(r,e),s=t.metadata&&t.metadata.size>0?Ge.createCustomMetadataVector(r,[...t.metadata].map(([i,o])=>{let a=r.createString(`${i}`),c=r.createString(`${o}`);return Tt.startKeyValue(r),Tt.addKey(r,a),Tt.addValue(r,c),Tt.endKeyValue(r)})):-1;return Ge.startSchema(r),Ge.addFields(r,n),Ge.addEndianness(r,CS?Hn.Little:Hn.Big),s!==-1&&Ge.addCustomMetadata(r,s),Ge.endSchema(r)}function _S(r,t){let e=-1,n=-1,s=-1,i=t.type,o=t.typeId;x.isDictionary(i)?(o=i.dictionary.typeId,s=zl.visit(i,r),n=zl.visit(i.dictionary,r)):n=zl.visit(i,r);let a=(i.children||[]).map(u=>B.encode(r,u)),c=ae.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?ae.createCustomMetadataVector(r,[...t.metadata].map(([u,f])=>{let h=r.createString(`${u}`),p=r.createString(`${f}`);return Tt.startKeyValue(r),Tt.addKey(r,h),Tt.addValue(r,p),Tt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),ae.startField(r),ae.addType(r,n),ae.addTypeType(r,o),ae.addChildren(r,c),ae.addNullable(r,!!t.nullable),e!==-1&&ae.addName(r,e),s!==-1&&ae.addDictionary(r,s),l!==-1&&ae.addCustomMetadata(r,l),ae.endField(r)}function LS(r,t){let e=t.nodes||[],n=t.buffers||[],s=t.variadicBufferCounts||[];oe.startNodesVector(r,e.length);for(let l of e.slice().reverse())gr.encode(r,l);let i=r.endVector();oe.startBuffersVector(r,n.length);for(let l of n.slice().reverse())Nt.encode(r,l);let o=r.endVector(),a=null;t.compression!==null&&(a=K0(r,t.compression));let c=-1;return s.length>0&&(c=oe.createVariadicBufferCountsVector(r,s.map(BigInt))),oe.startRecordBatch(r),oe.addLength(r,BigInt(t.length)),oe.addNodes(r,i),oe.addBuffers(r,o),t.compression!==null&&a&&oe.addCompression(r,a),c!==-1&&oe.addVariadicBufferCounts(r,c),oe.endRecordBatch(r)}function K0(r,t){return gn.startBodyCompression(r),gn.addCodec(r,t.type),gn.addMethod(r,t.method),gn.endBodyCompression(r)}function TS(r,t){let e=zt.encode(r,t.data);return bn.startDictionaryBatch(r),bn.addId(r,BigInt(t.id)),bn.addIsDelta(r,t.isDelta),bn.addData(r,e),bn.endDictionaryBatch(r)}function MS(r,t){return Bo.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function DS(r,t){return So.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var uS,fS,ge,zt,ye,Nt,gr,Si,CS,ws=d(()=>{it();Sh();sl();ch();Hy();oh();vh();ah();il();Io();lh();yh();hh();fh();wh();xh();gh();dh();Ah();ph();mh();bh();N0();ih();sh();me();Gt();en();Mt();U0();W0();yt();uS=di,fS=Ht,ge=class r{static fromJSON(t,e){let n=new r(0,ht.V5,e);return n._createHeader=hS(t,e),n}static decode(t){t=new fS(O(t));let e=ar.getRootAsMessage(t),n=e.bodyLength(),s=e.version(),i=e.headerType(),o=BS(e),a=new r(n,s,i,void 0,o);return a._createHeader=dS(e,i),a}static encode(t){let e=new uS,n=-1;t.isSchema()?n=P.encode(e,t.header()):t.isRecordBatch()?n=zt.encode(e,t.header()):t.isDictionaryBatch()&&(n=ye.encode(e,t.header()));let s=t.metadata&&t.metadata.size>0?ar.createCustomMetadataVector(e,[...t.metadata].map(([i,o])=>{let a=e.createString(`${i}`),c=e.createString(`${o}`);return Tt.startKeyValue(e),Tt.addKey(e,a),Tt.addValue(e,c),Tt.endKeyValue(e)})):-1;return ar.startMessage(e),ar.addVersion(e,ht.V5),ar.addHeader(e,n),ar.addHeaderType(e,t.headerType),ar.addBodyLength(e,BigInt(t.bodyLength)),s!==-1&&ar.addCustomMetadata(e,s),ar.finishMessageBuffer(e,ar.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof P)return new r(0,ht.V5,et.Schema,t);if(t instanceof zt)return new r(e,ht.V5,et.RecordBatch,t,t.metadata);if(t instanceof ye)return new r(e,ht.V5,et.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===et.Schema}isRecordBatch(){return this.headerType===et.RecordBatch}isDictionaryBatch(){return this.headerType===et.DictionaryBatch}constructor(t,e,n,s,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),this._compression=s?.compression,s&&(this._createHeader=()=>s),this._bodyLength=Q(t),this._metadata=i||new Map}},zt=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(t,e,n,s,i=[],o){this._nodes=e,this._buffers=n,this._length=Q(t),this._compression=s,this._variadicBufferCounts=i,this._metadata=o||new Map}},ye=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=Q(e)}},Nt=class{constructor(t,e){this.offset=Q(t),this.length=Q(e)}},gr=class{constructor(t,e){this.length=Q(t),this.nullCount=Q(e)}},Si=class{constructor(t,e=pi.BUFFER){this.type=t,this.method=e}};B.encode=_S;B.decode=SS;B.fromJSON=q0;P.encode=IS;P.decode=pS;P.fromJSON=z0;zt.encode=LS;zt.decode=mS;zt.fromJSON=td;ye.encode=TS;ye.decode=yS;ye.fromJSON=V0;gr.encode=MS;gr.decode=bS;Nt.encode=DS;Nt.decode=gS;Si.encode=K0;Si.decode=X0;CS=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})()});var vt,Qa,Bi,jl,tc=d(()=>{Ve();Ba();vt=Object.freeze({done:!0,value:void 0}),Qa=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Bi=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},jl=class extends Bi{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return _(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(vt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Zt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Zt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return _(this,void 0,void 0,function*(){return yield this.abort(t),vt})}return(t){return _(this,void 0,void 0,function*(){return yield this.close(),vt})}read(t){return _(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return _(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(vt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}});var br,wr,Ze,ed,In,xs=d(()=>{Ve();Ba();yn();tc();Gt();Zn();br=class extends jl{write(t){if((t=O(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?xo(this.toUint8Array(!0)):this.toUint8Array(!1).then(xo)}toUint8Array(t=!1){return t?er(this._values)[0]:_(this,void 0,void 0,function*(){var e,n,s,i;let o=[],a=0;try{for(var c=!0,l=Je(this),u;u=yield l.next(),e=u.done,!e;c=!0){i=u.value,c=!1;let f=i;o.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!e&&(s=l.return)&&(yield s.call(l))}finally{if(n)throw n.error}}return er(o,a)[0]})}},wr=class{constructor(t){t&&(this.source=new ed(Zt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Ze=class r{constructor(t){t instanceof r?this.source=t.source:t instanceof br?this.source=new In(Zt.fromAsyncIterable(t)):Xc(t)?this.source=new In(Zt.fromNodeStream(t)):Aa(t)?this.source=new In(Zt.fromDOMStream(t)):Zc(t)?this.source=new In(Zt.fromDOMStream(t.body)):Tr(t)?this.source=new In(Zt.fromIterable(t)):tr(t)?this.source=new In(Zt.fromAsyncIterable(t)):dr(t)&&(this.source=new In(Zt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},ed=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||vt)}return(t){return Object.create(this.source.return&&this.source.return(t)||vt)}},In=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return _(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return _(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return _(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return _(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return _(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||vt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return _(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||vt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}});var ec,As,rd=d(()=>{Ve();xs();Gt();ec=class extends wr{constructor(t,e){super(),this.position=0,this.buffer=O(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:n,position:s}=this;return e&&s<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,s+Math.min(n-s,t)),e.subarray(s,this.position)):null}readAt(t,e){let n=this.buffer,s=Math.min(this.size,t+e);return n?n.subarray(t,s):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},As=class extends Ze{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=_(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return _(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return _(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return _(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:s}=this;if(e&&s<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let i=s,o=0,a=0,c=Math.min(n,i+Math.min(n-i,t)),l=new Uint8Array(Math.max(0,(this.position=c)-i));for(;(i+=a)<c&&(o+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,o,l.byteLength-o,i));return l}return null})}readAt(t,e){return _(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:s}=this;if(n&&t+e<s){let i=Math.min(s,t+e),o=new Uint8Array(i-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return _(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return _(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return _(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}});var sd={};ze(sd,{BaseInt64:()=>rc,Int128:()=>nc,Int64:()=>_n,Uint64:()=>Ft});function zo(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Vo,nd,rc,Ft,_n,nc,id=d(()=>{Vo=8,nd=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],rc=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),s=e[3]*n[3];this.buffer[0]=s&65535;let i=s>>>16;return s=e[2]*n[3],i+=s,s=e[3]*n[2]>>>0,i+=s,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<s?65536:0,this.buffer[1]+=i>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${zo(this.buffer[1])} ${zo(this.buffer[0])}`}},Ft=class r extends rc{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,s=new r(e);for(let i=0;i<n;){let o=Vo<n-i?Vo:n-i,a=new r(new Uint32Array([Number.parseInt(t.slice(i,i+o),10),0])),c=new r(new Uint32Array([nd[o],0]));s.times(c),s.plus(a),i+=o}return s}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,s=t.length;++n<s;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},_n=class r extends rc{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),s=t.length,i=new r(e);for(let o=n?1:0;o<s;){let a=Vo<s-o?Vo:s-o,c=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new r(new Uint32Array([nd[a],0]));i.times(l),i.plus(c),o+=a}return n?i.negate():i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,s=t.length;++n<s;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},nc=class r{constructor(t){this.buffer=t}high(){return new _n(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new _n(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let e=new Ft(new Uint32Array([this.buffer[3],0])),n=new Ft(new Uint32Array([this.buffer[2],0])),s=new Ft(new Uint32Array([this.buffer[1],0])),i=new Ft(new Uint32Array([this.buffer[0],0])),o=new Ft(new Uint32Array([t.buffer[3],0])),a=new Ft(new Uint32Array([t.buffer[2],0])),c=new Ft(new Uint32Array([t.buffer[1],0])),l=new Ft(new Uint32Array([t.buffer[0],0])),u=Ft.multiply(i,l);this.buffer[0]=u.low();let f=new Ft(new Uint32Array([u.high(),0]));return u=Ft.multiply(s,l),f.plus(u),u=Ft.multiply(i,c),f.plus(u),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(u)?1:0,this.buffer[2]=f.high(),new Ft(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Ft.multiply(n,l)).plus(Ft.multiply(s,c)).plus(Ft.multiply(i,a)),this.buffer[3]+=Ft.multiply(e,l).plus(Ft.multiply(n,c)).plus(Ft.multiply(s,a)).plus(Ft.multiply(i,o)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${zo(this.buffer[3])} ${zo(this.buffer[2])} ${zo(this.buffer[1])} ${zo(this.buffer[0])}`}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),s=t.length,i=new r(e);for(let o=n?1:0;o<s;){let a=Vo<s-o?Vo:s-o,c=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new r(new Uint32Array([nd[a],0,0,0]));i.times(l),i.plus(c),o+=a}return n?i.negate():i}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,s=t.length;++n<s;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+16*n,4));return e}}});var ud={};ze(ud,{toIntervalDayTimeInt32Array:()=>od,toIntervalDayTimeObjects:()=>cd,toIntervalMonthDayNanoInt32Array:()=>ad,toIntervalMonthDayNanoObjects:()=>ld});function od(r){var t,e;let n=r.length,s=new Int32Array(n*2);for(let i=0,o=0;i<n;i++){let a=r[i];s[o++]=(t=a.days)!==null&&t!==void 0?t:0,s[o++]=(e=a.milliseconds)!==null&&e!==void 0?e:0}return s}function ad(r){var t,e;let n=r.length,s=new Int32Array(n*4);for(let i=0,o=0;i<n;i++){let a=r[i];s[o++]=(t=a.months)!==null&&t!==void 0?t:0,s[o++]=(e=a.days)!==null&&e!==void 0?e:0;let c=a.nanoseconds;if(c){let l=BigInt(c);s[o++]=Number(l&BigInt(4294967295))>>>0,s[o++]=Number(l>>BigInt(32))>>>0}else o+=2}return s}function cd(r){let t=r.length,e=new Array(t/2);for(let n=0,s=0;n<t;n+=2)e[s++]={days:r[n],milliseconds:r[n+1]};return e}function ld(r,t){let e=r.length,n=new Array(e/4);for(let s=0,i=0;s<e;s+=4){let o=BigInt(r[s+3])<<BigInt(32)|BigInt(r[s+2]>>>0);n[i++]={months:r[s],days:r[s+1],nanoseconds:t?`${o}`:o}}return n}var $l=d(()=>{});function Q0(r){let t=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2)t[e>>1]=Number.parseInt(r.slice(e,e+2),16);return t}function FS(r){return Q0(r.join(""))}function tb(r,t){let e=new Uint8Array(r.length*16),n=new DataView(e.buffer);for(let[s,i]of r.entries()){let o=s*16,a=i.SIZE;if(n.setInt32(o,a,!0),i.INLINED!==void 0){let c=t(i.INLINED);for(let l=0;l<c.length&&l<12;l++)e[o+4+l]=c[l]}else{let c=i.PREFIX_HEX;for(let l=0;l<8&&l<c.length;l+=2)e[o+4+(l>>1)]=Number.parseInt(c.slice(l,l+2),16);n.setInt32(o+8,i.BUFFER_INDEX,!0),n.setInt32(o+12,i.OFFSET,!0)}}return e}function ES(r){return tb(r,t=>{let e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n>>1]=Number.parseInt(t.slice(n,n+2),16);return e})}function OS(r){return tb(r,t=>new TextEncoder().encode(t))}var Go,ql,Wl,eb=d(()=>{yr();me();yt();We();xi();yn();id();Mt();Gt();$l();Go=class extends F{constructor(t,e,n,s,i=ht.V5,o=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=s,this.metadataVersion=i,this.variadicBufferCounts=o}visit(t){return super.visit(t instanceof B?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return D({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitUtf8View(t,{length:e,nullCount:n}=this.nextFieldNode()){let s=this.readNullBitmap(t,n),i=this.readData(t),o=this.readVariadicBuffers(this.nextVariadicBufferCount());return D({type:t,length:e,nullCount:n,nullBitmap:s,views:i,variadicBuffers:o})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinaryView(t,{length:e,nullCount:n}=this.nextFieldNode()){let s=this.readNullBitmap(t,n),i=this.readData(t),o=this.readVariadicBuffers(this.nextVariadicBufferCount());return D({type:t,length:e,nullCount:n,nullBitmap:s,views:i,variadicBuffers:o})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitLargeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<ht.V5&&this.readNullBitmap(t,n),t.mode===ut.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return D({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readVariadicBuffers(t){return Array.from({length:t},()=>this.readData(null))}nextVariadicBufferCount(){var t;return(t=this.variadicBufferCounts[++this.variadicBufferIndex])!==null&&t!==void 0?t:0}readDictionary(t){return this.dictionaries.get(t.id)}},ql=class extends Go{constructor(t,e,n,s,i,o=[]){super(new Uint8Array(0),e,n,s,i,o),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):wi(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return J(Uint8Array,J(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return J(Uint8Array,J(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;if(x.isTimestamp(t))return J(Uint8Array,_n.convertArray(n[e]));if((x.isInt(t)||x.isTime(t))&&t.bitWidth===64||x.isDuration(t))return J(Uint8Array,_n.convertArray(n[e]));if(x.isDate(t)&&t.unit===mt.MILLISECOND)return J(Uint8Array,_n.convertArray(n[e]));if(x.isDecimal(t))return J(Uint8Array,nc.convertArray(n[e]));if(x.isBinary(t)||x.isLargeBinary(t)||x.isFixedSizeBinary(t))return FS(n[e]);if(x.isBinaryView(t))return ES(n[e]);if(x.isUtf8View(t))return OS(n[e]);if(x.isBool(t))return wi(n[e]);if(x.isUtf8(t)||x.isLargeUtf8(t))return Qe(n[e].join(""));if(x.isInterval(t))switch(t.unit){case nt.DAY_TIME:return od(n[e]);case nt.MONTH_DAY_NANO:return ad(n[e]);default:break}return J(Uint8Array,J(t.ArrayType,n[e].map(s=>+s)))}readVariadicBuffers(t){let e=[];for(let n=0;n<t;n++){let{offset:s}=this.nextBufferRange(),i=this.sources[s];e.push(Q0(i))}return e}};Wl=class extends Go{constructor(t,e,n,s,i,o=[]){super(new Uint8Array(0),e,n,s,i,o),this.bodyChunks=t}readData(t,e=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}}});var Ln,Yl=d(()=>{zr();At();Gt();Ln=class extends pe{constructor(t){super(t),this._values=new Ye(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,O(e))}_flushPending(t,e){let n=this._offsets,s=this._values.reserve(e).buffer,i=0;for(let[o,a]of t)if(a===void 0)n.set(o,0);else{let c=a.length;s.set(a,i),n.set(o,c),i+=c}}}});var Tn,Zl=d(()=>{Gt();zr();At();Tn=class extends pe{constructor(t){super(t),this._values=new Ye(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,O(e))}_flushPending(t,e){let n=this._offsets,s=this._values.reserve(e).buffer,i=0;for(let[o,a]of t)if(a===void 0)n.set(o,BigInt(0));else{let c=a.length;s.set(a,i),n.set(o,BigInt(c)),i+=c}}}});var Ii,fd=d(()=>{zr();At();Ii=class extends bt{constructor(t){super(t),this._values=new ko}setValue(t,e){this._values.set(t,+e)}}});var on,vs,Ss,hd=d(()=>{At();ir();on=class extends kt{};on.prototype._setValue=Fh;vs=class extends on{};vs.prototype._setValue=ll;Ss=class extends on{};Ss.prototype._setValue=ul});var Bs,dd=d(()=>{At();ir();Bs=class extends kt{};Bs.prototype._setValue=Nh});var _i,pd=d(()=>{yt();At();sc();_i=class extends bt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Rt(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Gr({type:this.type.indices,nullValues:e}),this.dictionary=Gr({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,s=this.valueToKey(e),i=n[s];return i===void 0&&(n[s]=i=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,i)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),s=this.indices.flush().clone(t);return s.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}}});var Is,md=d(()=>{At();ir();Is=class extends kt{};Is.prototype._setValue=Ch});var Li,yd=d(()=>{me();At();yt();Li=class extends bt{setValue(t,e){let[n]=this.children,s=t*this.stride;for(let i=-1,o=this.stride;++i<o;)n.set(s+i,e[i])}setValid(t,e){return super.setValid(t,e)||this.children[0].setValid((t+1)*this.stride-1,!1),e}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new gt(this.type.listSize,new B(e,t.type,!0)),n}}});var an,Ti,Mi,Di,gd=d(()=>{Ya();At();an=class extends kt{setValue(t,e){this._values.set(t,e)}},Ti=class extends an{setValue(t,e){super.setValue(t,Wa(e))}},Mi=class extends an{},Di=class extends an{}});var jr,_s,Ls,Ts,bd=d(()=>{At();ir();jr=class extends kt{};jr.prototype._setValue=Uh;_s=class extends jr{};_s.prototype._setValue=wl;Ls=class extends jr{};Ls.prototype._setValue=xl;Ts=class extends jr{};Ts.prototype._setValue=Al});var xr,Ms,Ds,Cs,Fs,wd=d(()=>{At();ir();xr=class extends kt{};xr.prototype._setValue=Rh;Ms=class extends xr{};Ms.prototype._setValue=vl;Ds=class extends xr{};Ds.prototype._setValue=Sl;Cs=class extends xr{};Cs.prototype._setValue=Bl;Fs=class extends xr{};Fs.prototype._setValue=Il});var Fe,Ci,Fi,Ei,Oi,Ni,Ui,Ri,Pi,xd=d(()=>{At();Fe=class extends kt{setValue(t,e){this._values.set(t,e)}},Ci=class extends Fe{},Fi=class extends Fe{},Ei=class extends Fe{},Oi=class extends Fe{},Ni=class extends Fe{},Ui=class extends Fe{},Ri=class extends Fe{},Pi=class extends Fe{}});var ki,Ad=d(()=>{me();yt();zr();At();ki=class extends pe{constructor(t){super(t),this._offsets=new bs(t.type)}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ct(new B(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[s,i]of t)if(typeof i>"u")e.set(s,0);else{let o=i,a=o.length,c=e.set(s,a).buffer[s];for(let l=-1;++l<a;)n.set(c+l,o[l])}}}});var zi,vd=d(()=>{me();yt();zr();en();At();zi=class extends pe{constructor(t){super(t),this._offsets=new bs(t.type)}addChild(t,e="0"){if(this.numChildren>0)throw new Error("LargeListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new nr(new B(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[s,i]of t)if(typeof i>"u")e.set(s,BigInt(0));else{let o=i,a=o.length,c=Q(e.set(s,BigInt(a)).buffer[s]);for(let l=-1;++l<a;)n.set(c+l,o[l])}}}});var Vi,Sd=d(()=>{me();yt();At();Vi=class extends pe{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),s=this._pending||(this._pending=new Map),i=s.get(t);i&&(this._pendingLength-=i.size),this._pendingLength+=n.size,s.set(t,n)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new he(new B(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[s,i]of t)if(i===void 0)e.set(s,0);else{let{[s]:o,[s+1]:a}=e.set(s,i.size).buffer;for(let c of i.entries())if(n.set(o,c),++o>=a)break}}}});var Gi,Bd=d(()=>{At();Gi=class extends bt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}}});var ji,Id=d(()=>{me();At();yt();ji=class extends bt{setValue(t,e){let{children:n,type:s}=this;switch(Array.isArray(e)||e.constructor){case!0:return s.children.forEach((i,o)=>n[o].set(t,e[o]));case Map:return s.children.forEach((i,o)=>n[o].set(t,e.get(i.name)));default:return s.children.forEach((i,o)=>n[o].set(t,e[i.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){let n=this.children.push(t);return this.type=new ot([...this.type.children,new B(e,t.type,!0)]),n}}});var Ar,Es,Os,Ns,Us,_d=d(()=>{At();ir();Ar=class extends kt{};Ar.prototype._setValue=Eh;Es=class extends Ar{};Es.prototype._setValue=fl;Os=class extends Ar{};Os.prototype._setValue=hl;Ns=class extends Ar{};Ns.prototype._setValue=dl;Us=class extends Ar{};Us.prototype._setValue=pl});var vr,Rs,Ps,ks,zs,Ld=d(()=>{At();ir();vr=class extends kt{};vr.prototype._setValue=Oh;Rs=class extends vr{};Rs.prototype._setValue=ml;Ps=class extends vr{};Ps.prototype._setValue=yl;ks=class extends vr{};ks.prototype._setValue=gl;zs=class extends vr{};zs.prototype._setValue=bl});var Mn,$i,qi,Td=d(()=>{me();zr();At();yt();Mn=class extends bt{constructor(t){super(t),this._typeIds=new Sn(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let s=this.type.typeIdToChildIndex[n],i=this.children[s];i?.set(t,e),this.length=Math.max(t+1,this.length)}addChild(t,e=`${this.children.length}`){let n=this.children.push(t),{type:{children:s,mode:i,typeIds:o}}=this,a=[...s,new B(e,t.type)];return this.type=new Ce(i,[...o,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},$i=class extends Mn{},qi=class extends Mn{constructor(t){super(t),this._offsets=new Sn(Int32Array)}setValue(t,e,n){let s=this._typeIds.set(t,n).buffer[t],i=this.getChildAt(this.type.typeIdToChildIndex[s]),o=this._offsets.set(t,i.length).buffer[t];i?.set(o,e),this.length=Math.max(t+1,this.length)}}});var Vs,Md=d(()=>{yn();Yl();zr();At();Vs=class extends pe{constructor(t){super(t),this._values=new Ye(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Qe(e))}_flushPending(t,e){}};Vs.prototype._flushPending=Ln.prototype._flushPending});var Gs,Dd=d(()=>{yn();zr();At();Zl();Gs=class extends pe{constructor(t){super(t),this._values=new Ye(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Qe(e))}_flushPending(t,e){}};Gs.prototype._flushPending=Tn.prototype._flushPending});var Dn,Hl=d(()=>{yt();At();zr();Gt();yr();Dn=class extends bt{constructor(t){super(t),this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._bufferSize=32*1024*1024,this._views=new Ye(Uint8Array)}get byteLength(){let t=0;this._views&&(t+=this._views.byteLength),this._nulls&&(t+=this._nulls.byteLength);for(let e of this._variadicBuffers)t+=e.byteLength;return this._currentBuffer&&(t+=this._currentBuffer.byteLength),t}setValue(t,e){return this.writeBinaryValue(t,this.encodeValue(e))}writeBinaryValue(t,e){let n=e.length,s=(t+1)*H.ELEMENT_WIDTH,i=this._views.length;s>i&&this._views.reserve(s-i);let o=this._views.buffer,a=t*H.ELEMENT_WIDTH,c=new DataView(o.buffer,o.byteOffset+a,H.ELEMENT_WIDTH);if(c.setInt32(H.LENGTH_OFFSET,n,!0),n<=H.INLINE_CAPACITY){o.set(e,a+H.INLINE_OFFSET);for(let l=n;l<H.INLINE_CAPACITY;l++)o[a+H.INLINE_OFFSET+l]=0}else{let l=new DataView(e.buffer,e.byteOffset,Math.min(4,n));c.setUint32(H.INLINE_OFFSET,l.getUint32(0,!0),!0),(!this._currentBuffer||this._currentBufferOffset+n>this._bufferSize)&&(this._currentBuffer&&this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=new Ye(Uint8Array),this._currentBufferIndex=this._variadicBuffers.length,this._currentBufferOffset=0),this._currentBuffer.reserve(n).buffer.set(e,this._currentBufferOffset),c.setInt32(H.BUFFER_INDEX_OFFSET,this._currentBufferIndex,!0),c.setInt32(H.BUFFER_OFFSET_OFFSET,this._currentBufferOffset,!0),this._currentBufferOffset+=n}return this}encodeValue(t){return O(t)}setValid(t,e){let n=(t+1)*H.ELEMENT_WIDTH,s=this._views.length;n>s&&this._views.reserve(n-s);let i=super.setValid(t,e);if(!i){let o=this._views.buffer,a=t*H.ELEMENT_WIDTH;for(let c=0;c<H.ELEMENT_WIDTH;c++)o[a+c]=0}return i}clear(){return this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._views.clear(),super.clear()}flush(){let{type:t,length:e,nullCount:n,_views:s,_nulls:i}=this;this._currentBuffer&&this._currentBufferOffset>0&&(this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=null,this._currentBufferOffset=0);let o=s.flush(e*H.ELEMENT_WIDTH),a=n>0?i.flush(e):void 0,c=this._variadicBuffers.slice();return this._variadicBuffers=[],this._currentBufferIndex=0,this.clear(),D({type:t,length:e,nullCount:n,nullBitmap:a,views:o,variadicBuffers:c})}finish(){return this.finished=!0,this}}});var Wi,Cd=d(()=>{Hl();yn();Wi=class extends Dn{constructor(t){super(t)}setValue(t,e){return this.writeBinaryValue(t,Qe(e))}}});var Fd,rb,nb=d(()=>{We();Yl();Zl();fd();hd();dd();pd();md();yd();gd();bd();wd();xd();Ad();vd();Sd();Bd();Id();_d();Ld();Td();Md();Dd();Hl();Cd();Fd=class extends F{visitNull(){return Gi}visitBool(){return Ii}visitInt(){return Fe}visitInt8(){return Ci}visitInt16(){return Fi}visitInt32(){return Ei}visitInt64(){return Oi}visitUint8(){return Ni}visitUint16(){return Ui}visitUint32(){return Ri}visitUint64(){return Pi}visitFloat(){return an}visitFloat16(){return Ti}visitFloat32(){return Mi}visitFloat64(){return Di}visitUtf8(){return Vs}visitLargeUtf8(){return Gs}visitBinary(){return Ln}visitLargeBinary(){return Tn}visitFixedSizeBinary(){return Is}visitDate(){return on}visitDateDay(){return vs}visitDateMillisecond(){return Ss}visitTimestamp(){return Ar}visitTimestampSecond(){return Es}visitTimestampMillisecond(){return Os}visitTimestampMicrosecond(){return Ns}visitTimestampNanosecond(){return Us}visitTime(){return vr}visitTimeSecond(){return Rs}visitTimeMillisecond(){return Ps}visitTimeMicrosecond(){return ks}visitTimeNanosecond(){return zs}visitDecimal(){return Bs}visitList(){return ki}visitLargeList(){return zi}visitStruct(){return ji}visitUnion(){return Mn}visitDenseUnion(){return qi}visitSparseUnion(){return $i}visitDictionary(){return _i}visitInterval(){return jr}visitIntervalDayTime(){return _s}visitIntervalYearMonth(){return Ls}visitIntervalMonthDayNano(){return Ts}visitDuration(){return xr}visitDurationSecond(){return Ms}visitDurationMillisecond(){return Ds}visitDurationMicrosecond(){return Cs}visitDurationNanosecond(){return Fs}visitFixedSizeList(){return Li}visitMap(){return Vi}visitBinaryView(){return Dn}visitUtf8View(){return Wi}},rb=new Fd});function Ee(r,t){return t instanceof r.constructor}function Cn(r,t){return r===t||Ee(r,t)}function Fn(r,t){return r===t||Ee(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Xl(r,t){return r===t||Ee(r,t)&&r.precision===t.precision}function NS(r,t){return r===t||Ee(r,t)&&r.byteWidth===t.byteWidth}function Ed(r,t){return r===t||Ee(r,t)&&r.unit===t.unit}function ic(r,t){return r===t||Ee(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function oc(r,t){return r===t||Ee(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function sb(r,t){return r===t||Ee(r,t)&&r.children.length===t.children.length&&cn.compareManyFields(r.children,t.children)}function US(r,t){return r===t||Ee(r,t)&&r.children.length===t.children.length&&cn.compareManyFields(r.children,t.children)}function Od(r,t){return r===t||Ee(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&cn.compareManyFields(r.children,t.children)}function RS(r,t){return r===t||Ee(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&cn.visit(r.indices,t.indices)&&cn.visit(r.dictionary,t.dictionary)}function Kl(r,t){return r===t||Ee(r,t)&&r.unit===t.unit}function ac(r,t){return r===t||Ee(r,t)&&r.unit===t.unit}function PS(r,t){return r===t||Ee(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&cn.compareManyFields(r.children,t.children)}function kS(r,t){return r===t||Ee(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&cn.compareManyFields(r.children,t.children)}function Yi(r,t){return cn.compareSchemas(r,t)}function ib(r,t){return cn.compareFields(r,t)}function Jl(r,t){return cn.visit(r,t)}var k,cn,cc=d(()=>{We();k=class extends F{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,s)=>this.compareFields(n,e[s]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};k.prototype.visitNull=Cn;k.prototype.visitBool=Cn;k.prototype.visitInt=Fn;k.prototype.visitInt8=Fn;k.prototype.visitInt16=Fn;k.prototype.visitInt32=Fn;k.prototype.visitInt64=Fn;k.prototype.visitUint8=Fn;k.prototype.visitUint16=Fn;k.prototype.visitUint32=Fn;k.prototype.visitUint64=Fn;k.prototype.visitFloat=Xl;k.prototype.visitFloat16=Xl;k.prototype.visitFloat32=Xl;k.prototype.visitFloat64=Xl;k.prototype.visitUtf8=Cn;k.prototype.visitLargeUtf8=Cn;k.prototype.visitUtf8View=Cn;k.prototype.visitBinary=Cn;k.prototype.visitLargeBinary=Cn;k.prototype.visitBinaryView=Cn;k.prototype.visitFixedSizeBinary=NS;k.prototype.visitDate=Ed;k.prototype.visitDateDay=Ed;k.prototype.visitDateMillisecond=Ed;k.prototype.visitTimestamp=ic;k.prototype.visitTimestampSecond=ic;k.prototype.visitTimestampMillisecond=ic;k.prototype.visitTimestampMicrosecond=ic;k.prototype.visitTimestampNanosecond=ic;k.prototype.visitTime=oc;k.prototype.visitTimeSecond=oc;k.prototype.visitTimeMillisecond=oc;k.prototype.visitTimeMicrosecond=oc;k.prototype.visitTimeNanosecond=oc;k.prototype.visitDecimal=Cn;k.prototype.visitList=sb;k.prototype.visitLargeList=sb;k.prototype.visitStruct=US;k.prototype.visitUnion=Od;k.prototype.visitDenseUnion=Od;k.prototype.visitSparseUnion=Od;k.prototype.visitDictionary=RS;k.prototype.visitInterval=Kl;k.prototype.visitIntervalDayTime=Kl;k.prototype.visitIntervalYearMonth=Kl;k.prototype.visitIntervalMonthDayNano=Kl;k.prototype.visitDuration=ac;k.prototype.visitDurationSecond=ac;k.prototype.visitDurationMillisecond=ac;k.prototype.visitDurationMicrosecond=ac;k.prototype.visitDurationNanosecond=ac;k.prototype.visitFixedSizeList=PS;k.prototype.visitMap=kS;cn=new k});function Gr(r){let t=r.type,e=new(rb.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],s={nullValues:r.nullValues},i=Array.isArray(n)?((o,a)=>n[a]||s):(({name:o})=>n[o]||s);for(let[o,a]of t.children.entries()){let{type:c}=a,l=i(a,o);e.children.push(Gr(Object.assign(Object.assign({},l),{type:c})))}}return e}function jo(r,t){if(r instanceof M||r instanceof v||r.type instanceof x||ArrayBuffer.isView(r))return ee(r);let e={type:t??Ql(r),nullValues:[null]},n=[...tu(e)(r)],s=n.length===1?n[0]:n.reduce((i,o)=>i.concat(o));return x.isDictionary(s.type)?s.memoize():s}function Nd(r){let t=jo(r),e=new tt(new P(t.type.children),t.data[0]);return new X(e)}function Ql(r){if(r.length===0)return new Ot;let t=0,e=0,n=0,s=0,i=0,o=0,a=0,c=0;for(let l of r){if(l==null){++t;continue}switch(typeof l){case"bigint":++o;continue;case"boolean":++a;continue;case"number":++s;continue;case"string":++i;continue;case"object":Array.isArray(l)?++e:Object.prototype.toString.call(l)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(s+t===r.length)return new Le;if(i+t===r.length)return new Rt(new le,new Dt);if(o+t===r.length)return new rr;if(a+t===r.length)return new ue;if(c+t===r.length)return new rn;if(e+t===r.length){let l=r,u=Ql(l[l.findIndex(f=>f!=null)]);if(l.every(f=>f==null||Jl(u,Ql(f))))return new Ct(new B("",u,!0))}else if(n+t===r.length){let l=new Map;for(let u of r)for(let f of Object.keys(u))!l.has(f)&&u[f]!=null&&l.set(f,new B(f,Ql([u[f]]),!0));return new ot([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function tu(r){let{["queueingStrategy"]:t="count"}=r,{["highWaterMark"]:e=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=r,n=t!=="bytes"?"length":"byteLength";return function*(s){let i=0,o=Gr(r);for(let a of s)o.append(a)[n]>=e&&++i&&(yield o.toVector());(o.finish().length>0||i===0)&&(yield o.toVector())}}function Ud(r){let{["queueingStrategy"]:t="count"}=r,{["highWaterMark"]:e=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=r,n=t!=="bytes"?"length":"byteLength";return function(s){return Ae(this,arguments,function*(){var i,o,a,c;let l=0,u=Gr(r);try{for(var f=!0,h=Je(s),p;p=yield Y(h.next()),i=p.done,!i;f=!0){c=p.value,f=!1;let y=c;u.append(y)[n]>=e&&++l&&(yield yield Y(u.toVector()))}}catch(y){o={error:y}}finally{try{!f&&!i&&(a=h.return)&&(yield Y(a.call(h)))}finally{if(o)throw o.error}}(u.finish().length>0||l===0)&&(yield yield Y(u.toVector()))})}}var sc=d(()=>{Ve();me();yt();yr();de();nb();Zi();En();cc()});function eu(r,t){return zS(r,t.map(e=>e.data.concat()))}function zS(r,t){let e=[...r.fields],n=[],s={numBatches:t.reduce((f,h)=>Math.max(f,h.length),0)},i=0,o=0,a=-1,c=t.length,l,u=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=VS(e,o,u,t,s),o>0&&(n[i++]=D({type:new ot(e),length:o,nullCount:0,children:u.slice()})))}return[r=r.assign(e),n.map(f=>new tt(r,f))]}function VS(r,t,e,n,s){var i;let o=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=e[a],u=l?.length;if(u>=t)u===t?e[a]=l:(e[a]=l.slice(0,t),s.numBatches=Math.max(s.numBatches,n[a].unshift(l.slice(t,u-t))));else{let f=r[a];r[a]=f.clone({nullable:!0}),e[a]=(i=l?._changeLengthAndBackfillNullBitmap(t))!==null&&i!==void 0?i:D({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var ob=d(()=>{yr();yt();En()});function Rd(r){let t={},e=Object.entries(r);for(let[n,s]of e)t[n]=ee(s);return new X(t)}function Pd(r){let t={},e=Object.entries(r);for(let[n,s]of e)t[n]=jo(s);return new X(t)}var ab,cb,X,Zi=d(()=>{Mt();yr();sc();de();me();yt();cc();ob();Nl();yi();ir();Ul();Rl();No();En();cb=Symbol.for("apache-arrow/Table"),X=class r{static isTable(t){return t?.[cb]===!0}constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new P([]),this._offsets=[0],this;let s,i;t[0]instanceof P&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(i=t.pop());let o=c=>{if(c){if(c instanceof tt)return[c];if(c instanceof r)return c.batches;if(c instanceof M){if(c.type instanceof ot)return[new tt(new P(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>o(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>o(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(p=>new v([c[p]])),f=s??new P(l.map((p,y)=>new B(String(p),u[y].type,u[y].nullable))),[,h]=eu(f,u);return h.length===0?[new tt(c)]:h}}}return[]},a=t.flatMap(c=>o(c));if(s=(n=s??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new P([]),!(s instanceof P))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof tt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Yi(s,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=i??Cl(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Dl(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(gi(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Po.visit(new v(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
14
+ ${this.toArray().join(`,
15
+ `)}
16
+ ]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:s})=>s));return new r(e,n.map(s=>new tt(e,s)))}slice(t,e){let n=this.schema;[t,e]=Ha({length:this.numRows},t,e);let s=Fl(this.data,this._offsets,t,e);return new r(n,s.map(i=>new tt(n,i)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],s=D({type:n,length:0,nullCount:0});e.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new v(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===t),e)}setChildAt(t,e){let n=this.schema,s=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new v([D({type:new Ot,length:this.numRows})]));let i=n.fields.slice(),o=i[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[i[t],a[t]]=[o,e],[n,s]=eu(n,a)}return new r(n,s)}select(t){let e=this.schema.fields.reduce((n,s,i)=>n.set(s.name,i),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(s=>s.selectAt(t));return new r(e,n)}assign(t){let e=this.schema.fields,[n,s]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,h=e.findIndex(p=>p.name===c.name);return~h?f[h]=l:u.push(l),a},[[],[]]),i=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,s[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new r(...eu(i,o))}};ab=Symbol.toStringTag;X[ab]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r[cb]=!0,r.isValid=Ro(Ja),r.get=Ro(Pt.getVisitFn(m.Struct)),r.set=El(te.getVisitFn(m.Struct)),r.indexOf=Ol(Ai.getVisitFn(m.Struct)),"Table"))(X.prototype);Object.defineProperty(X,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===X&&X.isTable(t)}})});function lb(r,t,e=t.reduce((n,s)=>Math.max(n,s.length),0)){var n;let s=[...r.fields],i=[...t],o=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(s[a]=c.clone({nullable:!0}),i[a]=(n=l?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:D({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(s),D({type:new ot(s),length:e,children:i})]}function hb(r,t,e=new Map){var n,s;if(((n=r?.length)!==null&&n!==void 0?n:0)>0&&r?.length===t?.length)for(let i=-1,o=r.length;++i<o;){let{type:a}=r[i],c=t[i];for(let l of[c,...((s=c?.dictionary)===null||s===void 0?void 0:s.data)||[]])hb(a.children,l?.children,e);if(x.isDictionary(a)){let{id:l}=a;if(!e.has(l))c?.dictionary&&e.set(l,c.dictionary);else if(e.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var ub,fb,tt,Hi,En=d(()=>{yr();Zi();de();me();yt();No();yi();ir();Ul();Rl();fb=Symbol.for("apache-arrow/RecordBatch"),tt=class r{static isRecordBatch(t){return t?.[fb]===!0}constructor(...t){switch(t.length){case 3:case 2:{if([this.schema]=t,!(this.schema instanceof P))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=D({nullCount:0,type:new ot(this.schema.fields),children:this.schema.fields.map(e=>D({type:e.type,nullCount:0}))}),this._metadata=new Map]=t,!(this.data instanceof M))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=lb(this.schema,this.data.children,this.data.length);break}case 1:{let[e]=t,{fields:n,children:s,length:i}=Object.keys(e).reduce((c,l,u)=>(c.children[u]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[u]=B.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new P(n),a=D({type:new ot(n),length:i,children:s,nullCount:0});[this.schema,this.data]=lb(o,a.children,i),this._metadata=new Map;break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||(this._dictionaries=hb(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return Pt.visit(this.data,t)}at(t){return this.get(gi(t,this.numRows))}set(t,e){return te.visit(this.data,t,e)}indexOf(t,e){return Ai.visit(this.data,t,e)}[Symbol.iterator](){return Po.visit(new v([this.data]))}toArray(){return[...this]}concat(...t){return new X(this.schema,[this,...t])}slice(t,e){let[n]=new v([this.data]).slice(t,e).data;return new r(this.schema,n,this._metadata)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new v([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===t),e)}setChildAt(t,e){let n=this.schema,s=this.data;if(t>-1&&t<this.numCols){e||(e=new v([D({type:new Ot,length:this.numRows})]));let i=n.fields.slice(),o=s.children.slice(),a=i[t].clone({type:e.type});[i[t],o[t]]=[a,e.data[0]],n=new P(i,new Map(this.schema.metadata)),s=D({type:new ot(i),length:s.length,children:o})}return new r(n,s,this._metadata)}select(t){let e=this.schema.select(t),n=new ot(e.fields),s=[];for(let i of t){let o=this.schema.fields.findIndex(a=>a.name===i);~o&&(s[o]=this.data.children[o])}return new r(e,D({type:n,length:this.numRows,children:s}),this._metadata)}selectAt(t){let e=this.schema.selectAt(t),n=t.map(i=>this.data.children[i]).filter(Boolean),s=D({type:new ot(e.fields),length:this.numRows,children:n});return new r(e,s,this._metadata)}};ub=Symbol.toStringTag;tt[ub]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r[fb]=!0,"RecordBatch"))(tt.prototype);Object.defineProperty(tt,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===tt&&tt.isRecordBatch(t)}});Hi=class extends tt{constructor(t,e){let n=t.fields.map(i=>D({type:i.type})),s=D({type:new ot(t.fields),length:0,nullCount:0,children:n});super(t,s,e||new Map)}}});function nu(r,t=0){for(let e=-1,n=$o.length;++e<n;)if($o[e]!==r[t+e])return!1;return!0}var zd,Vd,db,pb,js,Xi,Ki,ru,kd,$o,qo,Gd,mb,su=d(()=>{Ve();Mt();it();ws();Zn();rd();Gt();xs();tc();zd=r=>`Expected ${et[r]} Message in stream, but was null or length 0.`,Vd=r=>`Header pointer of flatbuffer-encoded ${et[r]} Message is null or length 0.`,db=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,pb=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,js=class{constructor(t){this.source=t instanceof wr?t:new wr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?vt:t.value===-1&&(t=this.readMetadataLength()).done?vt:(t=this.readMetadata(t.value)).done?vt:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(zd(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=O(this.source.read(t));if(e.byteLength<t)throw new Error(pb(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=et.Schema,n=this.readMessage(e),s=n?.header();if(t&&!s)throw new Error(Vd(e));return s}readMetadataLength(){let t=this.source.read(ru),e=t&&new Ht(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return vt;if(e.byteLength<t)throw new Error(db(t,e.byteLength));return{done:!1,value:ge.decode(e)}}},Xi=class{constructor(t,e){this.source=t instanceof Ze?t:Yc(t)?new As(t,e):new Ze(t)}[Symbol.asyncIterator](){return this}next(){return _(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?vt:t.value===-1&&(t=yield this.readMetadataLength()).done?vt:(t=yield this.readMetadata(t.value)).done?vt:t})}throw(t){return _(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return _(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return _(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(zd(t));return e.value})}readMessageBody(t){return _(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=O(yield this.source.read(t));if(e.byteLength<t)throw new Error(pb(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return _(this,arguments,void 0,function*(t=!1){let e=et.Schema,n=yield this.readMessage(e),s=n?.header();if(t&&!s)throw new Error(Vd(e));return s})}readMetadataLength(){return _(this,void 0,void 0,function*(){let t=yield this.source.read(ru),e=t&&new Ht(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return _(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return vt;if(e.byteLength<t)throw new Error(db(t,e.byteLength));return{done:!1,value:ge.decode(e)}})}},Ki=class extends js{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Qa?t:new Qa(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ge.fromJSON(t.schema,et.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ge.fromJSON(e,et.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ge.fromJSON(e,et.RecordBatch)}}return this._body=[],vt}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((s,i)=>[...s,...i.VALIDITY&&[i.VALIDITY]||[],...i.TYPE_ID&&[i.TYPE_ID]||[],...i.OFFSET&&[i.OFFSET]||[],...i.DATA&&[i.DATA]||[],...i.VIEWS&&[i.VIEWS]||[],...i.VARIADIC_DATA_BUFFERS||[],...e(i.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(zd(t));return e.value}readSchema(){let t=et.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(Vd(t));return n}},ru=4,kd="ARROW1",$o=new Uint8Array(kd.length);for(let r=0;r<kd.length;r+=1)$o[r]=kd.codePointAt(r);qo=$o.length,Gd=qo+ru,mb=qo*2+ru});var jd,$d,yb,gb=d(()=>{vo();jd=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(t){let e=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(e);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)&&this._hasValidVersion(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.LZ4_FRAME_MAGIC.every((e,n)=>t[n]===e)}_hasValidVersion(t){return(t[4]&192)>>6===1}},$d=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(t){let e=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(e);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.ZSTD_MAGIC.every((e,n)=>t[n]===e)}},yb={[Xt.LZ4_FRAME]:new jd,[Xt.ZSTD]:new $d}});var qd,$s,iu=d(()=>{vo();gb();qd=class{constructor(){this.registry={}}set(t,e){if(e?.encode&&typeof e.encode=="function"&&!yb[t].isValidCodecEncode(e))throw new Error(`Encoder for ${Xt[t]} is not valid.`);this.registry[t]=e}get(t){var e;return((e=this.registry)===null||e===void 0?void 0:e[t])||null}},$s=new qd});function Ab(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*bb(r){let t=Oe.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function wb(r){return Ae(this,arguments,function*(){let e=yield Y(Oe.from(r));try{if(!(yield Y(e.open({autoDestroy:!1}))).closed)do yield yield Y(e);while(!(yield Y(e.reset().open())).closed)}finally{yield Y(e.cancel())}})}function jS(r){return new $r(new Yd(r))}function $S(r){let t=r.peek(qo+7&-8);return t&&t.byteLength>=4?nu(t)?new Nn(new au(r.read())):new $r(new Yo(r)):new $r(new Yo((function*(){})()))}function qS(r){return _(this,void 0,void 0,function*(){let t=yield r.peek(qo+7&-8);return t&&t.byteLength>=4?nu(t)?new Nn(new au(yield r.read())):new On(new Zo(r)):new On(new Zo((function(){return Ae(this,arguments,function*(){})})()))})}function WS(r){return _(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new As(r,t);return t>=mb&&nu(yield e.readAt(0,qo+7&-8))?new Wo(new Wd(e)):new On(new Zo(e))})}var Oe,$r,On,Nn,Wo,ou,Yo,Zo,au,Wd,Yd,lc=d(()=>{Ve();yr();de();yt();Mt();Jh();Ba();ws();xs();rd();eb();En();tc();su();Zn();iu();en();it();Oe=class r extends Bi{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return tr(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Zt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Zt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof r?t:qc(t)?jS(t):Yc(t)?WS(t):tr(t)?_(this,void 0,void 0,function*(){return yield r.from(yield t)}):Zc(t)||Aa(t)||Xc(t)||dr(t)?qS(new Ze(t)):$S(new wr(t))}static readAll(t){return t instanceof r?t.isSync()?bb(t):wb(t):qc(t)||ArrayBuffer.isView(t)||Tr(t)||Wc(t)?bb(t):wb(t)}},$r=class extends Oe{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Ae(this,arguments,function*(){yield Y(yield*wo(Je(this[Symbol.iterator]())))})}},On=class extends Oe{constructor(t){super(t),this._impl=t}readAll(){return _(this,void 0,void 0,function*(){var t,e,n,s;let i=new Array;try{for(var o=!0,a=Je(this),c;c=yield a.next(),t=c.done,!t;o=!0){s=c.value,o=!1;let l=s;i.push(l)}}catch(l){e={error:l}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return i})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Nn=class extends $r{constructor(t){super(t),this._impl=t}},Wo=class extends On{constructor(t){super(t),this._impl=t}},ou=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e,n){let s;if(t.compression!=null){let o=$s.get(t.compression.type);if(o?.decode&&typeof o.decode=="function"){let{decommpressedBody:a,buffers:c}=this._decompressBuffers(t,e,o);s=this._loadCompressedVectors(t,a,this.schema.fields),t=new zt(t.length,t.nodes,c,null)}else throw new Error("Record batch is compressed but codec not found")}else s=this._loadVectors(t,e,this.schema.fields);let i=D({type:new ot(this.schema.fields),length:t.length,children:s});return new tt(this.schema,i,n)}_loadDictionaryBatch(t,e){let{id:n,isDelta:s}=t,{dictionaries:i,schema:o}=this,a=i.get(n),c=o.dictionaries.get(n),l;if(t.data.compression!=null){let u=$s.get(t.data.compression.type);if(u?.decode&&typeof u.decode=="function"){let{decommpressedBody:f,buffers:h}=this._decompressBuffers(t.data,e,u);l=this._loadCompressedVectors(t.data,f,[c]),t=new ye(new zt(t.data.length,t.data.nodes,h,null,t.data.variadicBufferCounts),n,s)}else throw new Error("Dictionary batch is compressed but codec not found")}else l=this._loadVectors(t.data,e,[c]);return(a&&s?a.concat(new v(l)):new v(l)).memoize()}_loadVectors(t,e,n){return new Go(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(t,e,n){return new Wl(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_decompressBuffers(t,e,n){let s=[],i=[],o=0;for(let{offset:a,length:c}of t.buffers){if(c===0){s.push(new Uint8Array(0)),i.push(new Nt(o,0));continue}let l=new Ht(e.subarray(a,a+c)),u=Q(l.readInt64(0)),f=l.bytes().subarray(8),h=u===-1?f:n.decode(f);s.push(h);let p=(o+7&-8)-o;o+=p,i.push(new Nt(o,h.length)),o+=h.length}return{decommpressedBody:s,buffers:i}}},Yo=class extends ou{constructor(t,e){super(e),this._reader=qc(t)?new Ki(this._handle=t):new js(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Ab(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):vt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):vt}next(){if(this.closed)return vt;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),s=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),s=e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Hi(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Zo=class extends ou{constructor(t,e){super(e),this._reader=new Xi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return _(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return _(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Ab(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return _(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):vt})}return(t){return _(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):vt})}next(){return _(this,void 0,void 0,function*(){if(this.closed)return vt;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),s=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),s=yield e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Hi(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return _(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},au=class extends Yo{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof ec?t:new ec(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let s=this._reader.readMessage(et.RecordBatch);if(s?.isRecordBatch()){let i=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(i,o,s.metadata)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let s=this._reader.readMessage(et.DictionaryBatch);if(s?.isDictionaryBatch()){let i=s.header(),o=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(i,o);this.dictionaries.set(i.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-Gd,n=t.readInt32(e),s=t.readAt(e-n,n);return Bn.decode(s)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},Wd=class extends Zo{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,s=e[0]instanceof Map?e.shift():void 0;super(t instanceof As?t:new As(t,n),s)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return _(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return _(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let s=yield this._reader.readMessage(et.RecordBatch);if(s?.isRecordBatch()){let i=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(i,o,s.metadata)}}return null})}_readDictionaryBatch(t){return _(this,void 0,void 0,function*(){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let s=yield this._reader.readMessage(et.DictionaryBatch);if(s?.isDictionaryBatch()){let i=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(i,o);this.dictionaries.set(i.id,a)}}})}_readFooter(){return _(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-Gd,n=yield t.readInt32(e),s=yield t.readAt(e-n,n);return Bn.decode(s)})}_readNextMessageAndValidate(t){return _(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},Yd=class extends Yo{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new ql(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}}});function cr(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Nt(this._byteLength,t)),this._byteLength+=t,this}function YS(r){var t;let{type:e,length:n,typeIds:s,valueOffsets:i}=r;if(cr.call(this,s),e.mode===ut.Sparse)return Zd.call(this,r);if(e.mode===ut.Dense){if(r.offset<=0)return cr.call(this,i),Zd.call(this,r);{let o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<n;)(l=s[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=i[f]),o[f]=i[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);cr.call(this,o),this.visitMany(r.children.map((l,u)=>{let f=e.typeIds[u],h=a[f],p=c[f];return l.slice(h,Math.min(n,p))}))}}return this}function ZS(r){let t;return r.nullCount>=r.length?cr.call(this,new Uint8Array(r.length+7>>3)):(t=r.values)instanceof Uint8Array?cr.call(this,bi(r.offset,r.length,t)):cr.call(this,wi(r.values))}function Un(r){return cr.call(this,r.values.subarray(0,r.length*r.stride))}function cu(r){let{length:t,values:e,valueOffsets:n}=r,s=Q(n[0]),i=Q(n[t]),o=Math.min(i-s,e.byteLength-s);return cr.call(this,Kc(-s,t+1,n)),cr.call(this,e.subarray(s,s+o)),this}function vb(r){let{offset:t,length:e,stride:n,values:s,variadicBuffers:i=[]}=r;if(!s)throw new Error("BinaryView data is missing view buffer");let o=t*n,a=o+e*n;cr.call(this,s.subarray(o,a));for(let c of i)cr.call(this,c);return this._variadicBufferCounts.push(i.length),this}function lu(r){let{length:t,valueOffsets:e}=r;if(e){let n=Q(e[0]),s=Q(e[t]);return cr.call(this,Kc(-n,t+1,e)),this.visit(r.children[0].slice(n,s-n))}return this.visit(r.children[0])}function Zd(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}var St,Sb=d(()=>{de();We();Mt();En();Gt();xi();ws();yt();en();St=class r extends F{static assemble(...t){let e=s=>s.flatMap(i=>Array.isArray(i)?e(i):i instanceof tt?i.data.children:i.data),n=new r;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[],this._variadicBufferCounts=[]}visit(t){if(t instanceof v)return this.visitMany(t.data),this;let{type:e}=t;if(!x.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(x.isUnion(e))this.nodes.push(new gr(n,0));else{let{nullCount:s}=t;x.isNull(e)||cr.call(this,s<=0?new Uint8Array(0):bi(t.offset,n,t.nullBitmap)),this.nodes.push(new gr(n,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}get variadicBufferCounts(){return this._variadicBufferCounts}};St.prototype.visitBool=ZS;St.prototype.visitInt=Un;St.prototype.visitFloat=Un;St.prototype.visitUtf8=cu;St.prototype.visitLargeUtf8=cu;St.prototype.visitUtf8View=vb;St.prototype.visitBinary=cu;St.prototype.visitLargeBinary=cu;St.prototype.visitBinaryView=vb;St.prototype.visitFixedSizeBinary=Un;St.prototype.visitDate=Un;St.prototype.visitTimestamp=Un;St.prototype.visitTime=Un;St.prototype.visitDecimal=Un;St.prototype.visitList=lu;St.prototype.visitLargeList=lu;St.prototype.visitStruct=Zd;St.prototype.visitUnion=YS;St.prototype.visitInterval=Un;St.prototype.visitDuration=Un;St.prototype.visitFixedSizeList=lu;St.prototype.visitMap=lu});var uu,Bb=d(()=>{We();il();Mt();uu=class extends F{visit(t){return t==null?void 0:super.visit(t)}visitNull({typeId:t}){return{name:V[t].toLowerCase()}}visitInt({typeId:t,bitWidth:e,isSigned:n}){return{name:V[t].toLowerCase(),bitWidth:e,isSigned:n}}visitFloat({typeId:t,precision:e}){return{name:V[t].toLowerCase(),precision:ct[e]}}visitBinary({typeId:t}){return{name:V[t].toLowerCase()}}visitLargeBinary({typeId:t}){return{name:V[t].toLowerCase()}}visitBinaryView({typeId:t}){return{name:V[t].toLowerCase()}}visitBool({typeId:t}){return{name:V[t].toLowerCase()}}visitUtf8({typeId:t}){return{name:V[t].toLowerCase()}}visitLargeUtf8({typeId:t}){return{name:V[t].toLowerCase()}}visitUtf8View({typeId:t}){return{name:V[t].toLowerCase()}}visitDecimal({typeId:t,scale:e,precision:n,bitWidth:s}){return{name:V[t].toLowerCase(),scale:e,precision:n,bitWidth:s}}visitDate({typeId:t,unit:e}){return{name:V[t].toLowerCase(),unit:mt[e]}}visitTime({typeId:t,unit:e,bitWidth:n}){return{name:V[t].toLowerCase(),unit:A[e],bitWidth:n}}visitTimestamp({typeId:t,timezone:e,unit:n}){return{name:V[t].toLowerCase(),unit:A[n],timezone:e}}visitInterval({typeId:t,unit:e}){return{name:V[t].toLowerCase(),unit:nt[e]}}visitDuration({typeId:t,unit:e}){return{name:V[t].toLocaleLowerCase(),unit:A[e]}}visitList({typeId:t}){return{name:V[t].toLowerCase()}}visitLargeList({typeId:t}){return{name:V[t].toLowerCase()}}visitStruct({typeId:t}){return{name:V[t].toLowerCase()}}visitUnion({typeId:t,mode:e,typeIds:n}){return{name:V[t].toLowerCase(),mode:ut[e].toUpperCase(),typeIds:[...n]}}visitDictionary(t){return this.visit(t.dictionary)}visitFixedSizeBinary({typeId:t,byteWidth:e}){return{name:V[t].toLowerCase(),byteWidth:e}}visitFixedSizeList({typeId:t,listSize:e}){return{name:V[t].toLowerCase(),listSize:e}}visitMap({typeId:t,keysSorted:e}){return{name:V[t].toLowerCase(),keysSorted:e}}}});function*Hd(r){for(let t of r)yield t.reduce((e,n)=>`${e}${("0"+(n&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*Rn(r,t){let e=new Uint32Array(r.buffer,r.byteOffset,r.byteLength/Uint32Array.BYTES_PER_ELEMENT);for(let n=-1,s=e.length/t;++n<s;)yield`${mi.new(e.subarray((n+0)*t,(n+1)*t),!1)}`}function Ib(r,t){let n=r.values,s=new DataView(n.buffer,n.byteOffset,n.byteLength),i=n.byteLength/16,o=h=>Array.from(h).map(p=>("0"+(p&255).toString(16)).slice(-2)).join("").toUpperCase(),a=Array.from({length:i},(h,p)=>{let y=p*16,g=s.getInt32(y,!0);return[y,g]}).map(([h,p])=>p>12?{SIZE:p,PREFIX_HEX:o(n.subarray(h+4,h+8)),BUFFER_INDEX:s.getInt32(h+8,!0),OFFSET:s.getInt32(h+12,!0)}:{SIZE:p,INLINED:t(n.subarray(h+4,h+4+p))}),c=[...new Set(a.map(h=>h.BUFFER_INDEX).filter(h=>h!==void 0))],l=c.map(h=>o(r.variadicBuffers[h])),u=new Map(c.map((h,p)=>[h,p]));return{VIEWS:a.map(h=>h.BUFFER_INDEX!==void 0?Object.assign(Object.assign({},h),{BUFFER_INDEX:u.get(h.BUFFER_INDEX)}):h),VARIADIC_DATA_BUFFERS:l}}var uc,_b=d(()=>{al();de();We();Mt();Mt();xi();$l();yt();uc=class r extends F{static assemble(...t){let e=new r;return t.map(({schema:n,data:s})=>e.visitMany(n.fields,s.children))}visit({name:t},e){let{length:n}=e,{offset:s,nullCount:i,nullBitmap:o}=e,a=x.isDictionary(e.type)?e.type.indices:e.type,c=Object.assign([],e.buffers,{[Z.VALIDITY]:void 0});return Object.assign({name:t,count:n,VALIDITY:x.isNull(a)||x.isUnion(a)?void 0:i<=0?Array.from({length:n},()=>1):[...new sn(o,s,n,null,Ml)]},super.visit(e.clone(a,s,n,0,c)))}visitNull(){return{}}visitBool({values:t,offset:e,length:n}){return{DATA:[...new sn(t,e,n,null,Uo)]}}visitInt(t){return{DATA:t.type.bitWidth<64?[...t.values]:[...Rn(t.values,2)]}}visitFloat(t){return{DATA:[...t.values]}}visitUtf8(t){return{DATA:[...new v([t])],OFFSET:[...t.valueOffsets]}}visitLargeUtf8(t){return{DATA:[...new v([t])],OFFSET:[...Rn(t.valueOffsets,2)]}}visitBinary(t){return{DATA:[...Hd(new v([t]))],OFFSET:[...t.valueOffsets]}}visitLargeBinary(t){return{DATA:[...Hd(new v([t]))],OFFSET:[...Rn(t.valueOffsets,2)]}}visitBinaryView(t){return Ib(t,e=>Array.from(e).map(n=>("0"+(n&255).toString(16)).slice(-2)).join("").toUpperCase())}visitUtf8View(t){return Ib(t,e=>Array.from(e).map(n=>String.fromCodePoint(n)).join(""))}visitFixedSizeBinary(t){return{DATA:[...Hd(new v([t]))]}}visitDate(t){return{DATA:t.type.unit===mt.DAY?[...t.values]:[...Rn(t.values,2)]}}visitTimestamp(t){return{DATA:[...Rn(t.values,2)]}}visitTime(t){return{DATA:t.type.unit<A.MICROSECOND?[...t.values]:[...Rn(t.values,2)]}}visitDecimal(t){return{DATA:[...Rn(t.values,4)]}}visitList(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}visitLargeList(t){return{OFFSET:[...Rn(t.valueOffsets,2)],children:this.visitMany(t.type.children,t.children)}}visitStruct(t){return{children:this.visitMany(t.type.children,t.children)}}visitUnion(t){return{TYPE_ID:[...t.typeIds],OFFSET:t.type.mode===ut.Dense?[...t.valueOffsets]:void 0,children:this.visitMany(t.type.children,t.children)}}visitInterval(t){switch(t.type.unit){case nt.YEAR_MONTH:return{DATA:[...t.values]};case nt.DAY_TIME:return{DATA:cd(t.values)};case nt.MONTH_DAY_NANO:return{DATA:ld(t.values,!0)}}}visitDuration(t){return{DATA:[...Rn(t.values,2)]}}visitFixedSizeList(t){return{children:this.visitMany(t.type.children,t.children)}}visitMap(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}}});function Xd(r,t){let e=t;t instanceof X&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function Kd(r,t){return _(this,void 0,void 0,function*(){var e,n,s,i,o,a,c;try{for(e=!0,n=Je(t);s=yield n.next(),i=s.done,!i;e=!0){c=s.value,e=!1;let l=c;r.write(l)}}catch(l){o={error:l}}finally{try{!e&&!i&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function Lb({name:r,type:t,nullable:e}){let n=new uu;return{name:r,nullable:e,type:n.visit(t),children:(t.children||[]).map(s=>Lb(s)),dictionary:x.isDictionary(t)?{id:t.id,isOrdered:t.isOrdered,indexType:n.visit(t.indices)}:void 0}}function HS(r,t,e=!1){let[n]=uc.assemble(new tt({[t]:r}));return JSON.stringify({id:t,isDelta:e,data:{count:r.length,columns:n}},null,2)}function XS(r){let[t]=uc.assemble(r);return JSON.stringify({count:r.numRows,columns:t},null,2)}var ln,Pn,kn,fc,fu=d(()=>{Ve();Zi();su();de();yt();ws();ws();Jh();Mt();cc();xs();Sb();Bb();_b();Gt();En();tc();Zn();vo();iu();it();ln=class extends Bi{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){if(super(),this._position=0,this._started=!1,this._compression=null,this._sink=new br,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,ve(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1,compressionType:null}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1,t.compressionType!=null){if(this._writeLegacyIpcFormat)throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");if(Object.values(Xt).includes(t.compressionType))this._compression=new Si(t.compressionType);else{let e=Object.values(Xt).filter(n=>typeof n=="string");throw new Error(`Unsupported compressionType: ${t.compressionType} Available types: ${e.join(", ")}`)}}else this._compression=null}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return tr(t)?t.then(e=>this.writeAll(e)):dr(t)?Kd(this,t):Xd(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof br?this._sink=t:(this._sink=new br,t&&qy(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Wy(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!Yi(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof X&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof tt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!Yi(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof tt?t instanceof Hi||this._writeRecordBatch(t):t instanceof X?this.writeAll(t.batches):Tr(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,s=ge.encode(t),i=s.byteLength,o=this._writeLegacyIpcFormat?4:8,a=i+o+n&~n,c=a-i-o;return t.headerType===et.RecordBatch?this._recordBatchBlocks.push(new Vr(a,t.bodyLength,this._position)):t.headerType===et.DictionaryBatch&&this._dictionaryBlocks.push(new Vr(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),i>0&&this._write(s),this._writePadding(c)}_write(t){if(this._started){let e=O(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(ge.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write($o)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:s,buffers:i,variadicBufferCounts:o}=this._assembleRecordBatch(t),a=new zt(t.numRows,n,s,this._compression,o,t.metadata),c=ge.from(a,e);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(i)}_assembleRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:s,buffers:i,variadicBufferCounts:o}=St.assemble(t);return this._compression!=null&&({byteLength:e,bufferRegions:s,buffers:i}=this._compressBodyBuffers(i)),{byteLength:e,nodes:n,bufferRegions:s,buffers:i,variadicBufferCounts:o}}_compressBodyBuffers(t){let e=$s.get(this._compression.type);if(!e?.encode||typeof e.encode!="function")throw new Error(`Codec for compression type "${Xt[this._compression.type]}" has invalid encode method`);let n=0,s=[],i=[];for(let a of t){let c=O(a);if(c.length===0){s.push(new Uint8Array(0),new Uint8Array(0)),i.push(new Nt(n,0));continue}let l=e.encode(c),u=l.length<c.length,f=u?l:c,h=u?f.length:-1,p=new Ht(new Uint8Array(8));p.writeInt64(0,BigInt(h)),s.push(p.bytes(),new Uint8Array(f));let y=(n+7&-8)-n;n+=y;let g=8+f.length;i.push(new Nt(n,g)),n+=g}let o=(n+7&-8)-n;return n+=o,{byteLength:n,bufferRegions:i,buffers:s}}_writeDictionaryBatch(t,e,n=!1){let{byteLength:s,nodes:i,bufferRegions:o,buffers:a,variadicBufferCounts:c}=this._assembleRecordBatch(new v([t])),l=new zt(t.length,i,o,this._compression,c),u=new ye(l,e,n),f=ge.from(u,s);return this._writeMessage(f)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e=this._compression!=null?2:1,n=new Array(e);for(let s=0;s<t.length;s+=e){let i=0;for(let a=-1;++a<e;)n[a]=t[s+a],i+=n[a].byteLength;if(i===0)continue;for(let a of n)this._write(a);let o=(i+7&-8)-i;o>0&&this._writePadding(o)}return this}_writeDictionaries(t){var e,n;for(let[s,i]of t.dictionaries){let o=(e=i?.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(s),c=(n=this._dictionaryDeltaOffsets.get(s))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==o[0])for(let[l,u]of o.entries())this._writeDictionaryBatch(u,s,l>0);else if(c<o.length)for(let l of o.slice(c))this._writeDictionaryBatch(l,s,!0);this._seenDictionaries.set(s,i),this._dictionaryDeltaOffsets.set(s,o.length)}return this}},Pn=class r extends ln{static writeAll(t,e){let n=new r(e);return tr(t)?t.then(s=>n.writeAll(s)):dr(t)?Kd(n,t):Xd(n,t)}},kn=class r extends ln{static writeAll(t,e){let n=new r(e);return tr(t)?t.then(s=>n.writeAll(s)):dr(t)?Kd(n,t):Xd(n,t)}constructor(t){super(t),this._autoDestroy=!0,this._writeLegacyIpcFormat=!1}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){let e=Bn.encode(new Bn(t,ht.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}},fc=class r extends ln{static writeAll(t){return new r().writeAll(t)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._recordBatchesWithDictionaries=[]}_writeMessage(){return this}_writeFooter(t){return this}_writeSchema(t){return this._write(`{
17
+ "schema": ${JSON.stringify({fields:t.fields.map(e=>Lb(e))},null,2)}`)}_writeDictionaries(t){return t.dictionaries.size>0&&this._recordBatchesWithDictionaries.push(t),this}_writeDictionaryBatch(t,e,n=!1){return this._write(this._dictionaryBlocks.length===0?" ":`,
18
+ `),this._write(HS(t,e,n)),this._dictionaryBlocks.push(new Vr(0,0,0)),this}_writeRecordBatch(t){return this._writeDictionaries(t),this._recordBatches.push(t),this}close(){if(this._recordBatchesWithDictionaries.length>0){this._write(`,
19
+ "dictionaries": [
20
+ `);for(let t of this._recordBatchesWithDictionaries)super._writeDictionaries(t);this._write(`
21
+ ]`)}if(this._recordBatches.length>0){for(let t=-1,e=this._recordBatches.length;++t<e;)this._write(t===0?`,
22
+ "batches": [
23
+ `:`,
24
+ `),this._write(XS(this._recordBatches[t])),this._recordBatchBlocks.push(new Vr(0,0,0));this._write(`
25
+ ]`)}return this._schema&&this._write(`
26
+ }`),this._recordBatchesWithDictionaries=[],this._recordBatches=[],super.close()}}});function Tb(r,t){if(dr(r))return JS(r,t);if(Tr(r))return KS(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function KS(r,t){let e=null,n=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){i(o,e||(e=r[Symbol.iterator]()))},pull(o){e?i(o,e):o.close()},cancel(){e?.return&&e.return(),e=null}}),Object.assign({highWaterMark:n?s:void 0},t));function i(o,a){let c,l=null,u=o.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=O(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()}}function JS(r,t){let e=null,n=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return _(this,void 0,void 0,function*(){yield i(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return _(this,void 0,void 0,function*(){e?yield i(o,e):o.close()})},cancel(){return _(this,void 0,void 0,function*(){e?.return&&(yield e.return()),e=null})}}),Object.assign({highWaterMark:n?s:void 0},t));function i(o,a){return _(this,void 0,void 0,function*(){let c,l=null,u=o.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=O(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()})}}var Mb=d(()=>{Ve();Gt();Zn()});function Fb(r){return new Jd(r)}var Jd,Db,Cb,Eb=d(()=>{Ve();sc();Jd=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:s="count"}=t,i=Gy(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Gr(i),this._getSize=s!=="bytes"?Db:Cb;let{["highWaterMark"]:o=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:o,size:s!=="bytes"?Db:Cb}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},Db=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Cb=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0}});function hu(r,t){let e=new br,n=null,s=new ReadableStream({cancel(){return _(this,void 0,void 0,function*(){yield e.close()})},start(a){return _(this,void 0,void 0,function*(){yield o(a,n||(n=yield i()))})},pull(a){return _(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:s};function i(){return _(this,void 0,void 0,function*(){return yield(yield Oe.from(e)).open(t)})}function o(a,c){return _(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}var Ob=d(()=>{Ve();xs();lc()});function du(r,t){let e=new this(r),n=new Ze(e),s=new ReadableStream({cancel(){return _(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return _(this,void 0,void 0,function*(){yield i(o)})},start(o){return _(this,void 0,void 0,function*(){yield i(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:s};function i(o){return _(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield n.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}var Nb=d(()=>{Ve();xs()});function qs(r){let t=Oe.from(r);return tr(t)?t.then(e=>qs(e)):t.isAsync()?t.readAll().then(e=>new X(e)):new X(t.readAll())}function Ji(r,t="stream",e=null){let n={compressionType:e};return(t==="stream"?Pn:kn).writeAll(r,n).toUint8Array(!0)}var Ub=d(()=>{Zi();Zn();lc();fu()});var Qd={};ze(Qd,{isArrowData:()=>gu,isArrowDataType:()=>yu,isArrowField:()=>mu,isArrowRecordBatch:()=>wu,isArrowSchema:()=>pu,isArrowTable:()=>xu,isArrowVector:()=>bu});function pu(r){return P.isSchema(r)}function mu(r){return B.isField(r)}function yu(r){return x.isDataType(r)}function gu(r){return M.isData(r)}function bu(r){return v.isVector(r)}function wu(r){return tt.isRecordBatch(r)}function xu(r){return X.isTable(r)}var tp=d(()=>{me();yt();yr();de();En();Zi()});var Rb,ep=d(()=>{ol();vo();Mt();yr();yt();Zi();de();We();me();Za();_l();At();sc();fd();Bd();hd();dd();pd();md();gd();xd();Ld();_d();bd();wd();Md();Cd();Dd();Yl();Hl();Zl();Ad();vd();yd();Sd();Id();Td();xs();lc();fu();Ub();iu();su();ws();En();tp();al();id();xi();Ya();Gt();No();ka();$l();tp();cc();Rb=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Th),sd),$h),Mh),Zf),jh),Bh),ud),Qd),{compareSchemas:Yi,compareFields:ib,compareTypes:Jl})});var Ne={};ze(Ne,{AsyncByteQueue:()=>br,AsyncByteStream:()=>Ze,AsyncMessageReader:()=>Xi,AsyncRecordBatchFileReader:()=>Wo,AsyncRecordBatchStreamReader:()=>On,Binary:()=>je,BinaryBuilder:()=>Ln,BinaryView:()=>H,BinaryViewBuilder:()=>Dn,Bool:()=>ue,BoolBuilder:()=>Ii,BufferType:()=>Z,Builder:()=>bt,ByteStream:()=>wr,CompressionType:()=>Xt,Data:()=>M,DataType:()=>x,DateBuilder:()=>on,DateDay:()=>ns,DateDayBuilder:()=>vs,DateMillisecond:()=>ss,DateMillisecondBuilder:()=>Ss,DateUnit:()=>mt,Date_:()=>Me,Decimal:()=>$e,DecimalBuilder:()=>Bs,DenseUnion:()=>An,DenseUnionBuilder:()=>qi,Dictionary:()=>Rt,DictionaryBuilder:()=>_i,Duration:()=>De,DurationBuilder:()=>xr,DurationMicrosecond:()=>$a,DurationMicrosecondBuilder:()=>Cs,DurationMillisecond:()=>ja,DurationMillisecondBuilder:()=>Ds,DurationNanosecond:()=>qa,DurationNanosecondBuilder:()=>Fs,DurationSecond:()=>Ga,DurationSecondBuilder:()=>Ms,Field:()=>B,FixedSizeBinary:()=>qe,FixedSizeBinaryBuilder:()=>Is,FixedSizeList:()=>gt,FixedSizeListBuilder:()=>Li,Float:()=>ce,Float16:()=>Ur,Float16Builder:()=>Ti,Float32:()=>Kt,Float32Builder:()=>Mi,Float64:()=>Le,Float64Builder:()=>Di,FloatBuilder:()=>an,Int:()=>Lt,Int16:()=>Be,Int16Builder:()=>Fi,Int32:()=>Dt,Int32Builder:()=>Ei,Int64:()=>rr,Int64Builder:()=>Oi,Int8:()=>Se,Int8Builder:()=>Ci,IntBuilder:()=>Fe,Interval:()=>fe,IntervalBuilder:()=>jr,IntervalDayTime:()=>hs,IntervalDayTimeBuilder:()=>_s,IntervalMonthDayNano:()=>Va,IntervalMonthDayNanoBuilder:()=>Ts,IntervalUnit:()=>nt,IntervalYearMonth:()=>ds,IntervalYearMonthBuilder:()=>Ls,JSONMessageReader:()=>Ki,LargeBinary:()=>Rr,LargeBinaryBuilder:()=>Tn,LargeList:()=>nr,LargeListBuilder:()=>zi,LargeUtf8:()=>Pr,LargeUtf8Builder:()=>Gs,List:()=>Ct,ListBuilder:()=>ki,MapBuilder:()=>Vi,MapRow:()=>mr,Map_:()=>he,Message:()=>ge,MessageHeader:()=>et,MessageReader:()=>js,MetadataVersion:()=>ht,Null:()=>Ot,NullBuilder:()=>Gi,Precision:()=>ct,RecordBatch:()=>tt,RecordBatchFileReader:()=>Nn,RecordBatchFileWriter:()=>kn,RecordBatchJSONWriter:()=>fc,RecordBatchReader:()=>Oe,RecordBatchStreamReader:()=>$r,RecordBatchStreamWriter:()=>Pn,RecordBatchWriter:()=>ln,Schema:()=>P,SparseUnion:()=>ps,SparseUnionBuilder:()=>$i,Struct:()=>ot,StructBuilder:()=>ji,StructRow:()=>nn,Table:()=>X,Time:()=>Jt,TimeBuilder:()=>vr,TimeMicrosecond:()=>as,TimeMicrosecondBuilder:()=>ks,TimeMillisecond:()=>os,TimeMillisecondBuilder:()=>Ps,TimeNanosecond:()=>cs,TimeNanosecondBuilder:()=>zs,TimeSecond:()=>is,TimeSecondBuilder:()=>Rs,TimeUnit:()=>A,Timestamp:()=>Qt,TimestampBuilder:()=>Ar,TimestampMicrosecond:()=>us,TimestampMicrosecondBuilder:()=>Ns,TimestampMillisecond:()=>rn,TimestampMillisecondBuilder:()=>Os,TimestampNanosecond:()=>fs,TimestampNanosecondBuilder:()=>Us,TimestampSecond:()=>ls,TimestampSecondBuilder:()=>Es,Type:()=>m,Uint16:()=>_e,Uint16Builder:()=>Ui,Uint32:()=>qt,Uint32Builder:()=>Ri,Uint64:()=>Nr,Uint64Builder:()=>Pi,Uint8:()=>Ie,Uint8Builder:()=>Ni,Union:()=>Ce,UnionBuilder:()=>Mn,UnionMode:()=>ut,Utf8:()=>le,Utf8Builder:()=>Vs,Utf8View:()=>Te,Utf8ViewBuilder:()=>Wi,Vector:()=>v,Visitor:()=>F,builderThroughAsyncIterable:()=>Ud,builderThroughIterable:()=>tu,compressionRegistry:()=>$s,isArrowData:()=>gu,isArrowDataType:()=>yu,isArrowField:()=>mu,isArrowRecordBatch:()=>wu,isArrowSchema:()=>pu,isArrowTable:()=>xu,isArrowVector:()=>bu,makeBuilder:()=>Gr,makeData:()=>D,makeTable:()=>Rd,makeVector:()=>ee,tableFromArrays:()=>Pd,tableFromIPC:()=>qs,tableFromJSON:()=>Nd,tableToIPC:()=>Ji,util:()=>Rb,vectorFromArray:()=>jo});var Ue=d(()=>{Ba();At();lc();fu();Mb();Eb();Ob();Nb();ep();ep();Zt.toDOMStream=Tb;bt.throughDOM=Fb;Oe.throughDOM=hu;Nn.throughDOM=hu;$r.throughDOM=hu;ln.throughDOM=du;kn.throughDOM=du;Pn.throughDOM=du});var Au,rp,Pb=d(()=>{"use strict";Ue();Au=new P([new B("POSITION",new gt(3,new B("value",new Kt,!1)),!1)]),rp=new P([...Au.fields,new B("indices",new Ct(new B("item",new qt,!1)),!0)])});function lr(r){let t=r?.POSITION;if(!t||!("value"in t)||!t.value.length)return null;let e=1/0,n=1/0,s=1/0,i=-1/0,o=-1/0,a=-1/0,c=t.value,l=c.length;for(let u=0;u<l;u+=3){let f=c[u],h=c[u+1],p=c[u+2];e=f<e?f:e,n=h<n?h:n,s=p<s?p:s,i=f>i?f:i,o=h>o?h:o,a=p>a?p:a}return[[e,n,s],[i,o,a]]}var kb=d(()=>{"use strict"});var Ws=d(()=>{"use strict";zy();Pb()});var hc,eB,vu,rB,nB,np=d(()=>{hc=globalThis,eB=globalThis.document||{},vu=globalThis.process||{},rB=globalThis.console,nB=globalThis.navigator||{}});function Su(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let t=typeof navigator<"u"&&navigator.userAgent,e=r||t;return!!(e&&e.indexOf("Electron")>=0)}var Bu=d(()=>{});function Ys(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Su()}var sp=d(()=>{Bu()});var Vb=d(()=>{sp();Bu();np()});var Gb=d(()=>{});var ip,Iu=d(()=>{np();sp();Vb();Bu();Gb();ip="5.0.0"});function Xo(r,t){if(!r)throw new Error(t||"Assertion failed")}var op=d(()=>{});function _u(r){if(!r)return 0;let t;switch(typeof r){case"number":t=r;break;case"object":t=r.logLevel||r.priority||0;break;default:return 0}return Xo(Number.isFinite(t)&&t>=0),t}function ap(r){let{logLevel:t,message:e}=r;r.logLevel=_u(t);let n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&n.unshift(e),r.message=t;break;case"object":Object.assign(r,t);break;default:}typeof r.message=="function"&&(r.message=r.message());let s=typeof r.message;return Xo(s==="string"||s==="object"),Object.assign(r,{args:n},r.opts)}var Lu=d(()=>{op()});var Zs,Qi,dc=d(()=>{Lu();Zs=()=>{},Qi=class{constructor({level:t=0}={}){this.userData={},this._onceCache=new Set,this._level=t}set level(t){this.setLevel(t)}get level(){return this.getLevel()}setLevel(t){return this._level=t,this}getLevel(){return this._level}warn(t,...e){return this._log("warn",0,t,e,{once:!0})}error(t,...e){return this._log("error",0,t,e)}log(t,e,...n){return this._log("log",t,e,n)}info(t,e,...n){return this._log("info",t,e,n)}once(t,e,...n){return this._log("once",t,e,n,{once:!0})}_log(t,e,n,s,i={}){let o=ap({logLevel:e,message:n,args:this._buildArgs(e,n,s),opts:i});return this._createLogFunction(t,o,i)}_buildArgs(t,e,n){return[t,e,...n]}_createLogFunction(t,e,n){if(!this._shouldLog(e.logLevel))return Zs;let s=this._getOnceTag(n.tag??e.tag??e.message);if((n.once||e.once)&&s!==void 0){if(this._onceCache.has(s))return Zs;this._onceCache.add(s)}return this._emit(t,e)}_shouldLog(t){return this.getLevel()>=_u(t)}_getOnceTag(t){if(t!==void 0)try{return typeof t=="string"?t:String(t)}catch{return}}}});function iB(r){try{let t=window[r],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}var pc,cp=d(()=>{pc=class{constructor(t,e,n="sessionStorage"){this.storage=iB(n),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let t={};if(this.storage){let e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}});function jb(r){let t;return r<10?t=`${r.toFixed(2)}ms`:r<100?t=`${r.toFixed(1)}ms`:r<1e3?t=`${r.toFixed(0)}ms`:t=`${(r/1e3).toFixed(2)}s`,t}function lp(r,t=8){let e=Math.max(t-r.length,0);return`${" ".repeat(e)}${r}`}var up=d(()=>{});function $b(r){return typeof r!="string"?r:(r=r.toUpperCase(),mc[r]||mc.WHITE)}function fp(r,t,e){return!Ys&&typeof r=="string"&&(t&&(r=`\x1B[${$b(t)}m${r}\x1B[39m`),e&&(r=`\x1B[${$b(e)+oB}m${r}\x1B[49m`)),r}var mc,oB,Tu=d(()=>{Iu();(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(mc||(mc={}));oB=10});function hp(r,t=["constructor"]){let e=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(e),s=r;for(let i of n){let o=s[i];typeof o=="function"&&(t.find(a=>i===a)||(s[i]=o.bind(r)))}}var dp=d(()=>{});var Mu,Sr,yc=d(()=>{Iu();Mu=class{getHighResolutionTimer(){let t;if(Ys()&&hc.performance)t=hc?.performance?.now?.();else if("hrtime"in vu){let e=vu?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}getMemoryUsageMB(){let e=hc?.performance?.memory?.usedJSHeapSize;return e==null?null:Math.trunc(e/1024/1024)}},Sr=new Mu;globalThis.Probe=Mu;globalThis.probe=Sr});function aB(r,t,e){if(typeof t=="string"){let n=e.time?lp(jb(e.total)):"";t=e.time?`${r}: ${n} ${t}`:`${r}: ${t}`,t=fp(t,e.color,e.background)}return t}function cB(r){for(let t in r)for(let e in r[t])return e||"untitled";return"empty"}var Ko,pp,zn,mp=d(()=>{Iu();dc();cp();up();Tu();dp();op();yc();Lu();Lu();Ko={debug:Ys()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},pp={enabled:!0,level:0},zn=class extends Qi{constructor({id:t}={id:""}){super({level:0}),this.VERSION=ip,this._startTs=Sr.getHighResolutionTimer(),this._deltaTs=Sr.getHighResolutionTimer(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new pc(`__probe-${this.id}__`,{[this.id]:pp}),this.timeStamp(`${this.id} started`),hp(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((Sr.getHighResolutionTimer()-this._startTs).toPrecision(10))}getDelta(){return Number((Sr.getHighResolutionTimer()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._updateConfiguration({enabled:t}),this}setLevel(t){return this._updateConfiguration({level:t}),this}get(t){return this._getConfiguration()[t]}set(t,e){this._updateConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){if(!t)throw new Error(e||"Assertion failed")}warn(t,...e){return this._log("warn",0,t,e,{method:Ko.warn,once:!0})}error(t,...e){return this._log("error",0,t,e,{method:Ko.error})}deprecated(t,e){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${e}\` instead`)}removed(t,e){return this.error(`\`${t}\` has been removed. Use \`${e}\` instead`)}probe(t,e,...n){let s=Sr.getMemoryUsageMB();if(s!==null){let i=`${s}MB `;typeof e=="function"?e=()=>`${i}${e()}`:typeof e=="string"&&(e=`${i}${e}`)}return this._log("log",t,e,n,{method:Ko.log,time:!0,once:!0})}log(t,e,...n){return this._log("log",t,e,n,{method:Ko.debug})}info(t,e,...n){return this._log("info",t,e,n,{method:console.info})}once(t,e,...n){return this._log("once",t,e,n,{method:Ko.debug||Ko.info,once:!0})}table(t,e,n){return e?this._log("table",t,e,n&&[n]||[],{method:console.table||Zs,tag:cB(e)}):Zs}time(t,e){return this._log("time",t,e,[],{method:console.time?console.time:console.info})}timeEnd(t,e){return this._log("time",t,e,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(t,e){return this._log("time",t,e,[],{method:console.timeStamp||Zs})}group(t,e,n={collapsed:!1}){let s=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",t,e,[],{method:s})}groupCollapsed(t,e,n={}){return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._log("groupEnd",t,"",[],{method:console.groupEnd||Zs})}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&super._shouldLog(t)}_emit(t,e){let n=e.method;Xo(n),e.total=this.getTotal(),e.delta=this.getDelta(),this._deltaTs=Sr.getHighResolutionTimer();let s=aB(this.id,e.message,e);return n.bind(console,s,...e.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(pp),this._storage.config[this.id]}_updateConfiguration(t){let e=this._storage.config[this.id]||{...pp};this._storage.setConfiguration({[this.id]:{...e,...t}})}};zn.VERSION=ip});var qb=d(()=>{dc()});var Wb=d(()=>{dc()});var Yb=d(()=>{yc()});var Zb=d(()=>{yc();globalThis.probe||(globalThis.probe=Sr)});var f8,Hb=d(()=>{mp();yc();mp();qb();dc();Wb();Tu();Tu();up();dp();cp();Yb();Zb();f8=new zn({id:"@probe.gl/log"})});function uB(){let r=new zn({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=r,globalThis.loaders.version=lB,globalThis.probe||={},globalThis.probe.loaders=r,r}function gc(){}var yp,lB,bp,gp,_8,Xb=d(()=>{"use strict";Hb();yp="5.0.0-beta.10",lB=yp[0]>="0"&&yp[0]<="9"?`v${yp}`:"";bp=uB(),gp=class{log(){return gc}info(){return gc}once(){return gc}warn(){return gc}error(){return gc}};_8=new gp});function Kb(...r){return fB(r)}function fB(r){let t=r.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),e=t.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(e),s=0;for(let i of t)n.set(i,s),s+=i.byteLength;return n.buffer}var Jb=d(()=>{"use strict"});function hB(r){return ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r)}var Hs,Qb=d(()=>{"use strict";Hs=class{offset=0;ended=!1;maxRewindBytes;chunks=[];scratch=new ArrayBuffer(8);checkpoints=[];constructor(t){this.maxRewindBytes=t?.maxRewindBytes||0}get arrayBuffers(){return this.chunks.map(t=>t.buffer)}write(t){this.chunks.push(hB(t))}end(){this.chunks=[],this.checkpoints=[],this.offset=0,this.ended=!0}hasAvailableBytes(t){return this.getAvailableByteLength()>=t}getAvailableByteLength(){let t=-this.offset;for(let e of this.chunks)t+=e.byteLength,t>0;return Math.max(0,t)}findBufferOffsets(t){let e=-this.offset,n=[];for(let s=0;s<this.chunks.length;s++){let i=this.chunks[s];if(e+i.byteLength<=0){e+=i.byteLength;continue}let o=e<=0?Math.abs(e):0,a;if(o+t<=i.byteLength)return a=o+t,n.push([s,[o,a]]),n;a=i.byteLength,n.push([s,[o,a]]),t-=i.byteLength-o,e+=i.byteLength}return null}getDataView(t){let e=this.findBufferOffsets(t);if(!e){if(this.ended)throw new Error("binary data exhausted");return null}let n;if(e.length===1){let[s,[i,o]]=e[0],a=this.chunks[s];n=new DataView(a.buffer,a.byteOffset+i,o-i)}else{let s=this.combineBufferOffsets(e);n=new DataView(s.buffer,s.byteOffset,s.byteLength)}return this.offset+=t,this.disposeBuffers(),n}readByte(){let t=this.findBufferOffsets(1);if(!t)throw new Error("binary data exhausted");let[e,[n]]=t[0],s=this.chunks[e][n];return this.offset++,this.disposeBuffers(),s}readUint16LE(){let t=this.readByte(),e=this.readByte();return t|e<<8}readUint32LE(){let t=this.readByte(),e=this.readByte(),n=this.readByte(),s=this.readByte();return(t|e<<8|n<<16|s<<24>>>0)>>>0}readInt32LE(){return this.readUint32LE()|0}readFloat64LE(){let t=this.getContiguousDataView(8);if(t)return t.getFloat64(0,!0);let e=new Uint8Array(this.scratch);return this.readInto(e,0,8),new DataView(this.scratch).getFloat64(0,!0)}readInto(t,e,n){let s=this.findBufferOffsets(n);if(!s)throw new Error("binary data exhausted");let i=e;for(let[o,[a,c]]of s){let l=this.chunks[o];t.set(l.subarray(a,c),i),i+=c-a}this.offset+=n,this.disposeBuffers()}readBytes(t){let e=this.findBufferOffsets(t);if(!e)throw new Error("binary data exhausted");let n;if(e.length===1){let[s,[i,o]]=e[0];n=this.chunks[s].subarray(i,o)}else n=this.combineBufferOffsets(e);return this.offset+=t,this.disposeBuffers(),n}skip(t){this.offset+=t}rewind(t){this.offset-=t}checkpoint(){let t={offset:this.offset};return this.checkpoints.push(t),t}restore(t){this.offset=t.offset,this.checkpoints.pop()}discardConsumed(){this.disposeBuffers()}_combineArrayBuffers(t){return this.combineBufferOffsets(t).buffer}getContiguousDataView(t){let e=this.findBufferOffsets(t);if(!e||e.length!==1)return null;let[n,[s,i]]=e[0],o=this.chunks[n],a=new DataView(o.buffer,o.byteOffset+s,i-s);return this.offset+=t,this.disposeBuffers(),a}disposeBuffers(){let t=this.checkpoints.length>0?Math.min(...this.checkpoints.map(e=>e.offset)):Number.POSITIVE_INFINITY;for(;this.chunks.length>0&&this.offset-this.maxRewindBytes>=this.chunks[0].byteLength&&t>=this.chunks[0].byteLength;){this.offset-=this.chunks[0].byteLength;for(let e of this.checkpoints)e.offset-=this.chunks[0].byteLength;t-=this.chunks[0].byteLength,this.chunks.shift()}}combineBufferOffsets(t){let e=0;for(let[,[i,o]]of t)e+=o-i;let n=new Uint8Array(e),s=0;for(let[i,[o,a]]of t){let c=this.chunks[i];n.set(c.subarray(o,a),s),s+=a-o}return n}}});async function*Du(r,t={}){let e=new TextDecoder(void 0,t);for await(let n of r)yield typeof n=="string"?n:e.decode(n,{stream:!0})}async function*Cu(r){let t="";for await(let e of r){t+=e;let n;for(n=t.indexOf(`
27
+ `);n>=0;){let s=t.slice(0,n+1);t=t.slice(n+1),yield s,n=t.indexOf(`
28
+ `)}}t.length>0&&(yield t)}var tw=d(()=>{"use strict"});async function wp(r,t){let e=dB(r);for(;;){let{done:n,value:s}=await e.next();if(n){e.return&&e.return();return}if(t(s))return}}async function xp(r){let t=[];for await(let e of r)t.push(rw(e));return Kb(...t)}async function*Fu(r){for await(let t of r)yield rw(t)}function rw(r){if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r)){let{buffer:t,byteOffset:e,byteLength:n}=r;return ew(t,e,n)}return ew(r)}function ew(r,t=0,e=r.byteLength-t){let n=new Uint8Array(r,t,e),s=new Uint8Array(n.length);return s.set(n),s.buffer}function dB(r){if(typeof r[Symbol.asyncIterator]=="function")return r[Symbol.asyncIterator]();if(typeof r[Symbol.iterator]=="function"){let t=r[Symbol.iterator]();return pB(t)}return r}function pB(r){return{next(t){return Promise.resolve(r.next(t))},return(t){return typeof r.return=="function"?Promise.resolve(r.return(t)):Promise.resolve({done:!0,value:t})},throw(t){return typeof r.throw=="function"?Promise.resolve(r.throw(t)):Promise.reject(t)}}}var nw=d(()=>{"use strict";Jb()});function qp(r){return new Sp(r)}function Ip(r){return{intensity:!!r.intensities,classification:!!r.classifications,color:!!(r.colors||r.rawColors),gpsTime:!!r.gpsTimes,nir:!!r.nir,scanAngle:!!r.scanAngles,userData:!!r.userData,pointSourceId:!!r.pointSourceIds,flags:!!(r.scannerChannels||r.scanDirectionFlags||r.edgeOfFlightLines||r.syntheticFlags||r.keyPointFlags||r.withheldFlags||r.overlapFlags),waveform:!!r.waveforms,extraBytes:!!r.extraBytes}}function fw(r){return(r.intensity?1:0)|(r.classification?2:0)|(r.color?4:0)|(r.gpsTime?8:0)|(r.nir?16:0)|(r.scanAngle?32:0)|(r.userData?64:0)|(r.pointSourceId?128:0)|(r.flags?256:0)|(r.waveform?512:0)|(r.extraBytes?1024:0)}function Wr(r,t){return new Bp(r,t)}function $u(r,t){let e=Wr(r,t),n=new Uint8Array(t.pointCount*t.pointDataRecordLength);return e.decodeInto(n,0,t.pointCount),n}function hw(r,t){if(!Zu(t.pointDataRecordFormat))throw new at("Legacy LAZ chunk byte length is not self-describing");let e=ia(r),n=sa(t),s=t.pointDataRecordLength,i=Ac(t.pointDataRecordFormat,n),o=s+4,a=i*4;if(e.byteLength<o+a)throw new at;let c=new DataView(e.buffer,e.byteOffset,e.byteLength),l=o+a;for(let u=0;u<i;u++)l+=c.getUint32(o+u*4,!0);if(e.byteLength<l)throw new at;return l}function Wp(r,t){let e=new Ou(ia(r)),n=new re(e),s=It(32,2);n.readInitBytes();let i=[],o=0,a=0,c=t.pointCount;for(let l=0;l<t.chunkCount;l++){let u;t.variable?(o=s.decompress(n,o,0)>>>0,u=o):(u=Math.min(t.chunkSize,c),c-=u),a=s.decompress(n,a,1)>>>0,i.push({pointCount:u,byteLength:a})}return i}function qu(r){if(!Zu(r.pointDataRecordFormat))return r.pointDataRecordLength+4;let t=sa(r);return r.pointDataRecordLength+4+Ac(r.pointDataRecordFormat,t)*4}function Wu(r,t){if(!Zu(t.pointDataRecordFormat))throw new at("Legacy LAZ chunk byte length is not self-describing");let e=_p(ia(r),t);if(!e)throw new at("LAZ chunk decoder needs the complete layered size header");return e.byteLength}function _p(r,t){let e=sa(t),n=t.pointDataRecordLength+4,s=Ac(t.pointDataRecordFormat,e),i=s*4;if(r.byteLength<n+i)return null;let o=new DataView(r.buffer,r.byteOffset,r.byteLength),a=n+i,c=[];for(let u=0;u<s;u++){let f=o.getUint32(n+u*4,!0);a+=f,c.push(f)}let l=n+i;return{byteLength:a,layerByteLengths:c,getByteLength:u=>l+c.slice(0,u).reduce((f,h)=>f+h,0)}}function mB(r,t){if(t.extraBytes)return Ac(r.pointDataRecordFormat,sa(r));let e=2;return t.classifications&&(e=3),(t.scannerChannels||t.scanDirectionFlags||t.edgeOfFlightLines||t.syntheticFlags||t.keyPointFlags||t.withheldFlags||t.overlapFlags)&&(e=4),t.intensities&&(e=5),t.scanAngles&&(e=6),t.userData&&(e=7),t.pointSourceIds&&(e=8),t.gpsTimes&&(e=9),(t.colors||t.rawColors)&&(e=10),t.nir&&(e=11),t.waveforms&&(e=r.pointDataRecordFormat===9?10:12),Math.min(e,Ac(r.pointDataRecordFormat,sa(r)))}function vp(r){let t=r.byteItemVersion===1?4:2;return Math.max(SB,r.pointDataRecordLength*t+512)}function ow(r){return r[0]<r[1]?r[1]<r[2]?r[1]:Math.max(r[0],r[2]):r[0]<r[2]?r[0]:Math.max(r[1],r[2])}function IB(r,t,e,n){let s=sa(t);for(let i of[t.point10ItemVersion,t.gpsTime11ItemVersion,t.rgb12ItemVersion,t.byteItemVersion])if(i!==void 0&&i!==1&&i!==2)throw new Error(`Unsupported legacy LASzip item version ${i}`);switch(t.pointDataRecordFormat){case 0:return new Ep(r,s,t);case 1:return new Op(r,s,t);case 2:return new Np(r,s,t);case 3:return new Up(r,s,t,e==="point-data"?n:null);case 4:return new Rp(r,s,t);case 5:return new Pp(r,s,t);case 6:return new kp(r,s,e,t,n);case 7:return new zp(r,s,e,t,n);case 8:return new Vp(r,s,e,t,n);case 9:return new Gp(r,s,e,t,n);case 10:return new jp(r,s,e,t,n);default:throw new Error(`TypeScript LAZ decoder does not support point format ${t.pointDataRecordFormat}`)}}function _B(r){return r<=5||r>=6&&r<=10}function It(r,t){let e=new Tp(r,t);return e.init(),e}function be(r,t){return Array.from({length:r},()=>new jt(t))}function sa(r){let t=LB(r.pointDataRecordFormat),e=r.pointDataRecordLength-t;if(e<0)throw new Error(`Invalid point record length ${r.pointDataRecordLength}`);return e}function LB(r){switch(r){case 0:return 20;case 1:return 28;case 2:return 26;case 3:return 34;case 4:return 57;case 5:return 63;case 6:return 30;case 7:return 36;case 8:return 38;case 9:return 59;case 10:return 67;default:throw new Error(`TypeScript LAZ decoder does not support point format ${r}`)}}function Zu(r){return r>=6&&r<=10}function Ac(r,t){switch(r){case 6:return 9+t;case 7:return 10+t;case 8:return 11+t;case 9:return 10+t;case 10:return 12+t;default:throw new Error(`TypeScript LAZ decoder does not support point format ${r}`)}}function TB(){return{x:0,y:0,z:0,intensity:0,returns:0,flags:0,classification:0,userData:0,scanAngle:0,pointSourceId:0,gpsTime:0}}function aw(){return{x:0,y:0,z:0,intensity:0,bitByte:0,classification:0,scanAngleRank:0,userData:0,pointSourceId:0}}function MB(r,t){r.x=Qo(t),r.y=Qo(t),r.z=Qo(t),r.intensity=Qs(t),r.bitByte=t.getByte(),r.classification=t.getByte(),r.scanAngleRank=$p(t.getByte()),r.userData=t.getByte(),r.pointSourceId=Qs(t)}function DB(r,t){r.x=t.x,r.y=t.y,r.z=t.z,r.intensity=t.intensity,r.bitByte=t.bitByte,r.classification=t.classification,r.scanAngleRank=t.scanAngleRank,r.userData=t.userData,r.pointSourceId=t.pointSourceId}function CB(r,t,e){Re(r.x,t,e),Re(r.y,t,e+4),Re(r.z,t,e+8),ur(r.intensity,t,e+12),t[e+14]=r.bitByte,t[e+15]=r.classification,t[e+16]=r.scanAngleRank&255,t[e+17]=r.userData,ur(r.pointSourceId,t,e+18)}function Vn(r,t,e,n,s,i,o){let a=o*3;t[a]=r.x*s[0]+i[0],t[a+1]=r.y*s[1]+i[1],t[a+2]=r.z*s[2]+i[2],e&&(e[o]=r.intensity),n&&(n[o]=r.classification&31)}function no(r,t,e){let n=r.classification>>5;t.syntheticFlags&&(t.syntheticFlags[e]=n&1),t.keyPointFlags&&(t.keyPointFlags[e]=n>>1&1),t.withheldFlags&&(t.withheldFlags[e]=n>>2&1),t.overlapFlags&&(t.overlapFlags[e]=0),t.scanAngles&&(t.scanAngles[e]=r.scanAngleRank),t.userData&&(t.userData[e]=r.userData),t.pointSourceIds&&(t.pointSourceIds[e]=r.pointSourceId),t.returnNumbers&&(t.returnNumbers[e]=r.bitByte&7),t.numberOfReturns&&(t.numberOfReturns[e]=r.bitByte>>3&7),t.scannerChannels&&(t.scannerChannels[e]=0),t.scanDirectionFlags&&(t.scanDirectionFlags[e]=r.bitByte>>6&1),t.edgeOfFlightLines&&(t.edgeOfFlightLines[e]=r.bitByte>>7&1)}function cw(r){return r.bitByte&7}function lw(r){return r.bitByte>>3&7}function FB(r){return r.bitByte>>6&1}function uw(r,t){r.x=t.x,r.y=t.y,r.z=t.z,r.intensity=t.intensity,r.returns=t.returns,r.flags=t.flags,r.classification=t.classification,r.userData=t.userData,r.scanAngle=t.scanAngle,r.pointSourceId=t.pointSourceId,r.gpsTime=t.gpsTime}function EB(r,t,e){r.x=qr(t,e),r.y=qr(t,e+4),r.z=qr(t,e+8),r.intensity=zu(t,e+12),r.returns=t[e+14],r.flags=t[e+15],r.classification=t[e+16],r.userData=t[e+17],r.scanAngle=GB(t,e+18),r.pointSourceId=zu(t,e+20),r.gpsTime=$B(t,e+22)}function OB(r,t){r.x=Qo(t),r.y=Qo(t),r.z=Qo(t),r.intensity=Qs(t),r.returns=t.getByte(),r.flags=t.getByte(),r.classification=t.getByte(),r.userData=t.getByte(),r.scanAngle=Zp(Qs(t)),r.pointSourceId=Qs(t),r.gpsTime=yw(t)}function NB(r,t,e){Re(r.x,t,e),Re(r.y,t,e+4),Re(r.z,t,e+8),ur(r.intensity,t,e+12),t[e+14]=r.returns,t[e+15]=r.flags,t[e+16]=r.classification,t[e+17]=r.userData,jB(r.scanAngle,t,e+18),ur(r.pointSourceId,t,e+20),gw(r.gpsTime,t,e+22)}function vc(r,t,e){Js(r,t.positions,t.intensities,t.classifications,t.scale,t.offset,e),so(r,t,e),io(r,t,e)}function Js(r,t,e,n,s,i,o){let a=o*3;t[a]=r.x*s[0]+i[0],t[a+1]=r.y*s[1]+i[1],t[a+2]=r.z*s[2]+i[2],e&&(e[o]=r.intensity),n&&(n[o]=r.classification)}function so(r,t,e){t.gpsTimes&&(t.gpsTimes[e]=r.gpsTime)}function io(r,t,e){t.scanAngles&&(t.scanAngles[e]=r.scanAngle),t.userData&&(t.userData[e]=r.userData),t.pointSourceIds&&(t.pointSourceIds[e]=r.pointSourceId),t.returnNumbers&&(t.returnNumbers[e]=r.returns&15),t.numberOfReturns&&(t.numberOfReturns[e]=r.returns>>4),t.scannerChannels&&(t.scannerChannels[e]=r.flags>>4&3),t.scanDirectionFlags&&(t.scanDirectionFlags[e]=r.flags>>6&1),t.edgeOfFlightLines&&(t.edgeOfFlightLines[e]=r.flags>>7&1),t.syntheticFlags&&(t.syntheticFlags[e]=r.flags&1),t.keyPointFlags&&(t.keyPointFlags[e]=r.flags>>1&1),t.withheldFlags&&(t.withheldFlags[e]=r.flags>>2&1),t.overlapFlags&&(t.overlapFlags[e]=r.flags>>3&1)}function ku(r,t,e){t.nir&&(t.nir[e]=r)}function oo(r,t,e,n,s){if(n.colors){let o=s*4;n.colors[o]=r&255,n.colors[o+1]=t&255,n.colors[o+2]=e&255,n.colors[o+3]=255;return}if(!n.rawColors)return;let i=s*3;n.rawColors[i]=r,n.rawColors[i+1]=t,n.rawColors[i+2]=e}function UB(r){return r.flags>>4&3}function RB(r,t){r.flags=(t&3)<<4|r.flags&-49}function PB(r,t){r.flags=t&15|r.flags&240}function kB(r,t){r.flags=(t&1)<<6|r.flags&191}function zB(r,t){r.flags=(t&1)<<7|r.flags&127}function VB(r){return r.flags&15|(r.flags>>6&1)<<4|(r.flags>>7&1)<<5}function zu(r,t){return r[t]|r[t+1]<<8}function Qs(r){let t=r.getByte(),e=r.getByte();return t|e<<8}function ur(r,t,e){t[e]=r&255,t[e+1]=r>>8&255}function GB(r,t){return Zp(zu(r,t))}function jB(r,t,e){ur(r,t,e)}function Vu(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24>>>0)>>>0}function Gu(r,t,e){Re(r,t,e)}function pw(r,t){let e=Vu(r,t),n=Vu(r,t+4);return BigInt(n)<<32n|BigInt(e)}function mw(r,t,e){Gu(Number(r&0xffffffffn),t,e),Gu(Number(r>>32n&0xffffffffn),t,e+4)}function qr(r,t){return r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24}function Qo(r){let t=r.getByte(),e=r.getByte(),n=r.getByte(),s=r.getByte();return t|e<<8|n<<16|s<<24}function Re(r,t,e){t[e]=r&255,t[e+1]=r>>8&255,t[e+2]=r>>16&255,t[e+3]=r>>24&255}function $B(r,t){for(let e=0;e<8;e++)Yp[e]=r[t+e];return to.getFloat64(0,!0)}function yw(r){for(let t=0;t<8;t++)Yp[t]=r.getByte();return to.getFloat64(0,!0)}function gw(r,t,e){to.setFloat64(0,r,!0);for(let n=0;n<8;n++)t[e+n]=Yp[n]}function Ks(r){return r<=0?0:r>=255?255:r}function Zp(r){let t=r&65535;return t&32768?t-65536:t}function $p(r){let t=r&255;return t&128?t-256:t}function fn(r){return r|0}function ju(r){return to.setFloat64(0,r,!0),to.getBigUint64(0,!0)}function ta(r){return to.setBigUint64(0,r,!0),to.getFloat64(0,!0)}function Xs(r,t){let e=BigInt.asIntN(64,BigInt.asIntN(64,ju(r))+BigInt(t));return ta(BigInt.asUintN(64,e))}function ia(r){return r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}function qB(r){let t=r.reduce((s,i)=>s+i.byteLength,0),e=new Uint8Array(t),n=0;for(let s of r)e.set(s,n),n+=s.byteLength;return e}var at,Sp,Bp,Jo,yB,Yu,gB,bB,bc,wB,sw,xB,AB,un,ea,Eu,vB,Ap,dw,Yp,to,SB,iw,BB,Ou,jt,Lp,re,Tp,ra,ti,wc,ei,Ut,Mp,eo,Dp,xc,Cp,Nu,Uu,Ru,Fp,ro,Ep,na,Op,Np,Up,Pu,Rp,Pp,kp,zp,Vp,Gp,jp,bw=d(()=>{"use strict";at=class extends Error{constructor(t="LAZ chunk decoder needs more compressed data"){super(t),this.name="NeedsMoreData"}},Sp=class{metadata;chunks=[];closed=!1;compressed=null;cursor=null;fedByteLength=0;requiredByteLength=null;progressiveRequiredByteLength=null;progressiveSelectionKey=null;constructor(t){this.metadata=t}feed(t){if(this.closed)throw new Error("Cannot feed a closed LAZ chunk decoder");let e=ia(t);this.chunks.push(e),this.compressed=null,this.fedByteLength+=e.byteLength}close(){this.closed=!0}get remainingPointCount(){return this.cursor?.remainingPointCount??this.metadata.pointCount}decode(){if(!this.closed)throw new at("LAZ chunk decoder input is not closed");return this.decodeAvailable()}readBatch(t){if(!this.cursor){if(!this.hasCompleteChunk())return null;let i=this.getCompressedAvailable(),o=this.requiredByteLength??i.byteLength;this.cursor=Wr(i.subarray(0,o),this.metadata)}if(this.cursor.remainingPointCount<=0)return null;let e=this.metadata.pointDataRecordLength,n=Math.min(t,this.cursor.remainingPointCount),s=new Uint8Array(n*e);return this.cursor.decodeInto(s,0,n),s}readPositionDataBatch(t,e){if(t.colors||t.rawColors||t.nir)throw new Error("Position-only LAZ batches cannot request color or NIR output");return this.readPointDataBatch(t,e)}readPointDataBatch(t,e){let n=this.metadata.pointDataRecordFormat;if(n<6||n>10)throw new Error("Progressive LAZ point-data batches require point formats 6-10");let s=n===7||n===8||n===10;if((t.colors||t.rawColors)&&!s)throw new Error(`Point format ${n} does not contain RGB data`);if(t.nir&&n!==8&&n!==10)throw new Error("NIR output requires point format 8 or 10");if(t.waveforms&&n!==9&&n!==10)throw new Error("Waveform output requires point format 9 or 10");if(!this.cursor){let o=this.getProgressivePointData(t);if(!o)return null;this.cursor=Wr(o,this.metadata)}if(this.cursor.remainingPointCount<=0)return 0;let i=Math.min(e,this.cursor.remainingPointCount);return this.cursor.decodeIntoPointData(t,i)}hasCompleteChunk(){if(!Zu(this.metadata.pointDataRecordFormat))return this.closed;if(this.requiredByteLength!==null)return this.fedByteLength>=this.requiredByteLength;if(this.fedByteLength<qu(this.metadata))return!1;try{let t=this.getCompressedAvailable();return this.requiredByteLength=hw(t,this.metadata),this.requiredByteLength<=this.fedByteLength}catch(t){if(t instanceof at)return!1;throw t}}decodeAvailable(){let t=this.getCompressedAvailable(),e=this.requiredByteLength??t.byteLength;return $u(t.subarray(0,e),this.metadata)}getCompressedAvailable(){return this.compressed||=qB(this.chunks),this.compressed}getProgressivePointData(t){let e=fw(Ip(t));if(this.progressiveSelectionKey!==e&&(this.progressiveRequiredByteLength=null,this.progressiveSelectionKey=e),this.progressiveRequiredByteLength===null){let o=this.getCompressedAvailable(),a=_p(o,this.metadata);if(!a)return null;let c=mB(this.metadata,t);this.progressiveRequiredByteLength=a.getByteLength(c)}if(this.fedByteLength<this.progressiveRequiredByteLength)return null;let n=this.getCompressedAvailable(),s=_p(n,this.metadata),i=new Uint8Array(s.byteLength);return i.set(n.subarray(0,Math.min(n.byteLength,s.byteLength))),i}};Bp=class{metadata;stream;decoder=null;pointIndex=0;outputMode=null;pointDataSelectionKey=null;constructor(t,e){this.metadata=e,this.stream=new Ou(ia(t))}feed(t){if(this.metadata.pointDataRecordFormat>5)throw new Error("Only legacy PDRF 0-5 LAZ cursors accept additional compressed input");this.stream.append(ia(t))}discardConsumedInput(){if(this.metadata.pointDataRecordFormat>5)throw new Error("Only legacy PDRF 0-5 LAZ cursors can discard consumed input");this.stream.discardConsumedInput()}get remainingPointCount(){return this.metadata.pointCount-this.pointIndex}get compressedByteOffset(){return this.stream.byteOffset}get requiredInputByteLength(){if(this.metadata.pointDataRecordFormat>5)return this.stream.byteOffset;let t=this.pointIndex===0?this.metadata.pointDataRecordLength+4:vp(this.metadata);return this.stream.byteOffset+t}decodeInto(t,e,n){let s=Math.min(n,this.remainingPointCount),i=this.selectOutputMode("raw",s);if(!i)return 0;let o=e;for(let a=0;a<s;a++)o=i.decompress(t,o);return this.pointIndex+=s,s}decodeAvailableInto(t,e,n,s=!1){if(this.metadata.pointDataRecordFormat>5)throw new Error("Available-point decoding is limited to legacy PDRF 0-5 LAZ chunks");let i=Math.min(n,this.remainingPointCount);if(i===0)return 0;let o=this.selectOutputMode("raw",i),a=0,c=e;for(;a<i;){let l=this.pointIndex===0?this.metadata.pointDataRecordLength+4:vp(this.metadata);if(!s&&this.stream.availableByteLength<l)break;try{c=o.decompress(t,c)}catch(u){throw u instanceof at&&!s?new Error(`Legacy LAZ point exceeded the ${l}-byte streaming lookahead`):u}a++,this.pointIndex++}return a}decodeAvailableIntoPointData(t,e,n=!1){if(this.metadata.pointDataRecordFormat>5)throw new Error("Available point-data decoding is limited to legacy PDRF 0-5 LAZ chunks");let s=Math.min(e,this.remainingPointCount);if(s===0)return 0;let i=Ip(t),o=this.selectOutputMode("point-data",s,i),a=0,c=t.pointOffset;for(;a<s;){let l=this.pointIndex===0?this.metadata.pointDataRecordLength+4:vp(this.metadata);if(!n&&this.stream.availableByteLength<l)break;try{t.pointOffset=c+a,o.decompressPointData?o.decompressPointData(t,t.pointOffset):o.decompressPointDataBatch(t,1)}catch(u){throw t.pointOffset=c,u instanceof at&&!n?new Error(`Legacy LAZ point exceeded the ${l}-byte streaming lookahead`):u}a++,this.pointIndex++}return t.pointOffset=c,a}decodeIntoPointData(t,e){let n=Math.min(e,this.remainingPointCount);if(n>0&&!_B(this.metadata.pointDataRecordFormat))throw new Error(`TypeScript LAZ decoder does not support direct point-data output for point format ${this.metadata.pointDataRecordFormat}`);let s=Ip(t),i=this.selectOutputMode("point-data",n,s);if(!i)return 0;if(i.decompressPointDataBatch)i.decompressPointDataBatch(t,n);else for(let o=0;o<n;o++)i.decompressPointData(t,t.pointOffset+o);return this.pointIndex+=n,n}selectOutputMode(t,e,n=null){if(e===0)return null;if(this.outputMode&&this.outputMode!==t)throw new Error("Cannot mix raw and point-data decoding in one LAZ chunk cursor");if(t==="point-data"){let s=fw(n);if(this.pointDataSelectionKey!==null&&this.pointDataSelectionKey!==s)throw new Error("Cannot change selected point-data fields in one LAZ chunk cursor");this.pointDataSelectionKey=s}return this.outputMode=t,this.decoder||=IB(this.stream,this.metadata,t,n),this.decoder}};Jo=16777216,yB=4294967295,Yu=13,gB=1<<Yu,bB=2**(31-Yu),bc=15,wB=1<<bc,sw=2**(31-bc),xB=[[0,1,2,3,4,5,3,4,4,5,5,5,5,5,5,5],[1,0,1,3,3,3,3,3,3,3,3,3,3,3,3,3],[2,1,2,4,4,4,4,4,4,4,4,3,3,3,3,3],[3,3,4,5,4,4,4,4,4,4,4,4,4,4,4,4],[4,3,4,4,5,4,4,4,4,4,4,4,4,4,4,4],[5,3,4,4,4,5,4,4,4,4,4,4,4,4,4,4],[3,3,4,4,4,4,5,4,4,4,4,4,4,4,4,4],[4,3,4,4,4,4,4,5,4,4,4,4,4,4,4,4],[4,3,4,4,4,4,4,4,5,4,4,4,4,4,4,4],[5,3,4,4,4,4,4,4,4,5,4,4,4,4,4,4],[5,3,4,4,4,4,4,4,4,4,5,4,4,4,4,4],[5,3,3,4,4,4,4,4,4,4,4,5,5,4,4,4],[5,3,3,4,4,4,4,4,4,4,4,5,5,5,4,4],[5,3,3,4,4,4,4,4,4,4,4,4,5,5,5,4],[5,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5],[5,3,3,4,4,4,4,4,4,4,4,4,4,4,5,5]],AB=[[0,1,2,3,4,5,6,7,7,7,7,7,7,7,7,7],[1,0,1,2,3,4,5,6,7,7,7,7,7,7,7,7],[2,1,0,1,2,3,4,5,6,7,7,7,7,7,7,7],[3,2,1,0,1,2,3,4,5,6,7,7,7,7,7,7],[4,3,2,1,0,1,2,3,4,5,6,7,7,7,7,7],[5,4,3,2,1,0,1,2,3,4,5,6,7,7,7,7],[6,5,4,3,2,1,0,1,2,3,4,5,6,7,7,7],[7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,7],[7,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7],[7,7,7,6,5,4,3,2,1,0,1,2,3,4,5,6],[7,7,7,7,6,5,4,3,2,1,0,1,2,3,4,5],[7,7,7,7,7,6,5,4,3,2,1,0,1,2,3,4],[7,7,7,7,7,7,6,5,4,3,2,1,0,1,2,3],[7,7,7,7,7,7,7,6,5,4,3,2,1,0,1,2],[7,7,7,7,7,7,7,7,6,5,4,3,2,1,0,1],[7,7,7,7,7,7,7,7,7,6,5,4,3,2,1,0]],un=500,ea=-10,Eu=511,vB=un-ea+1,Ap=un-ea+2,dw=new ArrayBuffer(8),Yp=new Uint8Array(dw),to=new DataView(dw),SB=16*1024;iw=[[15,14,13,12,11,10,9,8],[14,0,1,3,6,10,10,9],[13,1,2,4,7,11,11,10],[12,3,4,5,8,12,12,11],[11,6,7,8,9,13,13,12],[10,10,11,12,13,14,14,13],[9,10,11,12,13,14,15,14],[8,9,10,11,12,13,14,15]],BB=[[0,1,2,3,4,5,6,7],[1,0,1,2,3,4,5,6],[2,1,0,1,2,3,4,5],[3,2,1,0,1,2,3,4],[4,3,2,1,0,1,2,3],[5,4,3,2,1,0,1,2],[6,5,4,3,2,1,0,1],[7,6,5,4,3,2,1,0]],Ou=class{bytes;length;offset=0;discardedByteLength=0;constructor(t){this.bytes=t,this.length=t.byteLength}get byteOffset(){return this.discardedByteLength+this.offset}get availableByteLength(){return this.length-this.offset}get data(){return this.length===this.bytes.byteLength?this.bytes:this.bytes.subarray(0,this.length)}append(t){if(t.byteLength===0)return;let e=this.length+t.byteLength;if(e>this.bytes.byteLength){let n=Math.max(e,Math.max(64,this.bytes.byteLength*2)),s=new Uint8Array(n);s.set(this.bytes.subarray(0,this.length)),this.bytes=s}this.bytes.set(t,this.length),this.length=e}discardConsumedInput(){this.offset!==0&&(this.bytes=this.bytes.slice(this.offset,this.length),this.discardedByteLength+=this.offset,this.length-=this.offset,this.offset=0)}getByte(){if(this.offset>=this.length)throw new at;return this.bytes[this.offset++]}getBytes(t,e,n){if(this.offset+n>this.length)throw new at;t.set(this.bytes.subarray(this.offset,this.offset+n),e),this.offset+=n}consume(t){if(this.offset+t>this.length)throw new at;let e=this.offset;return this.offset+=t,e}getUint32(){let t=this.getByte(),e=this.getByte(),n=this.getByte(),s=this.getByte();return(t|e<<8|n<<16|s<<24>>>0)>>>0}},jt=class{symbols;distribution;symbolCount;decoderTable;totalCount=0;updateCycle;symbolsUntilUpdate;lastSymbol;tableSize=0;tableShift=0;constructor(t){if(t<2||t>2048)throw new Error(`Invalid arithmetic model symbol count ${t}`);if(this.symbols=t,this.lastSymbol=t-1,t>16){let e=3;for(;t>1<<e+2;)e++;this.tableSize=1<<e,this.tableShift=bc-e,this.decoderTable=new Uint32Array(this.tableSize+2)}else this.decoderTable=null;this.distribution=new Uint32Array(t),this.symbolCount=new Uint32Array(t),this.symbolCount.fill(1),this.updateCycle=t,this.symbolsUntilUpdate=t,this.update(),this.symbolsUntilUpdate=this.updateCycle=t+6>>1}update(){if(this.totalCount+=this.updateCycle,this.totalCount>wB){this.totalCount=0;for(let i=0;i<this.symbols;i++)this.symbolCount[i]=this.symbolCount[i]+1>>1,this.totalCount+=this.symbolCount[i]}let t=0,e=0,n=2147483648/this.totalCount|0;if(this.decoderTable){for(let i=0;i<this.symbols;i++){this.distribution[i]=n*t/sw|0,t+=this.symbolCount[i];let o=this.distribution[i]>>this.tableShift;for(;e<o;)this.decoderTable[++e]=i-1}for(this.decoderTable[0]=0;e<=this.tableSize;)this.decoderTable[++e]=this.symbols-1}else for(let i=0;i<this.symbols;i++)this.distribution[i]=n*t/sw|0,t+=this.symbolCount[i];this.updateCycle=5*this.updateCycle>>2;let s=this.symbols+6<<3;this.updateCycle>s&&(this.updateCycle=s),this.symbolsUntilUpdate=this.updateCycle}},Lp=class{updateCycle=4;bitsUntilUpdate=4;bit0Prob=1<<Yu-1;bit0Count=1;bitCount=2;update(){this.bitCount+=this.updateCycle,this.bitCount>gB&&(this.bitCount=this.bitCount+1>>1,this.bit0Count=this.bit0Count+1>>1,this.bit0Count===this.bitCount&&this.bitCount++);let t=2147483648/this.bitCount|0;this.bit0Prob=this.bit0Count*t/bB|0,this.updateCycle=5*this.updateCycle>>2,this.updateCycle>64&&(this.updateCycle=64),this.bitsUntilUpdate=this.updateCycle}},re=class{input;inputBytes=null;inputOffset=0;inputEnd=0;value=0;length=yB;valid=!1;constructor(t=null){this.input=t}initStream(t,e){e?(this.inputBytes=t.data,this.inputOffset=t.consume(e),this.inputEnd=this.inputOffset+e,this.input=null,this.readInitBytes(),this.valid=!0):this.valid=!1}readInitBytes(){if(this.inputBytes){let e=this.inputOffset;if(e+4>this.inputEnd)throw new at;this.value=(this.inputBytes[e]<<24>>>0|this.inputBytes[e+1]<<16|this.inputBytes[e+2]<<8|this.inputBytes[e+3])>>>0,this.inputOffset=e+4;return}let t=this.input;this.value=(t.getByte()<<24>>>0|t.getByte()<<16|t.getByte()<<8|t.getByte())>>>0}decodeBit(t){let e=this.value,n=this.length,s=t.bit0Prob*(n>>>Yu),i=e>=s?1:0;return i===0?(this.length=s>>>0,t.bit0Count++):(this.value=e-s>>>0,this.length=n-s>>>0),this.length<Jo&&this.renormalize(),--t.bitsUntilUpdate===0&&t.update(),i}decodeSymbol(t){let e,n,s=this.length,i=s,o=this.value,a=t.distribution,c=t.decoderTable;if(c){s>>>=bc;let l=o/s|0,u=l>>t.tableShift;e=c[u];let f=c[u+1]+1;for(;f>e+1;){let h=e+f>>1;a[h]>l?f=h:e=h}n=a[e]*s,e!==t.lastSymbol&&(i=a[e+1]*s)}else{n=0,e=0,s>>>=bc;let l=t.symbols,u=l>>1;do{let f=s*a[u];f>o?(l=u,i=f):(e=u,n=f),u=e+l>>1}while(u!==e)}return this.value=o-n>>>0,this.length=i-n>>>0,this.length<Jo&&this.renormalize(),t.symbolCount[e]++,--t.symbolsUntilUpdate===0&&t.update(),e}readBits(t){if(t>19){let i=this.readShort();return(this.readBits(t-16)<<16|i)>>>0}let e=this.length>>>t,n=this.value,s=n/e|0;return this.value=n-e*s>>>0,this.length=e>>>0,e<Jo&&this.renormalize(),s>>>0}readShort(){let t=this.length>>>16,e=this.value,n=e/t|0;return this.value=e-t*n>>>0,this.length=t>>>0,t<Jo&&this.renormalize(),n&65535}readInt(){let t=this.readShort();return(this.readShort()<<16|t)>>>0}readUint64(){let t=this.readInt(),e=this.readInt();return BigInt(e)<<32n|BigInt(t)}renormalize(){let t=this.value,e=this.length;if(this.inputBytes){let n=this.inputBytes,s=this.inputEnd,i=this.inputOffset;do{if(i>=s)throw new at;t=(t<<8|n[i++])>>>0,e=e<<8>>>0}while(e<Jo);this.inputOffset=i}else{let n=this.input;do t=(t<<8|n.getByte())>>>0,e=e<<8>>>0;while(e<Jo)}this.value=t,this.length=e}},Tp=class{contexts;bitsHigh;corrBits;corrRange;corrMin;mBits=[];mCorrector0=new Lp;mCorrector=[];k=0;constructor(t=16,e=1,n=8,s=0){if(this.contexts=e,this.bitsHigh=n,s){for(this.corrBits=0,this.corrRange=s;s;)s>>=1,this.corrBits++;this.corrRange===1<<this.corrBits-1&&this.corrBits--,this.corrMin=-(this.corrRange/2)}else t&&t<32?(this.corrBits=t,this.corrRange=1<<t,this.corrMin=-(this.corrRange/2)):(this.corrBits=32,this.corrRange=0,this.corrMin=-2147483648)}init(){if(!this.mBits.length){for(let t=0;t<this.contexts;t++)this.mBits.push(new jt(this.corrBits+1));for(let t=1;t<=this.corrBits;t++){let e=t<=this.bitsHigh?1<<t:1<<this.bitsHigh;this.mCorrector.push(new jt(e))}}}decompress(t,e,n){let s=t.decodeSymbol(this.mBits[n]);this.k=s;let i;if(s)if(s<32){let a=this.bitsHigh,c=this.mCorrector[s-1];if(s<=a)i=t.decodeSymbol(c);else{let l=s-a;i=t.decodeSymbol(c),i=i<<l|t.readBits(l)}i>=1<<s-1?i+=1:i-=(1<<s)-1}else i=this.corrMin;else i=t.decodeBit(this.mCorrector0);let o=fn(e+i);return this.corrRange===0||(o<0?o=fn(o+this.corrRange):o>=this.corrRange&&(o=fn(o-this.corrRange))),o}},ra=class{value0=0;value1=0;value2=0;value3=0;value4=0;high=!0;add(t){this.high?t<this.value2?(this.value4=this.value3,this.value3=this.value2,t<this.value0?(this.value2=this.value1,this.value1=this.value0,this.value0=t):t<this.value1?(this.value2=this.value1,this.value1=t):this.value2=t):(t<this.value3?(this.value4=this.value3,this.value3=t):this.value4=t,this.high=!1):this.value2<t?(this.value0=this.value1,this.value1=this.value2,this.value4<t?(this.value2=this.value3,this.value3=this.value4,this.value4=t):this.value3<t?(this.value2=this.value3,this.value3=t):this.value2=t):(this.value1<t?(this.value0=this.value1,this.value1=t):this.value0=t,this.high=!0)}get(){return this.value2}};ti=class{itemVersion;stream;decoder;changedValuesModel=new jt(64);bitByteModel=be(256,256);classificationModel=be(256,256);scanAngleRankModel=be(2,256);userDataModel=be(256,256);intensity=It(16,4);pointSourceId=It(16,1);dx=It(32,2);dy=It(32,22);z=It(32,20);lastIntensity=new Array(16).fill(0);lastHeight=new Array(8).fill(0);lastXDiffMedian=Array.from({length:16},()=>new ra);lastYDiffMedian=Array.from({length:16},()=>new ra);haveLast=!1;last=aw();firstPoint=aw();legacyXDiffs=[0,0,0];legacyYDiffs=[0,0,0];legacyDifferenceIndex=0;legacyScanAngle=null;constructor(t,e=2){this.itemVersion=e,this.stream=t,this.decoder=new re(t),e===1&&(this.legacyScanAngle=It(8,2),this.dx=It(32,1),this.dy=It(32,20),this.intensity=It(16,1))}getDecoder(){return this.decoder}decompress(t,e){let n=this.decompressPoint();return CB(n,t,e),e+20}decompressPoint(){if(!this.haveLast)return this.haveLast=!0,MB(this.last,this.stream),DB(this.firstPoint,this.last),this.itemVersion===2&&(this.last.intensity=0),this.firstPoint;if(this.itemVersion===1)return this.decompressLegacyPoint();let t=this.decoder.decodeSymbol(this.changedValuesModel);if(t){t&32&&(this.last.bitByte=this.decoder.decodeSymbol(this.bitByteModel[this.last.bitByte]));let h=cw(this.last),p=lw(this.last),y=iw[p][h];if(t&16?(this.last.intensity=this.intensity.decompress(this.decoder,this.lastIntensity[y],y<3?y:3)&65535,this.lastIntensity[y]=this.last.intensity):this.last.intensity=this.lastIntensity[y],t&8&&(this.last.classification=this.decoder.decodeSymbol(this.classificationModel[this.last.classification])),t&4){let g=this.decoder.decodeSymbol(this.scanAngleRankModel[FB(this.last)]);this.last.scanAngleRank=$p(this.last.scanAngleRank+g)}t&2&&(this.last.userData=this.decoder.decodeSymbol(this.userDataModel[this.last.userData])),t&1&&(this.last.pointSourceId=this.pointSourceId.decompress(this.decoder,this.last.pointSourceId,0)&65535)}let e=cw(this.last),n=lw(this.last),s=iw[n][e],i=BB[n][e],o=this.lastXDiffMedian[s].get(),a=this.dx.decompress(this.decoder,o,n===1?1:0);this.last.x=fn(this.last.x+a),this.lastXDiffMedian[s].add(a);let c=this.lastYDiffMedian[s].get(),l=Math.min(this.dx.k,20)&-2,u=this.dy.decompress(this.decoder,c,(n===1?1:0)+l);this.last.y=fn(this.last.y+u),this.lastYDiffMedian[s].add(u);let f=Math.min(this.dx.k+this.dy.k>>1,18)&-2;return this.last.z=this.z.decompress(this.decoder,this.lastHeight[i],(n===1?1:0)+f),this.lastHeight[i]=this.last.z,this.last}decompressLegacyPoint(){let t=this.dx.decompress(this.decoder,ow(this.legacyXDiffs),0);this.last.x=fn(this.last.x+t);let e=this.dx.k,n=this.dy.decompress(this.decoder,ow(this.legacyYDiffs),Math.min(e,19));this.last.y=fn(this.last.y+n),e=e+this.dy.k>>1,this.last.z=this.z.decompress(this.decoder,this.last.z,Math.min(e,19));let s=this.decoder.decodeSymbol(this.changedValuesModel);return s&32&&(this.last.intensity=this.intensity.decompress(this.decoder,this.last.intensity,0)&65535),s&16&&(this.last.bitByte=this.decoder.decodeSymbol(this.bitByteModel[this.last.bitByte])),s&8&&(this.last.classification=this.decoder.decodeSymbol(this.classificationModel[this.last.classification])),s&4&&(this.last.scanAngleRank=$p(this.legacyScanAngle.decompress(this.decoder,this.last.scanAngleRank&255,e<3?1:0))),s&2&&(this.last.userData=this.decoder.decodeSymbol(this.userDataModel[this.last.userData])),s&1&&(this.last.pointSourceId=this.pointSourceId.decompress(this.decoder,this.last.pointSourceId,0)&65535),this.legacyXDiffs[this.legacyDifferenceIndex]=t,this.legacyYDiffs[this.legacyDifferenceIndex]=n,this.legacyDifferenceIndex=(this.legacyDifferenceIndex+1)%3,this.last}readFirstMetadata(){this.decoder.readInitBytes()}},wc=class{itemVersion;stream;decoder;haveLast=!1;lastRed=0;lastGreen=0;lastBlue=0;usedModel=new jt(128);diffModel=be(6,256);legacyRgb=null;constructor(t,e,n=2){this.itemVersion=n,this.stream=t,this.decoder=e,n===1&&(this.usedModel=new jt(64),this.legacyRgb=It(8,6))}decompress(t,e){return this.decompressRgb(),ur(this.lastRed,t,e),ur(this.lastGreen,t,e+2),ur(this.lastBlue,t,e+4),e+6}decompressRgb(){if(!this.haveLast){this.haveLast=!0,this.lastRed=Qs(this.stream),this.lastGreen=Qs(this.stream),this.lastBlue=Qs(this.stream);return}let t=this.decoder.decodeSymbol(this.usedModel);if(this.itemVersion===1){this.lastRed=this.decodeLegacyColor(this.lastRed,0,t),this.lastGreen=this.decodeLegacyColor(this.lastGreen,1,t),this.lastBlue=this.decodeLegacyColor(this.lastBlue,2,t);return}let e=0,n=0,s=0;if(t&1?e=this.decoder.decodeSymbol(this.diffModel[0])+(this.lastRed&255)&255:e=this.lastRed&255,t&2?e|=(this.decoder.decodeSymbol(this.diffModel[1])+(this.lastRed>>8)&255)<<8:e|=this.lastRed&65280,t&64){let i=(e&255)-(this.lastRed&255);t&4?n=this.decoder.decodeSymbol(this.diffModel[2])+Ks(i+(this.lastGreen&255))&255:n=this.lastGreen&255,t&16?(i=(i+((n&255)-(this.lastGreen&255)))/2|0,s=this.decoder.decodeSymbol(this.diffModel[4])+Ks(i+(this.lastBlue&255))&255):s=this.lastBlue&255,i=(e>>8)-(this.lastRed>>8),t&8?n|=(this.decoder.decodeSymbol(this.diffModel[3])+Ks(i+(this.lastGreen>>8))&255)<<8:n|=this.lastGreen&65280,t&32?(i=(i+(n>>8)-(this.lastGreen>>8))/2|0,s|=(this.decoder.decodeSymbol(this.diffModel[5])+Ks(i+(this.lastBlue>>8))&255)<<8):s|=this.lastBlue&65280}else n=e,s=e;this.lastRed=e,this.lastGreen=n,this.lastBlue=s}decodeLegacyColor(t,e,n){let s=0;for(let i=0;i<2;i++){let o=e*2+i,a=t>>i*8&255,c=n&1<<o?this.legacyRgb.decompress(this.decoder,a,o):a;s|=c<<i*8}return s}get decodedRed(){return this.lastRed}get decodedGreen(){return this.lastGreen}get decodedBlue(){return this.lastBlue}},ei=class{itemVersion;stream;decoder;count;haveLast=!1;last;models;legacyBytes;constructor(t,e,n,s=2){this.itemVersion=s,this.stream=t,this.decoder=e,this.count=n,this.last=new Uint8Array(n),this.models=be(n,256),this.legacyBytes=s===1?It(8,n):null}get byteCount(){return this.count}decompress(t,e){return this.decompressToTarget(t,e),e+this.count}decompressToTarget(t,e=0){if(this.count!==0){if(!this.haveLast){this.stream.getBytes(this.last,0,this.count),t?.set(this.last,e),this.haveLast=!0;return}for(let n=0;n<this.count;n++){let s=this.itemVersion===1?this.legacyBytes.decompress(this.decoder,this.last[n],n):this.last[n]+this.decoder.decodeSymbol(this.models[n])&255;t&&(t[e+n]=s),this.last[n]=s}}}};(function(r){r[r.Full=0]="Full",r[r.PointData=1]="PointData"})(Ut||(Ut={}));Mp=class{changedValuesModel=be(8,128);scannerChannelModel=new jt(3);returnNumberGpsSameModel=new jt(13);numberReturnsModel=be(16,16);returnNumberModel=be(16,16);classModel=[];flagModel=[];userDataModel=[];gpsTimeMultiModel;gpsTime0DiffModel;dx=It(32,2);dy=It(32,22);z=It(32,20);intensity=null;scanAngle;pointSourceId;gpsTime;haveLast=!1;last=TB();lastIntensity=[];lastZ=new Array(8).fill(0);lastXDiffMedian=Array.from({length:12},()=>new ra);lastYDiffMedian=Array.from({length:12},()=>new ra);lastGpsSequence=0;nextGpsSequence=0;lastGpsTime=[];lastGpsTimeDiff=[];multiExtremeCounter=[];gpsTimeChange=!1;constructor(t,e){(t===Ut.Full||e?.classification)&&(this.classModel=be(64,256)),(t===Ut.Full||e?.intensity)&&(this.intensity=It(16,4),this.lastIntensity=new Array(8).fill(0)),(t===Ut.Full||e?.userData)&&(this.userDataModel=be(64,256)),(t===Ut.Full||e?.scanAngle)&&(this.scanAngle=It(16,2)),(t===Ut.Full||e?.pointSourceId)&&(this.pointSourceId=It(16,1)),(t===Ut.Full||e?.flags)&&(this.flagModel=be(64,64)),(t===Ut.Full||e?.gpsTime)&&(this.gpsTimeMultiModel=new jt(515),this.gpsTime0DiffModel=new jt(5),this.gpsTime=It(32,9),this.lastGpsTime=new Array(4).fill(0),this.lastGpsTimeDiff=new Array(4).fill(0),this.multiExtremeCounter=new Array(4).fill(0))}},eo=class{stream;contexts;activeContext=null;decompressOptionalFields;xy=new re;z=new re;classification;flags;intensity;scanAngle;userData;pointSourceId;gpsTime;sizes=[];currentScannerChannel=0;itemContextChannel=0;itemVersion;constructor(t,e=Ut.Full,n=3,s=null){this.stream=t,this.itemVersion=n,this.contexts=Array.from({length:4},()=>new Mp(e,s)),this.decompressOptionalFields=e===Ut.Full,this.classification=this.decompressOptionalFields||s?.classification?new re:null,this.flags=this.decompressOptionalFields||s?.flags?new re:null,this.intensity=this.decompressOptionalFields||s?.intensity?new re:null,this.scanAngle=this.decompressOptionalFields||s?.scanAngle?new re:null,this.userData=this.decompressOptionalFields||s?.userData?new re:null,this.pointSourceId=this.decompressOptionalFields||s?.pointSourceId?new re:null,this.gpsTime=this.decompressOptionalFields||s?.gpsTime?new re:null}readSizes(){this.sizes=[];for(let t=0;t<9;t++)this.sizes.push(this.stream.getUint32())}readData(){let t=0;this.xy.initStream(this.stream,this.sizes[t++]),this.z.initStream(this.stream,this.sizes[t++]),this.initializeOptionalStream(this.classification,this.sizes[t++]),this.initializeOptionalStream(this.flags,this.sizes[t++]),this.initializeOptionalStream(this.intensity,this.sizes[t++]),this.initializeOptionalStream(this.scanAngle,this.sizes[t++]),this.initializeOptionalStream(this.userData,this.sizes[t++]),this.initializeOptionalStream(this.pointSourceId,this.sizes[t++]),this.initializeOptionalStream(this.gpsTime,this.sizes[t++])}initializeOptionalStream(t,e){t?t.initStream(this.stream,e):this.stream.consume(e)}decompress(t,e){let n=this.decompressPoint(t,e);return NB(n,t,e),e+30}decompressPoint(t,e=0){let n=this.gpsTime!==null;if(!this.activeContext){let st=this.contexts[0].last;t?(this.stream.getBytes(t,e,30),EB(st,t,e)):OB(st,this.stream),this.currentScannerChannel=UB(st),this.itemContextChannel=this.currentScannerChannel;let rt=this.contexts[this.currentScannerChannel];return rt.last!==st&&uw(rt.last,st),rt.haveLast=!0,n&&(rt.lastGpsTime[0]=rt.last.gpsTime),this.activeContext=rt,rt.lastZ.fill(rt.last.z),rt.lastIntensity.length&&rt.lastIntensity.fill(rt.last.intensity),rt.last}let s=this.activeContext,i=s.last.returns,o=i&15,a=(o===1?1:0)|(o>=i>>4?1:0)<<1|(s.gpsTimeChange?1:0)<<2,c=this.xy.decodeSymbol(s.changedValuesModel[a]),l=!!(c>>6&1),u=!!(c>>5&1),f=!!(c>>4&1),h=!!(c>>3&1),p=!!(c>>2&1),y=!!(c>>1&1),g=!!(c&1),w=g&&!y,S=y&&!g,E=g&&y;this.itemContextChannel=0;let I=this.currentScannerChannel,b=s;if(l){let st=this.xy.decodeSymbol(s.scannerChannelModel);I=(I+st+1)%4,b=this.contexts[I],this.activeContext=b,this.itemContextChannel=I}this.currentScannerChannel=I,this.itemVersion>=4&&(this.itemContextChannel=I),b.haveLast||(b.haveLast=!0,uw(b.last,s.last),b.lastZ.fill(s.last.z),b.lastIntensity.length&&b.lastIntensity.fill(s.last.intensity),n&&(b.lastGpsTime[0]=s.last.gpsTime)),RB(b.last,I);let C=b.last.returns>>4,L=b.last.returns&15;p&&(C=this.xy.decodeSymbol(b.numberReturnsModel[C])),w?L=(L+1)%16:S?L=(L+15)%16:E&&(L=f?this.xy.decodeSymbol(b.returnNumberModel[L]):(L+this.xy.decodeSymbol(b.returnNumberGpsSameModel)+2)%16),b.last.returns=C<<4|L;let q=xB[C][L]<<1|(f?1:0),K=b.lastXDiffMedian[q].get(),ft=b.dx.decompress(this.xy,K,C===1?1:0);b.last.x=fn(b.last.x+ft),b.lastXDiffMedian[q].add(ft);let dt=Math.min(b.dx.k,20)&-2,Bt=b.lastYDiffMedian[q].get(),ie=b.dy.decompress(this.xy,Bt,(C===1?1:0)|dt);if(b.last.y=fn(b.last.y+ie),b.lastYDiffMedian[q].add(ie),this.z.valid){let st=Math.min(b.dx.k+b.dy.k>>1,18)&-2,rt=AB[C][L],Xe=b.z.decompress(this.z,b.lastZ[rt],(C===1?1:0)|st);b.last.z=Xe,b.lastZ[rt]=Xe}if(this.classification?.valid){let st=(L===1&&L>=C?1:0)|(b.last.classification&31)<<1;b.last.classification=this.classification.decodeSymbol(b.classModel[st])}if(this.flags?.valid){let st=VB(b.last),rt=this.flags.decodeSymbol(b.flagModel[st]);zB(b.last,rt>>5&1),kB(b.last,rt>>4&1),PB(b.last,rt&15)}if(this.intensity?.valid){let st=(f?1:0)|(L>=C?1:0)<<1|(L===1?1:0)<<2,rt=b.intensity.decompress(this.intensity,b.lastIntensity[st],st>>1);b.lastIntensity[st]=rt&65535,b.last.intensity=rt&65535}if(h&&this.scanAngle&&(b.last.scanAngle=Zp(b.scanAngle.decompress(this.scanAngle,b.last.scanAngle,f?1:0))),this.userData?.valid){let st=b.last.userData>>2;b.last.userData=this.userData.decodeSymbol(b.userDataModel[st])}return u&&this.pointSourceId&&(b.last.pointSourceId=b.pointSourceId.decompress(this.pointSourceId,b.last.pointSourceId,0)&65535),f&&this.gpsTime&&this.decodeGpsTime(b),b.gpsTimeChange=f,b.last}decodeGpsTime(t){let e=this.gpsTime;for(;;){if(t.lastGpsTimeDiff[t.lastGpsSequence]===0){let n=e.decodeSymbol(t.gpsTime0DiffModel);if(n===0){let s=t.gpsTime.decompress(e,0,0);t.lastGpsTimeDiff[t.lastGpsSequence]=s,t.lastGpsTime[t.lastGpsSequence]=Xs(t.lastGpsTime[t.lastGpsSequence],s),t.multiExtremeCounter[t.lastGpsSequence]=0}else if(n===1){t.nextGpsSequence=t.nextGpsSequence+1&3;let s=ju(t.lastGpsTime[t.lastGpsSequence]),i=t.gpsTime.decompress(e,Number(s>>32n)|0,8),o=e.readInt();t.lastGpsTime[t.nextGpsSequence]=ta(BigInt(i>>>0)<<32n|BigInt(o)),t.lastGpsSequence=t.nextGpsSequence,t.lastGpsTimeDiff[t.lastGpsSequence]=0,t.multiExtremeCounter[t.lastGpsSequence]=0}else{t.lastGpsSequence=t.lastGpsSequence+n-1&3;continue}}else{let n=e.decodeSymbol(t.gpsTimeMultiModel),s=0;if(n===1){let i=t.gpsTime.decompress(e,t.lastGpsTimeDiff[t.lastGpsSequence],1);t.lastGpsTime[t.lastGpsSequence]=Xs(t.lastGpsTime[t.lastGpsSequence],i),t.multiExtremeCounter[t.lastGpsSequence]=0}else if(n<Eu){if(n===0)s=t.gpsTime.decompress(e,0,7),t.multiExtremeCounter[t.lastGpsSequence]++,t.multiExtremeCounter[t.lastGpsSequence]>3&&(t.multiExtremeCounter[t.lastGpsSequence]=0,t.lastGpsTimeDiff[t.lastGpsSequence]=s);else if(n<un){let i=n<10?2:3;s=t.gpsTime.decompress(e,n*t.lastGpsTimeDiff[t.lastGpsSequence],i)}else n===un?(s=t.gpsTime.decompress(e,un*t.lastGpsTimeDiff[t.lastGpsSequence],4),t.multiExtremeCounter[t.lastGpsSequence]++,t.multiExtremeCounter[t.lastGpsSequence]>3&&(t.multiExtremeCounter[t.lastGpsSequence]=0,t.lastGpsTimeDiff[t.lastGpsSequence]=s)):(n=un-n,n>ea?s=t.gpsTime.decompress(e,n*t.lastGpsTimeDiff[t.lastGpsSequence],5):(s=t.gpsTime.decompress(e,ea*t.lastGpsTimeDiff[t.lastGpsSequence],6),t.multiExtremeCounter[t.lastGpsSequence]++,t.multiExtremeCounter[t.lastGpsSequence]>3&&(t.multiExtremeCounter[t.lastGpsSequence]=0,t.lastGpsTimeDiff[t.lastGpsSequence]=s)));t.lastGpsTime[t.lastGpsSequence]=Xs(t.lastGpsTime[t.lastGpsSequence],s)}else if(n===Eu){t.nextGpsSequence=t.nextGpsSequence+1&3;let i=ju(t.lastGpsTime[t.lastGpsSequence]),o=t.gpsTime.decompress(e,Number(i>>32n)|0,8),a=e.readInt();t.lastGpsTime[t.nextGpsSequence]=ta(BigInt(o>>>0)<<32n|BigInt(a)),t.lastGpsSequence=t.nextGpsSequence,t.lastGpsTimeDiff[t.lastGpsSequence]=0,t.multiExtremeCounter[t.lastGpsSequence]=0}else if(n>=Eu){t.lastGpsSequence=t.lastGpsSequence+n-Eu&3;continue}}t.last.gpsTime=t.lastGpsTime[t.lastGpsSequence];break}}},Dp=class{haveLast=!1;lastRed=0;lastGreen=0;lastBlue=0;usedModel=new jt(128);diffModel=be(6,256)},xc=class{stream;contexts=Array.from({length:4},()=>new Dp);activeContext=null;lastChannel=-1;rgbCount=0;rgb=new re;decodedRed=0;decodedGreen=0;decodedBlue=0;itemVersion;constructor(t,e=3){this.stream=t,this.itemVersion=e}readSizes(){this.rgbCount=this.stream.getUint32()}readData(){this.rgb.initStream(this.stream,this.rgbCount)}decompress(t,e,n){return this.decompressRgb(n),ur(this.decodedRed,t,e),ur(this.decodedGreen,t,e+2),ur(this.decodedBlue,t,e+4),e+6}decompressRgb(t){if(this.lastChannel===-1){this.decodedRed=this.stream.getByte()|this.stream.getByte()<<8,this.decodedGreen=this.stream.getByte()|this.stream.getByte()<<8,this.decodedBlue=this.stream.getByte()|this.stream.getByte()<<8;let c=this.contexts[t];c.lastRed=this.decodedRed,c.lastGreen=this.decodedGreen,c.lastBlue=this.decodedBlue,c.haveLast=!0,this.lastChannel=t,this.activeContext=c;return}if(this.rgbCount===0){let c=this.activeContext;this.decodedRed=c.lastRed,this.decodedGreen=c.lastGreen,this.decodedBlue=c.lastBlue;return}let e=this.activeContext,n=e;if(t!==this.lastChannel){let c=e;e=this.contexts[t],n=c,this.lastChannel=t,e.haveLast||(e.haveLast=!0,e.lastRed=c.lastRed,e.lastGreen=c.lastGreen,e.lastBlue=c.lastBlue,n=e),this.itemVersion>=4&&(n=e),this.activeContext=e}let s=this.rgb.decodeSymbol(e.usedModel),i=0,o=0,a=0;if(s&1?i=this.rgb.decodeSymbol(e.diffModel[0])+(n.lastRed&255)&255:i=n.lastRed&255,s&2){let c=this.rgb.decodeSymbol(e.diffModel[1]);i|=(c+(n.lastRed>>8)&255)<<8}else i|=n.lastRed&65280;if(s&64){let c=(i&255)-(n.lastRed&255);if(s&4?o=this.rgb.decodeSymbol(e.diffModel[2])+Ks(c+(n.lastGreen&255))&255:o=n.lastGreen&255,s&16){let l=this.rgb.decodeSymbol(e.diffModel[4]);c=(c+((o&255)-(n.lastGreen&255)))/2|0,a=l+Ks(c+(n.lastBlue&255))&255}else a=n.lastBlue&255;if(c=(i>>8)-(n.lastRed>>8),s&8){let l=this.rgb.decodeSymbol(e.diffModel[3]);o|=(l+Ks(c+(n.lastGreen>>8))&255)<<8}else o|=n.lastGreen&65280;if(s&32){let l=this.rgb.decodeSymbol(e.diffModel[5]);c=(c+(o>>8)-(n.lastGreen>>8))/2|0,a|=(l+Ks(c+(n.lastBlue>>8))&255)<<8}else a|=n.lastBlue&65280}else o=i,a=i;n.lastRed=i,n.lastGreen=o,n.lastBlue=a,this.decodedRed=i,this.decodedGreen=o,this.decodedBlue=a}},Cp=class{haveLast=!1;lastValue=0;usedModel=new jt(4);diffModel=be(2,256)},Nu=class{stream;contexts=Array.from({length:4},()=>new Cp);lastChannel=-1;nirCount=0;nir=new re;scratch=new Uint8Array(2);decodedNir=0;itemVersion;constructor(t,e=3){this.stream=t,this.itemVersion=e}readSizes(){this.nirCount=this.stream.getUint32()}readData(){this.nir.initStream(this.stream,this.nirCount)}decompress(t,e,n){if(this.lastChannel===-1){this.stream.getBytes(t,e,2);let c=this.contexts[n];return c.lastValue=zu(t,e),c.haveLast=!0,this.lastChannel=n,this.decodedNir=c.lastValue,e+2}if(this.nirCount===0)return ur(this.contexts[this.lastChannel].lastValue,t,e),this.decodedNir=this.contexts[this.lastChannel].lastValue,e+2;let s=this.contexts[n],i=this.contexts[this.lastChannel];n!==this.lastChannel&&(this.lastChannel=n,s.haveLast||(s.haveLast=!0,s.lastValue=i.lastValue,i=s),this.itemVersion>=4&&(i=s));let o=this.nir.decodeSymbol(s.usedModel),a=o&1?this.nir.decodeSymbol(s.diffModel[0])+(i.lastValue&255)&255:i.lastValue&255;return a|=o&2?(this.nir.decodeSymbol(s.diffModel[1])+(i.lastValue>>8)&255)<<8:i.lastValue&65280,i.lastValue=a,this.decodedNir=a,ur(a,t,e),e+2}decompressNir(t){return this.decompress(this.scratch,0,t),this.decodedNir}},Uu=class{haveLast=!1;descriptorIndex=0;offset=0n;packetSize=0;returnPointBits=0;xBits=0;yBits=0;zBits=0;lastOffsetDifference=0;lastOffsetDifferenceSymbol=0;descriptorModel=new jt(256);offsetDifferenceModels=be(4,4);offsetDifferenceDecompressor=It(32,1);packetSizeDecompressor=It(32,1);returnPointDecompressor=It(32,1);vectorDecompressor=It(32,3)},Ru=class{stream;contexts=Array.from({length:4},()=>new Uu);lastChannel=-1;wavePacketByteCount=0;decoder=new re;itemVersion;constructor(t,e){this.stream=t,this.itemVersion=e}readSizes(){this.wavePacketByteCount=this.stream.getUint32()}readData(){this.decoder.initStream(this.stream,this.wavePacketByteCount)}decompress(t,e,n){if(this.lastChannel===-1){this.stream.getBytes(t,e,29);let a=this.contexts[n];return this.readContext(a,t,e),a.haveLast=!0,this.lastChannel=n,e+29}let s=this.contexts[this.lastChannel],i=this.contexts[n],o=i;return n!==this.lastChannel&&(o=s,i.haveLast?this.itemVersion>=4&&(o=i):(this.copyLastWavePacket(i,s),i.haveLast=!0,o=i),this.lastChannel=n),this.wavePacketByteCount&&this.decodeContext(i,o),this.writeContext(o,t,e),e+29}decompressToTarget(t,e,n){this.decompress(t,e,n)}decodeContext(t,e){e.descriptorIndex=this.decoder.decodeSymbol(t.descriptorModel);let n=this.decoder.decodeSymbol(t.offsetDifferenceModels[t.lastOffsetDifferenceSymbol]);switch(t.lastOffsetDifferenceSymbol=n,n){case 0:break;case 1:e.offset=BigInt.asUintN(64,e.offset+BigInt(e.packetSize));break;case 2:t.lastOffsetDifference=t.offsetDifferenceDecompressor.decompress(this.decoder,t.lastOffsetDifference,0),e.offset=BigInt.asUintN(64,e.offset+BigInt(t.lastOffsetDifference));break;default:e.offset=this.decoder.readUint64();break}e.packetSize=t.packetSizeDecompressor.decompress(this.decoder,e.packetSize|0,0)>>>0,e.returnPointBits=t.returnPointDecompressor.decompress(this.decoder,e.returnPointBits,0),e.xBits=t.vectorDecompressor.decompress(this.decoder,e.xBits,0),e.yBits=t.vectorDecompressor.decompress(this.decoder,e.yBits,1),e.zBits=t.vectorDecompressor.decompress(this.decoder,e.zBits,2)}copyLastWavePacket(t,e){t.descriptorIndex=e.descriptorIndex,t.offset=e.offset,t.packetSize=e.packetSize,t.returnPointBits=e.returnPointBits,t.xBits=e.xBits,t.yBits=e.yBits,t.zBits=e.zBits}readContext(t,e,n){t.descriptorIndex=e[n],t.offset=pw(e,n+1),t.packetSize=Vu(e,n+9),t.returnPointBits=qr(e,n+13),t.xBits=qr(e,n+17),t.yBits=qr(e,n+21),t.zBits=qr(e,n+25)}writeContext(t,e,n){e[n]=t.descriptorIndex,mw(t.offset,e,n+1),Gu(t.packetSize,e,n+9),Re(t.returnPointBits,e,n+13),Re(t.xBits,e,n+17),Re(t.yBits,e,n+21),Re(t.zBits,e,n+25)}},Fp=class{haveLast=!1;last;byteModel;constructor(t){this.last=new Uint8Array(t),this.byteModel=be(t,256)}},ro=class{stream;count;contexts;lastChannel=-1;byteCount;byteDecoder;itemVersion;constructor(t,e,n=3){this.stream=t,this.count=e,this.itemVersion=n,this.contexts=Array.from({length:4},()=>new Fp(e)),this.byteCount=new Array(e).fill(0),this.byteDecoder=Array.from({length:e},()=>new re)}readSizes(){for(let t=0;t<this.count;t++)this.byteCount[t]=this.stream.getUint32()}readData(){for(let t=0;t<this.count;t++)this.byteDecoder[t].initStream(this.stream,this.byteCount[t])}decompress(t,e,n){if(this.lastChannel===-1){this.stream.getBytes(t,e,this.count);let o=this.contexts[n];return o.last.set(t.subarray(e,e+this.count)),o.haveLast=!0,this.lastChannel=n,e+this.count}let s=this.contexts[n],i=this.contexts[this.lastChannel].last;n!==this.lastChannel&&(this.lastChannel=n,s.haveLast||(s.haveLast=!0,s.last.set(i),i=this.contexts[this.lastChannel].last),this.itemVersion>=4&&(i=s.last));for(let o=0;o<this.count;o++)if(this.byteCount[o]){let a=i[o]+this.byteDecoder[o].decodeSymbol(s.byteModel[o])&255;t[e+o]=a,i[o]=a}else t[e+o]=i[o];return e+this.count}};Ep=class{point;bytes;first=!0;constructor(t,e,n){this.point=new ti(t,n.point10ItemVersion??2),this.bytes=new ei(t,this.point.getDecoder(),e,n.byteItemVersion??2)}decompress(t,e){return e=this.point.decompress(t,e),e=this.bytes.decompress(t,e),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint();this.bytes.decompressToTarget(t.extraBytes,e*this.bytes.byteCount),this.readFirstMetadata(),Vn(n,t.positions,t.intensities,t.classifications,t.scale,t.offset,e),no(n,t,e)}decompressPointDataBatch(t,e){for(let n=0;n<e;n++)this.decompressPointData(t,t.pointOffset+n)}readFirstMetadata(){this.first&&(this.point.readFirstMetadata(),this.first=!1)}},na=class{itemVersion;stream;decoder;gpsTimeMultiModel=new jt(516);gpsTime0DiffModel=new jt(6);gpsTime=It(32,9);lastGpsSequence=0;nextGpsSequence=0;lastGpsTime=new Array(4).fill(0);lastGpsTimeDiff=new Array(4).fill(0);multiExtremeCounter=new Array(4).fill(0);haveLast=!1;constructor(t,e,n=2){this.itemVersion=n,this.stream=t,this.decoder=e,n===1&&(this.gpsTimeMultiModel=new jt(512),this.gpsTime0DiffModel=new jt(3),this.gpsTime=It(32,6))}decompress(t,e){return gw(this.decompressGpsTime(),t,e),e+8}decompressGpsTime(){return this.haveLast?(this.itemVersion===1?this.decodeLegacyGpsTime():this.decodeGpsTime(),this.lastGpsTime[this.lastGpsSequence]):(this.lastGpsTime[0]=yw(this.stream),this.haveLast=!0,this.lastGpsTime[0])}decodeLegacyGpsTime(){let t=this.lastGpsTimeDiff[0];if(t===0){let o=this.decoder.decodeSymbol(this.gpsTime0DiffModel);if(o===1){let a=this.gpsTime.decompress(this.decoder,0,0);this.lastGpsTimeDiff[0]=a,this.lastGpsTime[0]=Xs(this.lastGpsTime[0],a)}else o===2&&(this.lastGpsTime[0]=ta(this.decoder.readUint64()));return}let e=this.decoder.decodeSymbol(this.gpsTimeMultiModel);if(e===511)return;if(e===510){this.lastGpsTime[0]=ta(this.decoder.readUint64());return}let n=e===1?1:e===0?2:e<10?3:e<50?4:5,s=e===0?Math.trunc(t/4):fn(e*t),i=this.gpsTime.decompress(this.decoder,s,n);e===1?(this.lastGpsTimeDiff[0]=i,this.multiExtremeCounter[0]=0):(e===0||e===509)&&++this.multiExtremeCounter[0]>3&&(this.lastGpsTimeDiff[0]=i,this.multiExtremeCounter[0]=0),this.lastGpsTime[0]=Xs(this.lastGpsTime[0],i)}decodeGpsTime(){for(;;){if(this.lastGpsTimeDiff[this.lastGpsSequence]===0){let n=this.decoder.decodeSymbol(this.gpsTime0DiffModel);if(n===0)break;if(n===1){let s=this.gpsTime.decompress(this.decoder,0,0);this.lastGpsTimeDiff[this.lastGpsSequence]=s,this.lastGpsTime[this.lastGpsSequence]=Xs(this.lastGpsTime[this.lastGpsSequence],s),this.multiExtremeCounter[this.lastGpsSequence]=0;break}if(n===2){this.readFullGpsTime();break}this.lastGpsSequence=this.lastGpsSequence+n-2&3;continue}let t=this.decoder.decodeSymbol(this.gpsTimeMultiModel),e=0;if(t===1){let n=this.gpsTime.decompress(this.decoder,this.lastGpsTimeDiff[this.lastGpsSequence],1);this.lastGpsTime[this.lastGpsSequence]=Xs(this.lastGpsTime[this.lastGpsSequence],n),this.multiExtremeCounter[this.lastGpsSequence]=0}else if(t<vB){if(t===0)e=this.gpsTime.decompress(this.decoder,0,7),this.multiExtremeCounter[this.lastGpsSequence]++,this.multiExtremeCounter[this.lastGpsSequence]>3&&(this.multiExtremeCounter[this.lastGpsSequence]=0,this.lastGpsTimeDiff[this.lastGpsSequence]=e);else if(t<un){let n=t<10?2:3;e=this.gpsTime.decompress(this.decoder,t*this.lastGpsTimeDiff[this.lastGpsSequence],n)}else t===un?(e=this.gpsTime.decompress(this.decoder,un*this.lastGpsTimeDiff[this.lastGpsSequence],4),this.multiExtremeCounter[this.lastGpsSequence]++,this.multiExtremeCounter[this.lastGpsSequence]>3&&(this.multiExtremeCounter[this.lastGpsSequence]=0,this.lastGpsTimeDiff[this.lastGpsSequence]=e)):(t=un-t,t>ea?e=this.gpsTime.decompress(this.decoder,t*this.lastGpsTimeDiff[this.lastGpsSequence],5):(e=this.gpsTime.decompress(this.decoder,ea*this.lastGpsTimeDiff[this.lastGpsSequence],6),this.multiExtremeCounter[this.lastGpsSequence]++,this.multiExtremeCounter[this.lastGpsSequence]>3&&(this.multiExtremeCounter[this.lastGpsSequence]=0,this.lastGpsTimeDiff[this.lastGpsSequence]=e)));this.lastGpsTime[this.lastGpsSequence]=Xs(this.lastGpsTime[this.lastGpsSequence],e)}else if(t===Ap)this.readFullGpsTime();else if(t>=Ap){this.lastGpsSequence=this.lastGpsSequence+t-Ap&3;continue}break}}readFullGpsTime(){this.nextGpsSequence=this.nextGpsSequence+1&3;let t=ju(this.lastGpsTime[this.lastGpsSequence]),e=this.gpsTime.decompress(this.decoder,Number(t>>32n)|0,8),n=this.decoder.readInt();this.lastGpsTime[this.nextGpsSequence]=ta(BigInt(e>>>0)<<32n|BigInt(n)),this.lastGpsSequence=this.nextGpsSequence,this.lastGpsTimeDiff[this.lastGpsSequence]=0,this.multiExtremeCounter[this.lastGpsSequence]=0}},Op=class{point;gpsTime;bytes;first=!0;constructor(t,e,n){this.point=new ti(t,n.point10ItemVersion??2);let s=this.point.getDecoder();this.gpsTime=new na(t,s,n.gpsTime11ItemVersion??2),this.bytes=new ei(t,s,e,n.byteItemVersion??2)}decompress(t,e){return e=this.point.decompress(t,e),e=this.gpsTime.decompress(t,e),e=this.bytes.decompress(t,e),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint(),s=this.gpsTime.decompressGpsTime();this.bytes.decompressToTarget(t.extraBytes,e*this.bytes.byteCount),this.readFirstMetadata(),Vn(n,t.positions,t.intensities,t.classifications,t.scale,t.offset,e),no(n,t,e),t.gpsTimes&&(t.gpsTimes[e]=s)}decompressPointDataBatch(t,e){for(let n=0;n<e;n++)this.decompressPointData(t,t.pointOffset+n)}readFirstMetadata(){this.first&&(this.point.readFirstMetadata(),this.first=!1)}},Np=class{point;rgb;bytes;first=!0;constructor(t,e,n){this.point=new ti(t,n.point10ItemVersion??2);let s=this.point.getDecoder();this.rgb=new wc(t,s,n.rgb12ItemVersion??2),this.bytes=new ei(t,s,e,n.byteItemVersion??2)}decompress(t,e){return e=this.point.decompress(t,e),e=this.rgb.decompress(t,e),e=this.bytes.decompress(t,e),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint();this.rgb.decompressRgb(),this.bytes.decompressToTarget(t.extraBytes,e*this.bytes.byteCount),this.readFirstMetadata(),Vn(n,t.positions,t.intensities,t.classifications,t.scale,t.offset,e),no(n,t,e),oo(this.rgb.decodedRed,this.rgb.decodedGreen,this.rgb.decodedBlue,t,e)}decompressPointDataBatch(t,e){for(let n=0;n<e;n++)this.decompressPointData(t,t.pointOffset+n)}readFirstMetadata(){this.first&&(this.point.readFirstMetadata(),this.first=!1)}},Up=class{point;gpsTime;rgb;bytes;first=!0;directCommonOutput;constructor(t,e,n,s=null){this.point=new ti(t,n.point10ItemVersion??2);let i=this.point.getDecoder();this.gpsTime=new na(t,i,n.gpsTime11ItemVersion??2),this.rgb=new wc(t,i,n.rgb12ItemVersion??2),this.bytes=new ei(t,i,e,n.byteItemVersion??2),this.directCommonOutput=!!(s&&!s.gpsTime&&!s.scanAngle&&!s.userData&&!s.pointSourceId&&!s.flags&&!s.waveform&&!s.extraBytes)}decompress(t,e){return e=this.point.decompress(t,e),e=this.gpsTime.decompress(t,e),e=this.rgb.decompress(t,e),e=this.bytes.decompress(t,e),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint(),s=this.gpsTime.decompressGpsTime();if(this.rgb.decompressRgb(),this.directCommonOutput){if(this.bytes.decompressToTarget(),this.readFirstMetadata(),Vn(n,t.positions,t.intensities,t.classifications,t.scale,t.offset,e),t.colors){let i=e*4;t.colors[i]=this.rgb.decodedRed&255,t.colors[i+1]=this.rgb.decodedGreen&255,t.colors[i+2]=this.rgb.decodedBlue&255,t.colors[i+3]=255}else if(t.rawColors){let i=e*3;t.rawColors[i]=this.rgb.decodedRed,t.rawColors[i+1]=this.rgb.decodedGreen,t.rawColors[i+2]=this.rgb.decodedBlue}return}this.bytes.decompressToTarget(t.extraBytes,e*this.bytes.byteCount),this.readFirstMetadata(),Vn(n,t.positions,t.intensities,t.classifications,t.scale,t.offset,e),no(n,t,e),t.gpsTimes&&(t.gpsTimes[e]=s),oo(this.rgb.decodedRed,this.rgb.decodedGreen,this.rgb.decodedBlue,t,e)}decompressPointDataBatch(t,e){let n=t.positions,s=t.intensities,i=t.classifications,o=t.colors,a=t.rawColors,c=t.scale,l=t.offset,u=this.bytes.byteCount,f=t.pointOffset;if(!!!(t.gpsTimes||t.scanAngles||t.userData||t.pointSourceIds||t.returnNumbers||t.numberOfReturns||t.scannerChannels||t.scanDirectionFlags||t.edgeOfFlightLines||t.syntheticFlags||t.keyPointFlags||t.withheldFlags||t.overlapFlags)&&!t.extraBytes){for(let p=0;p<e;p++){let y=this.point.decompressPoint();if(this.gpsTime.decompressGpsTime(),this.rgb.decompressRgb(),this.bytes.decompressToTarget(),this.readFirstMetadata(),Vn(y,n,s,i,c,l,f),o){let g=f*4;o[g]=this.rgb.decodedRed&255,o[g+1]=this.rgb.decodedGreen&255,o[g+2]=this.rgb.decodedBlue&255,o[g+3]=255}else if(a){let g=f*3;a[g]=this.rgb.decodedRed,a[g+1]=this.rgb.decodedGreen,a[g+2]=this.rgb.decodedBlue}f++}return}for(let p=0;p<e;p++){let y=this.point.decompressPoint(),g=this.gpsTime.decompressGpsTime();this.rgb.decompressRgb(),this.bytes.decompressToTarget(t.extraBytes,f*u),this.readFirstMetadata(),Vn(y,n,s,i,c,l,f),no(y,t,f),t.gpsTimes&&(t.gpsTimes[f]=g),oo(this.rgb.decodedRed,this.rgb.decodedGreen,this.rgb.decodedBlue,t,f),f++}}readFirstMetadata(){this.first&&(this.point.readFirstMetadata(),this.first=!1)}},Pu=class{stream;decoder;context=new Uu;constructor(t,e){this.stream=t,this.decoder=e}decompress(t,e){let n=this.context;if(!n.haveLast)return this.stream.getBytes(t,e,29),this.readContext(t,e),n.haveLast=!0,e+29;n.descriptorIndex=this.decoder.decodeSymbol(n.descriptorModel);let s=this.decoder.decodeSymbol(n.offsetDifferenceModels[n.lastOffsetDifferenceSymbol]);switch(n.lastOffsetDifferenceSymbol=s,s){case 0:break;case 1:n.offset=BigInt.asUintN(64,n.offset+BigInt(n.packetSize));break;case 2:n.lastOffsetDifference=n.offsetDifferenceDecompressor.decompress(this.decoder,n.lastOffsetDifference,0),n.offset=BigInt.asUintN(64,n.offset+BigInt(n.lastOffsetDifference));break;default:n.offset=this.decoder.readUint64();break}return n.packetSize=n.packetSizeDecompressor.decompress(this.decoder,n.packetSize|0,0)>>>0,n.returnPointBits=n.returnPointDecompressor.decompress(this.decoder,n.returnPointBits,0),n.xBits=n.vectorDecompressor.decompress(this.decoder,n.xBits,0),n.yBits=n.vectorDecompressor.decompress(this.decoder,n.yBits,1),n.zBits=n.vectorDecompressor.decompress(this.decoder,n.zBits,2),this.writeContext(t,e),e+29}decompressToTarget(t,e){this.decompress(t,e)}readContext(t,e){let n=this.context;n.descriptorIndex=t[e],n.offset=pw(t,e+1),n.packetSize=Vu(t,e+9),n.returnPointBits=qr(t,e+13),n.xBits=qr(t,e+17),n.yBits=qr(t,e+21),n.zBits=qr(t,e+25)}writeContext(t,e){let n=this.context;t[e]=n.descriptorIndex,mw(n.offset,t,e+1),Gu(n.packetSize,t,e+9),Re(n.returnPointBits,t,e+13),Re(n.xBits,t,e+17),Re(n.yBits,t,e+21),Re(n.zBits,t,e+25)}},Rp=class{point;gpsTime;wavePacket;bytes;waveformScratch=new Uint8Array(29);first=!0;constructor(t,e,n){this.point=new ti(t,n.point10ItemVersion??2);let s=this.point.getDecoder();this.gpsTime=new na(t,s,n.gpsTime11ItemVersion??2),this.wavePacket=new Pu(t,s),this.bytes=new ei(t,s,e,n.byteItemVersion??2)}decompress(t,e){return e=this.point.decompress(t,e),e=this.gpsTime.decompress(t,e),e=this.wavePacket.decompress(t,e),e=this.bytes.decompress(t,e),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint(),s=this.gpsTime.decompressGpsTime();t.waveforms?this.wavePacket.decompressToTarget(t.waveforms,e*29):this.wavePacket.decompressToTarget(this.waveformScratch,0),this.bytes.decompressToTarget(t.extraBytes,e*this.bytes.byteCount),this.readFirstMetadata(),Vn(n,t.positions,t.intensities,t.classifications,t.scale,t.offset,e),no(n,t,e),t.gpsTimes&&(t.gpsTimes[e]=s)}decompressPointDataBatch(t,e){for(let n=0;n<e;n++)this.decompressPointData(t,t.pointOffset+n)}readFirstMetadata(){this.first&&(this.point.readFirstMetadata(),this.first=!1)}},Pp=class{point;gpsTime;rgb;wavePacket;bytes;waveformScratch=new Uint8Array(29);first=!0;constructor(t,e,n){this.point=new ti(t,n.point10ItemVersion??2);let s=this.point.getDecoder();this.gpsTime=new na(t,s,n.gpsTime11ItemVersion??2),this.rgb=new wc(t,s,n.rgb12ItemVersion??2),this.wavePacket=new Pu(t,s),this.bytes=new ei(t,s,e,n.byteItemVersion??2)}decompress(t,e){return e=this.point.decompress(t,e),e=this.gpsTime.decompress(t,e),e=this.rgb.decompress(t,e),e=this.wavePacket.decompress(t,e),e=this.bytes.decompress(t,e),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint(),s=this.gpsTime.decompressGpsTime();this.rgb.decompressRgb(),t.waveforms?this.wavePacket.decompressToTarget(t.waveforms,e*29):this.wavePacket.decompressToTarget(this.waveformScratch,0),this.bytes.decompressToTarget(t.extraBytes,e*this.bytes.byteCount),this.readFirstMetadata(),Vn(n,t.positions,t.intensities,t.classifications,t.scale,t.offset,e),no(n,t,e),t.gpsTimes&&(t.gpsTimes[e]=s),oo(this.rgb.decodedRed,this.rgb.decodedGreen,this.rgb.decodedBlue,t,e)}decompressPointDataBatch(t,e){for(let n=0;n<e;n++)this.decompressPointData(t,t.pointOffset+n)}readFirstMetadata(){this.first&&(this.point.readFirstMetadata(),this.first=!1)}},kp=class{stream;point;bytes;extraByteCount;first=!0;constructor(t,e,n,s,i){this.stream=t,this.extraByteCount=e,this.point=new eo(t,n==="raw"?Ut.Full:Ut.PointData,s.point14ItemVersion??3,i),this.bytes=(n==="raw"||i?.extraBytes)&&e?new ro(t,e,s.byte14ItemVersion??3):null}decompress(t,e){return e=this.point.decompress(t,e),this.bytes&&(e=this.bytes.decompress(t,e,this.point.itemContextChannel)),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint();this.bytes&&t.extraBytes?this.bytes.decompress(t.extraBytes,e*this.extraByteCount,this.point.itemContextChannel):this.first&&this.extraByteCount&&this.stream.consume(this.extraByteCount),this.readFirstMetadata(),vc(n,t,e)}decompressPointDataBatch(t,e){let n=t.positions,s=t.intensities,i=t.classifications,o=t.scale,a=t.offset,c=t.pointOffset;for(let l=0;l<e;l++){let u=this.point.decompressPoint();this.bytes&&t.extraBytes?this.bytes.decompress(t.extraBytes,c*this.extraByteCount,this.point.itemContextChannel):this.first&&this.extraByteCount&&this.stream.consume(this.extraByteCount),this.readFirstMetadata(),Js(u,n,s,i,o,a,c++),so(u,t,c-1),io(u,t,c-1)}}readFirstMetadata(){if(this.first){this.stream.getUint32(),this.point.readSizes();let t=0;if(this.bytes)this.bytes.readSizes();else for(let e=0;e<this.extraByteCount;e++)t+=this.stream.getUint32();this.point.readData(),this.bytes?this.bytes.readData():this.stream.consume(t),this.first=!1}}},zp=class{stream;point;rgb;bytes;extraByteCount;first=!0;constructor(t,e,n,s,i){this.stream=t,this.extraByteCount=e,this.point=new eo(t,n==="raw"?Ut.Full:Ut.PointData,s.point14ItemVersion??3,i),this.rgb=n==="raw"||i?.color?new xc(t,s.rgb14ItemVersion??3):null,this.bytes=(n==="raw"||i?.extraBytes)&&e?new ro(t,e,s.byte14ItemVersion??3):null}decompress(t,e){return e=this.point.decompress(t,e),e=this.rgb.decompress(t,e,this.point.itemContextChannel),this.bytes&&(e=this.bytes.decompress(t,e,this.point.itemContextChannel)),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint();this.rgb?this.rgb.decompressRgb(this.point.itemContextChannel):this.first&&this.stream.consume(6),this.bytes&&t.extraBytes?this.bytes.decompress(t.extraBytes,e*this.extraByteCount,this.point.itemContextChannel):this.first&&this.extraByteCount&&this.stream.consume(this.extraByteCount),this.readFirstMetadata(),vc(n,t,e),this.rgb&&oo(this.rgb.decodedRed,this.rgb.decodedGreen,this.rgb.decodedBlue,t,e)}decompressPointDataBatch(t,e){let n=t.positions,s=t.intensities,i=t.classifications,o=t.colors,a=t.rawColors,c=t.scale,l=t.offset,u=t.pointOffset,f=e;if(this.first&&f>0){let y=this.point.decompressPoint();if(this.rgb?this.rgb.decompressRgb(this.point.itemContextChannel):this.stream.consume(6),this.bytes&&t.extraBytes?this.bytes.decompress(t.extraBytes,u*this.extraByteCount,this.point.itemContextChannel):this.extraByteCount&&this.stream.consume(this.extraByteCount),this.readFirstMetadata(),Js(y,n,s,i,c,l,u),so(y,t,u),io(y,t,u),o&&this.rgb){let g=u*4;o[g]=this.rgb.decodedRed&255,o[g+1]=this.rgb.decodedGreen&255,o[g+2]=this.rgb.decodedBlue&255,o[g+3]=255}else if(a&&this.rgb){let g=u*3;a[g]=this.rgb.decodedRed,a[g+1]=this.rgb.decodedGreen,a[g+2]=this.rgb.decodedBlue}u++,f--}let h=!!(t.gpsTimes||t.scanAngles||t.userData||t.pointSourceIds||t.returnNumbers||t.numberOfReturns||t.scannerChannels||t.scanDirectionFlags||t.edgeOfFlightLines||t.syntheticFlags||t.keyPointFlags||t.withheldFlags||t.overlapFlags),p=!!(this.bytes&&t.extraBytes);if(!h&&!p){for(let y=0;y<f;y++){let g=this.point.decompressPoint();if(this.rgb?.decompressRgb(this.point.itemContextChannel),Js(g,n,s,i,c,l,u),o&&this.rgb){let w=u*4;o[w]=this.rgb.decodedRed&255,o[w+1]=this.rgb.decodedGreen&255,o[w+2]=this.rgb.decodedBlue&255,o[w+3]=255}else if(a&&this.rgb){let w=u*3;a[w]=this.rgb.decodedRed,a[w+1]=this.rgb.decodedGreen,a[w+2]=this.rgb.decodedBlue}u++}return}for(let y=0;y<f;y++){let g=this.point.decompressPoint();if(this.rgb?.decompressRgb(this.point.itemContextChannel),this.bytes&&t.extraBytes&&this.bytes.decompress(t.extraBytes,u*this.extraByteCount,this.point.itemContextChannel),Js(g,n,s,i,c,l,u),so(g,t,u),io(g,t,u),o&&this.rgb){let w=u*4;o[w]=this.rgb.decodedRed&255,o[w+1]=this.rgb.decodedGreen&255,o[w+2]=this.rgb.decodedBlue&255,o[w+3]=255}else if(a&&this.rgb){let w=u*3;a[w]=this.rgb.decodedRed,a[w+1]=this.rgb.decodedGreen,a[w+2]=this.rgb.decodedBlue}u++}}readFirstMetadata(){if(this.first){this.stream.getUint32(),this.point.readSizes();let t=this.rgb?0:this.stream.getUint32();this.rgb?.readSizes();let e=0;if(this.bytes)this.bytes.readSizes();else for(let n=0;n<this.extraByteCount;n++)e+=this.stream.getUint32();this.point.readData(),this.rgb?this.rgb.readData():this.stream.consume(t),this.bytes?this.bytes.readData():this.stream.consume(e),this.first=!1}}},Vp=class{stream;point;rgb;nir;bytes;extraByteCount;first=!0;constructor(t,e,n,s,i){this.stream=t,this.extraByteCount=e,this.point=new eo(t,n==="raw"?Ut.Full:Ut.PointData,s.point14ItemVersion??3,i),this.rgb=n==="raw"||i?.color?new xc(t,s.rgb14ItemVersion??3):null,this.nir=n==="raw"||i?.nir?new Nu(t,s.rgb14ItemVersion??3):null,this.bytes=(n==="raw"||i?.extraBytes)&&e?new ro(t,e,s.byte14ItemVersion??3):null}decompress(t,e){return e=this.point.decompress(t,e),e=this.rgb.decompress(t,e,this.point.itemContextChannel),e=this.nir.decompress(t,e,this.point.itemContextChannel),this.bytes&&(e=this.bytes.decompress(t,e,this.point.itemContextChannel)),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint();this.rgb?this.rgb.decompressRgb(this.point.itemContextChannel):this.first&&this.stream.consume(6),!this.nir&&this.first&&this.stream.consume(2);let s=this.nir?this.nir.decompressNir(this.point.itemContextChannel):0;this.bytes&&t.extraBytes&&this.bytes.decompress(t.extraBytes,e*this.extraByteCount,this.point.itemContextChannel),this.first&&this.stream.consume(this.bytes?0:this.extraByteCount),this.readFirstMetadata(),vc(n,t,e),ku(s,t,e),this.rgb&&oo(this.rgb.decodedRed,this.rgb.decodedGreen,this.rgb.decodedBlue,t,e)}decompressPointDataBatch(t,e){let n=t.positions,s=t.intensities,i=t.classifications,o=t.colors,a=t.rawColors,c=t.scale,l=t.offset,u=t.pointOffset;for(let f=0;f<e;f++){let h=this.point.decompressPoint();this.rgb?this.rgb.decompressRgb(this.point.itemContextChannel):this.first&&this.stream.consume(6),!this.nir&&this.first&&this.stream.consume(2);let p=this.nir?this.nir.decompressNir(this.point.itemContextChannel):0;if(this.bytes&&t.extraBytes&&this.bytes.decompress(t.extraBytes,u*this.extraByteCount,this.point.itemContextChannel),this.first&&this.stream.consume(this.bytes?0:this.extraByteCount),this.readFirstMetadata(),Js(h,n,s,i,c,l,u),so(h,t,u),io(h,t,u),o&&this.rgb){let y=u*4;o[y]=this.rgb.decodedRed&255,o[y+1]=this.rgb.decodedGreen&255,o[y+2]=this.rgb.decodedBlue&255,o[y+3]=255}else if(a&&this.rgb){let y=u*3;a[y]=this.rgb.decodedRed,a[y+1]=this.rgb.decodedGreen,a[y+2]=this.rgb.decodedBlue}ku(p,t,u),u++}}readFirstMetadata(){if(this.first){this.stream.getUint32(),this.point.readSizes();let t=this.rgb?0:this.stream.getUint32();this.rgb?.readSizes();let e=this.nir?0:this.stream.getUint32();this.nir?.readSizes();let n=0;if(this.bytes)this.bytes.readSizes();else for(let s=0;s<this.extraByteCount;s++)n+=this.stream.getUint32();this.point.readData(),this.rgb?this.rgb.readData():this.stream.consume(t),this.nir?this.nir.readData():this.stream.consume(e),this.bytes?this.bytes.readData():this.stream.consume(n),this.first=!1}}},Gp=class{stream;point;wavePacket;bytes;extraByteCount;first=!0;waveformScratch=new Uint8Array(29);constructor(t,e,n,s,i){this.stream=t,this.extraByteCount=e,this.point=new eo(t,n==="raw"?Ut.Full:Ut.PointData,s.point14ItemVersion??3,i),this.wavePacket=n==="raw"||i?.waveform?new Ru(t,s.wavePacketItemVersion??3):null,this.bytes=(n==="raw"||i?.extraBytes)&&e?new ro(t,e,s.byte14ItemVersion??3):null}decompress(t,e){return e=this.point.decompress(t,e),e=this.wavePacket.decompress(t,e,this.point.itemContextChannel),this.bytes&&(e=this.bytes.decompress(t,e,this.point.itemContextChannel)),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint();this.wavePacket?(this.wavePacket.decompressToTarget(this.waveformScratch,0,this.point.itemContextChannel),t.waveforms&&t.waveforms.set(this.waveformScratch,e*29)):this.first&&this.stream.consume(29),this.bytes&&t.extraBytes?this.bytes.decompress(t.extraBytes,e*this.extraByteCount,this.point.itemContextChannel):this.first&&this.stream.consume(this.extraByteCount),this.readFirstMetadata(),vc(n,t,e)}decompressPointDataBatch(t,e){let n=t.positions,s=t.intensities,i=t.classifications,o=t.scale,a=t.offset,c=t.pointOffset;for(let l=0;l<e;l++){let u=this.point.decompressPoint();this.wavePacket?(this.wavePacket.decompressToTarget(this.waveformScratch,0,this.point.itemContextChannel),t.waveforms&&t.waveforms.set(this.waveformScratch,c*29)):this.first&&this.stream.consume(29),this.bytes&&t.extraBytes?this.bytes.decompress(t.extraBytes,c*this.extraByteCount,this.point.itemContextChannel):this.first&&this.stream.consume(this.extraByteCount),this.readFirstMetadata(),Js(u,n,s,i,o,a,c++),so(u,t,c-1),io(u,t,c-1)}}readFirstMetadata(){if(this.first){this.stream.getUint32(),this.point.readSizes();let t=this.wavePacket?0:this.stream.getUint32();this.wavePacket?.readSizes();let e=0;if(this.bytes)this.bytes.readSizes();else for(let n=0;n<this.extraByteCount;n++)e+=this.stream.getUint32();this.point.readData(),this.wavePacket?this.wavePacket.readData():this.stream.consume(t),this.bytes?this.bytes.readData():this.stream.consume(e),this.first=!1}}},jp=class{stream;point;rgb;nir;wavePacket;bytes;extraByteCount;first=!0;waveformScratch=new Uint8Array(29);constructor(t,e,n,s,i){this.stream=t,this.extraByteCount=e,this.point=new eo(t,n==="raw"?Ut.Full:Ut.PointData,s.point14ItemVersion??3,i),this.rgb=n==="raw"||i?.color?new xc(t,s.rgb14ItemVersion??3):null,this.nir=n==="raw"||i?.nir?new Nu(t,s.rgb14ItemVersion??3):null,this.wavePacket=n==="raw"||i?.waveform?new Ru(t,s.wavePacketItemVersion??3):null,this.bytes=(n==="raw"||i?.extraBytes)&&e?new ro(t,e,s.byte14ItemVersion??3):null}decompress(t,e){return e=this.point.decompress(t,e),e=this.rgb.decompress(t,e,this.point.itemContextChannel),e=this.nir.decompress(t,e,this.point.itemContextChannel),e=this.wavePacket.decompress(t,e,this.point.itemContextChannel),this.bytes&&(e=this.bytes.decompress(t,e,this.point.itemContextChannel)),this.readFirstMetadata(),e}decompressPointData(t,e){let n=this.point.decompressPoint();this.rgb?this.rgb.decompressRgb(this.point.itemContextChannel):this.first&&this.stream.consume(6);let s=this.nir?this.nir.decompressNir(this.point.itemContextChannel):0;this.first&&this.stream.consume(this.nir?0:2),this.wavePacket?(this.wavePacket.decompressToTarget(this.waveformScratch,0,this.point.itemContextChannel),t.waveforms&&t.waveforms.set(this.waveformScratch,e*29)):this.first&&this.stream.consume(29),this.bytes&&t.extraBytes?this.bytes.decompress(t.extraBytes,e*this.extraByteCount,this.point.itemContextChannel):this.first&&this.stream.consume(this.extraByteCount),this.readFirstMetadata(),vc(n,t,e),ku(s,t,e),this.rgb&&oo(this.rgb.decodedRed,this.rgb.decodedGreen,this.rgb.decodedBlue,t,e)}decompressPointDataBatch(t,e){let n=t.positions,s=t.intensities,i=t.classifications,o=t.colors,a=t.rawColors,c=t.scale,l=t.offset,u=t.pointOffset;for(let f=0;f<e;f++){let h=this.point.decompressPoint();this.rgb?this.rgb.decompressRgb(this.point.itemContextChannel):this.first&&this.stream.consume(6);let p=this.nir?this.nir.decompressNir(this.point.itemContextChannel):0;if(this.first&&this.stream.consume(this.nir?0:2),this.wavePacket?(this.wavePacket.decompressToTarget(this.waveformScratch,0,this.point.itemContextChannel),t.waveforms&&t.waveforms.set(this.waveformScratch,u*29)):this.first&&this.stream.consume(29),this.bytes&&t.extraBytes?this.bytes.decompress(t.extraBytes,u*this.extraByteCount,this.point.itemContextChannel):this.first&&this.stream.consume(this.extraByteCount),this.readFirstMetadata(),Js(h,n,s,i,c,l,u),so(h,t,u),io(h,t,u),o&&this.rgb){let y=u*4;o[y]=this.rgb.decodedRed&255,o[y+1]=this.rgb.decodedGreen&255,o[y+2]=this.rgb.decodedBlue&255,o[y+3]=255}else if(a&&this.rgb){let y=u*3;a[y]=this.rgb.decodedRed,a[y+1]=this.rgb.decodedGreen,a[y+2]=this.rgb.decodedBlue}ku(p,t,u),u++}}readFirstMetadata(){if(this.first){this.stream.getUint32(),this.point.readSizes();let t=this.rgb?0:this.stream.getUint32();this.rgb?.readSizes();let e=this.nir?0:this.stream.getUint32();this.nir?.readSizes();let n=this.wavePacket?0:this.stream.getUint32();this.wavePacket?.readSizes();let s=0;if(this.bytes)this.bytes.readSizes();else for(let i=0;i<this.extraByteCount;i++)s+=this.stream.getUint32();this.point.readData(),this.rgb?this.rgb.readData():this.stream.consume(t),this.nir?this.nir.readData():this.stream.consume(e),this.wavePacket?this.wavePacket.readData():this.stream.consume(n),this.bytes?this.bytes.readData():this.stream.consume(s),this.first=!1}}}});function He(r){return r|0}var Et,Hp,Wt,_t,ao,ww=d(()=>{"use strict";Et=class{symbols;distribution;symbolCount;lastSymbol;totalCount=0;updateCycle;symbolsUntilUpdate;constructor(t){if(t<2||t>2048)throw new Error(`Invalid arithmetic model symbol count ${t}`);this.symbols=t,this.lastSymbol=t-1,this.distribution=new Uint32Array(t),this.symbolCount=new Uint32Array(t),this.symbolCount.fill(1),this.updateCycle=t,this.symbolsUntilUpdate=t,this.update(),this.symbolsUntilUpdate=this.updateCycle=t+6>>1}update(){if(this.totalCount+=this.updateCycle,this.totalCount>32768){this.totalCount=0;for(let s=0;s<this.symbols;s++)this.symbolCount[s]=this.symbolCount[s]+1>>1,this.totalCount+=this.symbolCount[s]}let t=0,e=2147483648/this.totalCount|0;for(let s=0;s<this.symbols;s++)this.distribution[s]=e*t/65536|0,t+=this.symbolCount[s];this.updateCycle=5*this.updateCycle>>2;let n=this.symbols+6<<3;this.updateCycle>n&&(this.updateCycle=n),this.symbolsUntilUpdate=this.updateCycle}},Hp=class{updateCycle=4;bitsUntilUpdate=4;bit0Probability=4096;bit0Count=1;bitCount=2;update(){this.bitCount+=this.updateCycle,this.bitCount>8192&&(this.bitCount=this.bitCount+1>>1,this.bit0Count=this.bit0Count+1>>1,this.bit0Count===this.bitCount&&this.bitCount++);let t=2147483648/this.bitCount|0;this.bit0Probability=this.bit0Count*t/262144|0,this.updateCycle=5*this.updateCycle>>2,this.updateCycle>64&&(this.updateCycle=64),this.bitsUntilUpdate=this.updateCycle}},Wt=class{bytes=[];base=0;length=4294967295;finished=!1;encodeBit(t,e){let n=t.bit0Probability*(this.length>>>13);if(e===0)this.length=n>>>0,t.bit0Count++;else if(e===1)this.addToBase(n),this.length=this.length-n>>>0;else throw new Error(`Invalid arithmetic bit ${e}`);this.renormalizeIfNeeded(),--t.bitsUntilUpdate===0&&t.update()}encodeSymbol(t,e){if(!Number.isInteger(e)||e<0||e>t.lastSymbol)throw new Error(`Invalid arithmetic symbol ${e}`);let n=this.length,s;e===t.lastSymbol?(s=t.distribution[e]*(n>>>15),this.addToBase(s),this.length=n-s>>>0):(n>>>=15,s=t.distribution[e]*n,this.addToBase(s),this.length=t.distribution[e+1]*n-s>>>0),this.renormalizeIfNeeded(),t.symbolCount[e]++,--t.symbolsUntilUpdate===0&&t.update()}writeBits(t,e){if(!Number.isInteger(t)||t<1||t>32)throw new Error(`Invalid arithmetic bit count ${t}`);t>19&&(this.writeShort(e&65535),e>>>=16,t-=16);let n=this.length>>>t;this.addToBase(e*n),this.length=n>>>0,this.renormalizeIfNeeded()}writeShort(t){let e=this.length>>>16;this.addToBase((t&65535)*e),this.length=e>>>0,this.renormalizeIfNeeded()}writeInt(t){this.writeShort(t&65535),this.writeShort(t>>>16)}finish(){if(this.finished)return Uint8Array.from(this.bytes);this.finished=!0;let t=this.base,e=!0;return this.length>2*16777216?(this.base=this.base+16777216>>>0,this.length=8388608):(this.base=this.base+8388608>>>0,this.length=32768,e=!1),t>this.base&&this.propagateCarry(),this.renormalize(),this.bytes.push(0,0),e&&this.bytes.push(0),Uint8Array.from(this.bytes)}addToBase(t){let e=this.base;this.base=this.base+t>>>0,e>this.base&&this.propagateCarry()}propagateCarry(){let t=this.bytes.length-1;for(;t>=0&&this.bytes[t]===255;)this.bytes[t--]=0;if(t<0)throw new Error("LASzip arithmetic carry precedes encoded output");this.bytes[t]++}renormalizeIfNeeded(){this.length<16777216&&this.renormalize()}renormalize(){do this.bytes.push(this.base>>>24),this.base=this.base<<8>>>0,this.length=this.length<<8>>>0;while(this.length<16777216)}},_t=class{encoder;contexts;bitsHigh;correctionBits;correctionRange;correctionMinimum;bitModels;zeroBitCorrector=new Hp;correctorModels;k=0;constructor(t,e=16,n=1,s=8,i=0){if(this.encoder=t,this.contexts=n,this.bitsHigh=s,i){let o=i,a=0;for(;o;)o>>=1,a++;i===2**(a-1)&&a--,this.correctionBits=a,this.correctionRange=i,this.correctionMinimum=-(i/2)}else e&&e<32?(this.correctionBits=e,this.correctionRange=2**e,this.correctionMinimum=-(this.correctionRange/2)):(this.correctionBits=32,this.correctionRange=0,this.correctionMinimum=-2147483648);this.bitModels=Array.from({length:this.contexts},()=>new Et(this.correctionBits+1)),this.correctorModels=Array.from({length:this.correctionBits},(o,a)=>{let c=a+1;return new Et(2**Math.min(c,this.bitsHigh))})}compress(t,e,n=0){if(!Number.isInteger(n)||n<0||n>=this.contexts)throw new Error(`Invalid integer compressor context ${n}`);let s=He(e-t);this.correctionRange&&(s<this.correctionMinimum?s+=this.correctionRange:s>this.correctionMinimum+this.correctionRange-1&&(s-=this.correctionRange)),this.writeCorrector(s,this.bitModels[n])}writeCorrector(t,e){let n=t<=0?-t:t-1,s=0;for(;n;)n>>>=1,s++;if(this.k=s,this.encoder.encodeSymbol(e,s),s===0){this.encoder.encodeBit(this.zeroBitCorrector,t);return}if(s===32){if(t!==this.correctionMinimum)throw new Error(`Invalid ${s}-bit integer correction ${t}`);return}let i=t<0?t+(2**s-1):t-1,o=this.correctorModels[s-1];if(s<=this.bitsHigh)this.encoder.encodeSymbol(o,i);else{let a=s-this.bitsHigh,c=2**a-1,l=i&c;i>>>=a,this.encoder.encodeSymbol(o,i),this.encoder.writeBits(a,l)}}},ao=class{value0=0;value1=0;value2=0;value3=0;value4=0;high=!0;add(t){this.high?t<this.value2?(this.value4=this.value3,this.value3=this.value2,t<this.value0?(this.value2=this.value1,this.value1=this.value0,this.value0=t):t<this.value1?(this.value2=this.value1,this.value1=t):this.value2=t):(t<this.value3?(this.value4=this.value3,this.value3=t):this.value4=t,this.high=!1):this.value2<t?(this.value0=this.value1,this.value1=this.value2,this.value4<t?(this.value2=this.value3,this.value3=this.value4,this.value4=t):this.value3<t?(this.value2=this.value3,this.value3=t):this.value2=t):(this.value1<t?(this.value0=this.value1,this.value1=t):this.value0=t,this.high=!0)}get(){return this.value2}}});function om(r,t){let e=rI(r);if(KB(e,t),t.pointCount===0)return new Uint8Array(0);if(t.pointDataRecordFormat<=5)return XB(e,t);let n=t.pointDataRecordLength,s=t.pointDataRecordFormat,i=nf[s],o=n-i,a=e.subarray(0,n),c=Bw(a,0),l=new rm(c),u=s===7||s===8||s===10?tf(a,30):null,f=u?new nm(u,oa(c)):null,h=s===8||s===10?new sm(Sc(a,36),oa(c)):null,p=s===9?30:s===10?38:-1,y=p>=0?new tm(ef(a,p),oa(c),t.wavePacketItemVersion??3):null,g=o?new im(a.subarray(i,n),oa(c)):null;for(let K=1;K<t.pointCount;K++){let ft=K*n,dt=e.subarray(ft,ft+n),Bt=l.encode(Bw(dt,0));f?.encode(tf(dt,30),Bt),h?.encode(Sc(dt,36),Bt),y?.encode(ef(dt,p),Bt),g?.encode(dt.subarray(i,n),Bt)}let w=l.finish(),S=f?.finish(),E=h?.finish(),I=y?.finish(),b=g?.finish()||[],C=[...w,...S?[S]:[],...E?[E]:[],...I?[I]:[],...b],L=new Uint8Array(4+C.length*4),q=new DataView(L.buffer);q.setUint32(0,t.pointCount,!0);for(let K=0;K<C.length;K++)q.setUint32(4+K*4,C[K].byteLength,!0);return Cw([a,L,...C])}function am(r,t={}){if(r.length===0)return new Uint8Array(0);let e=new Wt,n=new _t(e,32,2),s=0,i=0;for(let o of r)JB(o),t.variable&&(n.compress(s,o.pointCount,0),s=o.pointCount),n.compress(i,o.byteLength,1),i=o.byteLength;return e.finish()}function cm(r){let t=r.pointDataRecordFormat<=5,e=r.itemVersion||(t?2:3);if(t&&e!==2)throw new Error("Legacy LASzip point formats require item version 2");if(!t&&e!==3)throw new Error("Modern LASzip point formats require item version 3");let n=QB(r.pointDataRecordFormat,r.pointDataRecordLength),s=Aw+n.length*6,i=new Uint8Array(xw+s),o=new DataView(i.buffer),a=xw;Mw(o,2,"laszip encoded",16),o.setUint16(18,22204,!0),o.setUint16(20,s,!0),Mw(o,22,"loaders.gl LAZ writer",32),o.setUint16(a,t?2:3,!0),o.setUint16(a+2,0,!0),o.setUint8(a+4,t?2:3),o.setUint8(a+5,0),o.setUint16(a+6,1,!0),o.setUint32(a+8,0,!0),o.setUint32(a+12,r.chunkSize,!0),i.fill(255,a+16,a+32),o.setUint16(a+32,n.length,!0);for(let c=0;c<n.length;c++){let l=a+Aw+c*6,u=n[c];o.setUint16(l,u.type,!0),o.setUint16(l+2,u.size,!0),o.setUint16(l+4,u.version??e,!0)}return i}function XB(r,t){let e=t.pointDataRecordLength,n=t.pointDataRecordFormat,s=nf[n],i=e-s,o=r.subarray(0,e),a=new Wt,c=new Xp(a,Iw(o,0)),l=n===1||n===3||n===4||n===5?new Kp(a,_w(o,20)):null,u=n===2?20:n===3||n===5?28:-1,f=u>=0?new Jp(a,tf(o,u)):null,h=n===4?28:n===5?34:-1,p=h>=0?new Qp(a,ef(o,h)):null,y=i?new em(a,o.subarray(s,e)):null;for(let g=1;g<t.pointCount;g++){let w=g*e,S=r.subarray(w,w+e);c.encode(Iw(S,0)),l?.encode(_w(S,20)),f?.encode(tf(S,u)),p?.encode(ef(S,h)),y?.encode(S.subarray(s,e))}return Cw([o,a.finish()])}function KB(r,t){if([t.point10ItemVersion,t.gpsTime11ItemVersion,t.rgb12ItemVersion,t.byteItemVersion].some(s=>s!==void 0&&s!==2))throw new Error("TypeScript LAZ encoder only supports legacy item version 2");if(!Number.isInteger(t.pointCount)||t.pointCount<0)throw new Error(`Invalid LAZ chunk point count ${t.pointCount}`);let e=nf[t.pointDataRecordFormat];if(!e)throw new Error(`TypeScript LAZ encoder does not support point format ${t.pointDataRecordFormat}`);if(!Number.isInteger(t.pointDataRecordLength)||t.pointDataRecordLength<e)throw new Error(`Invalid point record length ${t.pointDataRecordLength} for point format ${t.pointDataRecordFormat}`);if(t.point14ItemVersion!==void 0&&t.point14ItemVersion!==3)throw new Error("TypeScript LAZ encoder only supports Point14 item version 3");if(t.pointDataRecordFormat>=7&&t.rgb14ItemVersion!==void 0&&t.rgb14ItemVersion!==3)throw new Error("TypeScript LAZ encoder only supports RGB14 item version 3");if((t.pointDataRecordFormat===9||t.pointDataRecordFormat===10)&&t.wavePacketItemVersion!==void 0&&t.wavePacketItemVersion!==3)throw new Error("TypeScript LAZ encoder only supports WavePacket14 item version 3");if(t.pointDataRecordLength>e&&t.byte14ItemVersion!==void 0&&t.byte14ItemVersion!==3)throw new Error("TypeScript LAZ encoder only supports Byte14 item version 3");let n=t.pointCount*t.pointDataRecordLength;if(r.byteLength!==n)throw new Error(`LAZ chunk input has ${r.byteLength} bytes; expected ${n}`)}function JB(r){if(!Number.isInteger(r.pointCount)||r.pointCount<=0||r.pointCount>4294967295)throw new Error(`Invalid LAZ chunk point count ${r.pointCount}`);if(!Number.isInteger(r.byteLength)||r.byteLength<=0||r.byteLength>4294967295)throw new Error(`Invalid LAZ chunk byte length ${r.byteLength}`)}function QB(r,t){let e=nf[r];if(!e||t<e)throw new Error(`Invalid point record length ${t} for point format ${r}`);if(r<=5){let i=[{type:6,size:20}];(r===1||r===3||r===4||r===5)&&i.push({type:7,size:8}),(r===2||r===3||r===5)&&i.push({type:8,size:6}),(r===4||r===5)&&i.push({type:9,size:29,version:1});let o=t-e;return o>0&&i.push({type:0,size:o}),i}let n=[{type:10,size:30}];r===7?n.push({type:11,size:6}):r===8?n.push({type:12,size:8}):r===10&&n.push({type:12,size:8}),(r===9||r===10)&&n.push({type:13,size:29});let s=t-e;return s>0&&n.push({type:14,size:s}),n}function Bw(r,t){let e=new DataView(r.buffer,r.byteOffset+t,30);return{x:e.getInt32(0,!0),y:e.getInt32(4,!0),z:e.getInt32(8,!0),intensity:e.getUint16(12,!0),returns:e.getUint8(14),flags:e.getUint8(15),classification:e.getUint8(16),userData:e.getUint8(17),scanAngle:e.getInt16(18,!0),pointSourceId:e.getUint16(20,!0),gpsTimeBits:e.getBigUint64(22,!0)}}function Iw(r,t){let e=new DataView(r.buffer,r.byteOffset+t,20);return{x:e.getInt32(0,!0),y:e.getInt32(4,!0),z:e.getInt32(8,!0),intensity:e.getUint16(12,!0),bitByte:e.getUint8(14),classification:e.getUint8(15),scanAngleRank:e.getInt8(16),userData:e.getUint8(17),pointSourceId:e.getUint16(18,!0)}}function tf(r,t){return{red:Sc(r,t),green:Sc(r,t+2),blue:Sc(r,t+4)}}function ef(r,t){let e=new DataView(r.buffer,r.byteOffset+t,29);return{descriptorIndex:e.getUint8(0),offset:e.getBigUint64(1,!0),packetSize:e.getUint32(9,!0),returnPointBits:e.getInt32(13,!0),xBits:e.getInt32(17,!0),yBits:e.getInt32(21,!0),zBits:e.getInt32(25,!0)}}function _w(r,t){return new DataView(r.buffer,r.byteOffset+t,8).getFloat64(0,!0)}function Lw(r,t){return BigInt.asIntN(64,rf(r)-rf(t))}function rf(r){let t=new ArrayBuffer(8),e=new DataView(t);return e.setFloat64(0,r,!0),e.getBigUint64(0,!0)}function Sc(r,t){return r[t]|r[t+1]<<8}function tI(r,t){r.x=t.x,r.y=t.y,r.z=t.z,r.intensity=t.intensity,r.returns=t.returns,r.flags=t.flags,r.classification=t.classification,r.userData=t.userData,r.scanAngle=t.scanAngle,r.pointSourceId=t.pointSourceId,r.gpsTimeBits=t.gpsTimeBits}function oa(r){return r.flags>>4&3}function Tw(r){return r.flags>>2&48|r.flags&15}function Ir(r,t){return Array.from({length:r},()=>new Et(t))}function we(r){return r&255}function eI(r){return r&255}function ri(r){return Math.min(255,Math.max(0,r))}function Dw(r,t){let e=Math.fround(Math.fround(r)/Math.fround(t));return e>=0?Math.trunc(e+.5):Math.trunc(e-.5)}function rI(r){return r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}function Cw(r){let t=r.reduce((s,i)=>s+i.byteLength,0),e=new Uint8Array(t),n=0;for(let s of r)e.set(s,n),n+=s.byteLength;return e}function Mw(r,t,e,n){for(let s=0;s<n;s++)r.setUint8(t+s,e.charCodeAt(s)||0)}var nf,xw,Aw,Br,co,vw,Sw,WB,YB,ZB,HB,Xp,Kp,Jp,Qp,Hu,tm,em,Xu,rm,Ku,nm,Ju,sm,Qu,im,Fw=d(()=>{"use strict";ww();nf={0:20,1:28,2:26,3:34,4:57,5:63,6:30,7:36,8:38,9:59,10:67},xw=54,Aw=34,Br=500,co=-10,vw=511,Sw=Br-co+2,WB=[[0,1,2,3,4,5,3,4,4,5,5,5,5,5,5,5],[1,0,1,3,3,3,3,3,3,3,3,3,3,3,3,3],[2,1,2,4,4,4,4,4,4,4,4,3,3,3,3,3],[3,3,4,5,4,4,4,4,4,4,4,4,4,4,4,4],[4,3,4,4,5,4,4,4,4,4,4,4,4,4,4,4],[5,3,4,4,4,5,4,4,4,4,4,4,4,4,4,4],[3,3,4,4,4,4,5,4,4,4,4,4,4,4,4,4],[4,3,4,4,4,4,4,5,4,4,4,4,4,4,4,4],[4,3,4,4,4,4,4,4,5,4,4,4,4,4,4,4],[5,3,4,4,4,4,4,4,4,5,4,4,4,4,4,4],[5,3,4,4,4,4,4,4,4,4,5,4,4,4,4,4],[5,3,3,4,4,4,4,4,4,4,4,5,5,4,4,4],[5,3,3,4,4,4,4,4,4,4,4,5,5,5,4,4],[5,3,3,4,4,4,4,4,4,4,4,4,5,5,5,4],[5,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5],[5,3,3,4,4,4,4,4,4,4,4,4,4,4,5,5]],YB=[[15,14,13,12,11,10,9,8],[14,0,1,3,6,10,10,9],[13,1,2,4,7,11,11,10],[12,3,4,5,8,12,12,11],[11,6,7,8,9,13,13,12],[10,10,11,12,13,14,14,13],[9,10,11,12,13,14,15,14],[8,9,10,11,12,13,14,15]],ZB=[[0,1,2,3,4,5,6,7],[1,0,1,2,3,4,5,6],[2,1,0,1,2,3,4,5],[3,2,1,0,1,2,3,4],[4,3,2,1,0,1,2,3],[5,4,3,2,1,0,1,2],[6,5,4,3,2,1,0,1],[7,6,5,4,3,2,1,0]],HB=[[0,1,2,3,4,5,6,7,7,7,7,7,7,7,7,7],[1,0,1,2,3,4,5,6,7,7,7,7,7,7,7,7],[2,1,0,1,2,3,4,5,6,7,7,7,7,7,7,7],[3,2,1,0,1,2,3,4,5,6,7,7,7,7,7,7],[4,3,2,1,0,1,2,3,4,5,6,7,7,7,7,7],[5,4,3,2,1,0,1,2,3,4,5,6,7,7,7,7],[6,5,4,3,2,1,0,1,2,3,4,5,6,7,7,7],[7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,7],[7,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7],[7,7,7,6,5,4,3,2,1,0,1,2,3,4,5,6],[7,7,7,7,6,5,4,3,2,1,0,1,2,3,4,5],[7,7,7,7,7,6,5,4,3,2,1,0,1,2,3,4],[7,7,7,7,7,7,6,5,4,3,2,1,0,1,2,3],[7,7,7,7,7,7,7,6,5,4,3,2,1,0,1,2],[7,7,7,7,7,7,7,7,6,5,4,3,2,1,0,1],[7,7,7,7,7,7,7,7,7,6,5,4,3,2,1,0]];Xp=class{encoder;changedValuesModel=new Et(64);bitByteModels=Ir(256,256);classificationModels=Ir(256,256);scanAngleRankModels=Ir(2,256);userDataModels=Ir(256,256);intensityCompressor;pointSourceIdCompressor;xDifferenceCompressor;yDifferenceCompressor;zCompressor;lastIntensity=new Array(16).fill(0);lastHeight=new Array(8).fill(0);lastXDifferenceMedian=Array.from({length:16},()=>new ao);lastYDifferenceMedian=Array.from({length:16},()=>new ao);last;constructor(t,e){this.encoder=t,this.last={...e},this.intensityCompressor=new _t(t,16,4),this.pointSourceIdCompressor=new _t(t,16,1),this.xDifferenceCompressor=new _t(t,32,2),this.yDifferenceCompressor=new _t(t,32,22),this.zCompressor=new _t(t,32,20)}encode(t){let e=this.last,n=t.bitByte&7,s=t.bitByte>>3&7,i=YB[s][n],o=ZB[s][n],a=(t.bitByte!==e.bitByte?32:0)|(t.intensity!==this.lastIntensity[i]?16:0)|(t.classification!==e.classification?8:0)|(t.scanAngleRank!==e.scanAngleRank?4:0)|(t.userData!==e.userData?2:0)|(t.pointSourceId!==e.pointSourceId?1:0);this.encoder.encodeSymbol(this.changedValuesModel,a),a&32&&this.encoder.encodeSymbol(this.bitByteModels[e.bitByte],t.bitByte),a&16&&(this.intensityCompressor.compress(this.lastIntensity[i],t.intensity,i<3?i:3),this.lastIntensity[i]=t.intensity),a&8&&this.encoder.encodeSymbol(this.classificationModels[e.classification],t.classification),a&4&&this.encoder.encodeSymbol(this.scanAngleRankModels[t.bitByte>>6&1],eI(t.scanAngleRank-e.scanAngleRank)),a&2&&this.encoder.encodeSymbol(this.userDataModels[e.userData],t.userData),a&1&&this.pointSourceIdCompressor.compress(e.pointSourceId,t.pointSourceId);let c=this.lastXDifferenceMedian[i].get(),l=He(t.x-e.x);this.xDifferenceCompressor.compress(c,l,s===1?1:0),this.lastXDifferenceMedian[i].add(l);let u=this.lastYDifferenceMedian[i].get(),f=Math.min(this.xDifferenceCompressor.k,20)&-2,h=He(t.y-e.y);this.yDifferenceCompressor.compress(u,h,(s===1?1:0)+f),this.lastYDifferenceMedian[i].add(h);let p=Math.min(this.xDifferenceCompressor.k+this.yDifferenceCompressor.k>>1,18)&-2;this.zCompressor.compress(this.lastHeight[o],t.z,(s===1?1:0)+p),this.lastHeight[o]=t.z,this.last={...t}}},Kp=class{encoder;gpsTimeMultiModel;gpsTime0DiffModel;gpsTime;lastGpsTime;lastGpsTimeDifference=[0,0,0,0];multiExtremeCounter=[0,0,0,0];lastGpsSequence=0;nextGpsSequence=0;constructor(t,e){this.encoder=t,this.gpsTimeMultiModel=new Et(516),this.gpsTime0DiffModel=new Et(6),this.gpsTime=new _t(t,32,9),this.lastGpsTime=[e,0,0,0]}encode(t){let e=this.lastGpsSequence,n=Lw(t,this.lastGpsTime[e]),s=Number(BigInt.asIntN(32,n)),i=n===BigInt(s);if(this.lastGpsTimeDifference[e]===0)if(i)s===0?this.encoder.encodeSymbol(this.gpsTime0DiffModel,0):(this.encoder.encodeSymbol(this.gpsTime0DiffModel,1),this.gpsTime.compress(0,s,0),this.lastGpsTimeDifference[e]=s,this.multiExtremeCounter[e]=0);else if(this.selectSequence(t,!1)){this.encode(t);return}else this.encoder.encodeSymbol(this.gpsTime0DiffModel,2),this.startSequence(t);else if(i){let o=this.lastGpsTimeDifference[e],a=Dw(s,o);a===1?(this.encoder.encodeSymbol(this.gpsTimeMultiModel,1),this.gpsTime.compress(o,s,1),this.multiExtremeCounter[e]=0):a>0&&a<Br?(this.encoder.encodeSymbol(this.gpsTimeMultiModel,a),this.gpsTime.compress(He(a*o),s,a<10?2:3)):a>=Br?(this.encoder.encodeSymbol(this.gpsTimeMultiModel,Br),this.gpsTime.compress(He(Br*o),s,4),this.recordExtremeDifference(e,s)):a<0&&a>co?(this.encoder.encodeSymbol(this.gpsTimeMultiModel,Br-a),this.gpsTime.compress(He(a*o),s,5)):a<0?(this.encoder.encodeSymbol(this.gpsTimeMultiModel,Br-co),this.gpsTime.compress(He(co*o),s,6),this.recordExtremeDifference(e,s)):(this.encoder.encodeSymbol(this.gpsTimeMultiModel,0),this.gpsTime.compress(0,s,7),this.recordExtremeDifference(e,s))}else if(this.selectSequence(t,!0)){this.encode(t);return}else this.encoder.encodeSymbol(this.gpsTimeMultiModel,Sw),this.startSequence(t);this.lastGpsTime[this.lastGpsSequence]=t}selectSequence(t,e){for(let n=1;n<4;n++){let s=this.lastGpsSequence+n&3,i=Lw(t,this.lastGpsTime[s]);if(i===BigInt.asIntN(32,i))return this.encoder.encodeSymbol(e?this.gpsTimeMultiModel:this.gpsTime0DiffModel,e?Sw+n:n+2),this.lastGpsSequence=s,!0}return!1}startSequence(t){let e=rf(this.lastGpsTime[this.lastGpsSequence]),n=rf(t);this.gpsTime.compress(Number(BigInt.asIntN(32,e>>32n)),Number(BigInt.asIntN(32,n>>32n)),8),this.encoder.writeInt(Number(n&0xffffffffn)),this.nextGpsSequence=this.nextGpsSequence+1&3,this.lastGpsSequence=this.nextGpsSequence,this.lastGpsTimeDifference[this.lastGpsSequence]=0,this.multiExtremeCounter[this.lastGpsSequence]=0}recordExtremeDifference(t,e){this.multiExtremeCounter[t]++,this.multiExtremeCounter[t]>3&&(this.multiExtremeCounter[t]=0,this.lastGpsTimeDifference[t]=e)}},Jp=class{encoder;usedModel=new Et(128);differenceModels=Ir(6,256);red;green;blue;constructor(t,e){this.encoder=t,this.red=e.red,this.green=e.green,this.blue=e.blue}encode(t){let e=this.red,n=this.green,s=this.blue,i=((t.red&255)!==(e&255)?1:0)|((t.red&65280)!==(e&65280)?2:0)|((t.green&255)!==(n&255)?4:0)|((t.green&65280)!==(n&65280)?8:0)|((t.blue&255)!==(s&255)?16:0)|((t.blue&65280)!==(s&65280)?32:0);((t.red&255)!==(t.green&255)||(t.red&255)!==(t.blue&255)||(t.red&65280)!==(t.green&65280)||(t.red&65280)!==(t.blue&65280))&&(i|=64),this.encoder.encodeSymbol(this.usedModel,i);let o=0,a=0;i&1&&(o=(t.red&255)-(e&255),this.encoder.encodeSymbol(this.differenceModels[0],we(o))),i&2&&(a=(t.red>>8)-(e>>8),this.encoder.encodeSymbol(this.differenceModels[1],we(a))),i&64&&(i&4&&this.encoder.encodeSymbol(this.differenceModels[2],we((t.green&255)-ri(o+(n&255)))),i&16&&(o=Math.trunc((o+(t.green&255)-(n&255))/2),this.encoder.encodeSymbol(this.differenceModels[4],we((t.blue&255)-ri(o+(s&255))))),i&8&&this.encoder.encodeSymbol(this.differenceModels[3],we((t.green>>8)-ri(a+(n>>8)))),i&32&&(a=Math.trunc((a+(t.green>>8)-(n>>8))/2),this.encoder.encodeSymbol(this.differenceModels[5],we((t.blue>>8)-ri(a+(s>>8)))))),this.red=t.red,this.green=t.green,this.blue=t.blue}},Qp=class{encoder;descriptorModel;offsetDifferenceModels;offsetDifferenceCompressor;packetSizeCompressor;returnPointCompressor;vectorCompressor;last;lastOffsetDifference=0;lastOffsetDifferenceSymbol=0;constructor(t,e){this.encoder=t,this.descriptorModel=new Et(256),this.offsetDifferenceModels=Ir(4,4),this.offsetDifferenceCompressor=new _t(t,32,1),this.packetSizeCompressor=new _t(t,32,1),this.returnPointCompressor=new _t(t,32,1),this.vectorCompressor=new _t(t,32,3),this.last={...e}}encode(t){let e=this.last;this.encoder.encodeSymbol(this.descriptorModel,t.descriptorIndex);let n=0;if(t.offset===e.offset)n=0;else if(t.offset===e.offset+BigInt(e.packetSize))n=1;else{let s=BigInt.asIntN(64,t.offset-e.offset);s===BigInt.asIntN(32,s)?n=2:n=3}if(this.encoder.encodeSymbol(this.offsetDifferenceModels[this.lastOffsetDifferenceSymbol],n),this.lastOffsetDifferenceSymbol=n,n===2){let s=Number(BigInt.asIntN(32,t.offset-e.offset));this.offsetDifferenceCompressor.compress(this.lastOffsetDifference,s,0),this.lastOffsetDifference=s}n===3&&(this.encoder.writeInt(Number(t.offset&0xffffffffn)),this.encoder.writeInt(Number(t.offset>>32n))),this.packetSizeCompressor.compress(e.packetSize,t.packetSize,0),this.returnPointCompressor.compress(e.returnPointBits,t.returnPointBits,0),this.vectorCompressor.compress(e.xBits,t.xBits,0),this.vectorCompressor.compress(e.yBits,t.yBits,1),this.vectorCompressor.compress(e.zBits,t.zBits,2),this.last={...t}}},Hu=class{packet;descriptorModel=new Et(256);offsetDifferenceModels=Ir(4,4);offsetDifferenceCompressor;packetSizeCompressor;returnPointCompressor;vectorCompressor;lastOffsetDifference=0;lastOffsetDifferenceSymbol=0;haveLast=!1;constructor(t,e){this.packet={...e},this.offsetDifferenceCompressor=new _t(t,32,1),this.packetSizeCompressor=new _t(t,32,1),this.returnPointCompressor=new _t(t,32,1),this.vectorCompressor=new _t(t,32,3),this.haveLast=!0}},tm=class{encoder=new Wt;contexts=new Array(4).fill(null);itemVersion;lastChannel;constructor(t,e,n){this.itemVersion=n,this.lastChannel=e,this.contexts[e]=new Hu(this.encoder,t)}encode(t,e){let n=this.contexts[this.lastChannel],s=this.contexts[e],i=s;e!==this.lastChannel&&(s?this.itemVersion<4&&(i=s,s=n):(s=new Hu(this.encoder,n.packet),this.contexts[e]=s,i=s),this.lastChannel=e),this.encodePacket(i,s,t)}finish(){return this.encoder.finish()}encodePacket(t,e,n){let s=e.packet;this.encoder.encodeSymbol(t.descriptorModel,n.descriptorIndex);let i=0;if(n.offset===s.offset?i=0:n.offset===s.offset+BigInt(s.packetSize)?i=1:BigInt.asIntN(64,n.offset-s.offset)===BigInt.asIntN(32,n.offset-s.offset)?i=2:i=3,this.encoder.encodeSymbol(t.offsetDifferenceModels[t.lastOffsetDifferenceSymbol],i),t.lastOffsetDifferenceSymbol=i,i===2){let o=Number(BigInt.asIntN(32,n.offset-s.offset));t.offsetDifferenceCompressor.compress(t.lastOffsetDifference,o,0),t.lastOffsetDifference=o}else i===3&&(this.encoder.writeInt(Number(n.offset&0xffffffffn)),this.encoder.writeInt(Number(n.offset>>32n)));t.packetSizeCompressor.compress(s.packetSize,n.packetSize,0),t.returnPointCompressor.compress(s.returnPointBits,n.returnPointBits,0),t.vectorCompressor.compress(s.xBits,n.xBits,0),t.vectorCompressor.compress(s.yBits,n.yBits,1),t.vectorCompressor.compress(s.zBits,n.zBits,2),e.packet={...n}}},em=class{encoder;models;last;constructor(t,e){this.encoder=t,this.models=Ir(e.byteLength,256),this.last=new Uint8Array(e)}encode(t){for(let e=0;e<t.byteLength;e++){let n=t[e]-this.last[e];this.encoder.encodeSymbol(this.models[e],we(n)),this.last[e]=t[e]}}},Xu=class{changedValuesModels=Ir(8,128);scannerChannelModel=new Et(3);returnNumberGpsSameModel=new Et(13);numberReturnsModels=new Array(16).fill(null);returnNumberModels=new Array(16).fill(null);classificationModels=new Array(64).fill(null);flagModels=new Array(64).fill(null);userDataModels=new Array(64).fill(null);gpsTimeMultiplierModel=new Et(515);gpsTimeZeroDifferenceModel=new Et(5);xDifferenceCompressor;yDifferenceCompressor;zCompressor;intensityCompressor;scanAngleCompressor;pointSourceIdCompressor;gpsTimeCompressor;lastXDifferenceMedian=Array.from({length:12},()=>new ao);lastYDifferenceMedian=Array.from({length:12},()=>new ao);lastZ;lastIntensity;lastGpsTimeBits;lastGpsTimeDifference=new Array(4).fill(0);gpsTimeExtremeCounter=new Array(4).fill(0);lastGpsSequence=0;nextGpsSequence=0;gpsTimeChanged=!1;last;constructor(t,e){this.last={...t},this.xDifferenceCompressor=new _t(e.xy,32,2),this.yDifferenceCompressor=new _t(e.xy,32,22),this.zCompressor=new _t(e.z,32,20),this.intensityCompressor=new _t(e.intensity,16,4),this.scanAngleCompressor=new _t(e.scanAngle,16,2),this.pointSourceIdCompressor=new _t(e.pointSourceId,16,1),this.gpsTimeCompressor=new _t(e.gpsTime,32,9),this.lastZ=new Array(8).fill(t.z),this.lastIntensity=new Array(8).fill(t.intensity),this.lastGpsTimeBits=[t.gpsTimeBits,0n,0n,0n]}},rm=class{layers={xy:new Wt,z:new Wt,classification:new Wt,flags:new Wt,intensity:new Wt,scanAngle:new Wt,userData:new Wt,pointSourceId:new Wt,gpsTime:new Wt};contexts=new Array(4).fill(null);currentScannerChannel;changed={classification:!1,flags:!1,intensity:!1,scanAngle:!1,userData:!1,pointSourceId:!1,gpsTime:!1};constructor(t){this.currentScannerChannel=oa(t),this.contexts[this.currentScannerChannel]=new Xu(t,this.layers)}encode(t){let e=this.contexts[this.currentScannerChannel],n=e.last,s=oa(t);s!==this.currentScannerChannel&&this.contexts[s]&&(n=this.contexts[s].last);let i=t.pointSourceId!==n.pointSourceId,o=t.gpsTimeBits!==n.gpsTimeBits,a=t.scanAngle!==n.scanAngle,c=n.returns>>4,l=n.returns&15,u=t.returns>>4,f=t.returns&15,h=(l===1?1:0)|(l>=c?2:0)|(e.gpsTimeChanged?4:0),p=(s!==this.currentScannerChannel?64:0)|(i?32:0)|(o?16:0)|(a?8:0)|(u!==c?4:0);f!==l&&(f===(l+1)%16?p|=1:f===(l+15)%16?p|=2:p|=3),this.layers.xy.encodeSymbol(e.changedValuesModels[h],p);let y=0;if(s!==this.currentScannerChannel){let xt=s-this.currentScannerChannel;this.layers.xy.encodeSymbol(e.scannerChannelModel,(xt+3)%4),this.contexts[s]||=new Xu(e.last,this.layers),this.currentScannerChannel=s,y=s,n=this.contexts[s].last}let g=this.contexts[this.currentScannerChannel];if(u!==c){let xt=g.numberReturnsModels[c];xt||(xt=new Et(16),g.numberReturnsModels[c]=xt),this.layers.xy.encodeSymbol(xt,u)}if((p&3)===3)if(o){let xt=g.returnNumberModels[l];xt||(xt=new Et(16),g.returnNumberModels[l]=xt),this.layers.xy.encodeSymbol(xt,f)}else{let xt=f-l;this.layers.xy.encodeSymbol(g.returnNumberGpsSameModel,(xt+14)%16)}let w=WB[u][f],S=HB[u][f],E=(f===1?2:0)|(f>=u?1:0),I=w<<1|(o?1:0),b=g.lastXDifferenceMedian[I].get(),C=He(t.x-n.x);g.xDifferenceCompressor.compress(b,C,u===1?1:0),g.lastXDifferenceMedian[I].add(C);let L=g.lastYDifferenceMedian[I].get(),q=He(t.y-n.y),K=(u===1?1:0)|Math.min(g.xDifferenceCompressor.k,20)&-2;g.yDifferenceCompressor.compress(L,q,K),g.lastYDifferenceMedian[I].add(q);let ft=(u===1?1:0)|Math.min(g.xDifferenceCompressor.k+g.yDifferenceCompressor.k>>1,18)&-2;g.zCompressor.compress(g.lastZ[S],t.z,ft),g.lastZ[S]=t.z,t.classification!==n.classification&&(this.changed.classification=!0);let dt=(n.classification&31)<<1|(E===3?1:0),Bt=g.classificationModels[dt];Bt||(Bt=new Et(256),g.classificationModels[dt]=Bt),this.layers.classification.encodeSymbol(Bt,t.classification);let ie=Tw(n),st=Tw(t);st!==ie&&(this.changed.flags=!0);let rt=g.flagModels[ie];rt||(rt=new Et(64),g.flagModels[ie]=rt),this.layers.flags.encodeSymbol(rt,st),t.intensity!==n.intensity&&(this.changed.intensity=!0);let Xe=E<<1|(o?1:0);g.intensityCompressor.compress(g.lastIntensity[Xe],t.intensity,E),g.lastIntensity[Xe]=t.intensity,a&&(this.changed.scanAngle=!0,g.scanAngleCompressor.compress(n.scanAngle,t.scanAngle,o?1:0)),t.userData!==n.userData&&(this.changed.userData=!0);let ke=n.userData>>2,Ke=g.userDataModels[ke];return Ke||(Ke=new Et(256),g.userDataModels[ke]=Ke),this.layers.userData.encodeSymbol(Ke,t.userData),i&&(this.changed.pointSourceId=!0,g.pointSourceIdCompressor.compress(n.pointSourceId,t.pointSourceId)),o&&(this.changed.gpsTime=!0,this.encodeGpsTime(g,t.gpsTimeBits)),tI(g.last,t),g.gpsTimeChanged=o,y}finish(){return[this.layers.xy.finish(),this.layers.z.finish(),this.changed.classification?this.layers.classification.finish():new Uint8Array(0),this.changed.flags?this.layers.flags.finish():new Uint8Array(0),this.changed.intensity?this.layers.intensity.finish():new Uint8Array(0),this.changed.scanAngle?this.layers.scanAngle.finish():new Uint8Array(0),this.changed.userData?this.layers.userData.finish():new Uint8Array(0),this.changed.pointSourceId?this.layers.pointSourceId.finish():new Uint8Array(0),this.changed.gpsTime?this.layers.gpsTime.finish():new Uint8Array(0)]}encodeGpsTime(t,e){let n=t.lastGpsSequence,s=BigInt.asIntN(64,e-t.lastGpsTimeBits[n]),i=Number(BigInt.asIntN(32,s)),o=s===BigInt(i);if(t.lastGpsTimeDifference[n]===0)if(o)this.layers.gpsTime.encodeSymbol(t.gpsTimeZeroDifferenceModel,0),t.gpsTimeCompressor.compress(0,i,0),t.lastGpsTimeDifference[n]=i,t.gpsTimeExtremeCounter[n]=0;else if(this.selectGpsTimeSequence(t,e,!1)){this.encodeGpsTime(t,e);return}else this.layers.gpsTime.encodeSymbol(t.gpsTimeZeroDifferenceModel,1),this.startGpsTimeSequence(t,e);else if(o){let a=t.lastGpsTimeDifference[n],c=Dw(i,a);c===1?(this.layers.gpsTime.encodeSymbol(t.gpsTimeMultiplierModel,1),t.gpsTimeCompressor.compress(a,i,1),t.gpsTimeExtremeCounter[n]=0):c>0?c<Br?(this.layers.gpsTime.encodeSymbol(t.gpsTimeMultiplierModel,c),t.gpsTimeCompressor.compress(He(c*a),i,c<10?2:3)):(this.layers.gpsTime.encodeSymbol(t.gpsTimeMultiplierModel,Br),t.gpsTimeCompressor.compress(He(Br*a),i,4),this.recordExtremeGpsDifference(t,n,i)):c<0?c>co?(this.layers.gpsTime.encodeSymbol(t.gpsTimeMultiplierModel,Br-c),t.gpsTimeCompressor.compress(He(c*a),i,5)):(this.layers.gpsTime.encodeSymbol(t.gpsTimeMultiplierModel,Br-co),t.gpsTimeCompressor.compress(He(co*a),i,6),this.recordExtremeGpsDifference(t,n,i)):(this.layers.gpsTime.encodeSymbol(t.gpsTimeMultiplierModel,0),t.gpsTimeCompressor.compress(0,i,7),this.recordExtremeGpsDifference(t,n,i))}else if(this.selectGpsTimeSequence(t,e,!0)){this.encodeGpsTime(t,e);return}else this.layers.gpsTime.encodeSymbol(t.gpsTimeMultiplierModel,vw),this.startGpsTimeSequence(t,e);t.lastGpsTimeBits[t.lastGpsSequence]=e}selectGpsTimeSequence(t,e,n){for(let s=1;s<4;s++){let i=t.lastGpsSequence+s&3,o=BigInt.asIntN(64,e-t.lastGpsTimeBits[i]);if(o===BigInt.asIntN(32,o)){let a=n?vw+s:s+1,c=n?t.gpsTimeMultiplierModel:t.gpsTimeZeroDifferenceModel;return this.layers.gpsTime.encodeSymbol(c,a),t.lastGpsSequence=i,!0}}return!1}startGpsTimeSequence(t,e){let n=t.lastGpsTimeBits[t.lastGpsSequence];t.gpsTimeCompressor.compress(Number(BigInt.asIntN(32,n>>32n)),Number(BigInt.asIntN(32,e>>32n)),8),this.layers.gpsTime.writeInt(Number(e&0xffffffffn)),t.nextGpsSequence=t.nextGpsSequence+1&3,t.lastGpsSequence=t.nextGpsSequence,t.lastGpsTimeDifference[t.lastGpsSequence]=0,t.gpsTimeExtremeCounter[t.lastGpsSequence]=0}recordExtremeGpsDifference(t,e,n){t.gpsTimeExtremeCounter[e]++,t.gpsTimeExtremeCounter[e]>3&&(t.lastGpsTimeDifference[e]=n,t.gpsTimeExtremeCounter[e]=0)}},Ku=class{red;green;blue;usedModel=new Et(128);differenceModels=Ir(6,256);constructor(t){this.red=t.red,this.green=t.green,this.blue=t.blue}},nm=class{encoder=new Wt;contexts=new Array(4).fill(null);currentContext;changed=!1;constructor(t,e){this.currentContext=e,this.contexts[e]=new Ku(t)}encode(t,e){let n=this.contexts[this.currentContext];e!==this.currentContext&&(this.currentContext=e,this.contexts[e]||(this.contexts[e]=new Ku({red:n.red,green:n.green,blue:n.blue}),n=this.contexts[e]));let s=this.contexts[this.currentContext],i=((t.red&255)!==(n.red&255)?1:0)|((t.red&65280)!==(n.red&65280)?2:0)|((t.green&255)!==(n.green&255)?4:0)|((t.green&65280)!==(n.green&65280)?8:0)|((t.blue&255)!==(n.blue&255)?16:0)|((t.blue&65280)!==(n.blue&65280)?32:0);((t.red&255)!==(t.green&255)||(t.red&255)!==(t.blue&255)||(t.red&65280)!==(t.green&65280)||(t.red&65280)!==(t.blue&65280))&&(i|=64),this.encoder.encodeSymbol(s.usedModel,i);let o=0,a=0;if(i&1&&(o=(t.red&255)-(n.red&255),this.encoder.encodeSymbol(s.differenceModels[0],we(o))),i&2&&(a=(t.red>>8)-(n.red>>8),this.encoder.encodeSymbol(s.differenceModels[1],we(a))),i&64){if(i&4){let c=(t.green&255)-ri(o+(n.green&255));this.encoder.encodeSymbol(s.differenceModels[2],we(c))}if(i&16){o=Math.trunc((o+(t.green&255)-(n.green&255))/2);let c=(t.blue&255)-ri(o+(n.blue&255));this.encoder.encodeSymbol(s.differenceModels[4],we(c))}if(i&8){let c=(t.green>>8)-ri(a+(n.green>>8));this.encoder.encodeSymbol(s.differenceModels[3],we(c))}if(i&32){a=Math.trunc((a+(t.green>>8)-(n.green>>8))/2);let c=(t.blue>>8)-ri(a+(n.blue>>8));this.encoder.encodeSymbol(s.differenceModels[5],we(c))}}this.changed||=i!==0,n.red=t.red,n.green=t.green,n.blue=t.blue}finish(){return this.changed?this.encoder.finish():new Uint8Array(0)}},Ju=class{value;usedModel=new Et(4);differenceModels=Ir(2,256);constructor(t){this.value=t}},sm=class{encoder=new Wt;contexts=new Array(4).fill(null);currentContext;changed=!1;constructor(t,e){this.currentContext=e,this.contexts[e]=new Ju(t)}encode(t,e){let n=this.contexts[this.currentContext];e!==this.currentContext&&(this.currentContext=e,this.contexts[e]||(this.contexts[e]=new Ju(n.value),n=this.contexts[e]));let s=this.contexts[this.currentContext],i=((t&255)!==(n.value&255)?1:0)|((t&65280)!==(n.value&65280)?2:0);this.encoder.encodeSymbol(s.usedModel,i),i&1&&this.encoder.encodeSymbol(s.differenceModels[0],we((t&255)-(n.value&255))),i&2&&this.encoder.encodeSymbol(s.differenceModels[1],we((t>>8)-(n.value>>8))),this.changed||=i!==0,n.value=t}finish(){return this.changed?this.encoder.finish():new Uint8Array(0)}},Qu=class{values;models;constructor(t){this.values=t.slice(),this.models=Ir(t.byteLength,256)}},im=class{encoders;contexts=new Array(4).fill(null);changed;currentContext;constructor(t,e){this.encoders=Array.from({length:t.byteLength},()=>new Wt),this.changed=new Array(t.byteLength).fill(!1),this.currentContext=e,this.contexts[e]=new Qu(t)}encode(t,e){let n=this.contexts[this.currentContext];e!==this.currentContext&&(this.currentContext=e,this.contexts[e]||(this.contexts[e]=new Qu(n.values),n=this.contexts[e]));let s=this.contexts[this.currentContext];for(let i=0;i<t.byteLength;i++){let o=t[i]-n.values[i];this.encoders[i].encodeSymbol(s.models[i],we(o)),o&&(this.changed[i]=!0,n.values[i]=t[i])}}finish(){return this.encoders.map((t,e)=>this.changed[e]?t.finish():new Uint8Array(0))}}});function Bc(r){return{...r,batchType:"data",length:r.data.numRows}}var Ew=d(()=>{"use strict"});function Ow(r){if(!Number.isFinite(r)||r<0)throw new RangeError("core.batchMaxRowsPerSecond must be a finite nonnegative number")}async function*lm(r,{batchMaxRowsPerSecond:t=0,getRowCount:e,signal:n}){if(Ow(t),n?.throwIfAborted(),t===0){yield*r;return}let s=0;for await(let i of r){n?.throwIfAborted();let o=e(i);if(o!==void 0&&o>0){let a=s-performance.now();for(;a>0;)await nI(Math.min(Math.ceil(a),2**31-1),n),a=s-performance.now();n?.throwIfAborted(),s=performance.now()+o/t*1e3}yield i,n?.throwIfAborted()}}function nI(r,t){return t?.throwIfAborted(),new Promise((e,n)=>{let s=setTimeout(()=>{t?.removeEventListener("abort",i),e()},r);function i(){clearTimeout(s),t?.removeEventListener("abort",i),n(t?.reason)}t?.addEventListener("abort",i,{once:!0})})}var Nw=d(()=>{"use strict"});var ni=d(()=>{"use strict";Xb();Qb();tw();nw();bw();Fw();Ew();Nw()});function sI(r,t="float32"){return r instanceof Date?"date-millisecond":typeof r=="number"?t:typeof r=="boolean"?"bool":typeof r=="string"?"utf8":"null"}function Uw(r){let t=um(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=sI(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function um(r){if(typeof Float16Array<"u"&&r instanceof Float16Array)return"float16";switch(r.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case BigInt64Array:return"int64";case BigUint64Array:return"uint64";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var fm=d(()=>{"use strict"});function fr(r){return{fields:r.fields.map(t=>si(t)),metadata:hm(r.metadata)}}function sf(r,t){return new P(r.fields.map(e=>Yr(e,t)),Ic(r.metadata))}function hm(r){return Object.fromEntries(r)}function Ic(r){return r?new Map(Object.entries(r)):new Map}function si(r){return{name:r.name,type:dm(r.type),nullable:r.nullable,metadata:hm(r.metadata)}}function Yr(r,t){return new B(r.name,_c(r.type,t),r.nullable,Ic(r.metadata))}function dm(r){if(Rw(r,"BinaryView"))return"binary-view";if(Rw(r,"Utf8View"))return"utf8-view";if(iI(r,"LargeList"))return{type:"large-list",children:[si(r.valueField)]};switch(r.constructor){case Ot:return"null";case je:return"binary";case qe:return{type:"fixed-size-binary",byteWidth:r.byteWidth};case ue:return"bool";case Lt:let t=r;return`${t.isSigned?"":"u"}int${t.bitWidth}`;case Se:return"int8";case Be:return"int16";case Dt:return"int32";case rr:return"int64";case Ie:return"uint8";case _e:return"uint16";case qt:return"uint32";case Nr:return"uint64";case ce:switch(r.precision){case ct.HALF:return"float16";case ct.SINGLE:return"float32";case ct.DOUBLE:return"float64";default:return"float16"}case Ur:return"float16";case Kt:return"float32";case Le:return"float64";case le:return"utf8";case $e:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case Me:return r.unit===mt.DAY?"date-day":"date-millisecond";case ns:return"date-day";case ss:return"date-millisecond";case Jt:switch(r.unit){case A.SECOND:return"time-second";case A.MILLISECOND:return"time-millisecond";case A.MICROSECOND:return"time-microsecond";case A.NANOSECOND:return"time-nanosecond";default:return"time-second"}case os:return"time-millisecond";case is:return"time-second";case as:return"time-microsecond";case cs:return"time-nanosecond";case Qt:switch(r.unit){case A.SECOND:return"timestamp-second";case A.MILLISECOND:return"timestamp-millisecond";case A.MICROSECOND:return"timestamp-microsecond";case A.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case ls:return"timestamp-second";case rn:return"timestamp-millisecond";case us:return"timestamp-microsecond";case fs:return"timestamp-nanosecond";case fe:switch(r.unit){case nt.DAY_TIME:return"interval-daytime";case nt.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case hs:return"interval-daytime";case ds:return"interval-yearmonth";case he:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(g=>si(g))};case Ct:let u=r.valueField;return{type:"list",children:[si(u)]};case gt:let f=r;return{type:"fixed-size-list",listSize:f.listSize,children:[si(f.children[0])]};case ot:return{type:"struct",children:r.children.map(g=>si(g))};case ps:case An:let p=r;return{type:p instanceof An?"dense-union":"sparse-union",typeIds:p.typeIds,children:p.children.map(g=>si(g)),typeIdToChildIndex:{...p.typeIdToChildIndex}};case Rt:let y=r;return{type:"dictionary",id:y.id,indices:oI(y.indices),dictionary:dm(y.dictionary),isOrdered:y.isOrdered};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function _c(r,t){if(typeof r=="object")switch(r.type){case"decimal":return new $e(r.scale,r.precision,r.bitWidth);case"map":{let e=r.children.map(n=>Yr(n,t));return new he(e[0],r.keysSorted)}case"list":{let e=Yr(r.children[0],t);return new Ct(e)}case"large-list":{let e=Yr(r.children[0],t),n=Lc("LargeList");if(!n)throw new Error("LargeList requires an Apache Arrow runtime that exports the LargeList constructor");return new n(e)}case"fixed-size-list":{let e=Yr(r.children[0],t);return new gt(r.listSize,e)}case"fixed-size-binary":return new qe(r.byteWidth);case"struct":{let e=r.children.map(n=>Yr(n,t));return new ot(e)}case"sparse-union":case"dense-union":{let e=r.children.map(n=>Yr(n,t));return r.type==="dense-union"?new An(r.typeIds,e):new ps(r.typeIds,e)}case"dictionary":return new Rt(_c(r.dictionary,t),cI(r.indices),r.id,r.isOrdered);default:throw new Error("array type not supported")}switch(r){case"null":return new Ot;case"binary":return Pw("BinaryView",new je,t);case"binary-view":return kw("BinaryView");case"bool":return new ue;case"int8":return new Se;case"int16":return new Be;case"int32":return new Dt;case"int64":return new rr;case"uint8":return new Ie;case"uint16":return new _e;case"uint32":return new qt;case"uint64":return new Nr;case"float16":return new Ur;case"float32":return new Kt;case"float64":return new Le;case"utf8":return Pw("Utf8View",new le,t);case"utf8-view":return kw("Utf8View");case"date-day":return new ns;case"date-millisecond":return new ss;case"time-second":return new is;case"time-millisecond":return new os;case"time-microsecond":return new as;case"time-nanosecond":return new cs;case"timestamp-second":return new ls;case"timestamp-millisecond":return new rn;case"timestamp-microsecond":return new us;case"timestamp-nanosecond":return new fs;case"interval-daytime":return new hs;case"interval-yearmonth":return new ds;default:throw new Error("array type not supported")}}function Lc(r){return Ne[r]}function Rw(r,t){let e=Lc(t);if(e&&r instanceof e)return!0;let n=x;return!!(t==="BinaryView"?n.isBinaryView:n.isUtf8View)?.(r)}function iI(r,t){let e=Lc(t);return!!(e&&r instanceof e)}function Pw(r,t,e){let n=e?.viewTypes||"never";if(n==="never")return t;let s=Lc(r);if(s)return new s;if(n==="require")throw new Error(`${r} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return t}function kw(r){let t=Lc(r);if(!t)throw new Error(`${r} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return new t}function oI(r){if(r instanceof Lt){let e=`${r.isSigned?"int":"uint"}${r.bitWidth}`;if(aI(e))return e}switch(r.constructor){case Se:return"int8";case Be:return"int16";case Dt:return"int32";case Ie:return"uint8";case _e:return"uint16";case qt:return"uint32";default:throw new Error(`arrow dictionary index type not supported: ${r.constructor.name}`)}}function aI(r){return["int8","int16","int32","uint8","uint16","uint32"].includes(r)}function cI(r){switch(r){case"int8":return new Se;case"int16":return new Be;case"int32":return new Dt;case"uint8":return new Ie;case"uint16":return new _e;case"uint32":return new qt;default:throw new Error(`schema dictionary index type not supported: ${r}`)}}var aa=d(()=>{"use strict";Ue()});function pm(r){return!!(r&&typeof r=="object"&&"schema"in r&&"batches"in r&&Array.isArray(r.batches)&&"numRows"in r&&typeof r.numRows=="number"&&"getChildAt"in r&&typeof r.getChildAt=="function")}var zw=d(()=>{"use strict"});function lo(r){return sf(fr(r))}function Vw(r,t){if(!r)return lo(t);new X(r,[new tt(t,void 0)]);let e=fr(r),n=fr(t);return sf({...n,fields:n.fields.map((s,i)=>Gw(e.fields[i],s)),metadata:{...e.metadata,...n.metadata}})}function Gw(r,t){return{...t,type:jw(r.type,t.type),metadata:{...r.metadata,...t.metadata}}}function jw(r,t){if(typeof r!="object"||typeof t!="object")return t;if("children"in r&&"children"in t){let e=r.children;return{...t,children:t.children.map((n,s)=>Gw(e[s],n))}}return r.type==="dictionary"&&t.type==="dictionary"?{...t,dictionary:jw(r.dictionary,t.dictionary)}:t}function mm(r,t){let e=lo(t),n=r.batches.map(s=>new tt(lo(e),s.data,new Map(s.metadata)));return new X(e,n.length?n:[new tt(lo(e),void 0)])}function ii(r,t){let e=new P(r.data.schema.fields,new Map([...r.data.schema.metadata,...Object.entries(t)])),n=mm(r.data,e);return{...r,data:n,schema:fr(n.schema)}}function Zr(r){return new tt(lo(r),void 0)}async function*Tc(r){let t,e;for await(let n of r){let s=n;if(s?.shape!=="arrow-table"){yield n;continue}let i=s.data.schema.metadata.get("boundingBox"),o=lo(s.data.schema);if(i){let c=JSON.parse(i);e=e?[c[0].map((l,u)=>Math.min(e[0][u],l)),c[1].map((l,u)=>Math.max(e[1][u],l))]:c,o.metadata.set("boundingBox",JSON.stringify(e))}t=Vw(t,o);let a=mm(s.data,t);if(i)for(let c of a.batches)c.metadata.set("boundingBox",i);yield{...s,data:a,schema:fr(a.schema)}}}var ym=d(()=>{"use strict";Ue();aa()});var gm=d(()=>{"use strict";kb()});function $w(r){return r.type instanceof gt?r.type.listSize:1}function bm(r,t,e){let n=lI(r,t,e);return new v([n])}function lI(r,t,e){let n=uI(r,t,e),s=n.children[0].type,i=e==="float16"&&Yn(r)?wa(r):r,o={[Z.DATA]:i},a=new M(s,0,i.length,0,o);return new M(n,0,i.length/t,0,void 0,[a])}function uI(r,t,e){let n=e||Uw(r).type,s=_c(n);return new gt(t,new B("value",s,!1))}var wm=d(()=>{"use strict";Ws();Ue();fm();aa()});function Pe(r,t){return of(r.attributes,{schema:r.schema,topology:r.topology,mode:r.mode,boundingBox:r.header?.boundingBox,indices:dI(r)?r.indices:void 0})}function of(r,t={}){let e=[],n={},s=hI(r);for(let c of s){let l=r[c],{value:u,size:f=1}=l,h=fI(u,f,l.componentType);if(n[c]=h,e.push(pI(t.schema,c,h,l.componentType)),c==="POSITION"&&t.indices?.value?.length){let p=rp.fields.find(y=>y.name==="indices");n.indices=yI(t.indices.value,h.length,p.type),e.push(p)}}let i=new P(e,gI(t)),o=n[s[0]]?.length===0?new X(i):new X(i,n);return{shape:"arrow-table",schema:fr(o.schema),data:o,topology:t.topology||"point-list",indices:t.indices}}function fI(r,t,e){if(e==="float16"){let n=Yn(r)?wa(r):r;if(t===1){let s=new M(new Ur,0,n.length,0,{[Z.DATA]:n});return new v([s])}return bm(r,t,e)}return t===1?ee(r):bm(r,t)}function hI(r){let t=Object.keys(r),e=qw.filter(s=>s in r),n=t.filter(s=>!qw.includes(s));return[...e,...n]}function dI(r){return!!r.indices?.value?.length}function pI(r,t,e,n){if(t==="POSITION"&&mI(e)){let i=Au.fields[0],o=r?.fields.find(c=>c.name===t);if(!o?.metadata)return i;let a=new Map(i.metadata);for(let[c,l]of Object.entries(o.metadata))a.set(c,l);return new B(i.name,i.type,i.nullable,a)}let s=r?.fields.find(i=>i.name===t);if(n==="float16"){let i=new Map(Object.entries(s?.metadata||{}));return i.set("componentType","float16"),new B(t,e.type,!1,i)}if(s&&s.type.toString()!==e.type.toString()){let i=Yr(s);return new B(t,e.type,i.nullable,i.metadata)}return s?Yr(s):new B(t,e.type,!1)}function mI(r){return r.type instanceof gt&&r.type.listSize===3&&r.type.children[0].type instanceof Kt}function yI(r,t,e){let n=e,s=r instanceof Uint32Array?r:Uint32Array.from(r),i=new Int32Array(t+1);t>0&&i.fill(s.length,1);let o=new Uint8Array(Math.ceil(t/8));t>0&&(o[0]=1);let a=new M(n.children[0].type,0,s.length,0,{[Z.DATA]:s}),c=new M(n,0,t,Math.max(0,t-1),{[Z.OFFSET]:i,[Z.VALIDITY]:o},[a]);return new v([c])}function gI(r){let t={...r.schema?.metadata};return r.topology&&(t.topology||=r.topology),Number.isFinite(r.mode)&&(t.mode||=String(r.mode)),r.boundingBox&&(t.boundingBox||=JSON.stringify(r.boundingBox)),Ic(t)}var qw,Ww=d(()=>{"use strict";Ws();Ws();Ue();wm();aa();qw=["POSITION"]});function ne(r){if(pm(r)||r.shape==="arrow-table")return Yw(r);throw new Error(r.shape)}function Yw(r){let t=pm(r)?r:r.data,e=fr(t.schema),n=t.batches.length===1?t.batches[0].metadata.get("boundingBox"):void 0;n&&(e.metadata={...e.metadata,boundingBox:n});let s=e.fields,i={},o=[];for(let f of s){let{name:h}=f;if(h==="indices")continue;let p=t.getChild(h),y=$w(p),g=vI(p,y),w=wI(f.metadata),S=w.componentType==="float16"?SI(g):g,E=o.find(I=>I.data.length===p.data.length&&i[I.name].value.constructor===S.constructor&&I.data.every((b,C)=>Zw(b,p.data[C])));i[h]={value:E?i[E.name].value:S,size:y,...w},E||o.push({name:h,data:p.data})}AI(e);let a=e.metadata.topology,c=BI(e),l=II(t),u=i.POSITION?.transform?.type==="quantization"?bI(e)||lr(i):lr(i);return{schema:e,attributes:i,topology:a,mode:c,indices:l,header:{vertexCount:t.numRows,boundingBox:u??void 0}}}function bI(r){let t=r.metadata?.boundingBox;if(!t)return null;try{let e=JSON.parse(t);if(Array.isArray(e)&&e.length===2&&e.every(n=>Array.isArray(n)&&n.length===3&&n.every(s=>typeof s=="number")))return e}catch{}return null}function wI(r={}){let t={};if(r.byteOffset!==void 0&&(t.byteOffset=Number(r.byteOffset)),r.byteStride!==void 0&&(t.byteStride=Number(r.byteStride)),r.normalized!==void 0&&(t.normalized=r.normalized==="true"),r.componentType==="float16"&&(t.componentType="float16"),r["loaders.gl.transform"])try{let e=JSON.parse(r["loaders.gl.transform"]);xI(e)&&(t.transform=e)}catch{}return t}function xI(r){if(!r||typeof r!="object"||!("type"in r))return!1;let t=r;return t.type==="octahedron"?Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30:t.type==="quantization"&&Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30&&Array.isArray(t.origin)&&t.origin.every(e=>typeof e=="number")&&typeof t.range=="number"}function AI(r){r.metadata||={},r.metadata.topology||="point-list",r.metadata.mode||="0"}function vI(r,t){if(!(r.type instanceof gt))return r.toArray();let n=r.data[0].children[0].values.constructor,s=new n(r.length*t),i=0;for(let o of r.data){let a=o.children[0],c=o.length*t,l=a.offset||o.offset*t,u=l+c<=a.values.length?l:0,f=a.values.subarray(u,u+c);s.set(f,i),i+=c}return s}function SI(r){let t=jc(r.length);for(let e=0;e<r.length;e++)$c(t,e,Gf(r,e));return t}function BI(r){let t=Number(r.metadata?.mode);return Number.isFinite(t)?t:0}function II(r){let t=r.getChild("indices");if(!t?.isValid(0))return;let e=t.data[0],n=e.valueOffsets,s=n[e.offset],i=n[e.offset+1];return{value:e.children[0].values.subarray(s,i),size:1}}function Zw(r,t){let e=Object.values(t.buffers);return r.type.toString()===t.type.toString()&&r.offset===t.offset&&r.length===t.length&&r.nullCount===t.nullCount&&r.dictionary===t.dictionary&&Object.values(r.buffers).every((n,s)=>{let i=e[s];return n===i||!!(n&&i&&n.buffer===i.buffer&&n.byteOffset===i.byteOffset&&n.byteLength===i.byteLength)})&&r.children.length===t.children.length&&r.children.every((n,s)=>Zw(n,t.children[s]))}var Hw=d(()=>{"use strict";Ws();Ue();wm();aa();zw();gm()});function uo(r,t={}){return{fields:_I(r),metadata:t}}function Xw(r,t,e){let n=t.componentType||um(t.value),s=e||Kw(t),i=t.size===1?n:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]};return{name:r,type:i,nullable:!1,metadata:s}}function _I(r){let t=[];for(let e in r){let n=r[e];t.push(Xw(e,n))}return t}function Kw(r){let t={};return"byteOffset"in r&&(t.byteOffset=r.byteOffset.toString(10)),"byteStride"in r&&(t.byteStride=r.byteStride.toString(10)),"normalized"in r&&(t.normalized=r.normalized.toString()),r.componentType&&(t.componentType=r.componentType),r.transform&&(t["loaders.gl.transform"]=JSON.stringify(r.transform)),t}var Jw=d(()=>{"use strict";fm()});var $t=d(()=>{"use strict";aa();gm();Ww();Hw();Jw();ym();ym()});var Qw,t1=d(()=>{"use strict";Qw={name:"LAS",id:"las",module:"pointclouds",encoding:"binary",format:"las",extensions:["las","laz"],mimeTypes:["application/octet-stream"],text:!1,binary:!0,tests:["LASF"]}});function r1(r){return r?.las?.shape||e1}function n1(r,t){if(t==="uint8norm"||!r.attributes.COLOR_0)return r;let e=r.attributes.COLOR_0,n=e.value instanceof Uint16Array?65535:255,s=t==="float16"?fi(e.value,n):xa(e.value,n),i={...r.attributes};for(let[o,a]of Object.entries(i))a.value===e.value&&(i[o]={...a,value:s,normalized:!1,...t==="float16"?{componentType:"float16"}:{}});return{...r,attributes:i}}var LI,e1,af,s1=d(()=>{"use strict";Ws();t1();LI="5.0.0-beta.10",e1="arrow";af={...Qw,defaultShape:"arrow",supportsNativeArrow:!0,dataType:null,batchType:null,version:LI,worker:!1,options:{las:{shape:e1,fp64:!1,colorDepth:8,colorFormat:"uint8norm",columns:void 0,extraBytes:"raw",recoverMissingChunkTable:!1,compatibilityMode:"auto"}}}});var cf=d(()=>{});var lf=d(()=>{});function ca(r){return r.variadicBuffers??[]}function Mc(r,t,e,n,s,i,o,a){return Reflect.construct(M,[r,t,e,n,s,i,o,a])}var uf=d(()=>{Ue()});function Dc(r){return r.metadata}function Cc(r,t,e){if("metadata"in tt.prototype){let s=tt;return Object.assign(new s(r,t,e),{data:t})}let n=Object.assign(new tt(r,t),{data:t});return e===void 0?n:Object.assign(n,{metadata:e})}var ff=d(()=>{Ue()});function Am(r,t={}){let e=new Set,n=new Set;for(let i of t.retain??[]){let o=i1(i)?i.batches.map(a=>a.data):a1(i)?i.data:[o1(i)?i.data:i];for(let a of o)xm(a,e,n)}let s={...t,copies:new WeakMap,retainedBuffers:e};return i1(r)?TI(r,s):o1(r)?c1(r,s):a1(r)?l1(r,s):hf(r,s)}function i1(r){return"batches"in r}function o1(r){return"schema"in r&&"data"in r&&!Array.isArray(r.data)}function a1(r){return"data"in r&&Array.isArray(r.data)}function TI(r,t){let e=r.batches.map(n=>c1(n,t));return new X(r.schema,e)}function c1(r,t){let e=hf(r.data,t);return Cc(r.schema,e,Dc(r))}function hf(r,t){let e=r.children.map(i=>hf(i,t)),n=r.dictionary?l1(r.dictionary,t):void 0,s={[Z.OFFSET]:Fc(r.buffers[Z.OFFSET],t),[Z.DATA]:Fc(r.buffers[Z.DATA],t),[Z.VALIDITY]:Fc(r.buffers[Z.VALIDITY],t),[Z.TYPE]:Fc(r.buffers[Z.TYPE],t)};return Mc(r.type,r.offset,r.length,r._nullCount,s,e,n,ca(r).map(i=>Fc(i,t)))}function l1(r,t){return new v(r.data.map(e=>hf(e,t)))}function xm(r,t,e){if(!e.has(r)){e.add(r);for(let n of[...Object.values(r.buffers),...ca(r)])u1(n)&&t.add(n.buffer);for(let n of r.children)xm(n,t,e);for(let n of r.dictionary?.data??[])xm(n,t,e)}}function Fc(r,t){if(!u1(r))return r;let e=r.byteOffset!==0||r.byteLength!==r.buffer.byteLength;if(!t.retainedBuffers.has(r.buffer)&&t.copy!=="all"&&(t.copy==="none"||!e))return r;let n=t.copies.get(r);return n||(n=r instanceof Uint8Array?new Uint8Array(r):r.slice(),t.copies.set(r,n)),n}function u1(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var df=d(()=>{Ue();ff();uf()});var vm=d(()=>{uf();df()});var Sm=d(()=>{cf()});var Bm=d(()=>{cf();lf();vm();Sm()});var d1=d(()=>{cf();Bm()});var p1=d(()=>{lf()});function m1(r,t){let e=Am(r,t);return{transport:"arrow-js",version:1,schema:Ji(new X(e.schema,[])),metadataVersion:e.schema.metadataVersion,batches:e.batches.map(n=>{let s=Dc(n);return{...Im(n.data),...s!==void 0?{metadata:[...s]}:{}}})}}function y1(r){if(r.transport!=="arrow-js"||r.version!==1)throw new Error("Unsupported Arrow column-buffer transport protocol.");let t=qs(r.schema).schema,e=new P(t.fields,t.metadata,t.dictionaries,r.metadataVersion),n=new ot(e.fields),s=r.batches.map(i=>{let o=_m(i,n);return Cc(e,o,i.metadata&&new Map(i.metadata))});return new X(e,s)}function Im(r){return{offset:r.offset,length:r.length,nullCount:r.nullCount,buffers:{[Z.OFFSET]:r.buffers[Z.OFFSET],[Z.DATA]:r.buffers[Z.DATA],[Z.VALIDITY]:r.buffers[Z.VALIDITY],[Z.TYPE]:r.buffers[Z.TYPE]},children:r.children.map(t=>Im(t)),variadicBuffers:ca(r),dictionary:r.dictionary?.data.map(t=>Im(t))}}function _m(r,t){let e=r.children.map((s,i)=>_m(s,t.children[i].type)),n=r.dictionary&&x.isDictionary(t)?new v(r.dictionary.map(s=>_m(s,t.dictionary))):void 0;return Mc(t,r.offset,r.length,r.nullCount,r.buffers,e,n,r.variadicBuffers)}var g1=d(()=>{Ue();ff();uf();df()});var b1=d(()=>{});var w1=d(()=>{Bm();Sm();d1();lf();p1();df();g1();b1();vm();ff()});var x1=d(()=>{w1()});function se(r){if(!EI(r))throw new Error("Workers require Arrow table output");let{data:t,shape:e,...n}=r;return{transport:"arrow-column-envelope",metadata:structuredClone(n),...UI(t,{copy:"all"})}}function la(r){if(OI(r))return{...r.metadata,shape:"arrow-table",data:A1(r)};if(NI(r)){let{arrowBatchMetadata:t,data:e,...n}=r;return{...n,data:A1(r)}}throw new Error("Workers require Arrow column transport")}function EI(r){let t=r;return!!(t&&t.shape==="arrow-table"&&t.data&&typeof t.data=="object"&&"batches"in t.data)}function v1(r){let t=r;return t?.data?.transport==="arrow-js"&&Array.isArray(t.data.batches)}function OI(r){return r?.transport==="arrow-column-envelope"&&v1(r)}function NI(r){return r?.shape==="arrow-table"&&v1(r)}function UI(r,t){return{arrowBatchMetadata:PI(r),data:RI(r,t)}}function RI(r,t){let e=m1(r,t);if(r.numCols===0)for(let[n,s]of r.batches.entries())e.batches[n].length=s.numRows;return e}function PI(r){return r.batches.map(t=>({schema:Ji(new X(t.schema,[])),metadata:Array.from(t.metadata)}))}function A1(r){let{arrowBatchMetadata:t,data:e}=r,n=y1(e),s=n.batches.map((i,o)=>{let a=t?.[o],c=a?new tt(qs(a.schema).schema,i.data,new Map(a.metadata)):i,l=e.batches[o].length;return c.numCols===0&&c.numRows!==l&&Object.defineProperty(c,"data",{value:new M(new ot([]),0,l,0,void 0,[])}),c});return new X(n.schema,s)}var oi=d(()=>{"use strict";Ue();x1()});function S1(r,t){let e=ua(r);return uo(t,e)}function ua(r){let t={};return t.las_pointsOffset=r.pointsOffset.toString(10),t.las_pointsFormatId=r.pointsFormatId.toString(10),t.las_pointsStructSize=r.pointsStructSize.toString(10),t.las_pointsCount=r.pointsCount.toString(10),t.las_scale=JSON.stringify(r.scale),t.las_offset=JSON.stringify(r.offset),r.maxs!==void 0&&(t.las_maxs=JSON.stringify(r.maxs)),r.mins!==void 0&&(t.las_mins=JSON.stringify(r.mins)),t.las_totalToRead=r.totalToRead.toString(10),t.las_pointsFortotalReadmatId=r.totalRead.toString(10),r.versionAsString!==void 0&&(t.las_versionAsString=r.versionAsString),r.isCompressed!==void 0&&(t.las_isCompressed=r.isCompressed.toString()),r.metadata?.wkt&&(t.las_wkt=r.metadata.wkt),r.metadata?.wktMathTransform&&(t.las_wktMathTransform=r.metadata.wktMathTransform),r.metadata?.geotiff&&(t.las_geotiff=JSON.stringify(r.metadata.geotiff)),t}var Lm=d(()=>{"use strict";$t()});function B1(r,t){let e=t.vlrs.find(y=>y.userId==="lascompatible"&&y.recordId===22204);if(!e)return;if(!["1.0","1.1","1.2","1.3"].includes(r.versionAsString||"")||![1,3,4,5].includes(r.pointsFormatId))throw new Error("LASLoader: compatibility mode requires a legacy LAS point format");let n=new DataView(e.data.buffer,e.data.byteOffset,e.data.byteLength);if(n.byteLength<4)throw new Error("LASLoader: truncated LASzip compatibility VLR");let s=n.getUint16(2,!0);if(s!==3&&s!==4||n.byteLength!==(s===3?156:174))throw new Error(`LASLoader: unsupported LASzip compatibility VLR version ${s} or length`);let i=new Map,o=0;for(let y of t.extraBytes){let g=y.dataType>20?y.dataType-20:y.dataType>10?y.dataType-10:y.dataType,w=y.dataType>20?3:y.dataType>10?2:1,S=y.dataType===0?y.options:g<=2?w:g<=4?2*w:g<=6||g===9?4*w:8*w;if(y.dataType>30||!S)throw new Error("LASLoader: invalid compatibility Extra Bytes layout");i.set(y.name,{byteOffset:o,dataType:y.dataType}),o+=S}let a={1:28,3:34,4:57,5:63}[r.pointsFormatId];if(o!==r.pointsStructSize-a)throw new Error("LASLoader: compatibility descriptors do not match point record length");let c=Ec(i,"LAS 1.4 scan angle",4),l=Ec(i,"LAS 1.4 extended returns",1),u=Ec(i,"LAS 1.4 classification",1),f=Ec(i,"LAS 1.4 flags and channel",1),h=i.has("LAS 1.4 NIR band")?Ec(i,"LAS 1.4 NIR band",3):void 0,p=r.pointsFormatId===1?6:r.pointsFormatId===3?h===void 0?7:8:r.pointsFormatId===4?9:10;if(r.pointsFormatId===5&&h===void 0)throw new Error("LASLoader: compatibility waveform color points require NIR");return{pointDataRecordFormat:p,version:s===3?"1.4":"1.5",scanAngleByteOffset:c,returnsByteOffset:l,classificationByteOffset:u,flagsByteOffset:f,nirByteOffset:h}}function Ec(r,t,e){let n=r.get(t);if(!n||n.dataType!==e)throw new Error(`LASLoader: missing or invalid compatibility field ${t}`);return n.byteOffset}function Tm(r,t,e,n,s){if(!s.classifications&&!s.returnNumbers&&!s.numberOfReturns&&!s.scanAngles&&!s.overlapFlags&&!s.scannerChannels&&!s.nir)return;let i=r.getUint8(t+n.returnsByteOffset),o=r.getUint8(t+n.flagsByteOffset);if(s.classifications&&(s.classifications[e]+=r.getUint8(t+n.classificationByteOffset)),s.returnNumbers&&(s.returnNumbers[e]+=i>>4),s.numberOfReturns&&(s.numberOfReturns[e]+=i&15),s.scanAngles){let a=s.scanAngles[e],c=Math.fround(a/Math.fround(.006)),l=Math.sign(c)*Math.floor(Math.abs(c)+.5);s.scanAngles[e]=l+r.getInt16(t+n.scanAngleByteOffset,!0)}s.overlapFlags&&(s.overlapFlags[e]=o&1),s.scannerChannels&&(s.scannerChannels[e]=o>>1&3),s.nir&&n.nirByteOffset!==void 0&&(s.nir[e]=r.getUint16(t+n.nirByteOffset,!0))}var I1=d(()=>{"use strict"});function L1(r){if(r.byteLength%192!==0)throw new Error(`LAS Extra Bytes VLR length ${r.byteLength} is not a multiple of 192`);let t=[],e=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let n=0;n<r.byteLength;n+=192){let s=[e.getFloat64(n+112,!0),e.getFloat64(n+120,!0),e.getFloat64(n+128,!0)],i=[e.getFloat64(n+136,!0),e.getFloat64(n+144,!0),e.getFloat64(n+152,!0)];t.push({dataType:r[n+2],options:r[n+3],name:_1(r,n+4,32),description:_1(r,n+160,32),scale:s[0],offset:i[0],scales:s,offsets:i,data:r.slice(n,n+192)})}return t}function T1(r,t,e){let n=0,s=new Set,i=[];for(let o=0;o<t.length;o++){let a=t[o],c=zI(a.dataType),l=VI(a.dataType),f=GI(c)*l;if(a.dataType<1||a.dataType>30||!f)throw new Error(`Unsupported typed LAS Extra Bytes data type ${a.dataType}`);let h=`EXTRA_BYTES_${kI(a.name)}`;h==="EXTRA_BYTES_"&&(h=`EXTRA_BYTES_${o}`);let p=h,y=1;for(;s.has(h);)h=`${p}_${y++}`;s.add(h);let g=a.options&8?a.scales.slice(0,l):new Array(l).fill(1),w=a.options&16?a.offsets.slice(0,l):new Array(l).fill(0),E=c!==10&&(c===7||c===8?g.some(I=>I!==1)||w.some(I=>I!==0):!!(a.options&24));i.push({name:h,value:Mm(c,r*l,E),size:l,scalarDataType:c,byteOffset:n,byteLength:f,outputFloat64:E,scales:g,offsets:w}),n+=f}if(n!==e)throw new Error(`LAS Extra Bytes descriptors use ${n} bytes; point records provide ${e}`);return i}function _1(r,t,e){let n=new TextDecoder().decode(r.subarray(t,t+e)),s=n.length;for(;s>0&&n[s-1]==="\0";)s--;return n.slice(0,s).trim()}function kI(r){return r.trim().replace(/[^A-Za-z0-9_]+/g,"_")}function zI(r){return r>20?r-20:r>10?r-10:r}function VI(r){return r>20?3:r>10?2:1}function GI(r){return r<=2?1:r<=4?2:r<=6||r===9?4:r===7||r===8||r===10?8:0}function jI(r,t,e){switch(e){case 1:return r.getUint8(t);case 2:return r.getInt8(t);case 3:return r.getUint16(t,!0);case 4:return r.getInt16(t,!0);case 5:return r.getUint32(t,!0);case 6:return r.getInt32(t,!0);case 7:return r.getBigUint64(t,!0);case 8:return r.getBigInt64(t,!0);case 9:return r.getFloat32(t,!0);case 10:return r.getFloat64(t,!0);default:throw new Error(`Unsupported typed LAS Extra Bytes scalar data type ${e}`)}}function Mm(r,t,e){if(e&&r!==10)return new Float64Array(t);switch(r){case 1:return new Uint8Array(t);case 2:return new Int8Array(t);case 3:return new Uint16Array(t);case 4:return new Int16Array(t);case 5:return new Uint32Array(t);case 6:return new Int32Array(t);case 7:return new BigUint64Array(t);case 8:return new BigInt64Array(t);case 9:return new Float32Array(t);case 10:return new Float64Array(t);default:throw new Error(`Unsupported typed LAS Extra Bytes scalar data type ${r}`)}}function Dm(r,t,e,n,s){let i=jI(r,t,e.scalarDataType);e.value instanceof BigInt64Array||e.value instanceof BigUint64Array?e.value[n]=i:e.value[n]=Number(i)*e.scales[s]+e.offsets[s]}var M1=d(()=>{"use strict"});function ci(r,t,e){return{pointDataRecordFormat:r.pointsFormatId,pointDataRecordLength:r.pointsStructSize,pointCount:e,point10ItemVersion:t.items.find(n=>n.type===6)?.version,gpsTime11ItemVersion:t.items.find(n=>n.type===7)?.version,rgb12ItemVersion:t.items.find(n=>n.type===8)?.version,byteItemVersion:t.items.find(n=>n.type===0)?.version,point14ItemVersion:t.point14ItemVersion??void 0,rgb14ItemVersion:t.rgb14ItemVersion??void 0,wavePacketItemVersion:t.wavePacketItemVersion??void 0,byte14ItemVersion:t.byte14ItemVersion??void 0}}function U1(r,t={}){let e=G1(r);if(e.isCompressed){let s=new Uint8Array(r),i=Rm(s,e);if(gf(e,i),e.pointsFormatId<=5||e.pointsFormatId>=6&&e.pointsFormatId<=10)return XI(s,e,i,t);let o=i_(r,e,i),a=e.pointsCount;return Oc(o,{...e,pointsOffset:0,pointsCount:a,totalToRead:a,totalRead:a},t)}let n=e.pointsCount;return Oc(r,{...e,totalToRead:n,totalRead:n},t)}function R1(r,t,e){if(t.pointDataRecordFormat<6||t.pointDataRecordFormat>8)throw new Error(`LASLoader: standalone Arrow chunk decode supports PDRF 6-8; received ${t.pointDataRecordFormat}`);let n=t.pointCount,s={pointsOffset:0,pointsFormatId:t.pointDataRecordFormat,pointsStructSize:t.pointDataRecordLength,pointsCount:n,scale:t.scale,offset:t.offset,maxs:[0,0,0],mins:[0,0,0],totalToRead:n,totalRead:n,hasColor:Z1(t.pointDataRecordFormat),versionAsString:"1.4",isCompressed:!0,headerSize:N1,vlrCount:0},i=xf(n,s,e);if(i.waveforms||i.extraBytes||i.typedExtraBytes)throw new Error("LASLoader: standalone Arrow chunk decode only supports direct LAZ columns");let a=Wr(r,t).decodeIntoPointData(i.target,n);if(a!==n)throw new Error(`LASLoader: standalone LAZ chunk produced ${a} points; expected ${n}`);return P1(s,i,n,e,!0)}function XI(r,t,e,n){let s=t.pointsCount,i=xf(s,t,n),o=Pm(r,t,e,n),a=0,c=t.pointsOffset+(e.compressor===1?0:Yt);for(let l of o)KI(r,c,l.byteLength,l.pointCount,t,e,i,a),c+=l.byteLength,a+=l.pointCount;if(a!==s)throw new Error(`LASLoader: decoded ${a} LAZ points; expected ${s}`);return P1(t,i,s,n)}function P1(r,t,e,n,s=!1){let i=s&&t.rawColors?t.rawColors:t.colors?t.colors:t.rawColors?tx(t.rawColors,e,n):null;return Fm({...r,pointsOffset:0,pointsCount:e,totalRead:e},t.positions,i,t.intensities,t.classifications,t.syntheticFlags,t.keyPointFlags,t.withheldFlags,t.overlapFlags,t.gpsTimes,t.nir,t.scanAngles,t.userData,t.pointSourceIds,t.returnNumbers,t.numberOfReturns,t.scannerChannels,t.scanDirectionFlags,t.edgeOfFlightLines,t.waveforms,t.extraBytes,t.typedExtraBytes)}function KI(r,t,e,n,s,i,o,a){let c=r.subarray(t,t+e);if(c.byteLength!==e)throw new at("LASLoader: truncated LAZ chunk");let l=Wr(c,ci(s,i,n));o.target.pointOffset=a;let u=l.decodeIntoPointData(o.target,n);if(u!==n)throw new Error(`LASLoader: decoded ${u} points from a ${n}-point LAZ chunk`);zm(o,a,n)}async function*k1(r,t={}){let e=ha(t),n=R_(r),s=new Uint8Array(0),i=0,o=null,a=0,c=0,l;for(;;){let f=await n.next();if(f.done)break;let h=f.value;if(s=Cm(s,yf(h)),o||(o=U_(s,i),o&&s.byteLength<o.pointsOffset&&(o=null),o&&(o.totalToRead=o.pointsCount)),!!o){if(o.isCompressed){let p=o.metadata?.evlrOffset,y=s.byteLength,g=[];p&&p<y&&g.push(s.subarray(p));let w={async next(){let S=await n.next();if(!S.done&&p){let E=yf(S.value),I=Math.max(p-y,0);I<E.byteLength&&g.push(E.slice(I)),y+=E.byteLength}return S}};if(o.pointsCount===0){let{laszip:S}=await H1(s,w,o);gf(o,S),l=D1(o,t)}else for await(let S of t_(s,w,o,t))l=ii(S,ua({...o,totalRead:S.loaderData.totalRead,metadata:S.loaderData.metadata||o.metadata})),yield l;if(p&&l&&o.metadata?.evlrCount&&(l.loaderData.metadata?.evlrs.length??0)<o.metadata.evlrCount){for(;!(await w.next()).done;);let S=g.reduce(Cm,new Uint8Array(0)),E=C1(l,o,S,p,l.loaderData.totalRead);if(E){yield E;return}}o.pointsCount===0&&l&&(yield l);return}for(let p of O_(s,i,o,a,c,e))a=p.sourcePointIndex,c=p.totalRead,s=p.pending,i=p.absoluteOffset,l=ii(Oc(p.arrayBuffer,p.header,t),ua({...o,totalRead:c})),yield l}}if(!o)throw new Error("LASLoader: incomplete LAS header");if(c<o.totalToRead)throw new Error("LASLoader: truncated LAS point data");l||(l=D1(o,t),yield l);let u=C1(l,o,s,i,c);u&&(yield u)}function D1(r,t){let e=Oc(new ArrayBuffer(0),{...r,pointsOffset:0},t);return ii({...e,loaderData:r},ua(r))}function C1(r,t,e,n,s){let i=t.metadata;if(i?.evlrOffset&&i.evlrCount){let o=i.evlrOffset-n,a=$1(new DataView(e.buffer,e.byteOffset,e.byteLength),o,i.evlrCount).map(u=>({...u,offset:u.offset+n})),c={...i,evlrs:a,extraBytes:[...i.extraBytes],waveformPacketDescriptors:[...i.waveformPacketDescriptors]};for(let u of a)q1({...u,data:u.data||new Uint8Array},c);W1(c);let l={...t,totalRead:s,metadata:c};if(a.length>0){let u=new X([Zr(r.data.schema)]);return ii({...r,data:u,loaderData:l},ua(l))}}}async function*JI(r,t,e,n,s){if(n.variableChunks){let p=await b_(r,t);yield*V1(p,e,n,s);return}if(e.pointsFormatId<=5){yield*QI(r,t,e,n,s);return}let i={...e,totalToRead:e.pointsCount},o=ha(s),a=wf(o,e.pointsStructSize,Af(s)),c=0,l=[],u=new Hs;u.write(r),await ho(u,t,e.pointsOffset+Yt,"LASLoader: incomplete compressed LAZ point data"),u.skip(e.pointsOffset);let f=vf(u.getDataView(Yt));for(;c<e.pointsCount;){let p=Math.min(n.chunkSize,e.pointsCount-c),y=ci(e,n,p),g=await v_(u,t,y);l.push(g),Vm(u,g,a.stats);let w=u.readBytes(g);s.las?.recoverMissingChunkTable&&f===e.pointsOffset&&km(w,y);for(let S of Gm(w,y,i,a))yield S;c+=p}await bf(u,t,e,n,f,l,s);let h=fo(i,a);h&&(yield h)}async function*QI(r,t,e,n,s={}){let i={...e,totalToRead:e.pointsCount},o=ha(s),a=wf(o,e.pointsStructSize,Af(s)),c=[],l=new Hs;l.write(r),await ho(l,t,e.pointsOffset+(n.compressor===1?0:Yt),"LASLoader: incomplete compressed LAZ point data"),l.skip(e.pointsOffset);let u=n.compressor===1?0:vf(l.getDataView(Yt)),f=0;for(;f<e.pointsCount;){let p=n.compressor===1?e.pointsCount:Math.min(n.chunkSize,e.pointsCount-f),y=ci(e,n,p),g=Wr(new Uint8Array(0),y),w=0,S=0,E=!1;for(;g.remainingPointCount>0;){let I=l.getAvailableByteLength(),b=z1(I,w,g.requiredInputByteLength-S);if(b>w){let K=l.checkpoint();l.skip(w);let ft=b-w;Vm(l,ft,a.stats),g.feed(l.readBytes(ft)),l.restore(K),w=b}let C=o-a.batchPointCount,L=g.decodeAvailableInto(a.rawBatch,a.batchPointCount*e.pointsStructSize,C,E);if(L>0){if(n.compressor===1){let K=g.compressedByteOffset-S;l.skip(K),w-=K,S=g.compressedByteOffset,g.discardConsumedInput()}if(a.batchPointCount+=L,a.batchPointCount===o){let K=fo(i,a);K&&(yield K)}continue}if(E)throw new at(`LASLoader: truncated legacy LAZ chunk after ${p-g.remainingPointCount} of ${p} points with ${I} bytes available`);let q=await t.next();q.done?E=!0:l.write(q.value)}l.skip(g.compressedByteOffset-S),c.push(g.compressedByteOffset),f+=p}n.compressor!==1&&await bf(l,t,e,n,u,c,s);let h=fo(i,a);h&&(yield h)}function z1(r,t,e){return Math.min(r,Math.max(e,t+HI))}async function*t_(r,t,e,n){let{pending:s,laszip:i}=await H1(r,t,e);if(gf(e,i),!i.variableChunks&&e.pointsFormatId<=5){yield*e_(s,t,e,i,n);return}if(!i.variableChunks&&e.pointsFormatId>=6&&e.pointsFormatId<=10){yield*r_(s,t,e,i,n);return}for await(let o of JI(s,t,e,i,n))yield Oc(o.arrayBuffer,o.header,n)}async function*e_(r,t,e,n,s){let i={...e,totalToRead:e.pointsCount},o=xf(ha(s),e,s),a=Af(s),c=[],l=new Hs;l.write(r),await ho(l,t,e.pointsOffset+(n.compressor===1?0:Yt),"LASLoader: incomplete compressed LAZ point data"),l.skip(e.pointsOffset);let u=n.compressor===1?0:vf(l.getDataView(Yt)),f=0;for(;f<e.pointsCount;){let p=n.compressor===1?e.pointsCount:Math.min(n.chunkSize,e.pointsCount-f),y=ci(e,n,p),g=Wr(new Uint8Array(0),y),w=0,S=0,E=!1;for(;g.remainingPointCount>0;){let I=l.getAvailableByteLength(),b=z1(I,w,g.requiredInputByteLength-S);if(b>w){let K=l.checkpoint();l.skip(w);let ft=b-w;Vm(l,ft,a),g.feed(l.readBytes(ft)),l.restore(K),w=b}o.target.pointOffset=o.batchPointCount;let C=o.batchCapacity-o.batchPointCount,L=g.decodeAvailableIntoPointData(o.target,C,E);if(L>0){if(n.compressor===1){let K=g.compressedByteOffset-S;l.skip(K),w-=K,S=g.compressedByteOffset,g.discardConsumedInput()}if(zm(o,o.batchPointCount,L),o.batchPointCount+=L,o.batchPointCount===o.batchCapacity){let K=mf(i,o,s);K&&(yield K)}continue}if(E)throw new at(`LASLoader: truncated legacy LAZ chunk after ${p-g.remainingPointCount} of ${p} points with ${I} bytes available`);let q=await t.next();q.done?E=!0:l.write(q.value)}l.skip(g.compressedByteOffset-S),c.push(g.compressedByteOffset),f+=p}n.compressor!==1&&await bf(l,t,e,n,u,c,s);let h=mf(i,o,s);h&&(yield h)}async function*r_(r,t,e,n,s){let i={...e,totalToRead:e.pointsCount},o=xf(ha(s),e,s),a=0,c=[],l=new Hs;l.write(r),await ho(l,t,e.pointsOffset+Yt,"LASLoader: incomplete compressed LAZ point data"),l.skip(e.pointsOffset);let u=vf(l.getDataView(Yt));for(;a<e.pointsCount;){let h=Math.min(n.chunkSize,e.pointsCount-a),p=ci(e,n,h),y=yield*n_(l,t,p,i,o,s,!!(s.las?.recoverMissingChunkTable&&u===e.pointsOffset));c.push(y),a+=h}await bf(l,t,e,n,u,c,s);let f=mf(i,o,s);f&&(yield f)}async function*n_(r,t,e,n,s,i,o){let a=qu(e);await ho(r,t,a,"LASLoader: incomplete layered LAZ chunk header");let c=r.readBytes(a);o&&km(c,e);let l=Wu(c,e),u=qp(e);u.feed(c);let f=a;for(;f<l;){if(yield*F1(u,n,s,i),r.getAvailableByteLength()===0){let p=await t.next();if(p.done)throw new at("LASLoader: incomplete layered LAZ chunk payload");r.write(p.value)}let h=Math.min(r.getAvailableByteLength(),l-f);u.feed(r.readBytes(h)),f+=h}if(u.close(),yield*F1(u,n,s,i),u.remainingPointCount!==0)throw new at(`LASLoader: layered LAZ chunk produced ${e.pointCount-u.remainingPointCount} of ${e.pointCount} points`);return l}function*F1(r,t,e,n){for(;r.remainingPointCount>0;){let s=e.batchCapacity-e.batchPointCount;e.target.pointOffset=e.batchPointCount;let i=r.readPointDataBatch(e.target,s);if(!i)return;if(zm(e,e.batchPointCount,i),e.batchPointCount+=i,e.batchPointCount===e.batchCapacity){let o=mf(t,e,n);o&&(yield o)}}}function*s_(r,t,e,n,s={}){let i=n||Rm(new Uint8Array(r),t);if(gf(t,i),t.pointsFormatId<=5||i.variableChunks){yield*V1(new Uint8Array(r),t,i,{...s,core:{...s.core,batchSize:e}});return}let o={...t,totalToRead:t.pointsCount},a=wf(e,t.pointsStructSize),c=new Uint8Array(r),l=Pm(c,t,i,s),u=t.pointsOffset+(i.compressor===1?0:Yt);for(let h of l){let p=ci(t,i,h.pointCount),y=c.subarray(u,u+h.byteLength);for(let g of Gm(y,p,o,a))yield g;u+=h.byteLength}let f=fo(o,a);f&&(yield f)}function*V1(r,t,e,n={}){let s=ha(n),i={...t,metadata:j1(r,t),totalToRead:t.pointsCount},o=wf(s,t.pointsStructSize,Af(n)),a=Pm(r,t,e,n),c=t.pointsOffset+(e.compressor===1?0:Yt);for(let u of a){let f=r.subarray(c,c+u.byteLength);if(f.byteLength<u.byteLength)throw new at("LASLoader: truncated legacy LAZ chunk");let h=ci(t,e,u.pointCount);if(e.compressor===1)yield*Gm(f,h,i,o);else{let p=$u(f,h);M_(p.byteLength,o.stats),yield*D_(p,i,o)}c+=u.byteLength}let l=fo(i,o);l&&(yield l)}function i_(r,t,e){let n=t.pointsCount,s=new Uint8Array(n*t.pointsStructSize),i=0;for(let o of s_(r,t,E1,e)){let a=new Uint8Array(o.arrayBuffer);s.set(a,i),i+=a.byteLength}return s}function G1(r){let t=new DataView(r);if(r.byteLength<227||t.getUint32(0,!0)!==O1)throw new Error("LASLoader: invalid LAS header");let e=t.getUint8(24),n=t.getUint8(25);if(e!==1||n>5)throw new Error(`LASLoader: unsupported LAS version ${e}.${n}`);let s=t.getUint16(94,!0),i=t.getUint16(6,!0),o=t.getUint32(100,!0),a=t.getUint8(104),c=a&qI,l=!!(a&$I),u=t.getUint32(107,!0),h=(e>1||n>=4?ai(t,247):u)||u,p=t.getUint32(96,!0),y=t.getUint16(105,!0);if(n===5){if(s<393)throw new Error("LASLoader: LAS 1.5 header must be at least 393 bytes");if(c<6||c>10)throw new Error(`LASLoader: LAS 1.5 requires point data record formats 6-10; received ${c}`);if((i&16)===0)throw new Error("LASLoader: LAS 1.5 requires the WKT global encoding flag");if((i&65440)!==0)throw new Error("LASLoader: LAS 1.5 Global Encoding contains reserved bits");if((i&64)!==0&&(i&1)===0)throw new Error("LASLoader: LAS 1.5 Time Offset Flag requires GPS Time Type");let b=t.getFloat64(375,!0),C=t.getFloat64(383,!0);if(!Number.isFinite(b)||!Number.isFinite(C)||b!==0&&C!==0&&b<C)throw new Error("LASLoader: LAS 1.5 GPS time range is invalid")}let g=[t.getFloat64(131,!0),t.getFloat64(139,!0),t.getFloat64(147,!0)],w=[t.getFloat64(155,!0),t.getFloat64(163,!0),t.getFloat64(171,!0)],S=[t.getFloat64(179,!0),t.getFloat64(195,!0),t.getFloat64(211,!0)],E=[t.getFloat64(187,!0),t.getFloat64(203,!0),t.getFloat64(219,!0)],I={pointsOffset:p,pointsFormatId:c,pointsStructSize:y,pointsCount:h,scale:g,offset:w,maxs:S,mins:E,totalToRead:h,totalRead:0,hasColor:Z1(c),versionAsString:`${e}.${n}`,isCompressed:l,headerSize:s,vlrCount:o,userHeaderData:n===5&&s>393?new Uint8Array(r,393,s-393).slice():void 0};return o_(r,I)&&(I.metadata=j1(r,I)),I}function o_(r,t){let e=t.headerSize+t.vlrCount*54;return r.byteLength>=Math.max(e,t.pointsOffset)}function j1(r,t){let e=Y1(r),n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=(t.versionAsString||"1.0").split(".").map(Number),o=i[0]>1||i[0]===1&&i[1]>=4,a=a_(e,t),c=o?ai(e,235):0,l=o?e.getUint32(243,!0):0,u=$1(e,c,l),f={fileSourceId:e.getUint16(4,!0),globalEncoding:e.getUint16(6,!0),waveformDataOffset:i[0]>1||i[0]===1&&i[1]>=3?e.getBigUint64(227,!0):void 0,projectId:f_(n.subarray(8,24)),systemIdentifier:fa(n,26,32),generatingSoftware:fa(n,58,32),creationDayOfYear:e.getUint16(90,!0),creationYear:e.getUint16(92,!0),headerSize:t.headerSize,userHeaderData:t.userHeaderData,vlrCount:t.vlrCount,evlrOffset:c||void 0,evlrCount:l||void 0,maxGpsTime:i[1]===5?e.getFloat64(375,!0):void 0,minGpsTime:i[1]===5?e.getFloat64(383,!0):void 0,timeOffset:i[1]===5?e.getUint16(391,!0):void 0,pointsByReturn:u_(e,o),vlrs:a,evlrs:u,extraBytes:[],waveformPacketDescriptors:[]};for(let h of a.concat(u.map(p=>({...p,data:p.data||new Uint8Array}))))q1(h,f);return f.compatibility=B1(t,f),W1(f),f}function a_(r,t){let e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),n=[],s=t.headerSize;for(let i=0;i<t.vlrCount&&!(s+54>e.byteLength);i++){let o=r.getUint16(s+20,!0),a=s+54;if(a+o>e.byteLength)break;n.push({reserved:r.getUint16(s,!0),userId:fa(e,s+2,16),recordId:r.getUint16(s+18,!0),description:fa(e,s+22,32),offset:s,data:e.slice(a,a+o)}),s=a+o}return n}function $1(r,t,e){if(t<0||!e||t>=r.byteLength)return[];let n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),s=[],i=t;for(let o=0;o<e&&!(i+60>n.byteLength);o++){let a=ai(r,i+20),c=i+60;if(a>n.byteLength-c)break;s.push({reserved:r.getUint16(i,!0),userId:fa(n,i+2,16),recordId:r.getUint16(i+18,!0),description:fa(n,i+28,32),offset:i,data:n.slice(c,c+a),dataOffset:c,dataLength:a}),i=c+a}return s}function q1(r,t){let e=r.data;e&&(r.userId==="LASF_Spec"&&r.recordId===4?t.extraBytes.push(...L1(e)):r.userId==="LASF_Spec"&&r.recordId>=100&&r.recordId<=354?t.waveformPacketDescriptors.push(l_(r.recordId,e)):r.userId==="LASF_Projection"&&r.recordId===2111?t.wktMathTransform=pf(e):r.userId==="LASF_Projection"&&r.recordId===2112?t.wkt=pf(e):r.userId==="LASF_Projection"&&r.recordId===34735?t.geotiff={...t.geotiff,keys:h_(e)}:r.userId==="LASF_Projection"&&r.recordId===34736?t.geotiff={...t.geotiff,doubles:d_(e)}:r.userId==="LASF_Projection"&&r.recordId===34737&&(t.geotiff={...t.geotiff,ascii:pf(e)}))}function W1(r){let t=r.geotiff,e=t?.keys;if(!t||!e||e.length<4)return;let n=e[3];if(e.length<4+n*4)return;let s=[];for(let i=0;i<n;i++){let o=4+i*4,a={keyId:e[o],tiffTagLocation:e[o+1],count:e[o+2],valueOffset:e[o+3]};a.value=c_(a,t),a.value===void 0&&delete a.value,s.push(a)}t.keyDirectory={version:e[0],keyRevision:e[1],minorRevision:e[2],entries:s}}function c_(r,t){if(r.tiffTagLocation===0)return r.valueOffset;if(r.tiffTagLocation===34735&&t.keys){let e=t.keys.slice(r.valueOffset,r.valueOffset+r.count);return e.length===r.count?Array.from(e):void 0}if(r.tiffTagLocation===34736&&t.doubles){let e=t.doubles.slice(r.valueOffset,r.valueOffset+r.count);return e.length!==r.count?void 0:r.count===1?e[0]:Array.from(e)}if(r.tiffTagLocation===34737&&t.ascii!==void 0){let e=r.valueOffset+r.count;return e>t.ascii.length?void 0:t.ascii.slice(r.valueOffset,e).replace(/\|$/,"")}}function l_(r,t){if(t.byteLength<28)throw new Error(`LASLoader: waveform descriptor VLR ${r} is truncated`);let e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{recordId:r,bitsPerSample:e.getUint8(2),compressionType:e.getUint8(3),numberOfSamples:e.getUint32(4,!0),temporalSampleSpacing:e.getUint32(8,!0),digitizerGain:e.getFloat64(12,!0),digitizerOffset:e.getFloat64(20,!0)}}function u_(r,t){let e=t?15:5,n=t?255:111,s=[];for(let i=0;i<e;i++)s.push(t?ai(r,n+i*8):r.getUint32(n+i*4,!0));return s}function fa(r,t,e){return pf(r.subarray(t,t+e))}function pf(r){let t=r.length;for(;t>0&&r[t-1]===0;)t--;return new TextDecoder().decode(r.subarray(0,t)).trim()}function f_(r){let t=(n,s)=>Array.from(r.subarray(n,n+s),i=>i.toString(16).padStart(2,"0")).reverse().join(""),e=(n,s)=>Array.from(r.subarray(n,n+s),i=>i.toString(16).padStart(2,"0")).join("");return`${t(0,4)}-${t(4,2)}-${t(6,2)}-${e(8,2)}${e(10,6)}`}function h_(r){let t=new DataView(r.buffer,r.byteOffset,r.byteLength),e=new Uint16Array(Math.floor(r.byteLength/2));for(let n=0;n<e.length;n++)e[n]=t.getUint16(n*2,!0);return e}function d_(r){let t=new DataView(r.buffer,r.byteOffset,r.byteLength),e=new Float64Array(Math.floor(r.byteLength/8));for(let n=0;n<e.length;n++)e[n]=t.getFloat64(n*8,!0);return e}function Oc(r,t,e={}){let n=t.pointsCount,s=e.las?.fp64?Float64Array:Float32Array,i=new s(n*3),o=Q1(e),a=t.hasColor&&o.color?new Uint8Array(n*4):null,c=o.intensity?new Uint16Array(n):null,l=o.classification?new Uint8Array(n):null,u=o.synthetic?new Uint8Array(n):null,f=o.keyPoint?new Uint8Array(n):null,h=o.withheld?new Uint8Array(n):null,p=o.overlap?new Uint8Array(n):null,y=o.gpsTime&&Nm(t.pointsFormatId)>=0?new Float64Array(n):null,g=o.nir&&(Um(t.pointsFormatId)>=0||e.las?.compatibilityMode!=="raw"&&t.metadata?.compatibility?.nirByteOffset!==void 0)?new Uint16Array(n):null,w=o.scanAngle?new Int16Array(n):null,S=o.userData?new Uint8Array(n):null,E=o.pointSourceId?new Uint16Array(n):null,I=o.returnNumber?new Uint8Array(n):null,b=o.numberOfReturns?new Uint8Array(n):null,C=o.scannerChannel?new Uint8Array(n):null,L=o.scanDirectionFlag?new Uint8Array(n):null,q=o.edgeOfFlightLine?new Uint8Array(n):null,K=o.waveform&&Om(t.pointsFormatId)>=0?new Uint8Array(n*29):null,ft=Math.max(0,t.pointsStructSize-Gn(t.pointsFormatId)),dt=o.extraBytes&&e.las?.extraBytes!=="typed"&&ft?new Uint8Array(n*ft):null,Bt=o.extraBytes&&e.las?.extraBytes==="typed"?K1(n,t):null;return p_(Y1(r),t,e,{positions:i,colors:a,intensities:c,classifications:l,syntheticFlags:u,keyPointFlags:f,withheldFlags:h,overlapFlags:p,gpsTimes:y,nir:g,scanAngles:w,userData:S,pointSourceIds:E,returnNumbers:I,numberOfReturns:b,scannerChannels:C,scanDirectionFlags:L,edgeOfFlightLines:q,waveforms:K,extraBytes:dt,typedExtraBytes:Bt,pointOffset:0,sourcePointIndex:0,pointCount:n}),Fm(t,i,a,c,l,u,f,h,p,y,g,w,S,E,I,b,C,L,q,K,dt,Bt)}function Fm(r,t,e,n,s,i,o,a,c,l,u,f,h,p,y,g,w,S,E,I,b,C){let L={POSITION:{value:t,size:3}};if(n&&(L.intensity={value:n,size:1}),s&&(L.classification={value:s,size:1}),i&&(L.synthetic={value:i,size:1}),o&&(L.keyPoint={value:o,size:1}),a&&(L.withheld={value:a,size:1}),c&&(L.overlap={value:c,size:1}),e&&(L.COLOR_0={value:e,size:e instanceof Uint16Array?3:4}),l&&(L.GPS_TIME={value:l,size:1}),u&&(L.NIR={value:u,size:1}),f&&(L.scanAngle={value:f,size:1}),h&&(L.userData={value:h,size:1}),p&&(L.pointSourceId={value:p,size:1}),y&&(L.returnNumber={value:y,size:1}),g&&(L.numberOfReturns={value:g,size:1}),w&&(L.scannerChannel={value:w,size:1}),S&&(L.scanDirectionFlag={value:S,size:1}),E&&(L.edgeOfFlightLine={value:E,size:1}),I&&(L.WAVEFORM={value:I,size:29}),b&&(L.EXTRA_BYTES={value:b,size:b.length/Math.max(r.pointsCount,1)}),C)for(let ft of C)L[ft.name]={value:ft.value,size:ft.size};let q={};for(let[ft,dt]of Object.entries(L))!(dt.value instanceof BigInt64Array)&&!(dt.value instanceof BigUint64Array)&&(q[ft]={...dt,value:dt.value});let K=S1(r,q);return{...of(L,{schema:K,topology:"point-list",mode:0,boundingBox:E_(r)}),loader:"las",loaderData:r,progress:r.totalRead/r.totalToRead}}function Y1(r){return ArrayBuffer.isView(r)?new DataView(r.buffer,r.byteOffset,r.byteLength):new DataView(r)}function p_(r,t,e,n){let{scale:[s,i,o],offset:[a,c,l]}=t,u=t.pointsFormatId,f=t.pointsStructSize,h=n.colors?Em(u):-1,p=h>=0?y_(r,t,n.sourcePointIndex,n.pointCount,e.las?.colorDepth):!1,y=n.intensities,g=n.classifications,w=n.syntheticFlags,S=n.keyPointFlags,E=n.withheldFlags,I=n.overlapFlags,b=n.gpsTimes,C=n.nir,L=n.scanAngles,q=n.userData,K=n.pointSourceIds,ft=n.returnNumbers,dt=n.numberOfReturns,Bt=n.scannerChannels,ie=n.scanDirectionFlags,st=n.edgeOfFlightLines,rt=n.waveforms,Xe=n.extraBytes,ke=n.typedExtraBytes,Ke=b?Nm(u):-1,xt=C?Um(u):-1;for(let Wn=0;Wn<n.pointCount;Wn++){let ui=n.sourcePointIndex+Wn,wt=t.pointsOffset+ui*f,pt=n.pointOffset+Wn;n.positions[pt*3]=r.getInt32(wt,!0)*s+a,n.positions[pt*3+1]=r.getInt32(wt+4,!0)*i+c,n.positions[pt*3+2]=r.getInt32(wt+8,!0)*o+l,y&&(y[pt]=r.getUint16(wt+12,!0)),g&&(g[pt]=m_(r,wt,u)),b&&Ke>=0&&(b[pt]=r.getFloat64(wt+Ke,!0)),C&&xt>=0&&(C[pt]=r.getUint16(wt+xt,!0)),L&&(L[pt]=u<=5?r.getInt8(wt+16):r.getInt16(wt+18,!0)),q&&(q[pt]=r.getUint8(wt+17)),K&&(K[pt]=r.getUint16(wt+(u<=5?18:20),!0));let dn=r.getUint8(wt+14),Xr=r.getUint8(wt+15),pn=u<=5?Xr>>5:Xr;if(w&&(w[pt]=pn&1),S&&(S[pt]=pn>>1&1),E&&(E[pt]=pn>>2&1),I&&(I[pt]=u<=5?0:pn>>3&1),ft&&(ft[pt]=u<=5?dn&7:dn&15),dt&&(dt[pt]=u<=5?dn>>3&7:dn>>4),Bt&&(Bt[pt]=u<=5?0:Xr>>4&3),ie&&(ie[pt]=u<=5?dn>>6&1:Xr>>6&1),st&&(st[pt]=u<=5?dn>>7&1:Xr>>7&1),rt){let _r=Om(u);if(_r>=0){let Lr=new Uint8Array(r.buffer,r.byteOffset+wt+_r,29);rt.set(Lr,pt*29)}}if(Xe){let _r=Gn(u),Lr=t.pointsStructSize-_r;Lr>0&&Xe.set(new Uint8Array(r.buffer,r.byteOffset+wt+_r,Lr),pt*Lr)}if(ke&&L_(r,wt,u,pt,ke),e.las?.compatibilityMode!=="raw"&&t.metadata?.compatibility&&Tm(r,wt+Gn(u),pt,t.metadata.compatibility,n),h>=0&&n.colors){let _r=r.getUint16(wt+h,!0),Lr=r.getUint16(wt+h+2,!0),yo=r.getUint16(wt+h+4,!0);n.colors[pt*4]=p?_r/256:_r,n.colors[pt*4+1]=p?Lr/256:Lr,n.colors[pt*4+2]=p?yo/256:yo,n.colors[pt*4+3]=255}}}function m_(r,t,e){return e<=5?r.getUint8(t+15)&31:r.getUint8(t+16)}function Z1(r){return Em(r)>=0}function Em(r){switch(r){case 2:return 20;case 3:return 28;case 5:return 28;case 7:case 8:case 10:return 30;default:return-1}}function Om(r){switch(r){case 4:return 28;case 5:return 34;case 9:return 30;case 10:return 38;default:return-1}}function Nm(r){return r===1||r===3||r===4||r===5?20:r>=6&&r<=10?22:-1}function Um(r){return r===8||r===10?36:-1}function y_(r,t,e,n,s){if(s===8)return!1;if(s===16)return!0;if(s!=="auto")return!1;let i=Em(t.pointsFormatId);if(i<0)return!1;for(let o=0;o<n;o++){let a=t.pointsOffset+(e+o)*t.pointsStructSize;if(r.getUint16(a+i,!0)>255||r.getUint16(a+i+2,!0)>255||r.getUint16(a+i+4,!0)>255)return!0}return!1}function ha(r){let t=r.core?.batchSize;return typeof t=="number"?t:E1}function Rm(r,t){let e=new DataView(r.buffer,r.byteOffset,r.byteLength),n=t.headerSize||N1,s=t.vlrCount||0;for(let i=0;i<s;i++){if(n+54>r.byteLength)throw new at("LASLoader: incomplete VLR header");let o=F_(r,n+2,16),a=e.getUint16(n+18,!0),c=e.getUint16(n+20,!0),l=n+54;if(l+c>r.byteLength)throw new at("LASLoader: incomplete VLR data");if(o===WI&&a===YI){if(c<34)throw new Error("LASLoader: malformed LASzip VLR");let u=e.getUint32(l+12,!0),f=e.getUint16(l+32,!0);if(34+f*6>c)throw new Error("LASLoader: malformed LASzip VLR item table");let p=null,y=null,g=null,w=null,S=null,E=[];for(let I=0;I<f;I++){let b=l+34+I*6,C=e.getUint16(b,!0),L=e.getUint16(b+2,!0),q=e.getUint16(b+4,!0);if(E.push({type:C,size:L,version:q}),[0,6,7,8].includes(C)){if(q!==1&&q!==2)throw new Error(`LASLoader: unsupported legacy LASzip item type ${C} version ${q}`)}else if(C===9){if(q!==1)throw new Error(`LASLoader: unsupported WavePacket13 item version ${q}`);g=q}else if([10,11,12,14].includes(C)){if(q!==2&&q!==3&&q!==4)throw new Error(`LASLoader: unsupported LAS 1.4 item type ${C} version ${q}`);C===10?p=q:C===11||C===12?y=q:S=q}else if(C===13){if(q!==3&&q!==4)throw new Error(`LASLoader: unsupported WavePacket14 item version ${q}`);w=q}}return{compressor:e.getUint16(l,!0),coder:e.getUint16(l+2,!0),chunkSize:u,variableChunks:e.getUint16(l,!0)!==1&&(u===0||u===ZI),items:E,point14ItemVersion:p,rgb14ItemVersion:y,wavePacket13ItemVersion:g,wavePacketItemVersion:w,byte14ItemVersion:S}}n=l+c}throw new Error("LASLoader: compressed LAZ file does not contain a LASzip VLR")}function gf(r,t){if(![0,1,2,3,4,5,6,7,8,9,10].includes(r.pointsFormatId))throw new Error(`LASLoader: TypeScript LAZ streaming only supports point formats 0-10; received ${r.pointsFormatId}`);if(r.pointsFormatId<=5&&t.compressor!==1&&t.compressor!==2)throw new Error(`LASLoader: legacy TypeScript LAZ decoding requires LASzip compressor 1 or 2; received ${t.compressor}`);if(r.pointsFormatId>=6&&t.compressor!==3)throw new Error(`LASLoader: LAS 1.4 TypeScript LAZ decoding requires LASzip compressor 3; received ${t.compressor}`);if(t.coder!==0)throw new Error(`LASLoader: TypeScript LAZ decoding requires LASzip arithmetic coder 0; received ${t.coder}`);if(g_(r,t.items),r.pointsFormatId>=6&&!t.point14ItemVersion)throw new Error(`LASLoader: point format ${r.pointsFormatId} requires a Point14 LASzip item`);if((r.pointsFormatId===4||r.pointsFormatId===5)&&!t.wavePacket13ItemVersion)throw new Error(`LASLoader: point format ${r.pointsFormatId} requires a WavePacket13 LASzip item`);if((r.pointsFormatId===7||r.pointsFormatId===8||r.pointsFormatId===10)&&!t.rgb14ItemVersion)throw new Error(`LASLoader: point format ${r.pointsFormatId} requires an RGB14 or RGBNIR14 LASzip item`);if(r.pointsFormatId>=6&&r.pointsStructSize>Gn(r.pointsFormatId)&&!t.byte14ItemVersion)throw new Error(`LASLoader: point format ${r.pointsFormatId} with Extra Bytes requires a Byte14 LASzip item`);if((r.pointsFormatId===9||r.pointsFormatId===10)&&!t.wavePacketItemVersion)throw new Error(`LASLoader: point format ${r.pointsFormatId} requires a WavePacket14 LASzip item`)}function g_(r,t){let e=r.pointsFormatId,n=Gn(e),s=r.pointsStructSize-n;if(s<0)throw new Error(`LASLoader: point format ${e} record length ${r.pointsStructSize} is smaller than ${n}`);let i=[];switch(e){case 0:i.push({type:6,size:20});break;case 1:i.push({type:6,size:20},{type:7,size:8});break;case 2:i.push({type:6,size:20},{type:8,size:6});break;case 3:i.push({type:6,size:20},{type:7,size:8},{type:8,size:6});break;case 4:i.push({type:6,size:20},{type:7,size:8},{type:9,size:29});break;case 5:i.push({type:6,size:20},{type:7,size:8},{type:8,size:6},{type:9,size:29});break;case 6:i.push({type:10,size:30});break;case 7:i.push({type:10,size:30},{type:11,size:6});break;case 8:i.push({type:10,size:30},{type:12,size:8});break;case 9:i.push({type:10,size:30},{type:13,size:29});break;case 10:i.push({type:10,size:30},{type:12,size:8},{type:13,size:29});break;default:return}if(s>0&&i.push({type:e<=5?0:14,size:s}),t.length!==i.length)throw new Error(`LASLoader: point format ${e} has ${t.length} LASzip items; expected ${i.length}`);for(let o=0;o<i.length;o++){let a=t[o],c=i[o];if(a.type!==c.type)throw new Error(`LASLoader: LASzip item ${o} has type ${a.type}; expected ${c.type} for point format ${e}`);if(a.size!==c.size)throw new Error(`LASLoader: LASzip item ${o} has size ${a.size}; expected ${c.size} for point format ${e}`)}}async function H1(r,t,e){let n=r;for(;;){try{return{pending:n,laszip:Rm(n,e)}}catch(i){if(!(i instanceof at))throw i}let s=await t.next();if(s.done)throw new at("LASLoader: incomplete LASzip VLR");n=Cm(n,yf(s.value))}}async function b_(r,t){let e=[r],n=r.byteLength;for(;;){let o=await t.next();if(o.done)break;let a=yf(o.value);e.push(a),n+=a.byteLength}if(e.length===1)return r;let s=new Uint8Array(n),i=0;for(let o of e)s.set(o,i),i+=o.byteLength;return s}async function bf(r,t,e,n,s,i,o){if(o.las?.recoverMissingChunkTable&&s===e.pointsOffset){if(n.variableChunks)throw new Error("LASLoader: cannot recover a missing variable-size LAZ chunk table");for(;;){if(r.getAvailableByteLength())throw new Error("LASLoader: unexpected bytes after recovered LAZ chunks");let h=await t.next();if(h.done)return;r.write(h.value)}}let a=i.reduce((h,p)=>h+p,0),c=e.pointsOffset+Yt+a,l=s===-1?c:s;if(!Number.isSafeInteger(l)||l<c)throw new Error("LASLoader: LAZ chunk table byte lengths overlap the chunk table");let u=l-c;await ho(r,t,u,"LASLoader: incomplete LAZ chunk table"),r.skip(u);let f=await A_(r,t,e,n);if(f.length!==i.length)throw new Error(`LASLoader: LAZ chunk table contains ${f.length} chunks; decoded ${i.length}`);for(let h=0;h<f.length;h++)if(f[h].byteLength!==i[h])throw new Error(`LASLoader: LAZ chunk ${h} has ${f[h].byteLength} table bytes; decoded ${i[h]}`);s===-1&&await w_(r,t,l)}async function w_(r,t,e){let n=new Uint8Array(Yt),s=0;for(;;){let o=r.getAvailableByteLength();if(o>0){let c=r.readBytes(Math.min(o,65536));x_(n,c),s+=c.byteLength;continue}let a=await t.next();if(a.done)break;r.write(a.value)}if(s<Yt)throw new at("LASLoader: incomplete non-seekable LAZ chunk-table footer");let i=ai(new DataView(n.buffer),0);if(!Number.isSafeInteger(i)||i!==e)throw new Error(`LASLoader: non-seekable LAZ footer points to ${i}; expected ${e}`)}function x_(r,t){if(t.byteLength>=r.byteLength){r.set(t.subarray(t.byteLength-r.byteLength));return}r.copyWithin(0,t.byteLength),r.set(t,r.byteLength-t.byteLength)}async function A_(r,t,e,n){let s=64;for(;;){let i=r.getAvailableByteLength();if(i>=8){let a=r.checkpoint();try{let c=r.readBytes(Math.min(i,s)),l=X1(c,e,n);return r.restore(a),l}catch(c){if(r.restore(a),!(c instanceof at))throw c;if(s*=2,s<=i)continue}}let o=await t.next();if(o.done)throw new at("LASLoader: incomplete LAZ chunk table");r.write(o.value)}}async function ho(r,t,e,n){for(;!r.hasAvailableBytes(e);){let s=await t.next();if(s.done)throw new at(n);r.write(s.value)}}async function v_(r,t,e){for(;;){let n=r.checkpoint(),s;try{s=S_(r,e)}finally{r.restore(n)}if(s!==null)return await ho(r,t,s,"LASLoader: truncated LAZ chunk"),s;let i=await t.next();if(i.done)throw new at("LASLoader: truncated LAZ chunk");r.write(i.value)}}function S_(r,t){if(t.pointDataRecordFormat<6||t.pointDataRecordFormat>10)return null;let e=t.pointDataRecordLength-Gn(t.pointDataRecordFormat);if(e<0)throw new Error(`Invalid point record length ${t.pointDataRecordLength}`);let n=B_(t.pointDataRecordFormat)+e,s=t.pointDataRecordLength+4,i=n*4,o=s+i;if(!r.hasAvailableBytes(o))return null;r.skip(s);let a=o;for(let c=0;c<n;c++)a+=r.readUint32LE();return a}function Gn(r){switch(r){case 0:return 20;case 1:return 28;case 2:return 26;case 3:return 34;case 4:return 57;case 5:return 63;case 6:return 30;case 7:return 36;case 8:return 38;case 9:return 59;case 10:return 67;default:throw new Error(`Unsupported LAS point format ${r}`)}}function B_(r){switch(r){case 6:return 9;case 7:return 10;case 8:return 11;case 9:return 10;case 10:return 12;default:throw new Error(`Unsupported LAS 1.4 point format ${r}`)}}function Pm(r,t,e,n){if(e.compressor===1)return[{pointCount:t.pointsCount,byteLength:r.byteLength-t.pointsOffset}];let s=P_(new DataView(r.buffer,r.byteOffset,r.byteLength),t.pointsOffset);return I_(r,t,e,s,n)}function I_(r,t,e,n,s){if(s.las?.recoverMissingChunkTable&&n===t.pointsOffset)return __(r,t,e);if(!Number.isSafeInteger(n)||n<0||n+8>r.byteLength)throw new at("LASLoader: incomplete LAZ chunk table");let i=X1(r.subarray(n),t,e),o=i.reduce((a,c)=>a+c.byteLength,0);if(t.pointsOffset+Yt+o>n)throw new Error("LASLoader: LAZ chunk table byte lengths overlap the chunk table");return i}function __(r,t,e){if(e.variableChunks||!e.chunkSize)throw new Error("LASLoader: cannot recover a missing variable-size LAZ chunk table");let n=[],s=t.pointsOffset+Yt,i=0;for(;i<t.pointsCount;){let o=Math.min(e.chunkSize,t.pointsCount-i),a=ci(t,e,o),c=r.subarray(s),l;if(t.pointsFormatId<=5){let u=Wr(c,a),f=new Uint8Array(Math.min(o,256)*t.pointsStructSize);for(;u.remainingPointCount;)u.decodeInto(f,0,Math.min(u.remainingPointCount,256));l=u.compressedByteOffset}else km(c,a),l=Wu(c,a);if(!l||s+l>r.byteLength)throw new at("LASLoader: truncated LAZ chunk during table recovery");n.push({pointCount:o,byteLength:l}),s+=l,i+=o}if(s!==r.byteLength)throw new Error("LASLoader: unexpected bytes after recovered LAZ chunks");return n}function km(r,t){if(r.byteLength<t.pointDataRecordLength+4)throw new at("LASLoader: truncated recovered layered LAZ chunk header");let n=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(t.pointDataRecordLength,!0);if(n!==t.pointCount)throw new Error(`LASLoader: recovered layered LAZ chunk contains ${n} points; expected ${t.pointCount}`)}function X1(r,t,e){if(r.byteLength<8)throw new at("LASLoader: incomplete LAZ chunk table");let n=new DataView(r.buffer,r.byteOffset,r.byteLength),s=n.getUint32(0,!0),i=n.getUint32(4,!0);if(s!==0)throw new Error(`LASLoader: unsupported LAZ chunk table version ${s}`);if(i===0){if(t.pointsCount!==0)throw new Error("LASLoader: missing LAZ chunk table");return[]}let o=Wp(r.subarray(8),{chunkCount:i,pointCount:t.pointsCount,chunkSize:e.chunkSize,variable:e.variableChunks}),a=0;for(let c of o){if(c.pointCount===0||c.byteLength===0)throw new Error("LASLoader: invalid empty LAZ chunk-table entry");a+=c.pointCount}if(a!==t.pointsCount)throw new Error(`LASLoader: LAZ chunk table contains ${a} points; expected ${t.pointsCount}`);return o}function wf(r,t,e){return e&&e.rawBatchAllocations++,{rawBatch:new Uint8Array(r*t),batchPointCount:0,totalRead:0,rawBatchAllocations:1,stats:e}}function xf(r,t,e){let n=e.las?.fp64?Float64Array:Float32Array,s=new n(r*3),i=Q1(e),o=t.hasColor&&i.color&&(e.las?.colorDepth===16||e.las?.colorDepth==="auto"),a=t.hasColor&&i.color&&!o?new Uint8Array(r*4):null,c=o?new Uint16Array(r*3):null,l=i.intensity?new Uint16Array(r):null,u=i.classification?new Uint8Array(r):null,f=i.synthetic?new Uint8Array(r):null,h=i.keyPoint?new Uint8Array(r):null,p=i.withheld?new Uint8Array(r):null,y=i.overlap?new Uint8Array(r):null,g=i.gpsTime&&Nm(t.pointsFormatId)>=0?new Float64Array(r):null,w=i.nir&&(Um(t.pointsFormatId)>=0||e.las?.compatibilityMode!=="raw"&&t.metadata?.compatibility?.nirByteOffset!==void 0)?new Uint16Array(r):null,S=i.scanAngle?new Int16Array(r):null,E=i.userData?new Uint8Array(r):null,I=i.pointSourceId?new Uint16Array(r):null,b=i.returnNumber?new Uint8Array(r):null,C=i.numberOfReturns?new Uint8Array(r):null,L=i.scannerChannel?new Uint8Array(r):null,q=i.scanDirectionFlag?new Uint8Array(r):null,K=i.edgeOfFlightLine?new Uint8Array(r):null,ft=i.waveform&&Om(t.pointsFormatId)>=0?new Uint8Array(r*29):null,dt=Math.max(0,t.pointsStructSize-Gn(t.pointsFormatId)),Bt=i.extraBytes&&e.las?.extraBytes!=="typed"&&dt?new Uint8Array(r*dt):null,ie=i.extraBytes&&e.las?.extraBytes==="typed"?K1(r,t):null,st=ie?.length&&dt?new Uint8Array(r*dt):null,rt=i.classification||i.returnNumber||i.numberOfReturns||i.scanAngle||i.overlap||i.scannerChannel||i.nir,Xe=e.las?.compatibilityMode==="raw"||!rt?null:t.metadata?.compatibility||null,ke=Xe&&!Bt&&!st?new Uint8Array(r*dt):null;return{batchCapacity:r,positions:s,colors:a,rawColors:c,intensities:l,classifications:u,syntheticFlags:f,keyPointFlags:h,withheldFlags:p,overlapFlags:y,gpsTimes:g,nir:w,scanAngles:S,userData:E,pointSourceIds:I,returnNumbers:b,numberOfReturns:C,scannerChannels:L,scanDirectionFlags:q,edgeOfFlightLines:K,waveforms:ft,extraBytes:Bt,typedExtraBytes:ie,typedExtraBytesSource:st,compatibilityLayout:Xe,compatibilityExtraBytesSource:ke,target:{positions:s,intensities:l,classifications:u,syntheticFlags:f,keyPointFlags:h,withheldFlags:p,overlapFlags:y,gpsTimes:g,nir:w,scanAngles:S,userData:E,pointSourceIds:I,returnNumbers:b,numberOfReturns:C,scannerChannels:L,scanDirectionFlags:q,edgeOfFlightLines:K,waveforms:ft,extraBytes:Bt||st||ke,colors:a,rawColors:c,pointOffset:0,scale:t.scale,offset:t.offset},batchPointCount:0,totalRead:0}}function K1(r,t){let e=t.pointsStructSize-Gn(t.pointsFormatId);return T1(r,t.metadata?.extraBytes||[],e)}function J1(r){return r<=2?1:r<=4?2:r<=6||r===9?4:r===7||r===8||r===10?8:0}function L_(r,t,e,n,s){let i=t+Gn(e);for(let o of s){let a=n*o.size,c=i+o.byteOffset;for(let l=0;l<o.size;l++)Dm(r,c+l*J1(o.scalarDataType),o,a+l,l)}}function T_(r,t,e,n,s){let i=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let o=0;o<n;o++){let a=e+o,c=a*t;for(let l of s){let u=a*l.size,f=J1(l.scalarDataType);for(let h=0;h<l.size;h++)Dm(i,c+l.byteOffset+h*f,l,u+h,h)}}}function zm(r,t,e){let n=r.extraBytes||r.typedExtraBytesSource||r.compatibilityExtraBytesSource;if(r.compatibilityLayout&&n&&e){let s=new DataView(n.buffer,n.byteOffset,n.byteLength),i=n.length/r.batchCapacity;for(let o=t;o<t+e;o++)Tm(s,o*i,o,r.compatibilityLayout,r)}!r.typedExtraBytesSource||!r.typedExtraBytes?.length||e===0||T_(r.typedExtraBytesSource,r.typedExtraBytesSource.length/r.batchCapacity,t,e,r.typedExtraBytes)}function Af(r){return r.las?.lazStreamingStats}function Vm(r,t,e){if(!e)return;let n=r.findBufferOffsets(t);n&&n.length>1&&(e.copiedBytes+=t,e.chunkConcatenations++)}function M_(r,t){t&&(t.copiedBytes+=r,t.decodedChunkAllocations++)}function*Gm(r,t,e,n){let s=e.pointsStructSize,i=Wr(r,t);for(;i.remainingPointCount>0;){let o=n.rawBatch.byteLength/s,a=o-n.batchPointCount,c=i.decodeInto(n.rawBatch,n.batchPointCount*s,a);if(n.batchPointCount+=c,n.batchPointCount===o){let l=fo(e,n);l&&(yield l)}}}function*D_(r,t,e){let n=t.pointsStructSize,s=r.byteLength/n;for(let i=0;i<s;i++){let o=i*n,a=e.batchPointCount*n;if(e.rawBatch.set(r.subarray(o,o+n),a),e.batchPointCount++,e.batchPointCount===e.rawBatch.byteLength/n){let c=fo(t,e);c&&(yield c)}}}function fo(r,t){if(t.batchPointCount===0)return null;let e=t.batchPointCount*r.pointsStructSize,n=e===t.rawBatch.byteLength,s=n?t.rawBatch.buffer:t.rawBatch.buffer.slice(0,e);t.totalRead+=t.batchPointCount;let i={...r,pointsOffset:0,pointsCount:t.batchPointCount,totalRead:t.totalRead};return t.batchPointCount=0,n&&(t.rawBatch=new Uint8Array(t.rawBatch.byteLength),t.rawBatchAllocations++,t.stats&&t.stats.rawBatchAllocations++),{arrayBuffer:s,header:i}}function mf(r,t,e){if(t.batchPointCount===0)return null;t.totalRead+=t.batchPointCount;let n={...r,pointsOffset:0,pointsCount:t.batchPointCount,totalRead:t.totalRead},s=t.batchPointCount,i=s===t.batchCapacity,o=i?t.positions:t.positions.subarray(0,s*3),a=t.intensities?i?t.intensities:t.intensities.subarray(0,s):null,c=t.classifications?i?t.classifications:t.classifications.subarray(0,s):null,l=t.syntheticFlags?i?t.syntheticFlags:t.syntheticFlags.subarray(0,s):null,u=t.keyPointFlags?i?t.keyPointFlags:t.keyPointFlags.subarray(0,s):null,f=t.withheldFlags?i?t.withheldFlags:t.withheldFlags.subarray(0,s):null,h=t.overlapFlags?i?t.overlapFlags:t.overlapFlags.subarray(0,s):null,p=t.colors?i?t.colors:t.colors.subarray(0,s*4):t.rawColors?tx(t.rawColors,s,e):null,y=t.gpsTimes?i?t.gpsTimes:t.gpsTimes.subarray(0,s):null,g=t.nir?i?t.nir:t.nir.subarray(0,s):null,w=t.scanAngles?i?t.scanAngles:t.scanAngles.subarray(0,s):null,S=t.userData?i?t.userData:t.userData.subarray(0,s):null,E=t.pointSourceIds?i?t.pointSourceIds:t.pointSourceIds.subarray(0,s):null,I=t.returnNumbers?i?t.returnNumbers:t.returnNumbers.subarray(0,s):null,b=t.numberOfReturns?i?t.numberOfReturns:t.numberOfReturns.subarray(0,s):null,C=t.scannerChannels?i?t.scannerChannels:t.scannerChannels.subarray(0,s):null,L=t.scanDirectionFlags?i?t.scanDirectionFlags:t.scanDirectionFlags.subarray(0,s):null,q=t.edgeOfFlightLines?i?t.edgeOfFlightLines:t.edgeOfFlightLines.subarray(0,s):null,K=t.waveforms?i?t.waveforms:t.waveforms.subarray(0,s*29):null,ft=t.extraBytes?t.extraBytes.length/t.batchCapacity:0,dt=t.extraBytes?i?t.extraBytes:t.extraBytes.subarray(0,s*ft):null,Bt=t.typedExtraBytes?t.typedExtraBytes.map(st=>({...st,value:i?st.value:st.value.subarray(0,s*st.size)})):null,ie=Fm(n,o,p,a,c,l,u,f,h,y,g,w,S,E,I,b,C,L,q,K,dt,Bt);if(t.batchPointCount=0,i){let st=e.las?.fp64?Float64Array:Float32Array;t.positions=new st(t.positions.length),t.colors=t.colors?new Uint8Array(t.colors.length):null,t.rawColors=t.rawColors?new Uint16Array(t.rawColors.length):null,t.intensities=t.intensities?new Uint16Array(t.intensities.length):null,t.classifications=t.classifications?new Uint8Array(t.classifications.length):null,t.syntheticFlags=t.syntheticFlags?new Uint8Array(t.syntheticFlags.length):null,t.keyPointFlags=t.keyPointFlags?new Uint8Array(t.keyPointFlags.length):null,t.withheldFlags=t.withheldFlags?new Uint8Array(t.withheldFlags.length):null,t.overlapFlags=t.overlapFlags?new Uint8Array(t.overlapFlags.length):null,t.gpsTimes=t.gpsTimes?new Float64Array(t.gpsTimes.length):null,t.nir=t.nir?new Uint16Array(t.nir.length):null,t.scanAngles=t.scanAngles?new Int16Array(t.scanAngles.length):null,t.userData=t.userData?new Uint8Array(t.userData.length):null,t.pointSourceIds=t.pointSourceIds?new Uint16Array(t.pointSourceIds.length):null,t.returnNumbers=t.returnNumbers?new Uint8Array(t.returnNumbers.length):null,t.numberOfReturns=t.numberOfReturns?new Uint8Array(t.numberOfReturns.length):null,t.scannerChannels=t.scannerChannels?new Uint8Array(t.scannerChannels.length):null,t.scanDirectionFlags=t.scanDirectionFlags?new Uint8Array(t.scanDirectionFlags.length):null,t.edgeOfFlightLines=t.edgeOfFlightLines?new Uint8Array(t.edgeOfFlightLines.length):null,t.waveforms=t.waveforms?new Uint8Array(t.waveforms.length):null,t.extraBytes=t.extraBytes?new Uint8Array(t.extraBytes.length):null,t.typedExtraBytes=t.typedExtraBytes?t.typedExtraBytes.map(rt=>({...rt,value:Mm(rt.scalarDataType,rt.value.length,rt.outputFloat64)})):null,t.typedExtraBytesSource=t.typedExtraBytesSource?new Uint8Array(t.typedExtraBytesSource.length):null,t.target.positions=t.positions,t.target.colors=t.colors,t.target.rawColors=t.rawColors,t.target.intensities=t.intensities,t.target.classifications=t.classifications,t.target.syntheticFlags=t.syntheticFlags,t.target.keyPointFlags=t.keyPointFlags,t.target.withheldFlags=t.withheldFlags,t.target.overlapFlags=t.overlapFlags,t.target.gpsTimes=t.gpsTimes,t.target.nir=t.nir,t.target.scanAngles=t.scanAngles,t.target.userData=t.userData,t.target.pointSourceIds=t.pointSourceIds,t.target.returnNumbers=t.returnNumbers,t.target.numberOfReturns=t.numberOfReturns,t.target.scannerChannels=t.scannerChannels,t.target.scanDirectionFlags=t.scanDirectionFlags,t.target.edgeOfFlightLines=t.edgeOfFlightLines,t.target.waveforms=t.waveforms,t.compatibilityExtraBytesSource=t.compatibilityExtraBytesSource?new Uint8Array(t.compatibilityExtraBytesSource.length):null,t.target.extraBytes=t.extraBytes||t.typedExtraBytesSource||t.compatibilityExtraBytesSource}return ie}function Q1(r){let t=r.las?.columns;if(!t)return{intensity:!0,classification:!0,synthetic:!0,keyPoint:!0,withheld:!0,overlap:!0,color:!0,gpsTime:!0,nir:!0,scanAngle:!0,userData:!0,pointSourceId:!0,returnNumber:!0,numberOfReturns:!0,scannerChannel:!0,scanDirectionFlag:!0,edgeOfFlightLine:!0,waveform:!0,extraBytes:r.las?.extraBytes==="typed"};let e=!1,n=!1,s=!1,i=!1,o=!1,a=!1,c=!1,l=!1,u=!1,f=!1,h=!1,p=!1,y=!1,g=!1,w=!1,S=!1,E=!1,I=!1,b=!1;for(let C of t)switch(C){case"POSITION":break;case"intensity":e=!0;break;case"classification":n=!0;break;case"synthetic":s=!0;break;case"keyPoint":i=!0;break;case"withheld":o=!0;break;case"overlap":a=!0;break;case"COLOR_0":c=!0;break;case"GPS_TIME":l=!0;break;case"NIR":u=!0;break;case"scanAngle":f=!0;break;case"userData":h=!0;break;case"pointSourceId":p=!0;break;case"returnNumber":y=!0;break;case"numberOfReturns":g=!0;break;case"scannerChannel":w=!0;break;case"scanDirectionFlag":S=!0;break;case"edgeOfFlightLine":E=!0;break;case"WAVEFORM":I=!0;break;case"EXTRA_BYTES":b=!0;break;default:throw new Error(`LASLoader: unsupported column ${C}`)}return{intensity:e,classification:n,synthetic:s,keyPoint:i,withheld:o,overlap:a,color:c,gpsTime:l,nir:u,scanAngle:f,userData:h,pointSourceId:p,returnNumber:y,numberOfReturns:g,scannerChannel:w,scanDirectionFlag:S,edgeOfFlightLine:E,waveform:I,extraBytes:b}}function tx(r,t,e){let n=new Uint8Array(t*4),s=new Uint32Array(n.buffer);if(C_(r,t,e.las?.colorDepth))for(let o=0;o<t;o++){let a=o*3,c=r[a]>>8&255,l=r[a+1]>>8&255,u=r[a+2]>>8&255;s[o]=4278190080|u<<16|l<<8|c}else for(let o=0;o<t;o++){let a=o*3,c=r[a]&255,l=r[a+1]&255,u=r[a+2]&255;s[o]=4278190080|u<<16|l<<8|c}return n}function C_(r,t,e){if(e===8)return!1;if(e===16)return!0;if(e!=="auto")return!1;for(let n=0;n<t*3;n++)if(r[n]>255)return!0;return!1}function F_(r,t,e){let n=t,s=t+e;for(;n<s&&r[n]!==0;)n++;return String.fromCharCode(...r.subarray(t,n))}function E_(r){let t=r.mins||[0,0,0],e=r.maxs||[0,0,0];return[[t[0],t[1],t[2]],[e[0],e[1],e[2]]]}function*O_(r,t,e,n,s,i){for(;n<e.pointsCount&&s<e.totalToRead;){let o=N_(r,t,e,n,s,i);if(!o)return;r=o.pending,t=o.absoluteOffset,n=o.sourcePointIndex,s=o.totalRead,yield o}}function N_(r,t,e,n,s,i){let o=e.pointsStructSize,c=e.pointsOffset+n*o-t;if(c<0)throw new Error("LASLoader: invalid streaming point offset");if(c+o>r.byteLength)return null;let l=Math.floor((r.byteLength-c)/o),u=Math.min(i,l,e.pointsCount-n,e.totalToRead-s);if(u<=0)return null;n+=u,s+=u;let f={...e,pointsOffset:r.byteOffset+c,pointsCount:u,totalRead:s},h=e.pointsOffset+n*o,p=Math.max(0,Math.min(r.byteLength,h-t));return{arrayBuffer:r.buffer,header:f,pending:r.subarray(p),absoluteOffset:t+p,sourcePointIndex:n,totalRead:s}}function U_(r,t){if(t!==0||r.byteLength<227)return null;let e=new DataView(r.buffer,r.byteOffset,r.byteLength);if(e.getUint32(0,!0)!==O1)throw new Error("LASLoader: invalid LAS header");let n=e.getUint32(96,!0);return r.byteLength<Math.max(n,255)?null:G1(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength))}function Cm(r,t){if(r.byteLength===0)return t;let e=new Uint8Array(r.byteLength+t.byteLength);return e.set(r),e.set(t,r.byteLength),e}function yf(r){let t=ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r),e=new Uint8Array(t.byteLength);return e.set(t),e}function R_(r){if(Symbol.asyncIterator in r)return r[Symbol.asyncIterator]();let t=r[Symbol.iterator]();return{async next(){return t.next()}}}function P_(r,t){return ex(r,t)?r.byteLength<Yt?0:ai(r,r.byteLength-Yt):ai(r,t)}function vf(r){return ex(r,0)?-1:ai(r,0)}function ex(r,t){return r.byteLength>=t+8&&r.getUint32(t,!0)===4294967295&&r.getUint32(t+4,!0)===4294967295}function ai(r,t){if(r.byteLength<t+8)return 0;let e=r.getUint32(t,!0);return r.getUint32(t+4,!0)*2**32+e}var E1,O1,N1,$I,qI,WI,YI,ZI,Yt,HI,rx=d(()=>{"use strict";$t();Ue();Lm();$t();ni();Lm();I1();M1();E1=1e3*100,O1=1179861324,N1=375,$I=128,qI=63,WI="laszip encoded",YI=22204,ZI=4294967295,Yt=8,HI=64*1024});function nx(r,t){let e=t?.las?._chunk;return e?R1(r,e.metadata,t||{}):U1(r,t)}function Sf(r,t){let e=t?.las?.colorFormat===void 0||t.las.colorFormat==="uint8norm"?r:{...Pe(n1(ne(r),t.las.colorFormat)),loader:r.loader,loaderData:r.loaderData,progress:r.progress};return r1(t)==="arrow"?e:{...ne(e),loader:e.loader,loaderData:e.loaderData,progress:e.progress}}async function*k_(r,t){for await(let e of lm(r,{batchMaxRowsPerSecond:t?.core?.batchMaxRowsPerSecond,getRowCount:n=>n.data.numRows,signal:t?.signal}))yield Sf(e,t)}function Bf(r,t){return Sf(la(r),t)}function Uc(r){if(!("shape"in r))return r;let t=JSON.stringify(r.loaderData,(e,n)=>typeof n=="bigint"?n.toString():ArrayBuffer.isView(n)?Array.from(n):n);if(t){r.data.schema.metadata.set("loaders.gl.las.header",t);for(let e of r.data.batches)e.schema.metadata.set("loaders.gl.las.header",t)}return r.data}function jm(r){let t=Uc(r);return t.batches.length?t.batches:[Zr(t.schema)]}var Nc,z_,sx=d(()=>{"use strict";ni();$t();$t();s1();oi();rx();Nc={...af,dataType:null,batchType:null,worker:!0,workerInBatches:!0,serializeWorkerResult:se,serializeWorkerBatch:se,deserializeWorkerResult:Bf,deserializeWorkerBatch:Bf,parse:async(r,t)=>Sf(nx(r,t),t),parseSync:(r,t)=>Sf(nx(r,t),t),parseInBatches:async function*(r,t){yield*k_(k1(r,t),t)}};z_={...Nc,dataType:af.dataType,batchType:af.batchType,parse:async(r,t)=>Uc(await Nc.parse(r,t)),parseSync:(r,t)=>Uc(Nc.parseSync(r,t)),async*parseInBatches(r,t){for await(let e of Nc.parseInBatches(r,t))"shape"in e?yield*jm(e):yield e},deserializeWorkerResult:(r,t)=>Uc(Bf(r,t)),deserializeWorkerBatch(r,t){let e=Bf(r,t);return"shape"in e?jm(e)[0]:e}}});var ix={};ze(ix,{LASColumnLoader:()=>Nc,LASLoaderWithParser:()=>z_,getLASRecordBatches:()=>jm,toPublicLASResult:()=>Uc});var ox=d(()=>{"use strict";sx()});function bx(r,t){let e=r.length,n=new Uint8Array(t),s=0,i=0,o,a,c;do if(o=r[s++],o<32){if(o++,i+o>t)throw new Error("Output buffer is not large enough");if(s+o>e)throw new Error("Invalid compressed data");do n[i++]=r[s++];while(--o)}else{if(a=o>>5,c=i-((o&31)<<8)-1,s>=e)throw new Error("Invalid compressed data");if(a===7&&(a+=r[s++],s>=e))throw new Error("Invalid compressed data");if(c-=r[s++],i+a+2>t)throw new Error("Output buffer is not large enough");if(c<0)throw new Error("Invalid compressed data");if(c>=i)throw new Error("Invalid compressed data");do n[i++]=n[c++];while(--a+2)}while(s<e);return n}var wx=d(()=>{"use strict"});function xx(r,t,e="uint8norm"){let n=[];for(let s of Object.keys(r.offset))switch(s){case"x":n.push({name:"POSITION",type:{type:"fixed-size-list",listSize:3,children:[{name:"xyz",type:"float32"}]},metadata:{attribute:"POSITION"}});break;case"y":case"z":break;case"normal_x":n.push({name:"NORMAL",type:{type:"fixed-size-list",listSize:3,children:[{name:"xyz",type:"float32"}]},metadata:{attribute:"NORMAL"}});break;case"normal_y":case"normal_z":break;case"rgb":let i=e==="float16"?"float16":e==="float32"?"float32":"uint8";n.push({name:"COLOR_0",type:{type:"fixed-size-list",listSize:3,children:[{name:"rgb",type:i}]},metadata:{attribute:"COLOR",...e==="float16"?{componentType:"float16"}:{}}});break;default:}return{fields:n,metadata:t}}var Ax=d(()=>{"use strict"});function ya(r,t){let e=new TextDecoder().decode(r),n=Rc(e),s={};switch(n.data){case"ascii":s=M2(n,e);break;case"binary":s=D2(n,r);break;case"binary_compressed":s=C2(n,r);break;default:throw new Error(`PCD: ${n.data} files are not supported`)}s=T2(s,t?.pcd?.colorFormat);let i=L2(n,s),o=Object.fromEntries([["topology","point-list"],["mode","0"],["boundingBox",JSON.stringify(i.boundingBox)]]),a=xx(n,o,t?.pcd?.colorFormat);return{loader:"pcd",loaderData:n,header:i,schema:a,topology:"point-list",mode:0,attributes:s}}function L2(r,t){if(typeof r.width=="number"&&typeof r.height=="number"){let e=r.width*r.height,n=lr(t);if(!n)throw new Error("PCD point cloud is missing positions");return{vertexCount:e,boundingBox:n}}return{vertexCount:r.vertexCount,boundingBox:r.boundingBox}}function T2(r,t="uint8norm"){let e={POSITION:{value:new Float32Array(r.position),size:3}};return r.normal&&r.normal.length>0&&(e.NORMAL={value:new Float32Array(r.normal),size:3}),r.color&&r.color.length>0&&(e.COLOR_0=Xm(r.color,t)),r.intensity&&r.intensity.length>0&&(e.COLOR_0=Xm(r.color,t)),!e.COLOR_0&&r.label&&r.label.length>0&&(e.COLOR_0=Xm(r.label,t)),e}function Xm(r,t){return t==="float16"?{value:fi(r,255),size:3,componentType:"float16"}:t==="float32"?{value:Float32Array.from(r,e=>e/255),size:3}:{value:new Uint8Array(r),size:3}}function Rc(r){let t=r.search(/[\r\n]DATA\s(\S*)\s/i),e=/[\r\n]DATA\s(\S*)\s/i.exec(r.substr(t-1)),n={};if(n.data=e&&e[1],e!==null&&(n.headerLen=(e&&e[0].length)+t),n.str=r.substr(0,n.headerLen),n.str=n.str.replace(/\#.*/gi,""),n.version=/VERSION (.*)/i.exec(n.str),n.fields=/FIELDS (.*)/i.exec(n.str),n.size=/SIZE (.*)/i.exec(n.str),n.type=/TYPE (.*)/i.exec(n.str),n.count=/COUNT (.*)/i.exec(n.str),n.width=/WIDTH (.*)/i.exec(n.str),n.height=/HEIGHT (.*)/i.exec(n.str),n.viewpoint=/VIEWPOINT (.*)/i.exec(n.str),n.points=/POINTS (.*)/i.exec(n.str),n.version!==null&&(n.version=parseFloat(n.version[1])),n.fields!==null&&(n.fields=n.fields[1].split(" ")),n.type!==null&&(n.type=n.type[1].split(" ")),n.width!==null&&(n.width=parseInt(n.width[1],10)),n.height!==null&&(n.height=parseInt(n.height[1],10)),n.viewpoint!==null&&(n.viewpoint=n.viewpoint[1]),n.points!==null&&(n.points=parseInt(n.points[1],10)),n.points===null&&typeof n.width=="number"&&typeof n.height=="number"&&(n.points=n.width*n.height),n.size!==null&&(n.size=n.size[1].split(" ").map(i=>parseInt(i,10))),n.count!==null)n.count=n.count[1].split(" ").map(i=>parseInt(i,10));else if(n.count=[],n.fields!==null)for(let i=0;i<n.fields.length;i++)n.count.push(1);n.offset={};let s=0;for(let i=0,o=n.fields.length;i<o;i++)n.data==="ascii"?n.offset[n.fields[i]]=i:(n.offset[n.fields[i]]=s,s+=n.size[i]*n.count[i]);return n.rowSize=s,n}function M2(r,t){let e=[],n=[],s=[],i=[],o=[],a=r.offset,l=t.substr(r.headerLen).split(`
29
+ `);for(let u=0;u<l.length;u++)if(l[u]!==""){let f=l[u].split(" ");if(a.x!==void 0&&(e.push(parseFloat(f[a.x])),e.push(parseFloat(f[a.y])),e.push(parseFloat(f[a.z]))),a.rgb!==void 0){let h=parseFloat(f[a.rgb]),p=new Float32Array([h]),y=new DataView(p.buffer,0);s.push(y.getUint8(0)),s.push(y.getUint8(1)),s.push(y.getUint8(2))}a.normal_x!==void 0&&(n.push(parseFloat(f[a.normal_x])),n.push(parseFloat(f[a.normal_y])),n.push(parseFloat(f[a.normal_z]))),a.intensity!==void 0&&i.push(parseFloat(f[a.intensity])),a.label!==void 0&&o.push(parseInt(f[a.label]))}return{position:e,normal:n,color:s}}function D2(r,t){let e=[],n=[],s=[],i=[],o=[],a=new DataView(t,r.headerLen),c=r.offset;for(let l=0,u=0;l<r.points;l++,u+=r.rowSize)c.x!==void 0&&(e.push(a.getFloat32(u+c.x,xe)),e.push(a.getFloat32(u+c.y,xe)),e.push(a.getFloat32(u+c.z,xe))),c.rgb!==void 0&&(s.push(a.getUint8(u+c.rgb+0)),s.push(a.getUint8(u+c.rgb+1)),s.push(a.getUint8(u+c.rgb+2))),c.normal_x!==void 0&&(n.push(a.getFloat32(u+c.normal_x,xe)),n.push(a.getFloat32(u+c.normal_y,xe)),n.push(a.getFloat32(u+c.normal_z,xe))),c.intensity!==void 0&&i.push(a.getFloat32(u+c.intensity,xe)),c.label!==void 0&&o.push(a.getInt32(u+c.label,xe));return{position:e,normal:n,color:s,intensity:i,label:o}}function C2(r,t){let e=[],n=[],s=[],i=[],o=[],a=new Uint32Array(t.slice(r.headerLen,r.headerLen+8)),c=a[0],l=a[1],u=bx(new Uint8Array(t,r.headerLen+8,c),l),f=new DataView(u.buffer),h=r.offset;for(let p=0;p<r.points;p++){if(h.x!==void 0&&(e.push(f.getFloat32(r.points*h.x+r.size[0]*p,xe)),e.push(f.getFloat32(r.points*h.y+r.size[1]*p,xe)),e.push(f.getFloat32(r.points*h.z+r.size[2]*p,xe))),h.rgb!==void 0&&(s.push(f.getUint8(r.points*h.rgb+r.size[3]*p+0)),s.push(f.getUint8(r.points*h.rgb+r.size[3]*p+1)),s.push(f.getUint8(r.points*h.rgb+r.size[3]*p+2))),h.normal_x!==void 0&&(n.push(f.getFloat32(r.points*h.normal_x+r.size[4]*p,xe)),n.push(f.getFloat32(r.points*h.normal_y+r.size[5]*p,xe)),n.push(f.getFloat32(r.points*h.normal_z+r.size[6]*p,xe))),h.intensity!==void 0){let y=r.fields.indexOf("intensity");i.push(f.getFloat32(r.points*h.intensity+r.size[y]*p,xe))}if(h.label!==void 0){let y=r.fields.indexOf("label");o.push(f.getInt32(r.points*h.label+r.size[y]*p,xe))}}return{position:e,normal:n,color:s,intensity:i,label:o}}var xe,vx=d(()=>{"use strict";Ws();$t();wx();Ax();xe=!0;});var Sx,Bx=d(()=>{"use strict";Sx={name:"PCD (Point Cloud Data)",id:"pcd",module:"pointclouds",encoding:"text",format:"pcd",extensions:["pcd"],mimeTypes:["text/plain"],category:"pointcloud",text:!0,binary:!0}});async function E2(){let{PCDLoaderWithParser:r}=await Promise.resolve().then(()=>(Jm(),Km));return r}var F2,Tf,Ix=d(()=>{"use strict";Bx();oi();F2="5.0.0-beta.10";Tf={defaultShape:"arrow",supportsNativeArrow:!0,...Sx,dataType:null,batchType:null,version:F2,worker:!0,workerInBatches:!0,serializeWorkerResult:se,options:{pcd:{shape:"arrow",colorFormat:"uint8norm"}},preload:E2}});function _x(r,t){let e=Pe(r);return t?.pcd?.shape==="mesh"?ey(e,r):{...e,loader:r.loader,loaderData:r.loaderData}}function N2(r){let t=r?.core?.batchSize;return typeof t=="number"?t:void 0}function*U2(r,t,e){let n=new TextDecoder().decode(r),s=Rc(n),i=n.slice(s.headerLen).split(/\r?\n/).filter(a=>a.trim().length>0),o=e||i.length||1;for(let a=0;a<i.length;a+=o){let c=i.slice(a,a+o),l=`${Tx(s,c.length)}${c.join(`
30
+ `)}
31
+ `;yield ty(ya(new TextEncoder().encode(l).buffer,t),t)}}function*R2(r,t,e){let n=new TextDecoder().decode(r),s=Rc(n),i=e||s.points||1,o=new Uint8Array(r);for(let a=0;a<s.points;a+=i){let c=Math.min(i,s.points-a),l=new TextEncoder().encode(Tx(s,c)),u=s.headerLen+a*s.rowSize,f=c*s.rowSize,h=new Uint8Array(l.length+f);h.set(l,0),h.set(o.subarray(u,u+f),l.length),yield ty(ya(h.buffer,t),t)}}function ty(r,t){let e=Pe(r);return t?.pcd?.shape==="mesh"?ey(e,r):Bc({...e,loader:r.loader,loaderData:r.loaderData})}function ey(r,t){return{...ne(r),loader:t.loader,loaderData:t.loaderData}}function Tx(r,t){let e=r.str.split(/\r?\n/).filter(n=>n.trim().length>0).map(n=>/^WIDTH\s+/i.test(n)?`WIDTH ${t}`:/^HEIGHT\s+/i.test(n)?"HEIGHT 1":/^POINTS\s+/i.test(n)?`POINTS ${t}`:n);if(!e.some(n=>/^POINTS\s+/i.test(n))){let n=e.findIndex(s=>/^DATA\s+/i.test(s));e.splice(n>=0?n:e.length,0,`POINTS ${t}`)}return`${e.join(`
32
+ `)}
33
+ `}function Mx(r,t){let e=la(r);return t?.pcd?.shape==="mesh"?ey(e,e):e}function P2(r,t){return Mx(r,t)}async function*k2(r,t){let e=N2(t),n=await xp(r),s=new TextDecoder().decode(n),i=Rc(s);if(i.data==="ascii"){yield*U2(n,t,e);return}if(i.data==="binary"){yield*R2(n,t,e);return}yield ty(ya(n,t),t)}function Qm(r){return"shape"in r&&r.shape==="arrow-table"?(r.data.schema.metadata.set("loaders.gl.pcd.header",JSON.stringify(r.loaderData)),r.data):r}function Lx(r){return"shape"in r&&r.shape==="arrow-table"}var Fz,O2,po,z2,Dx=d(()=>{"use strict";$t();ni();oi();$t();vx();Ix();({preload:Fz,...O2}=Tf);po={...O2,dataType:null,batchType:null,parse:async(r,t)=>_x(ya(r,t),t),parseSync:(r,t)=>_x(ya(r,t),t),parseInBatches:(r,t)=>Tc(k2(r,t)),serializeWorkerResult:se,deserializeWorkerResult:Mx,serializeWorkerBatch:se,deserializeWorkerBatch:P2};z2={...po,dataType:Tf.dataType,batchType:Tf.batchType,parse:async(r,t)=>Qm(await po.parse(r,t)),parseSync:(r,t)=>Qm(po.parseSync(r,t)),async*parseInBatches(r,t){for await(let e of po.parseInBatches(r,t))if(Lx(e)){e.data.schema.metadata.set("loaders.gl.pcd.header",JSON.stringify(e.loaderData));for(let n of e.data.batches)n.schema.metadata.set("loaders.gl.pcd.header",e.data.schema.metadata.get("loaders.gl.pcd.header"));e.data.batches.length?yield*e.data.batches:yield Zr(e.data.schema)}else yield e},deserializeWorkerResult:(r,t)=>Qm(po.deserializeWorkerResult(r,t)),deserializeWorkerBatch(r,t){let e=po.deserializeWorkerBatch(r,t);if(Lx(e)){let n=e.data.batches[0]??Zr(e.data.schema);return n.schema.metadata.set("loaders.gl.pcd.header",JSON.stringify(e.loaderData)),n}return e}}});var Km={};ze(Km,{PCDColumnLoader:()=>po,PCDLoaderWithParser:()=>z2});var Jm=d(()=>{"use strict";Dx()});function ba(r,t){let e=ny(r),n=uo(t,e);return Y2(n,r),n}function ny(r){let t={};return t.ply_comments=JSON.stringify(r.comments),t.ply_elements=JSON.stringify(r.elements),r.format!==void 0&&(t.ply_format=r.format),r.version!==void 0&&(t.ply_version=r.version),r.headerLength!==void 0&&(t.ply_headerLength=r.headerLength.toString(10)),t}function Y2(r,t){let e=Z2(t);if(H2(e)){r.metadata["loaders_gl.semantic_type"]="gaussian-splats",r.metadata["loaders_gl.gaussian_splats.version"]="1";for(let n of r.fields)X2(n)}}function Z2(r){let t=r.elements.find(e=>e.name==="vertex");return new Set(t?.properties.map(e=>e.name)||[])}function H2(r){return["x","y","z","f_dc_0","f_dc_1","f_dc_2","opacity","scale_0","scale_1","scale_2","rot_0","rot_1","rot_2","rot_3"].every(e=>r.has(e))}function X2(r){r.metadata||={};let t=r.metadata;if(r.name==="opacity"){t["loaders_gl.gaussian_splats.semantic"]="opacity",t["loaders_gl.gaussian_splats.encoding"]="logit";return}let e=Mf(r.name,"scale");if(e!==void 0){t["loaders_gl.gaussian_splats.semantic"]="scale",t["loaders_gl.gaussian_splats.component"]=e,t["loaders_gl.gaussian_splats.encoding"]="log";return}let n=Mf(r.name,"rot");if(n!==void 0){t["loaders_gl.gaussian_splats.semantic"]="rotation",t["loaders_gl.gaussian_splats.component"]=n,t["loaders_gl.gaussian_splats.encoding"]="quaternion";return}let s=Mf(r.name,"f_dc");if(s!==void 0){t["loaders_gl.gaussian_splats.semantic"]="spherical_harmonic_dc",t["loaders_gl.gaussian_splats.component"]=s,t["loaders_gl.gaussian_splats.encoding"]="coefficient";return}let i=Mf(r.name,"f_rest");i!==void 0&&(t["loaders_gl.gaussian_splats.semantic"]="spherical_harmonic_rest",t["loaders_gl.gaussian_splats.component"]=i,t["loaders_gl.gaussian_splats.encoding"]="coefficient")}function Mf(r,t){return r.match(new RegExp(`^${t}_(\\d+)$`))?.[1]}var Pc=d(()=>{"use strict";$t()});function kc(r,t,e){let n=K2(t),s=lr(n),i=t.indices.length||t.vertices.length/3,o=t.indices&&t.indices.length>0,a=o?4:0,c=o?"triangle-list":"point-list",l=ba(r,n),u={loader:"ply",loaderData:r,header:{vertexCount:i,boundingBox:s??void 0},schema:l,attributes:n,indices:{value:new Uint32Array(0),size:0},mode:a,topology:c};return t.indices.length>0&&(u.indices={value:new Uint32Array(t.indices),size:1}),u}function K2(r){let t={};for(let e of Object.keys(r))switch(e){case"vertices":r.vertices.length>0&&(t.POSITION={value:Df(r.vertices),size:3});break;case"normals":r.normals.length>0&&(t.NORMAL={value:Df(r.normals),size:3});break;case"uvs":r.uvs.length>0&&(t.TEXCOORD_0={value:Df(r.uvs),size:2});break;case"colors":r.colors.length>0&&(t.COLOR_0={value:J2(r.colors),size:3,normalized:!0});break;case"indices":break;default:r[e].length>0&&(t[e]={value:Df(r[e]),size:1});break}return t}function Df(r){return r instanceof Float32Array?r:new Float32Array(r)}function J2(r){return r instanceof Uint8Array?r:new Uint8Array(r)}var sy=d(()=>{"use strict";$t();Pc()});function Px(r,t={}){let e,n;return r instanceof ArrayBuffer?(e=$n(r,t),n=e.format==="ascii"?Ux(new TextDecoder().decode(r),e):lL(r,e,t)):(e=$n(r,t),n=Ux(r,e)),kc(e,n)}function kx(r,t={}){if(!(r instanceof ArrayBuffer))return null;let e=$n(r,t);if(e.format==="ascii")return null;let n=$x(r,e,t);return n?jx(e,n):null}function zx(r,t,e={},n){let s=qx(r,t,e,n);return s?jx(t,s):null}function $n(r,t){let{headerText:e,headerLength:n}=r instanceof ArrayBuffer?Q2(r):tL(r),s=e.indexOf("ply"),i=e.lastIndexOf("end_header"),o=i+10;if(s>=0&&i>=s+3&&o<e.length&&/\s/.test(e[o])){let a=e.slice(s+3,i).split(`
34
+ `);return Nx(a,n||o+1-s,t)}return Nx([],n,t)}function Q2(r){let t=new Uint8Array(r),e=eL(t);return{headerText:new TextDecoder().decode(t.subarray(0,e)),headerLength:e}}function tL(r){let t=r.indexOf(ay);if(t===-1)return{headerText:"",headerLength:0};let e=t+ay.length;return r[e]==="\r"&&r[e+1]===`
35
+ `?e+=2:e<r.length&&/\s/.test(r[e])&&(e+=1),{headerText:r.slice(0,e),headerLength:e}}function eL(r){let t=new TextEncoder().encode(ay),e=r.length-t.length;for(let n=0;n<=e;n++){let s=!0;for(let i=0;i<t.length;i++)if(r[n+i]!==t[i]){s=!1;break}if(s){let i=n+t.length;return r[i]===13&&r[i+1]===10?i+=2:i<r.length&&rL(r[i])&&(i+=1),i}}return r.length}function rL(r){return r===10||r===13||r===9||r===32}function Nx(r,t,e){let n={comments:[],elements:[],headerLength:t},s,i,o=null;for(let a=0;a<r.length;a++){let c=r[a];if(c=c.trim(),c!=="")switch(i=c.split(/\s+/),s=i.shift(),c=i.join(" "),s){case"format":n.format=i[0],n.version=i[1];break;case"comment":n.comments.push(c);break;case"element":o&&n.elements.push(o),o={name:i[0],count:parseInt(i[1],10),properties:[]};break;case"property":if(o){let l=nL(i);e?.propertyNameMapping&&l.name in e?.propertyNameMapping&&(l.name=e?.propertyNameMapping[l.name]),o.properties.push(l)}break;default:}}return o&&n.elements.push(o),n}function Vx(r){let t={indices:[],vertices:[],normals:[],uvs:[],colors:[]};for(let e of r.elements)if(e.name==="vertex")for(let n of e.properties)switch(n.name){case"x":case"y":case"z":case"nx":case"ny":case"nz":case"s":case"t":case"red":case"green":case"blue":break;default:t[n.name]=[];break}return t}function nL(r){let t=r[0];return t==="list"?{type:t,name:r[3],countType:r[1],itemType:r[2]}:{type:t,name:r[1]}}function iy(r,t){switch(t){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(r,10);case"float":case"double":case"float32":case"float64":return parseFloat(r);default:throw new Error(t)}}function sL(r,t){let e=t.split(/\s+/),n={};for(let s=0;s<r.length;s++)if(r[s].type==="list"){let i=[],o=iy(e.shift(),r[s].countType);for(let a=0;a<o;a++)i.push(iy(e.shift(),r[s].itemType));n[r[s].name]=i}else n[r[s].name]=iy(e.shift(),r[s].type);return n}function Ux(r,t){let e=Vx(t),n=/end_header\s([\s\S]*)$/,s="",i=n.exec(r);i!==null&&(s=i[1]);let o=s.split(`
36
+ `),a=0,c=0;for(let l=0;l<o.length;l++){let u=o[l];if(u=u.trim(),u!==""){c>=t.elements[a].count&&(a++,c=0);let f=sL(t.elements[a].properties,u);Gx(e,t.elements[a].name,f),c++}}return e}function Gx(r,t,e={}){if(t==="vertex")for(let n of Object.keys(e))switch(n){case"x":r.vertices.push(e.x,e.y,e.z);break;case"y":case"z":break;case"nx":"nx"in e&&"ny"in e&&"nz"in e&&r.normals.push(e.nx,e.ny,e.nz);break;case"ny":case"nz":break;case"s":"s"in e&&"t"in e&&r.uvs.push(e.s,e.t);break;case"t":break;case"red":"red"in e&&"green"in e&&"blue"in e&&r.colors.push(e.red,e.green,e.blue);break;case"green":case"blue":break;default:r[n].push(e[n])}else if(t==="face"){let n=e.vertex_indices||e.vertex_index;n.length===3?r.indices.push(n[0],n[1],n[2]):n.length===4&&(r.indices.push(n[0],n[1],n[3]),r.indices.push(n[1],n[2],n[3]))}}function oy(r,t,e,n){switch(e){case"int8":case"char":return[r.getInt8(t),1];case"uint8":case"uchar":return[r.getUint8(t),1];case"int16":case"short":return[r.getInt16(t,n),2];case"uint16":case"ushort":return[r.getUint16(t,n),2];case"int32":case"int":return[r.getInt32(t,n),4];case"uint32":case"uint":return[r.getUint32(t,n),4];case"float32":case"float":return[r.getFloat32(t,n),4];case"float64":case"double":return[r.getFloat64(t,n),8];default:throw new Error(e)}}function iL(r,t,e,n){let s={},i,o=0;for(let a=0;a<e.length;a++)if(e[a].type==="list"){let c=[];i=oy(r,t+o,e[a].countType,n);let l=i[0];o+=i[1];for(let u=0;u<l;u++)i=oy(r,t+o,e[a].itemType,n),c.push(i[0]),o+=i[1];s[e[a].name]=c}else i=oy(r,t+o,e[a].type,n),s[e[a].name]=i[0],o+=i[1];return[s,o]}function jx(r,t){let e=oL(t),n=ba(r,e);n.metadata.topology="point-list",n.metadata.mode="0";let s=lr(e);s&&(n.metadata.boundingBox=JSON.stringify(s));let i={},o=[];for(let c of n.fields){let l=e[c.name];if(!l)continue;let u=aL(l);i[c.name]=u,o.push(new B(c.name,u.type,!1,Rx(c.metadata)))}let a=new P(o,Rx(n.metadata));return{shape:"arrow-table",schema:n,data:new X(a,i),topology:"point-list"}}function oL(r){let t={};for(let e of Object.keys(r))switch(e){case"vertices":r.vertices.length>0&&(t.POSITION={value:Cf(r.vertices),size:3});break;case"normals":r.normals.length>0&&(t.NORMAL={value:Cf(r.normals),size:3});break;case"uvs":r.uvs.length>0&&(t.TEXCOORD_0={value:Cf(r.uvs),size:2});break;case"colors":r.colors.length>0&&(t.COLOR_0={value:cL(r.colors),size:3,normalized:!0});break;case"indices":break;default:r[e].length>0&&(t[e]={value:Cf(r[e]),size:1});break}return t}function aL(r){let{value:t,size:e}=r;if(e===1)return ee(t);let s=ee(t).data[0],i=new gt(e,new B("value",s.type,!1)),o=new M(i,0,t.length/e,0,{},[s]);return new v([o])}function Rx(r){return new Map(Object.entries(r||{}))}function Cf(r){return r instanceof Float32Array?r:new Float32Array(r)}function cL(r){return r instanceof Uint8Array?r:new Uint8Array(r)}function lL(r,t,e){let n=$x(r,t,e);if(n)return n;let s=Vx(t),i=t.format==="binary_little_endian",o=new DataView(r,t.headerLength),a,c=0;for(let l=0;l<t.elements.length;l++){let u=t.elements[l].count;for(let f=0;f<u;f++){a=iL(o,c,t.elements[l].properties,i),c+=a[1];let h=a[0];Gx(s,t.elements[l].name,h)}}return s}function $x(r,t,e){let n=new Uint8Array(r,t.headerLength||0);return qx(n,t,e)}function qx(r,t,e,n){let s=t.elements[0];if(!n&&(e?._useLegacyBinaryPointCloudParser||!e?.pointCloud&&t.elements.length!==1||s?.name!=="vertex"||s.properties.some(l=>l.type==="list")))return null;let i=n||cy(t,e);if(!i||!s)return null;let o=uL(s),a=new DataView(r.buffer,r.byteOffset,r.byteLength),c=0;for(let l=0;l<s.count;l++){for(let u of i.properties){let f=u.read(a,c+u.offset,i.littleEndian);hL(o,u.name,f,l)}c+=i.vertexStride}return o}function cy(r,t){let e=r.elements[0];if(t?._useLegacyBinaryPointCloudParser||!t?.pointCloud&&r.elements.length!==1||e?.name!=="vertex"||e.properties.some(s=>s.type==="list"))return null;let n=dL(e);return{properties:n,vertexStride:pL(n),littleEndian:r.format==="binary_little_endian"}}function uL(r){let t={indices:[],vertices:[],normals:[],uvs:[],colors:[]},e=new Set(r.properties.map(s=>s.name)),n=r.count;e.has("x")&&e.has("y")&&e.has("z")&&(t.vertices=new Float32Array(n*3)),e.has("nx")&&e.has("ny")&&e.has("nz")&&(t.normals=new Float32Array(n*3)),e.has("s")&&e.has("t")&&(t.uvs=new Float32Array(n*2)),e.has("red")&&e.has("green")&&e.has("blue")&&(t.colors=new Uint8Array(n*3));for(let s of r.properties)fL(s.name)||(t[s.name]=new Float32Array(n));return t}function fL(r){switch(r){case"x":case"y":case"z":case"nx":case"ny":case"nz":case"s":case"t":case"red":case"green":case"blue":return!0;default:return!1}}function hL(r,t,e,n){switch(t){case"x":r.vertices[n*3]=e;break;case"y":r.vertices[n*3+1]=e;break;case"z":r.vertices[n*3+2]=e;break;case"nx":r.normals[n*3]=e;break;case"ny":r.normals[n*3+1]=e;break;case"nz":r.normals[n*3+2]=e;break;case"s":r.uvs[n*2]=e;break;case"t":r.uvs[n*2+1]=e;break;case"red":r.colors[n*3]=e;break;case"green":r.colors[n*3+1]=e;break;case"blue":r.colors[n*3+2]=e;break;default:r[t][n]=e}}function dL(r){let t=[],e=0;for(let n of r.properties)t.push({name:n.name,offset:e,read:yL(n.type),size:mL(n.type)}),e+=t[t.length-1].size;return t}function pL(r){if(r.length===0)return 0;let t=r[r.length-1];return t.offset+t.size}function mL(r){switch(r){case"int8":case"uint8":case"char":case"uchar":return 1;case"int16":case"uint16":case"short":case"ushort":return 2;case"int32":case"uint32":case"int":case"uint":case"float32":case"float":return 4;case"float64":case"double":return 8;default:throw new Error(r)}}function yL(r){switch(r){case"int8":case"char":return gL;case"uint8":case"uchar":return bL;case"int16":case"short":return wL;case"uint16":case"ushort":return xL;case"int32":case"int":return AL;case"uint32":case"uint":return vL;case"float32":case"float":return SL;case"float64":case"double":return BL;default:throw new Error(r)}}function gL(r,t){return r.getInt8(t)}function bL(r,t){return r.getUint8(t)}function wL(r,t,e){return r.getInt16(t,e)}function xL(r,t,e){return r.getUint16(t,e)}function AL(r,t,e){return r.getInt32(t,e)}function vL(r,t,e){return r.getUint32(t,e)}function SL(r,t,e){return r.getFloat32(t,e)}function BL(r,t,e){return r.getFloat64(t,e)}var ay,Ff=d(()=>{"use strict";Ue();$t();sy();Pc();ay="end_header"});function zc(r,t={}){let e=$n(r,t),n=t.pointCloud?ML(e):e;if(e.format==="ascii"){let s=r instanceof ArrayBuffer?new TextDecoder().decode(r):r;return LL(s,n)}if(!(r instanceof ArrayBuffer))throw new Error("Binary PLY parsing requires an ArrayBuffer.");return TL(r,n)}function Vc(r){let t=_L(r);return NL(t)}function _L(r){let t=EL(r),e=OL(r),n=lr(t),s=t.POSITION?.value.length?t.POSITION.value.length/3:0,i=!!e?.value.length,o=i?4:0,a=i?"triangle-list":"point-list",c=ba(r.header,t);return{loader:"ply",loaderData:r.header,header:{vertexCount:s,boundingBox:n??void 0},schema:c,attributes:t,indices:e||{value:new Uint32Array(0),size:0},mode:o,topology:a}}function LL(r,t){let e=Wx(t),s=VL(r).split(`
37
+ `),i=0,o=0;for(let a of s){let c=a.trim();if(c!==""){for(;i<t.elements.length&&o>=t.elements[i].count;)i++,o=0;if(i>=t.elements.length)break;DL(e[i],c),o++}}return{header:t,elements:e.map(Yx)}}function TL(r,t){let e=Wx(t),n=new DataView(r,t.headerLength||0),s=t.format!=="binary_big_endian",i=0;for(let o=0;o<t.elements.length;o++){let a=t.elements[o];for(let c=0;c<a.count;c++)i+=CL(e[o],n,i,s)}return{header:t,elements:e.map(Yx)}}function ML(r){let t=r.elements[0];if(t?.name!=="vertex")throw new Error("PLY pointCloud parsing requires a leading vertex element");return{...r,elements:[t]}}function Wx(r){return r.elements.map(t=>({element:t,properties:t.properties.map(e=>({property:e,values:[],offsets:e.type==="list"?[0]:void 0}))}))}function DL(r,t){let e=t.split(/\s+/),n=0;for(let s of r.properties){let i=s.property;if(i.type==="list"){let o=ly(e[n++],i.countType);for(let a=0;a<o;a++)s.values.push(ly(e[n++],i.itemType));s.offsets.push(s.values.length)}else s.values.push(ly(e[n++],i.type))}}function CL(r,t,e,n){let s=0;for(let i of r.properties){let o=i.property;if(o.type==="list"){let[a,c]=uy(t,e+s,o.countType,n);s+=c;for(let l=0;l<a;l++){let[u,f]=uy(t,e+s,o.itemType,n);i.values.push(u),s+=f}i.offsets.push(i.values.length)}else{let[a,c]=uy(t,e+s,o.type,n);i.values.push(a),s+=c}}return s}function Yx(r){let t=[],e={};for(let n of r.properties){let s=FL(n);e[n.property.name]=s,t.push(new B(n.property.name,s.type,!1))}return{element:r.element,table:new X(new P(t),e)}}function FL(r){let t=r.property;return t.type==="list"?GL(t.itemType,r.values,Int32Array.from(r.offsets||[0])):ee(Hx(r.values,t.type))}function EL(r){let t=Zx(r,"vertex"),e={};if(!t)return e;let n=Ef(t.table,["x","y","z"],"float");n&&(e.POSITION=n);let s=Ef(t.table,["nx","ny","nz"],"float");s&&(e.NORMAL=s);let i=Ef(t.table,["s","t"],"float");i&&(e.TEXCOORD_0=i);let o=Ef(t.table,["red","green","blue"],"uchar");o&&(e.COLOR_0={...o,normalized:!0});let a=new Set(["x","y","z","nx","ny","nz","s","t","red","green","blue"]);for(let c of t.element.properties){if(c.type==="list"||a.has(c.name))continue;let l=t.table.getChild(c.name);l&&(e[c.name]={value:zL(l),size:1})}return e}function OL(r){let t=Zx(r,"face"),e=t?.table.getChild("vertex_indices")||t?.table.getChild("vertex_index");if(!e)return;let n=[];for(let s=0;s<e.length;s++){let i=e.get(s);i&&(i.length===3?n.push(qn(i,0),qn(i,1),qn(i,2)):i.length===4&&(n.push(qn(i,0),qn(i,1),qn(i,3)),n.push(qn(i,1),qn(i,2),qn(i,3))))}return n.length>0?{value:new Uint32Array(n),size:1}:void 0}function qn(r,t){return"get"in r&&typeof r.get=="function"?Number(r.get(t)):Number(r[t])}function NL(r){let t=[],e={},n=kL(r.attributes);for(let o of n){let a=r.attributes[o],c=UL(a);if(e[o]=c,t.push(RL(r,o,c)),o==="POSITION"&&r.indices?.value.length){let l=PL(r.indices.value,c.length);e.indices=l,t.push(new B("indices",l.type,!0))}}let s=Xx({...r.schema.metadata,topology:r.topology,mode:String(r.mode),boundingBox:r.header?.boundingBox?JSON.stringify(r.header.boundingBox):void 0}),i=new P(t,s);return{shape:"arrow-table",schema:fr(i),data:new X(i,e),topology:r.topology,indices:r.indices?.value.length?r.indices:void 0}}function UL(r){let{value:t,size:e}=r;if(e===1)return ee(t);let s=ee(t).data[0],i=new gt(e,new B("value",s.type,!1)),o=new M(i,0,t.length/e,0,{},[s]);return new v([o])}function RL(r,t,e){let n=r.schema.fields.find(s=>s.name===t);return new B(t,e.type,!1,Xx(n?.metadata))}function PL(r,t){let e=r instanceof Uint32Array?r:Uint32Array.from(r),n=new Int32Array(t+1);t>0&&n.fill(e.length,1);let s=new Uint8Array(Math.ceil(t/8));t>0&&(s[0]=1);let i=new Ct(new B("item",new qt,!1)),o=new M(i.children[0].type,0,e.length,0,{[Z.DATA]:e}),a=new M(i,0,t,Math.max(0,t-1),{[Z.OFFSET]:n,[Z.VALIDITY]:s},[o]);return new v([a])}function Ef(r,t,e){let n=t.map(o=>r.getChild(o));if(n.some(o=>!o))return null;let s=r.numRows,i=e==="uchar"?new Uint8Array(s*t.length):new Float32Array(s*t.length);for(let o=0;o<s;o++)for(let a=0;a<n.length;a++)i[o*n.length+a]=Number(n[a].get(o)??0);return{value:i,size:t.length}}function Zx(r,t){return r.elements.find(e=>e.element.name===t)}function kL(r){let t=["POSITION","indices"];return[...t.filter(e=>e in r),...Object.keys(r).filter(e=>!t.includes(e))]}function zL(r){return r.data[0].values}function VL(r){let t=IL.exec(r);return t?r.slice(t.index+t[0].length):""}function GL(r,t,e){let n=jL(r),s=new Ct(new B("item",n,!1)),i=Hx(t,r),o=new M(n,0,i.length,0,{[Z.DATA]:i}),a=new M(s,0,e.length-1,0,{[Z.OFFSET]:e},[o]);return new v([a])}function Hx(r,t){switch(t){case"int8":case"char":return Int8Array.from(r);case"uint8":case"uchar":return Uint8Array.from(r);case"int16":case"short":return Int16Array.from(r);case"uint16":case"ushort":return Uint16Array.from(r);case"int32":case"int":return Int32Array.from(r);case"uint32":case"uint":return Uint32Array.from(r);case"float64":case"double":return Float64Array.from(r);default:return Float32Array.from(r)}}function jL(r){switch(r){case"int8":case"char":return new Se;case"uint8":case"uchar":return new Ie;case"int16":case"short":return new Be;case"uint16":case"ushort":return new _e;case"int32":case"int":return new Dt;case"uint32":case"uint":return new qt;case"float64":case"double":return new Le;default:return new Kt}}function ly(r,t){switch(t){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(r,10);case"float":case"double":case"float32":case"float64":return parseFloat(r);default:throw new Error(t)}}function uy(r,t,e,n){switch(e){case"int8":case"char":return[r.getInt8(t),1];case"uint8":case"uchar":return[r.getUint8(t),1];case"int16":case"short":return[r.getInt16(t,n),2];case"uint16":case"ushort":return[r.getUint16(t,n),2];case"int32":case"int":return[r.getInt32(t,n),4];case"uint32":case"uint":return[r.getUint32(t,n),4];case"float32":case"float":return[r.getFloat32(t,n),4];case"float64":case"double":return[r.getFloat64(t,n),8];default:throw new Error(e)}}function Xx(r){return new Map(Object.entries(r||{}).filter(t=>t[1]!==void 0))}var IL,fy=d(()=>{"use strict";$t();Ue();Ff();Pc();IL=/end_header\s/});async function*tA(r,t){if(t?.shape==="arrow"){yield*WL(r,t);return}let e=Cu(Du(Fu(r))),n=await sT(e,t),s;if(n.format==="ascii")s=await oT(e,n);else throw new Error("Binary PLY can not yet be parsed in streaming mode");yield kc(n,s,t)}async function*WL(r,t){let e=Fu(r)[Symbol.asyncIterator](),{header:n,initialBodyBytes:s}=await XL(e,t),i;n.format==="ascii"?i=ZL(e,n,s,t):i=dy(n,t).properties.some(a=>a.type==="list")?HL(e,n,s,t):YL(e,n,s,t);for await(let o of i)yield{...ii(o,ny(n)),loaderData:n}}async function*YL(r,t,e,n){let s=KL(t,n),i=py(n),o=eT(s),a=cy(t,n),c=s.count,l=e;for(;;){for(;c>0&&Math.floor(l.length/o)>=i;){let h=Math.min(i,c),p=Kx(t,l,h,o,n,a);l=l.subarray(h*o),c-=h,yield p}if(n?.pointCloud&&c<=0)return;let{value:u,done:f}=await r.next();if(f)break;l=my([l,Uf(u)])}if(c>0){let u=Math.min(c,Math.floor(l.length/o));u>0&&(yield Kx(t,l,u,o,n,a))}}async function*ZL(r,t,e,n){let s=dy(t,n),i=py(n),o=Cu(Du(tT(r,e))),a=[],c=s.count;for await(let l of o){let u=l.trim();if(u!==""&&(a.push(u),c--,a.length>=i&&(yield Jx(t,a,n),a=[]),c<=0))break}a.length>0&&(yield Jx(t,a,n))}async function*HL(r,t,e,n){let s=dy(t,n),i=py(n),o=t.format!=="binary_big_endian",a=s.count,c=e,l=[],u=0,f=0;for(;a>0;){let h=JL(c,s,o);if(h===null){let{value:y,done:g}=await r.next();if(g)break;c=my([c,Uf(y)]);continue}let p=c.subarray(0,h);l.push(p),u+=h,f++,a--,c=c.subarray(h),f>=i&&(yield Qx(t,l,u,f,n),l=[],u=0,f=0)}f>0&&(yield Qx(t,l,u,f,n))}async function XL(r,t){let e=new Uint8Array(0);for(;;){let{value:n,done:s}=await r.next();if(s)throw new Error("Incomplete PLY header");e=my([e,Uf(n)]);let i=rT(e);if(i===-1)continue;return{header:$n(Nf(e.subarray(0,i)),t),initialBodyBytes:e.subarray(i)}}}function dy(r,t){let e=r.elements[0];if(!t?.pointCloud&&r.elements.length!==1||e?.name!=="vertex")throw new Error("PLY arrow-table batch parsing requires one vertex element");return e}function KL(r,t){let e=r.elements[0];if(!t?.pointCloud&&r.elements.length!==1||e?.name!=="vertex"||e.properties.some(n=>n.type==="list"))throw new Error("Binary PLY arrow-table batch parsing requires one scalar vertex element");return e}function Kx(r,t,e,n,s,i){let o=r.elements[0],a={...r,headerLength:0,elements:[{...o,count:e}]},c=e*n,l=zx(t.subarray(0,c),a,s,i||void 0);if(!l)throw new Error("Failed to parse binary PLY Arrow batch");return l}function Jx(r,t,e){let n=eA(r,t.length,e),s=zc(`${n}${t.join(`
38
+ `)}
39
+ `,e);return Vc(s)}function Qx(r,t,e,n,s){let i=eA(r,n,s),o=new TextEncoder().encode(i),a=new Uint8Array(o.length+e);a.set(o,0);let c=o.length;for(let u of t)a.set(u,c),c+=u.length;let l=zc(Nf(a),s);return Vc(l)}function JL(r,t,e){let n=new DataView(r.buffer,r.byteOffset,r.byteLength),s=0;for(let i of t.properties)if(i.type==="list"){let o=Of(i.countType);if(s+o>r.length)return null;let a=QL(n,s,i.countType,e);s+=o;let c=a*Of(i.itemType);if(s+c>r.length)return null;s+=c}else{let o=Of(i.type);if(s+o>r.length)return null;s+=o}return s}function QL(r,t,e,n){switch(e){case"int8":case"char":return r.getInt8(t);case"uint8":case"uchar":return r.getUint8(t);case"int16":case"short":return r.getInt16(t,n);case"uint16":case"ushort":return r.getUint16(t,n);case"int32":case"int":return r.getInt32(t,n);case"uint32":case"uint":return r.getUint32(t,n);case"float32":case"float":return r.getFloat32(t,n);case"float64":case"double":return r.getFloat64(t,n);default:throw new Error(e)}}function eA(r,t,e){let n=["ply",`format ${r.format} ${r.version||"1.0"}`],s=e?.pointCloud?r.elements.slice(0,1):r.elements;for(let i of r.comments)n.push(`comment ${i}`);for(let i of s){n.push(`element ${i.name} ${i.name==="vertex"?t:i.count}`);for(let o of i.properties)n.push(o.type==="list"?`property list ${o.countType} ${o.itemType} ${o.name}`:`property ${o.type} ${o.name}`)}return n.push("end_header"),`${n.join(`
40
+ `)}
41
+ `}async function*tT(r,t){for(t.length>0&&(yield Nf(t));;){let{value:e,done:n}=await r.next();if(n)break;yield Nf(Uf(e))}}function py(r){let t=r?.batchSize;return typeof t=="number"?t:$L}function eT(r){return r.properties.reduce((t,e)=>t+Of(e.type),0)}function Of(r){switch(r){case"int8":case"uint8":case"char":case"uchar":return 1;case"int16":case"uint16":case"short":case"ushort":return 2;case"int32":case"uint32":case"int":case"uint":case"float32":case"float":return 4;case"float64":case"double":return 8;default:throw new Error(r)}}function rT(r){let t=new TextEncoder().encode(qL),e=r.length-t.length;for(let n=0;n<=e;n++){let s=!0;for(let i=0;i<t.length;i++)if(r[n+i]!==t[i]){s=!1;break}if(s){let i=n+t.length;return i===r.length||r[i]===13&&i+1===r.length?-1:(r[i]===13&&r[i+1]===10?i+=2:i<r.length&&nT(r[i])&&(i+=1),i)}}return-1}function nT(r){return r===10||r===13||r===9||r===32}function Uf(r){return ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r)}function Nf(r){let t=new Uint8Array(r.byteLength);return t.set(r),t.buffer}function my(r){let t=r.reduce((s,i)=>s+i.length,0),e=new Uint8Array(t),n=0;for(let s of r)e.set(s,n),n+=s.length;return e}async function sT(r,t){let e,n={comments:[],elements:[]};return await wp(r,s=>{if(s=s.trim(),s==="end_header")return!0;if(s==="")return!1;let i=s.split(/\s+/),o=i.shift();switch(s=i.join(" "),o){case"ply":break;case"format":n.format=i[0],n.version=i[1];break;case"comment":n.comments.push(s);break;case"element":e&&n.elements.push(e),e={name:i[0],count:parseInt(i[1],10),properties:[]};break;case"property":let a=iT(i,t.propertyNameMapping);e?.properties.push(a);break;default:bp.log(0,"unhandled",o,i)()}return!1}),e&&n.elements.push(e),n}function iT(r,t){let e=r[0];return e==="list"?{type:e,name:r[3],countType:r[1],itemType:r[2]}:{type:e,name:r[1]}}async function oT(r,t){let e={indices:[],vertices:[],normals:[],uvs:[],colors:[]},n=0,s=0;for await(let i of r)if(i=i.trim(),i!==""){s>=t.elements[n].count&&(n++,s=0);let o=aT(t.elements[n].properties,i);cT(e,t.elements[n].name,o),s++}return e}function hy(r,t){switch(t){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(r,10);case"float":case"double":case"float32":case"float64":return parseFloat(r);default:throw new Error(t)}}function aT(r,t){let e=t.split(/\s+/),n={};for(let s=0;s<r.length;s++)if(r[s].type==="list"){let i=[],o=hy(e.shift(),r[s].countType);for(let a=0;a<o;a++)i.push(hy(e.shift(),r[s].itemType));n[r[s].name]=i}else n[r[s].name]=hy(e.shift(),r[s].type);return n}function cT(r,t,e={}){switch(t){case"vertex":r.vertices.push(e.x,e.y,e.z),"nx"in e&&"ny"in e&&"nz"in e&&r.normals.push(e.nx,e.ny,e.nz),"s"in e&&"t"in e&&r.uvs.push(e.s,e.t),"red"in e&&"green"in e&&"blue"in e&&r.colors.push(e.red,e.green,e.blue);break;case"face":let n=e.vertex_indices||e.vertex_index;n.length===3?r.indices.push(n[0],n[1],n[2]):n.length===4&&(r.indices.push(n[0],n[1],n[3]),r.indices.push(n[1],n[2],n[3]));break;default:break}}var $L,qL,rA=d(()=>{"use strict";ni();ni();$t();Pc();sy();Ff();fy();$L=65536,qL="end_header"});var nA,sA=d(()=>{"use strict";nA={name:"PLY",id:"ply",module:"pointclouds",encoding:"text",format:"ply",extensions:["ply"],mimeTypes:["text/plain","application/octet-stream"],text:!0,binary:!0,tests:["ply"]}});async function uT(){let{PLYLoaderWithParser:r}=await Promise.resolve().then(()=>(gy(),yy));return r}var lT,Rf,iA=d(()=>{"use strict";sA();oi();lT="5.0.0-beta.10";Rf={defaultShape:"arrow",supportsNativeArrow:!0,dataType:null,batchType:null,...nA,version:lT,worker:!0,workerInBatches:!0,serializeWorkerResult:se,options:{ply:{shape:"arrow",colorFormat:"uint8norm"}},preload:uT}});function aA(r,t){let e=Pe(r);return kf(e,t,r.loaderData)}function by(r,t){if(t?.ply?._useLegacyParser)return aA(Px(r,t?.ply),t);let e=kx(r,t?.ply);if(e)return kf(e,t,$n(r,t?.ply));let n=zc(r,t?.ply);return kf(Vc(n),t,n.header)}function kf(r,t,e){let n=e||r.loaderData||{comments:[],elements:[]},s=t?.ply?.shape==="arrow"?{...r,loader:"ply",loaderData:n}:{...ne(r),loader:"ply",loaderData:n},i=t?.ply?.colorFormat||"uint8norm";if(i==="uint8norm")return s;let o=s,a=hT(wy(o)?ne(o):o,i);return t?.ply?.shape==="arrow"?{...Pe(a),loader:"ply",loaderData:n}:a}function hT(r,t){let e=r.attributes.COLOR_0;if(!e)return r;let n=e.value instanceof Uint16Array?65535:255,s=t==="float16"?fi(e.value,n):xa(e.value,n),i={...r.attributes};for(let[o,a]of Object.entries(i))a.value===e.value&&(i[o]={...a,value:s,normalized:!1,...t==="float16"?{componentType:"float16"}:{}});return{...r,attributes:i,schema:uo(i,r.schema.metadata)}}function wy(r){return"shape"in r&&r.shape==="arrow-table"}function cA(r,t){let e=la(r);return t?.ply?.shape==="mesh"?{...ne(e),loader:"ply",loaderData:e.loaderData}:e}function dT(r,t){return cA(r,t)}async function*pT(r,t){let e={...t?.ply,batchSize:t?.core?.batchSize};for await(let n of tA(r,e)){let s=wy(n)?kf(n,t):aA(n,t);yield wy(s)?Bc(s):s}}function Pf(r){return"shape"in r&&r.shape==="arrow-table"?(r.data.schema.metadata.set("loaders.gl.ply.header",JSON.stringify(r.loaderData)),r.data):r}function oA(r){return"shape"in r&&r.shape==="arrow-table"}var vV,fT,li,mT,lA=d(()=>{"use strict";$t();ni();Ws();oi();$t();Ff();fy();rA();iA();({preload:vV,...fT}=Rf);li={...fT,dataType:null,batchType:null,parse:async(r,t)=>by(r,t),parseTextSync:(r,t)=>by(r,t),parseSync:(r,t)=>by(r,t),parseInBatches:(r,t)=>Tc(pT(r,t)),serializeWorkerResult:se,deserializeWorkerResult:cA,serializeWorkerBatch:se,deserializeWorkerBatch:dT};mT={...li,dataType:Rf.dataType,batchType:Rf.batchType,parse:async(r,t)=>Pf(await li.parse(r,t)),parseTextSync:(r,t)=>Pf(li.parseTextSync(r,t)),parseSync:(r,t)=>Pf(li.parseSync(r,t)),async*parseInBatches(r,t){for await(let e of li.parseInBatches(r,t))if(oA(e)){e.data.schema.metadata.set("loaders.gl.ply.header",JSON.stringify(e.loaderData));for(let n of e.data.batches)n.schema.metadata.set("loaders.gl.ply.header",e.data.schema.metadata.get("loaders.gl.ply.header"));e.data.batches.length?yield*e.data.batches:yield Zr(e.data.schema)}else yield e},deserializeWorkerResult:(r,t)=>Pf(li.deserializeWorkerResult(r,t)),deserializeWorkerBatch(r,t){let e=li.deserializeWorkerBatch(r,t);if(oA(e)){let n=e.data.batches[0]??Zr(e.data.schema);return n.schema.metadata.set("loaders.gl.ply.header",JSON.stringify(e.loaderData)),n}return e}}});var yy={};ze(yy,{PLYColumnLoader:()=>li,PLYLoaderWithParser:()=>mT});var gy=d(()=>{"use strict";lA()});var BT={};ze(BT,{LASFormat:()=>Ho,LASLoader:()=>ax,LASWriter:()=>fx,PCDFormat:()=>ma,PCDLoader:()=>Cx,PCDWriter:()=>Ex,PLYFormat:()=>ga,PLYLoader:()=>uA,PLYWriter:()=>hA});var Ho={name:"LAS",id:"las",module:"pointclouds",encoding:"binary",format:"las",extensions:["las","laz"],mimeTypes:["application/octet-stream"],text:!1,binary:!0,tests:["LASF"]};var QS=typeof __VERSION__<"u"?__VERSION__:"latest",tB="arrow";var zb={...Ho,defaultShape:"arrow",supportsNativeArrow:!0,dataType:null,batchType:null,version:QS,worker:!1,options:{las:{shape:tB,fp64:!1,colorDepth:8,colorFormat:"uint8norm",columns:void 0,extraBytes:"raw",recoverMissingChunkTable:!1,compatibilityMode:"auto"}}};async function V_(){let{LASLoaderWithParser:r}=await Promise.resolve().then(()=>(ox(),ix));return r}var ax={...zb,worker:!0,workerInBatches:!0,preload:V_};ni();$t();var G_=typeof __VERSION__<"u"?__VERSION__:"latest",j_=227,$_=375,q_=393,_f=54,Ym=192,W_=5e4,Y_=4294967295,Zm=15,Z_={0:20,1:28,2:26,3:34,4:57,5:63,6:30,7:36,8:38,9:59,10:67},fx={...Ho,dataType:null,batchType:null,version:G_,extensions:["las","laz"],options:{las:{}},encode:async(r,t)=>$m(r,t),encodeSync:$m,encodeInBatches:async function*(r,t){let e=[];for await(let n of r)e.push(n);yield $m(a2(e),t)}};function $m(r,t={}){let e=t.las?.format||"las",n=t.las?.colorDepth;if(n!==void 0&&n!=="auto"&&n!==8&&n!==16)throw new Error("LASWriter: invalid source color depth");let s=i2(r),i=px(s,"POSITION");l2(i);let o=i.value.length/i.size;f2(s,o);let a=s.attributes.COLOR_0,c=s.attributes.intensity,l=s.attributes.classification,u=s.attributes.nir,f=J_(s,t,o),h=s.attributes.gpsTime,p=s.attributes.scanAngle,y=s.attributes.userData,g=s.attributes.pointSourceId,w=s.attributes.returnNumber,S=s.attributes.numberOfReturns,E=s.attributes.scannerChannel,I=s.attributes.scanDirectionFlag,b=s.attributes.edgeOfFlightLine,C=s.attributes.synthetic,L=s.attributes.keyPoint,q=s.attributes.withheld,K=s.attributes.overlap,ft=s.attributes.wavePacketDescriptorIndex,dt=s.attributes.wavePacketOffset,Bt=s.attributes.wavePacketSize,ie=s.attributes.wavePacketReturnPoint,st=s.attributes.wavePacketVector,rt=B2(i,o),Xe=A2(w,o),ke=I2(s,t),Ke=_2(s,t,rt);u2(i,o,ke,Ke);let xt=t.las?.pointDataRecordFormat??b2(t,a);h2(s,o,xt);let Wn=Z_[xt];if(!Wn)throw new Error(`LASWriter: unsupported point data record format ${xt}`);let ui=Wn+f.reduce((mn,go)=>mn+go.byteLength,0);if(ui>65535)throw new Error(`LASWriter: point data record length ${ui} exceeds the LAS limit`);n2(f);let wt=t.las?.version||(xt>=6?"1.4":"1.2"),pt=wt==="1.5"?q_:wt==="1.4"?$_:j_;X_(wt,xt,t);let dn=r2(h,o);if(wt==="1.5"&&t.las?.timeOffset&&!h)throw new Error("LASWriter: LAS 1.5 timeOffset requires a GPS time attribute");e==="laz"&&s2(wt,xt,t.las?.chunkSize),H_(wt,xt);let Xr=new Uint8Array(o*ui),pn=new DataView(Xr.buffer);for(let mn=0;mn<o;mn++){let go=mn*ui;pn.setInt32(go,Math.round((Hr(i,mn,0)-Ke[0])/ke[0]),!0),pn.setInt32(go+4,Math.round((Hr(i,mn,1)-Ke[1])/ke[1]),!0),pn.setInt32(go+8,Math.round((Hr(i,mn,2)-Ke[2])/ke[2]),!0),d2(pn,go,mn,xt,Wn,{intensityAttribute:c,classificationAttribute:l,nirAttribute:u,colorAttribute:a,colorDepth:n,gpsTimeAttribute:h,scanAngleAttribute:p,userDataAttribute:y,pointSourceIdAttribute:g,returnNumberAttribute:w,numberOfReturnsAttribute:S,scannerChannelAttribute:E,scanDirectionFlagAttribute:I,edgeOfFlightLineAttribute:b,syntheticAttribute:C,keyPointAttribute:L,withheldAttribute:q,overlapAttribute:K,waveformDescriptorAttribute:ft,waveformOffsetAttribute:dt,waveformSizeAttribute:Bt,waveformReturnPointAttribute:ie,waveformVectorAttribute:st,extraByteFields:f})}let _r={vertexCount:o,boundingBox:rt,scale:ke,offset:Ke,version:wt,headerLength:pt,pointDataRecordFormat:xt,pointDataRecordLength:ui,returnCounts:Xe,maxGpsTime:dn.maximum,minGpsTime:dn.minimum,timeOffset:t.las?.timeOffset||0,hasGpsTime:!!h,hasWkt:!!t.las?.wkt};if(e==="laz")return K_(Xr,_r,t.las?.chunkSize,t.las?.variableChunkTable,f,t);let Lr=hx(f,t),yo=pt+Lr.byteLength,zf=new ArrayBuffer(yo+Xr.byteLength);yx(new DataView(zf),{..._r,pointDataOffset:yo,vlrCount:dx(f,t)});let Ay=new Uint8Array(zf);return Ay.set(Lr,pt),Ay.set(Xr,yo),zf}function H_(r,t){let n={0:"1.0",1:"1.1",2:"1.2",3:"1.2"}[t];if(n&&r<n)throw new Error(`LASWriter: point data record format ${t} requires LAS ${n} or newer; received ${r}`);if(t>=4&&t<=5&&!["1.3","1.4","1.5"].includes(r))throw new Error(`LASWriter: point data record format ${t} requires LAS 1.3; received ${r}`);if(t>=6&&!["1.4","1.5"].includes(r))throw new Error(`LASWriter: point data record format ${t} requires LAS 1.4; received ${r}`)}function X_(r,t,e){if(r==="1.5"){if(t<6||t>10)throw new Error("LASWriter: LAS 1.5 output requires point data record format 6-10");if(!e.las?.wkt?.trim())throw new Error("LASWriter: LAS 1.5 output requires las.wkt");let n=e.las?.timeOffset??0;if(!Number.isInteger(n)||n<0||n>65535)throw new Error("LASWriter: LAS 1.5 timeOffset must be an unsigned 16-bit integer")}}function K_(r,t,e,n=!1,s=[],i={}){let o=e||W_,a=cm({pointDataRecordFormat:t.pointDataRecordFormat,pointDataRecordLength:t.pointDataRecordLength,chunkSize:n?Y_:o}),c=hx(s,i),l=t.headerLength+c.byteLength+a.byteLength,u=[],f=[];for(let I=0;I<t.vertexCount;I+=o){let b=Math.min(o,t.vertexCount-I),C=I*t.pointDataRecordLength,L=om(r.subarray(C,C+b*t.pointDataRecordLength),{pointDataRecordFormat:t.pointDataRecordFormat,pointDataRecordLength:t.pointDataRecordLength,pointCount:b,point14ItemVersion:3,rgb14ItemVersion:3,byte14ItemVersion:3});u.push(L),f.push({pointCount:b,byteLength:L.byteLength})}let h=u.reduce((I,b)=>I+b.byteLength,0),p=am(f,{variable:n}),y=l+8+h,g=new ArrayBuffer(y+8+p.byteLength),w=new Uint8Array(g),S=new DataView(g);yx(S,{...t,pointDataOffset:l,vlrCount:dx(s,i)+1,compressed:!0}),w.set(c,t.headerLength),w.set(a,t.headerLength+c.byteLength),Hm(S,l,y);let E=l+8;for(let I of u)w.set(I,E),E+=I.byteLength;return S.setUint32(y,0,!0),S.setUint32(y+4,f.length,!0),w.set(p,y+8),g}function J_(r,t,e){let n=t.las?.extraBytes||[],s=new Set;return n.map(i=>{if(s.has(i.attribute))throw new Error(`LASWriter: duplicate Extra Bytes attribute ${i.attribute}`);s.add(i.attribute);let o=r.attributes[i.attribute];if(!o)throw new Error(`LASWriter: Extra Bytes attribute ${i.attribute} is missing`);if(![1,3].includes(o.size))throw new Error(`LASWriter: Extra Bytes attribute ${i.attribute} must have size 1 or 3`);if(o.value.length<e*o.size)throw new Error(`LASWriter: Extra Bytes attribute ${i.attribute} is too short`);mx(i.attribute,o);let a=Q_(o.value,o.size);return{...i,meshAttribute:o,dataType:a,byteLength:t2(a,o.size),componentCount:o.size}})}function Q_(r,t){let e=0;if(r instanceof Uint8Array?e=1:r instanceof Int8Array?e=2:r instanceof Uint16Array?e=3:r instanceof Int16Array?e=4:r instanceof Uint32Array?e=5:r instanceof Int32Array?e=6:r instanceof BigUint64Array?e=7:r instanceof BigInt64Array?e=8:r instanceof Float32Array?e=9:r instanceof Float64Array&&(e=10),e)return e+(t===3?20:0);throw new Error("LASWriter: Extra Bytes attributes require a supported typed array")}function t2(r,t){let e=r>20?r-20:r>10?r-10:r;return(e<=2?1:e<=4?2:e<=6||e===9?4:8)*t}function e2(r){if(r.length===0)return new Uint8Array(0);let t=new Uint8Array(r.length*Ym),e=new DataView(t.buffer),n=0;for(let o of r)e.setUint8(n+2,o.dataType),jn(e,n+4,o.name||o.attribute,32),jn(e,n+160,o.description||"",32),n+=Ym;let s=new Uint8Array(_f+t.byteLength),i=new DataView(s.buffer);return jn(i,2,"LASF_Spec",16),i.setUint16(18,4,!0),i.setUint16(20,t.byteLength,!0),jn(i,22,"Extra Bytes",32),s.set(t,_f),s}function hx(r,t){let e=[];t.las?.wktMathTransform&&e.push(cx(2111,"WKT Math Transform",t.las.wktMathTransform)),t.las?.wkt&&e.push(cx(2112,"WKT Coordinate System",t.las.wkt));let n=e2(r);n.byteLength&&e.push(n);let s=e.reduce((a,c)=>a+c.byteLength,0),i=new Uint8Array(s),o=0;for(let a of e)i.set(a,o),o+=a.byteLength;return i}function cx(r,t,e){let n=new TextEncoder().encode(`${e}\0`);if(n.byteLength>65535)throw new Error(`LASWriter: WKT VLR ${r} exceeds the LAS VLR size limit`);let s=new Uint8Array(_f+n.byteLength),i=new DataView(s.buffer);return jn(i,2,"LASF_Projection",16),i.setUint16(18,r,!0),i.setUint16(20,n.byteLength,!0),jn(i,22,t,32),s.set(n,_f),s}function dx(r,t){return(t.las?.wktMathTransform?1:0)+(t.las?.wkt?1:0)+(r.length?1:0)}function r2(r,t){if(!r)return{minimum:0,maximum:0};let e=Number(r.value[0]),n=e;for(let s=1;s<t;s++){let i=Number(r.value[s*r.size]);e=Math.min(e,i),n=Math.max(n,i)}return{minimum:e,maximum:n}}function n2(r){let t=r.length*Ym;if(t>65535)throw new Error(`LASWriter: Extra Bytes VLR payload ${t} exceeds the LAS limit`)}function s2(r,t,e){if(t===1&&!["1.1","1.2","1.3","1.4","1.5"].includes(r))throw new Error(`LASWriter: LAZ PDRF 1 output requires LAS 1.1 or newer; received ${r}`);if(t>=2&&t<=3&&!["1.2","1.3","1.4","1.5"].includes(r))throw new Error(`LASWriter: LAZ PDRF ${t} output requires LAS 1.2 or newer; received ${r}`);if(t>=4&&t<=5&&!["1.3","1.4","1.5"].includes(r))throw new Error(`LASWriter: LAZ PDRF ${t} requires LAS 1.3 or newer; received ${r}`);if(t>=6&&!["1.4","1.5"].includes(r))throw new Error(`LASWriter: LAZ output requires LAS 1.4; received ${r}`);if(![0,1,2,3,4,5,6,7,8,9,10].includes(t))throw new Error(`LASWriter: LAZ output currently supports point data record formats 0-10; received ${t}`);if(e!==void 0&&(!Number.isInteger(e)||e<=0||e>4294967295))throw new Error(`LASWriter: invalid LAZ chunk size ${e}`)}function i2(r){return"attributes"in r?r:ne(r)}function o2(r){return"attributes"in r?Pe(r):r}function a2(r){if(r.length===0)throw new Error("LASWriter: at least one input batch is required");if(r.length===1)return r[0];let t=r.map(s=>ne(o2(s))),e=t[0],n={};c2(t);for(let s of Object.keys(e.attributes)){let i=e.attributes[s],o=t.map(f=>f.attributes[s]?.value);if(o.some(f=>!f))continue;let a=o.reduce((f,h)=>f+h.length,0),c=i.value.constructor,l=new c(a),u=0;for(let f of o)l.set(f,u),u+=f.length;n[s]={...i,value:l}}return{...e,attributes:n,header:{...e.header,vertexCount:px({...e,attributes:n},"POSITION").value.length/3}}}function c2(r){let t=Object.keys(r[0].attributes);for(let e of r.slice(1)){if(Object.keys(e.attributes).length!==t.length||t.some(s=>!e.attributes[s]))throw new Error("LASWriter: encodeInBatches requires consistent attribute names");for(let s of t){let i=r[0].attributes[s],o=e.attributes[s];if(o.size!==i.size||o.value.constructor!==i.value.constructor)throw new Error(`LASWriter: encodeInBatches requires a consistent ${s} layout`)}}}function px(r,t){let e=r.attributes[t];if(!e)throw new Error(`LASWriter: ${t} attribute is required`);return e}function l2(r){if(r.size!==3)throw new Error("LASWriter: POSITION attribute must have size 3");if(r.value.length%r.size!==0)throw new Error("LASWriter: POSITION attribute length must be divisible by its size")}function u2(r,t,e,n){for(let s=0;s<3;s++){if(!Number.isFinite(e[s])||e[s]<=0)throw new Error("LASWriter: coordinate scale must be finite and positive");if(!Number.isFinite(n[s]))throw new Error("LASWriter: coordinate offset must be finite")}for(let s=0;s<t;s++)for(let i=0;i<3;i++){let o=r.value[s*r.size+i];if(!Number.isFinite(o))throw new Error("LASWriter: POSITION values must be finite");let a=Math.round((o-n[i])/e[i]);if(a<-2147483648||a>2147483647)throw new Error("LASWriter: encoded coordinate exceeds the signed 32-bit LAS range")}}function f2(r,t){let e=["intensity","classification","gpsTime","scanAngle","userData","pointSourceId","returnNumber","numberOfReturns","scannerChannel","scanDirectionFlag","edgeOfFlightLine","synthetic","keyPoint","withheld","overlap","nir","wavePacketDescriptorIndex","wavePacketOffset","wavePacketSize","wavePacketReturnPoint"];for(let i of e){let o=r.attributes[i];o&&qm(i,o,t,1)}let n=r.attributes.COLOR_0;n&&qm("COLOR_0",n,t,3,!1);let s=r.attributes.wavePacketVector;s&&qm("wavePacketVector",s,t,3)}function h2(r,t,e){let n=e>=6?15:5,s=r.attributes.returnNumber,i=r.attributes.numberOfReturns;for(let o=0;o<t;o++){let a=hr(s,o,1),c=hr(i,o,1);if(a<1||a>n)throw new Error(`LASWriter: returnNumber must be between 1 and ${n} for point data record format ${e}`);if(c<1||c>n)throw new Error(`LASWriter: numberOfReturns must be between 1 and ${n} for point data record format ${e}`);if(a>c)throw new Error("LASWriter: returnNumber cannot exceed numberOfReturns")}}function qm(r,t,e,n,s=!0){if(n===1?t.size!==1:t.size<n)throw new Error(`LASWriter: ${r} attribute must have size ${n}`);if(mx(r,t),s&&t.value.length<e*t.size)throw new Error(`LASWriter: ${r} attribute is too short`);if(!s&&t.value.length<t.size)throw new Error(`LASWriter: ${r} attribute is too short`)}function mx(r,t){for(let e of t.value)if(!Number.isFinite(Number(e)))throw new Error(`LASWriter: ${r} attribute must contain finite values`)}function yx(r,t){let[e,n]=t.version.split(".").map(Number);jn(r,0,"LASF",4),r.setUint8(24,e),r.setUint8(25,n),jn(r,26,"loaders.gl",32),jn(r,58,"loaders.gl",32),r.setUint16(94,t.headerLength,!0),r.setUint32(96,t.pointDataOffset,!0),r.setUint32(100,t.vlrCount||0,!0),r.setUint8(104,t.pointDataRecordFormat|(t.compressed?128:0)),r.setUint16(105,t.pointDataRecordLength,!0);let s=t.version==="1.4"||t.version==="1.5";r.setUint32(107,s?0:t.vertexCount,!0);for(let i=0;i<5;i++)r.setUint32(111+i*4,s?0:t.returnCounts[i],!0);if(t.version==="1.5"?r.setUint16(6,16|(t.hasGpsTime?1:0)|(t.timeOffset?64:0),!0):t.version==="1.4"&&t.hasWkt&&r.setUint16(6,16,!0),r.setFloat64(131,t.scale[0],!0),r.setFloat64(139,t.scale[1],!0),r.setFloat64(147,t.scale[2],!0),r.setFloat64(155,t.offset[0],!0),r.setFloat64(163,t.offset[1],!0),r.setFloat64(171,t.offset[2],!0),r.setFloat64(179,t.boundingBox[1][0],!0),r.setFloat64(187,t.boundingBox[0][0],!0),r.setFloat64(195,t.boundingBox[1][1],!0),r.setFloat64(203,t.boundingBox[0][1],!0),r.setFloat64(211,t.boundingBox[1][2],!0),r.setFloat64(219,t.boundingBox[0][2],!0),s){Hm(r,247,t.vertexCount);for(let i=0;i<Zm;i++)Hm(r,255+i*8,t.returnCounts[i])}t.version==="1.5"&&(r.setFloat64(375,t.maxGpsTime,!0),r.setFloat64(383,t.minGpsTime,!0),r.setUint16(391,t.timeOffset,!0))}function d2(r,t,e,n,s,i){if(r.setUint16(t+12,If(i.intensityAttribute,e),!0),n<=5){let o=hr(i.returnNumberAttribute,e,1)&7,a=hr(i.numberOfReturnsAttribute,e,1)&7;r.setUint8(t+14,o|a<<3),r.setUint8(t+15,hr(i.classificationAttribute,e)&31),r.setInt8(t+16,ux(i.scanAngleAttribute,e)),r.setUint8(t+17,hr(i.userDataAttribute,e)),r.setUint16(t+18,If(i.pointSourceIdAttribute,e),!0),(n===1||n===3||n>=4)&&r.setFloat64(t+20,Lf(i.gpsTimeAttribute,e),!0),(n===4||n===5)&&lx(r,t+(n===4?28:34),e,i)}else{let o=hr(i.returnNumberAttribute,e,1)&15,a=hr(i.numberOfReturnsAttribute,e,1)&15,c=hr(i.scannerChannelAttribute,e)&3,l=o|a<<4,u=(da(i.syntheticAttribute,e)?1:0)|(da(i.keyPointAttribute,e)?2:0)|(da(i.withheldAttribute,e)?4:0)|(da(i.overlapAttribute,e)?8:0)|c<<4|(da(i.scanDirectionFlagAttribute,e)?64:0)|(da(i.edgeOfFlightLineAttribute,e)?128:0);r.setUint8(t+14,l),r.setUint8(t+15,u),r.setUint8(t+16,hr(i.classificationAttribute,e)),r.setUint8(t+17,hr(i.userDataAttribute,e)),r.setInt16(t+18,ux(i.scanAngleAttribute,e),!0),r.setUint16(t+20,If(i.pointSourceIdAttribute,e),!0),r.setFloat64(t+22,Lf(i.gpsTimeAttribute,e),!0),(n===9||n===10)&&lx(r,t+(n===9?30:38),e,i)}y2(r,t,e,n,i.colorAttribute,i.colorDepth),(n===8||n===10)&&r.setUint16(t+36,If(i.nirAttribute,e),!0),p2(r,t,e,s,i.extraByteFields)}function lx(r,t,e,n){r.setUint8(t,hr(n.waveformDescriptorAttribute,e)),r.setBigUint64(t+1,x2(n.waveformOffsetAttribute,e),!0),r.setUint32(t+9,w2(n.waveformSizeAttribute,e),!0),r.setFloat32(t+13,Lf(n.waveformReturnPointAttribute,e),!0);for(let s=0;s<3;s++)r.setFloat32(t+17+s*4,Hr(n.waveformVectorAttribute,e,s),!0)}function p2(r,t,e,n,s){let i=t+n;for(let o of s)for(let a=0;a<o.componentCount;a++)m2(r,i,e,a,o),i+=o.byteLength/o.componentCount}function m2(r,t,e,n,s){let i=s.meshAttribute.value[e*s.componentCount+n];switch(s.dataType>20?s.dataType-20:s.dataType>10?s.dataType-10:s.dataType){case 1:r.setUint8(t,Number(i));break;case 2:r.setInt8(t,Number(i));break;case 3:r.setUint16(t,Number(i),!0);break;case 4:r.setInt16(t,Number(i),!0);break;case 5:r.setUint32(t,Number(i),!0);break;case 6:r.setInt32(t,Number(i),!0);break;case 7:r.setBigUint64(t,BigInt(i),!0);break;case 8:r.setBigInt64(t,BigInt(i),!0);break;case 9:r.setFloat32(t,Number(i),!0);break;case 10:r.setFloat64(t,Number(i),!0);break;default:throw new Error(`LASWriter: unsupported Extra Bytes data type ${s.dataType}`)}}function y2(r,t,e,n,s,i){let o=g2(n);o<0||!s||(r.setUint16(t+o,Wm(s,e,0,i),!0),r.setUint16(t+o+2,Wm(s,e,1,i),!0),r.setUint16(t+o+4,Wm(s,e,2,i),!0))}function g2(r){switch(r){case 2:return 20;case 3:return 28;case 5:return 57;case 7:case 8:case 10:return 30;default:return-1}}function b2(r,t){return r.las?.format==="laz"||r.las?.version==="1.4"?t?7:6:t?2:0}function Hm(r,t,e){r.setUint32(t,e>>>0,!0),r.setUint32(t+4,Math.floor(e/2**32),!0)}function jn(r,t,e,n){if(/[^\x00-\x7f]/.test(e))throw new Error("LASWriter fixed-width text must be ASCII");for(let s=0;s<n;s++)r.setUint8(t+s,e.charCodeAt(s)||0)}function Hr(r,t,e){return r&&r.value[t*r.size+e]||0}function If(r,t){return r?Math.max(0,Math.min(65535,Math.round(Hr(r,t,0)))):0}function w2(r,t){return r?Math.max(0,Math.min(4294967295,Math.round(Hr(r,t,0)))):0}function x2(r,t){if(!r)return 0n;let e=r.value[t*r.size];return typeof e=="bigint"?e:BigInt(Math.max(0,Math.round(Number(e))))}function hr(r,t,e=0){return r?Math.max(0,Math.min(255,Math.round(Hr(r,t,0)))):e}function ux(r,t){return r?Math.max(-32768,Math.min(32767,Math.round(Hr(r,t,0)))):0}function Lf(r,t){return r?Hr(r,t,0):0}function da(r,t){return!!Lf(r,t)}function A2(r,t){let e=new Array(Zm).fill(0);for(let n=0;n<t;n++){let s=hr(r,n,1)&15;s>=1&&s<=Zm&&e[s-1]++}return e}function Wm(r,t,e,n){let s=Hr(r,t,e);return r.normalized?v2(r,s):n===8?pa(s*257):n===16?pa(s):s<=1?pa(s*65535):s<=255?pa(s*257):pa(s)}function v2(r,t){let e=S2(r.value);return pa(t/e*65535)}function S2(r){return r instanceof Uint8Array||r instanceof Uint8ClampedArray?255:r instanceof Uint16Array?65535:1}function pa(r){return Math.max(0,Math.min(65535,Math.round(r)))}function B2(r,t){if(t===0)return[[0,0,0],[0,0,0]];let e=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],n=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let s=0;s<t;s++)for(let i=0;i<3;i++){let o=Hr(r,s,i);e[i]=Math.min(e[i],o),n[i]=Math.max(n[i],o)}return[e,n]}function I2(r,t){return t.las?.scale||gx(r.schema.metadata?.las_scale)||[.001,.001,.001]}function _2(r,t,e){return t.las?.offset||gx(r.schema.metadata?.las_offset)||e[0]}function gx(r){if(typeof r=="string")try{let t=JSON.parse(r);return Array.isArray(t)&&t.length===3&&t.every(e=>typeof e=="number")?[t[0],t[1],t[2]]:void 0}catch{return}}var ma={name:"PCD (Point Cloud Data)",id:"pcd",module:"pointclouds",encoding:"text",format:"pcd",extensions:["pcd"],mimeTypes:["text/plain"],category:"pointcloud",text:!0,binary:!0};oi();var V2=typeof __VERSION__<"u"?__VERSION__:"latest";async function G2(){let{PCDLoaderWithParser:r}=await Promise.resolve().then(()=>(Jm(),Km));return r}var Cx={defaultShape:"arrow",supportsNativeArrow:!0,...ma,dataType:null,batchType:null,version:V2,worker:!0,workerInBatches:!0,serializeWorkerResult:se,options:{pcd:{shape:"arrow",colorFormat:"uint8norm"}},preload:G2};$t();var j2=typeof __VERSION__<"u"?__VERSION__:"latest",Ex={...ma,dataType:null,batchType:null,version:j2,options:{pcd:{}},text:!0,encode:async(r,t)=>Fx(r,t),encodeSync:Fx,encodeTextSync:Ox};function Fx(r,t){let e=Ox(r,t);return new TextEncoder().encode(e).buffer}function Ox(r,t){let e=ne($2(r)),n=q2(e,"POSITION"),s=e.attributes.NORMAL,i=e.attributes.COLOR_0,o=n.value.length/n.size,a=["x","y","z"],c=["4","4","4"],l=["F","F","F"],u=["1","1","1"];s&&(a.push("normal_x","normal_y","normal_z"),c.push("4","4","4"),l.push("F","F","F"),u.push("1","1","1")),i&&(a.push("rgb"),c.push("4"),l.push("F"),u.push("1"));let f=["# .PCD v0.7 - Point Cloud Data file generated by loaders.gl","VERSION 0.7",`FIELDS ${a.join(" ")}`,`SIZE ${c.join(" ")}`,`TYPE ${l.join(" ")}`,`COUNT ${u.join(" ")}`,`WIDTH ${o}`,"HEIGHT 1","VIEWPOINT 0 0 0 1 0 0 0",`POINTS ${o}`,"DATA ascii"];for(let h=0;h<o;h++){let p=[mo(n,h,0),mo(n,h,1),mo(n,h,2)];s&&p.push(mo(s,h,0),mo(s,h,1),mo(s,h,2)),i&&p.push(W2(i,h)),f.push(p.join(" "))}return`${f.join(`
42
+ `)}
43
+ `}function $2(r){return"attributes"in r?Pe(r):r}function q2(r,t){let e=r.attributes[t];if(!e)throw new Error(`PCDWriter: ${t} attribute is required`);return e}function mo(r,t,e){return r.value[t*r.size+e]||0}function W2(r,t){let e=new Uint8Array(4);return e[0]=ry(r,t,0),e[1]=ry(r,t,1),e[2]=ry(r,t,2),new DataView(e.buffer).getFloat32(0,!0)}function ry(r,t,e){let n=mo(r,t,e),s=r.normalized||n<=1?n*255:n;return Math.max(0,Math.min(255,Math.round(s)))}var ga={name:"PLY",id:"ply",module:"pointclouds",encoding:"text",format:"ply",extensions:["ply"],mimeTypes:["text/plain","application/octet-stream"],text:!0,binary:!0,tests:["ply"]};oi();var yT=typeof __VERSION__<"u"?__VERSION__:"latest";async function gT(){let{PLYLoaderWithParser:r}=await Promise.resolve().then(()=>(gy(),yy));return r}var uA={defaultShape:"arrow",supportsNativeArrow:!0,dataType:null,batchType:null,...ga,version:yT,worker:!0,workerInBatches:!0,serializeWorkerResult:se,options:{ply:{shape:"arrow",colorFormat:"uint8norm"}},preload:gT};$t();var bT=typeof __VERSION__<"u"?__VERSION__:"latest",hA={...ga,dataType:null,batchType:null,version:bT,options:{ply:{}},text:!0,encode:async(r,t)=>fA(r,t),encodeSync:fA,encodeTextSync:dA};function fA(r,t){let e=dA(r,t);return new TextEncoder().encode(e).buffer}function dA(r,t){let e=ne(wT(r)),n=xT(e,"POSITION"),s=e.attributes.NORMAL,i=e.attributes.TEXCOORD_0,o=e.attributes.COLOR_0,a=vT(e),c=n.value.length/n.size,l=ST(e,c),u=AT(c,l.length/3,!!s,!!i,!!o,a),f=[];for(let h=0;h<c;h++){let p=[hn(n,h,0),hn(n,h,1),hn(n,h,2)];s&&p.push(hn(s,h,0),hn(s,h,1),hn(s,h,2)),i&&p.push(hn(i,h,0),hn(i,h,1)),o&&p.push(xy(o,h,0),xy(o,h,1),xy(o,h,2));for(let[,y]of a)p.push(hn(y,h,0));f.push(p.join(" "))}for(let h=0;h<l.length;h+=3)f.push(`3 ${l[h]} ${l[h+1]} ${l[h+2]}`);return`${u.concat(f).join(`
44
+ `)}
45
+ `}function wT(r){return"attributes"in r?Pe(r):r}function xT(r,t){let e=r.attributes[t];if(!e)throw new Error(`PLYWriter: ${t} attribute is required`);return e}function AT(r,t,e,n,s,i){let o=["ply","format ascii 1.0","comment generated by loaders.gl",`element vertex ${r}`,"property float x","property float y","property float z"];e&&o.push("property float nx","property float ny","property float nz"),n&&o.push("property float s","property float t"),s&&o.push("property uchar red","property uchar green","property uchar blue");for(let[a]of i)o.push(`property float ${a}`);return t>0&&o.push(`element face ${t}`,"property list uchar int vertex_indices"),o.push("end_header"),o}function vT(r){let t=new Set(["POSITION","NORMAL","TEXCOORD_0","COLOR_0"]);return Object.entries(r.attributes).filter(([e,n])=>!t.has(e)&&n.size===1)}function hn(r,t,e){return r.value[t*r.size+e]||0}function xy(r,t,e){let n=hn(r,t,e),s=r.normalized||n<=1?n*255:n;return Math.max(0,Math.min(255,Math.round(s)))}function ST(r,t){if(r.indices?.value?.length)return Array.from(r.indices.value);if(r.mode!==4&&r.topology!=="triangle-list")return[];let e=[];for(let n=0;n+2<t;n+=3)e.push(n,n+1,n+2);return e}return bA(BT);})();
46
+ /** Parse compressed PCD data in in binary_compressed form ( https://pointclouds.org/documentation/tutorials/pcd_file_format.html)
47
+ * from https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PCDLoader.js
48
+ * @license MIT (http://opensource.org/licenses/MIT)
49
+ * @param pcdHeader
50
+ * @param data
51
+ * @returns [attributes]
52
+ */
53
+ return __exports__;
54
+ });