@loaders.gl/scene 5.0.0-beta.2 → 5.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/DRACO-README.md +1 -1
  2. package/GLTF-README.md +1 -1
  3. package/OBJ-README.md +1 -1
  4. package/README.md +6 -1
  5. package/THIRD-PARTY-NOTICES.md +6 -0
  6. package/dist/dist.dev.js +6557 -1363
  7. package/dist/dist.min.js +24 -16
  8. package/dist/draco/draco-javascript-loader-with-parser.d.ts +2 -2
  9. package/dist/draco/draco-loader-types.cjs +3 -3
  10. package/dist/draco/draco-loader-types.cjs.map +2 -2
  11. package/dist/draco/draco-loader-types.d.ts +1 -1
  12. package/dist/draco/draco-loader-types.d.ts.map +1 -1
  13. package/dist/draco/draco-loader-types.js +1 -1
  14. package/dist/draco/draco-loader-types.js.map +1 -1
  15. package/dist/draco/draco-loader.d.ts +2 -2
  16. package/dist/draco/draco-wasm-loader-with-parser.d.ts +2 -2
  17. package/dist/draco/draco3d-loader-with-parser.d.ts +2 -2
  18. package/dist/draco/lib/utils/version.cjs +1 -1
  19. package/dist/draco/lib/utils/version.js +1 -1
  20. package/dist/draco-worker-node.js +806 -158
  21. package/dist/draco-worker-node.js.map +4 -4
  22. package/dist/draco-worker.js +775 -158
  23. package/dist/draco-worker.js.map +4 -4
  24. package/dist/draco-writer-worker-node.cjs +2122 -219
  25. package/dist/draco-writer-worker-node.cjs.map +4 -4
  26. package/dist/draco-writer-worker.js +2053 -220
  27. package/dist/draco-writer-worker.js.map +4 -4
  28. package/dist/gltf/gltf-loader-types.cjs.map +2 -2
  29. package/dist/gltf/gltf-loader-types.d.ts +6 -0
  30. package/dist/gltf/gltf-loader-types.d.ts.map +1 -1
  31. package/dist/gltf/gltf-loader-types.js.map +1 -1
  32. package/dist/gltf/index.cjs +2 -0
  33. package/dist/gltf/index.cjs.map +2 -2
  34. package/dist/gltf/index.d.ts +2 -2
  35. package/dist/gltf/index.d.ts.map +1 -1
  36. package/dist/gltf/index.js +1 -1
  37. package/dist/gltf/index.js.map +1 -1
  38. package/dist/gltf/lib/api/gltf-extensions.cjs +7 -2
  39. package/dist/gltf/lib/api/gltf-extensions.cjs.map +2 -2
  40. package/dist/gltf/lib/api/gltf-extensions.d.ts.map +1 -1
  41. package/dist/gltf/lib/api/gltf-extensions.js +7 -5
  42. package/dist/gltf/lib/api/gltf-extensions.js.map +1 -1
  43. package/dist/gltf/lib/extensions/EXT_texture_webp.cjs +1 -0
  44. package/dist/gltf/lib/extensions/EXT_texture_webp.cjs.map +2 -2
  45. package/dist/gltf/lib/extensions/EXT_texture_webp.d.ts.map +1 -1
  46. package/dist/gltf/lib/extensions/EXT_texture_webp.js +3 -0
  47. package/dist/gltf/lib/extensions/EXT_texture_webp.js.map +1 -1
  48. package/dist/gltf/lib/extensions/KHR_accessor_float64.cjs +45 -0
  49. package/dist/gltf/lib/extensions/KHR_accessor_float64.cjs.map +7 -0
  50. package/dist/gltf/lib/extensions/KHR_accessor_float64.d.ts +6 -0
  51. package/dist/gltf/lib/extensions/KHR_accessor_float64.d.ts.map +1 -0
  52. package/dist/gltf/lib/extensions/KHR_accessor_float64.js +20 -0
  53. package/dist/gltf/lib/extensions/KHR_accessor_float64.js.map +1 -0
  54. package/dist/gltf/lib/extensions/KHR_gaussian_splatting.cjs +23 -7
  55. package/dist/gltf/lib/extensions/KHR_gaussian_splatting.cjs.map +2 -2
  56. package/dist/gltf/lib/extensions/KHR_gaussian_splatting.d.ts +2 -1
  57. package/dist/gltf/lib/extensions/KHR_gaussian_splatting.d.ts.map +1 -1
  58. package/dist/gltf/lib/extensions/KHR_gaussian_splatting.js +21 -5
  59. package/dist/gltf/lib/extensions/KHR_gaussian_splatting.js.map +1 -1
  60. package/dist/gltf/lib/extensions/MSFT_texture_dds.cjs +64 -0
  61. package/dist/gltf/lib/extensions/MSFT_texture_dds.cjs.map +7 -0
  62. package/dist/gltf/lib/extensions/MSFT_texture_dds.d.ts +12 -0
  63. package/dist/gltf/lib/extensions/MSFT_texture_dds.d.ts.map +1 -0
  64. package/dist/gltf/lib/extensions/MSFT_texture_dds.js +39 -0
  65. package/dist/gltf/lib/extensions/MSFT_texture_dds.js.map +1 -0
  66. package/dist/gltf/lib/extensions/utils/3d-tiles-utils.cjs +1 -1
  67. package/dist/gltf/lib/extensions/utils/3d-tiles-utils.cjs.map +2 -2
  68. package/dist/gltf/lib/extensions/utils/3d-tiles-utils.d.ts.map +1 -1
  69. package/dist/gltf/lib/extensions/utils/3d-tiles-utils.js +3 -1
  70. package/dist/gltf/lib/extensions/utils/3d-tiles-utils.js.map +1 -1
  71. package/dist/gltf/lib/parsers/parse-gltf.cjs +25 -0
  72. package/dist/gltf/lib/parsers/parse-gltf.cjs.map +2 -2
  73. package/dist/gltf/lib/parsers/parse-gltf.d.ts +2 -0
  74. package/dist/gltf/lib/parsers/parse-gltf.d.ts.map +1 -1
  75. package/dist/gltf/lib/parsers/parse-gltf.js +18 -0
  76. package/dist/gltf/lib/parsers/parse-gltf.js.map +1 -1
  77. package/dist/gltf/lib/types/gltf-additional-extension-schemas.cjs +22 -0
  78. package/dist/gltf/lib/types/gltf-additional-extension-schemas.cjs.map +2 -2
  79. package/dist/gltf/lib/types/gltf-additional-extension-schemas.d.ts +23 -0
  80. package/dist/gltf/lib/types/gltf-additional-extension-schemas.d.ts.map +1 -1
  81. package/dist/gltf/lib/types/gltf-additional-extension-schemas.js +22 -0
  82. package/dist/gltf/lib/types/gltf-additional-extension-schemas.js.map +1 -1
  83. package/dist/gltf/lib/types/gltf-ext-gaussian-splatting-schema.cjs.map +1 -1
  84. package/dist/gltf/lib/types/gltf-ext-gaussian-splatting-schema.d.ts +1 -1
  85. package/dist/gltf/lib/types/gltf-ext-gaussian-splatting-schema.d.ts.map +1 -1
  86. package/dist/gltf/lib/types/gltf-extension-schemas.cjs +8 -0
  87. package/dist/gltf/lib/types/gltf-extension-schemas.cjs.map +2 -2
  88. package/dist/gltf/lib/types/gltf-extension-schemas.d.ts +27 -0
  89. package/dist/gltf/lib/types/gltf-extension-schemas.d.ts.map +1 -1
  90. package/dist/gltf/lib/types/gltf-extension-schemas.js +8 -1
  91. package/dist/gltf/lib/types/gltf-extension-schemas.js.map +1 -1
  92. package/dist/gltf/lib/types/gltf-json-schema.cjs.map +1 -1
  93. package/dist/gltf/lib/types/gltf-json-schema.d.ts +2 -2
  94. package/dist/gltf/lib/types/gltf-json-schema.d.ts.map +1 -1
  95. package/dist/gltf/lib/types/gltf-texture-procedurals.cjs +19 -0
  96. package/dist/gltf/lib/types/gltf-texture-procedurals.cjs.map +7 -0
  97. package/dist/gltf/lib/types/gltf-texture-procedurals.d.ts +45 -0
  98. package/dist/gltf/lib/types/gltf-texture-procedurals.d.ts.map +1 -0
  99. package/dist/gltf/lib/types/gltf-texture-procedurals.js +5 -0
  100. package/dist/gltf/lib/types/gltf-texture-procedurals.js.map +1 -0
  101. package/dist/gltf/lib/types/gltf-types.cjs.map +1 -1
  102. package/dist/gltf/lib/types/gltf-types.d.ts +7 -0
  103. package/dist/gltf/lib/types/gltf-types.d.ts.map +1 -1
  104. package/dist/gltf/lib/types/gltf-version-zod-schemas.d.ts +34 -0
  105. package/dist/gltf/lib/types/gltf-version-zod-schemas.d.ts.map +1 -1
  106. package/dist/gltf/lib/types/gltf-zod-schema.cjs +4 -1
  107. package/dist/gltf/lib/types/gltf-zod-schema.cjs.map +2 -2
  108. package/dist/gltf/lib/types/gltf-zod-schema.d.ts +56 -0
  109. package/dist/gltf/lib/types/gltf-zod-schema.d.ts.map +1 -1
  110. package/dist/gltf/lib/types/gltf-zod-schema.js +6 -2
  111. package/dist/gltf/lib/types/gltf-zod-schema.js.map +1 -1
  112. package/dist/gltf/lib/utils/version.cjs +1 -1
  113. package/dist/gltf/lib/utils/version.js +1 -1
  114. package/dist/gltf/schema.cjs +3 -0
  115. package/dist/gltf/schema.cjs.map +2 -2
  116. package/dist/gltf/schema.d.ts +1 -0
  117. package/dist/gltf/schema.d.ts.map +1 -1
  118. package/dist/gltf/schema.js +1 -0
  119. package/dist/gltf/schema.js.map +1 -1
  120. package/dist/gltf-loader-types.cjs.map +2 -2
  121. package/dist/index.cjs +7 -1
  122. package/dist/index.cjs.map +2 -2
  123. package/dist/index.d.ts +3 -0
  124. package/dist/index.d.ts.map +1 -1
  125. package/dist/index.js +3 -1
  126. package/dist/index.js.map +1 -1
  127. package/dist/materialx/parse-materialx.cjs +61 -0
  128. package/dist/materialx/parse-materialx.cjs.map +7 -0
  129. package/dist/materialx/parse-materialx.d.ts +23 -0
  130. package/dist/materialx/parse-materialx.d.ts.map +1 -0
  131. package/dist/materialx/parse-materialx.js +39 -0
  132. package/dist/materialx/parse-materialx.js.map +1 -0
  133. package/dist/materialx/procedural-graph.cjs +77 -0
  134. package/dist/materialx/procedural-graph.cjs.map +7 -0
  135. package/dist/materialx/procedural-graph.d.ts +40 -0
  136. package/dist/materialx/procedural-graph.d.ts.map +1 -0
  137. package/dist/materialx/procedural-graph.js +59 -0
  138. package/dist/materialx/procedural-graph.js.map +1 -0
  139. package/dist/materialx-loader-types.cjs +57 -0
  140. package/dist/materialx-loader-types.cjs.map +7 -0
  141. package/dist/materialx-loader-types.d.ts +34 -0
  142. package/dist/materialx-loader-types.d.ts.map +1 -0
  143. package/dist/materialx-loader-types.js +20 -0
  144. package/dist/materialx-loader-types.js.map +1 -0
  145. package/dist/materialx-loader.cjs +40 -0
  146. package/dist/materialx-loader.cjs.map +7 -0
  147. package/dist/materialx-loader.d.ts +19 -0
  148. package/dist/materialx-loader.d.ts.map +1 -0
  149. package/dist/materialx-loader.js +14 -0
  150. package/dist/materialx-loader.js.map +1 -0
  151. package/dist/mtl-loader-types.cjs +1 -1
  152. package/dist/obj/mtl-loader-types.cjs +1 -1
  153. package/dist/obj/mtl-loader-types.js +1 -1
  154. package/dist/obj/obj-loader-types.cjs +3 -3
  155. package/dist/obj/obj-loader-types.cjs.map +2 -2
  156. package/dist/obj/obj-loader-types.d.ts +1 -1
  157. package/dist/obj/obj-loader-types.d.ts.map +1 -1
  158. package/dist/obj/obj-loader-types.js +2 -2
  159. package/dist/obj/obj-loader-types.js.map +1 -1
  160. package/dist/obj/obj-loader.cjs +5 -5
  161. package/dist/obj/obj-loader.cjs.map +2 -2
  162. package/dist/obj/obj-loader.d.ts +1 -1
  163. package/dist/obj/obj-loader.d.ts.map +1 -1
  164. package/dist/obj/obj-loader.js +1 -1
  165. package/dist/obj/obj-loader.js.map +1 -1
  166. package/dist/obj/obj-writer.cjs +1 -1
  167. package/dist/obj/obj-writer.js +1 -1
  168. package/dist/obj-loader-types.cjs +3 -3
  169. package/dist/obj-loader-types.cjs.map +2 -2
  170. package/dist/obj-loader.cjs +5 -5
  171. package/dist/obj-loader.cjs.map +2 -2
  172. package/dist/obj-worker.js +985 -368
  173. package/dist/obj-writer.cjs +1 -1
  174. package/dist/stl/parse-stl.cjs +100 -0
  175. package/dist/stl/parse-stl.cjs.map +7 -0
  176. package/dist/stl/parse-stl.d.ts +4 -0
  177. package/dist/stl/parse-stl.d.ts.map +1 -0
  178. package/dist/stl/parse-stl.js +84 -0
  179. package/dist/stl/parse-stl.js.map +1 -0
  180. package/dist/stl-loader-types.cjs +58 -0
  181. package/dist/stl-loader-types.cjs.map +7 -0
  182. package/dist/stl-loader-types.d.ts +32 -0
  183. package/dist/stl-loader-types.d.ts.map +1 -0
  184. package/dist/stl-loader-types.js +25 -0
  185. package/dist/stl-loader-types.js.map +1 -0
  186. package/dist/stl-loader.cjs +38 -0
  187. package/dist/stl-loader.cjs.map +7 -0
  188. package/dist/stl-loader.d.ts +17 -0
  189. package/dist/stl-loader.d.ts.map +1 -0
  190. package/dist/stl-loader.js +13 -0
  191. package/dist/stl-loader.js.map +1 -0
  192. package/dist/usd/index.cjs.map +1 -1
  193. package/dist/usd/index.d.ts +1 -1
  194. package/dist/usd/index.d.ts.map +1 -1
  195. package/dist/usd/lib/parse-usd.cjs +42 -5
  196. package/dist/usd/lib/parse-usd.cjs.map +2 -2
  197. package/dist/usd/lib/parse-usd.d.ts.map +1 -1
  198. package/dist/usd/lib/parse-usd.js +53 -6
  199. package/dist/usd/lib/parse-usd.js.map +1 -1
  200. package/dist/usd/lib/parse-usdc.cjs +187 -0
  201. package/dist/usd/lib/parse-usdc.cjs.map +7 -0
  202. package/dist/usd/lib/parse-usdc.d.ts +4 -0
  203. package/dist/usd/lib/parse-usdc.d.ts.map +1 -0
  204. package/dist/usd/lib/parse-usdc.js +176 -0
  205. package/dist/usd/lib/parse-usdc.js.map +1 -0
  206. package/dist/usd/lib/parse-usdz.cjs +22 -0
  207. package/dist/usd/lib/parse-usdz.cjs.map +2 -2
  208. package/dist/usd/lib/parse-usdz.d.ts.map +1 -1
  209. package/dist/usd/lib/parse-usdz.js +26 -0
  210. package/dist/usd/lib/parse-usdz.js.map +1 -1
  211. package/dist/usd/lib/usd-types.cjs.map +1 -1
  212. package/dist/usd/lib/usd-types.d.ts +14 -1
  213. package/dist/usd/lib/usd-types.d.ts.map +1 -1
  214. package/dist/usd/lib/usd-types.js +1 -1
  215. package/dist/usd/lib/usd-types.js.map +1 -1
  216. package/dist/usd/libs/README.md +27 -0
  217. package/dist/usd/libs/THREE-LICENSE +21 -0
  218. package/dist/usd/libs/usdc-parser.d.ts +78 -0
  219. package/dist/usd/libs/usdc-parser.d.ts.map +1 -0
  220. package/dist/usd/libs/usdc-parser.js +1669 -0
  221. package/dist/usd/libs/usdc-parser.js.map +1 -0
  222. package/dist/usd/usd-loader-types.cjs +4 -4
  223. package/dist/usd/usd-loader-types.cjs.map +2 -2
  224. package/dist/usd/usd-loader-types.d.ts +7 -7
  225. package/dist/usd/usd-loader-types.d.ts.map +1 -1
  226. package/dist/usd/usd-loader-types.js +6 -6
  227. package/dist/usd/usd-loader-types.js.map +1 -1
  228. package/dist/usd/usd-loader.cjs.map +1 -1
  229. package/dist/usd/usd-loader.d.ts +4 -4
  230. package/dist/usd/usd-loader.d.ts.map +1 -1
  231. package/dist/usd/usd-loader.js +2 -2
  232. package/dist/usd/usd-loader.js.map +1 -1
  233. package/dist/usd-loader-types.cjs +4 -4
  234. package/dist/usd-loader-types.cjs.map +2 -2
  235. package/dist/usd-loader.cjs.map +1 -1
  236. package/package.json +19 -7
  237. package/src/draco/draco-loader-types.ts +1 -1
  238. package/src/gltf/gltf-loader-types.ts +6 -0
  239. package/src/gltf/index.ts +4 -1
  240. package/src/gltf/lib/api/gltf-extensions.ts +7 -2
  241. package/src/gltf/lib/extensions/EXT_texture_webp.ts +3 -0
  242. package/src/gltf/lib/extensions/KHR_accessor_float64.ts +22 -0
  243. package/src/gltf/lib/extensions/KHR_gaussian_splatting.ts +31 -7
  244. package/src/gltf/lib/extensions/MSFT_texture_dds.ts +52 -0
  245. package/src/gltf/lib/extensions/utils/3d-tiles-utils.ts +5 -1
  246. package/src/gltf/lib/parsers/parse-gltf.ts +31 -0
  247. package/src/gltf/lib/types/gltf-additional-extension-schemas.ts +32 -0
  248. package/src/gltf/lib/types/gltf-ext-gaussian-splatting-schema.ts +1 -1
  249. package/src/gltf/lib/types/gltf-extension-schemas.ts +12 -0
  250. package/src/gltf/lib/types/gltf-json-schema.ts +2 -1
  251. package/src/gltf/lib/types/gltf-texture-procedurals.ts +67 -0
  252. package/src/gltf/lib/types/gltf-types.ts +8 -0
  253. package/src/gltf/lib/types/gltf-zod-schema.ts +7 -1
  254. package/src/gltf/schema.ts +1 -0
  255. package/src/index.ts +6 -1
  256. package/src/materialx/README.md +5 -0
  257. package/src/materialx/parse-materialx.ts +70 -0
  258. package/src/materialx/procedural-graph.ts +94 -0
  259. package/src/materialx-loader-types.ts +24 -0
  260. package/src/materialx-loader.ts +15 -0
  261. package/src/obj/obj-loader-types.ts +1 -1
  262. package/src/obj/obj-loader.ts +1 -1
  263. package/src/stl/parse-stl.ts +90 -0
  264. package/src/stl-loader-types.ts +28 -0
  265. package/src/stl-loader.ts +12 -0
  266. package/src/usd/index.ts +1 -0
  267. package/src/usd/lib/parse-usd.ts +68 -7
  268. package/src/usd/lib/parse-usdc.ts +188 -0
  269. package/src/usd/lib/parse-usdz.ts +28 -0
  270. package/src/usd/lib/usd-types.ts +16 -2
  271. package/src/usd/libs/README.md +27 -0
  272. package/src/usd/libs/THREE-LICENSE +21 -0
  273. package/src/usd/libs/usdc-parser.d.ts +18 -0
  274. package/src/usd/libs/usdc-parser.js +1669 -0
  275. package/src/usd/usd-loader-types.ts +5 -5
  276. package/src/usd/usd-loader.ts +2 -2
@@ -7617,7 +7617,7 @@ var init_initialize_wasm_module = __esm({
7617
7617
 
7618
7618
  // ../core/src/worker-utils/lib/env-utils/version.ts
7619
7619
  function getVersion() {
7620
- const version2 = false ? NPM_TAG : "5.0.0-beta.2";
7620
+ const version2 = false ? NPM_TAG : "5.0.0-beta.5";
7621
7621
  globalThis._loadersgl_ = globalThis._loadersgl_ || {};
7622
7622
  globalThis._loadersgl_.version ||= version2;
7623
7623
  return version2;
@@ -7666,16 +7666,16 @@ var init_globals = __esm({
7666
7666
  }
7667
7667
  });
7668
7668
 
7669
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads.js
7669
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads.js
7670
7670
  var import_worker_threads, parentPort;
7671
7671
  var init_worker_threads = __esm({
7672
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads.js"() {
7672
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads.js"() {
7673
7673
  import_worker_threads = require("worker_threads");
7674
7674
  parentPort = import_worker_threads.parentPort;
7675
7675
  }
7676
7676
  });
7677
7677
 
7678
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js
7678
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
7679
7679
  function getTransferList(object2, recursive = true, transfers) {
7680
7680
  const transfersSet = transfers || /* @__PURE__ */ new Set();
7681
7681
  const seen = /* @__PURE__ */ new Set();
@@ -7688,6 +7688,9 @@ function getTransferList(object2, recursive = true, transfers) {
7688
7688
  else if (ArrayBuffer.isView(value)) {
7689
7689
  if (isTransferable(value.buffer))
7690
7690
  transfersSet.add(value.buffer);
7691
+ } else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
7692
+ visit(value.port1);
7693
+ visit(value.port2);
7691
7694
  } else if (recursive && value instanceof Map) {
7692
7695
  for (const [key, item] of value) {
7693
7696
  visit(key);
@@ -7723,11 +7726,11 @@ function isTransferable(object2) {
7723
7726
  return false;
7724
7727
  }
7725
7728
  var init_get_transfer_list = __esm({
7726
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
7729
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
7727
7730
  }
7728
7731
  });
7729
7732
 
7730
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js
7733
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
7731
7734
  async function getParentPort() {
7732
7735
  return parentPort;
7733
7736
  }
@@ -7740,7 +7743,7 @@ function getWorkerMessageData(message) {
7740
7743
  }
7741
7744
  var onMessageWrapperMap, WorkerBody;
7742
7745
  var init_worker_body = __esm({
7743
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js"() {
7746
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
7744
7747
  init_get_transfer_list();
7745
7748
  init_worker_threads();
7746
7749
  onMessageWrapperMap = /* @__PURE__ */ new Map();
@@ -7755,16 +7758,16 @@ var init_worker_body = __esm({
7755
7758
  */
7756
7759
  static set onmessage(onMessage) {
7757
7760
  async function handleMessage(message) {
7758
- const parentPort2 = await getParentPort();
7759
- const { type, payload } = parentPort2 ? message : message.data;
7761
+ const parentPort3 = await getParentPort();
7762
+ const { type, payload } = parentPort3 ? message : message.data;
7760
7763
  onMessage(type, payload);
7761
7764
  }
7762
- getParentPort().then((parentPort2) => {
7763
- if (parentPort2) {
7764
- parentPort2.on("message", (message) => {
7765
+ getParentPort().then((parentPort3) => {
7766
+ if (parentPort3) {
7767
+ parentPort3.on("message", (message) => {
7765
7768
  handleMessage(message);
7766
7769
  });
7767
- parentPort2.on("exit", () => console.debug("Node worker closing"));
7770
+ parentPort3.on("exit", () => console.debug("Node worker closing"));
7768
7771
  } else {
7769
7772
  globalThis.onmessage = handleMessage;
7770
7773
  }
@@ -7782,9 +7785,9 @@ var init_worker_body = __esm({
7782
7785
  };
7783
7786
  onMessageWrapperMap.set(onMessage, onMessageWrapper);
7784
7787
  }
7785
- const parentPort2 = await getParentPort();
7786
- if (parentPort2) {
7787
- parentPort2.on("message", onMessageWrapper);
7788
+ const parentPort3 = await getParentPort();
7789
+ if (parentPort3) {
7790
+ parentPort3.on("message", onMessageWrapper);
7788
7791
  } else {
7789
7792
  globalThis.addEventListener("message", onMessageWrapper);
7790
7793
  }
@@ -7795,9 +7798,9 @@ var init_worker_body = __esm({
7795
7798
  if (!onMessageWrapper) {
7796
7799
  return;
7797
7800
  }
7798
- const parentPort2 = await getParentPort();
7799
- if (parentPort2) {
7800
- parentPort2.off("message", onMessageWrapper);
7801
+ const parentPort3 = await getParentPort();
7802
+ if (parentPort3) {
7803
+ parentPort3.off("message", onMessageWrapper);
7801
7804
  } else {
7802
7805
  globalThis.removeEventListener("message", onMessageWrapper);
7803
7806
  }
@@ -7807,12 +7810,12 @@ var init_worker_body = __esm({
7807
7810
  * @param type
7808
7811
  * @param payload
7809
7812
  */
7810
- static async postMessage(type, payload) {
7813
+ static async postMessage(type, payload, copy = false) {
7811
7814
  const data = { source: "loaders.gl", type, payload };
7812
- const transferList = getTransferList(payload);
7813
- const parentPort2 = await getParentPort();
7814
- if (parentPort2) {
7815
- parentPort2.postMessage(data, transferList);
7815
+ const transferList = copy ? [] : getTransferList(payload);
7816
+ const parentPort3 = await getParentPort();
7817
+ if (parentPort3) {
7818
+ parentPort3.postMessage(data, transferList);
7816
7819
  } else {
7817
7820
  globalThis.postMessage(data, transferList);
7818
7821
  }
@@ -7821,10 +7824,10 @@ var init_worker_body = __esm({
7821
7824
  }
7822
7825
  });
7823
7826
 
7824
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js
7827
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
7825
7828
  var AsyncQueue;
7826
7829
  var init_async_queue = __esm({
7827
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js"() {
7830
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
7828
7831
  AsyncQueue = class {
7829
7832
  constructor() {
7830
7833
  this._values = [];
@@ -7893,10 +7896,10 @@ var init_async_queue = __esm({
7893
7896
  }
7894
7897
  });
7895
7898
 
7896
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js
7899
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
7897
7900
  var SharedWorkerState;
7898
7901
  var init_shared_state = __esm({
7899
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js"() {
7902
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
7900
7903
  SharedWorkerState = class {
7901
7904
  constructor(buffer2) {
7902
7905
  if (typeof SharedArrayBuffer === "undefined" || !(buffer2 instanceof SharedArrayBuffer) || buffer2.byteLength !== 16)
@@ -7937,8 +7940,19 @@ var init_shared_state = __esm({
7937
7940
  }
7938
7941
  });
7939
7942
 
7940
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
7941
- async function createWorker(process2, processInBatches) {
7943
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
7944
+ function validateOutputOwnership(ownership) {
7945
+ if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
7946
+ throw new Error("Invalid worker output ownership");
7947
+ }
7948
+ }
7949
+ var init_validate_output_ownership = __esm({
7950
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
7951
+ }
7952
+ });
7953
+
7954
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
7955
+ async function createWorker(process2, processInBatches, preload2) {
7942
7956
  if (!await WorkerBody.inWorkerThread()) {
7943
7957
  return;
7944
7958
  }
@@ -7946,7 +7960,7 @@ async function createWorker(process2, processInBatches) {
7946
7960
  process: processOnMainThread
7947
7961
  };
7948
7962
  WorkerBody.onmessage = async (type, payload) => {
7949
- var _a5;
7963
+ var _a5, _b2, _c2, _d2, _e2;
7950
7964
  if (type === "cancel") {
7951
7965
  activeController == null ? void 0 : activeController.abort();
7952
7966
  activeInputBatches == null ? void 0 : activeInputBatches.close();
@@ -7980,10 +7994,12 @@ async function createWorker(process2, processInBatches) {
7980
7994
  }
7981
7995
  switch (type) {
7982
7996
  case "preload":
7997
+ await (preload2 == null ? void 0 : preload2());
7983
7998
  WorkerBody.postMessage("done", {});
7984
7999
  break;
7985
8000
  case "process":
7986
8001
  throwIfAborted();
8002
+ validateOutputOwnership((_b2 = payload.options) == null ? void 0 : _b2["outputOwnership"]);
7987
8003
  if (!process2) {
7988
8004
  throw new Error("Worker does not support atomic processing");
7989
8005
  }
@@ -7993,10 +8009,11 @@ async function createWorker(process2, processInBatches) {
7993
8009
  await WorkerBody.postMessage("done", {
7994
8010
  result,
7995
8011
  executionMs: performance.now() - startedAt
7996
- });
8012
+ }, ((_c2 = payload.options) == null ? void 0 : _c2["outputOwnership"]) === "copy");
7997
8013
  break;
7998
8014
  case "process-in-batches":
7999
8015
  throwIfAborted();
8016
+ validateOutputOwnership((_d2 = payload.options) == null ? void 0 : _d2["outputOwnership"]);
8000
8017
  if (!processInBatches) {
8001
8018
  throw new Error("Worker does not support batched processing");
8002
8019
  }
@@ -8008,7 +8025,7 @@ async function createWorker(process2, processInBatches) {
8008
8025
  const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
8009
8026
  for await (const batch of resultIterator) {
8010
8027
  throwIfAborted();
8011
- await WorkerBody.postMessage("output-batch", { result: batch });
8028
+ await WorkerBody.postMessage("output-batch", { result: batch }, ((_e2 = payload.options) == null ? void 0 : _e2["outputOwnership"]) === "copy");
8012
8029
  await outputAcknowledgements.next();
8013
8030
  }
8014
8031
  throwIfAborted();
@@ -8106,14 +8123,14 @@ function processOnMainThread(arrayBuffer2, options = {}, jobContext = {}) {
8106
8123
  });
8107
8124
  }
8108
8125
  function createProgressReporter() {
8109
- let pending;
8126
+ let pending2;
8110
8127
  let finished2 = false;
8111
8128
  let scheduled = false;
8112
8129
  const flush = () => {
8113
8130
  scheduled = false;
8114
- if (pending) {
8115
- WorkerBody.postMessage("progress", { progress: pending });
8116
- pending = void 0;
8131
+ if (pending2) {
8132
+ WorkerBody.postMessage("progress", { progress: pending2 });
8133
+ pending2 = void 0;
8117
8134
  }
8118
8135
  };
8119
8136
  return {
@@ -8121,9 +8138,9 @@ function createProgressReporter() {
8121
8138
  report(progress) {
8122
8139
  if (finished2)
8123
8140
  return;
8124
- if (pending && pending.phase !== progress.phase)
8141
+ if (pending2 && pending2.phase !== progress.phase)
8125
8142
  flush();
8126
- pending = { ...progress };
8143
+ pending2 = { ...progress };
8127
8144
  if (!scheduled) {
8128
8145
  scheduled = true;
8129
8146
  setTimeout(flush, 0);
@@ -8132,7 +8149,7 @@ function createProgressReporter() {
8132
8149
  /** Flushes final progress and suppresses reports from stale callbacks. */
8133
8150
  finish(discard = false) {
8134
8151
  if (discard)
8135
- pending = void 0;
8152
+ pending2 = void 0;
8136
8153
  flush();
8137
8154
  finished2 = true;
8138
8155
  }
@@ -8140,10 +8157,11 @@ function createProgressReporter() {
8140
8157
  }
8141
8158
  var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
8142
8159
  var init_create_worker = __esm({
8143
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js"() {
8160
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
8144
8161
  init_shared_state();
8145
8162
  init_async_queue();
8146
8163
  init_worker_body();
8164
+ init_validate_output_ownership();
8147
8165
  requestId = 0;
8148
8166
  activeController = null;
8149
8167
  activeInputBatches = null;
@@ -8151,29 +8169,619 @@ var init_create_worker = __esm({
8151
8169
  }
8152
8170
  });
8153
8171
 
8154
- // ../../node_modules/@math.gl/core/dist/worker-utils/index.js
8172
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
8155
8173
  var import_meta3, path3, moduleUrl;
8156
8174
  var init_worker_utils = __esm({
8157
- "../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
8175
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
8176
+ init_worker_body();
8158
8177
  init_create_worker();
8178
+ init_get_transfer_list();
8159
8179
  import_meta3 = {};
8160
8180
  path3 = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
8161
8181
  moduleUrl = path3 ? `file://${path3.startsWith("/") ? "" : "/"}${encodeURI(path3).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta3.url;
8162
8182
  }
8163
8183
  });
8164
8184
 
8165
- // ../../node_modules/@math.gl/core/dist/tasks/index.js
8166
- var init_tasks = __esm({
8167
- "../../node_modules/@math.gl/core/dist/tasks/index.js"() {
8185
+ // ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
8186
+ function preloadTaskCode(task, signal) {
8187
+ if (!task.preload)
8188
+ return Promise.resolve();
8189
+ let promise = pending.get(task);
8190
+ if (!promise) {
8191
+ promise = Promise.resolve().then(() => task.preload()).then(() => {
8192
+ loaded.add(task);
8193
+ });
8194
+ pending.set(task, promise);
8195
+ void promise.catch(() => pending.delete(task));
8196
+ }
8197
+ return withSignal(promise, signal);
8198
+ }
8199
+ function withSignal(operation, signal) {
8200
+ if (!signal)
8201
+ return operation;
8202
+ return new Promise((resolve, reject) => {
8203
+ const abort = () => {
8204
+ signal.removeEventListener("abort", abort);
8205
+ reject(signal.reason);
8206
+ };
8207
+ signal.addEventListener("abort", abort, { once: true });
8208
+ if (signal.aborted)
8209
+ abort();
8210
+ operation.then((value) => {
8211
+ signal.removeEventListener("abort", abort);
8212
+ resolve(value);
8213
+ }, (error) => {
8214
+ signal.removeEventListener("abort", abort);
8215
+ reject(error);
8216
+ });
8217
+ });
8218
+ }
8219
+ var pending, loaded;
8220
+ var init_task_preload = __esm({
8221
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
8222
+ pending = /* @__PURE__ */ new WeakMap();
8223
+ loaded = /* @__PURE__ */ new WeakSet();
8224
+ }
8225
+ });
8226
+
8227
+ // ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
8228
+ var TaskRequestError, TaskChannel;
8229
+ var init_task_channel = __esm({
8230
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js"() {
8231
+ TaskRequestError = class extends Error {
8232
+ };
8233
+ TaskChannel = class {
8234
+ constructor(options) {
8235
+ this.options = options;
8236
+ this.nextId = 1;
8237
+ this.pending = /* @__PURE__ */ new Map();
8238
+ this.incoming = /* @__PURE__ */ new Map();
8239
+ }
8240
+ /** Send a request without serializing other in-flight requests. */
8241
+ request(operation, value, signal, transfer = []) {
8242
+ if (this.failure)
8243
+ return Promise.reject(this.failure.reason);
8244
+ if (signal == null ? void 0 : signal.aborted)
8245
+ return Promise.reject(signal.reason);
8246
+ const id = this.nextId++;
8247
+ return new Promise((resolve, reject) => {
8248
+ const abort = () => {
8249
+ const pending2 = this.pending.get(id);
8250
+ if (!pending2)
8251
+ return;
8252
+ this.pending.delete(id);
8253
+ pending2.cleanup();
8254
+ reject(signal == null ? void 0 : signal.reason);
8255
+ this.send({ source: "math.gl/tasks", kind: "cancel", id });
8256
+ };
8257
+ this.pending.set(id, {
8258
+ resolve,
8259
+ reject,
8260
+ cleanup: () => signal == null ? void 0 : signal.removeEventListener("abort", abort)
8261
+ });
8262
+ signal == null ? void 0 : signal.addEventListener("abort", abort, { once: true });
8263
+ this.send({ source: "math.gl/tasks", kind: "request", id, operation, value }, transfer);
8264
+ });
8265
+ }
8266
+ /** Send a one-way notification. */
8267
+ emit(operation, value, transfer = []) {
8268
+ if (this.failure)
8269
+ throw this.failure.reason;
8270
+ this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation, value }, transfer);
8271
+ }
8272
+ /** Dispatch a transport message; unrelated protocols are ignored. */
8273
+ receive(message) {
8274
+ var _a5, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
8275
+ if (this.failure || (message == null ? void 0 : message.source) !== "math.gl/tasks")
8276
+ return;
8277
+ if (message.kind === "failure") {
8278
+ const reason = new Error(((_a5 = message.error) == null ? void 0 : _a5.message) ?? "Task channel failed");
8279
+ this.close(reason);
8280
+ (_c2 = (_b2 = this.options).onFailure) == null ? void 0 : _c2.call(_b2, reason);
8281
+ } else if (message.kind === "result" || message.kind === "error") {
8282
+ const pending2 = this.pending.get(message.id);
8283
+ if (!pending2)
8284
+ return;
8285
+ this.pending.delete(message.id);
8286
+ pending2.cleanup();
8287
+ if (message.kind === "result")
8288
+ pending2.resolve(message.value);
8289
+ else {
8290
+ const error = new TaskRequestError(((_d2 = message.error) == null ? void 0 : _d2.message) ?? "Task request failed");
8291
+ error.name = ((_e2 = message.error) == null ? void 0 : _e2.name) ?? "Error";
8292
+ pending2.reject(error);
8293
+ }
8294
+ } else if (message.kind === "cancel") {
8295
+ (_f2 = this.incoming.get(message.id)) == null ? void 0 : _f2.abort(new DOMException("Task request cancelled", "AbortError"));
8296
+ } else if (message.kind === "event") {
8297
+ try {
8298
+ (_h2 = (_g2 = this.options).handleEvent) == null ? void 0 : _h2.call(_g2, message.operation, message.value);
8299
+ } catch (error) {
8300
+ this.fail(error);
8301
+ }
8302
+ } else if (message.kind === "request") {
8303
+ if (this.incoming.has(message.id)) {
8304
+ this.fail(new Error("Duplicate task request identifier"));
8305
+ return;
8306
+ }
8307
+ const controller = new AbortController();
8308
+ this.incoming.set(message.id, controller);
8309
+ void Promise.resolve().then(() => {
8310
+ controller.signal.throwIfAborted();
8311
+ return this.options.handleRequest(message.operation, message.value, controller.signal);
8312
+ }).then((value) => {
8313
+ var _a6, _b3;
8314
+ if (!controller.signal.aborted && !this.failure) {
8315
+ this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value }, (_b3 = (_a6 = this.options).getResultTransferList) == null ? void 0 : _b3.call(_a6, value, message.value));
8316
+ }
8317
+ }).catch((reason) => {
8318
+ if (!controller.signal.aborted && !this.failure) {
8319
+ this.send({
8320
+ source: "math.gl/tasks",
8321
+ kind: "error",
8322
+ id: message.id,
8323
+ error: {
8324
+ name: reason instanceof Error ? reason.name : "Error",
8325
+ message: reason instanceof Error ? reason.message : String(reason)
8326
+ }
8327
+ });
8328
+ }
8329
+ }).finally(() => this.incoming.delete(message.id));
8330
+ }
8331
+ }
8332
+ /** Reject all outstanding calls with a common cause and abort incoming callbacks. */
8333
+ close(reason = new Error("Task channel closed")) {
8334
+ if (this.failure)
8335
+ return;
8336
+ this.failure = { reason };
8337
+ for (const pending2 of this.pending.values()) {
8338
+ pending2.cleanup();
8339
+ pending2.reject(reason);
8340
+ }
8341
+ this.pending.clear();
8342
+ for (const controller of this.incoming.values())
8343
+ controller.abort(reason);
8344
+ this.incoming.clear();
8345
+ }
8346
+ send(message, transfer = []) {
8347
+ if (this.failure)
8348
+ return;
8349
+ try {
8350
+ this.options.send(message, transfer);
8351
+ } catch (error) {
8352
+ this.fail(error);
8353
+ }
8354
+ }
8355
+ /** Invalidate the channel and notify the peer when the transport still works. */
8356
+ fail(reason) {
8357
+ var _a5, _b2;
8358
+ if (this.failure)
8359
+ return;
8360
+ this.close(reason);
8361
+ try {
8362
+ this.options.send({
8363
+ source: "math.gl/tasks",
8364
+ kind: "failure",
8365
+ id: 0,
8366
+ error: {
8367
+ name: reason instanceof Error ? reason.name : "Error",
8368
+ message: reason instanceof Error ? reason.message : String(reason)
8369
+ }
8370
+ }, []);
8371
+ } catch {
8372
+ }
8373
+ (_b2 = (_a5 = this.options).onFailure) == null ? void 0 : _b2.call(_a5, reason);
8374
+ }
8375
+ };
8376
+ }
8377
+ });
8378
+
8379
+ // ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
8380
+ function assertPayload(value) {
8381
+ if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
8382
+ throw new TypeError("Task payloads must be plain objects with named fields");
8383
+ }
8384
+ }
8385
+ function clonePayload(value, ownership = "copy") {
8386
+ assertPayload(value);
8387
+ if (!["copy", "transfer", "share"].includes(ownership))
8388
+ throw new TypeError("Invalid input ownership");
8389
+ const transfer = getTransferList(value);
8390
+ if (ownership === "share" && transfer.length)
8391
+ throw new TypeError("Share requires shared storage");
8392
+ return structuredClone(value, {
8393
+ transfer: ownership === "transfer" ? transfer : []
8394
+ });
8395
+ }
8396
+ function taskContext(state, context = {}) {
8397
+ const signal = context.signal ?? new AbortController().signal;
8398
+ return {
8399
+ state,
8400
+ signal,
8401
+ requestHost: async (operation, payload, controls) => {
8402
+ signal.throwIfAborted();
8403
+ if (!context.requestHost)
8404
+ throw new Error("No host request handler configured");
8405
+ return context.requestHost(operation, payload, controls);
8406
+ },
8407
+ emitHost: (operation, payload) => {
8408
+ var _a5;
8409
+ signal.throwIfAborted();
8410
+ (_a5 = context.emitHost) == null ? void 0 : _a5.call(context, operation, payload);
8411
+ },
8412
+ throwIfAborted: () => {
8413
+ var _a5;
8414
+ signal.throwIfAborted();
8415
+ (_a5 = context.throwIfAborted) == null ? void 0 : _a5.call(context);
8416
+ },
8417
+ reportProgress: (progress) => {
8418
+ var _a5;
8419
+ return (_a5 = context.reportProgress) == null ? void 0 : _a5.call(context, {
8420
+ ...progress,
8421
+ phase: progress.phase ?? "process",
8422
+ unit: progress.unit ?? "items"
8423
+ });
8424
+ }
8425
+ };
8426
+ }
8427
+ async function initializeTaskWorker(task) {
8428
+ if (!await WorkerBody.inWorkerThread())
8429
+ throw new Error("initializeTaskWorker must run inside a worker");
8430
+ if (installed)
8431
+ throw new Error("A task is already installed in this worker");
8432
+ installed = true;
8433
+ const runtime = new TaskRuntime(task);
8434
+ let channelStream;
8435
+ const channel = new TaskChannel({
8436
+ getResultTransferList: (value, request) => request.outputOwnership === "transfer" ? getTransferList(value) : [],
8437
+ send: (message, transfer) => {
8438
+ const snapshot = structuredClone(message, { transfer });
8439
+ void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
8440
+ },
8441
+ handleRequest: async (operation, value, signal) => {
8442
+ var _a5;
8443
+ const request = value;
8444
+ const context = {
8445
+ signal,
8446
+ reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
8447
+ requestHost: (operation2, payload, controls = {}) => {
8448
+ const request2 = {
8449
+ operation: operation2,
8450
+ payload: clonePayload(payload, controls.inputOwnership),
8451
+ outputOwnership: controls.outputOwnership ?? "copy"
8452
+ };
8453
+ return channel.request("task:host-request", request2, signal, getTransferList(request2));
8454
+ },
8455
+ emitHost: (operation2, payload) => channel.emit("task:host-event", { operation: operation2, payload, id: request.progressId })
8456
+ };
8457
+ switch (operation) {
8458
+ case "initialize":
8459
+ return runtime.initialize(request.input, context);
8460
+ case "process":
8461
+ return runtime.process(request.input, request.options, context);
8462
+ case "stream-open": {
8463
+ if (channelStream)
8464
+ throw new Error("A task stream is already open");
8465
+ async function* inputs() {
8466
+ while (true) {
8467
+ const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
8468
+ if (result.done)
8469
+ return;
8470
+ yield result.value;
8471
+ }
8472
+ }
8473
+ channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
8474
+ return {};
8475
+ }
8476
+ case "stream-next":
8477
+ if (!channelStream)
8478
+ throw new Error("No active task stream");
8479
+ return channelStream.next();
8480
+ case "stream-close":
8481
+ try {
8482
+ await ((_a5 = channelStream == null ? void 0 : channelStream.return) == null ? void 0 : _a5.call(channelStream));
8483
+ } finally {
8484
+ channelStream = void 0;
8485
+ }
8486
+ return {};
8487
+ case "destroy":
8488
+ return runtime.destroy();
8489
+ default:
8490
+ throw new Error("Unknown task channel operation");
8491
+ }
8492
+ }
8493
+ });
8494
+ await WorkerBody.addEventListener((type, payload) => {
8495
+ if (type === "task-channel")
8496
+ channel.receive(payload);
8497
+ });
8498
+ let streamOptions = {};
8499
+ return createWorker(async (request, _options, context) => {
8500
+ switch (request.operation) {
8501
+ case "initialize":
8502
+ return runtime.initialize(request.input, context);
8503
+ case "destroy":
8504
+ return runtime.destroy();
8505
+ case "stream-options":
8506
+ streamOptions = request.options;
8507
+ return {};
8508
+ case "process":
8509
+ return runtime.process(request.input, request.options, context);
8510
+ default:
8511
+ throw new Error("Unknown task operation");
8512
+ }
8513
+ }, async function* (inputs, _options, context) {
8514
+ async function* batches() {
8515
+ for await (const input of inputs) {
8516
+ assertPayload(input);
8517
+ yield input;
8518
+ }
8519
+ }
8520
+ try {
8521
+ yield* runtime.stream(batches(), streamOptions, context);
8522
+ } finally {
8523
+ streamOptions = {};
8524
+ }
8525
+ }, () => preloadTaskCode(task));
8526
+ }
8527
+ var TaskRuntime, installed;
8528
+ var init_task_runtime = __esm({
8529
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
8168
8530
  init_worker_utils();
8531
+ init_task_preload();
8532
+ init_task_channel();
8533
+ TaskRuntime = class {
8534
+ constructor(task) {
8535
+ this.task = task;
8536
+ this.initialized = false;
8537
+ }
8538
+ async initialize(input, context = {}) {
8539
+ var _a5, _b2, _c2;
8540
+ if (this.initialized)
8541
+ throw new Error("Task is already initialized");
8542
+ assertPayload(input);
8543
+ await preloadTaskCode(this.task, context.signal);
8544
+ (_a5 = context.signal) == null ? void 0 : _a5.throwIfAborted();
8545
+ this.state = await ((_c2 = (_b2 = this.task).initialize) == null ? void 0 : _c2.call(_b2, input, taskContext(void 0, context)));
8546
+ this.initialized = true;
8547
+ return {};
8548
+ }
8549
+ async destroy() {
8550
+ var _a5, _b2;
8551
+ if (this.initialized) {
8552
+ this.initialized = false;
8553
+ const state = this.state;
8554
+ this.state = void 0;
8555
+ if (this.task.initialize)
8556
+ await ((_b2 = (_a5 = this.task).destroy) == null ? void 0 : _b2.call(_a5, state));
8557
+ }
8558
+ return {};
8559
+ }
8560
+ async process(input, options, context = {}) {
8561
+ if (!this.initialized)
8562
+ throw new Error("Task is not initialized");
8563
+ if (!this.task.process)
8564
+ throw new Error("Task has no atomic processor");
8565
+ assertPayload(input);
8566
+ const result = await this.task.process(input, options, taskContext(this.state, context));
8567
+ assertPayload(result);
8568
+ return result;
8569
+ }
8570
+ async *stream(inputs, options, context = {}) {
8571
+ if (!this.initialized)
8572
+ throw new Error("Task is not initialized");
8573
+ if (!this.task.processInBatches)
8574
+ throw new Error("Task has no streaming processor");
8575
+ for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
8576
+ assertPayload(output);
8577
+ yield output;
8578
+ }
8579
+ }
8580
+ };
8581
+ installed = false;
8582
+ }
8583
+ });
8584
+
8585
+ // ../../node_modules/@math.gl/tasks/dist/tasks/index.js
8586
+ var init_tasks = __esm({
8587
+ "../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
8588
+ init_task_runtime();
8589
+ }
8590
+ });
8591
+
8592
+ // ../../node_modules/@math.gl/tasks/dist/index.js
8593
+ var init_dist2 = __esm({
8594
+ "../../node_modules/@math.gl/tasks/dist/index.js"() {
8595
+ init_tasks();
8596
+ }
8597
+ });
8598
+
8599
+ // ../core/src/worker-utils/lib/node/worker_threads.ts
8600
+ var worker_threads_exports = {};
8601
+ __export(worker_threads_exports, {
8602
+ BroadcastChannel: () => import_worker_threads3.BroadcastChannel,
8603
+ MessageChannel: () => import_worker_threads3.MessageChannel,
8604
+ MessagePort: () => import_worker_threads3.MessagePort,
8605
+ NodeWorker: () => NodeWorker,
8606
+ SHARE_ENV: () => import_worker_threads3.SHARE_ENV,
8607
+ Worker: () => import_worker_threads3.Worker,
8608
+ getEnvironmentData: () => import_worker_threads3.getEnvironmentData,
8609
+ isInternalThread: () => isInternalThread2,
8610
+ isMainThread: () => import_worker_threads3.isMainThread,
8611
+ isMarkedAsUntransferable: () => import_worker_threads3.isMarkedAsUntransferable,
8612
+ locks: () => locks2,
8613
+ markAsUncloneable: () => import_worker_threads3.markAsUncloneable,
8614
+ markAsUntransferable: () => import_worker_threads3.markAsUntransferable,
8615
+ moveMessagePortToContext: () => import_worker_threads3.moveMessagePortToContext,
8616
+ parentPort: () => parentPort2,
8617
+ postMessageToThread: () => import_worker_threads3.postMessageToThread,
8618
+ receiveMessageOnPort: () => import_worker_threads3.receiveMessageOnPort,
8619
+ resourceLimits: () => import_worker_threads3.resourceLimits,
8620
+ setEnvironmentData: () => import_worker_threads3.setEnvironmentData,
8621
+ structuredClone: () => structuredClone3,
8622
+ threadId: () => import_worker_threads3.threadId,
8623
+ threadName: () => threadName2,
8624
+ workerData: () => import_worker_threads3.workerData
8625
+ });
8626
+ var WorkerThreads, import_worker_threads3, parentPort2, NodeWorker, isInternalThread2, threadName2, locks2, structuredClone3;
8627
+ var init_worker_threads2 = __esm({
8628
+ "../core/src/worker-utils/lib/node/worker_threads.ts"() {
8629
+ "use strict";
8630
+ WorkerThreads = __toESM(require("worker_threads"), 1);
8631
+ import_worker_threads3 = require("worker_threads");
8632
+ parentPort2 = WorkerThreads == null ? void 0 : WorkerThreads.parentPort;
8633
+ NodeWorker = WorkerThreads.Worker;
8634
+ isInternalThread2 = WorkerThreads.isInternalThread;
8635
+ threadName2 = WorkerThreads.threadName;
8636
+ locks2 = WorkerThreads.locks;
8637
+ structuredClone3 = WorkerThreads.structuredClone;
8638
+ }
8639
+ });
8640
+
8641
+ // ../core/src/worker-utils/lib/worker-api/task-runtime.ts
8642
+ function normalizeTaskProgress(progress) {
8643
+ return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
8644
+ }
8645
+ async function isWorkerThread() {
8646
+ var _a5;
8647
+ if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
8648
+ return true;
8649
+ if (typeof process !== "undefined" && ((_a5 = process.versions) == null ? void 0 : _a5.node)) {
8650
+ const { isMainThread: isMainThread2 } = await Promise.resolve().then(() => (init_worker_threads2(), worker_threads_exports));
8651
+ return !isMainThread2;
8652
+ }
8653
+ return false;
8654
+ }
8655
+ var initializeTaskWorker2;
8656
+ var init_task_runtime2 = __esm({
8657
+ "../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
8658
+ "use strict";
8659
+ init_dist2();
8660
+ initializeTaskWorker2 = initializeTaskWorker;
8661
+ }
8662
+ });
8663
+
8664
+ // ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
8665
+ function getTransferList2(object2, recursive = true, transfers) {
8666
+ const transfersSet = transfers || /* @__PURE__ */ new Set();
8667
+ if (!object2) {
8668
+ } else if (isTransferable2(object2)) {
8669
+ transfersSet.add(object2);
8670
+ } else if (isTransferable2(object2.buffer)) {
8671
+ transfersSet.add(object2.buffer);
8672
+ } else if (ArrayBuffer.isView(object2)) {
8673
+ } else if (recursive && typeof object2 === "object") {
8674
+ for (const key in object2) {
8675
+ getTransferList2(object2[key], recursive, transfersSet);
8676
+ }
8677
+ }
8678
+ return transfers === void 0 ? Array.from(transfersSet) : [];
8679
+ }
8680
+ function isTransferable2(object2) {
8681
+ if (!object2) {
8682
+ return false;
8683
+ }
8684
+ if (object2 instanceof ArrayBuffer) {
8685
+ return true;
8686
+ }
8687
+ if (typeof MessagePort !== "undefined" && object2 instanceof MessagePort) {
8688
+ return true;
8689
+ }
8690
+ if (typeof ImageBitmap !== "undefined" && object2 instanceof ImageBitmap) {
8691
+ return true;
8692
+ }
8693
+ if (typeof OffscreenCanvas !== "undefined" && object2 instanceof OffscreenCanvas) {
8694
+ return true;
8695
+ }
8696
+ return false;
8697
+ }
8698
+ var init_get_transfer_list2 = __esm({
8699
+ "../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
8700
+ "use strict";
8169
8701
  }
8170
8702
  });
8171
8703
 
8172
8704
  // ../core/src/worker-utils/lib/worker-api/create-worker.ts
8705
+ async function createWorker2(process2, processInBatches) {
8706
+ if (!await isWorkerThread()) return;
8707
+ await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
8708
+ }
8709
+ function createWorkerTask(process2, processInBatches) {
8710
+ return {
8711
+ id: "loaders.gl",
8712
+ initialize: (state) => state,
8713
+ destroy: (state) => {
8714
+ var _a5;
8715
+ return (_a5 = state.port) == null ? void 0 : _a5.close();
8716
+ },
8717
+ process: async ({ value }, options, context) => {
8718
+ if (!process2) throw new Error("Worker does not support atomic processing");
8719
+ return { value: await process2(value, options, createContext(context), context.state.context) };
8720
+ },
8721
+ ...processInBatches ? {
8722
+ processInBatches: async function* (inputs, options, context) {
8723
+ async function* values() {
8724
+ for await (const input of inputs) yield input.value;
8725
+ }
8726
+ for await (const value of processInBatches(
8727
+ values(),
8728
+ options,
8729
+ createContext(context),
8730
+ context.state.context
8731
+ )) {
8732
+ yield { value };
8733
+ }
8734
+ }
8735
+ } : {}
8736
+ };
8737
+ }
8738
+ function createContext(context) {
8739
+ let requestIdentifier = 0;
8740
+ const port = context.state.port;
8741
+ return {
8742
+ signal: context.signal,
8743
+ throwIfAborted: () => context.throwIfAborted(),
8744
+ reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
8745
+ process: port ? (input, options = {}, jobContext = {}) => {
8746
+ context.throwIfAborted();
8747
+ const identifier = ++requestIdentifier;
8748
+ return new Promise((resolve, reject) => {
8749
+ const onMessage = (event) => {
8750
+ if (event.data.identifier !== identifier) return;
8751
+ cleanup();
8752
+ if (event.data.error) {
8753
+ const error = new Error(event.data.error.message);
8754
+ error.name = event.data.error.name;
8755
+ reject(error);
8756
+ } else resolve(event.data.value);
8757
+ };
8758
+ const onAbort = () => {
8759
+ cleanup();
8760
+ reject(context.signal.reason);
8761
+ };
8762
+ const cleanup = () => {
8763
+ port.removeEventListener("message", onMessage);
8764
+ context.signal.removeEventListener("abort", onAbort);
8765
+ };
8766
+ port.addEventListener("message", onMessage);
8767
+ context.signal.addEventListener("abort", onAbort, { once: true });
8768
+ port.start();
8769
+ try {
8770
+ const request = { identifier, input, options, context: jobContext };
8771
+ port.postMessage(request, getTransferList2(request));
8772
+ } catch (error) {
8773
+ cleanup();
8774
+ reject(error);
8775
+ }
8776
+ });
8777
+ } : void 0
8778
+ };
8779
+ }
8173
8780
  var init_create_worker2 = __esm({
8174
8781
  "../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
8175
8782
  "use strict";
8176
- init_tasks();
8783
+ init_task_runtime2();
8784
+ init_get_transfer_list2();
8177
8785
  }
8178
8786
  });
8179
8787
 
@@ -8352,7 +8960,7 @@ var init_worker_utils2 = __esm({
8352
8960
 
8353
8961
  // ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
8354
8962
  async function createLoaderWorker(loader, selectLoader = () => loader) {
8355
- await createWorker(
8963
+ await createWorker2(
8356
8964
  (input, options, workerContext, loaderContext) => processLoaderWorkerData(
8357
8965
  selectLoader(options || {}),
8358
8966
  input,
@@ -8607,7 +9215,7 @@ var init_vec42 = __esm({
8607
9215
  });
8608
9216
 
8609
9217
  // ../../node_modules/@math.gl/core/dist/index.js
8610
- var init_dist2 = __esm({
9218
+ var init_dist3 = __esm({
8611
9219
  "../../node_modules/@math.gl/core/dist/index.js"() {
8612
9220
  init_math_utils();
8613
9221
  init_types2();
@@ -16394,11 +17002,11 @@ var init_builder = __esm({
16394
17002
  this._offsets = new OffsetsBufferBuilder(opts.type);
16395
17003
  }
16396
17004
  setValue(index2, value) {
16397
- const pending = this._pending || (this._pending = /* @__PURE__ */ new Map());
16398
- const current = pending.get(index2);
17005
+ const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
17006
+ const current = pending2.get(index2);
16399
17007
  current && (this._pendingLength -= current.length);
16400
17008
  this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
16401
- pending.set(index2, value);
17009
+ pending2.set(index2, value);
16402
17010
  }
16403
17011
  setValid(index2, isValid) {
16404
17012
  if (!super.setValid(index2, isValid)) {
@@ -16421,12 +17029,12 @@ var init_builder = __esm({
16421
17029
  return super.finish();
16422
17030
  }
16423
17031
  _flush() {
16424
- const pending = this._pending;
17032
+ const pending2 = this._pending;
16425
17033
  const pendingLength = this._pendingLength;
16426
17034
  this._pendingLength = 0;
16427
17035
  this._pending = void 0;
16428
- if (pending && pending.size > 0) {
16429
- this._flushPending(pending, pendingLength);
17036
+ if (pending2 && pending2.size > 0) {
17037
+ this._flushPending(pending2, pendingLength);
16430
17038
  }
16431
17039
  return this;
16432
17040
  }
@@ -19012,11 +19620,11 @@ var init_binary2 = __esm({
19012
19620
  setValue(index2, value) {
19013
19621
  return super.setValue(index2, toUint8Array2(value));
19014
19622
  }
19015
- _flushPending(pending, pendingLength) {
19623
+ _flushPending(pending2, pendingLength) {
19016
19624
  const offsets = this._offsets;
19017
19625
  const data = this._values.reserve(pendingLength).buffer;
19018
19626
  let offset = 0;
19019
- for (const [index2, value] of pending) {
19627
+ for (const [index2, value] of pending2) {
19020
19628
  if (value === void 0) {
19021
19629
  offsets.set(index2, 0);
19022
19630
  } else {
@@ -19053,11 +19661,11 @@ var init_largebinary = __esm({
19053
19661
  setValue(index2, value) {
19054
19662
  return super.setValue(index2, toUint8Array2(value));
19055
19663
  }
19056
- _flushPending(pending, pendingLength) {
19664
+ _flushPending(pending2, pendingLength) {
19057
19665
  const offsets = this._offsets;
19058
19666
  const data = this._values.reserve(pendingLength).buffer;
19059
19667
  let offset = 0;
19060
- for (const [index2, value] of pending) {
19668
+ for (const [index2, value] of pending2) {
19061
19669
  if (value === void 0) {
19062
19670
  offsets.set(index2, BigInt(0));
19063
19671
  } else {
@@ -19368,10 +19976,10 @@ var init_list2 = __esm({
19368
19976
  this.type = new List2(new Field2(name, child.type, true));
19369
19977
  return this.numChildren - 1;
19370
19978
  }
19371
- _flushPending(pending) {
19979
+ _flushPending(pending2) {
19372
19980
  const offsets = this._offsets;
19373
19981
  const [child] = this.children;
19374
- for (const [index2, value] of pending) {
19982
+ for (const [index2, value] of pending2) {
19375
19983
  if (typeof value === "undefined") {
19376
19984
  offsets.set(index2, 0);
19377
19985
  } else {
@@ -19410,10 +20018,10 @@ var init_largelist = __esm({
19410
20018
  this.type = new LargeList2(new Field2(name, child.type, true));
19411
20019
  return this.numChildren - 1;
19412
20020
  }
19413
- _flushPending(pending) {
20021
+ _flushPending(pending2) {
19414
20022
  const offsets = this._offsets;
19415
20023
  const [child] = this.children;
19416
- for (const [index2, value] of pending) {
20024
+ for (const [index2, value] of pending2) {
19417
20025
  if (typeof value === "undefined") {
19418
20026
  offsets.set(index2, BigInt(0));
19419
20027
  } else {
@@ -19443,11 +20051,11 @@ var init_map3 = __esm({
19443
20051
  }
19444
20052
  setValue(index2, value) {
19445
20053
  const row = value instanceof Map ? value : new Map(Object.entries(value));
19446
- const pending = this._pending || (this._pending = /* @__PURE__ */ new Map());
19447
- const current = pending.get(index2);
20054
+ const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
20055
+ const current = pending2.get(index2);
19448
20056
  current && (this._pendingLength -= current.size);
19449
20057
  this._pendingLength += row.size;
19450
- pending.set(index2, row);
20058
+ pending2.set(index2, row);
19451
20059
  }
19452
20060
  addChild(child, name = `${this.numChildren}`) {
19453
20061
  if (this.numChildren > 0) {
@@ -19457,10 +20065,10 @@ var init_map3 = __esm({
19457
20065
  this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
19458
20066
  return this.numChildren - 1;
19459
20067
  }
19460
- _flushPending(pending) {
20068
+ _flushPending(pending2) {
19461
20069
  const offsets = this._offsets;
19462
20070
  const [child] = this.children;
19463
- for (const [index2, value] of pending) {
20071
+ for (const [index2, value] of pending2) {
19464
20072
  if (value === void 0) {
19465
20073
  offsets.set(index2, 0);
19466
20074
  } else {
@@ -19669,7 +20277,7 @@ var init_utf83 = __esm({
19669
20277
  return super.setValue(index2, encodeUtf8(value));
19670
20278
  }
19671
20279
  // @ts-ignore
19672
- _flushPending(pending, pendingLength) {
20280
+ _flushPending(pending2, pendingLength) {
19673
20281
  }
19674
20282
  };
19675
20283
  Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
@@ -19700,7 +20308,7 @@ var init_largeutf8 = __esm({
19700
20308
  return super.setValue(index2, encodeUtf8(value));
19701
20309
  }
19702
20310
  // @ts-ignore
19703
- _flushPending(pending, pendingLength) {
20311
+ _flushPending(pending2, pendingLength) {
19704
20312
  }
19705
20313
  };
19706
20314
  LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
@@ -23962,12 +24570,6 @@ function serializeArrowSchema(arrowSchema) {
23962
24570
  metadata: serializeArrowMetadata(arrowSchema.metadata)
23963
24571
  };
23964
24572
  }
23965
- function deserializeArrowSchema(schema, options) {
23966
- return new Schema2(
23967
- schema.fields.map((field) => deserializeArrowField(field, options)),
23968
- deserializeArrowMetadata(schema.metadata)
23969
- );
23970
- }
23971
24573
  function serializeArrowMetadata(arrowMetadata) {
23972
24574
  return Object.fromEntries(arrowMetadata);
23973
24575
  }
@@ -24436,7 +25038,7 @@ function getFloat16Storage(array) {
24436
25038
  var init_float162 = __esm({
24437
25039
  "../core/src/schema/float16.ts"() {
24438
25040
  "use strict";
24439
- init_dist2();
25041
+ init_dist3();
24440
25042
  }
24441
25043
  });
24442
25044
 
@@ -25657,7 +26259,29 @@ var init_draco_module_loader = __esm({
25657
26259
  }
25658
26260
  });
25659
26261
 
25660
- // ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
26262
+ // ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
26263
+ function getArrowVariadicBuffers(data) {
26264
+ return data.variadicBuffers ?? [];
26265
+ }
26266
+ function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
26267
+ return Reflect.construct(Data, [
26268
+ type,
26269
+ offset,
26270
+ length,
26271
+ nullCount,
26272
+ buffers,
26273
+ children,
26274
+ dictionary,
26275
+ variadicBuffers
26276
+ ]);
26277
+ }
26278
+ var init_arrow_data = __esm({
26279
+ "../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
26280
+ init_Arrow_node();
26281
+ }
26282
+ });
26283
+
26284
+ // ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
25661
26285
  function splitArrowBuffers(input, options = {}) {
25662
26286
  const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
25663
26287
  if (isArrowTable2(input)) {
@@ -25680,17 +26304,12 @@ function isArrowRecordBatch2(input) {
25680
26304
  function isArrowVector2(input) {
25681
26305
  return "data" in input && Array.isArray(input.data);
25682
26306
  }
25683
- function splitArrowTableBuffersInternal(table, options) {
25684
- const recordBatches = table.batches.map(
25685
- (recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
25686
- );
25687
- return new Table(table.schema, recordBatches);
26307
+ function splitArrowTableBuffersInternal(arrowTable, options) {
26308
+ const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
26309
+ return new Table(arrowTable.schema, recordBatches);
25688
26310
  }
25689
26311
  function splitArrowRecordBatchBuffers(recordBatch, options) {
25690
- return new RecordBatch3(
25691
- recordBatch.schema,
25692
- splitArrowDataBuffers(recordBatch.data, options)
25693
- );
26312
+ return new RecordBatch3(recordBatch.schema, splitArrowDataBuffers(recordBatch.data, options));
25694
26313
  }
25695
26314
  function splitArrowDataBuffers(data, options) {
25696
26315
  const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
@@ -25701,7 +26320,7 @@ function splitArrowDataBuffers(data, options) {
25701
26320
  [BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
25702
26321
  [BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
25703
26322
  };
25704
- return new Data(
26323
+ return createArrowData(
25705
26324
  data.type,
25706
26325
  data.offset,
25707
26326
  data.length,
@@ -25709,7 +26328,8 @@ function splitArrowDataBuffers(data, options) {
25709
26328
  data._nullCount,
25710
26329
  buffers,
25711
26330
  children,
25712
- dictionary
26331
+ dictionary,
26332
+ getArrowVariadicBuffers(data).map((buffer2) => splitArrowBuffer(buffer2, options))
25713
26333
  );
25714
26334
  }
25715
26335
  function splitArrowVectorBuffers(vector, options) {
@@ -25727,7 +26347,7 @@ function splitArrowBuffer(array, options) {
25727
26347
  }
25728
26348
  let copy = options.copies.get(array);
25729
26349
  if (!copy) {
25730
- copy = array.slice();
26350
+ copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
25731
26351
  options.copies.set(array, copy);
25732
26352
  }
25733
26353
  return copy;
@@ -25736,29 +26356,107 @@ function isArrowTypedArray(value) {
25736
26356
  return ArrayBuffer.isView(value) && !(value instanceof DataView);
25737
26357
  }
25738
26358
  var init_split_arrow_buffers = __esm({
25739
- "../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
25740
- "use strict";
26359
+ "../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
25741
26360
  init_Arrow_node();
26361
+ init_arrow_data();
26362
+ }
26363
+ });
26364
+
26365
+ // ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
26366
+ var init_indexed_arrow_vector = __esm({
26367
+ "../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
26368
+ }
26369
+ });
26370
+
26371
+ // ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
26372
+ var init_indexed_arrow_table = __esm({
26373
+ "../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
26374
+ }
26375
+ });
26376
+
26377
+ // ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
26378
+ var init_mapped_arrow_table = __esm({
26379
+ "../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
25742
26380
  }
25743
26381
  });
25744
26382
 
25745
- // ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
25746
- function dehydrateArrowTable(table, options) {
25747
- const splitTable = splitArrowBuffers(table, options);
26383
+ // ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
26384
+ var init_rename_arrow_columns = __esm({
26385
+ "../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
26386
+ }
26387
+ });
26388
+
26389
+ // ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
26390
+ function dehydrateArrowTable(arrowTable, options) {
26391
+ const splitTable = splitArrowBuffers(arrowTable, options);
25748
26392
  return {
25749
- shape: "arrow-table",
25750
26393
  transport: "arrow-js",
25751
- schema: serializeArrowSchema(splitTable.schema),
25752
- batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
26394
+ version: 1,
26395
+ schema: tableToIPC(new Table(splitTable.schema, [])),
26396
+ metadataVersion: splitTable.schema.metadataVersion,
26397
+ batches: splitTable.batches.map((batch) => dehydrateArrowData(batch.data))
25753
26398
  };
25754
26399
  }
25755
26400
  function hydrateArrowTable(table) {
25756
- const schema = deserializeArrowSchema(table.schema);
25757
- const recordBatches = table.batches.map(
25758
- (recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
25759
- );
25760
- return new Table(schema, recordBatches);
26401
+ if (table.transport !== "arrow-js" || table.version !== 1) {
26402
+ throw new Error("Unsupported Arrow column-buffer transport protocol.");
26403
+ }
26404
+ const decodedSchema = tableFromIPC(table.schema).schema;
26405
+ const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
26406
+ const type = new Struct(schema.fields);
26407
+ const batches = table.batches.map((data) => new RecordBatch3(schema, hydrateArrowData(data, type)));
26408
+ return new Table(schema, batches);
25761
26409
  }
26410
+ function dehydrateArrowData(data) {
26411
+ var _a5;
26412
+ return {
26413
+ offset: data.offset,
26414
+ length: data.length,
26415
+ nullCount: data.nullCount,
26416
+ buffers: {
26417
+ [BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
26418
+ [BufferType.DATA]: data.buffers[BufferType.DATA],
26419
+ [BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
26420
+ [BufferType.TYPE]: data.buffers[BufferType.TYPE]
26421
+ },
26422
+ children: data.children.map((child) => dehydrateArrowData(child)),
26423
+ variadicBuffers: getArrowVariadicBuffers(data),
26424
+ dictionary: (_a5 = data.dictionary) == null ? void 0 : _a5.data.map((chunk) => dehydrateArrowData(chunk))
26425
+ };
26426
+ }
26427
+ function hydrateArrowData(data, type) {
26428
+ const children = data.children.map((child, index2) => hydrateArrowData(child, type.children[index2].type));
26429
+ const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
26430
+ return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
26431
+ }
26432
+ var init_arrow_table_transport = __esm({
26433
+ "../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
26434
+ init_Arrow_node();
26435
+ init_arrow_data();
26436
+ init_split_arrow_buffers();
26437
+ }
26438
+ });
26439
+
26440
+ // ../../node_modules/@math.gl/arrow/dist/arrow/index.js
26441
+ var init_arrow = __esm({
26442
+ "../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
26443
+ init_indexed_arrow_table();
26444
+ init_indexed_arrow_vector();
26445
+ init_mapped_arrow_table();
26446
+ init_rename_arrow_columns();
26447
+ init_split_arrow_buffers();
26448
+ init_arrow_table_transport();
26449
+ }
26450
+ });
26451
+
26452
+ // ../../node_modules/@math.gl/arrow/dist/index.js
26453
+ var init_dist4 = __esm({
26454
+ "../../node_modules/@math.gl/arrow/dist/index.js"() {
26455
+ init_arrow();
26456
+ }
26457
+ });
26458
+
26459
+ // ../core/src/arrow-worker-transport.ts
25762
26460
  function serializeArrowWorkerResult(result, options) {
25763
26461
  var _a5;
25764
26462
  if (!isArrowTableWrapper(result)) {
@@ -25789,60 +26487,10 @@ function isDehydratedArrowTableWrapper(value) {
25789
26487
  table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
25790
26488
  );
25791
26489
  }
25792
- function dehydrateArrowRecordBatch(recordBatch) {
25793
- return { data: dehydrateArrowData(recordBatch.data) };
25794
- }
25795
- function dehydrateArrowData(data) {
25796
- return {
25797
- type: serializeArrowType(data.type),
25798
- offset: data.offset,
25799
- length: data.length,
25800
- // @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
25801
- nullCount: data._nullCount,
25802
- buffers: {
25803
- [BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
25804
- [BufferType.DATA]: data.buffers[BufferType.DATA],
25805
- [BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
25806
- [BufferType.TYPE]: data.buffers[BufferType.TYPE]
25807
- },
25808
- children: data.children.map((childData) => dehydrateArrowData(childData)),
25809
- dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
25810
- };
25811
- }
25812
- function dehydrateArrowVector(vector) {
25813
- return { data: vector.data.map((data) => dehydrateArrowData(data)) };
25814
- }
25815
- function hydrateArrowData(data) {
25816
- const children = data.children.map((childData) => hydrateArrowData(childData));
25817
- const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
25818
- return new Data(
25819
- deserializeArrowType(data.type),
25820
- data.offset,
25821
- data.length,
25822
- data.nullCount,
25823
- data.buffers,
25824
- children,
25825
- dictionary
25826
- );
25827
- }
25828
- function hydrateArrowVector(vector) {
25829
- return new Vector(vector.data.map((data) => hydrateArrowData(data)));
25830
- }
25831
- var init_arrow_table_transport = __esm({
25832
- "../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
26490
+ var init_arrow_worker_transport = __esm({
26491
+ "../core/src/arrow-worker-transport.ts"() {
25833
26492
  "use strict";
25834
- init_Arrow_node();
25835
- init_convert_arrow_schema();
25836
- init_split_arrow_buffers();
25837
- }
25838
- });
25839
-
25840
- // ../core/src/schema-utils/arrow-transport.ts
25841
- var init_arrow_transport = __esm({
25842
- "../core/src/schema-utils/arrow-transport.ts"() {
25843
- "use strict";
25844
- init_arrow_table_transport();
25845
- init_split_arrow_buffers();
26493
+ init_dist4();
25846
26494
  }
25847
26495
  });
25848
26496
 
@@ -25851,7 +26499,7 @@ var VERSION2;
25851
26499
  var init_version2 = __esm({
25852
26500
  "src/draco/lib/utils/version.ts"() {
25853
26501
  "use strict";
25854
- VERSION2 = true ? "5.0.0-beta.2" : "latest";
26502
+ VERSION2 = true ? "5.0.0-beta.5" : "latest";
25855
26503
  }
25856
26504
  });
25857
26505
 
@@ -26037,7 +26685,7 @@ var DracoLoader;
26037
26685
  var init_draco_loader_types = __esm({
26038
26686
  "src/draco/draco-loader-types.ts"() {
26039
26687
  "use strict";
26040
- init_arrow_transport();
26688
+ init_arrow_worker_transport();
26041
26689
  init_version2();
26042
26690
  init_draco_format();
26043
26691
  init_draco_loader_options();