@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.
- package/DRACO-README.md +1 -1
- package/GLTF-README.md +1 -1
- package/OBJ-README.md +1 -1
- package/README.md +6 -1
- package/THIRD-PARTY-NOTICES.md +6 -0
- package/dist/dist.dev.js +6557 -1363
- package/dist/dist.min.js +24 -16
- package/dist/draco/draco-javascript-loader-with-parser.d.ts +2 -2
- package/dist/draco/draco-loader-types.cjs +3 -3
- package/dist/draco/draco-loader-types.cjs.map +2 -2
- package/dist/draco/draco-loader-types.d.ts +1 -1
- package/dist/draco/draco-loader-types.d.ts.map +1 -1
- package/dist/draco/draco-loader-types.js +1 -1
- package/dist/draco/draco-loader-types.js.map +1 -1
- package/dist/draco/draco-loader.d.ts +2 -2
- package/dist/draco/draco-wasm-loader-with-parser.d.ts +2 -2
- package/dist/draco/draco3d-loader-with-parser.d.ts +2 -2
- package/dist/draco/lib/utils/version.cjs +1 -1
- package/dist/draco/lib/utils/version.js +1 -1
- package/dist/draco-worker-node.js +806 -158
- package/dist/draco-worker-node.js.map +4 -4
- package/dist/draco-worker.js +775 -158
- package/dist/draco-worker.js.map +4 -4
- package/dist/draco-writer-worker-node.cjs +2122 -219
- package/dist/draco-writer-worker-node.cjs.map +4 -4
- package/dist/draco-writer-worker.js +2053 -220
- package/dist/draco-writer-worker.js.map +4 -4
- package/dist/gltf/gltf-loader-types.cjs.map +2 -2
- package/dist/gltf/gltf-loader-types.d.ts +6 -0
- package/dist/gltf/gltf-loader-types.d.ts.map +1 -1
- package/dist/gltf/gltf-loader-types.js.map +1 -1
- package/dist/gltf/index.cjs +2 -0
- package/dist/gltf/index.cjs.map +2 -2
- package/dist/gltf/index.d.ts +2 -2
- package/dist/gltf/index.d.ts.map +1 -1
- package/dist/gltf/index.js +1 -1
- package/dist/gltf/index.js.map +1 -1
- package/dist/gltf/lib/api/gltf-extensions.cjs +7 -2
- package/dist/gltf/lib/api/gltf-extensions.cjs.map +2 -2
- package/dist/gltf/lib/api/gltf-extensions.d.ts.map +1 -1
- package/dist/gltf/lib/api/gltf-extensions.js +7 -5
- package/dist/gltf/lib/api/gltf-extensions.js.map +1 -1
- package/dist/gltf/lib/extensions/EXT_texture_webp.cjs +1 -0
- package/dist/gltf/lib/extensions/EXT_texture_webp.cjs.map +2 -2
- package/dist/gltf/lib/extensions/EXT_texture_webp.d.ts.map +1 -1
- package/dist/gltf/lib/extensions/EXT_texture_webp.js +3 -0
- package/dist/gltf/lib/extensions/EXT_texture_webp.js.map +1 -1
- package/dist/gltf/lib/extensions/KHR_accessor_float64.cjs +45 -0
- package/dist/gltf/lib/extensions/KHR_accessor_float64.cjs.map +7 -0
- package/dist/gltf/lib/extensions/KHR_accessor_float64.d.ts +6 -0
- package/dist/gltf/lib/extensions/KHR_accessor_float64.d.ts.map +1 -0
- package/dist/gltf/lib/extensions/KHR_accessor_float64.js +20 -0
- package/dist/gltf/lib/extensions/KHR_accessor_float64.js.map +1 -0
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.cjs +23 -7
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.cjs.map +2 -2
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.d.ts +2 -1
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.d.ts.map +1 -1
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.js +21 -5
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.js.map +1 -1
- package/dist/gltf/lib/extensions/MSFT_texture_dds.cjs +64 -0
- package/dist/gltf/lib/extensions/MSFT_texture_dds.cjs.map +7 -0
- package/dist/gltf/lib/extensions/MSFT_texture_dds.d.ts +12 -0
- package/dist/gltf/lib/extensions/MSFT_texture_dds.d.ts.map +1 -0
- package/dist/gltf/lib/extensions/MSFT_texture_dds.js +39 -0
- package/dist/gltf/lib/extensions/MSFT_texture_dds.js.map +1 -0
- package/dist/gltf/lib/extensions/utils/3d-tiles-utils.cjs +1 -1
- package/dist/gltf/lib/extensions/utils/3d-tiles-utils.cjs.map +2 -2
- package/dist/gltf/lib/extensions/utils/3d-tiles-utils.d.ts.map +1 -1
- package/dist/gltf/lib/extensions/utils/3d-tiles-utils.js +3 -1
- package/dist/gltf/lib/extensions/utils/3d-tiles-utils.js.map +1 -1
- package/dist/gltf/lib/parsers/parse-gltf.cjs +25 -0
- package/dist/gltf/lib/parsers/parse-gltf.cjs.map +2 -2
- package/dist/gltf/lib/parsers/parse-gltf.d.ts +2 -0
- package/dist/gltf/lib/parsers/parse-gltf.d.ts.map +1 -1
- package/dist/gltf/lib/parsers/parse-gltf.js +18 -0
- package/dist/gltf/lib/parsers/parse-gltf.js.map +1 -1
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.cjs +22 -0
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.cjs.map +2 -2
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.d.ts +23 -0
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.js +22 -0
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.js.map +1 -1
- package/dist/gltf/lib/types/gltf-ext-gaussian-splatting-schema.cjs.map +1 -1
- package/dist/gltf/lib/types/gltf-ext-gaussian-splatting-schema.d.ts +1 -1
- package/dist/gltf/lib/types/gltf-ext-gaussian-splatting-schema.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-extension-schemas.cjs +8 -0
- package/dist/gltf/lib/types/gltf-extension-schemas.cjs.map +2 -2
- package/dist/gltf/lib/types/gltf-extension-schemas.d.ts +27 -0
- package/dist/gltf/lib/types/gltf-extension-schemas.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-extension-schemas.js +8 -1
- package/dist/gltf/lib/types/gltf-extension-schemas.js.map +1 -1
- package/dist/gltf/lib/types/gltf-json-schema.cjs.map +1 -1
- package/dist/gltf/lib/types/gltf-json-schema.d.ts +2 -2
- package/dist/gltf/lib/types/gltf-json-schema.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-texture-procedurals.cjs +19 -0
- package/dist/gltf/lib/types/gltf-texture-procedurals.cjs.map +7 -0
- package/dist/gltf/lib/types/gltf-texture-procedurals.d.ts +45 -0
- package/dist/gltf/lib/types/gltf-texture-procedurals.d.ts.map +1 -0
- package/dist/gltf/lib/types/gltf-texture-procedurals.js +5 -0
- package/dist/gltf/lib/types/gltf-texture-procedurals.js.map +1 -0
- package/dist/gltf/lib/types/gltf-types.cjs.map +1 -1
- package/dist/gltf/lib/types/gltf-types.d.ts +7 -0
- package/dist/gltf/lib/types/gltf-types.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-version-zod-schemas.d.ts +34 -0
- package/dist/gltf/lib/types/gltf-version-zod-schemas.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-zod-schema.cjs +4 -1
- package/dist/gltf/lib/types/gltf-zod-schema.cjs.map +2 -2
- package/dist/gltf/lib/types/gltf-zod-schema.d.ts +56 -0
- package/dist/gltf/lib/types/gltf-zod-schema.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-zod-schema.js +6 -2
- package/dist/gltf/lib/types/gltf-zod-schema.js.map +1 -1
- package/dist/gltf/lib/utils/version.cjs +1 -1
- package/dist/gltf/lib/utils/version.js +1 -1
- package/dist/gltf/schema.cjs +3 -0
- package/dist/gltf/schema.cjs.map +2 -2
- package/dist/gltf/schema.d.ts +1 -0
- package/dist/gltf/schema.d.ts.map +1 -1
- package/dist/gltf/schema.js +1 -0
- package/dist/gltf/schema.js.map +1 -1
- package/dist/gltf-loader-types.cjs.map +2 -2
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/materialx/parse-materialx.cjs +61 -0
- package/dist/materialx/parse-materialx.cjs.map +7 -0
- package/dist/materialx/parse-materialx.d.ts +23 -0
- package/dist/materialx/parse-materialx.d.ts.map +1 -0
- package/dist/materialx/parse-materialx.js +39 -0
- package/dist/materialx/parse-materialx.js.map +1 -0
- package/dist/materialx/procedural-graph.cjs +77 -0
- package/dist/materialx/procedural-graph.cjs.map +7 -0
- package/dist/materialx/procedural-graph.d.ts +40 -0
- package/dist/materialx/procedural-graph.d.ts.map +1 -0
- package/dist/materialx/procedural-graph.js +59 -0
- package/dist/materialx/procedural-graph.js.map +1 -0
- package/dist/materialx-loader-types.cjs +57 -0
- package/dist/materialx-loader-types.cjs.map +7 -0
- package/dist/materialx-loader-types.d.ts +34 -0
- package/dist/materialx-loader-types.d.ts.map +1 -0
- package/dist/materialx-loader-types.js +20 -0
- package/dist/materialx-loader-types.js.map +1 -0
- package/dist/materialx-loader.cjs +40 -0
- package/dist/materialx-loader.cjs.map +7 -0
- package/dist/materialx-loader.d.ts +19 -0
- package/dist/materialx-loader.d.ts.map +1 -0
- package/dist/materialx-loader.js +14 -0
- package/dist/materialx-loader.js.map +1 -0
- package/dist/mtl-loader-types.cjs +1 -1
- package/dist/obj/mtl-loader-types.cjs +1 -1
- package/dist/obj/mtl-loader-types.js +1 -1
- package/dist/obj/obj-loader-types.cjs +3 -3
- package/dist/obj/obj-loader-types.cjs.map +2 -2
- package/dist/obj/obj-loader-types.d.ts +1 -1
- package/dist/obj/obj-loader-types.d.ts.map +1 -1
- package/dist/obj/obj-loader-types.js +2 -2
- package/dist/obj/obj-loader-types.js.map +1 -1
- package/dist/obj/obj-loader.cjs +5 -5
- package/dist/obj/obj-loader.cjs.map +2 -2
- package/dist/obj/obj-loader.d.ts +1 -1
- package/dist/obj/obj-loader.d.ts.map +1 -1
- package/dist/obj/obj-loader.js +1 -1
- package/dist/obj/obj-loader.js.map +1 -1
- package/dist/obj/obj-writer.cjs +1 -1
- package/dist/obj/obj-writer.js +1 -1
- package/dist/obj-loader-types.cjs +3 -3
- package/dist/obj-loader-types.cjs.map +2 -2
- package/dist/obj-loader.cjs +5 -5
- package/dist/obj-loader.cjs.map +2 -2
- package/dist/obj-worker.js +985 -368
- package/dist/obj-writer.cjs +1 -1
- package/dist/stl/parse-stl.cjs +100 -0
- package/dist/stl/parse-stl.cjs.map +7 -0
- package/dist/stl/parse-stl.d.ts +4 -0
- package/dist/stl/parse-stl.d.ts.map +1 -0
- package/dist/stl/parse-stl.js +84 -0
- package/dist/stl/parse-stl.js.map +1 -0
- package/dist/stl-loader-types.cjs +58 -0
- package/dist/stl-loader-types.cjs.map +7 -0
- package/dist/stl-loader-types.d.ts +32 -0
- package/dist/stl-loader-types.d.ts.map +1 -0
- package/dist/stl-loader-types.js +25 -0
- package/dist/stl-loader-types.js.map +1 -0
- package/dist/stl-loader.cjs +38 -0
- package/dist/stl-loader.cjs.map +7 -0
- package/dist/stl-loader.d.ts +17 -0
- package/dist/stl-loader.d.ts.map +1 -0
- package/dist/stl-loader.js +13 -0
- package/dist/stl-loader.js.map +1 -0
- package/dist/usd/index.cjs.map +1 -1
- package/dist/usd/index.d.ts +1 -1
- package/dist/usd/index.d.ts.map +1 -1
- package/dist/usd/lib/parse-usd.cjs +42 -5
- package/dist/usd/lib/parse-usd.cjs.map +2 -2
- package/dist/usd/lib/parse-usd.d.ts.map +1 -1
- package/dist/usd/lib/parse-usd.js +53 -6
- package/dist/usd/lib/parse-usd.js.map +1 -1
- package/dist/usd/lib/parse-usdc.cjs +187 -0
- package/dist/usd/lib/parse-usdc.cjs.map +7 -0
- package/dist/usd/lib/parse-usdc.d.ts +4 -0
- package/dist/usd/lib/parse-usdc.d.ts.map +1 -0
- package/dist/usd/lib/parse-usdc.js +176 -0
- package/dist/usd/lib/parse-usdc.js.map +1 -0
- package/dist/usd/lib/parse-usdz.cjs +22 -0
- package/dist/usd/lib/parse-usdz.cjs.map +2 -2
- package/dist/usd/lib/parse-usdz.d.ts.map +1 -1
- package/dist/usd/lib/parse-usdz.js +26 -0
- package/dist/usd/lib/parse-usdz.js.map +1 -1
- package/dist/usd/lib/usd-types.cjs.map +1 -1
- package/dist/usd/lib/usd-types.d.ts +14 -1
- package/dist/usd/lib/usd-types.d.ts.map +1 -1
- package/dist/usd/lib/usd-types.js +1 -1
- package/dist/usd/lib/usd-types.js.map +1 -1
- package/dist/usd/libs/README.md +27 -0
- package/dist/usd/libs/THREE-LICENSE +21 -0
- package/dist/usd/libs/usdc-parser.d.ts +78 -0
- package/dist/usd/libs/usdc-parser.d.ts.map +1 -0
- package/dist/usd/libs/usdc-parser.js +1669 -0
- package/dist/usd/libs/usdc-parser.js.map +1 -0
- package/dist/usd/usd-loader-types.cjs +4 -4
- package/dist/usd/usd-loader-types.cjs.map +2 -2
- package/dist/usd/usd-loader-types.d.ts +7 -7
- package/dist/usd/usd-loader-types.d.ts.map +1 -1
- package/dist/usd/usd-loader-types.js +6 -6
- package/dist/usd/usd-loader-types.js.map +1 -1
- package/dist/usd/usd-loader.cjs.map +1 -1
- package/dist/usd/usd-loader.d.ts +4 -4
- package/dist/usd/usd-loader.d.ts.map +1 -1
- package/dist/usd/usd-loader.js +2 -2
- package/dist/usd/usd-loader.js.map +1 -1
- package/dist/usd-loader-types.cjs +4 -4
- package/dist/usd-loader-types.cjs.map +2 -2
- package/dist/usd-loader.cjs.map +1 -1
- package/package.json +19 -7
- package/src/draco/draco-loader-types.ts +1 -1
- package/src/gltf/gltf-loader-types.ts +6 -0
- package/src/gltf/index.ts +4 -1
- package/src/gltf/lib/api/gltf-extensions.ts +7 -2
- package/src/gltf/lib/extensions/EXT_texture_webp.ts +3 -0
- package/src/gltf/lib/extensions/KHR_accessor_float64.ts +22 -0
- package/src/gltf/lib/extensions/KHR_gaussian_splatting.ts +31 -7
- package/src/gltf/lib/extensions/MSFT_texture_dds.ts +52 -0
- package/src/gltf/lib/extensions/utils/3d-tiles-utils.ts +5 -1
- package/src/gltf/lib/parsers/parse-gltf.ts +31 -0
- package/src/gltf/lib/types/gltf-additional-extension-schemas.ts +32 -0
- package/src/gltf/lib/types/gltf-ext-gaussian-splatting-schema.ts +1 -1
- package/src/gltf/lib/types/gltf-extension-schemas.ts +12 -0
- package/src/gltf/lib/types/gltf-json-schema.ts +2 -1
- package/src/gltf/lib/types/gltf-texture-procedurals.ts +67 -0
- package/src/gltf/lib/types/gltf-types.ts +8 -0
- package/src/gltf/lib/types/gltf-zod-schema.ts +7 -1
- package/src/gltf/schema.ts +1 -0
- package/src/index.ts +6 -1
- package/src/materialx/README.md +5 -0
- package/src/materialx/parse-materialx.ts +70 -0
- package/src/materialx/procedural-graph.ts +94 -0
- package/src/materialx-loader-types.ts +24 -0
- package/src/materialx-loader.ts +15 -0
- package/src/obj/obj-loader-types.ts +1 -1
- package/src/obj/obj-loader.ts +1 -1
- package/src/stl/parse-stl.ts +90 -0
- package/src/stl-loader-types.ts +28 -0
- package/src/stl-loader.ts +12 -0
- package/src/usd/index.ts +1 -0
- package/src/usd/lib/parse-usd.ts +68 -7
- package/src/usd/lib/parse-usdc.ts +188 -0
- package/src/usd/lib/parse-usdz.ts +28 -0
- package/src/usd/lib/usd-types.ts +16 -2
- package/src/usd/libs/README.md +27 -0
- package/src/usd/libs/THREE-LICENSE +21 -0
- package/src/usd/libs/usdc-parser.d.ts +18 -0
- package/src/usd/libs/usdc-parser.js +1669 -0
- package/src/usd/usd-loader-types.ts +5 -5
- package/src/usd/usd-loader.ts +2 -2
package/dist/draco-worker.js
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
|
|
53
53
|
// ../core/src/worker-utils/lib/env-utils/version.ts
|
|
54
54
|
function getVersion() {
|
|
55
|
-
const version = false ? NPM_TAG : "5.0.0-beta.
|
|
55
|
+
const version = false ? NPM_TAG : "5.0.0-beta.5";
|
|
56
56
|
globalThis._loadersgl_ = globalThis._loadersgl_ || {};
|
|
57
57
|
globalThis._loadersgl_.version ||= version;
|
|
58
58
|
return version;
|
|
@@ -101,15 +101,15 @@
|
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
// ../../node_modules/@math.gl/
|
|
104
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js
|
|
105
105
|
var parentPort;
|
|
106
106
|
var init_worker_threads_browser = __esm({
|
|
107
|
-
"../../node_modules/@math.gl/
|
|
108
|
-
parentPort = null;
|
|
107
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
108
|
+
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
// ../../node_modules/@math.gl/
|
|
112
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
113
113
|
function getTransferList(object, recursive = true, transfers) {
|
|
114
114
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
115
115
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -122,6 +122,9 @@
|
|
|
122
122
|
else if (ArrayBuffer.isView(value)) {
|
|
123
123
|
if (isTransferable(value.buffer))
|
|
124
124
|
transfersSet.add(value.buffer);
|
|
125
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
|
|
126
|
+
visit(value.port1);
|
|
127
|
+
visit(value.port2);
|
|
125
128
|
} else if (recursive && value instanceof Map) {
|
|
126
129
|
for (const [key, item] of value) {
|
|
127
130
|
visit(key);
|
|
@@ -157,11 +160,11 @@
|
|
|
157
160
|
return false;
|
|
158
161
|
}
|
|
159
162
|
var init_get_transfer_list = __esm({
|
|
160
|
-
"../../node_modules/@math.gl/
|
|
163
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
161
164
|
}
|
|
162
165
|
});
|
|
163
166
|
|
|
164
|
-
// ../../node_modules/@math.gl/
|
|
167
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
165
168
|
async function getParentPort() {
|
|
166
169
|
return parentPort;
|
|
167
170
|
}
|
|
@@ -174,7 +177,7 @@
|
|
|
174
177
|
}
|
|
175
178
|
var onMessageWrapperMap, WorkerBody;
|
|
176
179
|
var init_worker_body = __esm({
|
|
177
|
-
"../../node_modules/@math.gl/
|
|
180
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
|
|
178
181
|
init_get_transfer_list();
|
|
179
182
|
init_worker_threads_browser();
|
|
180
183
|
onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
@@ -189,16 +192,16 @@
|
|
|
189
192
|
*/
|
|
190
193
|
static set onmessage(onMessage) {
|
|
191
194
|
async function handleMessage(message) {
|
|
192
|
-
const
|
|
193
|
-
const { type, payload } =
|
|
195
|
+
const parentPort3 = await getParentPort();
|
|
196
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
194
197
|
onMessage(type, payload);
|
|
195
198
|
}
|
|
196
|
-
getParentPort().then((
|
|
197
|
-
if (
|
|
198
|
-
|
|
199
|
+
getParentPort().then((parentPort3) => {
|
|
200
|
+
if (parentPort3) {
|
|
201
|
+
parentPort3.on("message", (message) => {
|
|
199
202
|
handleMessage(message);
|
|
200
203
|
});
|
|
201
|
-
|
|
204
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
202
205
|
} else {
|
|
203
206
|
globalThis.onmessage = handleMessage;
|
|
204
207
|
}
|
|
@@ -216,9 +219,9 @@
|
|
|
216
219
|
};
|
|
217
220
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
218
221
|
}
|
|
219
|
-
const
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
+
const parentPort3 = await getParentPort();
|
|
223
|
+
if (parentPort3) {
|
|
224
|
+
parentPort3.on("message", onMessageWrapper);
|
|
222
225
|
} else {
|
|
223
226
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
224
227
|
}
|
|
@@ -229,9 +232,9 @@
|
|
|
229
232
|
if (!onMessageWrapper) {
|
|
230
233
|
return;
|
|
231
234
|
}
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
234
|
-
|
|
235
|
+
const parentPort3 = await getParentPort();
|
|
236
|
+
if (parentPort3) {
|
|
237
|
+
parentPort3.off("message", onMessageWrapper);
|
|
235
238
|
} else {
|
|
236
239
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
237
240
|
}
|
|
@@ -241,12 +244,12 @@
|
|
|
241
244
|
* @param type
|
|
242
245
|
* @param payload
|
|
243
246
|
*/
|
|
244
|
-
static async postMessage(type, payload) {
|
|
247
|
+
static async postMessage(type, payload, copy = false) {
|
|
245
248
|
const data = { source: "loaders.gl", type, payload };
|
|
246
|
-
const transferList = getTransferList(payload);
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
249
|
-
|
|
249
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
250
|
+
const parentPort3 = await getParentPort();
|
|
251
|
+
if (parentPort3) {
|
|
252
|
+
parentPort3.postMessage(data, transferList);
|
|
250
253
|
} else {
|
|
251
254
|
globalThis.postMessage(data, transferList);
|
|
252
255
|
}
|
|
@@ -255,10 +258,10 @@
|
|
|
255
258
|
}
|
|
256
259
|
});
|
|
257
260
|
|
|
258
|
-
// ../../node_modules/@math.gl/
|
|
261
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
|
|
259
262
|
var AsyncQueue;
|
|
260
263
|
var init_async_queue = __esm({
|
|
261
|
-
"../../node_modules/@math.gl/
|
|
264
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
|
|
262
265
|
AsyncQueue = class {
|
|
263
266
|
constructor() {
|
|
264
267
|
this._values = [];
|
|
@@ -327,10 +330,10 @@
|
|
|
327
330
|
}
|
|
328
331
|
});
|
|
329
332
|
|
|
330
|
-
// ../../node_modules/@math.gl/
|
|
333
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
|
|
331
334
|
var SharedWorkerState;
|
|
332
335
|
var init_shared_state = __esm({
|
|
333
|
-
"../../node_modules/@math.gl/
|
|
336
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
|
|
334
337
|
SharedWorkerState = class {
|
|
335
338
|
constructor(buffer) {
|
|
336
339
|
if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
|
|
@@ -371,8 +374,19 @@
|
|
|
371
374
|
}
|
|
372
375
|
});
|
|
373
376
|
|
|
374
|
-
// ../../node_modules/@math.gl/
|
|
375
|
-
|
|
377
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
|
|
378
|
+
function validateOutputOwnership(ownership) {
|
|
379
|
+
if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
|
|
380
|
+
throw new Error("Invalid worker output ownership");
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
var init_validate_output_ownership = __esm({
|
|
384
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
|
|
389
|
+
async function createWorker(process2, processInBatches, preload2) {
|
|
376
390
|
if (!await WorkerBody.inWorkerThread()) {
|
|
377
391
|
return;
|
|
378
392
|
}
|
|
@@ -413,10 +427,12 @@
|
|
|
413
427
|
}
|
|
414
428
|
switch (type) {
|
|
415
429
|
case "preload":
|
|
430
|
+
await preload2?.();
|
|
416
431
|
WorkerBody.postMessage("done", {});
|
|
417
432
|
break;
|
|
418
433
|
case "process":
|
|
419
434
|
throwIfAborted();
|
|
435
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
420
436
|
if (!process2) {
|
|
421
437
|
throw new Error("Worker does not support atomic processing");
|
|
422
438
|
}
|
|
@@ -426,10 +442,11 @@
|
|
|
426
442
|
await WorkerBody.postMessage("done", {
|
|
427
443
|
result,
|
|
428
444
|
executionMs: performance.now() - startedAt
|
|
429
|
-
});
|
|
445
|
+
}, payload.options?.["outputOwnership"] === "copy");
|
|
430
446
|
break;
|
|
431
447
|
case "process-in-batches":
|
|
432
448
|
throwIfAborted();
|
|
449
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
433
450
|
if (!processInBatches) {
|
|
434
451
|
throw new Error("Worker does not support batched processing");
|
|
435
452
|
}
|
|
@@ -441,7 +458,7 @@
|
|
|
441
458
|
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
442
459
|
for await (const batch of resultIterator) {
|
|
443
460
|
throwIfAborted();
|
|
444
|
-
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
461
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
|
|
445
462
|
await outputAcknowledgements.next();
|
|
446
463
|
}
|
|
447
464
|
throwIfAborted();
|
|
@@ -539,14 +556,14 @@
|
|
|
539
556
|
});
|
|
540
557
|
}
|
|
541
558
|
function createProgressReporter() {
|
|
542
|
-
let
|
|
559
|
+
let pending2;
|
|
543
560
|
let finished = false;
|
|
544
561
|
let scheduled = false;
|
|
545
562
|
const flush = () => {
|
|
546
563
|
scheduled = false;
|
|
547
|
-
if (
|
|
548
|
-
WorkerBody.postMessage("progress", { progress:
|
|
549
|
-
|
|
564
|
+
if (pending2) {
|
|
565
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
566
|
+
pending2 = void 0;
|
|
550
567
|
}
|
|
551
568
|
};
|
|
552
569
|
return {
|
|
@@ -554,9 +571,9 @@
|
|
|
554
571
|
report(progress) {
|
|
555
572
|
if (finished)
|
|
556
573
|
return;
|
|
557
|
-
if (
|
|
574
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
558
575
|
flush();
|
|
559
|
-
|
|
576
|
+
pending2 = { ...progress };
|
|
560
577
|
if (!scheduled) {
|
|
561
578
|
scheduled = true;
|
|
562
579
|
setTimeout(flush, 0);
|
|
@@ -565,7 +582,7 @@
|
|
|
565
582
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
566
583
|
finish(discard = false) {
|
|
567
584
|
if (discard)
|
|
568
|
-
|
|
585
|
+
pending2 = void 0;
|
|
569
586
|
flush();
|
|
570
587
|
finished = true;
|
|
571
588
|
}
|
|
@@ -573,10 +590,11 @@
|
|
|
573
590
|
}
|
|
574
591
|
var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
|
|
575
592
|
var init_create_worker = __esm({
|
|
576
|
-
"../../node_modules/@math.gl/
|
|
593
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
|
|
577
594
|
init_shared_state();
|
|
578
595
|
init_async_queue();
|
|
579
596
|
init_worker_body();
|
|
597
|
+
init_validate_output_ownership();
|
|
580
598
|
requestId = 0;
|
|
581
599
|
activeController = null;
|
|
582
600
|
activeInputBatches = null;
|
|
@@ -584,29 +602,589 @@
|
|
|
584
602
|
}
|
|
585
603
|
});
|
|
586
604
|
|
|
587
|
-
// ../../node_modules/@math.gl/
|
|
605
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
|
|
588
606
|
var import_meta, path, moduleUrl;
|
|
589
607
|
var init_worker_utils = __esm({
|
|
590
|
-
"../../node_modules/@math.gl/
|
|
608
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
|
|
609
|
+
init_worker_body();
|
|
591
610
|
init_create_worker();
|
|
611
|
+
init_get_transfer_list();
|
|
592
612
|
import_meta = {};
|
|
593
613
|
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
594
614
|
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
595
615
|
}
|
|
596
616
|
});
|
|
597
617
|
|
|
598
|
-
// ../../node_modules/@math.gl/
|
|
599
|
-
|
|
600
|
-
|
|
618
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
|
|
619
|
+
function preloadTaskCode(task, signal) {
|
|
620
|
+
if (!task.preload)
|
|
621
|
+
return Promise.resolve();
|
|
622
|
+
let promise = pending.get(task);
|
|
623
|
+
if (!promise) {
|
|
624
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
625
|
+
loaded.add(task);
|
|
626
|
+
});
|
|
627
|
+
pending.set(task, promise);
|
|
628
|
+
void promise.catch(() => pending.delete(task));
|
|
629
|
+
}
|
|
630
|
+
return withSignal(promise, signal);
|
|
631
|
+
}
|
|
632
|
+
function withSignal(operation, signal) {
|
|
633
|
+
if (!signal)
|
|
634
|
+
return operation;
|
|
635
|
+
return new Promise((resolve, reject) => {
|
|
636
|
+
const abort = () => {
|
|
637
|
+
signal.removeEventListener("abort", abort);
|
|
638
|
+
reject(signal.reason);
|
|
639
|
+
};
|
|
640
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
641
|
+
if (signal.aborted)
|
|
642
|
+
abort();
|
|
643
|
+
operation.then((value) => {
|
|
644
|
+
signal.removeEventListener("abort", abort);
|
|
645
|
+
resolve(value);
|
|
646
|
+
}, (error) => {
|
|
647
|
+
signal.removeEventListener("abort", abort);
|
|
648
|
+
reject(error);
|
|
649
|
+
});
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
var pending, loaded;
|
|
653
|
+
var init_task_preload = __esm({
|
|
654
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
|
|
655
|
+
pending = /* @__PURE__ */ new WeakMap();
|
|
656
|
+
loaded = /* @__PURE__ */ new WeakSet();
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
|
|
661
|
+
var TaskRequestError, TaskChannel;
|
|
662
|
+
var init_task_channel = __esm({
|
|
663
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js"() {
|
|
664
|
+
TaskRequestError = class extends Error {
|
|
665
|
+
};
|
|
666
|
+
TaskChannel = class {
|
|
667
|
+
constructor(options) {
|
|
668
|
+
this.options = options;
|
|
669
|
+
this.nextId = 1;
|
|
670
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
671
|
+
this.incoming = /* @__PURE__ */ new Map();
|
|
672
|
+
}
|
|
673
|
+
/** Send a request without serializing other in-flight requests. */
|
|
674
|
+
request(operation, value, signal, transfer = []) {
|
|
675
|
+
if (this.failure)
|
|
676
|
+
return Promise.reject(this.failure.reason);
|
|
677
|
+
if (signal?.aborted)
|
|
678
|
+
return Promise.reject(signal.reason);
|
|
679
|
+
const id = this.nextId++;
|
|
680
|
+
return new Promise((resolve, reject) => {
|
|
681
|
+
const abort = () => {
|
|
682
|
+
const pending2 = this.pending.get(id);
|
|
683
|
+
if (!pending2)
|
|
684
|
+
return;
|
|
685
|
+
this.pending.delete(id);
|
|
686
|
+
pending2.cleanup();
|
|
687
|
+
reject(signal?.reason);
|
|
688
|
+
this.send({ source: "math.gl/tasks", kind: "cancel", id });
|
|
689
|
+
};
|
|
690
|
+
this.pending.set(id, {
|
|
691
|
+
resolve,
|
|
692
|
+
reject,
|
|
693
|
+
cleanup: () => signal?.removeEventListener("abort", abort)
|
|
694
|
+
});
|
|
695
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
696
|
+
this.send({ source: "math.gl/tasks", kind: "request", id, operation, value }, transfer);
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
/** Send a one-way notification. */
|
|
700
|
+
emit(operation, value, transfer = []) {
|
|
701
|
+
if (this.failure)
|
|
702
|
+
throw this.failure.reason;
|
|
703
|
+
this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation, value }, transfer);
|
|
704
|
+
}
|
|
705
|
+
/** Dispatch a transport message; unrelated protocols are ignored. */
|
|
706
|
+
receive(message) {
|
|
707
|
+
if (this.failure || message?.source !== "math.gl/tasks")
|
|
708
|
+
return;
|
|
709
|
+
if (message.kind === "failure") {
|
|
710
|
+
const reason = new Error(message.error?.message ?? "Task channel failed");
|
|
711
|
+
this.close(reason);
|
|
712
|
+
this.options.onFailure?.(reason);
|
|
713
|
+
} else if (message.kind === "result" || message.kind === "error") {
|
|
714
|
+
const pending2 = this.pending.get(message.id);
|
|
715
|
+
if (!pending2)
|
|
716
|
+
return;
|
|
717
|
+
this.pending.delete(message.id);
|
|
718
|
+
pending2.cleanup();
|
|
719
|
+
if (message.kind === "result")
|
|
720
|
+
pending2.resolve(message.value);
|
|
721
|
+
else {
|
|
722
|
+
const error = new TaskRequestError(message.error?.message ?? "Task request failed");
|
|
723
|
+
error.name = message.error?.name ?? "Error";
|
|
724
|
+
pending2.reject(error);
|
|
725
|
+
}
|
|
726
|
+
} else if (message.kind === "cancel") {
|
|
727
|
+
this.incoming.get(message.id)?.abort(new DOMException("Task request cancelled", "AbortError"));
|
|
728
|
+
} else if (message.kind === "event") {
|
|
729
|
+
try {
|
|
730
|
+
this.options.handleEvent?.(message.operation, message.value);
|
|
731
|
+
} catch (error) {
|
|
732
|
+
this.fail(error);
|
|
733
|
+
}
|
|
734
|
+
} else if (message.kind === "request") {
|
|
735
|
+
if (this.incoming.has(message.id)) {
|
|
736
|
+
this.fail(new Error("Duplicate task request identifier"));
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
const controller = new AbortController();
|
|
740
|
+
this.incoming.set(message.id, controller);
|
|
741
|
+
void Promise.resolve().then(() => {
|
|
742
|
+
controller.signal.throwIfAborted();
|
|
743
|
+
return this.options.handleRequest(message.operation, message.value, controller.signal);
|
|
744
|
+
}).then((value) => {
|
|
745
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
746
|
+
this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value }, this.options.getResultTransferList?.(value, message.value));
|
|
747
|
+
}
|
|
748
|
+
}).catch((reason) => {
|
|
749
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
750
|
+
this.send({
|
|
751
|
+
source: "math.gl/tasks",
|
|
752
|
+
kind: "error",
|
|
753
|
+
id: message.id,
|
|
754
|
+
error: {
|
|
755
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
756
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
}).finally(() => this.incoming.delete(message.id));
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
/** Reject all outstanding calls with a common cause and abort incoming callbacks. */
|
|
764
|
+
close(reason = new Error("Task channel closed")) {
|
|
765
|
+
if (this.failure)
|
|
766
|
+
return;
|
|
767
|
+
this.failure = { reason };
|
|
768
|
+
for (const pending2 of this.pending.values()) {
|
|
769
|
+
pending2.cleanup();
|
|
770
|
+
pending2.reject(reason);
|
|
771
|
+
}
|
|
772
|
+
this.pending.clear();
|
|
773
|
+
for (const controller of this.incoming.values())
|
|
774
|
+
controller.abort(reason);
|
|
775
|
+
this.incoming.clear();
|
|
776
|
+
}
|
|
777
|
+
send(message, transfer = []) {
|
|
778
|
+
if (this.failure)
|
|
779
|
+
return;
|
|
780
|
+
try {
|
|
781
|
+
this.options.send(message, transfer);
|
|
782
|
+
} catch (error) {
|
|
783
|
+
this.fail(error);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
/** Invalidate the channel and notify the peer when the transport still works. */
|
|
787
|
+
fail(reason) {
|
|
788
|
+
if (this.failure)
|
|
789
|
+
return;
|
|
790
|
+
this.close(reason);
|
|
791
|
+
try {
|
|
792
|
+
this.options.send({
|
|
793
|
+
source: "math.gl/tasks",
|
|
794
|
+
kind: "failure",
|
|
795
|
+
id: 0,
|
|
796
|
+
error: {
|
|
797
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
798
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
799
|
+
}
|
|
800
|
+
}, []);
|
|
801
|
+
} catch {
|
|
802
|
+
}
|
|
803
|
+
this.options.onFailure?.(reason);
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
|
|
810
|
+
function assertPayload(value) {
|
|
811
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
812
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
function clonePayload(value, ownership = "copy") {
|
|
816
|
+
assertPayload(value);
|
|
817
|
+
if (!["copy", "transfer", "share"].includes(ownership))
|
|
818
|
+
throw new TypeError("Invalid input ownership");
|
|
819
|
+
const transfer = getTransferList(value);
|
|
820
|
+
if (ownership === "share" && transfer.length)
|
|
821
|
+
throw new TypeError("Share requires shared storage");
|
|
822
|
+
return structuredClone(value, {
|
|
823
|
+
transfer: ownership === "transfer" ? transfer : []
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
function taskContext(state, context = {}) {
|
|
827
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
828
|
+
return {
|
|
829
|
+
state,
|
|
830
|
+
signal,
|
|
831
|
+
requestHost: async (operation, payload, controls) => {
|
|
832
|
+
signal.throwIfAborted();
|
|
833
|
+
if (!context.requestHost)
|
|
834
|
+
throw new Error("No host request handler configured");
|
|
835
|
+
return context.requestHost(operation, payload, controls);
|
|
836
|
+
},
|
|
837
|
+
emitHost: (operation, payload) => {
|
|
838
|
+
signal.throwIfAborted();
|
|
839
|
+
context.emitHost?.(operation, payload);
|
|
840
|
+
},
|
|
841
|
+
throwIfAborted: () => {
|
|
842
|
+
signal.throwIfAborted();
|
|
843
|
+
context.throwIfAborted?.();
|
|
844
|
+
},
|
|
845
|
+
reportProgress: (progress) => context.reportProgress?.({
|
|
846
|
+
...progress,
|
|
847
|
+
phase: progress.phase ?? "process",
|
|
848
|
+
unit: progress.unit ?? "items"
|
|
849
|
+
})
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
async function initializeTaskWorker(task) {
|
|
853
|
+
if (!await WorkerBody.inWorkerThread())
|
|
854
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
855
|
+
if (installed)
|
|
856
|
+
throw new Error("A task is already installed in this worker");
|
|
857
|
+
installed = true;
|
|
858
|
+
const runtime = new TaskRuntime(task);
|
|
859
|
+
let channelStream;
|
|
860
|
+
const channel = new TaskChannel({
|
|
861
|
+
getResultTransferList: (value, request) => request.outputOwnership === "transfer" ? getTransferList(value) : [],
|
|
862
|
+
send: (message, transfer) => {
|
|
863
|
+
const snapshot = structuredClone(message, { transfer });
|
|
864
|
+
void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
|
|
865
|
+
},
|
|
866
|
+
handleRequest: async (operation, value, signal) => {
|
|
867
|
+
const request = value;
|
|
868
|
+
const context = {
|
|
869
|
+
signal,
|
|
870
|
+
reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
|
|
871
|
+
requestHost: (operation2, payload, controls = {}) => {
|
|
872
|
+
const request2 = {
|
|
873
|
+
operation: operation2,
|
|
874
|
+
payload: clonePayload(payload, controls.inputOwnership),
|
|
875
|
+
outputOwnership: controls.outputOwnership ?? "copy"
|
|
876
|
+
};
|
|
877
|
+
return channel.request("task:host-request", request2, signal, getTransferList(request2));
|
|
878
|
+
},
|
|
879
|
+
emitHost: (operation2, payload) => channel.emit("task:host-event", { operation: operation2, payload, id: request.progressId })
|
|
880
|
+
};
|
|
881
|
+
switch (operation) {
|
|
882
|
+
case "initialize":
|
|
883
|
+
return runtime.initialize(request.input, context);
|
|
884
|
+
case "process":
|
|
885
|
+
return runtime.process(request.input, request.options, context);
|
|
886
|
+
case "stream-open": {
|
|
887
|
+
if (channelStream)
|
|
888
|
+
throw new Error("A task stream is already open");
|
|
889
|
+
async function* inputs() {
|
|
890
|
+
while (true) {
|
|
891
|
+
const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
|
|
892
|
+
if (result.done)
|
|
893
|
+
return;
|
|
894
|
+
yield result.value;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
|
|
898
|
+
return {};
|
|
899
|
+
}
|
|
900
|
+
case "stream-next":
|
|
901
|
+
if (!channelStream)
|
|
902
|
+
throw new Error("No active task stream");
|
|
903
|
+
return channelStream.next();
|
|
904
|
+
case "stream-close":
|
|
905
|
+
try {
|
|
906
|
+
await channelStream?.return?.();
|
|
907
|
+
} finally {
|
|
908
|
+
channelStream = void 0;
|
|
909
|
+
}
|
|
910
|
+
return {};
|
|
911
|
+
case "destroy":
|
|
912
|
+
return runtime.destroy();
|
|
913
|
+
default:
|
|
914
|
+
throw new Error("Unknown task channel operation");
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
await WorkerBody.addEventListener((type, payload) => {
|
|
919
|
+
if (type === "task-channel")
|
|
920
|
+
channel.receive(payload);
|
|
921
|
+
});
|
|
922
|
+
let streamOptions = {};
|
|
923
|
+
return createWorker(async (request, _options, context) => {
|
|
924
|
+
switch (request.operation) {
|
|
925
|
+
case "initialize":
|
|
926
|
+
return runtime.initialize(request.input, context);
|
|
927
|
+
case "destroy":
|
|
928
|
+
return runtime.destroy();
|
|
929
|
+
case "stream-options":
|
|
930
|
+
streamOptions = request.options;
|
|
931
|
+
return {};
|
|
932
|
+
case "process":
|
|
933
|
+
return runtime.process(request.input, request.options, context);
|
|
934
|
+
default:
|
|
935
|
+
throw new Error("Unknown task operation");
|
|
936
|
+
}
|
|
937
|
+
}, async function* (inputs, _options, context) {
|
|
938
|
+
async function* batches() {
|
|
939
|
+
for await (const input of inputs) {
|
|
940
|
+
assertPayload(input);
|
|
941
|
+
yield input;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
try {
|
|
945
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
946
|
+
} finally {
|
|
947
|
+
streamOptions = {};
|
|
948
|
+
}
|
|
949
|
+
}, () => preloadTaskCode(task));
|
|
950
|
+
}
|
|
951
|
+
var TaskRuntime, installed;
|
|
952
|
+
var init_task_runtime = __esm({
|
|
953
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
|
|
601
954
|
init_worker_utils();
|
|
955
|
+
init_task_preload();
|
|
956
|
+
init_task_channel();
|
|
957
|
+
TaskRuntime = class {
|
|
958
|
+
constructor(task) {
|
|
959
|
+
this.task = task;
|
|
960
|
+
this.initialized = false;
|
|
961
|
+
}
|
|
962
|
+
async initialize(input, context = {}) {
|
|
963
|
+
if (this.initialized)
|
|
964
|
+
throw new Error("Task is already initialized");
|
|
965
|
+
assertPayload(input);
|
|
966
|
+
await preloadTaskCode(this.task, context.signal);
|
|
967
|
+
context.signal?.throwIfAborted();
|
|
968
|
+
this.state = await this.task.initialize?.(input, taskContext(void 0, context));
|
|
969
|
+
this.initialized = true;
|
|
970
|
+
return {};
|
|
971
|
+
}
|
|
972
|
+
async destroy() {
|
|
973
|
+
if (this.initialized) {
|
|
974
|
+
this.initialized = false;
|
|
975
|
+
const state = this.state;
|
|
976
|
+
this.state = void 0;
|
|
977
|
+
if (this.task.initialize)
|
|
978
|
+
await this.task.destroy?.(state);
|
|
979
|
+
}
|
|
980
|
+
return {};
|
|
981
|
+
}
|
|
982
|
+
async process(input, options, context = {}) {
|
|
983
|
+
if (!this.initialized)
|
|
984
|
+
throw new Error("Task is not initialized");
|
|
985
|
+
if (!this.task.process)
|
|
986
|
+
throw new Error("Task has no atomic processor");
|
|
987
|
+
assertPayload(input);
|
|
988
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
989
|
+
assertPayload(result);
|
|
990
|
+
return result;
|
|
991
|
+
}
|
|
992
|
+
async *stream(inputs, options, context = {}) {
|
|
993
|
+
if (!this.initialized)
|
|
994
|
+
throw new Error("Task is not initialized");
|
|
995
|
+
if (!this.task.processInBatches)
|
|
996
|
+
throw new Error("Task has no streaming processor");
|
|
997
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
998
|
+
assertPayload(output);
|
|
999
|
+
yield output;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
installed = false;
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
|
|
1007
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/index.js
|
|
1008
|
+
var init_tasks = __esm({
|
|
1009
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
|
|
1010
|
+
init_task_runtime();
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
|
|
1014
|
+
// ../../node_modules/@math.gl/tasks/dist/index.js
|
|
1015
|
+
var init_dist = __esm({
|
|
1016
|
+
"../../node_modules/@math.gl/tasks/dist/index.js"() {
|
|
1017
|
+
init_tasks();
|
|
1018
|
+
}
|
|
1019
|
+
});
|
|
1020
|
+
|
|
1021
|
+
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
1022
|
+
var worker_threads_browser_exports = {};
|
|
1023
|
+
__export(worker_threads_browser_exports, {
|
|
1024
|
+
NodeWorker: () => NodeWorker,
|
|
1025
|
+
parentPort: () => parentPort2
|
|
1026
|
+
});
|
|
1027
|
+
var NodeWorker, parentPort2;
|
|
1028
|
+
var init_worker_threads_browser2 = __esm({
|
|
1029
|
+
"../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
|
|
1030
|
+
"use strict";
|
|
1031
|
+
NodeWorker = class {
|
|
1032
|
+
/** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
|
|
1033
|
+
constructor(...arguments_) {
|
|
1034
|
+
const runtimeProcess = globalThis.process;
|
|
1035
|
+
const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
|
|
1036
|
+
if (WorkerConstructor) {
|
|
1037
|
+
return new WorkerConstructor(...arguments_);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
/** No-op browser fallback matching the native Worker API. */
|
|
1041
|
+
terminate() {
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1044
|
+
parentPort2 = null;
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
|
|
1048
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
1049
|
+
function normalizeTaskProgress(progress) {
|
|
1050
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
1051
|
+
}
|
|
1052
|
+
async function isWorkerThread() {
|
|
1053
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
1054
|
+
return true;
|
|
1055
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
1056
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
|
|
1057
|
+
return !isMainThread;
|
|
1058
|
+
}
|
|
1059
|
+
return false;
|
|
1060
|
+
}
|
|
1061
|
+
var initializeTaskWorker2;
|
|
1062
|
+
var init_task_runtime2 = __esm({
|
|
1063
|
+
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
1064
|
+
"use strict";
|
|
1065
|
+
init_dist();
|
|
1066
|
+
initializeTaskWorker2 = initializeTaskWorker;
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
|
|
1070
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
1071
|
+
function getTransferList2(object, recursive = true, transfers) {
|
|
1072
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
1073
|
+
if (!object) {
|
|
1074
|
+
} else if (isTransferable2(object)) {
|
|
1075
|
+
transfersSet.add(object);
|
|
1076
|
+
} else if (isTransferable2(object.buffer)) {
|
|
1077
|
+
transfersSet.add(object.buffer);
|
|
1078
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
1079
|
+
} else if (recursive && typeof object === "object") {
|
|
1080
|
+
for (const key in object) {
|
|
1081
|
+
getTransferList2(object[key], recursive, transfersSet);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
1085
|
+
}
|
|
1086
|
+
function isTransferable2(object) {
|
|
1087
|
+
if (!object) {
|
|
1088
|
+
return false;
|
|
1089
|
+
}
|
|
1090
|
+
if (object instanceof ArrayBuffer) {
|
|
1091
|
+
return true;
|
|
1092
|
+
}
|
|
1093
|
+
if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
|
|
1094
|
+
return true;
|
|
1095
|
+
}
|
|
1096
|
+
if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
|
|
1097
|
+
return true;
|
|
1098
|
+
}
|
|
1099
|
+
if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
|
|
1100
|
+
return true;
|
|
1101
|
+
}
|
|
1102
|
+
return false;
|
|
1103
|
+
}
|
|
1104
|
+
var init_get_transfer_list2 = __esm({
|
|
1105
|
+
"../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
|
|
1106
|
+
"use strict";
|
|
602
1107
|
}
|
|
603
1108
|
});
|
|
604
1109
|
|
|
605
1110
|
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
1111
|
+
async function createWorker2(process2, processInBatches) {
|
|
1112
|
+
if (!await isWorkerThread()) return;
|
|
1113
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
1114
|
+
}
|
|
1115
|
+
function createWorkerTask(process2, processInBatches) {
|
|
1116
|
+
return {
|
|
1117
|
+
id: "loaders.gl",
|
|
1118
|
+
initialize: (state) => state,
|
|
1119
|
+
destroy: (state) => state.port?.close(),
|
|
1120
|
+
process: async ({ value }, options, context) => {
|
|
1121
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
1122
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
1123
|
+
},
|
|
1124
|
+
...processInBatches ? {
|
|
1125
|
+
processInBatches: async function* (inputs, options, context) {
|
|
1126
|
+
async function* values() {
|
|
1127
|
+
for await (const input of inputs) yield input.value;
|
|
1128
|
+
}
|
|
1129
|
+
for await (const value of processInBatches(
|
|
1130
|
+
values(),
|
|
1131
|
+
options,
|
|
1132
|
+
createContext(context),
|
|
1133
|
+
context.state.context
|
|
1134
|
+
)) {
|
|
1135
|
+
yield { value };
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
} : {}
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
function createContext(context) {
|
|
1142
|
+
let requestIdentifier = 0;
|
|
1143
|
+
const port = context.state.port;
|
|
1144
|
+
return {
|
|
1145
|
+
signal: context.signal,
|
|
1146
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
1147
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
1148
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
1149
|
+
context.throwIfAborted();
|
|
1150
|
+
const identifier = ++requestIdentifier;
|
|
1151
|
+
return new Promise((resolve, reject) => {
|
|
1152
|
+
const onMessage = (event) => {
|
|
1153
|
+
if (event.data.identifier !== identifier) return;
|
|
1154
|
+
cleanup();
|
|
1155
|
+
if (event.data.error) {
|
|
1156
|
+
const error = new Error(event.data.error.message);
|
|
1157
|
+
error.name = event.data.error.name;
|
|
1158
|
+
reject(error);
|
|
1159
|
+
} else resolve(event.data.value);
|
|
1160
|
+
};
|
|
1161
|
+
const onAbort = () => {
|
|
1162
|
+
cleanup();
|
|
1163
|
+
reject(context.signal.reason);
|
|
1164
|
+
};
|
|
1165
|
+
const cleanup = () => {
|
|
1166
|
+
port.removeEventListener("message", onMessage);
|
|
1167
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
1168
|
+
};
|
|
1169
|
+
port.addEventListener("message", onMessage);
|
|
1170
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
1171
|
+
port.start();
|
|
1172
|
+
try {
|
|
1173
|
+
const request = { identifier, input, options, context: jobContext };
|
|
1174
|
+
port.postMessage(request, getTransferList2(request));
|
|
1175
|
+
} catch (error) {
|
|
1176
|
+
cleanup();
|
|
1177
|
+
reject(error);
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
} : void 0
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
606
1183
|
var init_create_worker2 = __esm({
|
|
607
1184
|
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
608
1185
|
"use strict";
|
|
609
|
-
|
|
1186
|
+
init_task_runtime2();
|
|
1187
|
+
init_get_transfer_list2();
|
|
610
1188
|
}
|
|
611
1189
|
});
|
|
612
1190
|
|
|
@@ -783,7 +1361,7 @@
|
|
|
783
1361
|
|
|
784
1362
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
785
1363
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
786
|
-
await
|
|
1364
|
+
await createWorker2(
|
|
787
1365
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
788
1366
|
selectLoader(options || {}),
|
|
789
1367
|
input,
|
|
@@ -1037,7 +1615,7 @@
|
|
|
1037
1615
|
});
|
|
1038
1616
|
|
|
1039
1617
|
// ../../node_modules/@math.gl/core/dist/index.js
|
|
1040
|
-
var
|
|
1618
|
+
var init_dist2 = __esm({
|
|
1041
1619
|
"../../node_modules/@math.gl/core/dist/index.js"() {
|
|
1042
1620
|
init_math_utils();
|
|
1043
1621
|
init_types2();
|
|
@@ -8775,11 +9353,11 @@ return true;`);
|
|
|
8775
9353
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8776
9354
|
}
|
|
8777
9355
|
setValue(index, value) {
|
|
8778
|
-
const
|
|
8779
|
-
const current =
|
|
9356
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
9357
|
+
const current = pending2.get(index);
|
|
8780
9358
|
current && (this._pendingLength -= current.length);
|
|
8781
9359
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8782
|
-
|
|
9360
|
+
pending2.set(index, value);
|
|
8783
9361
|
}
|
|
8784
9362
|
setValid(index, isValid) {
|
|
8785
9363
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8802,12 +9380,12 @@ return true;`);
|
|
|
8802
9380
|
return super.finish();
|
|
8803
9381
|
}
|
|
8804
9382
|
_flush() {
|
|
8805
|
-
const
|
|
9383
|
+
const pending2 = this._pending;
|
|
8806
9384
|
const pendingLength = this._pendingLength;
|
|
8807
9385
|
this._pendingLength = 0;
|
|
8808
9386
|
this._pending = void 0;
|
|
8809
|
-
if (
|
|
8810
|
-
this._flushPending(
|
|
9387
|
+
if (pending2 && pending2.size > 0) {
|
|
9388
|
+
this._flushPending(pending2, pendingLength);
|
|
8811
9389
|
}
|
|
8812
9390
|
return this;
|
|
8813
9391
|
}
|
|
@@ -11393,11 +11971,11 @@ return true;`);
|
|
|
11393
11971
|
setValue(index, value) {
|
|
11394
11972
|
return super.setValue(index, toUint8Array(value));
|
|
11395
11973
|
}
|
|
11396
|
-
_flushPending(
|
|
11974
|
+
_flushPending(pending2, pendingLength) {
|
|
11397
11975
|
const offsets = this._offsets;
|
|
11398
11976
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11399
11977
|
let offset = 0;
|
|
11400
|
-
for (const [index, value] of
|
|
11978
|
+
for (const [index, value] of pending2) {
|
|
11401
11979
|
if (value === void 0) {
|
|
11402
11980
|
offsets.set(index, 0);
|
|
11403
11981
|
} else {
|
|
@@ -11434,11 +12012,11 @@ return true;`);
|
|
|
11434
12012
|
setValue(index, value) {
|
|
11435
12013
|
return super.setValue(index, toUint8Array(value));
|
|
11436
12014
|
}
|
|
11437
|
-
_flushPending(
|
|
12015
|
+
_flushPending(pending2, pendingLength) {
|
|
11438
12016
|
const offsets = this._offsets;
|
|
11439
12017
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11440
12018
|
let offset = 0;
|
|
11441
|
-
for (const [index, value] of
|
|
12019
|
+
for (const [index, value] of pending2) {
|
|
11442
12020
|
if (value === void 0) {
|
|
11443
12021
|
offsets.set(index, BigInt(0));
|
|
11444
12022
|
} else {
|
|
@@ -11749,10 +12327,10 @@ return true;`);
|
|
|
11749
12327
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11750
12328
|
return this.numChildren - 1;
|
|
11751
12329
|
}
|
|
11752
|
-
_flushPending(
|
|
12330
|
+
_flushPending(pending2) {
|
|
11753
12331
|
const offsets = this._offsets;
|
|
11754
12332
|
const [child] = this.children;
|
|
11755
|
-
for (const [index, value] of
|
|
12333
|
+
for (const [index, value] of pending2) {
|
|
11756
12334
|
if (typeof value === "undefined") {
|
|
11757
12335
|
offsets.set(index, 0);
|
|
11758
12336
|
} else {
|
|
@@ -11791,10 +12369,10 @@ return true;`);
|
|
|
11791
12369
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11792
12370
|
return this.numChildren - 1;
|
|
11793
12371
|
}
|
|
11794
|
-
_flushPending(
|
|
12372
|
+
_flushPending(pending2) {
|
|
11795
12373
|
const offsets = this._offsets;
|
|
11796
12374
|
const [child] = this.children;
|
|
11797
|
-
for (const [index, value] of
|
|
12375
|
+
for (const [index, value] of pending2) {
|
|
11798
12376
|
if (typeof value === "undefined") {
|
|
11799
12377
|
offsets.set(index, BigInt(0));
|
|
11800
12378
|
} else {
|
|
@@ -11824,11 +12402,11 @@ return true;`);
|
|
|
11824
12402
|
}
|
|
11825
12403
|
setValue(index, value) {
|
|
11826
12404
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11827
|
-
const
|
|
11828
|
-
const current =
|
|
12405
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
12406
|
+
const current = pending2.get(index);
|
|
11829
12407
|
current && (this._pendingLength -= current.size);
|
|
11830
12408
|
this._pendingLength += row.size;
|
|
11831
|
-
|
|
12409
|
+
pending2.set(index, row);
|
|
11832
12410
|
}
|
|
11833
12411
|
addChild(child, name = `${this.numChildren}`) {
|
|
11834
12412
|
if (this.numChildren > 0) {
|
|
@@ -11838,10 +12416,10 @@ return true;`);
|
|
|
11838
12416
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11839
12417
|
return this.numChildren - 1;
|
|
11840
12418
|
}
|
|
11841
|
-
_flushPending(
|
|
12419
|
+
_flushPending(pending2) {
|
|
11842
12420
|
const offsets = this._offsets;
|
|
11843
12421
|
const [child] = this.children;
|
|
11844
|
-
for (const [index, value] of
|
|
12422
|
+
for (const [index, value] of pending2) {
|
|
11845
12423
|
if (value === void 0) {
|
|
11846
12424
|
offsets.set(index, 0);
|
|
11847
12425
|
} else {
|
|
@@ -12050,7 +12628,7 @@ return true;`);
|
|
|
12050
12628
|
return super.setValue(index, encodeUtf8(value));
|
|
12051
12629
|
}
|
|
12052
12630
|
// @ts-ignore
|
|
12053
|
-
_flushPending(
|
|
12631
|
+
_flushPending(pending2, pendingLength) {
|
|
12054
12632
|
}
|
|
12055
12633
|
};
|
|
12056
12634
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -12081,7 +12659,7 @@ return true;`);
|
|
|
12081
12659
|
return super.setValue(index, encodeUtf8(value));
|
|
12082
12660
|
}
|
|
12083
12661
|
// @ts-ignore
|
|
12084
|
-
_flushPending(
|
|
12662
|
+
_flushPending(pending2, pendingLength) {
|
|
12085
12663
|
}
|
|
12086
12664
|
};
|
|
12087
12665
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -16032,12 +16610,6 @@ return true;`);
|
|
|
16032
16610
|
metadata: serializeArrowMetadata(arrowSchema.metadata)
|
|
16033
16611
|
};
|
|
16034
16612
|
}
|
|
16035
|
-
function deserializeArrowSchema(schema, options) {
|
|
16036
|
-
return new Schema2(
|
|
16037
|
-
schema.fields.map((field) => deserializeArrowField(field, options)),
|
|
16038
|
-
deserializeArrowMetadata(schema.metadata)
|
|
16039
|
-
);
|
|
16040
|
-
}
|
|
16041
16613
|
function serializeArrowMetadata(arrowMetadata) {
|
|
16042
16614
|
return Object.fromEntries(arrowMetadata);
|
|
16043
16615
|
}
|
|
@@ -16506,7 +17078,7 @@ return true;`);
|
|
|
16506
17078
|
var init_float162 = __esm({
|
|
16507
17079
|
"../core/src/schema/float16.ts"() {
|
|
16508
17080
|
"use strict";
|
|
16509
|
-
|
|
17081
|
+
init_dist2();
|
|
16510
17082
|
}
|
|
16511
17083
|
});
|
|
16512
17084
|
|
|
@@ -17717,7 +18289,29 @@ return true;`);
|
|
|
17717
18289
|
}
|
|
17718
18290
|
});
|
|
17719
18291
|
|
|
17720
|
-
//
|
|
18292
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
|
|
18293
|
+
function getArrowVariadicBuffers(data) {
|
|
18294
|
+
return data.variadicBuffers ?? [];
|
|
18295
|
+
}
|
|
18296
|
+
function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
|
|
18297
|
+
return Reflect.construct(Data, [
|
|
18298
|
+
type,
|
|
18299
|
+
offset,
|
|
18300
|
+
length,
|
|
18301
|
+
nullCount,
|
|
18302
|
+
buffers,
|
|
18303
|
+
children,
|
|
18304
|
+
dictionary,
|
|
18305
|
+
variadicBuffers
|
|
18306
|
+
]);
|
|
18307
|
+
}
|
|
18308
|
+
var init_arrow_data = __esm({
|
|
18309
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
|
|
18310
|
+
init_Arrow_dom();
|
|
18311
|
+
}
|
|
18312
|
+
});
|
|
18313
|
+
|
|
18314
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
|
|
17721
18315
|
function splitArrowBuffers(input, options = {}) {
|
|
17722
18316
|
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
17723
18317
|
if (isArrowTable2(input)) {
|
|
@@ -17740,17 +18334,12 @@ return true;`);
|
|
|
17740
18334
|
function isArrowVector2(input) {
|
|
17741
18335
|
return "data" in input && Array.isArray(input.data);
|
|
17742
18336
|
}
|
|
17743
|
-
function splitArrowTableBuffersInternal(
|
|
17744
|
-
const recordBatches =
|
|
17745
|
-
|
|
17746
|
-
);
|
|
17747
|
-
return new Table(table.schema, recordBatches);
|
|
18337
|
+
function splitArrowTableBuffersInternal(arrowTable, options) {
|
|
18338
|
+
const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
|
|
18339
|
+
return new Table(arrowTable.schema, recordBatches);
|
|
17748
18340
|
}
|
|
17749
18341
|
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
17750
|
-
return new RecordBatch3(
|
|
17751
|
-
recordBatch.schema,
|
|
17752
|
-
splitArrowDataBuffers(recordBatch.data, options)
|
|
17753
|
-
);
|
|
18342
|
+
return new RecordBatch3(recordBatch.schema, splitArrowDataBuffers(recordBatch.data, options));
|
|
17754
18343
|
}
|
|
17755
18344
|
function splitArrowDataBuffers(data, options) {
|
|
17756
18345
|
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
@@ -17761,7 +18350,7 @@ return true;`);
|
|
|
17761
18350
|
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
17762
18351
|
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
17763
18352
|
};
|
|
17764
|
-
return
|
|
18353
|
+
return createArrowData(
|
|
17765
18354
|
data.type,
|
|
17766
18355
|
data.offset,
|
|
17767
18356
|
data.length,
|
|
@@ -17769,7 +18358,8 @@ return true;`);
|
|
|
17769
18358
|
data._nullCount,
|
|
17770
18359
|
buffers,
|
|
17771
18360
|
children,
|
|
17772
|
-
dictionary
|
|
18361
|
+
dictionary,
|
|
18362
|
+
getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
|
|
17773
18363
|
);
|
|
17774
18364
|
}
|
|
17775
18365
|
function splitArrowVectorBuffers(vector, options) {
|
|
@@ -17787,7 +18377,7 @@ return true;`);
|
|
|
17787
18377
|
}
|
|
17788
18378
|
let copy = options.copies.get(array);
|
|
17789
18379
|
if (!copy) {
|
|
17790
|
-
copy = array.slice();
|
|
18380
|
+
copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
|
|
17791
18381
|
options.copies.set(array, copy);
|
|
17792
18382
|
}
|
|
17793
18383
|
return copy;
|
|
@@ -17796,29 +18386,106 @@ return true;`);
|
|
|
17796
18386
|
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
17797
18387
|
}
|
|
17798
18388
|
var init_split_arrow_buffers = __esm({
|
|
17799
|
-
"
|
|
17800
|
-
"use strict";
|
|
18389
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
|
|
17801
18390
|
init_Arrow_dom();
|
|
18391
|
+
init_arrow_data();
|
|
18392
|
+
}
|
|
18393
|
+
});
|
|
18394
|
+
|
|
18395
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
|
|
18396
|
+
var init_indexed_arrow_vector = __esm({
|
|
18397
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
|
|
18398
|
+
}
|
|
18399
|
+
});
|
|
18400
|
+
|
|
18401
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
|
|
18402
|
+
var init_indexed_arrow_table = __esm({
|
|
18403
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
|
|
17802
18404
|
}
|
|
17803
18405
|
});
|
|
17804
18406
|
|
|
17805
|
-
//
|
|
17806
|
-
|
|
17807
|
-
|
|
18407
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
|
|
18408
|
+
var init_mapped_arrow_table = __esm({
|
|
18409
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
|
|
18410
|
+
}
|
|
18411
|
+
});
|
|
18412
|
+
|
|
18413
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
|
|
18414
|
+
var init_rename_arrow_columns = __esm({
|
|
18415
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
|
|
18416
|
+
}
|
|
18417
|
+
});
|
|
18418
|
+
|
|
18419
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
|
|
18420
|
+
function dehydrateArrowTable(arrowTable, options) {
|
|
18421
|
+
const splitTable = splitArrowBuffers(arrowTable, options);
|
|
17808
18422
|
return {
|
|
17809
|
-
shape: "arrow-table",
|
|
17810
18423
|
transport: "arrow-js",
|
|
17811
|
-
|
|
17812
|
-
|
|
18424
|
+
version: 1,
|
|
18425
|
+
schema: tableToIPC(new Table(splitTable.schema, [])),
|
|
18426
|
+
metadataVersion: splitTable.schema.metadataVersion,
|
|
18427
|
+
batches: splitTable.batches.map((batch) => dehydrateArrowData(batch.data))
|
|
17813
18428
|
};
|
|
17814
18429
|
}
|
|
17815
18430
|
function hydrateArrowTable(table) {
|
|
17816
|
-
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
);
|
|
17820
|
-
|
|
18431
|
+
if (table.transport !== "arrow-js" || table.version !== 1) {
|
|
18432
|
+
throw new Error("Unsupported Arrow column-buffer transport protocol.");
|
|
18433
|
+
}
|
|
18434
|
+
const decodedSchema = tableFromIPC(table.schema).schema;
|
|
18435
|
+
const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
|
|
18436
|
+
const type = new Struct(schema.fields);
|
|
18437
|
+
const batches = table.batches.map((data) => new RecordBatch3(schema, hydrateArrowData(data, type)));
|
|
18438
|
+
return new Table(schema, batches);
|
|
17821
18439
|
}
|
|
18440
|
+
function dehydrateArrowData(data) {
|
|
18441
|
+
return {
|
|
18442
|
+
offset: data.offset,
|
|
18443
|
+
length: data.length,
|
|
18444
|
+
nullCount: data.nullCount,
|
|
18445
|
+
buffers: {
|
|
18446
|
+
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
18447
|
+
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
18448
|
+
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
18449
|
+
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
18450
|
+
},
|
|
18451
|
+
children: data.children.map((child) => dehydrateArrowData(child)),
|
|
18452
|
+
variadicBuffers: getArrowVariadicBuffers(data),
|
|
18453
|
+
dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
|
|
18454
|
+
};
|
|
18455
|
+
}
|
|
18456
|
+
function hydrateArrowData(data, type) {
|
|
18457
|
+
const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
|
|
18458
|
+
const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
|
|
18459
|
+
return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
|
|
18460
|
+
}
|
|
18461
|
+
var init_arrow_table_transport = __esm({
|
|
18462
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
|
|
18463
|
+
init_Arrow_dom();
|
|
18464
|
+
init_arrow_data();
|
|
18465
|
+
init_split_arrow_buffers();
|
|
18466
|
+
}
|
|
18467
|
+
});
|
|
18468
|
+
|
|
18469
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/index.js
|
|
18470
|
+
var init_arrow = __esm({
|
|
18471
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
|
|
18472
|
+
init_indexed_arrow_table();
|
|
18473
|
+
init_indexed_arrow_vector();
|
|
18474
|
+
init_mapped_arrow_table();
|
|
18475
|
+
init_rename_arrow_columns();
|
|
18476
|
+
init_split_arrow_buffers();
|
|
18477
|
+
init_arrow_table_transport();
|
|
18478
|
+
}
|
|
18479
|
+
});
|
|
18480
|
+
|
|
18481
|
+
// ../../node_modules/@math.gl/arrow/dist/index.js
|
|
18482
|
+
var init_dist3 = __esm({
|
|
18483
|
+
"../../node_modules/@math.gl/arrow/dist/index.js"() {
|
|
18484
|
+
init_arrow();
|
|
18485
|
+
}
|
|
18486
|
+
});
|
|
18487
|
+
|
|
18488
|
+
// ../core/src/arrow-worker-transport.ts
|
|
17822
18489
|
function serializeArrowWorkerResult(result, options) {
|
|
17823
18490
|
if (!isArrowTableWrapper(result)) {
|
|
17824
18491
|
return result;
|
|
@@ -17848,60 +18515,10 @@ return true;`);
|
|
|
17848
18515
|
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
17849
18516
|
);
|
|
17850
18517
|
}
|
|
17851
|
-
|
|
17852
|
-
|
|
17853
|
-
}
|
|
17854
|
-
function dehydrateArrowData(data) {
|
|
17855
|
-
return {
|
|
17856
|
-
type: serializeArrowType(data.type),
|
|
17857
|
-
offset: data.offset,
|
|
17858
|
-
length: data.length,
|
|
17859
|
-
// @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
|
|
17860
|
-
nullCount: data._nullCount,
|
|
17861
|
-
buffers: {
|
|
17862
|
-
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
17863
|
-
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
17864
|
-
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
17865
|
-
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
17866
|
-
},
|
|
17867
|
-
children: data.children.map((childData) => dehydrateArrowData(childData)),
|
|
17868
|
-
dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
|
|
17869
|
-
};
|
|
17870
|
-
}
|
|
17871
|
-
function dehydrateArrowVector(vector) {
|
|
17872
|
-
return { data: vector.data.map((data) => dehydrateArrowData(data)) };
|
|
17873
|
-
}
|
|
17874
|
-
function hydrateArrowData(data) {
|
|
17875
|
-
const children = data.children.map((childData) => hydrateArrowData(childData));
|
|
17876
|
-
const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
|
|
17877
|
-
return new Data(
|
|
17878
|
-
deserializeArrowType(data.type),
|
|
17879
|
-
data.offset,
|
|
17880
|
-
data.length,
|
|
17881
|
-
data.nullCount,
|
|
17882
|
-
data.buffers,
|
|
17883
|
-
children,
|
|
17884
|
-
dictionary
|
|
17885
|
-
);
|
|
17886
|
-
}
|
|
17887
|
-
function hydrateArrowVector(vector) {
|
|
17888
|
-
return new Vector(vector.data.map((data) => hydrateArrowData(data)));
|
|
17889
|
-
}
|
|
17890
|
-
var init_arrow_table_transport = __esm({
|
|
17891
|
-
"../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
|
|
17892
|
-
"use strict";
|
|
17893
|
-
init_Arrow_dom();
|
|
17894
|
-
init_convert_arrow_schema();
|
|
17895
|
-
init_split_arrow_buffers();
|
|
17896
|
-
}
|
|
17897
|
-
});
|
|
17898
|
-
|
|
17899
|
-
// ../core/src/schema-utils/arrow-transport.ts
|
|
17900
|
-
var init_arrow_transport = __esm({
|
|
17901
|
-
"../core/src/schema-utils/arrow-transport.ts"() {
|
|
18518
|
+
var init_arrow_worker_transport = __esm({
|
|
18519
|
+
"../core/src/arrow-worker-transport.ts"() {
|
|
17902
18520
|
"use strict";
|
|
17903
|
-
|
|
17904
|
-
init_split_arrow_buffers();
|
|
18521
|
+
init_dist3();
|
|
17905
18522
|
}
|
|
17906
18523
|
});
|
|
17907
18524
|
|
|
@@ -17910,7 +18527,7 @@ return true;`);
|
|
|
17910
18527
|
var init_version2 = __esm({
|
|
17911
18528
|
"src/draco/lib/utils/version.ts"() {
|
|
17912
18529
|
"use strict";
|
|
17913
|
-
VERSION2 = true ? "5.0.0-beta.
|
|
18530
|
+
VERSION2 = true ? "5.0.0-beta.5" : "latest";
|
|
17914
18531
|
}
|
|
17915
18532
|
});
|
|
17916
18533
|
|
|
@@ -18090,7 +18707,7 @@ return true;`);
|
|
|
18090
18707
|
var init_draco_loader_types = __esm({
|
|
18091
18708
|
"src/draco/draco-loader-types.ts"() {
|
|
18092
18709
|
"use strict";
|
|
18093
|
-
|
|
18710
|
+
init_arrow_worker_transport();
|
|
18094
18711
|
init_version2();
|
|
18095
18712
|
init_draco_format();
|
|
18096
18713
|
init_draco_loader_options();
|