@loaders.gl/raster 5.0.0-beta.1 → 5.0.0-beta.4
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/README.md +6 -2
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/geotiff/advanced.cjs +16 -11
- package/dist/geotiff/advanced.cjs.map +2 -2
- package/dist/geotiff/geotiff-loader-types.d.ts +1 -1
- package/dist/geotiff/geotiff-loader-types.js +2 -2
- package/dist/geotiff/geotiff-loader-types.js.map +1 -1
- package/dist/geotiff/geotiff-raster-loader-types.d.ts.map +1 -1
- package/dist/geotiff/geotiff-raster-loader-types.js +2 -2
- package/dist/geotiff/geotiff-raster-loader-types.js.map +1 -1
- package/dist/geotiff/geotiff-source-loader-types.js +1 -1
- package/dist/geotiff/geotiff-source-loader-types.js.map +1 -1
- package/dist/geotiff/geotiff-source-loader.js +1 -1
- package/dist/geotiff/lib/ome/load-ome-tiff.d.ts +1 -0
- package/dist/geotiff/lib/ome/load-ome-tiff.d.ts.map +1 -1
- package/dist/geotiff/lib/ome/load-ome-tiff.js +7 -1
- package/dist/geotiff/lib/ome/load-ome-tiff.js.map +1 -1
- package/dist/geotiff/lib/ome/omexml.d.ts.map +1 -1
- package/dist/geotiff/lib/ome/omexml.js +5 -4
- package/dist/geotiff/lib/ome/omexml.js.map +1 -1
- package/dist/geotiff/lib/tiff/tiff-gdal-metadata.d.ts.map +1 -1
- package/dist/geotiff/lib/tiff/tiff-gdal-metadata.js +6 -5
- package/dist/geotiff/lib/tiff/tiff-gdal-metadata.js.map +1 -1
- package/dist/geotiff/loaders.js +1 -1
- package/dist/geotiff/ometiff-source-loader-types.js +1 -1
- package/dist/geotiff/ometiff-source-loader-types.js.map +1 -1
- package/dist/geotiff/ometiff-source-loader.js +1 -1
- package/dist/geotiff-loader-types.d.ts +2 -0
- package/dist/geotiff-loader-types.d.ts.map +1 -0
- package/dist/geotiff-loader-types.js +2 -0
- package/dist/geotiff-loader-types.js.map +1 -0
- package/dist/geotiff-loader.d.ts +2 -0
- package/dist/geotiff-loader.d.ts.map +1 -0
- package/dist/geotiff-loader.js +2 -0
- package/dist/geotiff-loader.js.map +1 -0
- package/dist/geotiff-raster-loader-types.d.ts +2 -0
- package/dist/geotiff-raster-loader-types.d.ts.map +1 -0
- package/dist/geotiff-raster-loader-types.js +2 -0
- package/dist/geotiff-raster-loader-types.js.map +1 -0
- package/dist/geotiff-raster-loader.d.ts +2 -0
- package/dist/geotiff-raster-loader.d.ts.map +1 -0
- package/dist/geotiff-raster-loader.js +2 -0
- package/dist/geotiff-raster-loader.js.map +1 -0
- package/dist/geotiff-source-loader-types.d.ts +2 -0
- package/dist/geotiff-source-loader-types.d.ts.map +1 -0
- package/dist/geotiff-source-loader-types.js +2 -0
- package/dist/geotiff-source-loader-types.js.map +1 -0
- package/dist/geotiff-source-loader.d.ts +2 -0
- package/dist/geotiff-source-loader.d.ts.map +1 -0
- package/dist/geotiff-source-loader.js +2 -0
- package/dist/geotiff-source-loader.js.map +1 -0
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +2 -2
- package/dist/lerc/lerc-loader-types.d.ts +1 -1
- package/dist/lerc/lerc-loader-types.js +2 -2
- package/dist/lerc/lerc-loader-types.js.map +1 -1
- package/dist/lerc-loader-types.d.ts +2 -0
- package/dist/lerc-loader-types.d.ts.map +1 -0
- package/dist/lerc-loader-types.js +2 -0
- package/dist/lerc-loader-types.js.map +1 -0
- package/dist/lerc-loader.d.ts +2 -0
- package/dist/lerc-loader.d.ts.map +1 -0
- package/dist/lerc-loader.js +2 -0
- package/dist/lerc-loader.js.map +1 -0
- package/dist/ometiff-source-loader-types.d.ts +2 -0
- package/dist/ometiff-source-loader-types.d.ts.map +1 -0
- package/dist/ometiff-source-loader-types.js +2 -0
- package/dist/ometiff-source-loader-types.js.map +1 -0
- package/dist/ometiff-source-loader.d.ts +2 -0
- package/dist/ometiff-source-loader.d.ts.map +1 -0
- package/dist/ometiff-source-loader.js +2 -0
- package/dist/ometiff-source-loader.js.map +1 -0
- package/dist/quantized-mesh-loader-types.d.ts +2 -0
- package/dist/quantized-mesh-loader-types.d.ts.map +1 -0
- package/dist/quantized-mesh-loader-types.js +2 -0
- package/dist/quantized-mesh-loader-types.js.map +1 -0
- package/dist/quantized-mesh-loader.d.ts +2 -0
- package/dist/quantized-mesh-loader.d.ts.map +1 -0
- package/dist/quantized-mesh-loader.js +2 -0
- package/dist/quantized-mesh-loader.js.map +1 -0
- package/dist/quantized-mesh-worker.js +600 -123
- package/dist/quantized-mesh-writer.d.ts +2 -0
- package/dist/quantized-mesh-writer.d.ts.map +1 -0
- package/dist/quantized-mesh-writer.js +2 -0
- package/dist/quantized-mesh-writer.js.map +1 -0
- package/dist/terrain/index.cjs +24 -523
- package/dist/terrain/index.cjs.map +4 -4
- package/dist/terrain/lib/parse-terrain.d.ts +2 -0
- package/dist/terrain/lib/parse-terrain.d.ts.map +1 -1
- package/dist/terrain/lib/parse-terrain.js +23 -38
- package/dist/terrain/lib/parse-terrain.js.map +1 -1
- package/dist/terrain/lib/utils/version.js +1 -1
- package/dist/terrain/quantized-mesh-loader-types.d.ts.map +1 -1
- package/dist/terrain/quantized-mesh-loader-types.js +1 -2
- package/dist/terrain/quantized-mesh-loader-types.js.map +1 -1
- package/dist/terrain/terrain-loader-types.d.ts +2 -2
- package/dist/terrain/terrain-loader-types.d.ts.map +1 -1
- package/dist/terrain/terrain-loader-types.js +1 -1
- package/dist/terrain/terrain-loader-types.js.map +1 -1
- package/dist/terrain/terrain-loader.js +3 -3
- package/dist/terrain/terrain-loader.js.map +1 -1
- package/dist/terrain-loader-types.d.ts +2 -0
- package/dist/terrain-loader-types.d.ts.map +1 -0
- package/dist/terrain-loader-types.js +2 -0
- package/dist/terrain-loader-types.js.map +1 -0
- package/dist/terrain-loader.d.ts +2 -0
- package/dist/terrain-loader.d.ts.map +1 -0
- package/dist/terrain-loader.js +2 -0
- package/dist/terrain-loader.js.map +1 -0
- package/dist/terrain-worker.js +4641 -3581
- package/package.json +80 -54
- package/src/geotiff/geotiff-loader-types.ts +1 -1
- package/src/geotiff/geotiff-raster-loader-types.ts +1 -3
- package/src/geotiff/geotiff-source-loader-types.ts +1 -1
- package/src/geotiff/lib/ome/load-ome-tiff.ts +7 -1
- package/src/geotiff/lib/ome/omexml.ts +5 -4
- package/src/geotiff/lib/tiff/tiff-gdal-metadata.ts +6 -5
- package/src/geotiff/ometiff-source-loader-types.ts +1 -1
- package/src/geotiff-loader-types.ts +1 -0
- package/src/geotiff-loader.ts +1 -0
- package/src/geotiff-raster-loader-types.ts +1 -0
- package/src/geotiff-raster-loader.ts +1 -0
- package/src/geotiff-source-loader-types.ts +1 -0
- package/src/geotiff-source-loader.ts +1 -0
- package/src/lerc/lerc-loader-types.ts +1 -1
- package/src/lerc-loader-types.ts +1 -0
- package/src/lerc-loader.ts +1 -0
- package/src/ometiff-source-loader-types.ts +1 -0
- package/src/ometiff-source-loader.ts +1 -0
- package/src/quantized-mesh-loader-types.ts +1 -0
- package/src/quantized-mesh-loader.ts +1 -0
- package/src/quantized-mesh-writer.ts +1 -0
- package/src/terrain/lib/parse-terrain.ts +36 -40
- package/src/terrain/quantized-mesh-loader-types.ts +1 -2
- package/src/terrain/terrain-loader-types.ts +3 -4
- package/src/terrain/terrain-loader.ts +3 -3
- package/src/terrain-loader-types.ts +1 -0
- package/src/terrain-loader.ts +1 -0
- package/dist/terrain/libs/README.md +0 -10
- package/dist/terrain/libs/martini-LICENSE +0 -15
- package/dist/terrain/libs/martini.d.mts +0 -19
- package/dist/terrain/libs/martini.mjs +0 -164
- package/src/terrain/libs/README.md +0 -10
- package/src/terrain/libs/martini-LICENSE +0 -15
- package/src/terrain/libs/martini.d.mts +0 -19
- package/src/terrain/libs/martini.mjs +0 -164
|
@@ -15,29 +15,44 @@
|
|
|
15
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js
|
|
19
19
|
var parentPort;
|
|
20
20
|
var init_worker_threads_browser = __esm({
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
parentPort = null;
|
|
21
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
22
|
+
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
|
|
27
|
-
//
|
|
26
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
28
27
|
function getTransferList(object, recursive = true, transfers) {
|
|
29
28
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30
|
+
function visit(value) {
|
|
31
|
+
if (!value || typeof value !== "object" || seen.has(value))
|
|
32
|
+
return;
|
|
33
|
+
seen.add(value);
|
|
34
|
+
if (isTransferable(value))
|
|
35
|
+
transfersSet.add(value);
|
|
36
|
+
else if (ArrayBuffer.isView(value)) {
|
|
37
|
+
if (isTransferable(value.buffer))
|
|
38
|
+
transfersSet.add(value.buffer);
|
|
39
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
|
|
40
|
+
visit(value.port1);
|
|
41
|
+
visit(value.port2);
|
|
42
|
+
} else if (recursive && value instanceof Map) {
|
|
43
|
+
for (const [key, item] of value) {
|
|
44
|
+
visit(key);
|
|
45
|
+
visit(item);
|
|
46
|
+
}
|
|
47
|
+
} else if (recursive && value instanceof Set) {
|
|
48
|
+
for (const item of value)
|
|
49
|
+
visit(item);
|
|
50
|
+
} else if (recursive) {
|
|
51
|
+
for (const key of Object.keys(value))
|
|
52
|
+
visit(value[key]);
|
|
39
53
|
}
|
|
40
54
|
}
|
|
55
|
+
visit(object);
|
|
41
56
|
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
42
57
|
}
|
|
43
58
|
function isTransferable(object) {
|
|
@@ -59,12 +74,11 @@
|
|
|
59
74
|
return false;
|
|
60
75
|
}
|
|
61
76
|
var init_get_transfer_list = __esm({
|
|
62
|
-
"
|
|
63
|
-
"use strict";
|
|
77
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
64
78
|
}
|
|
65
79
|
});
|
|
66
80
|
|
|
67
|
-
//
|
|
81
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
68
82
|
async function getParentPort() {
|
|
69
83
|
return parentPort;
|
|
70
84
|
}
|
|
@@ -77,31 +91,31 @@
|
|
|
77
91
|
}
|
|
78
92
|
var onMessageWrapperMap, WorkerBody;
|
|
79
93
|
var init_worker_body = __esm({
|
|
80
|
-
"
|
|
81
|
-
"use strict";
|
|
94
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js"() {
|
|
82
95
|
init_get_transfer_list();
|
|
83
96
|
init_worker_threads_browser();
|
|
84
97
|
onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
85
98
|
WorkerBody = class {
|
|
86
99
|
/** Check that we are actually in a worker thread */
|
|
87
100
|
static async inWorkerThread() {
|
|
88
|
-
|
|
101
|
+
const workerGlobalScope = globalThis.WorkerGlobalScope;
|
|
102
|
+
return typeof workerGlobalScope === "function" && globalThis instanceof workerGlobalScope || Boolean(await getParentPort());
|
|
89
103
|
}
|
|
90
104
|
/*
|
|
91
105
|
* (type: WorkerMessageType, payload: WorkerMessagePayload) => any
|
|
92
106
|
*/
|
|
93
107
|
static set onmessage(onMessage) {
|
|
94
108
|
async function handleMessage(message) {
|
|
95
|
-
const
|
|
96
|
-
const { type, payload } =
|
|
109
|
+
const parentPort3 = await getParentPort();
|
|
110
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
97
111
|
onMessage(type, payload);
|
|
98
112
|
}
|
|
99
|
-
getParentPort().then((
|
|
100
|
-
if (
|
|
101
|
-
|
|
113
|
+
getParentPort().then((parentPort3) => {
|
|
114
|
+
if (parentPort3) {
|
|
115
|
+
parentPort3.on("message", (message) => {
|
|
102
116
|
handleMessage(message);
|
|
103
117
|
});
|
|
104
|
-
|
|
118
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
105
119
|
} else {
|
|
106
120
|
globalThis.onmessage = handleMessage;
|
|
107
121
|
}
|
|
@@ -119,9 +133,9 @@
|
|
|
119
133
|
};
|
|
120
134
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
121
135
|
}
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
|
|
136
|
+
const parentPort3 = await getParentPort();
|
|
137
|
+
if (parentPort3) {
|
|
138
|
+
parentPort3.on("message", onMessageWrapper);
|
|
125
139
|
} else {
|
|
126
140
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
127
141
|
}
|
|
@@ -132,9 +146,9 @@
|
|
|
132
146
|
if (!onMessageWrapper) {
|
|
133
147
|
return;
|
|
134
148
|
}
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
149
|
+
const parentPort3 = await getParentPort();
|
|
150
|
+
if (parentPort3) {
|
|
151
|
+
parentPort3.off("message", onMessageWrapper);
|
|
138
152
|
} else {
|
|
139
153
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
140
154
|
}
|
|
@@ -144,12 +158,12 @@
|
|
|
144
158
|
* @param type
|
|
145
159
|
* @param payload
|
|
146
160
|
*/
|
|
147
|
-
static async postMessage(type, payload) {
|
|
161
|
+
static async postMessage(type, payload, copy = false) {
|
|
148
162
|
const data = { source: "loaders.gl", type, payload };
|
|
149
|
-
const transferList = getTransferList(payload);
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
|
|
163
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
164
|
+
const parentPort3 = await getParentPort();
|
|
165
|
+
if (parentPort3) {
|
|
166
|
+
parentPort3.postMessage(data, transferList);
|
|
153
167
|
} else {
|
|
154
168
|
globalThis.postMessage(data, transferList);
|
|
155
169
|
}
|
|
@@ -158,15 +172,11 @@
|
|
|
158
172
|
}
|
|
159
173
|
});
|
|
160
174
|
|
|
161
|
-
//
|
|
175
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js
|
|
162
176
|
var AsyncQueue;
|
|
163
177
|
var init_async_queue = __esm({
|
|
164
|
-
"
|
|
165
|
-
"use strict";
|
|
178
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js"() {
|
|
166
179
|
AsyncQueue = class {
|
|
167
|
-
_values;
|
|
168
|
-
_settlers;
|
|
169
|
-
_closed;
|
|
170
180
|
constructor() {
|
|
171
181
|
this._values = [];
|
|
172
182
|
this._settlers = [];
|
|
@@ -234,8 +244,63 @@
|
|
|
234
244
|
}
|
|
235
245
|
});
|
|
236
246
|
|
|
237
|
-
//
|
|
238
|
-
|
|
247
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js
|
|
248
|
+
var SharedWorkerState;
|
|
249
|
+
var init_shared_state = __esm({
|
|
250
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js"() {
|
|
251
|
+
SharedWorkerState = class {
|
|
252
|
+
constructor(buffer) {
|
|
253
|
+
if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
|
|
254
|
+
throw new Error("Expected a 16-byte shared worker control buffer");
|
|
255
|
+
this.buffer = buffer;
|
|
256
|
+
this.values = new Int32Array(buffer);
|
|
257
|
+
}
|
|
258
|
+
get snapshot() {
|
|
259
|
+
return {
|
|
260
|
+
cancelled: Atomics.load(this.values, 0) !== 0,
|
|
261
|
+
completed: Atomics.load(this.values, 1),
|
|
262
|
+
total: Atomics.load(this.values, 2),
|
|
263
|
+
revision: Atomics.load(this.values, 3)
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
cancel() {
|
|
267
|
+
Atomics.store(this.values, 0, 1);
|
|
268
|
+
Atomics.add(this.values, 3, 1);
|
|
269
|
+
Atomics.notify(this.values, 0);
|
|
270
|
+
}
|
|
271
|
+
throwIfCancelled() {
|
|
272
|
+
if (Atomics.load(this.values, 0) !== 0) {
|
|
273
|
+
const error = new Error("Shared worker task was cancelled");
|
|
274
|
+
error.name = "AbortError";
|
|
275
|
+
throw error;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/** Integer counters for application-defined work; messages still carry phase names and units. */
|
|
279
|
+
setProgress(completed, total = -1) {
|
|
280
|
+
if (!Number.isInteger(completed) || completed < 0 || completed > 2147483647 || !Number.isInteger(total) || total < -1 || total > 2147483647) {
|
|
281
|
+
throw new RangeError("Shared progress requires nonnegative int32 counts (or total -1)");
|
|
282
|
+
}
|
|
283
|
+
Atomics.store(this.values, 1, completed);
|
|
284
|
+
Atomics.store(this.values, 2, total);
|
|
285
|
+
Atomics.add(this.values, 3, 1);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js
|
|
292
|
+
function validateOutputOwnership(ownership) {
|
|
293
|
+
if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
|
|
294
|
+
throw new Error("Invalid worker output ownership");
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
var init_validate_output_ownership = __esm({
|
|
298
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
|
|
303
|
+
async function createWorker(process2, processInBatches, preload) {
|
|
239
304
|
if (!await WorkerBody.inWorkerThread()) {
|
|
240
305
|
return;
|
|
241
306
|
}
|
|
@@ -243,27 +308,59 @@
|
|
|
243
308
|
process: processOnMainThread
|
|
244
309
|
};
|
|
245
310
|
WorkerBody.onmessage = async (type, payload) => {
|
|
311
|
+
if (type === "cancel") {
|
|
312
|
+
activeController?.abort();
|
|
313
|
+
activeInputBatches?.close();
|
|
314
|
+
activeOutputAcknowledgements?.close();
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const controller = type === "process" || type === "process-in-batches" ? new AbortController() : void 0;
|
|
318
|
+
if (controller)
|
|
319
|
+
activeController = controller;
|
|
320
|
+
const startedAt = performance.now();
|
|
246
321
|
const reporter = type === "process" || type === "process-in-batches" ? createProgressReporter() : void 0;
|
|
247
|
-
|
|
322
|
+
let sharedState;
|
|
323
|
+
const throwIfAborted = () => {
|
|
324
|
+
controller?.signal.throwIfAborted();
|
|
325
|
+
sharedState?.throwIfCancelled();
|
|
326
|
+
};
|
|
327
|
+
const jobContext = {
|
|
328
|
+
...context,
|
|
329
|
+
signal: controller?.signal,
|
|
330
|
+
sharedState,
|
|
331
|
+
throwIfAborted,
|
|
332
|
+
reportProgress: (progress) => {
|
|
333
|
+
if (!controller?.signal.aborted && !sharedState?.snapshot.cancelled)
|
|
334
|
+
reporter?.report(progress);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
248
337
|
try {
|
|
338
|
+
if (controller && payload.options?.["sharedState"]) {
|
|
339
|
+
sharedState = new SharedWorkerState(payload.options["sharedState"]);
|
|
340
|
+
jobContext.sharedState = sharedState;
|
|
341
|
+
}
|
|
249
342
|
switch (type) {
|
|
250
343
|
case "preload":
|
|
344
|
+
await preload?.();
|
|
251
345
|
WorkerBody.postMessage("done", {});
|
|
252
346
|
break;
|
|
253
347
|
case "process":
|
|
254
|
-
|
|
348
|
+
throwIfAborted();
|
|
349
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
350
|
+
if (!process2) {
|
|
255
351
|
throw new Error("Worker does not support atomic processing");
|
|
256
352
|
}
|
|
257
|
-
const result = await
|
|
258
|
-
|
|
259
|
-
payload.options || {},
|
|
260
|
-
jobContext,
|
|
261
|
-
payload.context || {}
|
|
262
|
-
);
|
|
353
|
+
const result = await process2(payload.input, payload.options || {}, jobContext, payload.context || {});
|
|
354
|
+
throwIfAborted();
|
|
263
355
|
reporter?.finish();
|
|
264
|
-
WorkerBody.postMessage("done", {
|
|
356
|
+
await WorkerBody.postMessage("done", {
|
|
357
|
+
result,
|
|
358
|
+
executionMs: performance.now() - startedAt
|
|
359
|
+
}, payload.options?.["outputOwnership"] === "copy");
|
|
265
360
|
break;
|
|
266
361
|
case "process-in-batches":
|
|
362
|
+
throwIfAborted();
|
|
363
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
267
364
|
if (!processInBatches) {
|
|
268
365
|
throw new Error("Worker does not support batched processing");
|
|
269
366
|
}
|
|
@@ -272,18 +369,15 @@
|
|
|
272
369
|
activeInputBatches = inputBatches;
|
|
273
370
|
activeOutputAcknowledgements = outputAcknowledgements;
|
|
274
371
|
try {
|
|
275
|
-
const resultIterator = processInBatches(
|
|
276
|
-
createDemandDrivenIterator(inputBatches),
|
|
277
|
-
payload.options || {},
|
|
278
|
-
jobContext,
|
|
279
|
-
payload.context || {}
|
|
280
|
-
);
|
|
372
|
+
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
281
373
|
for await (const batch of resultIterator) {
|
|
282
|
-
|
|
374
|
+
throwIfAborted();
|
|
375
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
|
|
283
376
|
await outputAcknowledgements.next();
|
|
284
377
|
}
|
|
378
|
+
throwIfAborted();
|
|
285
379
|
reporter?.finish();
|
|
286
|
-
await WorkerBody.postMessage("done", {});
|
|
380
|
+
await WorkerBody.postMessage("done", { executionMs: performance.now() - startedAt });
|
|
287
381
|
} finally {
|
|
288
382
|
activeInputBatches = null;
|
|
289
383
|
activeOutputAcknowledgements = null;
|
|
@@ -310,11 +404,18 @@
|
|
|
310
404
|
default:
|
|
311
405
|
}
|
|
312
406
|
} catch (error) {
|
|
313
|
-
reporter?.finish();
|
|
407
|
+
reporter?.finish(controller?.signal.aborted || sharedState?.snapshot.cancelled);
|
|
314
408
|
const message = error instanceof Error ? error.message : "";
|
|
315
|
-
WorkerBody.postMessage("error", {
|
|
409
|
+
await WorkerBody.postMessage("error", {
|
|
410
|
+
error: message,
|
|
411
|
+
errorName: error instanceof Error ? error.name : "Error"
|
|
412
|
+
});
|
|
413
|
+
} finally {
|
|
414
|
+
if (controller && activeController === controller)
|
|
415
|
+
activeController = null;
|
|
316
416
|
}
|
|
317
417
|
};
|
|
418
|
+
await WorkerBody.postMessage("ready", {});
|
|
318
419
|
}
|
|
319
420
|
async function* createDemandDrivenIterator(inputBatches) {
|
|
320
421
|
while (true) {
|
|
@@ -327,81 +428,449 @@
|
|
|
327
428
|
}
|
|
328
429
|
}
|
|
329
430
|
function processOnMainThread(arrayBuffer, options = {}, jobContext = {}) {
|
|
431
|
+
const signal = activeController?.signal;
|
|
432
|
+
signal?.throwIfAborted();
|
|
330
433
|
return new Promise((resolve, reject) => {
|
|
331
434
|
const id = requestId++;
|
|
332
|
-
const
|
|
333
|
-
|
|
435
|
+
const cleanup = () => {
|
|
436
|
+
signal?.removeEventListener("abort", abort);
|
|
437
|
+
void WorkerBody.removeEventListener(onMessage);
|
|
438
|
+
};
|
|
439
|
+
const abort = () => {
|
|
440
|
+
cleanup();
|
|
441
|
+
reject(signal?.reason);
|
|
442
|
+
};
|
|
443
|
+
const onMessage = (type, payload) => {
|
|
444
|
+
if (payload.id !== id)
|
|
334
445
|
return;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
case "error":
|
|
342
|
-
WorkerBody.removeEventListener(onMessage);
|
|
343
|
-
reject(payload2.error);
|
|
344
|
-
break;
|
|
345
|
-
default:
|
|
446
|
+
if (type === "done") {
|
|
447
|
+
cleanup();
|
|
448
|
+
resolve(payload.result);
|
|
449
|
+
} else if (type === "error") {
|
|
450
|
+
cleanup();
|
|
451
|
+
reject(payload.error);
|
|
346
452
|
}
|
|
347
453
|
};
|
|
348
|
-
WorkerBody.addEventListener(onMessage)
|
|
349
|
-
|
|
350
|
-
|
|
454
|
+
void WorkerBody.addEventListener(onMessage).then(async () => {
|
|
455
|
+
if (signal?.aborted) {
|
|
456
|
+
abort();
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
460
|
+
await WorkerBody.postMessage("process", {
|
|
461
|
+
id,
|
|
462
|
+
input: arrayBuffer,
|
|
463
|
+
options,
|
|
464
|
+
context: jobContext
|
|
465
|
+
});
|
|
466
|
+
}).catch((error) => {
|
|
467
|
+
cleanup();
|
|
468
|
+
reject(error);
|
|
469
|
+
});
|
|
351
470
|
});
|
|
352
471
|
}
|
|
353
472
|
function createProgressReporter() {
|
|
354
|
-
let
|
|
473
|
+
let pending2;
|
|
355
474
|
let finished = false;
|
|
356
475
|
let scheduled = false;
|
|
357
476
|
const flush = () => {
|
|
358
477
|
scheduled = false;
|
|
359
|
-
if (
|
|
360
|
-
WorkerBody.postMessage("progress", { progress:
|
|
361
|
-
|
|
478
|
+
if (pending2) {
|
|
479
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
480
|
+
pending2 = void 0;
|
|
362
481
|
}
|
|
363
482
|
};
|
|
364
483
|
return {
|
|
365
484
|
/** Records progress while retaining phase transitions. */
|
|
366
485
|
report(progress) {
|
|
367
|
-
if (finished)
|
|
368
|
-
|
|
369
|
-
|
|
486
|
+
if (finished)
|
|
487
|
+
return;
|
|
488
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
489
|
+
flush();
|
|
490
|
+
pending2 = { ...progress };
|
|
370
491
|
if (!scheduled) {
|
|
371
492
|
scheduled = true;
|
|
372
493
|
setTimeout(flush, 0);
|
|
373
494
|
}
|
|
374
495
|
},
|
|
375
496
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
376
|
-
finish() {
|
|
497
|
+
finish(discard = false) {
|
|
498
|
+
if (discard)
|
|
499
|
+
pending2 = void 0;
|
|
377
500
|
flush();
|
|
378
501
|
finished = true;
|
|
379
502
|
}
|
|
380
503
|
};
|
|
381
504
|
}
|
|
382
|
-
var requestId, activeInputBatches, activeOutputAcknowledgements;
|
|
505
|
+
var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
|
|
383
506
|
var init_create_worker = __esm({
|
|
384
|
-
"
|
|
385
|
-
|
|
507
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js"() {
|
|
508
|
+
init_shared_state();
|
|
386
509
|
init_async_queue();
|
|
387
510
|
init_worker_body();
|
|
511
|
+
init_validate_output_ownership();
|
|
388
512
|
requestId = 0;
|
|
513
|
+
activeController = null;
|
|
389
514
|
activeInputBatches = null;
|
|
390
515
|
activeOutputAcknowledgements = null;
|
|
391
516
|
}
|
|
392
517
|
});
|
|
393
518
|
|
|
394
|
-
//
|
|
519
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/index.js
|
|
520
|
+
var import_meta, path, moduleUrl;
|
|
395
521
|
var init_worker_utils = __esm({
|
|
522
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
524
|
+
init_create_worker();
|
|
525
|
+
import_meta = {};
|
|
526
|
+
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
527
|
+
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
// ../../node_modules/@math.gl/core/dist/tasks/task-preload.js
|
|
532
|
+
function preloadTaskCode(task, signal) {
|
|
533
|
+
if (!task.preload)
|
|
534
|
+
return Promise.resolve();
|
|
535
|
+
let promise = pending.get(task);
|
|
536
|
+
if (!promise) {
|
|
537
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
538
|
+
loaded.add(task);
|
|
539
|
+
});
|
|
540
|
+
pending.set(task, promise);
|
|
541
|
+
void promise.catch(() => pending.delete(task));
|
|
542
|
+
}
|
|
543
|
+
return withSignal(promise, signal);
|
|
544
|
+
}
|
|
545
|
+
function withSignal(operation, signal) {
|
|
546
|
+
if (!signal)
|
|
547
|
+
return operation;
|
|
548
|
+
return new Promise((resolve, reject) => {
|
|
549
|
+
const abort = () => {
|
|
550
|
+
signal.removeEventListener("abort", abort);
|
|
551
|
+
reject(signal.reason);
|
|
552
|
+
};
|
|
553
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
554
|
+
if (signal.aborted)
|
|
555
|
+
abort();
|
|
556
|
+
operation.then((value) => {
|
|
557
|
+
signal.removeEventListener("abort", abort);
|
|
558
|
+
resolve(value);
|
|
559
|
+
}, (error) => {
|
|
560
|
+
signal.removeEventListener("abort", abort);
|
|
561
|
+
reject(error);
|
|
562
|
+
});
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
var pending, loaded;
|
|
566
|
+
var init_task_preload = __esm({
|
|
567
|
+
"../../node_modules/@math.gl/core/dist/tasks/task-preload.js"() {
|
|
568
|
+
pending = /* @__PURE__ */ new WeakMap();
|
|
569
|
+
loaded = /* @__PURE__ */ new WeakSet();
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
// ../../node_modules/@math.gl/core/dist/tasks/task-runtime.js
|
|
574
|
+
function assertPayload(value) {
|
|
575
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
576
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function taskContext(state, context = {}) {
|
|
580
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
581
|
+
return {
|
|
582
|
+
state,
|
|
583
|
+
signal,
|
|
584
|
+
throwIfAborted: () => {
|
|
585
|
+
signal.throwIfAborted();
|
|
586
|
+
context.throwIfAborted?.();
|
|
587
|
+
},
|
|
588
|
+
reportProgress: (progress) => context.reportProgress?.({
|
|
589
|
+
...progress,
|
|
590
|
+
phase: progress.phase ?? "process",
|
|
591
|
+
unit: progress.unit ?? "items"
|
|
592
|
+
})
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
async function initializeTaskWorker(task) {
|
|
596
|
+
if (!await WorkerBody.inWorkerThread())
|
|
597
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
598
|
+
if (installed)
|
|
599
|
+
throw new Error("A task is already installed in this worker");
|
|
600
|
+
installed = true;
|
|
601
|
+
const runtime = new TaskRuntime(task);
|
|
602
|
+
let streamOptions = {};
|
|
603
|
+
return createWorker(async (request, _options, context) => {
|
|
604
|
+
switch (request.operation) {
|
|
605
|
+
case "initialize":
|
|
606
|
+
return runtime.initialize(request.input, context);
|
|
607
|
+
case "destroy":
|
|
608
|
+
return runtime.destroy();
|
|
609
|
+
case "stream-options":
|
|
610
|
+
streamOptions = request.options;
|
|
611
|
+
return {};
|
|
612
|
+
case "process":
|
|
613
|
+
return runtime.process(request.input, request.options, context);
|
|
614
|
+
default:
|
|
615
|
+
throw new Error("Unknown task operation");
|
|
616
|
+
}
|
|
617
|
+
}, async function* (inputs, _options, context) {
|
|
618
|
+
async function* batches() {
|
|
619
|
+
for await (const input of inputs) {
|
|
620
|
+
assertPayload(input);
|
|
621
|
+
yield input;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
try {
|
|
625
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
626
|
+
} finally {
|
|
627
|
+
streamOptions = {};
|
|
628
|
+
}
|
|
629
|
+
}, () => preloadTaskCode(task));
|
|
630
|
+
}
|
|
631
|
+
var TaskRuntime, installed;
|
|
632
|
+
var init_task_runtime = __esm({
|
|
633
|
+
"../../node_modules/@math.gl/core/dist/tasks/task-runtime.js"() {
|
|
634
|
+
init_worker_utils();
|
|
635
|
+
init_task_preload();
|
|
636
|
+
TaskRuntime = class {
|
|
637
|
+
constructor(task) {
|
|
638
|
+
this.task = task;
|
|
639
|
+
this.initialized = false;
|
|
640
|
+
}
|
|
641
|
+
async initialize(input, context = {}) {
|
|
642
|
+
if (this.initialized)
|
|
643
|
+
throw new Error("Task is already initialized");
|
|
644
|
+
assertPayload(input);
|
|
645
|
+
await preloadTaskCode(this.task, context.signal);
|
|
646
|
+
context.signal?.throwIfAborted();
|
|
647
|
+
this.state = await this.task.initialize?.(input, taskContext(void 0, context));
|
|
648
|
+
this.initialized = true;
|
|
649
|
+
return {};
|
|
650
|
+
}
|
|
651
|
+
async destroy() {
|
|
652
|
+
if (this.initialized) {
|
|
653
|
+
this.initialized = false;
|
|
654
|
+
const state = this.state;
|
|
655
|
+
this.state = void 0;
|
|
656
|
+
if (this.task.initialize)
|
|
657
|
+
await this.task.destroy?.(state);
|
|
658
|
+
}
|
|
659
|
+
return {};
|
|
660
|
+
}
|
|
661
|
+
async process(input, options, context = {}) {
|
|
662
|
+
if (!this.initialized)
|
|
663
|
+
throw new Error("Task is not initialized");
|
|
664
|
+
if (!this.task.process)
|
|
665
|
+
throw new Error("Task has no atomic processor");
|
|
666
|
+
assertPayload(input);
|
|
667
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
668
|
+
assertPayload(result);
|
|
669
|
+
return result;
|
|
670
|
+
}
|
|
671
|
+
async *stream(inputs, options, context = {}) {
|
|
672
|
+
if (!this.initialized)
|
|
673
|
+
throw new Error("Task is not initialized");
|
|
674
|
+
if (!this.task.processInBatches)
|
|
675
|
+
throw new Error("Task has no streaming processor");
|
|
676
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
677
|
+
assertPayload(output);
|
|
678
|
+
yield output;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
installed = false;
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
// ../../node_modules/@math.gl/core/dist/tasks/index.js
|
|
687
|
+
var init_tasks = __esm({
|
|
688
|
+
"../../node_modules/@math.gl/core/dist/tasks/index.js"() {
|
|
689
|
+
init_task_runtime();
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
694
|
+
var worker_threads_browser_exports = {};
|
|
695
|
+
__export(worker_threads_browser_exports, {
|
|
696
|
+
NodeWorker: () => NodeWorker,
|
|
697
|
+
parentPort: () => parentPort2
|
|
698
|
+
});
|
|
699
|
+
var NodeWorker, parentPort2;
|
|
700
|
+
var init_worker_threads_browser2 = __esm({
|
|
701
|
+
"../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
|
|
702
|
+
"use strict";
|
|
703
|
+
NodeWorker = class {
|
|
704
|
+
/** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
|
|
705
|
+
constructor(...arguments_) {
|
|
706
|
+
const runtimeProcess = globalThis.process;
|
|
707
|
+
const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
|
|
708
|
+
if (WorkerConstructor) {
|
|
709
|
+
return new WorkerConstructor(...arguments_);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
/** No-op browser fallback matching the native Worker API. */
|
|
713
|
+
terminate() {
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
parentPort2 = null;
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
721
|
+
function normalizeTaskProgress(progress) {
|
|
722
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
723
|
+
}
|
|
724
|
+
async function isWorkerThread() {
|
|
725
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
726
|
+
return true;
|
|
727
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
728
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
|
|
729
|
+
return !isMainThread;
|
|
730
|
+
}
|
|
731
|
+
return false;
|
|
732
|
+
}
|
|
733
|
+
var initializeTaskWorker2;
|
|
734
|
+
var init_task_runtime2 = __esm({
|
|
735
|
+
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
736
|
+
"use strict";
|
|
737
|
+
init_tasks();
|
|
738
|
+
initializeTaskWorker2 = initializeTaskWorker;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
743
|
+
function getTransferList2(object, recursive = true, transfers) {
|
|
744
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
745
|
+
if (!object) {
|
|
746
|
+
} else if (isTransferable2(object)) {
|
|
747
|
+
transfersSet.add(object);
|
|
748
|
+
} else if (isTransferable2(object.buffer)) {
|
|
749
|
+
transfersSet.add(object.buffer);
|
|
750
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
751
|
+
} else if (recursive && typeof object === "object") {
|
|
752
|
+
for (const key in object) {
|
|
753
|
+
getTransferList2(object[key], recursive, transfersSet);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
757
|
+
}
|
|
758
|
+
function isTransferable2(object) {
|
|
759
|
+
if (!object) {
|
|
760
|
+
return false;
|
|
761
|
+
}
|
|
762
|
+
if (object instanceof ArrayBuffer) {
|
|
763
|
+
return true;
|
|
764
|
+
}
|
|
765
|
+
if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
|
|
766
|
+
return true;
|
|
767
|
+
}
|
|
768
|
+
if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
|
|
769
|
+
return true;
|
|
770
|
+
}
|
|
771
|
+
if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
|
|
772
|
+
return true;
|
|
773
|
+
}
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
var init_get_transfer_list2 = __esm({
|
|
777
|
+
"../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
|
|
778
|
+
"use strict";
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
783
|
+
async function createWorker2(process2, processInBatches) {
|
|
784
|
+
if (!await isWorkerThread()) return;
|
|
785
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
786
|
+
}
|
|
787
|
+
function createWorkerTask(process2, processInBatches) {
|
|
788
|
+
return {
|
|
789
|
+
id: "loaders.gl",
|
|
790
|
+
initialize: (state) => state,
|
|
791
|
+
destroy: (state) => state.port?.close(),
|
|
792
|
+
process: async ({ value }, options, context) => {
|
|
793
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
794
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
795
|
+
},
|
|
796
|
+
...processInBatches ? {
|
|
797
|
+
processInBatches: async function* (inputs, options, context) {
|
|
798
|
+
async function* values() {
|
|
799
|
+
for await (const input of inputs) yield input.value;
|
|
800
|
+
}
|
|
801
|
+
for await (const value of processInBatches(
|
|
802
|
+
values(),
|
|
803
|
+
options,
|
|
804
|
+
createContext(context),
|
|
805
|
+
context.state.context
|
|
806
|
+
)) {
|
|
807
|
+
yield { value };
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
} : {}
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
function createContext(context) {
|
|
814
|
+
let requestIdentifier = 0;
|
|
815
|
+
const port = context.state.port;
|
|
816
|
+
return {
|
|
817
|
+
signal: context.signal,
|
|
818
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
819
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
820
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
821
|
+
context.throwIfAborted();
|
|
822
|
+
const identifier = ++requestIdentifier;
|
|
823
|
+
return new Promise((resolve, reject) => {
|
|
824
|
+
const onMessage = (event) => {
|
|
825
|
+
if (event.data.identifier !== identifier) return;
|
|
826
|
+
cleanup();
|
|
827
|
+
if (event.data.error) {
|
|
828
|
+
const error = new Error(event.data.error.message);
|
|
829
|
+
error.name = event.data.error.name;
|
|
830
|
+
reject(error);
|
|
831
|
+
} else resolve(event.data.value);
|
|
832
|
+
};
|
|
833
|
+
const onAbort = () => {
|
|
834
|
+
cleanup();
|
|
835
|
+
reject(context.signal.reason);
|
|
836
|
+
};
|
|
837
|
+
const cleanup = () => {
|
|
838
|
+
port.removeEventListener("message", onMessage);
|
|
839
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
840
|
+
};
|
|
841
|
+
port.addEventListener("message", onMessage);
|
|
842
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
843
|
+
port.start();
|
|
844
|
+
try {
|
|
845
|
+
const request = { identifier, input, options, context: jobContext };
|
|
846
|
+
port.postMessage(request, getTransferList2(request));
|
|
847
|
+
} catch (error) {
|
|
848
|
+
cleanup();
|
|
849
|
+
reject(error);
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
} : void 0
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
var init_create_worker2 = __esm({
|
|
856
|
+
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
857
|
+
"use strict";
|
|
858
|
+
init_task_runtime2();
|
|
859
|
+
init_get_transfer_list2();
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
// ../core/src/worker-utils/index.ts
|
|
864
|
+
var init_worker_utils2 = __esm({
|
|
396
865
|
"../core/src/worker-utils/index.ts"() {
|
|
397
866
|
"use strict";
|
|
398
|
-
|
|
867
|
+
init_create_worker2();
|
|
399
868
|
}
|
|
400
869
|
});
|
|
401
870
|
|
|
402
871
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
403
872
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
404
|
-
await
|
|
873
|
+
await createWorker2(
|
|
405
874
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
406
875
|
selectLoader(options || {}),
|
|
407
876
|
input,
|
|
@@ -539,7 +1008,7 @@
|
|
|
539
1008
|
var init_create_loader_worker = __esm({
|
|
540
1009
|
"../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts"() {
|
|
541
1010
|
"use strict";
|
|
542
|
-
|
|
1011
|
+
init_worker_utils2();
|
|
543
1012
|
}
|
|
544
1013
|
});
|
|
545
1014
|
|
|
@@ -8354,11 +8823,11 @@ return true;`);
|
|
|
8354
8823
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8355
8824
|
}
|
|
8356
8825
|
setValue(index, value) {
|
|
8357
|
-
const
|
|
8358
|
-
const current =
|
|
8826
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
8827
|
+
const current = pending2.get(index);
|
|
8359
8828
|
current && (this._pendingLength -= current.length);
|
|
8360
8829
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8361
|
-
|
|
8830
|
+
pending2.set(index, value);
|
|
8362
8831
|
}
|
|
8363
8832
|
setValid(index, isValid) {
|
|
8364
8833
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8381,12 +8850,12 @@ return true;`);
|
|
|
8381
8850
|
return super.finish();
|
|
8382
8851
|
}
|
|
8383
8852
|
_flush() {
|
|
8384
|
-
const
|
|
8853
|
+
const pending2 = this._pending;
|
|
8385
8854
|
const pendingLength = this._pendingLength;
|
|
8386
8855
|
this._pendingLength = 0;
|
|
8387
8856
|
this._pending = void 0;
|
|
8388
|
-
if (
|
|
8389
|
-
this._flushPending(
|
|
8857
|
+
if (pending2 && pending2.size > 0) {
|
|
8858
|
+
this._flushPending(pending2, pendingLength);
|
|
8390
8859
|
}
|
|
8391
8860
|
return this;
|
|
8392
8861
|
}
|
|
@@ -10972,11 +11441,11 @@ return true;`);
|
|
|
10972
11441
|
setValue(index, value) {
|
|
10973
11442
|
return super.setValue(index, toUint8Array(value));
|
|
10974
11443
|
}
|
|
10975
|
-
_flushPending(
|
|
11444
|
+
_flushPending(pending2, pendingLength) {
|
|
10976
11445
|
const offsets = this._offsets;
|
|
10977
11446
|
const data = this._values.reserve(pendingLength).buffer;
|
|
10978
11447
|
let offset = 0;
|
|
10979
|
-
for (const [index, value] of
|
|
11448
|
+
for (const [index, value] of pending2) {
|
|
10980
11449
|
if (value === void 0) {
|
|
10981
11450
|
offsets.set(index, 0);
|
|
10982
11451
|
} else {
|
|
@@ -11013,11 +11482,11 @@ return true;`);
|
|
|
11013
11482
|
setValue(index, value) {
|
|
11014
11483
|
return super.setValue(index, toUint8Array(value));
|
|
11015
11484
|
}
|
|
11016
|
-
_flushPending(
|
|
11485
|
+
_flushPending(pending2, pendingLength) {
|
|
11017
11486
|
const offsets = this._offsets;
|
|
11018
11487
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11019
11488
|
let offset = 0;
|
|
11020
|
-
for (const [index, value] of
|
|
11489
|
+
for (const [index, value] of pending2) {
|
|
11021
11490
|
if (value === void 0) {
|
|
11022
11491
|
offsets.set(index, BigInt(0));
|
|
11023
11492
|
} else {
|
|
@@ -11328,10 +11797,10 @@ return true;`);
|
|
|
11328
11797
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11329
11798
|
return this.numChildren - 1;
|
|
11330
11799
|
}
|
|
11331
|
-
_flushPending(
|
|
11800
|
+
_flushPending(pending2) {
|
|
11332
11801
|
const offsets = this._offsets;
|
|
11333
11802
|
const [child] = this.children;
|
|
11334
|
-
for (const [index, value] of
|
|
11803
|
+
for (const [index, value] of pending2) {
|
|
11335
11804
|
if (typeof value === "undefined") {
|
|
11336
11805
|
offsets.set(index, 0);
|
|
11337
11806
|
} else {
|
|
@@ -11370,10 +11839,10 @@ return true;`);
|
|
|
11370
11839
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11371
11840
|
return this.numChildren - 1;
|
|
11372
11841
|
}
|
|
11373
|
-
_flushPending(
|
|
11842
|
+
_flushPending(pending2) {
|
|
11374
11843
|
const offsets = this._offsets;
|
|
11375
11844
|
const [child] = this.children;
|
|
11376
|
-
for (const [index, value] of
|
|
11845
|
+
for (const [index, value] of pending2) {
|
|
11377
11846
|
if (typeof value === "undefined") {
|
|
11378
11847
|
offsets.set(index, BigInt(0));
|
|
11379
11848
|
} else {
|
|
@@ -11403,11 +11872,11 @@ return true;`);
|
|
|
11403
11872
|
}
|
|
11404
11873
|
setValue(index, value) {
|
|
11405
11874
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11406
|
-
const
|
|
11407
|
-
const current =
|
|
11875
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
11876
|
+
const current = pending2.get(index);
|
|
11408
11877
|
current && (this._pendingLength -= current.size);
|
|
11409
11878
|
this._pendingLength += row.size;
|
|
11410
|
-
|
|
11879
|
+
pending2.set(index, row);
|
|
11411
11880
|
}
|
|
11412
11881
|
addChild(child, name = `${this.numChildren}`) {
|
|
11413
11882
|
if (this.numChildren > 0) {
|
|
@@ -11417,10 +11886,10 @@ return true;`);
|
|
|
11417
11886
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11418
11887
|
return this.numChildren - 1;
|
|
11419
11888
|
}
|
|
11420
|
-
_flushPending(
|
|
11889
|
+
_flushPending(pending2) {
|
|
11421
11890
|
const offsets = this._offsets;
|
|
11422
11891
|
const [child] = this.children;
|
|
11423
|
-
for (const [index, value] of
|
|
11892
|
+
for (const [index, value] of pending2) {
|
|
11424
11893
|
if (value === void 0) {
|
|
11425
11894
|
offsets.set(index, 0);
|
|
11426
11895
|
} else {
|
|
@@ -11629,7 +12098,7 @@ return true;`);
|
|
|
11629
12098
|
return super.setValue(index, encodeUtf8(value));
|
|
11630
12099
|
}
|
|
11631
12100
|
// @ts-ignore
|
|
11632
|
-
_flushPending(
|
|
12101
|
+
_flushPending(pending2, pendingLength) {
|
|
11633
12102
|
}
|
|
11634
12103
|
};
|
|
11635
12104
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -11660,7 +12129,7 @@ return true;`);
|
|
|
11660
12129
|
return super.setValue(index, encodeUtf8(value));
|
|
11661
12130
|
}
|
|
11662
12131
|
// @ts-ignore
|
|
11663
|
-
_flushPending(
|
|
12132
|
+
_flushPending(pending2, pendingLength) {
|
|
11664
12133
|
}
|
|
11665
12134
|
};
|
|
11666
12135
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -17333,7 +17802,7 @@ return true;`);
|
|
|
17333
17802
|
var init_version = __esm({
|
|
17334
17803
|
"src/terrain/lib/utils/version.ts"() {
|
|
17335
17804
|
"use strict";
|
|
17336
|
-
VERSION = true ? "5.0.0-beta.
|
|
17805
|
+
VERSION = true ? "5.0.0-beta.4" : "latest";
|
|
17337
17806
|
}
|
|
17338
17807
|
});
|
|
17339
17808
|
|
|
@@ -17355,6 +17824,18 @@ return true;`);
|
|
|
17355
17824
|
}
|
|
17356
17825
|
});
|
|
17357
17826
|
|
|
17827
|
+
// src/quantized-mesh-loader.ts
|
|
17828
|
+
var quantized_mesh_loader_exports = {};
|
|
17829
|
+
__export(quantized_mesh_loader_exports, {
|
|
17830
|
+
QuantizedMeshLoaderWithParser: () => QuantizedMeshLoaderWithParser
|
|
17831
|
+
});
|
|
17832
|
+
var init_quantized_mesh_loader = __esm({
|
|
17833
|
+
"src/quantized-mesh-loader.ts"() {
|
|
17834
|
+
"use strict";
|
|
17835
|
+
init_quantized_mesh_loader2();
|
|
17836
|
+
}
|
|
17837
|
+
});
|
|
17838
|
+
|
|
17358
17839
|
// src/terrain/quantized-mesh-loader-types.ts
|
|
17359
17840
|
var QuantizedMeshLoader;
|
|
17360
17841
|
var init_quantized_mesh_loader_types = __esm({
|
|
@@ -17382,10 +17863,6 @@ return true;`);
|
|
|
17382
17863
|
});
|
|
17383
17864
|
|
|
17384
17865
|
// src/terrain/quantized-mesh-loader.ts
|
|
17385
|
-
var quantized_mesh_loader_exports = {};
|
|
17386
|
-
__export(quantized_mesh_loader_exports, {
|
|
17387
|
-
QuantizedMeshLoaderWithParser: () => QuantizedMeshLoaderWithParser
|
|
17388
|
-
});
|
|
17389
17866
|
function parseQuantizedMeshInRequestedShape(arrayBuffer, options) {
|
|
17390
17867
|
const mesh = parseQuantizedMesh(arrayBuffer, options?.["quantized-mesh"]);
|
|
17391
17868
|
const table = convertMeshToTable(mesh, "arrow-table");
|
|
@@ -17399,7 +17876,7 @@ return true;`);
|
|
|
17399
17876
|
};
|
|
17400
17877
|
}
|
|
17401
17878
|
var _QuantizedMeshLoaderPreload, QuantizedMeshLoaderMetadataWithoutPreload, QuantizedMeshLoaderWithParser;
|
|
17402
|
-
var
|
|
17879
|
+
var init_quantized_mesh_loader2 = __esm({
|
|
17403
17880
|
"src/terrain/quantized-mesh-loader.ts"() {
|
|
17404
17881
|
"use strict";
|
|
17405
17882
|
init_arrow_transport();
|
|
@@ -17419,6 +17896,6 @@ return true;`);
|
|
|
17419
17896
|
|
|
17420
17897
|
// src/terrain/workers/quantized-mesh-worker.ts
|
|
17421
17898
|
init_loader_utils();
|
|
17422
|
-
|
|
17899
|
+
init_quantized_mesh_loader2();
|
|
17423
17900
|
createLoaderWorker(QuantizedMeshLoaderWithParser);
|
|
17424
17901
|
})();
|