@loaders.gl/pointclouds 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/LAS-README.md +1 -1
- package/PCD-README.md +1 -1
- package/PLY-README.md +1 -1
- package/README.md +1 -1
- package/dist/dist.dev.js +135 -91
- package/dist/dist.min.js +20 -20
- package/dist/las/las-loader-shared.cjs +1 -1
- package/dist/las/las-loader-shared.js +1 -1
- package/dist/las/las-loader-types.d.ts +2 -2
- package/dist/las/las-loader.cjs +4 -4
- package/dist/las/las-loader.cjs.map +2 -2
- package/dist/las/las-loader.d.ts +1 -1
- package/dist/las/las-loader.d.ts.map +1 -1
- package/dist/las/las-loader.js +1 -1
- package/dist/las/las-loader.js.map +1 -1
- package/dist/las/las-writer.cjs +1 -1
- package/dist/las/las-writer.js +1 -1
- package/dist/las/lib/las-extra-bytes.cjs +6 -1
- package/dist/las/lib/las-extra-bytes.cjs.map +2 -2
- package/dist/las/lib/las-extra-bytes.d.ts.map +1 -1
- package/dist/las/lib/las-extra-bytes.js +6 -4
- package/dist/las/lib/las-extra-bytes.js.map +1 -1
- package/dist/las-loader.cjs +4 -4
- package/dist/las-loader.cjs.map +2 -2
- package/dist/las-worker.js +704 -160
- package/dist/las-writer.cjs +1 -1
- package/dist/pcd/pcd-loader-types.cjs +3 -3
- package/dist/pcd/pcd-loader-types.cjs.map +2 -2
- package/dist/pcd/pcd-loader-types.d.ts +1 -1
- package/dist/pcd/pcd-loader-types.d.ts.map +1 -1
- package/dist/pcd/pcd-loader-types.js +2 -2
- package/dist/pcd/pcd-loader-types.js.map +1 -1
- package/dist/pcd/pcd-loader.cjs +4 -4
- package/dist/pcd/pcd-loader.cjs.map +2 -2
- package/dist/pcd/pcd-loader.d.ts +1 -1
- package/dist/pcd/pcd-loader.d.ts.map +1 -1
- package/dist/pcd/pcd-loader.js +1 -1
- package/dist/pcd/pcd-loader.js.map +1 -1
- package/dist/pcd/pcd-writer.cjs +1 -1
- package/dist/pcd/pcd-writer.js +1 -1
- package/dist/pcd-loader-types.cjs +3 -3
- package/dist/pcd-loader-types.cjs.map +2 -2
- package/dist/pcd-loader.cjs +4 -4
- package/dist/pcd-loader.cjs.map +2 -2
- package/dist/pcd-worker.js +984 -367
- package/dist/pcd-writer.cjs +1 -1
- package/dist/ply/ply-loader-types.cjs +3 -3
- package/dist/ply/ply-loader-types.cjs.map +2 -2
- package/dist/ply/ply-loader-types.d.ts +1 -1
- package/dist/ply/ply-loader-types.d.ts.map +1 -1
- package/dist/ply/ply-loader-types.js +2 -2
- package/dist/ply/ply-loader-types.js.map +1 -1
- package/dist/ply/ply-loader.cjs +4 -4
- package/dist/ply/ply-loader.cjs.map +2 -2
- package/dist/ply/ply-loader.d.ts +1 -1
- package/dist/ply/ply-loader.d.ts.map +1 -1
- package/dist/ply/ply-loader.js +1 -1
- package/dist/ply/ply-loader.js.map +1 -1
- package/dist/ply/ply-writer.cjs +1 -1
- package/dist/ply/ply-writer.js +1 -1
- package/dist/ply-loader-types.cjs +3 -3
- package/dist/ply-loader-types.cjs.map +2 -2
- package/dist/ply-loader.cjs +4 -4
- package/dist/ply-loader.cjs.map +2 -2
- package/dist/ply-worker.js +779 -162
- package/dist/ply-writer.cjs +1 -1
- package/package.json +4 -3
- package/src/las/las-loader.ts +1 -1
- package/src/las/lib/las-extra-bytes.ts +6 -4
- package/src/pcd/pcd-loader-types.ts +1 -1
- package/src/pcd/pcd-loader.ts +1 -1
- package/src/ply/ply-loader-types.ts +1 -1
- package/src/ply/ply-loader.ts +1 -1
package/dist/pcd-worker.js
CHANGED
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
// ../../node_modules/@math.gl/
|
|
18
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js
|
|
19
19
|
var parentPort;
|
|
20
20
|
var init_worker_threads_browser = __esm({
|
|
21
|
-
"../../node_modules/@math.gl/
|
|
22
|
-
parentPort = null;
|
|
21
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
22
|
+
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
// ../../node_modules/@math.gl/
|
|
26
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
27
27
|
function getTransferList(object, recursive = true, transfers) {
|
|
28
28
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
29
29
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
else if (ArrayBuffer.isView(value)) {
|
|
37
37
|
if (isTransferable(value.buffer))
|
|
38
38
|
transfersSet.add(value.buffer);
|
|
39
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
|
|
40
|
+
visit(value.port1);
|
|
41
|
+
visit(value.port2);
|
|
39
42
|
} else if (recursive && value instanceof Map) {
|
|
40
43
|
for (const [key, item] of value) {
|
|
41
44
|
visit(key);
|
|
@@ -71,11 +74,11 @@
|
|
|
71
74
|
return false;
|
|
72
75
|
}
|
|
73
76
|
var init_get_transfer_list = __esm({
|
|
74
|
-
"../../node_modules/@math.gl/
|
|
77
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
75
78
|
}
|
|
76
79
|
});
|
|
77
80
|
|
|
78
|
-
// ../../node_modules/@math.gl/
|
|
81
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
79
82
|
async function getParentPort() {
|
|
80
83
|
return parentPort;
|
|
81
84
|
}
|
|
@@ -88,7 +91,7 @@
|
|
|
88
91
|
}
|
|
89
92
|
var onMessageWrapperMap, WorkerBody;
|
|
90
93
|
var init_worker_body = __esm({
|
|
91
|
-
"../../node_modules/@math.gl/
|
|
94
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
|
|
92
95
|
init_get_transfer_list();
|
|
93
96
|
init_worker_threads_browser();
|
|
94
97
|
onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
@@ -103,16 +106,16 @@
|
|
|
103
106
|
*/
|
|
104
107
|
static set onmessage(onMessage) {
|
|
105
108
|
async function handleMessage(message) {
|
|
106
|
-
const
|
|
107
|
-
const { type, payload } =
|
|
109
|
+
const parentPort3 = await getParentPort();
|
|
110
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
108
111
|
onMessage(type, payload);
|
|
109
112
|
}
|
|
110
|
-
getParentPort().then((
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
+
getParentPort().then((parentPort3) => {
|
|
114
|
+
if (parentPort3) {
|
|
115
|
+
parentPort3.on("message", (message) => {
|
|
113
116
|
handleMessage(message);
|
|
114
117
|
});
|
|
115
|
-
|
|
118
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
116
119
|
} else {
|
|
117
120
|
globalThis.onmessage = handleMessage;
|
|
118
121
|
}
|
|
@@ -130,9 +133,9 @@
|
|
|
130
133
|
};
|
|
131
134
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
132
135
|
}
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
+
const parentPort3 = await getParentPort();
|
|
137
|
+
if (parentPort3) {
|
|
138
|
+
parentPort3.on("message", onMessageWrapper);
|
|
136
139
|
} else {
|
|
137
140
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
138
141
|
}
|
|
@@ -143,9 +146,9 @@
|
|
|
143
146
|
if (!onMessageWrapper) {
|
|
144
147
|
return;
|
|
145
148
|
}
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
+
const parentPort3 = await getParentPort();
|
|
150
|
+
if (parentPort3) {
|
|
151
|
+
parentPort3.off("message", onMessageWrapper);
|
|
149
152
|
} else {
|
|
150
153
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
151
154
|
}
|
|
@@ -155,12 +158,12 @@
|
|
|
155
158
|
* @param type
|
|
156
159
|
* @param payload
|
|
157
160
|
*/
|
|
158
|
-
static async postMessage(type, payload) {
|
|
161
|
+
static async postMessage(type, payload, copy = false) {
|
|
159
162
|
const data = { source: "loaders.gl", type, payload };
|
|
160
|
-
const transferList = getTransferList(payload);
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
|
|
163
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
164
|
+
const parentPort3 = await getParentPort();
|
|
165
|
+
if (parentPort3) {
|
|
166
|
+
parentPort3.postMessage(data, transferList);
|
|
164
167
|
} else {
|
|
165
168
|
globalThis.postMessage(data, transferList);
|
|
166
169
|
}
|
|
@@ -169,10 +172,10 @@
|
|
|
169
172
|
}
|
|
170
173
|
});
|
|
171
174
|
|
|
172
|
-
// ../../node_modules/@math.gl/
|
|
175
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
|
|
173
176
|
var AsyncQueue;
|
|
174
177
|
var init_async_queue = __esm({
|
|
175
|
-
"../../node_modules/@math.gl/
|
|
178
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
|
|
176
179
|
AsyncQueue = class {
|
|
177
180
|
constructor() {
|
|
178
181
|
this._values = [];
|
|
@@ -241,10 +244,10 @@
|
|
|
241
244
|
}
|
|
242
245
|
});
|
|
243
246
|
|
|
244
|
-
// ../../node_modules/@math.gl/
|
|
247
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
|
|
245
248
|
var SharedWorkerState;
|
|
246
249
|
var init_shared_state = __esm({
|
|
247
|
-
"../../node_modules/@math.gl/
|
|
250
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
|
|
248
251
|
SharedWorkerState = class {
|
|
249
252
|
constructor(buffer) {
|
|
250
253
|
if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
|
|
@@ -285,8 +288,19 @@
|
|
|
285
288
|
}
|
|
286
289
|
});
|
|
287
290
|
|
|
288
|
-
// ../../node_modules/@math.gl/
|
|
289
|
-
|
|
291
|
+
// ../../node_modules/@math.gl/tasks/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/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
|
|
303
|
+
async function createWorker(process2, processInBatches, preload2) {
|
|
290
304
|
if (!await WorkerBody.inWorkerThread()) {
|
|
291
305
|
return;
|
|
292
306
|
}
|
|
@@ -327,23 +341,26 @@
|
|
|
327
341
|
}
|
|
328
342
|
switch (type) {
|
|
329
343
|
case "preload":
|
|
344
|
+
await preload2?.();
|
|
330
345
|
WorkerBody.postMessage("done", {});
|
|
331
346
|
break;
|
|
332
347
|
case "process":
|
|
333
348
|
throwIfAborted();
|
|
334
|
-
|
|
349
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
350
|
+
if (!process2) {
|
|
335
351
|
throw new Error("Worker does not support atomic processing");
|
|
336
352
|
}
|
|
337
|
-
const result = await
|
|
353
|
+
const result = await process2(payload.input, payload.options || {}, jobContext, payload.context || {});
|
|
338
354
|
throwIfAborted();
|
|
339
355
|
reporter?.finish();
|
|
340
356
|
await WorkerBody.postMessage("done", {
|
|
341
357
|
result,
|
|
342
358
|
executionMs: performance.now() - startedAt
|
|
343
|
-
});
|
|
359
|
+
}, payload.options?.["outputOwnership"] === "copy");
|
|
344
360
|
break;
|
|
345
361
|
case "process-in-batches":
|
|
346
362
|
throwIfAborted();
|
|
363
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
347
364
|
if (!processInBatches) {
|
|
348
365
|
throw new Error("Worker does not support batched processing");
|
|
349
366
|
}
|
|
@@ -355,7 +372,7 @@
|
|
|
355
372
|
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
356
373
|
for await (const batch of resultIterator) {
|
|
357
374
|
throwIfAborted();
|
|
358
|
-
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
375
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
|
|
359
376
|
await outputAcknowledgements.next();
|
|
360
377
|
}
|
|
361
378
|
throwIfAborted();
|
|
@@ -453,14 +470,14 @@
|
|
|
453
470
|
});
|
|
454
471
|
}
|
|
455
472
|
function createProgressReporter() {
|
|
456
|
-
let
|
|
473
|
+
let pending2;
|
|
457
474
|
let finished = false;
|
|
458
475
|
let scheduled = false;
|
|
459
476
|
const flush = () => {
|
|
460
477
|
scheduled = false;
|
|
461
|
-
if (
|
|
462
|
-
WorkerBody.postMessage("progress", { progress:
|
|
463
|
-
|
|
478
|
+
if (pending2) {
|
|
479
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
480
|
+
pending2 = void 0;
|
|
464
481
|
}
|
|
465
482
|
};
|
|
466
483
|
return {
|
|
@@ -468,9 +485,9 @@
|
|
|
468
485
|
report(progress) {
|
|
469
486
|
if (finished)
|
|
470
487
|
return;
|
|
471
|
-
if (
|
|
488
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
472
489
|
flush();
|
|
473
|
-
|
|
490
|
+
pending2 = { ...progress };
|
|
474
491
|
if (!scheduled) {
|
|
475
492
|
scheduled = true;
|
|
476
493
|
setTimeout(flush, 0);
|
|
@@ -479,7 +496,7 @@
|
|
|
479
496
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
480
497
|
finish(discard = false) {
|
|
481
498
|
if (discard)
|
|
482
|
-
|
|
499
|
+
pending2 = void 0;
|
|
483
500
|
flush();
|
|
484
501
|
finished = true;
|
|
485
502
|
}
|
|
@@ -487,10 +504,11 @@
|
|
|
487
504
|
}
|
|
488
505
|
var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
|
|
489
506
|
var init_create_worker = __esm({
|
|
490
|
-
"../../node_modules/@math.gl/
|
|
507
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
|
|
491
508
|
init_shared_state();
|
|
492
509
|
init_async_queue();
|
|
493
510
|
init_worker_body();
|
|
511
|
+
init_validate_output_ownership();
|
|
494
512
|
requestId = 0;
|
|
495
513
|
activeController = null;
|
|
496
514
|
activeInputBatches = null;
|
|
@@ -498,29 +516,589 @@
|
|
|
498
516
|
}
|
|
499
517
|
});
|
|
500
518
|
|
|
501
|
-
// ../../node_modules/@math.gl/
|
|
519
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
|
|
502
520
|
var import_meta, path, moduleUrl;
|
|
503
521
|
var init_worker_utils = __esm({
|
|
504
|
-
"../../node_modules/@math.gl/
|
|
522
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
505
524
|
init_create_worker();
|
|
525
|
+
init_get_transfer_list();
|
|
506
526
|
import_meta = {};
|
|
507
527
|
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
508
528
|
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
509
529
|
}
|
|
510
530
|
});
|
|
511
531
|
|
|
512
|
-
// ../../node_modules/@math.gl/
|
|
513
|
-
|
|
514
|
-
|
|
532
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
|
|
533
|
+
function preloadTaskCode(task, signal) {
|
|
534
|
+
if (!task.preload)
|
|
535
|
+
return Promise.resolve();
|
|
536
|
+
let promise = pending.get(task);
|
|
537
|
+
if (!promise) {
|
|
538
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
539
|
+
loaded.add(task);
|
|
540
|
+
});
|
|
541
|
+
pending.set(task, promise);
|
|
542
|
+
void promise.catch(() => pending.delete(task));
|
|
543
|
+
}
|
|
544
|
+
return withSignal(promise, signal);
|
|
545
|
+
}
|
|
546
|
+
function withSignal(operation, signal) {
|
|
547
|
+
if (!signal)
|
|
548
|
+
return operation;
|
|
549
|
+
return new Promise((resolve, reject) => {
|
|
550
|
+
const abort = () => {
|
|
551
|
+
signal.removeEventListener("abort", abort);
|
|
552
|
+
reject(signal.reason);
|
|
553
|
+
};
|
|
554
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
555
|
+
if (signal.aborted)
|
|
556
|
+
abort();
|
|
557
|
+
operation.then((value) => {
|
|
558
|
+
signal.removeEventListener("abort", abort);
|
|
559
|
+
resolve(value);
|
|
560
|
+
}, (error) => {
|
|
561
|
+
signal.removeEventListener("abort", abort);
|
|
562
|
+
reject(error);
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
var pending, loaded;
|
|
567
|
+
var init_task_preload = __esm({
|
|
568
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
|
|
569
|
+
pending = /* @__PURE__ */ new WeakMap();
|
|
570
|
+
loaded = /* @__PURE__ */ new WeakSet();
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
|
|
575
|
+
var TaskRequestError, TaskChannel;
|
|
576
|
+
var init_task_channel = __esm({
|
|
577
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js"() {
|
|
578
|
+
TaskRequestError = class extends Error {
|
|
579
|
+
};
|
|
580
|
+
TaskChannel = class {
|
|
581
|
+
constructor(options) {
|
|
582
|
+
this.options = options;
|
|
583
|
+
this.nextId = 1;
|
|
584
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
585
|
+
this.incoming = /* @__PURE__ */ new Map();
|
|
586
|
+
}
|
|
587
|
+
/** Send a request without serializing other in-flight requests. */
|
|
588
|
+
request(operation, value, signal, transfer = []) {
|
|
589
|
+
if (this.failure)
|
|
590
|
+
return Promise.reject(this.failure.reason);
|
|
591
|
+
if (signal?.aborted)
|
|
592
|
+
return Promise.reject(signal.reason);
|
|
593
|
+
const id = this.nextId++;
|
|
594
|
+
return new Promise((resolve, reject) => {
|
|
595
|
+
const abort = () => {
|
|
596
|
+
const pending2 = this.pending.get(id);
|
|
597
|
+
if (!pending2)
|
|
598
|
+
return;
|
|
599
|
+
this.pending.delete(id);
|
|
600
|
+
pending2.cleanup();
|
|
601
|
+
reject(signal?.reason);
|
|
602
|
+
this.send({ source: "math.gl/tasks", kind: "cancel", id });
|
|
603
|
+
};
|
|
604
|
+
this.pending.set(id, {
|
|
605
|
+
resolve,
|
|
606
|
+
reject,
|
|
607
|
+
cleanup: () => signal?.removeEventListener("abort", abort)
|
|
608
|
+
});
|
|
609
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
610
|
+
this.send({ source: "math.gl/tasks", kind: "request", id, operation, value }, transfer);
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
/** Send a one-way notification. */
|
|
614
|
+
emit(operation, value, transfer = []) {
|
|
615
|
+
if (this.failure)
|
|
616
|
+
throw this.failure.reason;
|
|
617
|
+
this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation, value }, transfer);
|
|
618
|
+
}
|
|
619
|
+
/** Dispatch a transport message; unrelated protocols are ignored. */
|
|
620
|
+
receive(message) {
|
|
621
|
+
if (this.failure || message?.source !== "math.gl/tasks")
|
|
622
|
+
return;
|
|
623
|
+
if (message.kind === "failure") {
|
|
624
|
+
const reason = new Error(message.error?.message ?? "Task channel failed");
|
|
625
|
+
this.close(reason);
|
|
626
|
+
this.options.onFailure?.(reason);
|
|
627
|
+
} else if (message.kind === "result" || message.kind === "error") {
|
|
628
|
+
const pending2 = this.pending.get(message.id);
|
|
629
|
+
if (!pending2)
|
|
630
|
+
return;
|
|
631
|
+
this.pending.delete(message.id);
|
|
632
|
+
pending2.cleanup();
|
|
633
|
+
if (message.kind === "result")
|
|
634
|
+
pending2.resolve(message.value);
|
|
635
|
+
else {
|
|
636
|
+
const error = new TaskRequestError(message.error?.message ?? "Task request failed");
|
|
637
|
+
error.name = message.error?.name ?? "Error";
|
|
638
|
+
pending2.reject(error);
|
|
639
|
+
}
|
|
640
|
+
} else if (message.kind === "cancel") {
|
|
641
|
+
this.incoming.get(message.id)?.abort(new DOMException("Task request cancelled", "AbortError"));
|
|
642
|
+
} else if (message.kind === "event") {
|
|
643
|
+
try {
|
|
644
|
+
this.options.handleEvent?.(message.operation, message.value);
|
|
645
|
+
} catch (error) {
|
|
646
|
+
this.fail(error);
|
|
647
|
+
}
|
|
648
|
+
} else if (message.kind === "request") {
|
|
649
|
+
if (this.incoming.has(message.id)) {
|
|
650
|
+
this.fail(new Error("Duplicate task request identifier"));
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
const controller = new AbortController();
|
|
654
|
+
this.incoming.set(message.id, controller);
|
|
655
|
+
void Promise.resolve().then(() => {
|
|
656
|
+
controller.signal.throwIfAborted();
|
|
657
|
+
return this.options.handleRequest(message.operation, message.value, controller.signal);
|
|
658
|
+
}).then((value) => {
|
|
659
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
660
|
+
this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value }, this.options.getResultTransferList?.(value, message.value));
|
|
661
|
+
}
|
|
662
|
+
}).catch((reason) => {
|
|
663
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
664
|
+
this.send({
|
|
665
|
+
source: "math.gl/tasks",
|
|
666
|
+
kind: "error",
|
|
667
|
+
id: message.id,
|
|
668
|
+
error: {
|
|
669
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
670
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}).finally(() => this.incoming.delete(message.id));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
/** Reject all outstanding calls with a common cause and abort incoming callbacks. */
|
|
678
|
+
close(reason = new Error("Task channel closed")) {
|
|
679
|
+
if (this.failure)
|
|
680
|
+
return;
|
|
681
|
+
this.failure = { reason };
|
|
682
|
+
for (const pending2 of this.pending.values()) {
|
|
683
|
+
pending2.cleanup();
|
|
684
|
+
pending2.reject(reason);
|
|
685
|
+
}
|
|
686
|
+
this.pending.clear();
|
|
687
|
+
for (const controller of this.incoming.values())
|
|
688
|
+
controller.abort(reason);
|
|
689
|
+
this.incoming.clear();
|
|
690
|
+
}
|
|
691
|
+
send(message, transfer = []) {
|
|
692
|
+
if (this.failure)
|
|
693
|
+
return;
|
|
694
|
+
try {
|
|
695
|
+
this.options.send(message, transfer);
|
|
696
|
+
} catch (error) {
|
|
697
|
+
this.fail(error);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
/** Invalidate the channel and notify the peer when the transport still works. */
|
|
701
|
+
fail(reason) {
|
|
702
|
+
if (this.failure)
|
|
703
|
+
return;
|
|
704
|
+
this.close(reason);
|
|
705
|
+
try {
|
|
706
|
+
this.options.send({
|
|
707
|
+
source: "math.gl/tasks",
|
|
708
|
+
kind: "failure",
|
|
709
|
+
id: 0,
|
|
710
|
+
error: {
|
|
711
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
712
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
713
|
+
}
|
|
714
|
+
}, []);
|
|
715
|
+
} catch {
|
|
716
|
+
}
|
|
717
|
+
this.options.onFailure?.(reason);
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
|
|
724
|
+
function assertPayload(value) {
|
|
725
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
726
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
function clonePayload(value, ownership = "copy") {
|
|
730
|
+
assertPayload(value);
|
|
731
|
+
if (!["copy", "transfer", "share"].includes(ownership))
|
|
732
|
+
throw new TypeError("Invalid input ownership");
|
|
733
|
+
const transfer = getTransferList(value);
|
|
734
|
+
if (ownership === "share" && transfer.length)
|
|
735
|
+
throw new TypeError("Share requires shared storage");
|
|
736
|
+
return structuredClone(value, {
|
|
737
|
+
transfer: ownership === "transfer" ? transfer : []
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
function taskContext(state, context = {}) {
|
|
741
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
742
|
+
return {
|
|
743
|
+
state,
|
|
744
|
+
signal,
|
|
745
|
+
requestHost: async (operation, payload, controls) => {
|
|
746
|
+
signal.throwIfAborted();
|
|
747
|
+
if (!context.requestHost)
|
|
748
|
+
throw new Error("No host request handler configured");
|
|
749
|
+
return context.requestHost(operation, payload, controls);
|
|
750
|
+
},
|
|
751
|
+
emitHost: (operation, payload) => {
|
|
752
|
+
signal.throwIfAborted();
|
|
753
|
+
context.emitHost?.(operation, payload);
|
|
754
|
+
},
|
|
755
|
+
throwIfAborted: () => {
|
|
756
|
+
signal.throwIfAborted();
|
|
757
|
+
context.throwIfAborted?.();
|
|
758
|
+
},
|
|
759
|
+
reportProgress: (progress) => context.reportProgress?.({
|
|
760
|
+
...progress,
|
|
761
|
+
phase: progress.phase ?? "process",
|
|
762
|
+
unit: progress.unit ?? "items"
|
|
763
|
+
})
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
async function initializeTaskWorker(task) {
|
|
767
|
+
if (!await WorkerBody.inWorkerThread())
|
|
768
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
769
|
+
if (installed)
|
|
770
|
+
throw new Error("A task is already installed in this worker");
|
|
771
|
+
installed = true;
|
|
772
|
+
const runtime = new TaskRuntime(task);
|
|
773
|
+
let channelStream;
|
|
774
|
+
const channel = new TaskChannel({
|
|
775
|
+
getResultTransferList: (value, request) => request.outputOwnership === "transfer" ? getTransferList(value) : [],
|
|
776
|
+
send: (message, transfer) => {
|
|
777
|
+
const snapshot = structuredClone(message, { transfer });
|
|
778
|
+
void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
|
|
779
|
+
},
|
|
780
|
+
handleRequest: async (operation, value, signal) => {
|
|
781
|
+
const request = value;
|
|
782
|
+
const context = {
|
|
783
|
+
signal,
|
|
784
|
+
reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
|
|
785
|
+
requestHost: (operation2, payload, controls = {}) => {
|
|
786
|
+
const request2 = {
|
|
787
|
+
operation: operation2,
|
|
788
|
+
payload: clonePayload(payload, controls.inputOwnership),
|
|
789
|
+
outputOwnership: controls.outputOwnership ?? "copy"
|
|
790
|
+
};
|
|
791
|
+
return channel.request("task:host-request", request2, signal, getTransferList(request2));
|
|
792
|
+
},
|
|
793
|
+
emitHost: (operation2, payload) => channel.emit("task:host-event", { operation: operation2, payload, id: request.progressId })
|
|
794
|
+
};
|
|
795
|
+
switch (operation) {
|
|
796
|
+
case "initialize":
|
|
797
|
+
return runtime.initialize(request.input, context);
|
|
798
|
+
case "process":
|
|
799
|
+
return runtime.process(request.input, request.options, context);
|
|
800
|
+
case "stream-open": {
|
|
801
|
+
if (channelStream)
|
|
802
|
+
throw new Error("A task stream is already open");
|
|
803
|
+
async function* inputs() {
|
|
804
|
+
while (true) {
|
|
805
|
+
const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
|
|
806
|
+
if (result.done)
|
|
807
|
+
return;
|
|
808
|
+
yield result.value;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
|
|
812
|
+
return {};
|
|
813
|
+
}
|
|
814
|
+
case "stream-next":
|
|
815
|
+
if (!channelStream)
|
|
816
|
+
throw new Error("No active task stream");
|
|
817
|
+
return channelStream.next();
|
|
818
|
+
case "stream-close":
|
|
819
|
+
try {
|
|
820
|
+
await channelStream?.return?.();
|
|
821
|
+
} finally {
|
|
822
|
+
channelStream = void 0;
|
|
823
|
+
}
|
|
824
|
+
return {};
|
|
825
|
+
case "destroy":
|
|
826
|
+
return runtime.destroy();
|
|
827
|
+
default:
|
|
828
|
+
throw new Error("Unknown task channel operation");
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
await WorkerBody.addEventListener((type, payload) => {
|
|
833
|
+
if (type === "task-channel")
|
|
834
|
+
channel.receive(payload);
|
|
835
|
+
});
|
|
836
|
+
let streamOptions = {};
|
|
837
|
+
return createWorker(async (request, _options, context) => {
|
|
838
|
+
switch (request.operation) {
|
|
839
|
+
case "initialize":
|
|
840
|
+
return runtime.initialize(request.input, context);
|
|
841
|
+
case "destroy":
|
|
842
|
+
return runtime.destroy();
|
|
843
|
+
case "stream-options":
|
|
844
|
+
streamOptions = request.options;
|
|
845
|
+
return {};
|
|
846
|
+
case "process":
|
|
847
|
+
return runtime.process(request.input, request.options, context);
|
|
848
|
+
default:
|
|
849
|
+
throw new Error("Unknown task operation");
|
|
850
|
+
}
|
|
851
|
+
}, async function* (inputs, _options, context) {
|
|
852
|
+
async function* batches() {
|
|
853
|
+
for await (const input of inputs) {
|
|
854
|
+
assertPayload(input);
|
|
855
|
+
yield input;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
try {
|
|
859
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
860
|
+
} finally {
|
|
861
|
+
streamOptions = {};
|
|
862
|
+
}
|
|
863
|
+
}, () => preloadTaskCode(task));
|
|
864
|
+
}
|
|
865
|
+
var TaskRuntime, installed;
|
|
866
|
+
var init_task_runtime = __esm({
|
|
867
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
|
|
515
868
|
init_worker_utils();
|
|
869
|
+
init_task_preload();
|
|
870
|
+
init_task_channel();
|
|
871
|
+
TaskRuntime = class {
|
|
872
|
+
constructor(task) {
|
|
873
|
+
this.task = task;
|
|
874
|
+
this.initialized = false;
|
|
875
|
+
}
|
|
876
|
+
async initialize(input, context = {}) {
|
|
877
|
+
if (this.initialized)
|
|
878
|
+
throw new Error("Task is already initialized");
|
|
879
|
+
assertPayload(input);
|
|
880
|
+
await preloadTaskCode(this.task, context.signal);
|
|
881
|
+
context.signal?.throwIfAborted();
|
|
882
|
+
this.state = await this.task.initialize?.(input, taskContext(void 0, context));
|
|
883
|
+
this.initialized = true;
|
|
884
|
+
return {};
|
|
885
|
+
}
|
|
886
|
+
async destroy() {
|
|
887
|
+
if (this.initialized) {
|
|
888
|
+
this.initialized = false;
|
|
889
|
+
const state = this.state;
|
|
890
|
+
this.state = void 0;
|
|
891
|
+
if (this.task.initialize)
|
|
892
|
+
await this.task.destroy?.(state);
|
|
893
|
+
}
|
|
894
|
+
return {};
|
|
895
|
+
}
|
|
896
|
+
async process(input, options, context = {}) {
|
|
897
|
+
if (!this.initialized)
|
|
898
|
+
throw new Error("Task is not initialized");
|
|
899
|
+
if (!this.task.process)
|
|
900
|
+
throw new Error("Task has no atomic processor");
|
|
901
|
+
assertPayload(input);
|
|
902
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
903
|
+
assertPayload(result);
|
|
904
|
+
return result;
|
|
905
|
+
}
|
|
906
|
+
async *stream(inputs, options, context = {}) {
|
|
907
|
+
if (!this.initialized)
|
|
908
|
+
throw new Error("Task is not initialized");
|
|
909
|
+
if (!this.task.processInBatches)
|
|
910
|
+
throw new Error("Task has no streaming processor");
|
|
911
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
912
|
+
assertPayload(output);
|
|
913
|
+
yield output;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
installed = false;
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/index.js
|
|
922
|
+
var init_tasks = __esm({
|
|
923
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
|
|
924
|
+
init_task_runtime();
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
// ../../node_modules/@math.gl/tasks/dist/index.js
|
|
929
|
+
var init_dist = __esm({
|
|
930
|
+
"../../node_modules/@math.gl/tasks/dist/index.js"() {
|
|
931
|
+
init_tasks();
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
936
|
+
var worker_threads_browser_exports = {};
|
|
937
|
+
__export(worker_threads_browser_exports, {
|
|
938
|
+
NodeWorker: () => NodeWorker,
|
|
939
|
+
parentPort: () => parentPort2
|
|
940
|
+
});
|
|
941
|
+
var NodeWorker, parentPort2;
|
|
942
|
+
var init_worker_threads_browser2 = __esm({
|
|
943
|
+
"../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
|
|
944
|
+
"use strict";
|
|
945
|
+
NodeWorker = class {
|
|
946
|
+
/** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
|
|
947
|
+
constructor(...arguments_) {
|
|
948
|
+
const runtimeProcess = globalThis.process;
|
|
949
|
+
const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
|
|
950
|
+
if (WorkerConstructor) {
|
|
951
|
+
return new WorkerConstructor(...arguments_);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
/** No-op browser fallback matching the native Worker API. */
|
|
955
|
+
terminate() {
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
parentPort2 = null;
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
|
|
962
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
963
|
+
function normalizeTaskProgress(progress) {
|
|
964
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
965
|
+
}
|
|
966
|
+
async function isWorkerThread() {
|
|
967
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
968
|
+
return true;
|
|
969
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
970
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
|
|
971
|
+
return !isMainThread;
|
|
972
|
+
}
|
|
973
|
+
return false;
|
|
974
|
+
}
|
|
975
|
+
var initializeTaskWorker2;
|
|
976
|
+
var init_task_runtime2 = __esm({
|
|
977
|
+
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
978
|
+
"use strict";
|
|
979
|
+
init_dist();
|
|
980
|
+
initializeTaskWorker2 = initializeTaskWorker;
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
985
|
+
function getTransferList2(object, recursive = true, transfers) {
|
|
986
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
987
|
+
if (!object) {
|
|
988
|
+
} else if (isTransferable2(object)) {
|
|
989
|
+
transfersSet.add(object);
|
|
990
|
+
} else if (isTransferable2(object.buffer)) {
|
|
991
|
+
transfersSet.add(object.buffer);
|
|
992
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
993
|
+
} else if (recursive && typeof object === "object") {
|
|
994
|
+
for (const key in object) {
|
|
995
|
+
getTransferList2(object[key], recursive, transfersSet);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
999
|
+
}
|
|
1000
|
+
function isTransferable2(object) {
|
|
1001
|
+
if (!object) {
|
|
1002
|
+
return false;
|
|
1003
|
+
}
|
|
1004
|
+
if (object instanceof ArrayBuffer) {
|
|
1005
|
+
return true;
|
|
1006
|
+
}
|
|
1007
|
+
if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
|
|
1008
|
+
return true;
|
|
1009
|
+
}
|
|
1010
|
+
if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
|
|
1011
|
+
return true;
|
|
1012
|
+
}
|
|
1013
|
+
if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
|
1016
|
+
return false;
|
|
1017
|
+
}
|
|
1018
|
+
var init_get_transfer_list2 = __esm({
|
|
1019
|
+
"../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
|
|
1020
|
+
"use strict";
|
|
516
1021
|
}
|
|
517
1022
|
});
|
|
518
1023
|
|
|
519
1024
|
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
1025
|
+
async function createWorker2(process2, processInBatches) {
|
|
1026
|
+
if (!await isWorkerThread()) return;
|
|
1027
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
1028
|
+
}
|
|
1029
|
+
function createWorkerTask(process2, processInBatches) {
|
|
1030
|
+
return {
|
|
1031
|
+
id: "loaders.gl",
|
|
1032
|
+
initialize: (state) => state,
|
|
1033
|
+
destroy: (state) => state.port?.close(),
|
|
1034
|
+
process: async ({ value }, options, context) => {
|
|
1035
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
1036
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
1037
|
+
},
|
|
1038
|
+
...processInBatches ? {
|
|
1039
|
+
processInBatches: async function* (inputs, options, context) {
|
|
1040
|
+
async function* values() {
|
|
1041
|
+
for await (const input of inputs) yield input.value;
|
|
1042
|
+
}
|
|
1043
|
+
for await (const value of processInBatches(
|
|
1044
|
+
values(),
|
|
1045
|
+
options,
|
|
1046
|
+
createContext(context),
|
|
1047
|
+
context.state.context
|
|
1048
|
+
)) {
|
|
1049
|
+
yield { value };
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
} : {}
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
function createContext(context) {
|
|
1056
|
+
let requestIdentifier = 0;
|
|
1057
|
+
const port = context.state.port;
|
|
1058
|
+
return {
|
|
1059
|
+
signal: context.signal,
|
|
1060
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
1061
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
1062
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
1063
|
+
context.throwIfAborted();
|
|
1064
|
+
const identifier = ++requestIdentifier;
|
|
1065
|
+
return new Promise((resolve, reject) => {
|
|
1066
|
+
const onMessage = (event) => {
|
|
1067
|
+
if (event.data.identifier !== identifier) return;
|
|
1068
|
+
cleanup();
|
|
1069
|
+
if (event.data.error) {
|
|
1070
|
+
const error = new Error(event.data.error.message);
|
|
1071
|
+
error.name = event.data.error.name;
|
|
1072
|
+
reject(error);
|
|
1073
|
+
} else resolve(event.data.value);
|
|
1074
|
+
};
|
|
1075
|
+
const onAbort = () => {
|
|
1076
|
+
cleanup();
|
|
1077
|
+
reject(context.signal.reason);
|
|
1078
|
+
};
|
|
1079
|
+
const cleanup = () => {
|
|
1080
|
+
port.removeEventListener("message", onMessage);
|
|
1081
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
1082
|
+
};
|
|
1083
|
+
port.addEventListener("message", onMessage);
|
|
1084
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
1085
|
+
port.start();
|
|
1086
|
+
try {
|
|
1087
|
+
const request = { identifier, input, options, context: jobContext };
|
|
1088
|
+
port.postMessage(request, getTransferList2(request));
|
|
1089
|
+
} catch (error) {
|
|
1090
|
+
cleanup();
|
|
1091
|
+
reject(error);
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
} : void 0
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
520
1097
|
var init_create_worker2 = __esm({
|
|
521
1098
|
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
522
1099
|
"use strict";
|
|
523
|
-
|
|
1100
|
+
init_task_runtime2();
|
|
1101
|
+
init_get_transfer_list2();
|
|
524
1102
|
}
|
|
525
1103
|
});
|
|
526
1104
|
|
|
@@ -534,7 +1112,7 @@
|
|
|
534
1112
|
|
|
535
1113
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
536
1114
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
537
|
-
await
|
|
1115
|
+
await createWorker2(
|
|
538
1116
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
539
1117
|
selectLoader(options || {}),
|
|
540
1118
|
input,
|
|
@@ -855,7 +1433,7 @@
|
|
|
855
1433
|
});
|
|
856
1434
|
|
|
857
1435
|
// ../../node_modules/@math.gl/core/dist/index.js
|
|
858
|
-
var
|
|
1436
|
+
var init_dist2 = __esm({
|
|
859
1437
|
"../../node_modules/@math.gl/core/dist/index.js"() {
|
|
860
1438
|
init_math_utils();
|
|
861
1439
|
init_types2();
|
|
@@ -8528,11 +9106,11 @@ return true;`);
|
|
|
8528
9106
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8529
9107
|
}
|
|
8530
9108
|
setValue(index, value) {
|
|
8531
|
-
const
|
|
8532
|
-
const current =
|
|
9109
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
9110
|
+
const current = pending2.get(index);
|
|
8533
9111
|
current && (this._pendingLength -= current.length);
|
|
8534
9112
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8535
|
-
|
|
9113
|
+
pending2.set(index, value);
|
|
8536
9114
|
}
|
|
8537
9115
|
setValid(index, isValid) {
|
|
8538
9116
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8555,12 +9133,12 @@ return true;`);
|
|
|
8555
9133
|
return super.finish();
|
|
8556
9134
|
}
|
|
8557
9135
|
_flush() {
|
|
8558
|
-
const
|
|
9136
|
+
const pending2 = this._pending;
|
|
8559
9137
|
const pendingLength = this._pendingLength;
|
|
8560
9138
|
this._pendingLength = 0;
|
|
8561
9139
|
this._pending = void 0;
|
|
8562
|
-
if (
|
|
8563
|
-
this._flushPending(
|
|
9140
|
+
if (pending2 && pending2.size > 0) {
|
|
9141
|
+
this._flushPending(pending2, pendingLength);
|
|
8564
9142
|
}
|
|
8565
9143
|
return this;
|
|
8566
9144
|
}
|
|
@@ -11146,11 +11724,11 @@ return true;`);
|
|
|
11146
11724
|
setValue(index, value) {
|
|
11147
11725
|
return super.setValue(index, toUint8Array(value));
|
|
11148
11726
|
}
|
|
11149
|
-
_flushPending(
|
|
11727
|
+
_flushPending(pending2, pendingLength) {
|
|
11150
11728
|
const offsets = this._offsets;
|
|
11151
11729
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11152
11730
|
let offset = 0;
|
|
11153
|
-
for (const [index, value] of
|
|
11731
|
+
for (const [index, value] of pending2) {
|
|
11154
11732
|
if (value === void 0) {
|
|
11155
11733
|
offsets.set(index, 0);
|
|
11156
11734
|
} else {
|
|
@@ -11187,11 +11765,11 @@ return true;`);
|
|
|
11187
11765
|
setValue(index, value) {
|
|
11188
11766
|
return super.setValue(index, toUint8Array(value));
|
|
11189
11767
|
}
|
|
11190
|
-
_flushPending(
|
|
11768
|
+
_flushPending(pending2, pendingLength) {
|
|
11191
11769
|
const offsets = this._offsets;
|
|
11192
11770
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11193
11771
|
let offset = 0;
|
|
11194
|
-
for (const [index, value] of
|
|
11772
|
+
for (const [index, value] of pending2) {
|
|
11195
11773
|
if (value === void 0) {
|
|
11196
11774
|
offsets.set(index, BigInt(0));
|
|
11197
11775
|
} else {
|
|
@@ -11502,10 +12080,10 @@ return true;`);
|
|
|
11502
12080
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11503
12081
|
return this.numChildren - 1;
|
|
11504
12082
|
}
|
|
11505
|
-
_flushPending(
|
|
12083
|
+
_flushPending(pending2) {
|
|
11506
12084
|
const offsets = this._offsets;
|
|
11507
12085
|
const [child] = this.children;
|
|
11508
|
-
for (const [index, value] of
|
|
12086
|
+
for (const [index, value] of pending2) {
|
|
11509
12087
|
if (typeof value === "undefined") {
|
|
11510
12088
|
offsets.set(index, 0);
|
|
11511
12089
|
} else {
|
|
@@ -11544,10 +12122,10 @@ return true;`);
|
|
|
11544
12122
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11545
12123
|
return this.numChildren - 1;
|
|
11546
12124
|
}
|
|
11547
|
-
_flushPending(
|
|
12125
|
+
_flushPending(pending2) {
|
|
11548
12126
|
const offsets = this._offsets;
|
|
11549
12127
|
const [child] = this.children;
|
|
11550
|
-
for (const [index, value] of
|
|
12128
|
+
for (const [index, value] of pending2) {
|
|
11551
12129
|
if (typeof value === "undefined") {
|
|
11552
12130
|
offsets.set(index, BigInt(0));
|
|
11553
12131
|
} else {
|
|
@@ -11577,11 +12155,11 @@ return true;`);
|
|
|
11577
12155
|
}
|
|
11578
12156
|
setValue(index, value) {
|
|
11579
12157
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11580
|
-
const
|
|
11581
|
-
const current =
|
|
12158
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
12159
|
+
const current = pending2.get(index);
|
|
11582
12160
|
current && (this._pendingLength -= current.size);
|
|
11583
12161
|
this._pendingLength += row.size;
|
|
11584
|
-
|
|
12162
|
+
pending2.set(index, row);
|
|
11585
12163
|
}
|
|
11586
12164
|
addChild(child, name = `${this.numChildren}`) {
|
|
11587
12165
|
if (this.numChildren > 0) {
|
|
@@ -11591,10 +12169,10 @@ return true;`);
|
|
|
11591
12169
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11592
12170
|
return this.numChildren - 1;
|
|
11593
12171
|
}
|
|
11594
|
-
_flushPending(
|
|
12172
|
+
_flushPending(pending2) {
|
|
11595
12173
|
const offsets = this._offsets;
|
|
11596
12174
|
const [child] = this.children;
|
|
11597
|
-
for (const [index, value] of
|
|
12175
|
+
for (const [index, value] of pending2) {
|
|
11598
12176
|
if (value === void 0) {
|
|
11599
12177
|
offsets.set(index, 0);
|
|
11600
12178
|
} else {
|
|
@@ -11803,7 +12381,7 @@ return true;`);
|
|
|
11803
12381
|
return super.setValue(index, encodeUtf8(value));
|
|
11804
12382
|
}
|
|
11805
12383
|
// @ts-ignore
|
|
11806
|
-
_flushPending(
|
|
12384
|
+
_flushPending(pending2, pendingLength) {
|
|
11807
12385
|
}
|
|
11808
12386
|
};
|
|
11809
12387
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -11834,7 +12412,7 @@ return true;`);
|
|
|
11834
12412
|
return super.setValue(index, encodeUtf8(value));
|
|
11835
12413
|
}
|
|
11836
12414
|
// @ts-ignore
|
|
11837
|
-
_flushPending(
|
|
12415
|
+
_flushPending(pending2, pendingLength) {
|
|
11838
12416
|
}
|
|
11839
12417
|
};
|
|
11840
12418
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -13546,8 +14124,8 @@ return true;`);
|
|
|
13546
14124
|
});
|
|
13547
14125
|
|
|
13548
14126
|
// ../../node_modules/apache-arrow/ipc/reader.mjs
|
|
13549
|
-
function shouldAutoDestroy(
|
|
13550
|
-
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] :
|
|
14127
|
+
function shouldAutoDestroy(self2, options) {
|
|
14128
|
+
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
|
|
13551
14129
|
}
|
|
13552
14130
|
function* readAllSync(source) {
|
|
13553
14131
|
const reader = RecordBatchReader.from(source);
|
|
@@ -15778,52 +16356,344 @@ return true;`);
|
|
|
15778
16356
|
}
|
|
15779
16357
|
});
|
|
15780
16358
|
|
|
15781
|
-
//
|
|
15782
|
-
function
|
|
15783
|
-
return
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
16359
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
|
|
16360
|
+
function getArrowVariadicBuffers(data) {
|
|
16361
|
+
return data.variadicBuffers ?? [];
|
|
16362
|
+
}
|
|
16363
|
+
function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
|
|
16364
|
+
return Reflect.construct(Data, [
|
|
16365
|
+
type,
|
|
16366
|
+
offset,
|
|
16367
|
+
length,
|
|
16368
|
+
nullCount,
|
|
16369
|
+
buffers,
|
|
16370
|
+
children,
|
|
16371
|
+
dictionary,
|
|
16372
|
+
variadicBuffers
|
|
16373
|
+
]);
|
|
15787
16374
|
}
|
|
15788
|
-
|
|
15789
|
-
|
|
15790
|
-
|
|
15791
|
-
|
|
15792
|
-
|
|
16375
|
+
var init_arrow_data = __esm({
|
|
16376
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
|
|
16377
|
+
init_Arrow_dom();
|
|
16378
|
+
}
|
|
16379
|
+
});
|
|
16380
|
+
|
|
16381
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
|
|
16382
|
+
function splitArrowBuffers(input, options = {}) {
|
|
16383
|
+
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
16384
|
+
if (isArrowTable2(input)) {
|
|
16385
|
+
return splitArrowTableBuffersInternal(input, context);
|
|
16386
|
+
}
|
|
16387
|
+
if (isArrowRecordBatch2(input)) {
|
|
16388
|
+
return splitArrowRecordBatchBuffers(input, context);
|
|
16389
|
+
}
|
|
16390
|
+
if (isArrowVector2(input)) {
|
|
16391
|
+
return splitArrowVectorBuffers(input, context);
|
|
16392
|
+
}
|
|
16393
|
+
return splitArrowDataBuffers(input, context);
|
|
15793
16394
|
}
|
|
15794
|
-
function
|
|
15795
|
-
return
|
|
16395
|
+
function isArrowTable2(input) {
|
|
16396
|
+
return "batches" in input;
|
|
15796
16397
|
}
|
|
15797
|
-
function
|
|
15798
|
-
return
|
|
16398
|
+
function isArrowRecordBatch2(input) {
|
|
16399
|
+
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
15799
16400
|
}
|
|
15800
|
-
function
|
|
15801
|
-
return
|
|
15802
|
-
name: field.name,
|
|
15803
|
-
type: serializeArrowType(field.type),
|
|
15804
|
-
nullable: field.nullable,
|
|
15805
|
-
metadata: serializeArrowMetadata(field.metadata)
|
|
15806
|
-
};
|
|
16401
|
+
function isArrowVector2(input) {
|
|
16402
|
+
return "data" in input && Array.isArray(input.data);
|
|
15807
16403
|
}
|
|
15808
|
-
function
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
|
|
15813
|
-
|
|
16404
|
+
function splitArrowTableBuffersInternal(arrowTable, options) {
|
|
16405
|
+
const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
|
|
16406
|
+
return new Table(arrowTable.schema, recordBatches);
|
|
16407
|
+
}
|
|
16408
|
+
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
16409
|
+
return new RecordBatch3(recordBatch.schema, splitArrowDataBuffers(recordBatch.data, options));
|
|
16410
|
+
}
|
|
16411
|
+
function splitArrowDataBuffers(data, options) {
|
|
16412
|
+
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
16413
|
+
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
16414
|
+
const buffers = {
|
|
16415
|
+
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
16416
|
+
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
16417
|
+
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
16418
|
+
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
16419
|
+
};
|
|
16420
|
+
return createArrowData(
|
|
16421
|
+
data.type,
|
|
16422
|
+
data.offset,
|
|
16423
|
+
data.length,
|
|
16424
|
+
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
16425
|
+
data._nullCount,
|
|
16426
|
+
buffers,
|
|
16427
|
+
children,
|
|
16428
|
+
dictionary,
|
|
16429
|
+
getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
|
|
15814
16430
|
);
|
|
15815
16431
|
}
|
|
15816
|
-
function
|
|
15817
|
-
|
|
15818
|
-
|
|
16432
|
+
function splitArrowVectorBuffers(vector, options) {
|
|
16433
|
+
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
16434
|
+
}
|
|
16435
|
+
function splitArrowBuffer(array, options) {
|
|
16436
|
+
if (!isArrowTypedArray(array)) {
|
|
16437
|
+
return array;
|
|
15819
16438
|
}
|
|
15820
|
-
if (
|
|
15821
|
-
return
|
|
16439
|
+
if (options.copy === "none") {
|
|
16440
|
+
return array;
|
|
15822
16441
|
}
|
|
15823
|
-
if (
|
|
15824
|
-
|
|
15825
|
-
|
|
15826
|
-
|
|
16442
|
+
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
16443
|
+
return array;
|
|
16444
|
+
}
|
|
16445
|
+
let copy = options.copies.get(array);
|
|
16446
|
+
if (!copy) {
|
|
16447
|
+
copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
|
|
16448
|
+
options.copies.set(array, copy);
|
|
16449
|
+
}
|
|
16450
|
+
return copy;
|
|
16451
|
+
}
|
|
16452
|
+
function isArrowTypedArray(value) {
|
|
16453
|
+
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
16454
|
+
}
|
|
16455
|
+
var init_split_arrow_buffers = __esm({
|
|
16456
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
|
|
16457
|
+
init_Arrow_dom();
|
|
16458
|
+
init_arrow_data();
|
|
16459
|
+
}
|
|
16460
|
+
});
|
|
16461
|
+
|
|
16462
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
|
|
16463
|
+
var init_indexed_arrow_vector = __esm({
|
|
16464
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
|
|
16465
|
+
}
|
|
16466
|
+
});
|
|
16467
|
+
|
|
16468
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
|
|
16469
|
+
var init_indexed_arrow_table = __esm({
|
|
16470
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
|
|
16471
|
+
}
|
|
16472
|
+
});
|
|
16473
|
+
|
|
16474
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
|
|
16475
|
+
var init_mapped_arrow_table = __esm({
|
|
16476
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
|
|
16477
|
+
}
|
|
16478
|
+
});
|
|
16479
|
+
|
|
16480
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
|
|
16481
|
+
var init_rename_arrow_columns = __esm({
|
|
16482
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
|
|
16483
|
+
}
|
|
16484
|
+
});
|
|
16485
|
+
|
|
16486
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
|
|
16487
|
+
function dehydrateArrowTable(arrowTable, options) {
|
|
16488
|
+
const splitTable = splitArrowBuffers(arrowTable, options);
|
|
16489
|
+
return {
|
|
16490
|
+
transport: "arrow-js",
|
|
16491
|
+
version: 1,
|
|
16492
|
+
schema: tableToIPC(new Table(splitTable.schema, [])),
|
|
16493
|
+
metadataVersion: splitTable.schema.metadataVersion,
|
|
16494
|
+
batches: splitTable.batches.map((batch) => dehydrateArrowData(batch.data))
|
|
16495
|
+
};
|
|
16496
|
+
}
|
|
16497
|
+
function hydrateArrowTable(table) {
|
|
16498
|
+
if (table.transport !== "arrow-js" || table.version !== 1) {
|
|
16499
|
+
throw new Error("Unsupported Arrow column-buffer transport protocol.");
|
|
16500
|
+
}
|
|
16501
|
+
const decodedSchema = tableFromIPC(table.schema).schema;
|
|
16502
|
+
const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
|
|
16503
|
+
const type = new Struct(schema.fields);
|
|
16504
|
+
const batches = table.batches.map((data) => new RecordBatch3(schema, hydrateArrowData(data, type)));
|
|
16505
|
+
return new Table(schema, batches);
|
|
16506
|
+
}
|
|
16507
|
+
function dehydrateArrowData(data) {
|
|
16508
|
+
return {
|
|
16509
|
+
offset: data.offset,
|
|
16510
|
+
length: data.length,
|
|
16511
|
+
nullCount: data.nullCount,
|
|
16512
|
+
buffers: {
|
|
16513
|
+
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
16514
|
+
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
16515
|
+
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
16516
|
+
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
16517
|
+
},
|
|
16518
|
+
children: data.children.map((child) => dehydrateArrowData(child)),
|
|
16519
|
+
variadicBuffers: getArrowVariadicBuffers(data),
|
|
16520
|
+
dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
|
|
16521
|
+
};
|
|
16522
|
+
}
|
|
16523
|
+
function hydrateArrowData(data, type) {
|
|
16524
|
+
const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
|
|
16525
|
+
const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
|
|
16526
|
+
return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
|
|
16527
|
+
}
|
|
16528
|
+
var init_arrow_table_transport = __esm({
|
|
16529
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
|
|
16530
|
+
init_Arrow_dom();
|
|
16531
|
+
init_arrow_data();
|
|
16532
|
+
init_split_arrow_buffers();
|
|
16533
|
+
}
|
|
16534
|
+
});
|
|
16535
|
+
|
|
16536
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/index.js
|
|
16537
|
+
var init_arrow = __esm({
|
|
16538
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
|
|
16539
|
+
init_indexed_arrow_table();
|
|
16540
|
+
init_indexed_arrow_vector();
|
|
16541
|
+
init_mapped_arrow_table();
|
|
16542
|
+
init_rename_arrow_columns();
|
|
16543
|
+
init_split_arrow_buffers();
|
|
16544
|
+
init_arrow_table_transport();
|
|
16545
|
+
}
|
|
16546
|
+
});
|
|
16547
|
+
|
|
16548
|
+
// ../../node_modules/@math.gl/arrow/dist/index.js
|
|
16549
|
+
var init_dist3 = __esm({
|
|
16550
|
+
"../../node_modules/@math.gl/arrow/dist/index.js"() {
|
|
16551
|
+
init_arrow();
|
|
16552
|
+
}
|
|
16553
|
+
});
|
|
16554
|
+
|
|
16555
|
+
// ../core/src/arrow-worker-transport.ts
|
|
16556
|
+
function serializeArrowWorkerTable(result) {
|
|
16557
|
+
if (!isArrowTableWrapper(result)) {
|
|
16558
|
+
throw new Error("Workers require Arrow table output");
|
|
16559
|
+
}
|
|
16560
|
+
const { data, ...metadata } = result;
|
|
16561
|
+
return {
|
|
16562
|
+
...structuredClone(metadata),
|
|
16563
|
+
data: dehydrateArrowTable(data, { copy: "all" })
|
|
16564
|
+
};
|
|
16565
|
+
}
|
|
16566
|
+
function deserializeArrowWorkerTable(result) {
|
|
16567
|
+
if (!isDehydratedArrowTableWrapper(result)) {
|
|
16568
|
+
throw new Error("Workers require Arrow column transport");
|
|
16569
|
+
}
|
|
16570
|
+
return { ...result, data: hydrateArrowTable(result.data) };
|
|
16571
|
+
}
|
|
16572
|
+
function isArrowTableWrapper(value) {
|
|
16573
|
+
const table = value;
|
|
16574
|
+
return Boolean(
|
|
16575
|
+
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
16576
|
+
);
|
|
16577
|
+
}
|
|
16578
|
+
function isDehydratedArrowTableWrapper(value) {
|
|
16579
|
+
const table = value;
|
|
16580
|
+
return Boolean(
|
|
16581
|
+
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
16582
|
+
);
|
|
16583
|
+
}
|
|
16584
|
+
var init_arrow_worker_transport = __esm({
|
|
16585
|
+
"../core/src/arrow-worker-transport.ts"() {
|
|
16586
|
+
"use strict";
|
|
16587
|
+
init_dist3();
|
|
16588
|
+
}
|
|
16589
|
+
});
|
|
16590
|
+
|
|
16591
|
+
// ../core/src/schema-utils/lib/schema/data-type.ts
|
|
16592
|
+
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
16593
|
+
if (value instanceof Date) {
|
|
16594
|
+
return "date-millisecond";
|
|
16595
|
+
}
|
|
16596
|
+
if (typeof value === "number") {
|
|
16597
|
+
return defaultNumberType;
|
|
16598
|
+
}
|
|
16599
|
+
if (typeof value === "boolean") {
|
|
16600
|
+
return "bool";
|
|
16601
|
+
}
|
|
16602
|
+
if (typeof value === "string") {
|
|
16603
|
+
return "utf8";
|
|
16604
|
+
}
|
|
16605
|
+
if (value === null || value === "undefined") {
|
|
16606
|
+
return "null";
|
|
16607
|
+
}
|
|
16608
|
+
return "null";
|
|
16609
|
+
}
|
|
16610
|
+
function getDataTypeFromArray(array) {
|
|
16611
|
+
let type = getDataTypeFromTypedArray(array);
|
|
16612
|
+
if (type !== "null") {
|
|
16613
|
+
return { type, nullable: false };
|
|
16614
|
+
}
|
|
16615
|
+
if (array.length > 0) {
|
|
16616
|
+
type = getDataTypeFromValue(array[0]);
|
|
16617
|
+
return { type, nullable: true };
|
|
16618
|
+
}
|
|
16619
|
+
return { type: "null", nullable: true };
|
|
16620
|
+
}
|
|
16621
|
+
function getDataTypeFromTypedArray(array) {
|
|
16622
|
+
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
16623
|
+
return "float16";
|
|
16624
|
+
}
|
|
16625
|
+
switch (array.constructor) {
|
|
16626
|
+
case Int8Array:
|
|
16627
|
+
return "int8";
|
|
16628
|
+
case Uint8Array:
|
|
16629
|
+
case Uint8ClampedArray:
|
|
16630
|
+
return "uint8";
|
|
16631
|
+
case Int16Array:
|
|
16632
|
+
return "int16";
|
|
16633
|
+
case Uint16Array:
|
|
16634
|
+
return "uint16";
|
|
16635
|
+
case Int32Array:
|
|
16636
|
+
return "int32";
|
|
16637
|
+
case Uint32Array:
|
|
16638
|
+
return "uint32";
|
|
16639
|
+
case BigInt64Array:
|
|
16640
|
+
return "int64";
|
|
16641
|
+
case BigUint64Array:
|
|
16642
|
+
return "uint64";
|
|
16643
|
+
case Float32Array:
|
|
16644
|
+
return "float32";
|
|
16645
|
+
case Float64Array:
|
|
16646
|
+
return "float64";
|
|
16647
|
+
default:
|
|
16648
|
+
return "null";
|
|
16649
|
+
}
|
|
16650
|
+
}
|
|
16651
|
+
var init_data_type = __esm({
|
|
16652
|
+
"../core/src/schema-utils/lib/schema/data-type.ts"() {
|
|
16653
|
+
"use strict";
|
|
16654
|
+
}
|
|
16655
|
+
});
|
|
16656
|
+
|
|
16657
|
+
// ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
|
|
16658
|
+
function serializeArrowSchema(arrowSchema) {
|
|
16659
|
+
return {
|
|
16660
|
+
fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
|
|
16661
|
+
metadata: serializeArrowMetadata(arrowSchema.metadata)
|
|
16662
|
+
};
|
|
16663
|
+
}
|
|
16664
|
+
function serializeArrowMetadata(arrowMetadata) {
|
|
16665
|
+
return Object.fromEntries(arrowMetadata);
|
|
16666
|
+
}
|
|
16667
|
+
function deserializeArrowMetadata(metadata) {
|
|
16668
|
+
return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
|
|
16669
|
+
}
|
|
16670
|
+
function serializeArrowField(field) {
|
|
16671
|
+
return {
|
|
16672
|
+
name: field.name,
|
|
16673
|
+
type: serializeArrowType(field.type),
|
|
16674
|
+
nullable: field.nullable,
|
|
16675
|
+
metadata: serializeArrowMetadata(field.metadata)
|
|
16676
|
+
};
|
|
16677
|
+
}
|
|
16678
|
+
function deserializeArrowField(field, options) {
|
|
16679
|
+
return new Field2(
|
|
16680
|
+
field.name,
|
|
16681
|
+
deserializeArrowType(field.type, options),
|
|
16682
|
+
field.nullable,
|
|
16683
|
+
deserializeArrowMetadata(field.metadata)
|
|
16684
|
+
);
|
|
16685
|
+
}
|
|
16686
|
+
function serializeArrowType(arrowType) {
|
|
16687
|
+
if (isArrowViewType(arrowType, "BinaryView")) {
|
|
16688
|
+
return "binary-view";
|
|
16689
|
+
}
|
|
16690
|
+
if (isArrowViewType(arrowType, "Utf8View")) {
|
|
16691
|
+
return "utf8-view";
|
|
16692
|
+
}
|
|
16693
|
+
if (isOptionalArrowType(arrowType, "LargeList")) {
|
|
16694
|
+
const largeListType = arrowType;
|
|
16695
|
+
return {
|
|
16696
|
+
type: "large-list",
|
|
15827
16697
|
children: [serializeArrowField(largeListType.valueField)]
|
|
15828
16698
|
};
|
|
15829
16699
|
}
|
|
@@ -16213,259 +17083,6 @@ return true;`);
|
|
|
16213
17083
|
}
|
|
16214
17084
|
});
|
|
16215
17085
|
|
|
16216
|
-
// ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
|
|
16217
|
-
function splitArrowBuffers(input, options = {}) {
|
|
16218
|
-
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
16219
|
-
if (isArrowTable2(input)) {
|
|
16220
|
-
return splitArrowTableBuffersInternal(input, context);
|
|
16221
|
-
}
|
|
16222
|
-
if (isArrowRecordBatch2(input)) {
|
|
16223
|
-
return splitArrowRecordBatchBuffers(input, context);
|
|
16224
|
-
}
|
|
16225
|
-
if (isArrowVector2(input)) {
|
|
16226
|
-
return splitArrowVectorBuffers(input, context);
|
|
16227
|
-
}
|
|
16228
|
-
return splitArrowDataBuffers(input, context);
|
|
16229
|
-
}
|
|
16230
|
-
function isArrowTable2(input) {
|
|
16231
|
-
return "batches" in input;
|
|
16232
|
-
}
|
|
16233
|
-
function isArrowRecordBatch2(input) {
|
|
16234
|
-
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
16235
|
-
}
|
|
16236
|
-
function isArrowVector2(input) {
|
|
16237
|
-
return "data" in input && Array.isArray(input.data);
|
|
16238
|
-
}
|
|
16239
|
-
function splitArrowTableBuffersInternal(table, options) {
|
|
16240
|
-
const recordBatches = table.batches.map(
|
|
16241
|
-
(recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
|
|
16242
|
-
);
|
|
16243
|
-
return new Table(table.schema, recordBatches);
|
|
16244
|
-
}
|
|
16245
|
-
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
16246
|
-
return new RecordBatch3(
|
|
16247
|
-
recordBatch.schema,
|
|
16248
|
-
splitArrowDataBuffers(recordBatch.data, options)
|
|
16249
|
-
);
|
|
16250
|
-
}
|
|
16251
|
-
function splitArrowDataBuffers(data, options) {
|
|
16252
|
-
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
16253
|
-
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
16254
|
-
const buffers = {
|
|
16255
|
-
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
16256
|
-
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
16257
|
-
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
16258
|
-
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
16259
|
-
};
|
|
16260
|
-
return new Data(
|
|
16261
|
-
data.type,
|
|
16262
|
-
data.offset,
|
|
16263
|
-
data.length,
|
|
16264
|
-
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
16265
|
-
data._nullCount,
|
|
16266
|
-
buffers,
|
|
16267
|
-
children,
|
|
16268
|
-
dictionary
|
|
16269
|
-
);
|
|
16270
|
-
}
|
|
16271
|
-
function splitArrowVectorBuffers(vector, options) {
|
|
16272
|
-
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
16273
|
-
}
|
|
16274
|
-
function splitArrowBuffer(array, options) {
|
|
16275
|
-
if (!isArrowTypedArray(array)) {
|
|
16276
|
-
return array;
|
|
16277
|
-
}
|
|
16278
|
-
if (options.copy === "none") {
|
|
16279
|
-
return array;
|
|
16280
|
-
}
|
|
16281
|
-
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
16282
|
-
return array;
|
|
16283
|
-
}
|
|
16284
|
-
let copy = options.copies.get(array);
|
|
16285
|
-
if (!copy) {
|
|
16286
|
-
copy = array.slice();
|
|
16287
|
-
options.copies.set(array, copy);
|
|
16288
|
-
}
|
|
16289
|
-
return copy;
|
|
16290
|
-
}
|
|
16291
|
-
function isArrowTypedArray(value) {
|
|
16292
|
-
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
16293
|
-
}
|
|
16294
|
-
var init_split_arrow_buffers = __esm({
|
|
16295
|
-
"../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
|
|
16296
|
-
"use strict";
|
|
16297
|
-
init_Arrow_dom();
|
|
16298
|
-
}
|
|
16299
|
-
});
|
|
16300
|
-
|
|
16301
|
-
// ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
|
|
16302
|
-
function dehydrateArrowTable(table, options) {
|
|
16303
|
-
const splitTable = splitArrowBuffers(table, options);
|
|
16304
|
-
return {
|
|
16305
|
-
shape: "arrow-table",
|
|
16306
|
-
transport: "arrow-js",
|
|
16307
|
-
schema: serializeArrowSchema(splitTable.schema),
|
|
16308
|
-
batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
|
|
16309
|
-
};
|
|
16310
|
-
}
|
|
16311
|
-
function hydrateArrowTable(table) {
|
|
16312
|
-
const schema = deserializeArrowSchema(table.schema);
|
|
16313
|
-
const recordBatches = table.batches.map(
|
|
16314
|
-
(recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
|
|
16315
|
-
);
|
|
16316
|
-
return new Table(schema, recordBatches);
|
|
16317
|
-
}
|
|
16318
|
-
function serializeArrowWorkerTable(result) {
|
|
16319
|
-
if (!isArrowTableWrapper(result)) {
|
|
16320
|
-
throw new Error("Workers require Arrow table output");
|
|
16321
|
-
}
|
|
16322
|
-
const { data, ...metadata } = result;
|
|
16323
|
-
return {
|
|
16324
|
-
...structuredClone(metadata),
|
|
16325
|
-
data: dehydrateArrowTable(data, { copy: "all" })
|
|
16326
|
-
};
|
|
16327
|
-
}
|
|
16328
|
-
function deserializeArrowWorkerTable(result) {
|
|
16329
|
-
if (!isDehydratedArrowTableWrapper(result)) {
|
|
16330
|
-
throw new Error("Workers require Arrow column transport");
|
|
16331
|
-
}
|
|
16332
|
-
return { ...result, data: hydrateArrowTable(result.data) };
|
|
16333
|
-
}
|
|
16334
|
-
function isArrowTableWrapper(value) {
|
|
16335
|
-
const table = value;
|
|
16336
|
-
return Boolean(
|
|
16337
|
-
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
16338
|
-
);
|
|
16339
|
-
}
|
|
16340
|
-
function isDehydratedArrowTableWrapper(value) {
|
|
16341
|
-
const table = value;
|
|
16342
|
-
return Boolean(
|
|
16343
|
-
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
16344
|
-
);
|
|
16345
|
-
}
|
|
16346
|
-
function dehydrateArrowRecordBatch(recordBatch) {
|
|
16347
|
-
return { data: dehydrateArrowData(recordBatch.data) };
|
|
16348
|
-
}
|
|
16349
|
-
function dehydrateArrowData(data) {
|
|
16350
|
-
return {
|
|
16351
|
-
type: serializeArrowType(data.type),
|
|
16352
|
-
offset: data.offset,
|
|
16353
|
-
length: data.length,
|
|
16354
|
-
// @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
|
|
16355
|
-
nullCount: data._nullCount,
|
|
16356
|
-
buffers: {
|
|
16357
|
-
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
16358
|
-
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
16359
|
-
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
16360
|
-
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
16361
|
-
},
|
|
16362
|
-
children: data.children.map((childData) => dehydrateArrowData(childData)),
|
|
16363
|
-
dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
|
|
16364
|
-
};
|
|
16365
|
-
}
|
|
16366
|
-
function dehydrateArrowVector(vector) {
|
|
16367
|
-
return { data: vector.data.map((data) => dehydrateArrowData(data)) };
|
|
16368
|
-
}
|
|
16369
|
-
function hydrateArrowData(data) {
|
|
16370
|
-
const children = data.children.map((childData) => hydrateArrowData(childData));
|
|
16371
|
-
const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
|
|
16372
|
-
return new Data(
|
|
16373
|
-
deserializeArrowType(data.type),
|
|
16374
|
-
data.offset,
|
|
16375
|
-
data.length,
|
|
16376
|
-
data.nullCount,
|
|
16377
|
-
data.buffers,
|
|
16378
|
-
children,
|
|
16379
|
-
dictionary
|
|
16380
|
-
);
|
|
16381
|
-
}
|
|
16382
|
-
function hydrateArrowVector(vector) {
|
|
16383
|
-
return new Vector(vector.data.map((data) => hydrateArrowData(data)));
|
|
16384
|
-
}
|
|
16385
|
-
var init_arrow_table_transport = __esm({
|
|
16386
|
-
"../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
|
|
16387
|
-
"use strict";
|
|
16388
|
-
init_Arrow_dom();
|
|
16389
|
-
init_convert_arrow_schema();
|
|
16390
|
-
init_split_arrow_buffers();
|
|
16391
|
-
}
|
|
16392
|
-
});
|
|
16393
|
-
|
|
16394
|
-
// ../core/src/schema-utils/arrow-transport.ts
|
|
16395
|
-
var init_arrow_transport = __esm({
|
|
16396
|
-
"../core/src/schema-utils/arrow-transport.ts"() {
|
|
16397
|
-
"use strict";
|
|
16398
|
-
init_arrow_table_transport();
|
|
16399
|
-
init_split_arrow_buffers();
|
|
16400
|
-
}
|
|
16401
|
-
});
|
|
16402
|
-
|
|
16403
|
-
// ../core/src/schema-utils/lib/schema/data-type.ts
|
|
16404
|
-
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
16405
|
-
if (value instanceof Date) {
|
|
16406
|
-
return "date-millisecond";
|
|
16407
|
-
}
|
|
16408
|
-
if (typeof value === "number") {
|
|
16409
|
-
return defaultNumberType;
|
|
16410
|
-
}
|
|
16411
|
-
if (typeof value === "boolean") {
|
|
16412
|
-
return "bool";
|
|
16413
|
-
}
|
|
16414
|
-
if (typeof value === "string") {
|
|
16415
|
-
return "utf8";
|
|
16416
|
-
}
|
|
16417
|
-
if (value === null || value === "undefined") {
|
|
16418
|
-
return "null";
|
|
16419
|
-
}
|
|
16420
|
-
return "null";
|
|
16421
|
-
}
|
|
16422
|
-
function getDataTypeFromArray(array) {
|
|
16423
|
-
let type = getDataTypeFromTypedArray(array);
|
|
16424
|
-
if (type !== "null") {
|
|
16425
|
-
return { type, nullable: false };
|
|
16426
|
-
}
|
|
16427
|
-
if (array.length > 0) {
|
|
16428
|
-
type = getDataTypeFromValue(array[0]);
|
|
16429
|
-
return { type, nullable: true };
|
|
16430
|
-
}
|
|
16431
|
-
return { type: "null", nullable: true };
|
|
16432
|
-
}
|
|
16433
|
-
function getDataTypeFromTypedArray(array) {
|
|
16434
|
-
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
16435
|
-
return "float16";
|
|
16436
|
-
}
|
|
16437
|
-
switch (array.constructor) {
|
|
16438
|
-
case Int8Array:
|
|
16439
|
-
return "int8";
|
|
16440
|
-
case Uint8Array:
|
|
16441
|
-
case Uint8ClampedArray:
|
|
16442
|
-
return "uint8";
|
|
16443
|
-
case Int16Array:
|
|
16444
|
-
return "int16";
|
|
16445
|
-
case Uint16Array:
|
|
16446
|
-
return "uint16";
|
|
16447
|
-
case Int32Array:
|
|
16448
|
-
return "int32";
|
|
16449
|
-
case Uint32Array:
|
|
16450
|
-
return "uint32";
|
|
16451
|
-
case BigInt64Array:
|
|
16452
|
-
return "int64";
|
|
16453
|
-
case BigUint64Array:
|
|
16454
|
-
return "uint64";
|
|
16455
|
-
case Float32Array:
|
|
16456
|
-
return "float32";
|
|
16457
|
-
case Float64Array:
|
|
16458
|
-
return "float64";
|
|
16459
|
-
default:
|
|
16460
|
-
return "null";
|
|
16461
|
-
}
|
|
16462
|
-
}
|
|
16463
|
-
var init_data_type = __esm({
|
|
16464
|
-
"../core/src/schema-utils/lib/schema/data-type.ts"() {
|
|
16465
|
-
"use strict";
|
|
16466
|
-
}
|
|
16467
|
-
});
|
|
16468
|
-
|
|
16469
17086
|
// ../core/src/schema-utils/lib/mesh/mesh-utils.ts
|
|
16470
17087
|
function getMeshBoundingBox(attributes) {
|
|
16471
17088
|
const positionAttribute = attributes?.POSITION;
|
|
@@ -16574,7 +17191,7 @@ return true;`);
|
|
|
16574
17191
|
var init_float162 = __esm({
|
|
16575
17192
|
"../core/src/schema/float16.ts"() {
|
|
16576
17193
|
"use strict";
|
|
16577
|
-
|
|
17194
|
+
init_dist2();
|
|
16578
17195
|
}
|
|
16579
17196
|
});
|
|
16580
17197
|
|
|
@@ -17480,8 +18097,8 @@ return true;`);
|
|
|
17480
18097
|
"src/pcd/pcd-loader-types.ts"() {
|
|
17481
18098
|
"use strict";
|
|
17482
18099
|
init_pcd_format();
|
|
17483
|
-
|
|
17484
|
-
VERSION = true ? "5.0.0-beta.
|
|
18100
|
+
init_arrow_worker_transport();
|
|
18101
|
+
VERSION = true ? "5.0.0-beta.5" : "latest";
|
|
17485
18102
|
PCDLoader = {
|
|
17486
18103
|
...PCDFormat,
|
|
17487
18104
|
dataType: null,
|
|
@@ -17593,7 +18210,7 @@ return true;`);
|
|
|
17593
18210
|
"src/pcd/pcd-loader.ts"() {
|
|
17594
18211
|
"use strict";
|
|
17595
18212
|
init_loader_utils();
|
|
17596
|
-
|
|
18213
|
+
init_arrow_worker_transport();
|
|
17597
18214
|
init_schema_utils();
|
|
17598
18215
|
init_parse_pcd();
|
|
17599
18216
|
init_pcd_loader_types();
|