@loaders.gl/core 5.0.0-beta.1 → 5.0.0-beta.11

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 (910) hide show
  1. package/GEOARROW-README.md +1 -1
  2. package/README.md +4 -2
  3. package/SCAN-README.md +3 -3
  4. package/SCHEMA-UTILS-README.md +1 -1
  5. package/dist/arrow-geometry/binary-geometry-to-wkb.cjs +2 -2
  6. package/dist/arrow-geometry/binary-geometry-to-wkb.cjs.map +2 -2
  7. package/dist/arrow-geometry/binary-geometry-to-wkb.js +1 -1
  8. package/dist/arrow-geometry/binary-geometry-to-wkb.js.map +1 -1
  9. package/dist/arrow-geometry/feature-collection-to-arrow.cjs.map +2 -2
  10. package/dist/arrow-geometry/feature-collection-to-arrow.d.ts +4 -3
  11. package/dist/arrow-geometry/feature-collection-to-arrow.d.ts.map +1 -1
  12. package/dist/arrow-geometry/feature-collection-to-arrow.js +1 -1
  13. package/dist/arrow-geometry/feature-collection-to-arrow.js.map +1 -1
  14. package/dist/arrow-geometry/feature-table.cjs +2 -6
  15. package/dist/arrow-geometry/feature-table.cjs.map +2 -2
  16. package/dist/arrow-geometry/feature-table.d.ts +6 -5
  17. package/dist/arrow-geometry/feature-table.d.ts.map +1 -1
  18. package/dist/arrow-geometry/feature-table.js +5 -9
  19. package/dist/arrow-geometry/feature-table.js.map +1 -1
  20. package/dist/arrow-geometry/geojson-table.cjs +295 -18
  21. package/dist/arrow-geometry/geojson-table.cjs.map +3 -3
  22. package/dist/arrow-geometry/geojson-table.d.ts +10 -3
  23. package/dist/arrow-geometry/geojson-table.d.ts.map +1 -1
  24. package/dist/arrow-geometry/geojson-table.js +23 -13
  25. package/dist/arrow-geometry/geojson-table.js.map +1 -1
  26. package/dist/arrow-geometry/geometry-codecs.cjs +6 -6
  27. package/dist/arrow-geometry/geometry-codecs.cjs.map +2 -2
  28. package/dist/arrow-geometry/geometry-codecs.js +1 -1
  29. package/dist/arrow-geometry/geometry-codecs.js.map +1 -1
  30. package/dist/arrow-geometry/geometry-to-wkt.cjs +2 -2
  31. package/dist/arrow-geometry/geometry-to-wkt.cjs.map +2 -2
  32. package/dist/arrow-geometry/geometry-to-wkt.js +1 -1
  33. package/dist/arrow-geometry/geometry-to-wkt.js.map +1 -1
  34. package/dist/arrow-geometry/index.cjs +0 -11
  35. package/dist/arrow-geometry/index.cjs.map +2 -2
  36. package/dist/arrow-geometry/index.d.ts +0 -1
  37. package/dist/arrow-geometry/index.d.ts.map +1 -1
  38. package/dist/arrow-geometry/index.js +0 -1
  39. package/dist/arrow-geometry/index.js.map +1 -1
  40. package/dist/arrow-geometry/wkb-arrow-utils.cjs +1 -5
  41. package/dist/arrow-geometry/wkb-arrow-utils.cjs.map +2 -2
  42. package/dist/arrow-geometry/wkb-arrow-utils.d.ts +7 -7
  43. package/dist/arrow-geometry/wkb-arrow-utils.d.ts.map +1 -1
  44. package/dist/arrow-geometry/wkb-arrow-utils.js +4 -8
  45. package/dist/arrow-geometry/wkb-arrow-utils.js.map +1 -1
  46. package/dist/arrow-geometry/wkb-builder.cjs +3 -3
  47. package/dist/arrow-geometry/wkb-builder.cjs.map +2 -2
  48. package/dist/arrow-geometry/wkb-builder.d.ts +1 -1
  49. package/dist/arrow-geometry/wkb-builder.d.ts.map +1 -1
  50. package/dist/arrow-geometry/wkb-builder.js +1 -1
  51. package/dist/arrow-geometry/wkb-builder.js.map +1 -1
  52. package/dist/arrow-geometry/wkb-statistics.cjs +2 -2
  53. package/dist/arrow-geometry/wkb-statistics.cjs.map +2 -2
  54. package/dist/arrow-geometry/wkb-statistics.js +1 -1
  55. package/dist/arrow-geometry/wkb-statistics.js.map +1 -1
  56. package/dist/arrow-worker-transport.cjs +105 -0
  57. package/dist/arrow-worker-transport.cjs.map +6 -0
  58. package/dist/arrow-worker-transport.d.ts +11 -0
  59. package/dist/arrow-worker-transport.d.ts.map +1 -0
  60. package/dist/arrow-worker-transport.js +77 -0
  61. package/dist/arrow-worker-transport.js.map +1 -0
  62. package/dist/cluster-source.cjs +6874 -0
  63. package/dist/cluster-source.cjs.map +6 -0
  64. package/dist/cluster-source.d.ts +2 -0
  65. package/dist/cluster-source.d.ts.map +1 -0
  66. package/dist/cluster-source.js +2 -0
  67. package/dist/cluster-source.js.map +1 -0
  68. package/dist/dist.dev.js +3040 -817
  69. package/dist/dist.min.js +3 -3
  70. package/dist/federated-table-scan-source.cjs +2409 -0
  71. package/dist/federated-table-scan-source.cjs.map +6 -0
  72. package/dist/federated-table-scan-source.d.ts +2 -0
  73. package/dist/federated-table-scan-source.d.ts.map +1 -0
  74. package/dist/federated-table-scan-source.js +2 -0
  75. package/dist/federated-table-scan-source.js.map +1 -0
  76. package/dist/geoarrow/binary-polygon-to-geoarrow.cjs +2 -2
  77. package/dist/geoarrow/binary-polygon-to-geoarrow.cjs.map +2 -2
  78. package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts +1 -1
  79. package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts.map +1 -1
  80. package/dist/geoarrow/binary-polygon-to-geoarrow.js +1 -1
  81. package/dist/geoarrow/binary-polygon-to-geoarrow.js.map +1 -1
  82. package/dist/geoarrow/clustering/cluster-source.cjs +16 -19
  83. package/dist/geoarrow/clustering/cluster-source.cjs.map +2 -2
  84. package/dist/geoarrow/clustering/cluster-source.d.ts +3 -2
  85. package/dist/geoarrow/clustering/cluster-source.d.ts.map +1 -1
  86. package/dist/geoarrow/clustering/cluster-source.js +13 -18
  87. package/dist/geoarrow/clustering/cluster-source.js.map +1 -1
  88. package/dist/geoarrow/convert-table-to-geoarrow.cjs +5 -12
  89. package/dist/geoarrow/convert-table-to-geoarrow.cjs.map +2 -2
  90. package/dist/geoarrow/convert-table-to-geoarrow.d.ts +6 -6
  91. package/dist/geoarrow/convert-table-to-geoarrow.d.ts.map +1 -1
  92. package/dist/geoarrow/convert-table-to-geoarrow.js +8 -14
  93. package/dist/geoarrow/convert-table-to-geoarrow.js.map +1 -1
  94. package/dist/geoarrow/geoarrow-bounds.cjs +7 -7
  95. package/dist/geoarrow/geoarrow-bounds.cjs.map +2 -2
  96. package/dist/geoarrow/geoarrow-bounds.js +3 -3
  97. package/dist/geoarrow/geoarrow-bounds.js.map +1 -1
  98. package/dist/geoarrow/geoarrow-capabilities.cjs +2 -2
  99. package/dist/geoarrow/geoarrow-capabilities.cjs.map +2 -2
  100. package/dist/geoarrow/geoarrow-capabilities.js +1 -1
  101. package/dist/geoarrow/geoarrow-capabilities.js.map +1 -1
  102. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs +8 -8
  103. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs.map +2 -2
  104. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js +2 -2
  105. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js.map +1 -1
  106. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs +6 -4
  107. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs.map +2 -2
  108. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts +3 -3
  109. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts.map +1 -1
  110. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js +9 -4
  111. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js.map +1 -1
  112. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs +5 -4
  113. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs.map +2 -2
  114. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +3 -3
  115. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts.map +1 -1
  116. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js +5 -4
  117. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js.map +1 -1
  118. package/dist/geoarrow/geoarrow-inspection.cjs +2 -2
  119. package/dist/geoarrow/geoarrow-inspection.cjs.map +2 -2
  120. package/dist/geoarrow/geoarrow-inspection.js +1 -1
  121. package/dist/geoarrow/geoarrow-inspection.js.map +1 -1
  122. package/dist/geoarrow/geoarrow-stream.cjs +11 -12
  123. package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
  124. package/dist/geoarrow/geoarrow-stream.d.ts +2 -2
  125. package/dist/geoarrow/geoarrow-stream.d.ts.map +1 -1
  126. package/dist/geoarrow/geoarrow-stream.js +10 -13
  127. package/dist/geoarrow/geoarrow-stream.js.map +1 -1
  128. package/dist/geoarrow/get-geoarrow-vertex-count.cjs +2 -2
  129. package/dist/geoarrow/get-geoarrow-vertex-count.cjs.map +2 -2
  130. package/dist/geoarrow/get-geoarrow-vertex-count.js +1 -1
  131. package/dist/geoarrow/get-geoarrow-vertex-count.js.map +1 -1
  132. package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.cjs.map +1 -1
  133. package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.js +3 -3
  134. package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.js.map +1 -1
  135. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs +4 -8
  136. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs.map +2 -2
  137. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.d.ts.map +1 -1
  138. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js +4 -8
  139. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js.map +1 -1
  140. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs +4 -4
  141. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs.map +2 -2
  142. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js +1 -1
  143. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js.map +1 -1
  144. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs +3 -3
  145. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs.map +2 -2
  146. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js +1 -1
  147. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js.map +1 -1
  148. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs +3 -3
  149. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs.map +2 -2
  150. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js +1 -1
  151. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js.map +1 -1
  152. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs +0 -6
  153. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs.map +2 -2
  154. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts +5 -3
  155. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts.map +1 -1
  156. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js +0 -6
  157. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js.map +1 -1
  158. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs +3 -2
  159. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs.map +2 -2
  160. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.d.ts.map +1 -1
  161. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js +3 -2
  162. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js.map +1 -1
  163. package/dist/geoarrow/metadata/geoarrow-metadata.cjs +44 -2
  164. package/dist/geoarrow/metadata/geoarrow-metadata.cjs.map +4 -4
  165. package/dist/geoarrow/metadata/geoarrow-metadata.d.ts.map +1 -1
  166. package/dist/geoarrow/metadata/geoarrow-metadata.js +3 -4
  167. package/dist/geoarrow/metadata/geoarrow-metadata.js.map +1 -1
  168. package/dist/index.cjs +746 -1365
  169. package/dist/index.cjs.map +3 -3
  170. package/dist/index.d.ts +2 -4
  171. package/dist/index.d.ts.map +1 -1
  172. package/dist/index.js +2 -5
  173. package/dist/index.js.map +1 -1
  174. package/dist/lib/api/create-data-source.d.ts +20 -9
  175. package/dist/lib/api/create-data-source.d.ts.map +1 -1
  176. package/dist/lib/api/create-data-source.js +55 -45
  177. package/dist/lib/api/create-data-source.js.map +1 -1
  178. package/dist/lib/api/encode.d.ts +1 -1
  179. package/dist/lib/api/encode.d.ts.map +1 -1
  180. package/dist/lib/api/encode.js +11 -2
  181. package/dist/lib/api/encode.js.map +1 -1
  182. package/dist/lib/api/load-in-batches.d.ts +3 -2
  183. package/dist/lib/api/load-in-batches.d.ts.map +1 -1
  184. package/dist/lib/api/load-in-batches.js.map +1 -1
  185. package/dist/lib/api/load-loader.d.ts +3 -3
  186. package/dist/lib/api/load-loader.d.ts.map +1 -1
  187. package/dist/lib/api/load-loader.js +15 -19
  188. package/dist/lib/api/load-loader.js.map +1 -1
  189. package/dist/lib/api/load.d.ts +7 -3
  190. package/dist/lib/api/load.d.ts.map +1 -1
  191. package/dist/lib/api/load.js +15 -67
  192. package/dist/lib/api/load.js.map +1 -1
  193. package/dist/lib/api/loader-options.d.ts +6 -0
  194. package/dist/lib/api/loader-options.d.ts.map +1 -1
  195. package/dist/lib/api/loader-options.js +48 -0
  196. package/dist/lib/api/loader-options.js.map +1 -1
  197. package/dist/lib/api/parse-file.d.ts +5 -3
  198. package/dist/lib/api/parse-file.d.ts.map +1 -1
  199. package/dist/lib/api/parse-file.js +8 -6
  200. package/dist/lib/api/parse-file.js.map +1 -1
  201. package/dist/lib/api/parse-in-batches.d.ts +5 -3
  202. package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
  203. package/dist/lib/api/parse-in-batches.js +60 -9
  204. package/dist/lib/api/parse-in-batches.js.map +1 -1
  205. package/dist/lib/api/parse-sync.d.ts +5 -3
  206. package/dist/lib/api/parse-sync.d.ts.map +1 -1
  207. package/dist/lib/api/parse-sync.js +3 -4
  208. package/dist/lib/api/parse-sync.js.map +1 -1
  209. package/dist/lib/api/parse.d.ts +5 -3
  210. package/dist/lib/api/parse.d.ts.map +1 -1
  211. package/dist/lib/api/parse.js +22 -14
  212. package/dist/lib/api/parse.js.map +1 -1
  213. package/dist/lib/api/select-loader.d.ts +4 -2
  214. package/dist/lib/api/select-loader.d.ts.map +1 -1
  215. package/dist/lib/api/select-loader.js +47 -53
  216. package/dist/lib/api/select-loader.js.map +1 -1
  217. package/dist/lib/api/select-source.d.ts.map +1 -1
  218. package/dist/lib/api/select-source.js +1 -1
  219. package/dist/lib/api/select-source.js.map +1 -1
  220. package/dist/lib/init.js +1 -1
  221. package/dist/lib/init.js.map +1 -1
  222. package/dist/lib/loader-utils/get-fetch-function.js +2 -2
  223. package/dist/lib/loader-utils/get-fetch-function.js.map +1 -1
  224. package/dist/lib/loader-utils/loggers.d.ts +2 -37
  225. package/dist/lib/loader-utils/loggers.d.ts.map +1 -1
  226. package/dist/lib/loader-utils/loggers.js +2 -63
  227. package/dist/lib/loader-utils/loggers.js.map +1 -1
  228. package/dist/lib/loader-utils/native-arrow.d.ts +13 -0
  229. package/dist/lib/loader-utils/native-arrow.d.ts.map +1 -0
  230. package/dist/lib/loader-utils/native-arrow.js +66 -0
  231. package/dist/lib/loader-utils/native-arrow.js.map +1 -0
  232. package/dist/lib/loader-utils/option-defaults.d.ts +3 -2
  233. package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -1
  234. package/dist/lib/loader-utils/option-defaults.js +9 -10
  235. package/dist/lib/loader-utils/option-defaults.js.map +1 -1
  236. package/dist/lib/loader-utils/option-utils.d.ts +0 -6
  237. package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
  238. package/dist/lib/loader-utils/option-utils.js +31 -114
  239. package/dist/lib/loader-utils/option-utils.js.map +1 -1
  240. package/dist/loader-utils/format-types.d.ts +3 -0
  241. package/dist/loader-utils/format-types.d.ts.map +1 -1
  242. package/dist/loader-utils/index.cjs +854 -1295
  243. package/dist/loader-utils/index.cjs.map +3 -3
  244. package/dist/loader-utils/index.d.ts +17 -8
  245. package/dist/loader-utils/index.d.ts.map +1 -1
  246. package/dist/loader-utils/index.js +9 -5
  247. package/dist/loader-utils/index.js.map +1 -1
  248. package/dist/loader-utils/json-loader.js +1 -1
  249. package/dist/loader-utils/json-loader.js.map +1 -1
  250. package/dist/loader-utils/lib/files/http-file-transport.d.ts +4 -0
  251. package/dist/loader-utils/lib/files/http-file-transport.d.ts.map +1 -1
  252. package/dist/loader-utils/lib/files/http-file-transport.js +45 -1
  253. package/dist/loader-utils/lib/files/http-file-transport.js.map +1 -1
  254. package/dist/loader-utils/lib/files/http-file-types.d.ts +2 -0
  255. package/dist/loader-utils/lib/files/http-file-types.d.ts.map +1 -1
  256. package/dist/loader-utils/lib/files/read-range-response.d.ts +3 -0
  257. package/dist/loader-utils/lib/files/read-range-response.d.ts.map +1 -0
  258. package/dist/loader-utils/lib/files/read-range-response.js +62 -0
  259. package/dist/loader-utils/lib/files/read-range-response.js.map +1 -0
  260. package/dist/loader-utils/lib/log-utils/log.d.ts +23 -1
  261. package/dist/loader-utils/lib/log-utils/log.d.ts.map +1 -1
  262. package/dist/loader-utils/lib/log-utils/log.js +32 -1
  263. package/dist/loader-utils/lib/log-utils/log.js.map +1 -1
  264. package/dist/loader-utils/lib/pace-batch-iterator.d.ts +14 -0
  265. package/dist/loader-utils/lib/pace-batch-iterator.d.ts.map +1 -0
  266. package/dist/loader-utils/lib/pace-batch-iterator.js +51 -0
  267. package/dist/loader-utils/lib/pace-batch-iterator.js.map +1 -0
  268. package/dist/loader-utils/lib/request-utils/request-credentials.js +1 -1
  269. package/dist/loader-utils/lib/request-utils/request-credentials.js.map +1 -1
  270. package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts +43 -0
  271. package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts.map +1 -0
  272. package/dist/loader-utils/lib/scan-utils/logical-table-query.js +104 -0
  273. package/dist/loader-utils/lib/scan-utils/logical-table-query.js.map +1 -0
  274. package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.d.ts → query-options.d.ts} +5 -8
  275. package/dist/loader-utils/lib/scan-utils/query-options.d.ts.map +1 -0
  276. package/dist/{schema-utils/lib/table/batch-builder/table-batch-aggregator.js → loader-utils/lib/scan-utils/query-options.js} +1 -1
  277. package/dist/loader-utils/lib/scan-utils/query-options.js.map +1 -0
  278. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +58 -18
  279. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -1
  280. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +17 -6
  281. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -1
  282. package/dist/loader-utils/lib/scan-utils/table-query.d.ts +54 -3
  283. package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -1
  284. package/dist/loader-utils/lib/scan-utils/table-query.js +6 -0
  285. package/dist/loader-utils/lib/scan-utils/table-query.js.map +1 -1
  286. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +18 -12
  287. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -1
  288. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +58 -29
  289. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -1
  290. package/dist/loader-utils/lib/sources/data-source.d.ts +4 -0
  291. package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -1
  292. package/dist/loader-utils/lib/sources/data-source.js +53 -14
  293. package/dist/loader-utils/lib/sources/data-source.js.map +1 -1
  294. package/dist/loader-utils/lib/sources/image-source.d.ts +1 -1
  295. package/dist/loader-utils/lib/sources/table-source-collection.d.ts +31 -0
  296. package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -0
  297. package/dist/loader-utils/lib/{scan-utils/experimental-scan-options.js → sources/table-source-collection.js} +1 -1
  298. package/dist/loader-utils/lib/sources/table-source-collection.js.map +1 -0
  299. package/dist/loader-utils/lib/sources/utils/utils.js +1 -1
  300. package/dist/loader-utils/lib/sources/utils/utils.js.map +1 -1
  301. package/dist/loader-utils/lib/sources/vector-source.d.ts +4 -3
  302. package/dist/loader-utils/lib/sources/vector-source.d.ts.map +1 -1
  303. package/dist/loader-utils/lib/sources/vector-tile-source.d.ts +4 -3
  304. package/dist/loader-utils/lib/sources/vector-tile-source.d.ts.map +1 -1
  305. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.d.ts.map +1 -1
  306. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js +2 -5
  307. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js.map +1 -1
  308. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.d.ts.map +1 -1
  309. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js +40 -21
  310. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
  311. package/dist/loader-utils/loader-types.d.ts +118 -91
  312. package/dist/loader-utils/loader-types.d.ts.map +1 -1
  313. package/dist/loader-utils/loader-types.js.map +1 -1
  314. package/dist/loader-utils/source-types.d.ts +7 -5
  315. package/dist/loader-utils/source-types.d.ts.map +1 -1
  316. package/dist/loader-utils/source-types.js +9 -1
  317. package/dist/loader-utils/source-types.js.map +1 -1
  318. package/dist/null-loader.d.ts +0 -18
  319. package/dist/null-loader.d.ts.map +1 -1
  320. package/dist/null-loader.js +1 -19
  321. package/dist/null-loader.js.map +1 -1
  322. package/dist/null-worker-node.js +771 -82
  323. package/dist/null-worker.js +742 -81
  324. package/dist/polyfills/images/encode-image-node.d.ts +18 -15
  325. package/dist/polyfills/images/encode-image-node.d.ts.map +1 -1
  326. package/dist/polyfills/images/encode-image-node.js +19 -33
  327. package/dist/polyfills/images/encode-image-node.js.map +1 -1
  328. package/dist/polyfills/images/image-codecs-node.d.ts +2 -6
  329. package/dist/polyfills/images/image-codecs-node.d.ts.map +1 -1
  330. package/dist/polyfills/images/image-codecs-node.js +2 -24
  331. package/dist/polyfills/images/image-codecs-node.js.map +1 -1
  332. package/dist/polyfills/images/load-sharp.d.ts +3 -0
  333. package/dist/polyfills/images/load-sharp.d.ts.map +1 -0
  334. package/dist/polyfills/images/load-sharp.js +11 -0
  335. package/dist/polyfills/images/load-sharp.js.map +1 -0
  336. package/dist/polyfills/images/node-image-bitmap.d.ts +1 -1
  337. package/dist/polyfills/images/node-image-bitmap.js +1 -1
  338. package/dist/polyfills/images/node-image-formats.d.ts +1 -1
  339. package/dist/polyfills/images/node-image-formats.d.ts.map +1 -1
  340. package/dist/polyfills/images/node-image-formats.js +10 -4
  341. package/dist/polyfills/images/node-image-formats.js.map +1 -1
  342. package/dist/polyfills/images/parse-image-node.d.ts +10 -2
  343. package/dist/polyfills/images/parse-image-node.d.ts.map +1 -1
  344. package/dist/polyfills/images/parse-image-node.js +20 -32
  345. package/dist/polyfills/images/parse-image-node.js.map +1 -1
  346. package/dist/polyfills/index.cjs +76 -151
  347. package/dist/polyfills/index.d.ts.map +1 -1
  348. package/dist/polyfills/index.js +2 -2
  349. package/dist/polyfills/index.js.map +1 -1
  350. package/dist/scan/arrow-execution/expressions.cjs +134 -0
  351. package/dist/scan/arrow-execution/expressions.cjs.map +7 -0
  352. package/dist/scan/arrow-execution/expressions.d.ts +11 -0
  353. package/dist/scan/arrow-execution/expressions.d.ts.map +1 -0
  354. package/dist/scan/arrow-execution/expressions.js +86 -0
  355. package/dist/scan/arrow-execution/expressions.js.map +1 -0
  356. package/dist/scan/arrow-execution/filter-arrow-table.cjs +255 -0
  357. package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +7 -0
  358. package/dist/scan/arrow-execution/filter-arrow-table.d.ts +18 -0
  359. package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -0
  360. package/dist/scan/arrow-execution/filter-arrow-table.js +224 -0
  361. package/dist/scan/arrow-execution/filter-arrow-table.js.map +1 -0
  362. package/dist/scan/arrow-execution/project-arrow-table.cjs +70 -0
  363. package/dist/scan/arrow-execution/project-arrow-table.cjs.map +7 -0
  364. package/dist/scan/arrow-execution/project-arrow-table.d.ts +8 -0
  365. package/dist/scan/arrow-execution/project-arrow-table.d.ts.map +1 -0
  366. package/dist/scan/arrow-execution/project-arrow-table.js +39 -0
  367. package/dist/scan/arrow-execution/project-arrow-table.js.map +1 -0
  368. package/dist/scan/arrow-execution.cjs +34 -0
  369. package/dist/scan/arrow-execution.cjs.map +7 -0
  370. package/dist/scan/arrow-execution.d.ts +4 -0
  371. package/dist/scan/arrow-execution.d.ts.map +1 -0
  372. package/dist/scan/arrow-execution.js +6 -0
  373. package/dist/scan/arrow-execution.js.map +1 -0
  374. package/dist/scan/arrow-query-worker-entry.cjs +121 -0
  375. package/dist/scan/arrow-query-worker-entry.cjs.map +7 -0
  376. package/dist/scan/arrow-query-worker-entry.d.ts +2 -0
  377. package/dist/scan/arrow-query-worker-entry.d.ts.map +1 -0
  378. package/dist/scan/arrow-query-worker-entry.js +7 -0
  379. package/dist/scan/arrow-query-worker-entry.js.map +1 -0
  380. package/dist/scan/arrow-query-worker.cjs +197 -0
  381. package/dist/scan/arrow-query-worker.cjs.map +7 -0
  382. package/dist/scan/arrow-query-worker.d.ts +47 -0
  383. package/dist/scan/arrow-query-worker.d.ts.map +1 -0
  384. package/dist/scan/arrow-query-worker.js +101 -0
  385. package/dist/scan/arrow-query-worker.js.map +1 -0
  386. package/dist/scan/arrow-query.cjs.map +1 -1
  387. package/dist/scan/arrow-query.d.ts +1 -1
  388. package/dist/scan/arrow-query.d.ts.map +1 -1
  389. package/dist/scan/catalog-query-source.cjs +122 -0
  390. package/dist/scan/catalog-query-source.cjs.map +7 -0
  391. package/dist/scan/catalog-query-source.d.ts +6 -0
  392. package/dist/scan/catalog-query-source.d.ts.map +1 -0
  393. package/dist/scan/catalog-query-source.js +115 -0
  394. package/dist/scan/catalog-query-source.js.map +1 -0
  395. package/dist/scan/federated-table-scan-source.cjs +42 -43
  396. package/dist/scan/federated-table-scan-source.cjs.map +2 -2
  397. package/dist/scan/federated-table-scan-source.d.ts +6 -10
  398. package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
  399. package/dist/scan/federated-table-scan-source.js +39 -40
  400. package/dist/scan/federated-table-scan-source.js.map +1 -1
  401. package/dist/scan/index.cjs +213 -6
  402. package/dist/scan/index.cjs.map +4 -4
  403. package/dist/scan/index.d.ts +15 -4
  404. package/dist/scan/index.d.ts.map +1 -1
  405. package/dist/scan/index.js +8 -2
  406. package/dist/scan/index.js.map +1 -1
  407. package/dist/scan/parse-sql-predicate.cjs +3 -294
  408. package/dist/scan/parse-sql-predicate.cjs.map +3 -3
  409. package/dist/scan/parse-sql-predicate.d.ts +6 -9
  410. package/dist/scan/parse-sql-predicate.d.ts.map +1 -1
  411. package/dist/scan/parse-sql-predicate.js +5 -314
  412. package/dist/scan/parse-sql-predicate.js.map +1 -1
  413. package/dist/scan/query-arrow-table-in-batches.cjs +75 -0
  414. package/dist/scan/query-arrow-table-in-batches.cjs.map +7 -0
  415. package/dist/scan/query-arrow-table-in-batches.d.ts +8 -0
  416. package/dist/scan/query-arrow-table-in-batches.d.ts.map +1 -0
  417. package/dist/scan/query-arrow-table-in-batches.js +54 -0
  418. package/dist/scan/query-arrow-table-in-batches.js.map +1 -0
  419. package/dist/scan/query-arrow-table.cjs +65 -202
  420. package/dist/scan/query-arrow-table.cjs.map +3 -3
  421. package/dist/scan/query-arrow-table.d.ts +7 -40
  422. package/dist/scan/query-arrow-table.d.ts.map +1 -1
  423. package/dist/scan/query-arrow-table.js +51 -211
  424. package/dist/scan/query-arrow-table.js.map +1 -1
  425. package/dist/scan/query-open-source.cjs +52 -0
  426. package/dist/scan/query-open-source.cjs.map +7 -0
  427. package/dist/scan/query-open-source.d.ts +4 -0
  428. package/dist/scan/query-open-source.d.ts.map +1 -0
  429. package/dist/scan/query-open-source.js +26 -0
  430. package/dist/scan/query-open-source.js.map +1 -0
  431. package/dist/scan/query-progressive.cjs +190 -0
  432. package/dist/scan/query-progressive.cjs.map +7 -0
  433. package/dist/scan/query-progressive.d.ts +39 -0
  434. package/dist/scan/query-progressive.d.ts.map +1 -0
  435. package/dist/scan/query-progressive.js +173 -0
  436. package/dist/scan/query-progressive.js.map +1 -0
  437. package/dist/scan/query-pushdown.cjs +140 -0
  438. package/dist/scan/query-pushdown.cjs.map +7 -0
  439. package/dist/scan/query-pushdown.d.ts +14 -0
  440. package/dist/scan/query-pushdown.d.ts.map +1 -0
  441. package/dist/scan/query-pushdown.js +133 -0
  442. package/dist/scan/query-pushdown.js.map +1 -0
  443. package/dist/scan/query-scales.cjs +140 -0
  444. package/dist/scan/query-scales.cjs.map +7 -0
  445. package/dist/scan/query-scales.d.ts +35 -0
  446. package/dist/scan/query-scales.d.ts.map +1 -0
  447. package/dist/scan/query-scales.js +120 -0
  448. package/dist/scan/query-scales.js.map +1 -0
  449. package/dist/scan/query.cjs +385 -0
  450. package/dist/scan/query.cjs.map +7 -0
  451. package/dist/scan/query.d.ts +67 -0
  452. package/dist/scan/query.d.ts.map +1 -0
  453. package/dist/scan/query.js +402 -0
  454. package/dist/scan/query.js.map +1 -0
  455. package/dist/scan/resolve-query-source.cjs +59 -0
  456. package/dist/scan/resolve-query-source.cjs.map +7 -0
  457. package/dist/scan/resolve-query-source.d.ts +6 -0
  458. package/dist/scan/resolve-query-source.d.ts.map +1 -0
  459. package/dist/scan/resolve-query-source.js +37 -0
  460. package/dist/scan/resolve-query-source.js.map +1 -0
  461. package/dist/scan/rows-to-arrow.cjs +1 -28
  462. package/dist/scan/rows-to-arrow.cjs.map +2 -2
  463. package/dist/scan/rows-to-arrow.d.ts +3 -3
  464. package/dist/scan/rows-to-arrow.d.ts.map +1 -1
  465. package/dist/scan/rows-to-arrow.js +2 -32
  466. package/dist/scan/rows-to-arrow.js.map +1 -1
  467. package/dist/scan/scan-engine.cjs.map +2 -2
  468. package/dist/scan/scan-engine.d.ts +5 -5
  469. package/dist/scan/scan-engine.d.ts.map +1 -1
  470. package/dist/scan/scan-engine.js.map +1 -1
  471. package/dist/scan/sql-catalog.cjs +110 -0
  472. package/dist/scan/sql-catalog.cjs.map +7 -0
  473. package/dist/scan/sql-catalog.d.ts +47 -0
  474. package/dist/scan/sql-catalog.d.ts.map +1 -0
  475. package/dist/scan/sql-catalog.js +97 -0
  476. package/dist/scan/sql-catalog.js.map +1 -0
  477. package/dist/scan/table-query.cjs.map +2 -2
  478. package/dist/scan/table-query.d.ts +4 -1
  479. package/dist/scan/table-query.d.ts.map +1 -1
  480. package/dist/scan/table-query.js.map +1 -1
  481. package/dist/scan/vector-table-scan-source.cjs +24 -17
  482. package/dist/scan/vector-table-scan-source.cjs.map +4 -4
  483. package/dist/scan/vector-table-scan-source.d.ts +8 -8
  484. package/dist/scan/vector-table-scan-source.d.ts.map +1 -1
  485. package/dist/scan/vector-table-scan-source.js +19 -17
  486. package/dist/scan/vector-table-scan-source.js.map +1 -1
  487. package/dist/schema/categories/category-mesh.d.ts +3 -10
  488. package/dist/schema/categories/category-mesh.d.ts.map +1 -1
  489. package/dist/schema/categories/category-mesh.js.map +1 -1
  490. package/dist/schema/categories/category-table.d.ts +2 -19
  491. package/dist/schema/categories/category-table.d.ts.map +1 -1
  492. package/dist/schema/geometry/arrow-binary-features.d.ts +1 -1
  493. package/dist/schema/geometry/arrow-binary-features.d.ts.map +1 -1
  494. package/dist/schema/geometry/geoarrow.d.ts +3 -6
  495. package/dist/schema/geometry/geoarrow.d.ts.map +1 -1
  496. package/dist/schema/index.cjs +11 -7
  497. package/dist/schema/index.cjs.map +2 -2
  498. package/dist/schema/index.d.ts +4 -4
  499. package/dist/schema/index.d.ts.map +1 -1
  500. package/dist/schema/index.js +2 -2
  501. package/dist/schema/index.js.map +1 -1
  502. package/dist/schema/types/batch.d.ts +0 -4
  503. package/dist/schema/types/batch.d.ts.map +1 -1
  504. package/dist/schema-utils/index.cjs +404 -620
  505. package/dist/schema-utils/index.cjs.map +3 -3
  506. package/dist/schema-utils/index.d.ts +6 -6
  507. package/dist/schema-utils/index.d.ts.map +1 -1
  508. package/dist/schema-utils/index.js +6 -5
  509. package/dist/schema-utils/index.js.map +1 -1
  510. package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts +16 -0
  511. package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts.map +1 -0
  512. package/dist/schema-utils/lib/arrow/arrow-metadata.js +109 -0
  513. package/dist/schema-utils/lib/arrow/arrow-metadata.js.map +1 -0
  514. package/dist/schema-utils/lib/converters/convert.js +9 -2
  515. package/dist/schema-utils/lib/converters/convert.js.map +1 -1
  516. package/dist/schema-utils/lib/converters/types.d.ts +2 -0
  517. package/dist/schema-utils/lib/converters/types.d.ts.map +1 -1
  518. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts +8 -12
  519. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts.map +1 -1
  520. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js +8 -21
  521. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js.map +1 -1
  522. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts +5 -4
  523. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts.map +1 -1
  524. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js +18 -13
  525. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js.map +1 -1
  526. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts +14 -0
  527. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts.map +1 -0
  528. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js +39 -0
  529. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js.map +1 -0
  530. package/dist/schema-utils/lib/mesh/mesh-utils.d.ts +2 -14
  531. package/dist/schema-utils/lib/mesh/mesh-utils.d.ts.map +1 -1
  532. package/dist/schema-utils/lib/mesh/mesh-utils.js +1 -35
  533. package/dist/schema-utils/lib/mesh/mesh-utils.js.map +1 -1
  534. package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts.map +1 -1
  535. package/dist/schema-utils/lib/mesh/point-cloud-tiler.js +6 -5
  536. package/dist/schema-utils/lib/mesh/point-cloud-tiler.js.map +1 -1
  537. package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts +2 -1
  538. package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts.map +1 -1
  539. package/dist/schema-utils/lib/schema/deduce-table-schema.js +7 -3
  540. package/dist/schema-utils/lib/schema/deduce-table-schema.js.map +1 -1
  541. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts +6 -5
  542. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -1
  543. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js +6 -5
  544. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js.map +1 -1
  545. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts +9 -9
  546. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts.map +1 -1
  547. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js +13 -46
  548. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js.map +1 -1
  549. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts +9 -20
  550. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts.map +1 -1
  551. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js +61 -73
  552. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js.map +1 -1
  553. package/dist/schema-utils/lib/table/batches/convert-batches.d.ts +4 -3
  554. package/dist/schema-utils/lib/table/batches/convert-batches.d.ts.map +1 -1
  555. package/dist/schema-utils/lib/table/batches/convert-batches.js +27 -9
  556. package/dist/schema-utils/lib/table/batches/convert-batches.js.map +1 -1
  557. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts +6 -9
  558. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts.map +1 -1
  559. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js +22 -15
  560. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js.map +1 -1
  561. package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts +4 -1
  562. package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts.map +1 -1
  563. package/dist/schema-utils/lib/table/batches/make-table-from-batches.js +13 -9
  564. package/dist/schema-utils/lib/table/batches/make-table-from-batches.js.map +1 -1
  565. package/dist/schema-utils/lib/table/query-arrow-table.d.ts +3 -3
  566. package/dist/schema-utils/lib/table/query-arrow-table.d.ts.map +1 -1
  567. package/dist/schema-utils/lib/table/query-arrow-table.js +9 -23
  568. package/dist/schema-utils/lib/table/query-arrow-table.js.map +1 -1
  569. package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts +9 -10
  570. package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts.map +1 -1
  571. package/dist/schema-utils/lib/table/tables/convert-arrow-table.js +13 -75
  572. package/dist/schema-utils/lib/table/tables/convert-arrow-table.js.map +1 -1
  573. package/dist/schema-utils/lib/table/tables/convert-table.d.ts +6 -36
  574. package/dist/schema-utils/lib/table/tables/convert-table.d.ts.map +1 -1
  575. package/dist/schema-utils/lib/table/tables/convert-table.js +5 -42
  576. package/dist/schema-utils/lib/table/tables/convert-table.js.map +1 -1
  577. package/dist/schema-utils/lib/table/tables/make-table.d.ts +3 -55
  578. package/dist/schema-utils/lib/table/tables/make-table.d.ts.map +1 -1
  579. package/dist/schema-utils/lib/table/tables/make-table.js +3 -59
  580. package/dist/schema-utils/lib/table/tables/make-table.js.map +1 -1
  581. package/dist/schema-utils/lib/table/tables/row-utils.js +2 -2
  582. package/dist/schema-utils/lib/table/tables/row-utils.js.map +1 -1
  583. package/dist/schema-utils/lib/table/tables/table-accessors.d.ts +18 -16
  584. package/dist/schema-utils/lib/table/tables/table-accessors.d.ts.map +1 -1
  585. package/dist/schema-utils/lib/table/tables/table-accessors.js +36 -39
  586. package/dist/schema-utils/lib/table/tables/table-accessors.js.map +1 -1
  587. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts +6 -5
  588. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts.map +1 -1
  589. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js +2 -2
  590. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js.map +1 -1
  591. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts +1 -1
  592. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts.map +1 -1
  593. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js +8 -5
  594. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js.map +1 -1
  595. package/dist/schema-utils/lib/table/tables/table-types.d.ts +1 -3
  596. package/dist/schema-utils/lib/table/tables/table-types.d.ts.map +1 -1
  597. package/dist/schema-utils/lib/table/tables/table-types.js +0 -4
  598. package/dist/schema-utils/lib/table/tables/table-types.js.map +1 -1
  599. package/dist/vector-table-scan-source.cjs +1766 -0
  600. package/dist/vector-table-scan-source.cjs.map +6 -0
  601. package/dist/vector-table-scan-source.d.ts +2 -0
  602. package/dist/vector-table-scan-source.d.ts.map +1 -0
  603. package/dist/vector-table-scan-source.js +2 -0
  604. package/dist/vector-table-scan-source.js.map +1 -0
  605. package/dist/worker-utils/index.cjs +407 -1184
  606. package/dist/worker-utils/index.cjs.map +3 -3
  607. package/dist/worker-utils/index.d.ts +2 -8
  608. package/dist/worker-utils/index.d.ts.map +1 -1
  609. package/dist/worker-utils/index.js +1 -10
  610. package/dist/worker-utils/index.js.map +1 -1
  611. package/dist/worker-utils/lib/env-utils/version.js +1 -1
  612. package/dist/worker-utils/lib/env-utils/version.js.map +1 -1
  613. package/dist/worker-utils/lib/library-utils/library-utils.d.ts.map +1 -1
  614. package/dist/worker-utils/lib/library-utils/library-utils.js +3 -2
  615. package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -1
  616. package/dist/worker-utils/lib/process-utils/child-process-proxy.d.ts.map +1 -1
  617. package/dist/worker-utils/lib/process-utils/child-process-proxy.js +8 -7
  618. package/dist/worker-utils/lib/process-utils/child-process-proxy.js.map +1 -1
  619. package/dist/worker-utils/lib/worker-api/create-worker.d.ts +5 -7
  620. package/dist/worker-utils/lib/worker-api/create-worker.d.ts.map +1 -1
  621. package/dist/worker-utils/lib/worker-api/create-worker.js +76 -146
  622. package/dist/worker-utils/lib/worker-api/create-worker.js.map +1 -1
  623. package/dist/worker-utils/lib/worker-api/get-worker-url.d.ts.map +1 -1
  624. package/dist/worker-utils/lib/worker-api/get-worker-url.js +5 -2
  625. package/dist/worker-utils/lib/worker-api/get-worker-url.js.map +1 -1
  626. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +17 -45
  627. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts.map +1 -1
  628. package/dist/worker-utils/lib/worker-api/process-on-worker.js +214 -312
  629. package/dist/worker-utils/lib/worker-api/process-on-worker.js.map +1 -1
  630. package/dist/worker-utils/lib/worker-api/task-runtime.d.ts +36 -0
  631. package/dist/worker-utils/lib/worker-api/task-runtime.d.ts.map +1 -0
  632. package/dist/worker-utils/lib/worker-api/task-runtime.js +23 -0
  633. package/dist/worker-utils/lib/worker-api/task-runtime.js.map +1 -0
  634. package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js +1 -6
  635. package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js.map +1 -1
  636. package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts +1 -0
  637. package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts.map +1 -1
  638. package/dist/worker-utils/lib/worker-utils/get-transfer-list.js +3 -1
  639. package/dist/worker-utils/lib/worker-utils/get-transfer-list.js.map +1 -1
  640. package/dist/worker-utils/null-worker-node.js +836 -147
  641. package/dist/worker-utils/null-worker-node.js.map +4 -4
  642. package/dist/worker-utils/null-worker.js +804 -143
  643. package/dist/worker-utils/null-worker.js.map +4 -4
  644. package/dist/worker-utils/types.d.ts +55 -72
  645. package/dist/worker-utils/types.d.ts.map +1 -1
  646. package/package.json +141 -35
  647. package/src/arrow-geometry/binary-geometry-to-wkb.ts +1 -1
  648. package/src/arrow-geometry/feature-collection-to-arrow.ts +4 -3
  649. package/src/arrow-geometry/feature-table.ts +8 -17
  650. package/src/arrow-geometry/geojson-table.ts +32 -21
  651. package/src/arrow-geometry/geometry-codecs.ts +2 -2
  652. package/src/arrow-geometry/geometry-to-wkt.ts +2 -2
  653. package/src/arrow-geometry/index.ts +0 -9
  654. package/src/arrow-geometry/wkb-arrow-utils.ts +8 -12
  655. package/src/arrow-geometry/wkb-builder.ts +2 -2
  656. package/src/arrow-geometry/wkb-statistics.ts +2 -2
  657. package/src/arrow-worker-transport.ts +126 -0
  658. package/src/cluster-source.ts +1 -0
  659. package/src/federated-table-scan-source.ts +1 -0
  660. package/src/geoarrow/binary-polygon-to-geoarrow.ts +2 -2
  661. package/src/geoarrow/clustering/cluster-source.ts +20 -30
  662. package/src/geoarrow/convert-table-to-geoarrow.ts +14 -24
  663. package/src/geoarrow/geoarrow-bounds.ts +3 -3
  664. package/src/geoarrow/geoarrow-capabilities.ts +1 -1
  665. package/src/geoarrow/geoarrow-converter/convert-geoarrow-geometry.ts +3 -3
  666. package/src/geoarrow/geoarrow-converter/convert-geoarrow.ts +14 -9
  667. package/src/geoarrow/geoarrow-converter/geoarrow-converter.ts +7 -6
  668. package/src/geoarrow/geoarrow-inspection.ts +2 -2
  669. package/src/geoarrow/geoarrow-stream.ts +16 -16
  670. package/src/geoarrow/get-geoarrow-vertex-count.ts +1 -1
  671. package/src/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.ts +3 -3
  672. package/src/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.ts +4 -11
  673. package/src/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.ts +1 -1
  674. package/src/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts +2 -2
  675. package/src/geoarrow/lib/kernels/encode-geoarrow-box.ts +1 -1
  676. package/src/geoarrow/lib/table-converters/convert-geoarrow-table.ts +11 -11
  677. package/src/geoarrow/mesharrow/arrow-fixed-size-list-utils.ts +3 -2
  678. package/src/geoarrow/metadata/geoarrow-metadata.ts +3 -4
  679. package/src/index.ts +2 -6
  680. package/src/lib/api/create-data-source.ts +148 -58
  681. package/src/lib/api/encode.ts +14 -3
  682. package/src/lib/api/load-in-batches.ts +15 -7
  683. package/src/lib/api/load-loader.ts +22 -21
  684. package/src/lib/api/load.ts +51 -127
  685. package/src/lib/api/loader-options.ts +69 -0
  686. package/src/lib/api/parse-file.ts +32 -22
  687. package/src/lib/api/parse-in-batches.ts +121 -20
  688. package/src/lib/api/parse-sync.ts +30 -16
  689. package/src/lib/api/parse.ts +46 -29
  690. package/src/lib/api/select-loader.ts +54 -69
  691. package/src/lib/api/select-source.ts +7 -1
  692. package/src/lib/loader-utils/get-fetch-function.ts +2 -2
  693. package/src/lib/loader-utils/loggers.ts +2 -70
  694. package/src/lib/loader-utils/native-arrow.ts +83 -0
  695. package/src/lib/loader-utils/option-defaults.ts +9 -10
  696. package/src/lib/loader-utils/option-utils.ts +33 -122
  697. package/src/loader-utils/format-types.ts +4 -0
  698. package/src/loader-utils/index.ts +50 -10
  699. package/src/loader-utils/lib/files/http-file-transport.ts +65 -1
  700. package/src/loader-utils/lib/files/http-file-types.ts +2 -0
  701. package/src/loader-utils/lib/files/read-range-response.ts +66 -0
  702. package/src/loader-utils/lib/log-utils/log.ts +36 -1
  703. package/src/loader-utils/lib/pace-batch-iterator.ts +66 -0
  704. package/src/loader-utils/lib/request-utils/request-credentials.ts +1 -1
  705. package/src/loader-utils/lib/scan-utils/logical-table-query.ts +174 -0
  706. package/src/loader-utils/lib/scan-utils/query-options.ts +44 -0
  707. package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +81 -28
  708. package/src/loader-utils/lib/scan-utils/table-query.ts +76 -8
  709. package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +101 -53
  710. package/src/loader-utils/lib/sources/data-source.ts +57 -16
  711. package/src/loader-utils/lib/sources/image-source.ts +1 -1
  712. package/src/loader-utils/lib/sources/table-source-collection.ts +39 -0
  713. package/src/loader-utils/lib/sources/utils/utils.ts +1 -1
  714. package/src/loader-utils/lib/sources/vector-source.ts +3 -3
  715. package/src/loader-utils/lib/sources/vector-tile-source.ts +4 -9
  716. package/src/loader-utils/lib/worker-loader-utils/encode-with-worker.ts +5 -6
  717. package/src/loader-utils/lib/worker-loader-utils/parse-with-worker.ts +41 -24
  718. package/src/loader-utils/loader-types.ts +190 -111
  719. package/src/loader-utils/source-types.ts +17 -6
  720. package/src/null-loader.ts +1 -20
  721. package/src/polyfills/README.md +2 -2
  722. package/src/polyfills/images/encode-image-node.ts +44 -37
  723. package/src/polyfills/images/image-codecs-node.ts +2 -37
  724. package/src/polyfills/images/load-sharp.ts +13 -0
  725. package/src/polyfills/images/node-image-bitmap.ts +1 -1
  726. package/src/polyfills/images/node-image-formats.ts +10 -4
  727. package/src/polyfills/images/parse-image-node.ts +31 -40
  728. package/src/polyfills/index.ts +3 -3
  729. package/src/scan/arrow-execution/expressions.ts +116 -0
  730. package/src/scan/arrow-execution/filter-arrow-table.ts +298 -0
  731. package/src/scan/arrow-execution/project-arrow-table.ts +53 -0
  732. package/src/scan/arrow-execution.ts +7 -0
  733. package/src/scan/arrow-query-worker-entry.ts +8 -0
  734. package/src/scan/arrow-query-worker.ts +158 -0
  735. package/src/scan/arrow-query.ts +3 -0
  736. package/src/scan/catalog-query-source.ts +132 -0
  737. package/src/scan/federated-table-scan-source.ts +67 -78
  738. package/src/scan/index.ts +64 -6
  739. package/src/scan/parse-sql-predicate.ts +14 -367
  740. package/src/scan/query-arrow-table-in-batches.ts +55 -0
  741. package/src/scan/query-arrow-table.ts +81 -271
  742. package/src/scan/query-open-source.ts +39 -0
  743. package/src/scan/query-progressive.ts +229 -0
  744. package/src/scan/query-pushdown.ts +184 -0
  745. package/src/scan/query-scales.ts +199 -0
  746. package/src/scan/query.ts +594 -0
  747. package/src/scan/resolve-query-source.ts +47 -0
  748. package/src/scan/rows-to-arrow.ts +3 -39
  749. package/src/scan/scan-engine.ts +6 -6
  750. package/src/scan/sql-catalog.ts +167 -0
  751. package/src/scan/table-query.ts +6 -1
  752. package/src/scan/vector-table-scan-source.ts +25 -26
  753. package/src/schema/categories/category-mesh.ts +3 -11
  754. package/src/schema/categories/category-table.ts +2 -28
  755. package/src/schema/geometry/arrow-binary-features.ts +1 -1
  756. package/src/schema/geometry/geoarrow.ts +8 -19
  757. package/src/schema/index.ts +4 -5
  758. package/src/schema/types/batch.ts +0 -5
  759. package/src/schema-utils/index.ts +19 -10
  760. package/src/schema-utils/lib/arrow/arrow-metadata.ts +139 -0
  761. package/src/schema-utils/lib/converters/convert.ts +7 -2
  762. package/src/schema-utils/lib/converters/types.ts +2 -0
  763. package/src/schema-utils/lib/mesh/convert-mesh-to-table.ts +15 -43
  764. package/src/schema-utils/lib/mesh/convert-table-to-mesh.ts +19 -16
  765. package/src/schema-utils/lib/mesh/get-mesh-bounding-box.ts +52 -0
  766. package/src/schema-utils/lib/mesh/mesh-utils.ts +3 -49
  767. package/src/schema-utils/lib/mesh/point-cloud-tiler.ts +6 -5
  768. package/src/schema-utils/lib/schema/deduce-table-schema.ts +8 -4
  769. package/src/schema-utils/lib/table/arrow-api/arrow-like-table.ts +10 -9
  770. package/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts +21 -51
  771. package/src/schema-utils/lib/table/batch-builder/table-batch-builder.ts +68 -83
  772. package/src/schema-utils/lib/table/batches/convert-batches.ts +38 -21
  773. package/src/schema-utils/lib/table/batches/make-arrow-batch-iterator.ts +29 -19
  774. package/src/schema-utils/lib/table/batches/make-table-from-batches.ts +26 -7
  775. package/src/schema-utils/lib/table/query-arrow-table.ts +14 -32
  776. package/src/schema-utils/lib/table/tables/convert-arrow-table.ts +27 -95
  777. package/src/schema-utils/lib/table/tables/convert-table.ts +11 -57
  778. package/src/schema-utils/lib/table/tables/make-table.ts +6 -70
  779. package/src/schema-utils/lib/table/tables/row-utils.ts +2 -2
  780. package/src/schema-utils/lib/table/tables/table-accessors.ts +60 -63
  781. package/src/schema-utils/lib/table/tables/table-converter/convert-tables.ts +12 -14
  782. package/src/schema-utils/lib/table/tables/table-converter/table-converter.ts +12 -9
  783. package/src/schema-utils/lib/table/tables/table-types.ts +1 -7
  784. package/src/vector-table-scan-source.ts +1 -0
  785. package/src/worker-utils/index.ts +2 -18
  786. package/src/worker-utils/lib/library-utils/library-utils.ts +3 -2
  787. package/src/worker-utils/lib/process-utils/child-process-proxy.ts +8 -7
  788. package/src/worker-utils/lib/worker-api/create-worker.ts +89 -188
  789. package/src/worker-utils/lib/worker-api/get-worker-url.ts +4 -3
  790. package/src/worker-utils/lib/worker-api/process-on-worker.ts +246 -402
  791. package/src/worker-utils/lib/worker-api/task-runtime.ts +66 -0
  792. package/src/worker-utils/lib/worker-utils/get-loadable-worker-url.ts +1 -6
  793. package/src/worker-utils/lib/worker-utils/get-transfer-list.ts +2 -0
  794. package/src/worker-utils/types.ts +74 -109
  795. package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs +0 -477
  796. package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs.map +0 -7
  797. package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts +0 -29
  798. package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts.map +0 -1
  799. package/dist/arrow-geometry/arrow-geoarrow-adapter.js +0 -434
  800. package/dist/arrow-geometry/arrow-geoarrow-adapter.js.map +0 -1
  801. package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs +0 -39
  802. package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs.map +0 -7
  803. package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts +0 -2
  804. package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts.map +0 -1
  805. package/dist/geoarrow/lib/arrow-geoarrow-adapter.js +0 -5
  806. package/dist/geoarrow/lib/arrow-geoarrow-adapter.js.map +0 -1
  807. package/dist/loader-utils/lib/file-provider/data-view-file.d.ts +0 -40
  808. package/dist/loader-utils/lib/file-provider/data-view-file.d.ts.map +0 -1
  809. package/dist/loader-utils/lib/file-provider/data-view-file.js +0 -68
  810. package/dist/loader-utils/lib/file-provider/data-view-file.js.map +0 -1
  811. package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts +0 -54
  812. package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts.map +0 -1
  813. package/dist/loader-utils/lib/file-provider/file-handle-file.js +0 -102
  814. package/dist/loader-utils/lib/file-provider/file-handle-file.js.map +0 -1
  815. package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts +0 -45
  816. package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts.map +0 -1
  817. package/dist/loader-utils/lib/file-provider/file-provider-interface.js +0 -13
  818. package/dist/loader-utils/lib/file-provider/file-provider-interface.js.map +0 -1
  819. package/dist/loader-utils/lib/file-provider/file-provider.d.ts +0 -57
  820. package/dist/loader-utils/lib/file-provider/file-provider.d.ts.map +0 -1
  821. package/dist/loader-utils/lib/file-provider/file-provider.js +0 -114
  822. package/dist/loader-utils/lib/file-provider/file-provider.js.map +0 -1
  823. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts.map +0 -1
  824. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js.map +0 -1
  825. package/dist/schema/deprecated/mesh-utils.d.ts +0 -12
  826. package/dist/schema/deprecated/mesh-utils.d.ts.map +0 -1
  827. package/dist/schema/deprecated/mesh-utils.js +0 -37
  828. package/dist/schema/deprecated/mesh-utils.js.map +0 -1
  829. package/dist/schema-utils/arrow-transport.cjs +0 -691
  830. package/dist/schema-utils/arrow-transport.cjs.map +0 -6
  831. package/dist/schema-utils/arrow-transport.d.ts +0 -4
  832. package/dist/schema-utils/arrow-transport.d.ts.map +0 -1
  833. package/dist/schema-utils/arrow-transport.js +0 -7
  834. package/dist/schema-utils/arrow-transport.js.map +0 -1
  835. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts +0 -76
  836. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts.map +0 -1
  837. package/dist/schema-utils/lib/arrow/arrow-table-transport.js +0 -182
  838. package/dist/schema-utils/lib/arrow/arrow-table-transport.js.map +0 -1
  839. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts +0 -33
  840. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts.map +0 -1
  841. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js +0 -134
  842. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js.map +0 -1
  843. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts +0 -10
  844. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts.map +0 -1
  845. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js +0 -71
  846. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js.map +0 -1
  847. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts +0 -19
  848. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts.map +0 -1
  849. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js +0 -64
  850. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js.map +0 -1
  851. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts +0 -20
  852. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts.map +0 -1
  853. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js +0 -83
  854. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js.map +0 -1
  855. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts +0 -21
  856. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts.map +0 -1
  857. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js +0 -86
  858. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js.map +0 -1
  859. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts +0 -24
  860. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts.map +0 -1
  861. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.js.map +0 -1
  862. package/dist/worker-utils/lib/async-queue/async-queue.d.ts +0 -32
  863. package/dist/worker-utils/lib/async-queue/async-queue.d.ts.map +0 -1
  864. package/dist/worker-utils/lib/async-queue/async-queue.js +0 -91
  865. package/dist/worker-utils/lib/async-queue/async-queue.js.map +0 -1
  866. package/dist/worker-utils/lib/worker-farm/worker-body.d.ts +0 -20
  867. package/dist/worker-utils/lib/worker-farm/worker-body.d.ts.map +0 -1
  868. package/dist/worker-utils/lib/worker-farm/worker-body.js +0 -131
  869. package/dist/worker-utils/lib/worker-farm/worker-body.js.map +0 -1
  870. package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts +0 -58
  871. package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts.map +0 -1
  872. package/dist/worker-utils/lib/worker-farm/worker-farm.js +0 -116
  873. package/dist/worker-utils/lib/worker-farm/worker-farm.js.map +0 -1
  874. package/dist/worker-utils/lib/worker-farm/worker-job.d.ts +0 -34
  875. package/dist/worker-utils/lib/worker-farm/worker-job.d.ts.map +0 -1
  876. package/dist/worker-utils/lib/worker-farm/worker-job.js +0 -74
  877. package/dist/worker-utils/lib/worker-farm/worker-job.js.map +0 -1
  878. package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts +0 -94
  879. package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts.map +0 -1
  880. package/dist/worker-utils/lib/worker-farm/worker-pool.js +0 -246
  881. package/dist/worker-utils/lib/worker-farm/worker-pool.js.map +0 -1
  882. package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts +0 -67
  883. package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts.map +0 -1
  884. package/dist/worker-utils/lib/worker-farm/worker-thread.js +0 -175
  885. package/dist/worker-utils/lib/worker-farm/worker-thread.js.map +0 -1
  886. package/src/arrow-geometry/arrow-geoarrow-adapter.ts +0 -568
  887. package/src/geoarrow/lib/arrow-geoarrow-adapter.ts +0 -12
  888. package/src/loader-utils/lib/file-provider/data-view-file.ts +0 -83
  889. package/src/loader-utils/lib/file-provider/file-handle-file.ts +0 -114
  890. package/src/loader-utils/lib/file-provider/file-provider-interface.ts +0 -60
  891. package/src/loader-utils/lib/file-provider/file-provider.ts +0 -130
  892. package/src/loader-utils/lib/scan-utils/experimental-scan-options.ts +0 -46
  893. package/src/polyfills/images/encode-image.node.ts.disabled +0 -41
  894. package/src/polyfills/images/parse-image.node.ts.disabled +0 -55
  895. package/src/schema/deprecated/mesh-utils.ts +0 -46
  896. package/src/schema-utils/arrow-transport.ts +0 -7
  897. package/src/schema-utils/lib/arrow/arrow-table-transport.ts +0 -282
  898. package/src/schema-utils/lib/arrow/split-arrow-buffers.ts +0 -247
  899. package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator-builders.ts.disabled +0 -190
  900. package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.ts +0 -85
  901. package/src/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.ts +0 -82
  902. package/src/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.ts +0 -103
  903. package/src/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.ts +0 -108
  904. package/src/schema-utils/lib/table/batch-builder/table-batch-aggregator.ts +0 -28
  905. package/src/worker-utils/lib/async-queue/async-queue.ts +0 -100
  906. package/src/worker-utils/lib/worker-farm/worker-body.ts +0 -145
  907. package/src/worker-utils/lib/worker-farm/worker-farm.ts +0 -144
  908. package/src/worker-utils/lib/worker-farm/worker-job.ts +0 -85
  909. package/src/worker-utils/lib/worker-farm/worker-pool.ts +0 -316
  910. package/src/worker-utils/lib/worker-farm/worker-thread.ts +0 -206
@@ -3,6 +3,14 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __esm = (fn, res, err) => function __init() {
7
+ if (err) throw err[0];
8
+ try {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ } catch (e) {
11
+ throw err = [e], e;
12
+ }
13
+ };
6
14
  var __export = (target, all) => {
7
15
  for (var name in all)
8
16
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,6 +25,34 @@ var __copyProps = (to, from, except, desc) => {
17
25
  };
18
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
27
 
28
+ // src/worker-utils/lib/node/worker_threads-browser.ts
29
+ var worker_threads_browser_exports = {};
30
+ __export(worker_threads_browser_exports, {
31
+ NodeWorker: () => NodeWorker,
32
+ parentPort: () => parentPort
33
+ });
34
+ var NodeWorker, parentPort;
35
+ var init_worker_threads_browser = __esm({
36
+ "src/worker-utils/lib/node/worker_threads-browser.ts"() {
37
+ "use strict";
38
+ NodeWorker = class {
39
+ /** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
40
+ constructor(...arguments_) {
41
+ var _a;
42
+ const runtimeProcess = globalThis.process;
43
+ const WorkerConstructor = (_a = runtimeProcess == null ? void 0 : runtimeProcess.getBuiltinModule) == null ? void 0 : _a.call(runtimeProcess, "node:worker_threads").Worker;
44
+ if (WorkerConstructor) {
45
+ return new WorkerConstructor(...arguments_);
46
+ }
47
+ }
48
+ /** No-op browser fallback matching the native Worker API. */
49
+ terminate() {
50
+ }
51
+ };
52
+ parentPort = null;
53
+ }
54
+ });
55
+
20
56
  // dist/loader-utils/index.js
21
57
  var index_exports = {};
22
58
  __export(index_exports, {
@@ -68,6 +104,7 @@ __export(index_exports, {
68
104
  createLAZChunkDecoderCursor: () => createLAZChunkDecoderCursor,
69
105
  createLAZChunkEncoder: () => createLAZChunkEncoder,
70
106
  createLoaderWorker: () => createLoaderWorker,
107
+ createQueryMetadata: () => createQueryMetadata,
71
108
  createQueryParameterCredential: () => createQueryParameterCredential,
72
109
  createRangeStats: () => createRangeStats,
73
110
  createScanQueryMetadata: () => createScanQueryMetadata,
@@ -79,7 +116,7 @@ __export(index_exports, {
79
116
  decodeLAZChunkInBatches: () => decodeLAZChunkInBatches,
80
117
  decodeLAZChunkTable: () => decodeLAZChunkTable,
81
118
  document: () => document_,
82
- emitScanExecutionTelemetry: () => emitScanExecutionTelemetry,
119
+ emitQueryComplete: () => emitQueryComplete,
83
120
  encodeArrayBufferToBase64: () => encodeArrayBufferToBase64,
84
121
  encodeHex: () => encodeHex,
85
122
  encodeLASzipVLR: () => encodeLASzipVLR,
@@ -105,6 +142,7 @@ __export(index_exports, {
105
142
  getLAZChunkByteLength: () => getLAZChunkByteLength,
106
143
  getLAZChunkDeclaredByteLength: () => getLAZChunkDeclaredByteLength,
107
144
  getLAZChunkHeaderByteLength: () => getLAZChunkHeaderByteLength,
145
+ getLoaderLog: () => getLoaderLog,
108
146
  getMagicString: () => getMagicString,
109
147
  getPathPrefix: () => getPathPrefix,
110
148
  getRangeStats: () => getRangeStats,
@@ -146,11 +184,12 @@ __export(index_exports, {
146
184
  log: () => log,
147
185
  makeLineIterator: () => makeLineIterator,
148
186
  makeNumberedLineIterator: () => makeNumberedLineIterator,
149
- makeTableScanBatch: () => makeTableScanBatch,
150
187
  makeTextDecoderIterator: () => makeTextDecoderIterator,
151
188
  makeTextEncoderIterator: () => makeTextEncoderIterator,
152
189
  mergeOptions: () => mergeOptions,
153
190
  nodeVersion: () => nodeVersion,
191
+ normalizeTableQuery: () => normalizeTableQuery,
192
+ paceBatchIterator: () => paceBatchIterator,
154
193
  padStringToByteAlignment: () => padStringToByteAlignment,
155
194
  padToNBytes: () => padToNBytes,
156
195
  parseContentType: () => parseContentType,
@@ -161,6 +200,7 @@ __export(index_exports, {
161
200
  parseWithWorker: () => parseWithWorker,
162
201
  parseWithWorkerInBatches: () => parseWithWorkerInBatches,
163
202
  path: () => path_exports,
203
+ planLogicalTableQuery: () => planLogicalTableQuery,
164
204
  planRelationalQuery: () => planRelationalQuery,
165
205
  planTableQuery: () => planTableQuery,
166
206
  processLoaderWorkerBatches: () => processLoaderWorkerBatches,
@@ -169,6 +209,7 @@ __export(index_exports, {
169
209
  promisify1: () => promisify1,
170
210
  promisify2: () => promisify2,
171
211
  rasterCoordinateToPixel: () => rasterCoordinateToPixel,
212
+ readRangeResponse: () => readRangeResponse,
172
213
  redactCredentialURL: () => redactCredentialURL,
173
214
  registerJSModules: () => registerJSModules,
174
215
  resolveAuthenticationOptions: () => resolveAuthenticationOptions,
@@ -184,17 +225,20 @@ __export(index_exports, {
184
225
  shouldParseWithWorker: () => shouldParseWithWorker,
185
226
  sliceArrayBuffer: () => sliceArrayBuffer,
186
227
  stream: () => stream_browser_exports,
228
+ supportsSourceCreation: () => supportsSourceCreation,
187
229
  toArrayBuffer: () => toArrayBuffer2,
188
230
  toArrayBufferIterator: () => toArrayBufferIterator,
189
231
  toArrayBufferView: () => toArrayBufferView,
190
232
  toBuffer: () => toBuffer2,
191
233
  truncateTableBatch: () => truncateTableBatch,
234
+ validateBatchDeliveryRate: () => validateBatchDeliveryRate,
192
235
  validateColumnarPredicate: () => validateColumnarPredicate,
193
236
  validatePointCloudQueryOptions: () => validatePointCloudQueryOptions,
194
237
  validateRasterQueryOptions: () => validateRasterQueryOptions,
195
238
  validateRasterRegion: () => validateRasterRegion,
196
239
  validateTableQueryLimit: () => validateTableQueryLimit,
197
240
  validateTableQueryOptions: () => validateTableQueryOptions,
241
+ validateTableReference: () => validateTableReference,
198
242
  validateTileGrid: () => validateTileGrid,
199
243
  validateTileGridLimits: () => validateTileGridLimits,
200
244
  waitForPromiseWithSignal: () => waitForPromiseWithSignal,
@@ -248,18 +292,48 @@ var nodeVersion = matches && parseFloat(matches[1]) || 0;
248
292
 
249
293
  // dist/loader-utils/lib/log-utils/log.js
250
294
  var import_log = require("probe.gl/log");
251
- var VERSION = true ? "5.0.0-beta.1" : "latest";
295
+ var VERSION = true ? "5.0.0-beta.11" : "latest";
252
296
  var version = VERSION[0] >= "0" && VERSION[0] <= "9" ? `v${VERSION}` : "";
253
297
  function createLog() {
254
- const log2 = new import_log.Log({ id: "loaders.gl" });
298
+ const log3 = new import_log.Log({ id: "loaders.gl" });
255
299
  globalThis.loaders ||= {};
256
- globalThis.loaders.log = log2;
300
+ globalThis.loaders.log = log3;
257
301
  globalThis.loaders.version = version;
258
302
  globalThis.probe ||= {};
259
- globalThis.probe.loaders = log2;
260
- return log2;
303
+ globalThis.probe.loaders = log3;
304
+ return log3;
261
305
  }
262
306
  var log = createLog();
307
+ var NullLog = class {
308
+ /** Discards debug messages. */
309
+ log() {
310
+ return ignoreMessage;
311
+ }
312
+ /** Discards informational messages. */
313
+ info() {
314
+ return ignoreMessage;
315
+ }
316
+ /** Discards messages marked to be emitted once. */
317
+ once() {
318
+ return ignoreMessage;
319
+ }
320
+ /** Discards warnings. */
321
+ warn() {
322
+ return ignoreMessage;
323
+ }
324
+ /** Discards errors. */
325
+ error() {
326
+ return ignoreMessage;
327
+ }
328
+ };
329
+ function ignoreMessage() {
330
+ }
331
+ var nullLog = new NullLog();
332
+ function getLoaderLog(options) {
333
+ var _a;
334
+ const logger = (_a = options == null ? void 0 : options.core) == null ? void 0 : _a.log;
335
+ return logger === null ? nullLog : logger || log;
336
+ }
263
337
 
264
338
  // dist/loader-utils/lib/javascript-utils/is-type.js
265
339
  var isBoolean = (value) => typeof value === "boolean";
@@ -368,15 +442,6 @@ var LOADERS_GL_RAW_FIXTURE_URL = `https://raw.githubusercontent.com/visgl/loader
368
442
  var LOADERS_GL_REDIRECTING_FIXTURE_URL = `https://github.com/visgl/loaders.gl/raw/${LOADERS_GL_FIXTURE_BRANCH}/`;
369
443
  var NPM_TAG = "beta";
370
444
 
371
- // src/worker-utils/lib/env-utils/version.ts
372
- function getVersion() {
373
- const version2 = typeof __VERSION__ === "undefined" ? NPM_TAG : __VERSION__;
374
- globalThis._loadersgl_ = globalThis._loadersgl_ || {};
375
- globalThis._loadersgl_.version ||= version2;
376
- return version2;
377
- }
378
- var VERSION2 = getVersion();
379
-
380
445
  // src/worker-utils/lib/env-utils/assert.ts
381
446
  function assert2(condition, message) {
382
447
  if (!condition) {
@@ -403,818 +468,51 @@ var isMobile = typeof window !== "undefined" && typeof window.orientation !== "u
403
468
  var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
404
469
  var nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
405
470
 
406
- // src/worker-utils/lib/worker-farm/worker-job.ts
407
- var WorkerJob = class {
408
- name;
409
- workerThread;
410
- isRunning = true;
411
- /** Promise that resolves when Job is done */
412
- result;
413
- _resolve = () => {
414
- };
415
- _reject = () => {
416
- };
417
- constructor(jobName, workerThread) {
418
- this.name = jobName;
419
- this.workerThread = workerThread;
420
- this.result = new Promise((resolve2, reject) => {
421
- this._resolve = resolve2;
422
- this._reject = reject;
423
- });
424
- }
425
- /**
426
- * Send a message to the job's worker thread
427
- * @param data any data structure, ideally consisting mostly of transferrable objects
428
- */
429
- postMessage(type, payload) {
430
- if (!this.isRunning) return;
431
- this.workerThread.postMessage({
432
- source: "loaders.gl",
433
- // Lets worker ignore unrelated messages
434
- type,
435
- payload
436
- });
437
- }
438
- /**
439
- * Call to resolve the `result` Promise with the supplied value
440
- */
441
- done(value) {
442
- if (!this.isRunning) {
443
- return;
444
- }
445
- this.isRunning = false;
446
- this._resolve(value);
447
- }
448
- /**
449
- * Call to reject the `result` Promise with the supplied error
450
- */
451
- error(error) {
452
- if (!this.isRunning) {
453
- return;
454
- }
455
- this.isRunning = false;
456
- this._reject(error);
457
- }
458
- /**
459
- * Terminates the worker executing this job and rejects its result.
460
- * @param reason Abort reason supplied by the caller, or a cross-runtime `AbortError`.
461
- */
462
- abort(reason) {
463
- if (!this.isRunning) {
464
- return;
465
- }
466
- this.workerThread.destroy();
467
- this.error(
468
- arguments.length ? reason : createAbortError(`Worker job "${this.name}" was aborted`)
469
- );
470
- }
471
- };
472
- function createAbortError(message) {
473
- const error = new Error(message);
474
- error.name = "AbortError";
475
- return error;
476
- }
477
-
478
- // src/worker-utils/lib/node/worker_threads-browser.ts
479
- var NodeWorker = class {
480
- /** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
481
- constructor(...arguments_) {
482
- var _a;
483
- const runtimeProcess = globalThis.process;
484
- const WorkerConstructor = (_a = runtimeProcess == null ? void 0 : runtimeProcess.getBuiltinModule) == null ? void 0 : _a.call(runtimeProcess, "node:worker_threads").Worker;
485
- if (WorkerConstructor) {
486
- return new WorkerConstructor(...arguments_);
487
- }
488
- }
489
- /** No-op browser fallback matching the native Worker API. */
490
- terminate() {
491
- }
492
- };
493
- var parentPort = null;
494
-
495
- // src/worker-utils/lib/worker-utils/get-loadable-worker-url.ts
496
- var workerURLCache = /* @__PURE__ */ new Map();
497
- function getLoadableWorkerURL(props) {
498
- assert2(props.source && !props.url || !props.source && props.url);
499
- let workerURL = workerURLCache.get(props.source || props.url);
500
- if (!workerURL) {
501
- if (props.url) {
502
- workerURL = getLoadableWorkerURLFromURL(props.url);
503
- workerURLCache.set(props.url, workerURL);
504
- }
505
- if (props.source) {
506
- workerURL = getLoadableWorkerURLFromSource(props.source);
507
- workerURLCache.set(props.source, workerURL);
508
- }
509
- }
510
- assert2(workerURL);
511
- return workerURL;
512
- }
513
- function getLoadableWorkerURLFromURL(url) {
514
- if (!url.startsWith("http")) {
515
- return url;
516
- }
517
- const workerSource = buildScriptSource(url);
518
- return getLoadableWorkerURLFromSource(workerSource);
519
- }
520
- function getLoadableWorkerURLFromSource(workerSource) {
521
- const blob = new Blob([workerSource], { type: "application/javascript" });
522
- return URL.createObjectURL(blob);
523
- }
524
- function buildScriptSource(workerUrl) {
525
- return `try {
526
- importScripts('${workerUrl}');
527
- } catch (error) {
528
- console.error(error);
529
- throw error;
530
- }`;
531
- }
532
-
533
- // src/worker-utils/lib/worker-utils/get-transfer-list.ts
534
- function getTransferList(object, recursive = true, transfers) {
535
- const transfersSet = transfers || /* @__PURE__ */ new Set();
536
- if (!object) {
537
- } else if (isTransferable(object)) {
538
- transfersSet.add(object);
539
- } else if (isTransferable(object.buffer)) {
540
- transfersSet.add(object.buffer);
541
- } else if (ArrayBuffer.isView(object)) {
542
- } else if (recursive && typeof object === "object") {
543
- for (const key in object) {
544
- getTransferList(object[key], recursive, transfersSet);
545
- }
546
- }
547
- return transfers === void 0 ? Array.from(transfersSet) : [];
548
- }
549
- function isTransferable(object) {
550
- if (!object) {
551
- return false;
552
- }
553
- if (object instanceof ArrayBuffer) {
554
- return true;
555
- }
556
- if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
557
- return true;
558
- }
559
- if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
560
- return true;
561
- }
562
- if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
563
- return true;
564
- }
565
- return false;
566
- }
567
- function getTransferListForWriter(object) {
568
- if (object === null) {
569
- return {};
570
- }
571
- const clone = Object.assign({}, object);
572
- Object.keys(clone).forEach((key) => {
573
- if (typeof object[key] === "object" && !ArrayBuffer.isView(object[key]) && !(object[key] instanceof Array)) {
574
- clone[key] = getTransferListForWriter(object[key]);
575
- } else if (typeof clone[key] === "function" || clone[key] instanceof RegExp) {
576
- clone[key] = {};
577
- } else {
578
- clone[key] = object[key];
579
- }
580
- });
581
- return clone;
582
- }
583
-
584
- // src/worker-utils/lib/worker-farm/worker-thread.ts
585
- var NOOP = () => {
586
- };
587
- var WorkerThread = class {
588
- name;
589
- source;
590
- url;
591
- /** Lazily resolves the classic worker URL used as a fallback. */
592
- getUrl;
593
- /** Creates a browser Worker directly. */
594
- loadWorker;
595
- terminated = false;
596
- worker;
597
- onMessage;
598
- onError;
599
- _loadableURL = "";
600
- /** Checks if workers are supported on this platform */
601
- static isSupported() {
602
- return typeof Worker !== "undefined" && isBrowser2 || typeof NodeWorker !== "undefined" && !isBrowser2;
603
- }
604
- constructor(props) {
605
- const { name, source, url, getUrl, loadWorker } = props;
606
- assert2(source || url || getUrl || loadWorker);
607
- this.name = name;
608
- this.source = source;
609
- this.url = url;
610
- this.getUrl = getUrl;
611
- this.loadWorker = loadWorker;
612
- this.onMessage = NOOP;
613
- this.onError = (error) => console.log(error);
614
- this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
615
- }
616
- /**
617
- * Terminate this worker thread
618
- * @note Can free up significant memory
619
- */
620
- destroy() {
621
- this.onMessage = NOOP;
622
- this.onError = NOOP;
623
- this.worker.terminate();
624
- this.terminated = true;
625
- }
626
- /** Keeps this worker from preventing Node.js process exit while idle. */
627
- unref() {
628
- if (!isBrowser2 && typeof this.worker.unref === "function") {
629
- this.worker.unref();
630
- }
631
- }
632
- /** Keeps this worker alive while it is actively processing a job. */
633
- ref() {
634
- if (!isBrowser2 && typeof this.worker.ref === "function") {
635
- this.worker.ref();
636
- }
637
- }
638
- get isRunning() {
639
- return Boolean(this.onMessage);
640
- }
641
- /**
642
- * Send a message to this worker thread
643
- * @param data any data structure, ideally consisting mostly of transferrable objects
644
- * @param transferList If not supplied, calculated automatically by traversing data
645
- */
646
- postMessage(data, transferList) {
647
- transferList = transferList || getTransferList(data);
648
- this.worker.postMessage(data, transferList);
649
- }
650
- // PRIVATE
651
- /**
652
- * Generate a standard Error from an ErrorEvent
653
- * @param event
654
- */
655
- _getErrorFromErrorEvent(event) {
656
- let message = "Failed to load ";
657
- message += `worker ${this.name} from ${this.url || "built-in worker factory"}. `;
658
- if (event.message) {
659
- message += `${event.message} in `;
660
- }
661
- if (event.lineno) {
662
- message += `:${event.lineno}:${event.colno}`;
663
- }
664
- return new Error(message);
665
- }
666
- /**
667
- * Creates a worker thread on the browser
668
- */
669
- _createBrowserWorker() {
670
- var _a;
671
- if (this.loadWorker) {
672
- try {
673
- const worker2 = this.loadWorker();
674
- if (worker2) {
675
- return this._initializeBrowserWorker(worker2);
676
- }
677
- } catch (error) {
678
- if (!this.source && !this.url && !this.getUrl) {
679
- throw error;
680
- }
681
- }
682
- }
683
- const url = this.url || ((_a = this.getUrl) == null ? void 0 : _a.call(this));
684
- this._loadableURL = getLoadableWorkerURL({ source: this.source, url });
685
- const worker = new Worker(this._loadableURL, { name: this.name });
686
- return this._initializeBrowserWorker(worker);
687
- }
688
- /** Attaches protocol handlers to a browser worker. */
689
- _initializeBrowserWorker(worker) {
690
- worker.onmessage = (event) => {
691
- if (!event.data) {
692
- this.onError(new Error("No data received"));
693
- } else {
694
- this.onMessage(event.data);
695
- }
696
- };
697
- worker.onerror = (error) => {
698
- this.onError(this._getErrorFromErrorEvent(error));
699
- this.terminated = true;
700
- };
701
- worker.onmessageerror = (event) => console.error(event);
702
- return worker;
703
- }
704
- /**
705
- * Creates a worker thread in node.js
706
- * @todo https://nodejs.org/api/async_hooks.html#async-resource-worker-pool
707
- */
708
- _createNodeWorker() {
709
- let worker;
710
- if (this.url) {
711
- const absolute = this.url.includes(":/") || this.url.startsWith("/");
712
- const url = absolute ? this.url : `./${this.url}`;
713
- const workerUrl = url.startsWith("file:") ? new URL(url) : url;
714
- const type = this.url.endsWith(".ts") || this.url.endsWith(".mjs") ? "module" : "commonjs";
715
- worker = new NodeWorker(workerUrl, { eval: false, type });
716
- } else if (this.source) {
717
- worker = new NodeWorker(this.source, { eval: true });
718
- } else {
719
- throw new Error("no worker");
720
- }
721
- worker.on("message", (data) => {
722
- this.onMessage(data);
723
- });
724
- worker.on("error", (error) => {
725
- this.onError(error);
726
- });
727
- worker.on("exit", (_code) => {
728
- });
729
- return worker;
730
- }
731
- };
732
-
733
- // src/worker-utils/lib/worker-farm/worker-pool.ts
734
- var WorkerPool = class {
735
- name = "unnamed";
736
- source;
737
- // | Function;
738
- url;
739
- /** Lazily resolves a classic worker fallback URL. */
740
- getUrl;
741
- /** Creates a browser Worker directly. */
742
- loadWorker;
743
- maxConcurrency = 1;
744
- maxMobileConcurrency = 1;
745
- onDebug = () => {
746
- };
747
- reuseWorkers = true;
748
- props = {};
749
- jobQueue = [];
750
- idleQueue = [];
751
- activeJobs = /* @__PURE__ */ new Set();
752
- count = 0;
753
- isDestroyed = false;
754
- /** Checks if workers are supported on this platform */
755
- static isSupported() {
756
- return WorkerThread.isSupported();
757
- }
758
- /**
759
- * @param processor - worker function
760
- * @param maxConcurrency - max count of workers
761
- */
762
- constructor(props) {
763
- this.source = props.source;
764
- this.url = props.url;
765
- this.getUrl = props.getUrl;
766
- this.loadWorker = props.loadWorker;
767
- this.setProps(props);
768
- }
769
- /**
770
- * Terminates all workers in the pool and aborts active jobs.
771
- * @param reason Optional error delivered to active jobs.
772
- * @note Can free up significant memory
773
- */
774
- destroy(reason = new Error("Worker pool was destroyed")) {
775
- this.isDestroyed = true;
776
- this.activeJobs.forEach((job) => job.abort(reason));
777
- const queuedJobs = this.jobQueue.splice(0);
778
- queuedJobs.forEach((queuedJob) => {
779
- queuedJob.removeAbortListener();
780
- queuedJob.onReject(reason);
781
- });
782
- this.idleQueue.forEach((worker) => worker.destroy());
783
- this.isDestroyed = true;
784
- }
785
- setProps(props) {
786
- this.props = { ...this.props, ...props };
787
- if (props.name !== void 0) {
788
- this.name = props.name;
789
- }
790
- if (props.maxConcurrency !== void 0) {
791
- this.maxConcurrency = props.maxConcurrency;
792
- }
793
- if (props.maxMobileConcurrency !== void 0) {
794
- this.maxMobileConcurrency = props.maxMobileConcurrency;
795
- }
796
- if (props.reuseWorkers !== void 0) {
797
- this.reuseWorkers = props.reuseWorkers;
798
- }
799
- if (props.onDebug !== void 0) {
800
- this.onDebug = props.onDebug;
801
- }
802
- }
803
- async startJob(name, onMessage2 = (job, type, data) => job.done(data), onError = (job, error) => job.error(error), signal) {
804
- if (signal == null ? void 0 : signal.aborted) {
805
- throw signal.reason;
806
- }
807
- if (this.isDestroyed) {
808
- return Promise.reject(new Error("Worker pool was destroyed"));
809
- }
810
- const startPromise = new Promise((onStart, onReject) => {
811
- const abortQueuedJob = () => {
812
- const index = this.jobQueue.indexOf(queuedJob);
813
- if (index >= 0) {
814
- this.jobQueue.splice(index, 1);
815
- queuedJob.removeAbortListener();
816
- onReject(signal == null ? void 0 : signal.reason);
817
- }
818
- };
819
- const queuedJob = {
820
- name,
821
- onMessage: onMessage2,
822
- onError,
823
- onStart,
824
- onReject,
825
- signal,
826
- removeAbortListener: () => signal == null ? void 0 : signal.removeEventListener("abort", abortQueuedJob)
827
- };
828
- this.jobQueue.push(queuedJob);
829
- signal == null ? void 0 : signal.addEventListener("abort", abortQueuedJob, { once: true });
830
- return this;
831
- });
832
- this._startQueuedJob();
833
- return await startPromise;
834
- }
835
- // PRIVATE
836
- /**
837
- * Starts first queued job if worker is available or can be created
838
- * Called when job is started and whenever a worker returns to the idleQueue
839
- */
840
- async _startQueuedJob() {
841
- var _a, _b, _c;
842
- if (!this.jobQueue.length) {
843
- return;
844
- }
845
- let workerThread;
846
- try {
847
- workerThread = this._getAvailableWorker();
848
- } catch (error) {
849
- const queuedJob2 = this.jobQueue.shift();
850
- queuedJob2 == null ? void 0 : queuedJob2.removeAbortListener();
851
- queuedJob2 == null ? void 0 : queuedJob2.onReject(error);
852
- void this._startQueuedJob();
853
- return;
854
- }
855
- if (!workerThread) {
856
- return;
857
- }
858
- const queuedJob = this.jobQueue.shift();
859
- if (queuedJob) {
860
- this.onDebug({
861
- message: "Starting job",
862
- name: queuedJob.name,
863
- workerThread,
864
- backlog: this.jobQueue.length
865
- });
866
- const job = new WorkerJob(queuedJob.name, workerThread);
867
- queuedJob.removeAbortListener();
868
- const abortJob = () => {
869
- var _a2;
870
- return job.abort((_a2 = queuedJob.signal) == null ? void 0 : _a2.reason);
871
- };
872
- (_a = queuedJob.signal) == null ? void 0 : _a.addEventListener("abort", abortJob, { once: true });
873
- if ((_b = queuedJob.signal) == null ? void 0 : _b.aborted) abortJob();
874
- this.activeJobs.add(job);
875
- workerThread.ref();
876
- workerThread.onMessage = (data) => {
877
- if (job.isRunning) queuedJob.onMessage(job, data.type, data.payload);
878
- };
879
- workerThread.onError = (error) => queuedJob.onError(job, error);
880
- queuedJob.onStart(job);
881
- try {
882
- await job.result;
883
- } catch {
884
- } finally {
885
- (_c = queuedJob.signal) == null ? void 0 : _c.removeEventListener("abort", abortJob);
886
- this.activeJobs.delete(job);
887
- this.returnWorkerToQueue(workerThread);
888
- }
889
- } else {
890
- this.returnWorkerToQueue(workerThread);
891
- }
892
- }
893
- /**
894
- * Returns a worker to the idle queue
895
- * Destroys the worker if
896
- * - pool is destroyed
897
- * - if this pool doesn't reuse workers
898
- * - if maxConcurrency has been lowered
899
- * @param worker
900
- */
901
- returnWorkerToQueue(worker) {
902
- const shouldDestroyWorker = (
903
- // Aborted jobs terminate their worker immediately.
904
- worker.terminated || // If the pool is destroyed, there is no reason to keep the worker around
905
- this.isDestroyed || // If the app has disabled worker reuse, any completed workers should be destroyed
906
- !this.reuseWorkers || // If concurrency has been lowered, this worker might be surplus to requirements
907
- this.count > this._getMaxConcurrency()
908
- );
909
- if (shouldDestroyWorker) {
910
- if (!worker.terminated) {
911
- worker.destroy();
912
- }
913
- this.count--;
914
- } else {
915
- worker.unref();
916
- this.idleQueue.push(worker);
917
- }
918
- if (!this.isDestroyed) {
919
- this._startQueuedJob();
920
- }
921
- }
922
- /**
923
- * Returns idle worker or creates new worker if maxConcurrency has not been reached
924
- */
925
- _getAvailableWorker() {
926
- if (this.idleQueue.length > 0) {
927
- return this.idleQueue.shift() || null;
928
- }
929
- if (this.count < this._getMaxConcurrency()) {
930
- this.count++;
931
- const name = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;
932
- try {
933
- return new WorkerThread({
934
- name,
935
- source: this.source,
936
- url: this.url,
937
- getUrl: this.getUrl,
938
- loadWorker: this.loadWorker
939
- });
940
- } catch (error) {
941
- this.count--;
942
- throw error;
943
- }
944
- }
945
- return null;
946
- }
947
- _getMaxConcurrency() {
948
- return isMobile ? this.maxMobileConcurrency : this.maxConcurrency;
949
- }
950
- };
471
+ // src/worker-utils/lib/worker-api/process-on-worker.ts
472
+ var import_tasks2 = require("@math.gl/tasks");
951
473
 
952
- // src/worker-utils/lib/worker-farm/worker-farm.ts
953
- var DEFAULT_PROPS = {
954
- maxConcurrency: 3,
955
- maxMobileConcurrency: 1,
956
- reuseWorkers: true,
957
- onDebug: () => {
958
- }
959
- };
960
- var loadWorkerIds = /* @__PURE__ */ new WeakMap();
961
- var nextLoadWorkerId = 1;
962
- var WorkerFarm = class _WorkerFarm {
963
- props;
964
- workerPools = /* @__PURE__ */ new Map();
965
- // singleton
966
- static _workerFarm;
967
- /** Checks if workers are supported on this platform */
968
- static isSupported() {
969
- return WorkerThread.isSupported();
970
- }
971
- /** Get the singleton instance of the global worker farm */
972
- static getWorkerFarm(props = {}) {
973
- _WorkerFarm._workerFarm = _WorkerFarm._workerFarm || new _WorkerFarm({});
974
- _WorkerFarm._workerFarm.setProps(props);
975
- return _WorkerFarm._workerFarm;
976
- }
977
- /** get global instance with WorkerFarm.getWorkerFarm() */
978
- constructor(props) {
979
- this.props = { ...DEFAULT_PROPS };
980
- this.setProps(props);
981
- this.workerPools = /* @__PURE__ */ new Map();
982
- }
983
- /**
984
- * Terminate all workers in the farm and abort active jobs.
985
- * @param reason Optional error delivered to active jobs.
986
- * @note Can free up significant memory
987
- */
988
- destroy(reason) {
989
- for (const workerPool of this.workerPools.values()) {
990
- workerPool.destroy(reason);
991
- }
992
- this.workerPools = /* @__PURE__ */ new Map();
993
- }
994
- /**
995
- * Set props used when initializing worker pools
996
- * @param props
997
- */
998
- setProps(props) {
999
- this.props = { ...this.props, ...props };
1000
- for (const workerPool of this.workerPools.values()) {
1001
- workerPool.setProps(this._getWorkerPoolProps());
1002
- }
1003
- }
1004
- /**
1005
- * Returns a worker pool for the specified worker
1006
- * @param options Worker target used to identify and initialize the pool.
1007
- * @param options.name Worker name used as the base pool identity.
1008
- * @param options.url Worker script URL.
1009
- * @param options.source Inline worker source.
1010
- * @param options.loadWorker Built-in browser worker factory.
1011
- * @example
1012
- * const job = WorkerFarm.getWorkerFarm().getWorkerPool({name, url}).startJob(...);
1013
- */
1014
- getWorkerPool(options) {
1015
- const { name, source, url, getUrl, loadWorker } = options;
1016
- const workerPoolKey = getWorkerPoolKey(options);
1017
- let workerPool = this.workerPools.get(workerPoolKey);
1018
- if (!workerPool) {
1019
- workerPool = new WorkerPool({
1020
- name,
1021
- source,
1022
- url,
1023
- getUrl,
1024
- loadWorker
1025
- });
1026
- workerPool.setProps(this._getWorkerPoolProps());
1027
- this.workerPools.set(workerPoolKey, workerPool);
1028
- }
1029
- return workerPool;
1030
- }
1031
- _getWorkerPoolProps() {
1032
- return {
1033
- maxConcurrency: this.props.maxConcurrency,
1034
- maxMobileConcurrency: this.props.maxMobileConcurrency,
1035
- reuseWorkers: this.props.reuseWorkers,
1036
- onDebug: this.props.onDebug
1037
- };
1038
- }
1039
- };
1040
- function getWorkerPoolKey(options) {
1041
- const { name, source, url, urlKey, loadWorker } = options;
1042
- const sourceKey = source ? `source:${source}` : "";
1043
- const urlKeyPart = url || urlKey ? `url:${url || urlKey}` : "";
1044
- const loadWorkerKey = loadWorker ? `loadWorker:${getLoadWorkerId(loadWorker)}` : "";
1045
- return [name, sourceKey, urlKeyPart, loadWorkerKey].filter(Boolean).join("|");
474
+ // src/loader-utils/lib/log-utils/log.ts
475
+ var import_log3 = require("probe.gl/log");
476
+ var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
477
+ var version2 = VERSION2[0] >= "0" && VERSION2[0] <= "9" ? `v${VERSION2}` : "";
478
+ function createLog2() {
479
+ const log3 = new import_log3.Log({ id: "loaders.gl" });
480
+ globalThis.loaders ||= {};
481
+ globalThis.loaders.log = log3;
482
+ globalThis.loaders.version = version2;
483
+ globalThis.probe ||= {};
484
+ globalThis.probe.loaders = log3;
485
+ return log3;
1046
486
  }
1047
- function getLoadWorkerId(loadWorker) {
1048
- let loadWorkerId = loadWorkerIds.get(loadWorker);
1049
- if (!loadWorkerId) {
1050
- loadWorkerId = nextLoadWorkerId++;
1051
- loadWorkerIds.set(loadWorker, loadWorkerId);
487
+ var log2 = createLog2();
488
+ var NullLog2 = class {
489
+ /** Discards debug messages. */
490
+ log() {
491
+ return ignoreMessage2;
1052
492
  }
1053
- return loadWorkerId;
1054
- }
1055
-
1056
- // src/worker-utils/lib/worker-farm/worker-body.ts
1057
- async function getParentPort() {
1058
- return parentPort;
1059
- }
1060
- var onMessageWrapperMap = /* @__PURE__ */ new Map();
1061
- var WorkerBody = class {
1062
- /** Check that we are actually in a worker thread */
1063
- static async inWorkerThread() {
1064
- return typeof self !== "undefined" || Boolean(await getParentPort());
1065
- }
1066
- /*
1067
- * (type: WorkerMessageType, payload: WorkerMessagePayload) => any
1068
- */
1069
- static set onmessage(onMessage2) {
1070
- async function handleMessage(message) {
1071
- const parentPort2 = await getParentPort();
1072
- const { type, payload } = parentPort2 ? message : message.data;
1073
- onMessage2(type, payload);
1074
- }
1075
- getParentPort().then((parentPort2) => {
1076
- if (parentPort2) {
1077
- parentPort2.on("message", (message) => {
1078
- handleMessage(message);
1079
- });
1080
- parentPort2.on("exit", () => console.debug("Node worker closing"));
1081
- } else {
1082
- globalThis.onmessage = handleMessage;
1083
- }
1084
- });
493
+ /** Discards informational messages. */
494
+ info() {
495
+ return ignoreMessage2;
1085
496
  }
1086
- static async addEventListener(onMessage2) {
1087
- let onMessageWrapper = onMessageWrapperMap.get(onMessage2);
1088
- if (!onMessageWrapper) {
1089
- onMessageWrapper = (message) => {
1090
- const messageData = getWorkerMessageData(message);
1091
- if (!messageData) {
1092
- return;
1093
- }
1094
- onMessage2(messageData.type, messageData.payload);
1095
- };
1096
- onMessageWrapperMap.set(onMessage2, onMessageWrapper);
1097
- }
1098
- const parentPort2 = await getParentPort();
1099
- if (parentPort2) {
1100
- parentPort2.on("message", onMessageWrapper);
1101
- } else {
1102
- globalThis.addEventListener("message", onMessageWrapper);
1103
- }
497
+ /** Discards messages marked to be emitted once. */
498
+ once() {
499
+ return ignoreMessage2;
1104
500
  }
1105
- static async removeEventListener(onMessage2) {
1106
- const onMessageWrapper = onMessageWrapperMap.get(onMessage2);
1107
- onMessageWrapperMap.delete(onMessage2);
1108
- if (!onMessageWrapper) {
1109
- return;
1110
- }
1111
- const parentPort2 = await getParentPort();
1112
- if (parentPort2) {
1113
- parentPort2.off("message", onMessageWrapper);
1114
- } else {
1115
- globalThis.removeEventListener("message", onMessageWrapper);
1116
- }
501
+ /** Discards warnings. */
502
+ warn() {
503
+ return ignoreMessage2;
1117
504
  }
1118
- /**
1119
- * Send a message from a worker to creating thread (main thread)
1120
- * @param type
1121
- * @param payload
1122
- */
1123
- static async postMessage(type, payload) {
1124
- const data = { source: "loaders.gl", type, payload };
1125
- const transferList = getTransferList(payload);
1126
- const parentPort2 = await getParentPort();
1127
- if (parentPort2) {
1128
- parentPort2.postMessage(data, transferList);
1129
- } else {
1130
- globalThis.postMessage(data, transferList);
1131
- }
505
+ /** Discards errors. */
506
+ error() {
507
+ return ignoreMessage2;
1132
508
  }
1133
509
  };
1134
- function getWorkerMessageData(message) {
1135
- if (!message || typeof message !== "object") {
1136
- return null;
1137
- }
1138
- const messageData = "data" in message && message.type === "message" ? message.data : message;
1139
- return messageData && typeof messageData.source === "string" && messageData.source.startsWith("loaders.gl") ? messageData : null;
510
+ function ignoreMessage2() {
1140
511
  }
1141
-
1142
- // src/worker-utils/lib/async-queue/async-queue.ts
1143
- var AsyncQueue = class {
1144
- _values;
1145
- _settlers;
1146
- _closed;
1147
- constructor() {
1148
- this._values = [];
1149
- this._settlers = [];
1150
- this._closed = false;
1151
- }
1152
- /** Return an async iterator for this queue */
1153
- [Symbol.asyncIterator]() {
1154
- return this;
1155
- }
1156
- /** Push a new value - the async iterator will yield a promise resolved to this value */
1157
- push(value) {
1158
- return this.enqueue(value);
1159
- }
1160
- /**
1161
- * Push a new value - the async iterator will yield a promise resolved to this value
1162
- * Add an error - the async iterator will yield a promise rejected with this value
1163
- */
1164
- enqueue(value) {
1165
- if (this._closed) {
1166
- throw new Error("Closed");
1167
- }
1168
- if (this._settlers.length > 0) {
1169
- if (this._values.length > 0) {
1170
- throw new Error("Illegal internal state");
1171
- }
1172
- const settler = this._settlers.shift();
1173
- if (value instanceof Error) {
1174
- settler.reject(value);
1175
- } else {
1176
- settler.resolve({ value });
1177
- }
1178
- } else {
1179
- this._values.push(value);
1180
- }
1181
- }
1182
- /** Indicate that we not waiting for more values - The async iterator will be done */
1183
- close() {
1184
- while (this._settlers.length > 0) {
1185
- const settler = this._settlers.shift();
1186
- settler.resolve({ done: true });
1187
- }
1188
- this._closed = true;
1189
- }
1190
- // ITERATOR IMPLEMENTATION
1191
- /** @returns a Promise for an IteratorResult */
1192
- next() {
1193
- if (this._values.length > 0) {
1194
- const value = this._values.shift();
1195
- if (value instanceof Error) {
1196
- return Promise.reject(value);
1197
- }
1198
- return Promise.resolve({ done: false, value });
1199
- }
1200
- if (this._closed) {
1201
- if (this._settlers.length > 0) {
1202
- throw new Error("Illegal internal state");
1203
- }
1204
- return Promise.resolve({ done: true, value: void 0 });
1205
- }
1206
- return new Promise((resolve2, reject) => {
1207
- this._settlers.push({ resolve: resolve2, reject });
1208
- });
1209
- }
1210
- };
512
+ var nullLog2 = new NullLog2();
1211
513
 
1212
514
  // src/worker-utils/lib/worker-api/get-worker-url.ts
1213
515
  var warnedWorkerVersionFallbacks = /* @__PURE__ */ new Set();
1214
- function getWorkerName(worker) {
1215
- const warning = worker.version !== VERSION2 ? ` (worker-utils@${VERSION2})` : "";
1216
- return `${worker.name}@${worker.version}${warning}`;
1217
- }
1218
516
  function getCustomWorkerURL(worker, options = {}) {
1219
517
  var _a, _b;
1220
518
  const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
@@ -1244,11 +542,11 @@ function getWorkerURL(worker, options = {}) {
1244
542
  }
1245
543
  function getDefaultWorkerURL(worker, warn = false) {
1246
544
  const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
1247
- let version2 = worker.version;
1248
- if (version2 === "latest") {
1249
- version2 = NPM_TAG;
545
+ let version3 = worker.version;
546
+ if (version3 === "latest") {
547
+ version3 = NPM_TAG;
1250
548
  }
1251
- const versionTag = version2 ? `@${version2}` : "";
549
+ const versionTag = version3 ? `@${version3}` : "";
1252
550
  const url = `https://unpkg.com/@loaders.gl/${worker.module}${versionTag}/dist/${workerFile}`;
1253
551
  if (warn) {
1254
552
  warnIfUsingNpmTagFallback(worker, url);
@@ -1264,417 +562,373 @@ function warnIfUsingNpmTagFallback(worker, url) {
1264
562
  return;
1265
563
  }
1266
564
  warnedWorkerVersionFallbacks.add(workerId);
1267
- console.warn(
565
+ log2.warn(
1268
566
  `loaders.gl: ${worker.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${url} from CDN.`
1269
- );
567
+ )();
1270
568
  }
1271
569
 
1272
- // src/worker-utils/lib/worker-api/process-on-worker.ts
1273
- function canProcessOnWorker(worker, options) {
1274
- if (!WorkerFarm.isSupported()) {
1275
- return false;
1276
- }
1277
- const workerOptions = options == null ? void 0 : options[worker.id];
1278
- return Boolean(
1279
- (worker.worker || worker.loadWorker || (workerOptions == null ? void 0 : workerOptions.workerUrl)) && (options == null ? void 0 : options.worker)
1280
- );
1281
- }
1282
- function canProcessOnWorkerInBatches(worker, options = {}) {
1283
- if (!canProcessOnWorker(worker, options)) return false;
1284
- if (options.workerInBatches !== void 0) return options.workerInBatches;
1285
- return Boolean(
1286
- worker.workerInBatches && !options.source && !getConfiguredWorkerURL(worker, options)
1287
- );
570
+ // src/worker-utils/lib/worker-api/task-runtime.ts
571
+ var import_tasks = require("@math.gl/tasks");
572
+ function normalizeTaskProgress(progress) {
573
+ return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
1288
574
  }
1289
- async function processOnWorker(worker, data, options = {}, context = {}, jobContext = {}) {
575
+ async function isWorkerThread() {
1290
576
  var _a;
1291
- throwIfAborted(options.signal);
1292
- const name = getWorkerName(worker);
1293
- const workerFarm = WorkerFarm.getWorkerFarm(options);
1294
- const workerPool = workerFarm.getWorkerPool(getWorkerPoolTarget(worker, options, name));
1295
- const jobName = options.jobName || worker.name;
1296
- const job = await workerPool.startJob(
1297
- jobName,
1298
- // eslint-disable-next-line
1299
- onMessage.bind(null, context, options),
1300
- void 0,
1301
- options.signal
1302
- );
1303
- try {
1304
- if ((_a = options.signal) == null ? void 0 : _a.aborted) job.abort(getAbortReason(options.signal));
1305
- const { signal: _signal, onProgress: _onProgress, ...workerOptions } = options;
1306
- const transferableOptions = getTransferListForWriter(workerOptions);
1307
- const transferableContext = getTransferListForWriter(jobContext);
1308
- if (job.isRunning) {
1309
- job.postMessage("process", {
1310
- input: data,
1311
- options: transferableOptions,
1312
- context: transferableContext
1313
- });
1314
- }
1315
- const result = await job.result;
1316
- return result.result;
1317
- } catch (error) {
1318
- job.abort(error);
1319
- throw error;
577
+ if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
578
+ return true;
579
+ if (typeof process !== "undefined" && ((_a = process.versions) == null ? void 0 : _a.node)) {
580
+ const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser(), worker_threads_browser_exports));
581
+ return !isMainThread;
1320
582
  }
583
+ return false;
1321
584
  }
1322
- function processOnWorkerInBatches(worker, input, options = {}, context = {}, jobContext = {}) {
1323
- return processOnWorkerInBatchesIterator(worker, input, options, context, jobContext);
1324
- }
1325
- async function* processOnWorkerInBatchesIterator(worker, input, options, context, jobContext) {
1326
- throwIfAborted(options.signal);
1327
- const name = getWorkerName(worker);
1328
- const workerFarm = WorkerFarm.getWorkerFarm(options);
1329
- const workerPool = workerFarm.getWorkerPool(getWorkerPoolTarget(worker, options, name));
1330
- const outputBatches = new AsyncQueue();
1331
- const inputIterator = getAsyncIterator(input);
1332
- let outputFinished = false;
1333
- let inputFinished = false;
1334
- let inputCleanupRequested = false;
1335
- let inputRequest = Promise.resolve();
1336
- const batchJobFailed = new Error("Worker batch job failed");
1337
- const closeJobInput = () => {
1338
- if (!inputFinished && !inputCleanupRequested) {
1339
- inputCleanupRequested = true;
1340
- closeInputIterator(inputIterator);
1341
- }
1342
- };
1343
- const finishOutput = () => {
1344
- if (!outputFinished) {
1345
- outputFinished = true;
1346
- outputBatches.close();
1347
- }
1348
- };
1349
- const failOutput = (_error) => {
1350
- if (!outputFinished) {
1351
- outputFinished = true;
1352
- outputBatches.enqueue(batchJobFailed);
1353
- outputBatches.close();
1354
- }
1355
- };
1356
- const job = await workerPool.startJob(
1357
- options.jobName || worker.name,
1358
- (activeJob, type, payload) => {
1359
- switch (type) {
1360
- case "progress":
1361
- reportProgress(activeJob, options, payload);
1362
- break;
1363
- case "input-request":
1364
- inputRequest = inputRequest.then(async () => {
1365
- if (!activeJob.isRunning) return;
1366
- const nextBatch = await inputIterator.next();
1367
- if (!activeJob.isRunning) {
1368
- return;
1369
- }
1370
- if (nextBatch.done) {
1371
- inputFinished = true;
1372
- activeJob.postMessage("input-done", {});
1373
- } else {
1374
- activeJob.postMessage("input-batch", { input: nextBatch.value });
1375
- }
1376
- }).catch((error) => activeJob.abort(error));
1377
- break;
1378
- case "output-batch":
1379
- outputBatches.push(payload.result);
1380
- break;
1381
- case "done":
1382
- activeJob.done(payload);
1383
- finishOutput();
1384
- break;
1385
- case "error": {
1386
- const error = new Error(payload.error || "Worker batch processing failed");
1387
- activeJob.error(error);
1388
- failOutput(error);
1389
- break;
1390
- }
1391
- case "process":
1392
- void onMessage(context, options, activeJob, type, payload);
1393
- break;
1394
- default: {
1395
- const error = new Error(`Unexpected worker batch message: ${type}`);
1396
- activeJob.error(error);
1397
- failOutput(error);
1398
- break;
1399
- }
1400
- }
1401
- },
1402
- void 0,
1403
- options.signal
1404
- ).catch((error) => {
1405
- closeJobInput();
1406
- throw error;
1407
- });
1408
- void job.result.catch((error) => {
1409
- failOutput(error);
1410
- closeJobInput();
1411
- });
1412
- try {
1413
- const { signal: _signal, onProgress: _onProgress, ...workerOptions } = options;
1414
- if (job.isRunning) {
1415
- job.postMessage("process-in-batches", {
1416
- options: getTransferListForWriter(workerOptions),
1417
- context: getTransferListForWriter(jobContext)
1418
- });
1419
- }
1420
- try {
1421
- for await (const outputBatch of outputBatches) {
1422
- yield outputBatch;
1423
- if (job.isRunning) {
1424
- job.postMessage("output-ack", {});
1425
- }
1426
- }
1427
- } catch (error) {
1428
- if (error === batchJobFailed) {
1429
- await job.result;
1430
- }
1431
- throw error;
1432
- }
1433
- await job.result;
1434
- } finally {
1435
- if (job.isRunning) {
1436
- job.abort(createAbortError2("Worker batch iterator was closed"));
585
+ var initializeTaskWorker = import_tasks.initializeTaskWorker;
586
+
587
+ // src/worker-utils/lib/worker-utils/get-transfer-list.ts
588
+ function getTransferList(object, recursive = true, transfers) {
589
+ const transfersSet = transfers || /* @__PURE__ */ new Set();
590
+ if (!object) {
591
+ } else if (isTransferable(object)) {
592
+ transfersSet.add(object);
593
+ } else if (isTransferable(object.buffer)) {
594
+ transfersSet.add(object.buffer);
595
+ } else if (ArrayBuffer.isView(object)) {
596
+ } else if (recursive && typeof object === "object") {
597
+ for (const key in object) {
598
+ getTransferList(object[key], recursive, transfersSet);
1437
599
  }
1438
- closeJobInput();
1439
600
  }
601
+ return transfers === void 0 ? Array.from(transfersSet) : [];
602
+ }
603
+ function isTransferable(object) {
604
+ if (!object) {
605
+ return false;
606
+ }
607
+ if (object instanceof ArrayBuffer) {
608
+ return true;
609
+ }
610
+ if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
611
+ return true;
612
+ }
613
+ if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
614
+ return true;
615
+ }
616
+ if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
617
+ return true;
618
+ }
619
+ return false;
1440
620
  }
1441
- function throwIfAborted(signal) {
1442
- if (!(signal == null ? void 0 : signal.aborted)) {
1443
- return;
621
+ function getTransferListForWriter(object) {
622
+ if (object === null) {
623
+ return {};
1444
624
  }
1445
- throw getAbortReason(signal);
625
+ const clone = Object.assign({}, object);
626
+ Object.keys(clone).forEach((key) => {
627
+ if (object[key] !== null && typeof object[key] === "object" && !ArrayBuffer.isView(object[key]) && !(object[key] instanceof Array)) {
628
+ clone[key] = getTransferListForWriter(object[key]);
629
+ } else if (typeof clone[key] === "function" || clone[key] instanceof RegExp) {
630
+ clone[key] = {};
631
+ } else {
632
+ clone[key] = object[key];
633
+ }
634
+ });
635
+ return clone;
1446
636
  }
1447
- function getAbortReason(signal) {
1448
- return signal ? signal.reason : createAbortError2("Worker job was aborted");
637
+
638
+ // src/worker-utils/lib/worker-api/process-on-worker.ts
639
+ var runners = /* @__PURE__ */ new WeakMap();
640
+ var activeRunners = /* @__PURE__ */ new Set();
641
+ var moduleWorkerUrls = /* @__PURE__ */ new Map();
642
+ function canProcessOnWorker(worker, options = {}) {
643
+ const supported = isBrowser2 ? typeof Worker !== "undefined" : Boolean(options._nodeWorkers);
644
+ return Boolean(
645
+ supported && options.worker && (worker.worker || worker.loadWorker || getConfiguredWorkerURL(worker, options))
646
+ );
1449
647
  }
1450
- function createAbortError2(message) {
1451
- const error = new Error(message);
1452
- error.name = "AbortError";
1453
- return error;
648
+ function canProcessOnWorkerInBatches(worker, options = {}) {
649
+ if (!canProcessOnWorker(worker, options)) return false;
650
+ if (options.workerInBatches !== void 0) return options.workerInBatches;
651
+ return Boolean(worker.workerInBatches && !getConfiguredWorkerURL(worker, options));
1454
652
  }
1455
- function getAsyncIterator(input) {
1456
- if (Symbol.asyncIterator in input) {
1457
- return input[Symbol.asyncIterator]();
653
+ async function processOnWorker(worker, data, options = {}, context = {}, jobContext = {}) {
654
+ const session = await openSession(worker, options, context, jobContext);
655
+ try {
656
+ const result = await session.handle.runTask(
657
+ { value: data },
658
+ {
659
+ ...getControls(options),
660
+ options: getParserOptions(options)
661
+ }
662
+ );
663
+ return result.value;
664
+ } finally {
665
+ await session.close();
1458
666
  }
1459
- return (async function* iterateSynchronously() {
1460
- yield* input;
1461
- })();
1462
667
  }
1463
- function closeInputIterator(inputIterator) {
668
+ async function* processOnWorkerInBatches(worker, input, options = {}, context = {}, jobContext = {}) {
1464
669
  var _a;
670
+ const taskInput = wrapInput(input);
671
+ let session;
1465
672
  try {
1466
- void Promise.resolve((_a = inputIterator.return) == null ? void 0 : _a.call(inputIterator)).catch(() => void 0);
1467
- } catch {
673
+ session = await openSession(worker, options, context, jobContext);
674
+ for await (const result of session.handle.runTaskInBatches(taskInput, {
675
+ ...getControls(options),
676
+ options: getParserOptions(options)
677
+ }))
678
+ yield result.value;
679
+ } finally {
680
+ const closingInput = (_a = taskInput.return) == null ? void 0 : _a.call(taskInput);
681
+ void (closingInput == null ? void 0 : closingInput.catch(() => {
682
+ }));
683
+ await (session == null ? void 0 : session.close());
1468
684
  }
1469
685
  }
1470
- function getWorkerPoolTarget(worker, options, name) {
1471
- if (options.source) {
1472
- return { name, source: options.source };
1473
- }
1474
- const customWorkerUrl = getCustomWorkerURL(worker, options);
1475
- if (customWorkerUrl) {
1476
- return { name, url: customWorkerUrl };
1477
- }
1478
- if (isBrowser2 && worker.loadWorker) {
1479
- return {
1480
- name,
1481
- loadWorker: worker.loadWorker,
1482
- getUrl: () => getWorkerURL(worker, options),
1483
- urlKey: getDefaultWorkerURL(worker)
686
+ function getTask(worker, options) {
687
+ var _a;
688
+ if (options.source || ((_a = options.core) == null ? void 0 : _a.source))
689
+ throw new Error(
690
+ "Inline legacy worker source is unsupported; use a TaskRunner worker URL or factory"
691
+ );
692
+ const create = !getCustomWorkerURL(worker, options) && isBrowser2 ? worker.loadWorker : void 0;
693
+ const url = getWorkerURL(worker, options);
694
+ return {
695
+ id: `${worker.module}:${worker.id}`,
696
+ initialize: (state) => state,
697
+ worker: {
698
+ ...create ? { create: () => create() ?? createModuleWorker(url) } : { url },
699
+ capabilities: { atomic: true, streaming: true }
700
+ }
701
+ };
702
+ }
703
+ function getControls(options) {
704
+ return {
705
+ execution: "worker",
706
+ signal: options.signal,
707
+ inputOwnership: options.inputOwnership ?? "transfer",
708
+ outputOwnership: options.outputOwnership ?? "transfer",
709
+ onProgress: options.onProgress ? (progress) => {
710
+ var _a;
711
+ return (_a = options.onProgress) == null ? void 0 : _a.call(options, normalizeTaskProgress(progress));
712
+ } : void 0
713
+ };
714
+ }
715
+ function getParserOptions(options) {
716
+ const { signal, onProgress, parserOptions, ...workerOptions } = options;
717
+ return getTransferListForWriter(parserOptions ?? workerOptions);
718
+ }
719
+ async function openSession(worker, options, context, jobContext) {
720
+ var _a, _b;
721
+ (_a = options.signal) == null ? void 0 : _a.throwIfAborted();
722
+ const task = getTask(worker, options);
723
+ let state = runners.get(worker);
724
+ if (!state) {
725
+ state = {
726
+ runner: new import_tasks2.TaskRunner({
727
+ maxConcurrency: isMobile ? options.maxMobileConcurrency ?? 1 : options.maxConcurrency ?? 3
728
+ }),
729
+ requests: 0
1484
730
  };
731
+ runners.set(worker, state);
1485
732
  }
1486
- return { name, url: getWorkerURL(worker, options) };
1487
- }
1488
- async function onMessage(context, options, job, type, payload) {
1489
- switch (type) {
1490
- case "progress":
1491
- reportProgress(job, options, payload);
1492
- break;
1493
- case "done":
1494
- job.done(payload);
1495
- break;
1496
- case "error":
1497
- job.error(new Error(payload.error));
1498
- break;
1499
- case "process":
1500
- const { id, input, options: processOptions } = payload;
733
+ const runnerState = state;
734
+ const channel = context.process ? new MessageChannel() : void 0;
735
+ const callbackController = new AbortController();
736
+ let channelClosed = false;
737
+ const abortCallbacks = () => {
738
+ var _a2;
739
+ return callbackController.abort((_a2 = options.signal) == null ? void 0 : _a2.reason);
740
+ };
741
+ (_b = options.signal) == null ? void 0 : _b.addEventListener("abort", abortCallbacks, { once: true });
742
+ const closeChannel = () => {
743
+ var _a2;
744
+ channelClosed = true;
745
+ (_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortCallbacks);
746
+ callbackController.abort();
747
+ channel == null ? void 0 : channel.port1.close();
748
+ channel == null ? void 0 : channel.port2.close();
749
+ };
750
+ if (channel) {
751
+ channel.port1.onmessage = async ({ data }) => {
1501
752
  try {
1502
- if (!context.process) {
1503
- job.postMessage("error", { id, error: "Worker not set up to process on main thread" });
1504
- return;
1505
- }
1506
- const result = await context.process(
1507
- input,
1508
- { ...processOptions, signal: options.signal, onProgress: options.onProgress },
1509
- void 0,
1510
- payload.context || {}
753
+ const value = await context.process(
754
+ data.input,
755
+ data.options,
756
+ {
757
+ signal: callbackController.signal,
758
+ throwIfAborted: () => callbackController.signal.throwIfAborted()
759
+ },
760
+ data.context
1511
761
  );
1512
- job.postMessage("done", { id, result });
762
+ if (!channelClosed && !callbackController.signal.aborted)
763
+ channel.port1.postMessage({ identifier: data.identifier, value }, getTransferList(value));
1513
764
  } catch (error) {
1514
- const message = error instanceof Error ? error.message : "unknown error";
1515
- job.postMessage("error", { id, error: message });
765
+ if (channelClosed || callbackController.signal.aborted) return;
766
+ channel.port1.postMessage({
767
+ identifier: data.identifier,
768
+ error: {
769
+ name: error instanceof Error ? error.name : "Error",
770
+ message: error instanceof Error ? error.message : String(error)
771
+ }
772
+ });
1516
773
  }
1517
- break;
1518
- default:
1519
- console.warn(`process-on-worker: unknown message ${type}`);
1520
- }
1521
- }
1522
- function reportProgress(job, options, payload) {
1523
- var _a;
1524
- if (!job.isRunning || !payload.progress) return;
774
+ };
775
+ channel.port1.start();
776
+ }
777
+ runnerState.requests++;
778
+ activeRunners.add(runnerState);
779
+ let released = false;
780
+ const releaseRunner = () => {
781
+ if (released) return;
782
+ released = true;
783
+ runnerState.requests--;
784
+ if (!runnerState.requests) activeRunners.delete(runnerState);
785
+ };
786
+ let handle;
1525
787
  try {
1526
- (_a = options.onProgress) == null ? void 0 : _a.call(options, payload.progress);
788
+ handle = await runnerState.runner.initializeTask(
789
+ task,
790
+ {
791
+ context: structuredClone(jobContext),
792
+ ...channel ? { port: channel.port2 } : {}
793
+ },
794
+ // The callback port is setup state, independent of the caller's payload ownership.
795
+ { ...getControls(options), inputOwnership: "transfer" }
796
+ );
1527
797
  } catch (error) {
1528
- job.abort(error);
1529
- }
1530
- }
1531
-
1532
- // src/worker-utils/lib/worker-api/create-worker.ts
1533
- var requestId = 0;
1534
- var activeInputBatches = null;
1535
- var activeOutputAcknowledgements = null;
1536
- async function createWorker(process2, processInBatches) {
1537
- if (!await WorkerBody.inWorkerThread()) {
1538
- return;
798
+ releaseRunner();
799
+ closeChannel();
800
+ throw error;
1539
801
  }
1540
- const context = {
1541
- process: processOnMainThread
802
+ return {
803
+ handle,
804
+ /** Releases the worker and callback channel on success, failure, and early stream return. */
805
+ async close() {
806
+ try {
807
+ await handle.close();
808
+ } finally {
809
+ closeChannel();
810
+ releaseRunner();
811
+ }
812
+ }
1542
813
  };
1543
- WorkerBody.onmessage = async (type, payload) => {
1544
- const reporter = type === "process" || type === "process-in-batches" ? createProgressReporter() : void 0;
1545
- const jobContext = { ...context, reportProgress: reporter == null ? void 0 : reporter.report };
1546
- try {
1547
- switch (type) {
1548
- case "preload":
1549
- WorkerBody.postMessage("done", {});
1550
- break;
1551
- case "process":
1552
- if (!process2) {
1553
- throw new Error("Worker does not support atomic processing");
1554
- }
1555
- const result = await process2(
1556
- payload.input,
1557
- payload.options || {},
1558
- jobContext,
1559
- payload.context || {}
1560
- );
1561
- reporter == null ? void 0 : reporter.finish();
1562
- WorkerBody.postMessage("done", { result });
1563
- break;
1564
- case "process-in-batches":
1565
- if (!processInBatches) {
1566
- throw new Error("Worker does not support batched processing");
1567
- }
1568
- const inputBatches = new AsyncQueue();
1569
- const outputAcknowledgements = new AsyncQueue();
1570
- activeInputBatches = inputBatches;
1571
- activeOutputAcknowledgements = outputAcknowledgements;
1572
- try {
1573
- const resultIterator = processInBatches(
1574
- createDemandDrivenIterator(inputBatches),
1575
- payload.options || {},
1576
- jobContext,
1577
- payload.context || {}
1578
- );
1579
- for await (const batch of resultIterator) {
1580
- await WorkerBody.postMessage("output-batch", { result: batch });
1581
- await outputAcknowledgements.next();
1582
- }
1583
- reporter == null ? void 0 : reporter.finish();
1584
- await WorkerBody.postMessage("done", {});
1585
- } finally {
1586
- activeInputBatches = null;
1587
- activeOutputAcknowledgements = null;
1588
- }
1589
- break;
1590
- case "input-batch":
1591
- if (!activeInputBatches) {
1592
- throw new Error("Worker has no active batched processing session");
1593
- }
1594
- activeInputBatches.push(payload.input);
1595
- break;
1596
- case "input-done":
1597
- if (!activeInputBatches) {
1598
- throw new Error("Worker has no active batched processing session");
1599
- }
1600
- activeInputBatches.close();
1601
- break;
1602
- case "output-ack":
1603
- if (!activeOutputAcknowledgements) {
1604
- throw new Error("Worker has no active batched processing session");
1605
- }
1606
- activeOutputAcknowledgements.push(void 0);
1607
- break;
1608
- default:
814
+ }
815
+ function wrapInput(input) {
816
+ const iterator = Symbol.asyncIterator in input ? input[Symbol.asyncIterator]() : input[Symbol.iterator]();
817
+ let inputClosed = false;
818
+ return {
819
+ [Symbol.asyncIterator]() {
820
+ return this;
821
+ },
822
+ async next() {
823
+ if (inputClosed) return { done: true, value: void 0 };
824
+ const next = await iterator.next();
825
+ if (next.done || inputClosed) {
826
+ inputClosed = true;
827
+ return { done: true, value: void 0 };
828
+ }
829
+ return { done: false, value: { value: next.value } };
830
+ },
831
+ async return() {
832
+ var _a;
833
+ if (!inputClosed) {
834
+ inputClosed = true;
835
+ await ((_a = iterator.return) == null ? void 0 : _a.call(iterator));
1609
836
  }
1610
- } catch (error) {
1611
- reporter == null ? void 0 : reporter.finish();
1612
- const message = error instanceof Error ? error.message : "";
1613
- WorkerBody.postMessage("error", { error: message });
837
+ return { done: true, value: void 0 };
1614
838
  }
1615
839
  };
1616
840
  }
1617
- async function* createDemandDrivenIterator(inputBatches) {
1618
- while (true) {
1619
- await WorkerBody.postMessage("input-request", {});
1620
- const nextBatch = await inputBatches.next();
1621
- if (nextBatch.done) {
1622
- return;
841
+ function createModuleWorker(url) {
842
+ var _a;
843
+ const resolved = new URL(url, ((_a = globalThis.document) == null ? void 0 : _a.baseURI) ?? globalThis.location.href);
844
+ let workerUrl = resolved.href;
845
+ if (/^https?:$/.test(resolved.protocol) && resolved.origin !== globalThis.location.origin) {
846
+ let shimUrl = moduleWorkerUrls.get(resolved.href);
847
+ if (!shimUrl) {
848
+ shimUrl = URL.createObjectURL(
849
+ new Blob([`import ${JSON.stringify(resolved.href)};`], { type: "application/javascript" })
850
+ );
851
+ moduleWorkerUrls.set(resolved.href, shimUrl);
1623
852
  }
1624
- yield nextBatch.value;
853
+ workerUrl = shimUrl;
1625
854
  }
855
+ return new Worker(workerUrl, { type: "module" });
1626
856
  }
1627
- function processOnMainThread(arrayBuffer, options = {}, jobContext = {}) {
1628
- return new Promise((resolve2, reject) => {
1629
- const id = requestId++;
1630
- const onMessage2 = (type, payload2) => {
1631
- if (payload2.id !== id) {
1632
- return;
1633
- }
1634
- switch (type) {
1635
- case "done":
1636
- WorkerBody.removeEventListener(onMessage2);
1637
- resolve2(payload2.result);
1638
- break;
1639
- case "error":
1640
- WorkerBody.removeEventListener(onMessage2);
1641
- reject(payload2.error);
1642
- break;
1643
- default:
1644
- }
1645
- };
1646
- WorkerBody.addEventListener(onMessage2);
1647
- const payload = { id, input: arrayBuffer, options, context: jobContext };
1648
- WorkerBody.postMessage("process", payload);
1649
- });
857
+
858
+ // src/worker-utils/lib/worker-api/create-worker.ts
859
+ async function createWorker(process2, processInBatches) {
860
+ if (!await isWorkerThread()) return;
861
+ await initializeTaskWorker(createWorkerTask(process2, processInBatches));
1650
862
  }
1651
- function createProgressReporter() {
1652
- let pending;
1653
- let finished = false;
1654
- let scheduled = false;
1655
- const flush = () => {
1656
- scheduled = false;
1657
- if (pending) {
1658
- WorkerBody.postMessage("progress", { progress: pending });
1659
- pending = void 0;
1660
- }
1661
- };
863
+ function createWorkerTask(process2, processInBatches) {
1662
864
  return {
1663
- /** Records progress while retaining phase transitions. */
1664
- report(progress) {
1665
- if (finished) return;
1666
- if (pending && pending.phase !== progress.phase) flush();
1667
- pending = { ...progress };
1668
- if (!scheduled) {
1669
- scheduled = true;
1670
- setTimeout(flush, 0);
1671
- }
865
+ id: "loaders.gl",
866
+ initialize: (state) => state,
867
+ destroy: (state) => {
868
+ var _a;
869
+ return (_a = state.port) == null ? void 0 : _a.close();
1672
870
  },
1673
- /** Flushes final progress and suppresses reports from stale callbacks. */
1674
- finish() {
1675
- flush();
1676
- finished = true;
1677
- }
871
+ process: async ({ value }, options, context) => {
872
+ if (!process2) throw new Error("Worker does not support atomic processing");
873
+ return { value: await process2(value, options, createContext(context), context.state.context) };
874
+ },
875
+ ...processInBatches ? {
876
+ processInBatches: async function* (inputs, options, context) {
877
+ async function* values() {
878
+ for await (const input of inputs) yield input.value;
879
+ }
880
+ for await (const value of processInBatches(
881
+ values(),
882
+ options,
883
+ createContext(context),
884
+ context.state.context
885
+ )) {
886
+ yield { value };
887
+ }
888
+ }
889
+ } : {}
890
+ };
891
+ }
892
+ function createContext(context) {
893
+ let requestIdentifier = 0;
894
+ const port = context.state.port;
895
+ return {
896
+ signal: context.signal,
897
+ throwIfAborted: () => context.throwIfAborted(),
898
+ reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
899
+ process: port ? (input, options = {}, jobContext = {}) => {
900
+ context.throwIfAborted();
901
+ const identifier = ++requestIdentifier;
902
+ return new Promise((resolve2, reject) => {
903
+ const onMessage = (event) => {
904
+ if (event.data.identifier !== identifier) return;
905
+ cleanup();
906
+ if (event.data.error) {
907
+ const error = new Error(event.data.error.message);
908
+ error.name = event.data.error.name;
909
+ reject(error);
910
+ } else resolve2(event.data.value);
911
+ };
912
+ const onAbort = () => {
913
+ cleanup();
914
+ reject(context.signal.reason);
915
+ };
916
+ const cleanup = () => {
917
+ port.removeEventListener("message", onMessage);
918
+ context.signal.removeEventListener("abort", onAbort);
919
+ };
920
+ port.addEventListener("message", onMessage);
921
+ context.signal.addEventListener("abort", onAbort, { once: true });
922
+ port.start();
923
+ try {
924
+ const request = { identifier, input, options, context: jobContext };
925
+ port.postMessage(request, getTransferList(request));
926
+ } catch (error) {
927
+ cleanup();
928
+ reject(error);
929
+ }
930
+ });
931
+ } : void 0
1678
932
  };
1679
933
  }
1680
934
 
@@ -1725,13 +979,13 @@ function createWorkerCoreApi() {
1725
979
  loadInBatches: unavailable("loadInBatches")
1726
980
  };
1727
981
  }
1728
- function createParseOnMainThread(processOnMainThread2) {
982
+ function createParseOnMainThread(processOnMainThread) {
1729
983
  return (arrayBuffer, loaders, options, context) => {
1730
- if (!processOnMainThread2) {
984
+ if (!processOnMainThread) {
1731
985
  throw new Error("Worker not set up to parse on main thread");
1732
986
  }
1733
987
  const parseArguments = getMainThreadParseArguments(loaders, options, context);
1734
- return processOnMainThread2(arrayBuffer, parseArguments.options, {
988
+ return processOnMainThread(arrayBuffer, parseArguments.options, {
1735
989
  ...parseArguments.context,
1736
990
  ...Array.isArray(loaders) || loaders && isLoaderObject(loaders) ? {
1737
991
  _loaderIsArray: Array.isArray(loaders),
@@ -1759,7 +1013,7 @@ function getSerializableLoaderContext(context) {
1759
1013
  if (!context) {
1760
1014
  return void 0;
1761
1015
  }
1762
- const { fetch: fetch2, loaders, coreApi, signal, reportProgress: reportProgress2, _parse, _parseSync, _parseInBatches, ...serializableContext } = context;
1016
+ const { fetch: fetch2, loaders, coreApi, signal, reportProgress, _parse, _parseSync, _parseInBatches, ...serializableContext } = context;
1763
1017
  return JSON.parse(JSON.stringify(serializableContext));
1764
1018
  }
1765
1019
  async function parseData({ loader, arrayBuffer, options, context }) {
@@ -1795,7 +1049,7 @@ function canParseWithWorker(loader, options) {
1795
1049
  return false;
1796
1050
  if ((_d = (_c = options == null ? void 0 : options.core) == null ? void 0 : _c.credentials) == null ? void 0 : _d.some((credential) => credential.type === "request" || "token" in credential && typeof credential.token === "function"))
1797
1051
  return false;
1798
- if (loader.id === "shapefile" && (typeof (options == null ? void 0 : options.fetch) === "function" || typeof ((_e = options == null ? void 0 : options.core) == null ? void 0 : _e.fetch) === "function"))
1052
+ if (loader.id === "shapefile" && typeof ((_e = options == null ? void 0 : options.core) == null ? void 0 : _e.fetch) === "function")
1799
1053
  return false;
1800
1054
  const workerOptions = getWorkerOptions(options);
1801
1055
  const nodeWorkers = workerOptions._nodeWorkers;
@@ -1839,12 +1093,16 @@ async function parseWithWorker(loader, data, options, context, parseOnMainThread
1839
1093
  signal: workerSignal,
1840
1094
  onProgress: (options == null ? void 0 : options.onProgress) || (context == null ? void 0 : context.reportProgress)
1841
1095
  }, {
1842
- process: async (input, processOptions, _workerContext, parseContext) => {
1096
+ process: async (input, processOptions, workerContext, parseContext) => {
1843
1097
  if (!parseOnMainThread) {
1844
1098
  throw new Error("Worker not set up to parse on main thread");
1845
1099
  }
1846
1100
  const { _loaderIds, _loaderIsArray, ...workerParseContext } = parseContext || {};
1847
- const mainThreadContext = context || parseContext ? { ...context, ...workerParseContext } : void 0;
1101
+ const mainThreadContext = context || parseContext || (workerContext == null ? void 0 : workerContext.signal) ? {
1102
+ ...context,
1103
+ ...workerParseContext,
1104
+ signal: (workerContext == null ? void 0 : workerContext.signal) ?? (context == null ? void 0 : context.signal)
1105
+ } : void 0;
1848
1106
  return await callParseOnMainThread(parseOnMainThread, input, processOptions, mainThreadContext, resolveWorkerLoaders(loader, _loaderIds, _loaderIsArray, context, options));
1849
1107
  }
1850
1108
  }, getSerializableLoaderContext2(context));
@@ -1857,12 +1115,16 @@ async function* parseWithWorkerInBatches(loader, inputIterator, options, context
1857
1115
  signal: workerSignal,
1858
1116
  onProgress: (options == null ? void 0 : options.onProgress) || (context == null ? void 0 : context.reportProgress)
1859
1117
  }, {
1860
- process: async (input, processOptions, _workerContext, parseContext) => {
1118
+ process: async (input, processOptions, workerContext, parseContext) => {
1861
1119
  if (!parseOnMainThread) {
1862
1120
  throw new Error("Worker not set up to parse on main thread");
1863
1121
  }
1864
1122
  const { _loaderIds, _loaderIsArray, ...workerParseContext } = parseContext || {};
1865
- const mainThreadContext = context || parseContext ? { ...context, ...workerParseContext } : void 0;
1123
+ const mainThreadContext = context || parseContext || (workerContext == null ? void 0 : workerContext.signal) ? {
1124
+ ...context,
1125
+ ...workerParseContext,
1126
+ signal: (workerContext == null ? void 0 : workerContext.signal) ?? (context == null ? void 0 : context.signal)
1127
+ } : void 0;
1866
1128
  return await callParseOnMainThread(parseOnMainThread, input, processOptions, mainThreadContext, resolveWorkerLoaders(loader, _loaderIds, _loaderIsArray, context, options));
1867
1129
  }
1868
1130
  }, getSerializableLoaderContext2(context));
@@ -1916,13 +1178,19 @@ function resolveWorkerLoaders(loader, loaderIds, loaderIsArray, context, options
1916
1178
  }
1917
1179
  }
1918
1180
  function getWorkerOptions(options = {}, loader) {
1919
- var _a;
1181
+ var _a, _b;
1920
1182
  const portableOptions = ((_a = loader == null ? void 0 : loader.serializeWorkerOptions) == null ? void 0 : _a.call(loader, options)) || options;
1921
1183
  const optionsToSerialize = {
1922
1184
  ...portableOptions,
1923
1185
  signal: void 0,
1924
1186
  onProgress: void 0,
1925
- ...portableOptions.core ? { core: { ...portableOptions.core, authentications: void 0 } } : {}
1187
+ ...portableOptions.core ? {
1188
+ core: {
1189
+ ...portableOptions.core,
1190
+ authentications: void 0,
1191
+ log: isDisabledLog(portableOptions.core.log) ? null : void 0
1192
+ }
1193
+ } : {}
1926
1194
  };
1927
1195
  const serializedOptions = JSON.parse(JSON.stringify(optionsToSerialize, (_key, value) => {
1928
1196
  if (typeof Headers !== "undefined" && value instanceof Headers)
@@ -1932,17 +1200,17 @@ function getWorkerOptions(options = {}, loader) {
1932
1200
  return typeof value === "bigint" ? null : value;
1933
1201
  }));
1934
1202
  restoreBigIntOptions(optionsToSerialize, serializedOptions);
1935
- const workerOptions = {
1936
- ...serializedOptions.core,
1937
- ...serializedOptions
1938
- };
1939
- if (workerOptions.worker === "auto") {
1940
- workerOptions.worker = true;
1203
+ if (((_b = serializedOptions.core) == null ? void 0 : _b.worker) === "auto") {
1204
+ serializedOptions.core.worker = true;
1941
1205
  }
1942
1206
  if (loader) {
1943
- workerOptions._workerLoaderId = loader.id;
1207
+ serializedOptions._workerLoaderId = loader.id;
1944
1208
  }
1945
- return workerOptions;
1209
+ return {
1210
+ ...serializedOptions,
1211
+ ...serializedOptions.core,
1212
+ parserOptions: serializedOptions
1213
+ };
1946
1214
  }
1947
1215
  function restoreBigIntOptions(original, serialized) {
1948
1216
  if (!serialized || typeof serialized !== "object")
@@ -1959,30 +1227,30 @@ function getSerializableLoaderContext2(context) {
1959
1227
  if (!context) {
1960
1228
  return {};
1961
1229
  }
1962
- const { fetch: fetch2, loaders, coreApi, signal, reportProgress: reportProgress2, _parse, _parseSync, _parseInBatches, ...serializableContext } = context;
1230
+ const { fetch: fetch2, loaders, coreApi, signal, reportProgress, _parse, _parseSync, _parseInBatches, ...serializableContext } = context;
1963
1231
  return JSON.parse(JSON.stringify(serializableContext));
1964
1232
  }
1965
1233
  function shouldParseCSVWithWorker(options) {
1966
1234
  var _a, _b;
1967
1235
  const csvOptions = options;
1968
- return (((_a = csvOptions == null ? void 0 : csvOptions.csv) == null ? void 0 : _a.shape) ?? ((_b = csvOptions == null ? void 0 : csvOptions.core) == null ? void 0 : _b.shape)) === "arrow-table";
1236
+ return (((_a = csvOptions == null ? void 0 : csvOptions.csv) == null ? void 0 : _a.shape) ?? ((_b = csvOptions == null ? void 0 : csvOptions.core) == null ? void 0 : _b.shape)) === "arrow";
1969
1237
  }
1970
1238
  function isLoaderWithWorkerResultDeserializer(loader) {
1971
1239
  return typeof loader.deserializeWorkerResult === "function";
1972
1240
  }
1241
+ function isDisabledLog(logger) {
1242
+ return logger === null || logger instanceof NullLog;
1243
+ }
1973
1244
 
1974
1245
  // dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js
1975
1246
  function canEncodeWithWorker(writer, options) {
1976
1247
  var _a, _b;
1977
- if (!WorkerFarm.isSupported()) {
1978
- return false;
1979
- }
1980
1248
  const nodeWorkers = (options == null ? void 0 : options._nodeWorkers) ?? ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._nodeWorkers);
1981
1249
  const useWorkers = (options == null ? void 0 : options.worker) ?? ((_b = options == null ? void 0 : options.core) == null ? void 0 : _b.worker);
1982
1250
  if (!isBrowser && !nodeWorkers) {
1983
1251
  return false;
1984
1252
  }
1985
- return Boolean(writer.worker && useWorkers);
1253
+ return canProcessOnWorker({ ...writer, options: writer.options || {} }, { worker: Boolean(useWorkers), _nodeWorkers: Boolean(nodeWorkers) });
1986
1254
  }
1987
1255
 
1988
1256
  // dist/loader-utils/lib/binary-utils/get-first-characters.js
@@ -2507,7 +1775,7 @@ var STAT_ACTIVE_REQUESTS = "Active Requests";
2507
1775
  var STAT_CANCELLED_REQUESTS = "Cancelled Requests";
2508
1776
  var STAT_QUEUED_REQUESTS_EVER = "Queued Requests Ever";
2509
1777
  var STAT_ACTIVE_REQUESTS_EVER = "Active Requests Ever";
2510
- var DEFAULT_PROPS2 = {
1778
+ var DEFAULT_PROPS = {
2511
1779
  id: "request-scheduler",
2512
1780
  /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */
2513
1781
  throttleRequests: true,
@@ -2529,7 +1797,7 @@ var RequestScheduler = class {
2529
1797
  /** Pending arrival debounce or next-tick refill; only new arrivals replace this timer. */
2530
1798
  updateTimer = null;
2531
1799
  constructor(props = {}) {
2532
- this.props = { ...DEFAULT_PROPS2, ...props };
1800
+ this.props = { ...DEFAULT_PROPS, ...props };
2533
1801
  this.stats = new import_stats.Stats({ id: this.props.id });
2534
1802
  this.stats.get(STAT_QUEUED_REQUESTS);
2535
1803
  this.stats.get(STAT_ACTIVE_REQUESTS);
@@ -2789,7 +2057,7 @@ var RequestCache = class {
2789
2057
  return cached;
2790
2058
  }
2791
2059
  if (signal == null ? void 0 : signal.aborted) {
2792
- return Promise.reject(createAbortError3());
2060
+ return Promise.reject(createAbortError());
2793
2061
  }
2794
2062
  const controller = new AbortController();
2795
2063
  let resolveRequest;
@@ -2847,7 +2115,7 @@ var RequestCache = class {
2847
2115
  }
2848
2116
  waitForEntry(key, entry, signal) {
2849
2117
  if (signal == null ? void 0 : signal.aborted) {
2850
- return Promise.reject(createAbortError3());
2118
+ return Promise.reject(createAbortError());
2851
2119
  }
2852
2120
  if (!entry.pending) {
2853
2121
  return entry.promise;
@@ -2866,7 +2134,7 @@ var RequestCache = class {
2866
2134
  if (!waiting)
2867
2135
  return;
2868
2136
  finishWaiting();
2869
- reject(createAbortError3());
2137
+ reject(createAbortError());
2870
2138
  if (entry.pending && entry.waiterCount === 0 && this.entries.get(key) === entry) {
2871
2139
  this.removeEntry(key, "abort");
2872
2140
  }
@@ -2919,7 +2187,7 @@ var RequestCache = class {
2919
2187
  return true;
2920
2188
  }
2921
2189
  };
2922
- function createAbortError3() {
2190
+ function createAbortError() {
2923
2191
  const error = new Error("Request aborted");
2924
2192
  error.name = "AbortError";
2925
2193
  return error;
@@ -3092,7 +2360,7 @@ function createAuthenticatedFetch(options) {
3092
2360
  }
3093
2361
  function getAuthenticatedFetch(options = {}) {
3094
2362
  var _a, _b, _c;
3095
- const fetchOption = options.fetch ?? ((_a = options.core) == null ? void 0 : _a.fetch);
2363
+ const fetchOption = (_a = options.core) == null ? void 0 : _a.fetch;
3096
2364
  let fetchFunction;
3097
2365
  if (typeof fetchOption === "function") {
3098
2366
  fetchFunction = fetchOption;
@@ -3275,7 +2543,7 @@ var RANGE_STATS_KEYS = {
3275
2543
  abortedLogicalRanges: "Aborted Logical Range Requests",
3276
2544
  fullResponseFallbacks: "Full Response Fallbacks"
3277
2545
  };
3278
- var DEFAULT_PROPS3 = {
2546
+ var DEFAULT_PROPS2 = {
3279
2547
  batchDelayMs: 50,
3280
2548
  maxGapBytes: 65536,
3281
2549
  rangeExpansionBytes: 65536,
@@ -3314,16 +2582,16 @@ var RangeRequestScheduler = class {
3314
2582
  flushTimer = null;
3315
2583
  /** Creates a scheduler for one group of byte-range-addressable resources. */
3316
2584
  constructor(props = {}) {
3317
- const rangeExpansionBytes = props.rangeExpansionBytes ?? props.maxGapBytes ?? DEFAULT_PROPS3.rangeExpansionBytes;
2585
+ const rangeExpansionBytes = props.rangeExpansionBytes ?? props.maxGapBytes ?? DEFAULT_PROPS2.rangeExpansionBytes;
3318
2586
  this.props = {
3319
- batchDelayMs: props.batchDelayMs ?? DEFAULT_PROPS3.batchDelayMs,
2587
+ batchDelayMs: props.batchDelayMs ?? DEFAULT_PROPS2.batchDelayMs,
3320
2588
  maxGapBytes: props.maxGapBytes ?? rangeExpansionBytes,
3321
2589
  rangeExpansionBytes,
3322
- maxMergedBytes: props.maxMergedBytes ?? DEFAULT_PROPS3.maxMergedBytes,
2590
+ maxMergedBytes: props.maxMergedBytes ?? DEFAULT_PROPS2.maxMergedBytes,
3323
2591
  maxConcurrency: props.maxConcurrency ?? 6,
3324
2592
  maxQueueSize: props.maxQueueSize ?? 4096,
3325
2593
  maxRangeBytes: props.maxRangeBytes ?? 64 * 1024 * 1024,
3326
- maxTotalBytes: props.maxTotalBytes ?? DEFAULT_PROPS3.maxTotalBytes
2594
+ maxTotalBytes: props.maxTotalBytes ?? DEFAULT_PROPS2.maxTotalBytes
3327
2595
  };
3328
2596
  for (const value of [
3329
2597
  this.props.maxConcurrency,
@@ -3353,7 +2621,7 @@ var RangeRequestScheduler = class {
3353
2621
  return Promise.reject(new Error("Byte range length cannot be negative"));
3354
2622
  }
3355
2623
  if ((_a = request.signal) == null ? void 0 : _a.aborted) {
3356
- return Promise.reject(request.signal.reason ?? createAbortError4());
2624
+ return Promise.reject(request.signal.reason ?? createAbortError2());
3357
2625
  }
3358
2626
  if (request.length === 0) {
3359
2627
  return Promise.resolve(new ArrayBuffer(0));
@@ -3618,7 +2886,7 @@ var RangeRequestScheduler = class {
3618
2886
  }
3619
2887
  }
3620
2888
  this.transportQueue = this.transportQueue.filter((group) => group.requests.length > 0);
3621
- request.reject(((_a = request.signal) == null ? void 0 : _a.reason) ?? createAbortError4());
2889
+ request.reject(((_a = request.signal) == null ? void 0 : _a.reason) ?? createAbortError2());
3622
2890
  this.trackEvent({
3623
2891
  type: "abort",
3624
2892
  sourceId: request.sourceId,
@@ -3849,7 +3117,7 @@ function getTimestamp() {
3849
3117
  var _a;
3850
3118
  return ((_a = globalThis.performance) == null ? void 0 : _a.now()) ?? Date.now();
3851
3119
  }
3852
- function createAbortError4() {
3120
+ function createAbortError2() {
3853
3121
  if (typeof DOMException !== "undefined") {
3854
3122
  return new DOMException("Request aborted", "AbortError");
3855
3123
  }
@@ -3931,7 +3199,7 @@ var RangeRequestCache = class {
3931
3199
  (_a = this.onEvent) == null ? void 0 : _a.call(this, { type: "miss", sourceId, offset, length });
3932
3200
  if (this.cache.maxEntries === 0 || length > this.cache.maxBytes) {
3933
3201
  if (signal == null ? void 0 : signal.aborted) {
3934
- throw createAbortError5();
3202
+ throw createAbortError3();
3935
3203
  }
3936
3204
  const arrayBuffer = await fetchRange(offset, length, signal || new AbortController().signal);
3937
3205
  validateResponseLength(arrayBuffer, length);
@@ -4042,7 +3310,7 @@ function validateResponseLength(arrayBuffer, expectedLength) {
4042
3310
  throw new Error(`Range request returned ${arrayBuffer.byteLength} bytes; expected ${expectedLength}`);
4043
3311
  }
4044
3312
  }
4045
- function createAbortError5() {
3313
+ function createAbortError3() {
4046
3314
  const error = new Error("Request aborted");
4047
3315
  error.name = "AbortError";
4048
3316
  return error;
@@ -6213,14 +5481,14 @@ var Byte14Decompressor = class {
6213
5481
  };
6214
5482
  function createPointDecompressor(stream, metadata, outputMode, selection) {
6215
5483
  const extraByteCount = getExtraByteCount(metadata);
6216
- for (const version2 of [
5484
+ for (const version3 of [
6217
5485
  metadata.point10ItemVersion,
6218
5486
  metadata.gpsTime11ItemVersion,
6219
5487
  metadata.rgb12ItemVersion,
6220
5488
  metadata.byteItemVersion
6221
5489
  ]) {
6222
- if (version2 !== void 0 && version2 !== 1 && version2 !== 2) {
6223
- throw new Error(`Unsupported legacy LASzip item version ${version2}`);
5490
+ if (version3 !== void 0 && version3 !== 1 && version3 !== 2) {
5491
+ throw new Error(`Unsupported legacy LASzip item version ${version3}`);
6224
5492
  }
6225
5493
  }
6226
5494
  switch (metadata.pointDataRecordFormat) {
@@ -9524,7 +8792,7 @@ function validateMetadata(rawBytes, metadata) {
9524
8792
  metadata.gpsTime11ItemVersion,
9525
8793
  metadata.rgb12ItemVersion,
9526
8794
  metadata.byteItemVersion
9527
- ].some((version2) => version2 !== void 0 && version2 !== 2)) {
8795
+ ].some((version3) => version3 !== void 0 && version3 !== 2)) {
9528
8796
  throw new Error("TypeScript LAZ encoder only supports legacy item version 2");
9529
8797
  }
9530
8798
  if (!Number.isInteger(metadata.pointCount) || metadata.pointCount < 0) {
@@ -9941,7 +9209,7 @@ var CachedUriResolver = class {
9941
9209
  };
9942
9210
 
9943
9211
  // dist/loader-utils/json-loader.js
9944
- var VERSION3 = true ? "5.0.0-beta.1" : "latest";
9212
+ var VERSION3 = true ? "5.0.0-beta.11" : "latest";
9945
9213
  var JSONLoader = {
9946
9214
  dataType: null,
9947
9215
  batchType: null,
@@ -10180,6 +9448,8 @@ var HttpFileTransport = class {
10180
9448
  identityHints;
10181
9449
  /** Failure objects already included in telemetry. */
10182
9450
  countedFailures = /* @__PURE__ */ new WeakSet();
9451
+ /** Observer for cumulative transport counters, including asynchronous cancellation. */
9452
+ onTelemetry;
10183
9453
  /** Mutable counters backing immutable telemetry snapshots. */
10184
9454
  telemetry = {
10185
9455
  requestedBytes: 0,
@@ -10193,6 +9463,7 @@ var HttpFileTransport = class {
10193
9463
  constructor(url, options) {
10194
9464
  validateKnownByteLength(options.byteLength);
10195
9465
  this.url = url;
9466
+ this.onTelemetry = options.onTelemetry;
10196
9467
  this.fetchFunction = options.fetch || ((input, init) => globalThis.fetch(input, init));
10197
9468
  this.fetchOptions = options.fetchOptions ? { ...options.fetchOptions, headers: new Headers(options.fetchOptions.headers) } : void 0;
10198
9469
  this.consistency = options.consistency || "best-effort";
@@ -10219,6 +9490,7 @@ var HttpFileTransport = class {
10219
9490
  }
10220
9491
  /** Counts each failure object once even when it passes through several async layers. */
10221
9492
  trackFailure(error) {
9493
+ var _a;
10222
9494
  if (typeof error === "object" && error !== null) {
10223
9495
  if (this.countedFailures.has(error)) {
10224
9496
  return;
@@ -10230,10 +9502,11 @@ var HttpFileTransport = class {
10230
9502
  } else {
10231
9503
  this.telemetry.errorCount++;
10232
9504
  }
9505
+ (_a = this.onTelemetry) == null ? void 0 : _a.call(this, this.getTelemetry(), error);
10233
9506
  }
10234
9507
  /** Performs and validates one exact HTTP range request. */
10235
9508
  async requestRange(offset, length, signal, expectedIdentity) {
10236
- var _a;
9509
+ var _a, _b;
10237
9510
  const requestStartTime = getTimestamp2();
10238
9511
  const abortContext = createCombinedAbortContext(signal, (_a = this.fetchOptions) == null ? void 0 : _a.signal);
10239
9512
  this.telemetry.requestCount++;
@@ -10247,7 +9520,7 @@ var HttpFileTransport = class {
10247
9520
  await cancelResponse(response);
10248
9521
  throw new Error(`HTTP byte-range request expected 206, received ${response.status}`);
10249
9522
  }
10250
- const contentRange = await readContentRange(response);
9523
+ const contentRange = response.headers.has("Content-Range") ? await readContentRange(response) : await this.inferContentRange(response, offset, length, expectedIdentity, abortContext.signal);
10251
9524
  const responseIdentity = getResponseIdentity(response, contentRange.byteLength);
10252
9525
  const responseError = getIdentityError(expectedIdentity, responseIdentity, this.identityHints, this.consistency) || getRangeError(contentRange, offset, length);
10253
9526
  if (responseError) {
@@ -10274,6 +9547,39 @@ var HttpFileTransport = class {
10274
9547
  } finally {
10275
9548
  abortContext.removeAbortListeners();
10276
9549
  this.telemetry.networkTimeMs += getTimestamp2() - requestStartTime;
9550
+ (_b = this.onTelemetry) == null ? void 0 : _b.call(this, this.getTelemetry());
9551
+ }
9552
+ }
9553
+ /** Infers bounds for a CORS-filtered 206; the caller still validates the body length. */
9554
+ async inferContentRange(response, offset, length, expectedIdentity, signal) {
9555
+ var _a;
9556
+ try {
9557
+ let byteLength = (expectedIdentity == null ? void 0 : expectedIdentity.byteLength) ?? this.identityHints.byteLength;
9558
+ if (byteLength === void 0) {
9559
+ const headers = new Headers((_a = this.fetchOptions) == null ? void 0 : _a.headers);
9560
+ headers.delete("Range");
9561
+ this.telemetry.requestCount++;
9562
+ const metadata = await this.fetchFunction(this.url, {
9563
+ ...this.fetchOptions,
9564
+ method: "HEAD",
9565
+ body: void 0,
9566
+ headers,
9567
+ signal
9568
+ });
9569
+ await cancelResponse(metadata);
9570
+ const value = metadata.headers.get("Content-Length");
9571
+ byteLength = value && /^\d+$/.test(value) ? Number(value) : NaN;
9572
+ if (metadata.status !== 200 || !Number.isSafeInteger(byteLength) || byteLength < offset + length) {
9573
+ throw new Error("HTTP byte-range response is missing Content-Range and HEAD did not provide a valid file length");
9574
+ }
9575
+ const identityError = getIdentityError(getResponseIdentity(metadata, byteLength), getResponseIdentity(response, byteLength), this.identityHints, this.consistency);
9576
+ if (identityError)
9577
+ throw new Error(identityError);
9578
+ }
9579
+ return { offset, endOffset: offset + length - 1, byteLength };
9580
+ } catch (error) {
9581
+ await cancelResponse(response);
9582
+ throw error;
10277
9583
  }
10278
9584
  }
10279
9585
  /** Validates and consumes the special empty-object identity response. */
@@ -10459,7 +9765,7 @@ var HttpFile = class _HttpFile {
10459
9765
  async open(signal) {
10460
9766
  this.assertOpen();
10461
9767
  if (signal == null ? void 0 : signal.aborted) {
10462
- const error = createAbortError6();
9768
+ const error = createAbortError4();
10463
9769
  this.transport.trackFailure(error);
10464
9770
  throw error;
10465
9771
  }
@@ -10501,7 +9807,7 @@ var HttpFile = class _HttpFile {
10501
9807
  async read(offset = 0, length = 0, signal) {
10502
9808
  this.assertOpen();
10503
9809
  if (signal == null ? void 0 : signal.aborted) {
10504
- const error = createAbortError6();
9810
+ const error = createAbortError4();
10505
9811
  this.transport.trackFailure(error);
10506
9812
  throw error;
10507
9813
  }
@@ -10609,7 +9915,7 @@ function validateRange2(offset, length, byteLength) {
10609
9915
  throw new Error("HTTP byte range extends beyond the end of the file");
10610
9916
  }
10611
9917
  }
10612
- function createAbortError6() {
9918
+ function createAbortError4() {
10613
9919
  if (typeof DOMException !== "undefined") {
10614
9920
  return new DOMException("Request aborted", "AbortError");
10615
9921
  }
@@ -10702,7 +10008,10 @@ var NodeFileSystemFacade = class {
10702
10008
 
10703
10009
  // dist/loader-utils/source-types.js
10704
10010
  function isSourceLoader(loader) {
10705
- return Boolean(loader && typeof loader === "object" && "createDataSource" in loader);
10011
+ return Boolean(loader && typeof loader === "object" && "createDataSourceSync" in loader && "fromUrl" in loader && "testURL" in loader);
10012
+ }
10013
+ function supportsSourceCreation(loader) {
10014
+ return Boolean(loader.createDataSourceSync || loader.preload && loader.fromUrl !== void 0);
10706
10015
  }
10707
10016
 
10708
10017
  // dist/loader-utils/lib/sources/data-source.js
@@ -10728,6 +10037,8 @@ var DataSource = class _DataSource {
10728
10037
  options;
10729
10038
  data;
10730
10039
  url;
10040
+ /** Stable query-visible name, resolved without fetching source data. */
10041
+ name;
10731
10042
  /** Shared parser options derived from the source options, excluding source-only core controls. */
10732
10043
  loadOptions;
10733
10044
  /** A resolved fetch function extracted from the shared core options. */
@@ -10741,6 +10052,7 @@ var DataSource = class _DataSource {
10741
10052
  this.options = mergeOptions(mergeOptions(_DataSource.defaultOptions, defaultOptions || {}), options);
10742
10053
  this.data = data;
10743
10054
  this.url = typeof data === "string" ? resolvePath(data) : "";
10055
+ this.name = getDataSourceName(data, this.options);
10744
10056
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
10745
10057
  this.loadOptions = loadOptions;
10746
10058
  const fetch2 = getFetchFunction(loadOptions);
@@ -10749,6 +10061,9 @@ var DataSource = class _DataSource {
10749
10061
  this.fetch = fetch2;
10750
10062
  }
10751
10063
  setProps(options) {
10064
+ var _a;
10065
+ if (((_a = options.core) == null ? void 0 : _a.name) !== void 0 && options.core.name !== this.name)
10066
+ throw new Error("Data source names are fixed at creation.");
10752
10067
  const mergedOptions = mergeOptions(this.options, options);
10753
10068
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
10754
10069
  this.options = mergedOptions;
@@ -10779,7 +10094,7 @@ var DataSource = class _DataSource {
10779
10094
  if (callback) {
10780
10095
  callback(normalizedError, this);
10781
10096
  } else {
10782
- log.warn(`${this.constructor.name}: ${normalizedError.message}`)();
10097
+ getLoaderLog(this.options).warn(`${this.constructor.name}: ${normalizedError.message}`)();
10783
10098
  }
10784
10099
  return normalizedError;
10785
10100
  }
@@ -10796,23 +10111,13 @@ function getSourceLoaderOptions(options) {
10796
10111
  if (options == null ? void 0 : options.core) {
10797
10112
  loadOptions.core = { ...options.core };
10798
10113
  const parserCore = loadOptions.core;
10799
- for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
10114
+ for (const key of ["type", "name", "attributions", "loaders", "onError", "loadOptions"]) {
10800
10115
  delete parserCore[key];
10801
10116
  }
10802
10117
  if (Object.keys(parserCore).length === 0) {
10803
10118
  delete loadOptions.core;
10804
10119
  }
10805
10120
  }
10806
- const topLevelBaseUri = typeof loadOptions.baseUri === "string" ? loadOptions.baseUri : void 0;
10807
- const topLevelBaseUrl = typeof loadOptions.baseUrl === "string" ? loadOptions.baseUrl : void 0;
10808
- if (topLevelBaseUri !== void 0 || topLevelBaseUrl !== void 0) {
10809
- loadOptions.core ||= {};
10810
- if (loadOptions.core.baseUrl === void 0) {
10811
- loadOptions.core.baseUrl = topLevelBaseUrl ?? topLevelBaseUri;
10812
- }
10813
- delete loadOptions.baseUri;
10814
- delete loadOptions.baseUrl;
10815
- }
10816
10121
  return loadOptions;
10817
10122
  }
10818
10123
  function normalizeError(error, message) {
@@ -10826,9 +10131,48 @@ function normalizeError(error, message) {
10826
10131
  }
10827
10132
  function unavailableCoreApiMethod(methodName) {
10828
10133
  return () => {
10829
- throw new Error(`CoreAPI.${methodName} is unavailable. Use @loaders.gl/core.createDataSource().`);
10134
+ throw new Error(`CoreAPI.${methodName} is unavailable. Use @loaders.gl/core.createDataSourceSync().`);
10830
10135
  };
10831
10136
  }
10137
+ function getDataSourceName(data, options) {
10138
+ var _a, _b, _c;
10139
+ const explicitName = (_a = options.core) == null ? void 0 : _a.name;
10140
+ if (explicitName !== void 0) {
10141
+ if (typeof explicitName !== "string" || !explicitName.trim())
10142
+ throw new Error("Data source name must be a non-empty string.");
10143
+ return explicitName;
10144
+ }
10145
+ if (data && typeof data === "object") {
10146
+ const named = data;
10147
+ if (typeof named.name === "string" && named.name.trim())
10148
+ return data instanceof Blob ? removeFileExtension(named.name) : named.name;
10149
+ const metadata = (_b = named.schema) == null ? void 0 : _b.metadata;
10150
+ const embeddedName = metadata instanceof Map ? metadata.get("name") : metadata == null ? void 0 : metadata.name;
10151
+ if (typeof embeddedName === "string" && embeddedName.trim())
10152
+ return embeddedName;
10153
+ }
10154
+ if (typeof data === "string") {
10155
+ try {
10156
+ const url = new URL(data.replace(/\\/g, "/"), "https://source.invalid/");
10157
+ if (!["data:", "blob:"].includes(url.protocol)) {
10158
+ let basename = url.pathname.split("/").filter(Boolean).pop();
10159
+ if (basename) {
10160
+ try {
10161
+ basename = decodeURIComponent(basename);
10162
+ } catch {
10163
+ }
10164
+ return removeFileExtension(basename);
10165
+ }
10166
+ }
10167
+ } catch {
10168
+ }
10169
+ }
10170
+ return ((_c = options.core) == null ? void 0 : _c.type) && options.core.type !== "auto" ? options.core.type : "source";
10171
+ }
10172
+ function removeFileExtension(name) {
10173
+ const extension = name.lastIndexOf(".");
10174
+ return extension > 0 ? name.slice(0, extension) : name;
10175
+ }
10832
10176
 
10833
10177
  // dist/loader-utils/lib/sources/data-source-manager.js
10834
10178
  var DataSourceManager = class {
@@ -10937,8 +10281,8 @@ var DataSourceManager = class {
10937
10281
  unsubscribe({ consumerId }) {
10938
10282
  const consumer = this.consumers[consumerId];
10939
10283
  if (consumer) {
10940
- for (const requestId2 in consumer) {
10941
- const request = consumer[requestId2];
10284
+ for (const requestId in consumer) {
10285
+ const request = consumer[requestId];
10942
10286
  const dataSourceEntry = this.dataSources[request.dataSourceId];
10943
10287
  dataSourceEntry == null ? void 0 : dataSourceEntry.unsubscribe(request);
10944
10288
  }
@@ -10947,13 +10291,13 @@ var DataSourceManager = class {
10947
10291
  }
10948
10292
  }
10949
10293
  /** Subscribes a consumer to a managed DataSource. */
10950
- subscribe({ dataSourceId, onChange, consumerId, requestId: requestId2 = "default" }) {
10294
+ subscribe({ dataSourceId, onChange, consumerId, requestId = "default" }) {
10951
10295
  const normalizedDataSourceId = this.normalizeDataSourceId(dataSourceId);
10952
10296
  if (dataSourceId.startsWith(this.protocol) && !this.dataSources[normalizedDataSourceId]) {
10953
10297
  this.add({ dataSourceId: normalizedDataSourceId, dataSource: null, persistent: false });
10954
10298
  }
10955
10299
  const dataSourceEntry = this.dataSources[normalizedDataSourceId];
10956
- this.track(consumerId, requestId2, dataSourceEntry, onChange);
10300
+ this.track(consumerId, requestId, dataSourceEntry, onChange);
10957
10301
  return dataSourceEntry == null ? void 0 : dataSourceEntry.getDataSource();
10958
10302
  }
10959
10303
  /** Schedules pruning of unused non-persistent DataSources. */
@@ -10996,10 +10340,10 @@ var DataSourceManager = class {
10996
10340
  throw new Error("DataSourceManager.getOrCreate requires dataSourceId or data.");
10997
10341
  }
10998
10342
  /** Tracks one consumer request against one managed DataSource entry. */
10999
- track(consumerId, requestId2, dataSourceEntry, onChange) {
10343
+ track(consumerId, requestId, dataSourceEntry, onChange) {
11000
10344
  this.consumers[consumerId] = this.consumers[consumerId] || /* @__PURE__ */ Object.create(null);
11001
10345
  const consumer = this.consumers[consumerId];
11002
- let request = consumer[requestId2];
10346
+ let request = consumer[requestId];
11003
10347
  const oldDataSourceEntry = (request == null ? void 0 : request.dataSourceId) && this.dataSources[request.dataSourceId];
11004
10348
  if (oldDataSourceEntry) {
11005
10349
  oldDataSourceEntry.unsubscribe(request);
@@ -11012,7 +10356,7 @@ var DataSourceManager = class {
11012
10356
  } else {
11013
10357
  request = { onChange, dataSourceId: dataSourceEntry.id };
11014
10358
  }
11015
- consumer[requestId2] = request;
10359
+ consumer[requestId] = request;
11016
10360
  dataSourceEntry.subscribe(request);
11017
10361
  }
11018
10362
  }
@@ -11570,11 +10914,11 @@ function throwIfScanAborted(signal) {
11570
10914
 
11571
10915
  // dist/loader-utils/lib/scan-utils/scan-query-metadata.js
11572
10916
  var import_crs = require("@math.gl/geospatial/crs");
11573
- function emitScanExecutionTelemetry(callback, telemetry) {
10917
+ function emitQueryComplete(callback, summary) {
11574
10918
  if (!callback)
11575
10919
  return;
11576
10920
  try {
11577
- callback(telemetry);
10921
+ callback(summary);
11578
10922
  } catch {
11579
10923
  }
11580
10924
  }
@@ -11596,6 +10940,7 @@ function createScanQueryMetadata(options) {
11596
10940
  metadata: field.metadata || Object.freeze({})
11597
10941
  });
11598
10942
  });
10943
+ const queryCapabilities = Object.freeze({ ...options.capabilities });
11599
10944
  return Object.freeze({
11600
10945
  sourceType: options.sourceType,
11601
10946
  queryType: options.queryType,
@@ -11604,7 +10949,9 @@ function createScanQueryMetadata(options) {
11604
10949
  description: options.description,
11605
10950
  schema,
11606
10951
  columns: Object.freeze(columns),
11607
- capabilities: Object.freeze({ ...options.capabilities }),
10952
+ capabilities: queryCapabilities,
10953
+ queryCapabilities,
10954
+ ...options.hasDefaultRowWindow ? { hasDefaultRowWindow: true } : {},
11608
10955
  spatial: options.spatial ? Object.freeze({
11609
10956
  ...options.spatial,
11610
10957
  bounds: options.spatial.bounds ? Object.freeze({
@@ -11641,6 +10988,13 @@ function getNonEmptyMetadataValue(metadata, key) {
11641
10988
  const value = metadata == null ? void 0 : metadata[key];
11642
10989
  return value || void 0;
11643
10990
  }
10991
+ function createQueryMetadata(options) {
10992
+ const { queryCapabilities, ...metadataOptions } = options;
10993
+ return createScanQueryMetadata({
10994
+ ...metadataOptions,
10995
+ capabilities: queryCapabilities
10996
+ });
10997
+ }
11644
10998
 
11645
10999
  // dist/loader-utils/lib/scan-utils/table-query.js
11646
11000
  function planTableQuery(sourceColumnNames, options = {}) {
@@ -11684,14 +11038,18 @@ function validateTableQueryLimit(limit) {
11684
11038
  throw new Error("Table query limit must be a non-negative safe integer.");
11685
11039
  }
11686
11040
  }
11041
+ function validateTableQueryOffset(offset) {
11042
+ if (offset !== void 0 && (!Number.isSafeInteger(offset) || offset < 0)) {
11043
+ throw new Error("Table query offset must be a non-negative safe integer.");
11044
+ }
11045
+ }
11687
11046
 
11688
11047
  // dist/loader-utils/lib/scan-utils/table-scan-batch.js
11689
- function makeTableScanBatch(table) {
11690
- return { ...table, batchType: "data", length: table.data.numRows };
11691
- }
11692
11048
  async function* executeTableScanBatches(readBatches, options = {}, operators = {}) {
11693
- var _a;
11049
+ var _a, _b, _c, _d, _e;
11694
11050
  validateTableQueryLimit(options.limit);
11051
+ validateTableQueryOffset(options.offset);
11052
+ let skip = options.offset ?? 0;
11695
11053
  const startedAt = Date.now();
11696
11054
  let sourcesRead = 0;
11697
11055
  let batchesRead = 0;
@@ -11705,6 +11063,7 @@ async function* executeTableScanBatches(readBatches, options = {}, operators = {
11705
11063
  let executionError;
11706
11064
  let remaining = options.limit === void 0 ? Number.POSITIVE_INFINITY : Math.max(0, options.limit);
11707
11065
  try {
11066
+ (_a = options.signal) == null ? void 0 : _a.throwIfAborted();
11708
11067
  if (remaining <= 0) {
11709
11068
  earlyTerminationReason = "limit";
11710
11069
  return;
@@ -11715,36 +11074,47 @@ async function* executeTableScanBatches(readBatches, options = {}, operators = {
11715
11074
  earlyTerminationReason = "limit";
11716
11075
  return;
11717
11076
  }
11077
+ (_b = options.signal) == null ? void 0 : _b.throwIfAborted();
11718
11078
  batchesRead++;
11719
- rowsRead += batch.length;
11720
- const filteredBatch = (operators.filter || filterTableBatch)(batch, options.predicate);
11079
+ const rowCount = getScanBatchRowCount(batch);
11080
+ rowsRead += rowCount;
11081
+ if (options.predicate && !operators.filter && !("shape" in batch)) {
11082
+ throw new Error("Native Arrow scans require a filter kernel for residual predicates.");
11083
+ }
11084
+ const filteredBatch = operators.filter ? await operators.filter(batch, options.predicate, options.signal) : "shape" in batch ? filterTableBatch(batch, options.predicate) : batch;
11085
+ (_c = options.signal) == null ? void 0 : _c.throwIfAborted();
11086
+ const filteredRowCount = getScanBatchRowCount(filteredBatch);
11721
11087
  if (options.predicate) {
11722
- rowsTested += batch.length;
11723
- rowsRetained += filteredBatch.length;
11724
- }
11725
- const projectedBatch = (operators.project || projectTableBatch)(filteredBatch, options.columns);
11726
- if (projectedBatch.length <= remaining) {
11727
- remaining -= projectedBatch.length;
11728
- rowsReturned += projectedBatch.length;
11729
- yield projectedBatch;
11730
- } else {
11731
- const outputBatch = truncateTableBatch(projectedBatch, remaining);
11732
- rowsReturned += outputBatch.length;
11088
+ rowsTested += rowCount;
11089
+ rowsRetained += filteredRowCount;
11090
+ }
11091
+ if (skip >= filteredRowCount && (skip > 0 || options.skipEmptyBatches)) {
11092
+ skip -= filteredRowCount;
11093
+ continue;
11094
+ }
11095
+ const end = Math.min(filteredRowCount, skip + remaining);
11096
+ const window2 = skip || end < filteredRowCount ? "shape" in filteredBatch ? sliceTableBatch(filteredBatch, skip, end) : filteredBatch.slice(skip, end) : filteredBatch;
11097
+ skip = 0;
11098
+ const output = operators.project ? operators.project(window2, options.columns) : projectTableBatch(window2, options.columns);
11099
+ remaining -= getScanBatchRowCount(window2);
11100
+ rowsReturned += getScanBatchRowCount(output);
11101
+ if (remaining === 0)
11733
11102
  earlyTerminationReason = "limit";
11734
- yield outputBatch;
11103
+ yield output;
11104
+ if (remaining === 0)
11735
11105
  return;
11736
- }
11106
+ (_d = options.signal) == null ? void 0 : _d.throwIfAborted();
11737
11107
  }
11738
11108
  status = "completed";
11739
11109
  } catch (error) {
11740
- status = ((_a = options.signal) == null ? void 0 : _a.aborted) ? "cancelled" : "failed";
11110
+ status = ((_e = options.signal) == null ? void 0 : _e.aborted) ? "cancelled" : "failed";
11741
11111
  executionError = error;
11742
11112
  throw error;
11743
11113
  } finally {
11744
11114
  if (status === "early-terminated" && !earlyTerminationReason) {
11745
11115
  earlyTerminationReason = "consumer-return";
11746
11116
  }
11747
- emitScanExecutionTelemetry(options.onTelemetry, Object.freeze({
11117
+ emitQueryComplete(options.onQueryComplete, Object.freeze({
11748
11118
  status,
11749
11119
  sourcesPlanned: 1,
11750
11120
  sourcesRead,
@@ -11764,27 +11134,36 @@ async function* executeTableScanBatches(readBatches, options = {}, operators = {
11764
11134
  }));
11765
11135
  }
11766
11136
  }
11137
+ function getScanBatchRowCount(batch) {
11138
+ return "shape" in batch ? batch.length : batch.numRows;
11139
+ }
11767
11140
  function truncateTableBatch(batch, length) {
11141
+ return "shape" in batch ? sliceTableBatch(batch, 0, length) : batch.slice(0, length);
11142
+ }
11143
+ function sliceTableBatch(batch, start, end) {
11144
+ const length = end - start;
11768
11145
  if (batch.shape === "object-row-table" || batch.shape === "array-row-table") {
11769
- return { ...batch, data: batch.data.slice(0, length), length };
11146
+ return { ...batch, data: batch.data.slice(start, end), length };
11770
11147
  }
11771
11148
  if (batch.shape === "columnar-table") {
11772
11149
  return {
11773
11150
  ...batch,
11774
11151
  data: Object.fromEntries(Object.entries(batch.data).map(([name, values]) => [
11775
11152
  name,
11776
- Array.from(values).slice(0, length)
11153
+ Array.from(values).slice(start, end)
11777
11154
  ])),
11778
11155
  length
11779
11156
  };
11780
11157
  }
11781
- if (batch.shape === "arrow-table")
11782
- return { ...batch, data: batch.data.slice(0, length), length };
11783
- return { ...batch, features: batch.features.slice(0, length), length };
11158
+ return { ...batch, features: batch.features.slice(start, end), length };
11784
11159
  }
11785
11160
  function projectTableBatch(batch, columns) {
11786
11161
  if (columns === void 0)
11787
11162
  return batch;
11163
+ if (!("shape" in batch)) {
11164
+ const indices = columns.map((column) => batch.schema.fields.findIndex((field) => field.name === column)).filter((index) => index >= 0);
11165
+ return batch.selectAt(indices);
11166
+ }
11788
11167
  const schema = projectTableSchema(batch, columns);
11789
11168
  if (batch.shape === "object-row-table") {
11790
11169
  return {
@@ -11800,8 +11179,6 @@ function projectTableBatch(batch, columns) {
11800
11179
  data: Object.fromEntries(columns.map((column) => [column, batch.data[column]]))
11801
11180
  };
11802
11181
  }
11803
- if (batch.shape === "arrow-table")
11804
- return { ...batch, schema, data: batch.data.select([...columns]) };
11805
11182
  return batch;
11806
11183
  }
11807
11184
  function projectTableSchema(batch, columns) {
@@ -12761,4 +12138,186 @@ function getXYZTileGridOptions(metadata) {
12761
12138
  function isClose(actual, expected) {
12762
12139
  return Number.isFinite(actual) && Math.abs(actual - expected) <= Math.abs(expected) * 1e-10;
12763
12140
  }
12141
+
12142
+ // dist/loader-utils/lib/scan-utils/logical-table-query.js
12143
+ function normalizeTableQuery(sourceColumnNames, query = {}) {
12144
+ if (!query || typeof query !== "object" || Array.isArray(query)) {
12145
+ throw new Error("Table query must be an object.");
12146
+ }
12147
+ for (const key of Object.keys(query)) {
12148
+ if (!["from", "select", "where", "offset", "limit"].includes(key)) {
12149
+ throw new Error(`Unsupported table query option: ${key}`);
12150
+ }
12151
+ }
12152
+ if (query.select !== void 0 && (!Array.isArray(query.select) || query.select.length === 0)) {
12153
+ throw new Error("Table query select must be a non-empty array.");
12154
+ }
12155
+ validateTableReference(query.from);
12156
+ validateTableQueryOffset(query.offset);
12157
+ validateTableQueryLimit(query.limit);
12158
+ if (query.where !== void 0) {
12159
+ validateColumnarPredicate(query.where, new Set(sourceColumnNames));
12160
+ }
12161
+ const outputNames = /* @__PURE__ */ new Set();
12162
+ const select = (query.select ?? sourceColumnNames).map((selection) => {
12163
+ if (typeof selection !== "string" && (!selection || typeof selection !== "object" || Array.isArray(selection))) {
12164
+ throw new Error("Table query selection must be a column name or {column, as}.");
12165
+ }
12166
+ if (typeof selection !== "string" && Object.keys(selection).some((key) => key !== "column" && key !== "as")) {
12167
+ throw new Error("Unsupported table query selection field.");
12168
+ }
12169
+ const column = typeof selection === "string" ? selection : selection.column;
12170
+ const outputName = typeof selection === "string" ? selection : selection.as === void 0 ? column : selection.as;
12171
+ if (typeof column !== "string" || !sourceColumnNames.includes(column)) {
12172
+ throw new Error(`Table query column not found: ${column}`);
12173
+ }
12174
+ if (typeof outputName !== "string" || outputName.length === 0) {
12175
+ throw new Error("Table query output name must be a non-empty string.");
12176
+ }
12177
+ if (outputNames.has(outputName)) {
12178
+ throw new Error(`Duplicate table query output name: ${outputName}`);
12179
+ }
12180
+ outputNames.add(outputName);
12181
+ return Object.freeze({ column, as: outputName });
12182
+ });
12183
+ planTableQuery(sourceColumnNames, {
12184
+ columns: [...new Set(select.map((selection) => selection.column))],
12185
+ predicate: query.where,
12186
+ limit: query.limit
12187
+ });
12188
+ return Object.freeze({
12189
+ select: Object.freeze(select),
12190
+ ...query.from === void 0 ? {} : { from: typeof query.from === "string" ? query.from : Object.freeze({ ...query.from }) },
12191
+ ...query.where === void 0 ? {} : { where: query.where },
12192
+ ...query.offset === void 0 ? {} : { offset: query.offset },
12193
+ ...query.limit === void 0 ? {} : { limit: query.limit }
12194
+ });
12195
+ }
12196
+ function planLogicalTableQuery(sourceColumnNames, query = {}) {
12197
+ const normalized = normalizeTableQuery(sourceColumnNames, query);
12198
+ const plan = planTableQuery(sourceColumnNames, {
12199
+ columns: [...new Set(normalized.select.map((selection) => selection.column))],
12200
+ predicate: normalized.where,
12201
+ limit: normalized.limit
12202
+ });
12203
+ const steps = [];
12204
+ for (const step of plan) {
12205
+ if (step.kind === "limit" && normalized.offset !== void 0)
12206
+ steps.push(Object.freeze({ kind: "offset", offset: normalized.offset }));
12207
+ steps.push(step.kind === "project" ? Object.freeze({ kind: "project", select: normalized.select }) : step);
12208
+ }
12209
+ if (normalized.limit === void 0 && normalized.offset !== void 0)
12210
+ steps.push(Object.freeze({ kind: "offset", offset: normalized.offset }));
12211
+ return Object.freeze(steps);
12212
+ }
12213
+ function validateTableReference(reference) {
12214
+ if (reference === void 0)
12215
+ return;
12216
+ if (typeof reference === "string" && reference.trim())
12217
+ return;
12218
+ if (reference && typeof reference === "object" && !Array.isArray(reference)) {
12219
+ const value = reference;
12220
+ if (Object.keys(value).every((key) => key === "source" || key === "table") && typeof value.source === "string" && value.source.trim() && typeof value.table === "string" && value.table.trim())
12221
+ return;
12222
+ }
12223
+ throw new Error("FROM must be a source name or {source, table} with non-empty names.");
12224
+ }
12225
+
12226
+ // dist/loader-utils/lib/files/read-range-response.js
12227
+ async function readRangeResponse(response, offset, length, signal) {
12228
+ var _a, _b, _c;
12229
+ if (typeof offset === "number" && (!Number.isSafeInteger(offset) || offset < 0) || typeof offset === "bigint" && offset < 0n || !Number.isSafeInteger(length) || length <= 0) {
12230
+ await ((_a = response.body) == null ? void 0 : _a.cancel().catch(() => {
12231
+ }));
12232
+ throw new RangeError("Invalid HTTP byte range");
12233
+ }
12234
+ const start = BigInt(offset);
12235
+ const end = start + BigInt(length) - 1n;
12236
+ const value = response.headers.get("Content-Range");
12237
+ const match = value === null ? null : /^bytes (\d+)-(\d+)\/(\d+|\*)$/.exec(value);
12238
+ if (response.status !== 206 || value !== null && (!match || BigInt(match[1]) !== start || BigInt(match[2]) !== end || match[3] !== "*" && BigInt(match[3]) <= end)) {
12239
+ await ((_b = response.body) == null ? void 0 : _b.cancel().catch(() => {
12240
+ }));
12241
+ throw new Error("HTTP range requires 206 and matching Content-Range when visible");
12242
+ }
12243
+ const reader = (_c = response.body) == null ? void 0 : _c.getReader();
12244
+ if (!reader)
12245
+ throw new Error("HTTP range response has no body");
12246
+ let received = 0;
12247
+ const abort = () => {
12248
+ void reader.cancel(signal == null ? void 0 : signal.reason).catch(() => {
12249
+ });
12250
+ };
12251
+ signal == null ? void 0 : signal.addEventListener("abort", abort, { once: true });
12252
+ try {
12253
+ signal == null ? void 0 : signal.throwIfAborted();
12254
+ const bytes = new Uint8Array(length);
12255
+ for (; ; ) {
12256
+ const chunk = await reader.read();
12257
+ signal == null ? void 0 : signal.throwIfAborted();
12258
+ if (chunk.done)
12259
+ break;
12260
+ if (received + chunk.value.byteLength > length)
12261
+ throw new Error("HTTP range body exceeds requested length");
12262
+ bytes.set(chunk.value, received);
12263
+ received += chunk.value.byteLength;
12264
+ }
12265
+ if (received !== length)
12266
+ throw new Error("HTTP range body has truncated length");
12267
+ return bytes;
12268
+ } catch (error) {
12269
+ await reader.cancel(error).catch(() => {
12270
+ });
12271
+ throw error;
12272
+ } finally {
12273
+ signal == null ? void 0 : signal.removeEventListener("abort", abort);
12274
+ reader.releaseLock();
12275
+ }
12276
+ }
12277
+
12278
+ // dist/loader-utils/lib/pace-batch-iterator.js
12279
+ function validateBatchDeliveryRate(rate) {
12280
+ if (!Number.isFinite(rate) || rate < 0) {
12281
+ throw new RangeError("core.batchMaxRowsPerSecond must be a finite nonnegative number");
12282
+ }
12283
+ }
12284
+ async function* paceBatchIterator(batches, { batchMaxRowsPerSecond = 0, getRowCount, signal }) {
12285
+ validateBatchDeliveryRate(batchMaxRowsPerSecond);
12286
+ signal == null ? void 0 : signal.throwIfAborted();
12287
+ if (batchMaxRowsPerSecond === 0) {
12288
+ yield* batches;
12289
+ return;
12290
+ }
12291
+ let deadline = 0;
12292
+ for await (const batch of batches) {
12293
+ signal == null ? void 0 : signal.throwIfAborted();
12294
+ const rowCount = getRowCount(batch);
12295
+ if (rowCount !== void 0 && rowCount > 0) {
12296
+ let remaining = deadline - performance.now();
12297
+ while (remaining > 0) {
12298
+ await waitForBatch(Math.min(Math.ceil(remaining), 2 ** 31 - 1), signal);
12299
+ remaining = deadline - performance.now();
12300
+ }
12301
+ signal == null ? void 0 : signal.throwIfAborted();
12302
+ deadline = performance.now() + rowCount / batchMaxRowsPerSecond * 1e3;
12303
+ }
12304
+ yield batch;
12305
+ signal == null ? void 0 : signal.throwIfAborted();
12306
+ }
12307
+ }
12308
+ function waitForBatch(delay, signal) {
12309
+ signal == null ? void 0 : signal.throwIfAborted();
12310
+ return new Promise((resolve2, reject) => {
12311
+ const timer = setTimeout(() => {
12312
+ signal == null ? void 0 : signal.removeEventListener("abort", abort);
12313
+ resolve2();
12314
+ }, delay);
12315
+ function abort() {
12316
+ clearTimeout(timer);
12317
+ signal == null ? void 0 : signal.removeEventListener("abort", abort);
12318
+ reject(signal == null ? void 0 : signal.reason);
12319
+ }
12320
+ signal == null ? void 0 : signal.addEventListener("abort", abort, { once: true });
12321
+ });
12322
+ }
12764
12323
  //# sourceMappingURL=index.cjs.map