@loaders.gl/pointclouds 5.0.0-beta.2 → 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/dist/dist.dev.js +6 -1
- package/dist/dist.min.js +4 -4
- package/dist/las/las-loader-shared.cjs +1 -1
- package/dist/las/las-loader-shared.js +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-worker.js +405 -84
- package/dist/las-writer.cjs +1 -1
- package/dist/pcd/pcd-loader-types.cjs +1 -1
- package/dist/pcd/pcd-loader-types.js +1 -1
- package/dist/pcd/pcd-writer.cjs +1 -1
- package/dist/pcd/pcd-writer.js +1 -1
- package/dist/pcd-loader-types.cjs +1 -1
- package/dist/pcd-worker.js +393 -57
- package/dist/pcd-writer.cjs +1 -1
- package/dist/ply/ply-loader-types.cjs +1 -1
- package/dist/ply/ply-loader-types.js +1 -1
- package/dist/ply/ply-writer.cjs +1 -1
- package/dist/ply/ply-writer.js +1 -1
- package/dist/ply-loader-types.cjs +1 -1
- package/dist/ply-worker.js +393 -57
- package/dist/ply-writer.cjs +1 -1
- package/package.json +4 -3
- package/src/las/lib/las-extra-bytes.ts +6 -4
package/dist/pcd-worker.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
var parentPort;
|
|
20
20
|
var init_worker_threads_browser = __esm({
|
|
21
21
|
"../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
22
|
-
parentPort = null;
|
|
22
|
+
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -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);
|
|
@@ -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
|
}
|
|
@@ -285,8 +288,19 @@
|
|
|
285
288
|
}
|
|
286
289
|
});
|
|
287
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
|
+
|
|
288
302
|
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
|
|
289
|
-
async function createWorker(
|
|
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
|
}
|
|
@@ -491,6 +508,7 @@
|
|
|
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;
|
|
@@ -502,6 +520,7 @@
|
|
|
502
520
|
var import_meta, path, moduleUrl;
|
|
503
521
|
var init_worker_utils = __esm({
|
|
504
522
|
"../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
505
524
|
init_create_worker();
|
|
506
525
|
import_meta = {};
|
|
507
526
|
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
@@ -509,18 +528,335 @@
|
|
|
509
528
|
}
|
|
510
529
|
});
|
|
511
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
|
+
|
|
512
686
|
// ../../node_modules/@math.gl/core/dist/tasks/index.js
|
|
513
687
|
var init_tasks = __esm({
|
|
514
688
|
"../../node_modules/@math.gl/core/dist/tasks/index.js"() {
|
|
515
|
-
|
|
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";
|
|
516
779
|
}
|
|
517
780
|
});
|
|
518
781
|
|
|
519
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
|
+
}
|
|
520
855
|
var init_create_worker2 = __esm({
|
|
521
856
|
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
522
857
|
"use strict";
|
|
523
|
-
|
|
858
|
+
init_task_runtime2();
|
|
859
|
+
init_get_transfer_list2();
|
|
524
860
|
}
|
|
525
861
|
});
|
|
526
862
|
|
|
@@ -534,7 +870,7 @@
|
|
|
534
870
|
|
|
535
871
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
536
872
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
537
|
-
await
|
|
873
|
+
await createWorker2(
|
|
538
874
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
539
875
|
selectLoader(options || {}),
|
|
540
876
|
input,
|
|
@@ -8528,11 +8864,11 @@ return true;`);
|
|
|
8528
8864
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8529
8865
|
}
|
|
8530
8866
|
setValue(index, value) {
|
|
8531
|
-
const
|
|
8532
|
-
const current =
|
|
8867
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
8868
|
+
const current = pending2.get(index);
|
|
8533
8869
|
current && (this._pendingLength -= current.length);
|
|
8534
8870
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8535
|
-
|
|
8871
|
+
pending2.set(index, value);
|
|
8536
8872
|
}
|
|
8537
8873
|
setValid(index, isValid) {
|
|
8538
8874
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8555,12 +8891,12 @@ return true;`);
|
|
|
8555
8891
|
return super.finish();
|
|
8556
8892
|
}
|
|
8557
8893
|
_flush() {
|
|
8558
|
-
const
|
|
8894
|
+
const pending2 = this._pending;
|
|
8559
8895
|
const pendingLength = this._pendingLength;
|
|
8560
8896
|
this._pendingLength = 0;
|
|
8561
8897
|
this._pending = void 0;
|
|
8562
|
-
if (
|
|
8563
|
-
this._flushPending(
|
|
8898
|
+
if (pending2 && pending2.size > 0) {
|
|
8899
|
+
this._flushPending(pending2, pendingLength);
|
|
8564
8900
|
}
|
|
8565
8901
|
return this;
|
|
8566
8902
|
}
|
|
@@ -11146,11 +11482,11 @@ return true;`);
|
|
|
11146
11482
|
setValue(index, value) {
|
|
11147
11483
|
return super.setValue(index, toUint8Array(value));
|
|
11148
11484
|
}
|
|
11149
|
-
_flushPending(
|
|
11485
|
+
_flushPending(pending2, pendingLength) {
|
|
11150
11486
|
const offsets = this._offsets;
|
|
11151
11487
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11152
11488
|
let offset = 0;
|
|
11153
|
-
for (const [index, value] of
|
|
11489
|
+
for (const [index, value] of pending2) {
|
|
11154
11490
|
if (value === void 0) {
|
|
11155
11491
|
offsets.set(index, 0);
|
|
11156
11492
|
} else {
|
|
@@ -11187,11 +11523,11 @@ return true;`);
|
|
|
11187
11523
|
setValue(index, value) {
|
|
11188
11524
|
return super.setValue(index, toUint8Array(value));
|
|
11189
11525
|
}
|
|
11190
|
-
_flushPending(
|
|
11526
|
+
_flushPending(pending2, pendingLength) {
|
|
11191
11527
|
const offsets = this._offsets;
|
|
11192
11528
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11193
11529
|
let offset = 0;
|
|
11194
|
-
for (const [index, value] of
|
|
11530
|
+
for (const [index, value] of pending2) {
|
|
11195
11531
|
if (value === void 0) {
|
|
11196
11532
|
offsets.set(index, BigInt(0));
|
|
11197
11533
|
} else {
|
|
@@ -11502,10 +11838,10 @@ return true;`);
|
|
|
11502
11838
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11503
11839
|
return this.numChildren - 1;
|
|
11504
11840
|
}
|
|
11505
|
-
_flushPending(
|
|
11841
|
+
_flushPending(pending2) {
|
|
11506
11842
|
const offsets = this._offsets;
|
|
11507
11843
|
const [child] = this.children;
|
|
11508
|
-
for (const [index, value] of
|
|
11844
|
+
for (const [index, value] of pending2) {
|
|
11509
11845
|
if (typeof value === "undefined") {
|
|
11510
11846
|
offsets.set(index, 0);
|
|
11511
11847
|
} else {
|
|
@@ -11544,10 +11880,10 @@ return true;`);
|
|
|
11544
11880
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11545
11881
|
return this.numChildren - 1;
|
|
11546
11882
|
}
|
|
11547
|
-
_flushPending(
|
|
11883
|
+
_flushPending(pending2) {
|
|
11548
11884
|
const offsets = this._offsets;
|
|
11549
11885
|
const [child] = this.children;
|
|
11550
|
-
for (const [index, value] of
|
|
11886
|
+
for (const [index, value] of pending2) {
|
|
11551
11887
|
if (typeof value === "undefined") {
|
|
11552
11888
|
offsets.set(index, BigInt(0));
|
|
11553
11889
|
} else {
|
|
@@ -11577,11 +11913,11 @@ return true;`);
|
|
|
11577
11913
|
}
|
|
11578
11914
|
setValue(index, value) {
|
|
11579
11915
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11580
|
-
const
|
|
11581
|
-
const current =
|
|
11916
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
11917
|
+
const current = pending2.get(index);
|
|
11582
11918
|
current && (this._pendingLength -= current.size);
|
|
11583
11919
|
this._pendingLength += row.size;
|
|
11584
|
-
|
|
11920
|
+
pending2.set(index, row);
|
|
11585
11921
|
}
|
|
11586
11922
|
addChild(child, name = `${this.numChildren}`) {
|
|
11587
11923
|
if (this.numChildren > 0) {
|
|
@@ -11591,10 +11927,10 @@ return true;`);
|
|
|
11591
11927
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11592
11928
|
return this.numChildren - 1;
|
|
11593
11929
|
}
|
|
11594
|
-
_flushPending(
|
|
11930
|
+
_flushPending(pending2) {
|
|
11595
11931
|
const offsets = this._offsets;
|
|
11596
11932
|
const [child] = this.children;
|
|
11597
|
-
for (const [index, value] of
|
|
11933
|
+
for (const [index, value] of pending2) {
|
|
11598
11934
|
if (value === void 0) {
|
|
11599
11935
|
offsets.set(index, 0);
|
|
11600
11936
|
} else {
|
|
@@ -11803,7 +12139,7 @@ return true;`);
|
|
|
11803
12139
|
return super.setValue(index, encodeUtf8(value));
|
|
11804
12140
|
}
|
|
11805
12141
|
// @ts-ignore
|
|
11806
|
-
_flushPending(
|
|
12142
|
+
_flushPending(pending2, pendingLength) {
|
|
11807
12143
|
}
|
|
11808
12144
|
};
|
|
11809
12145
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -11834,7 +12170,7 @@ return true;`);
|
|
|
11834
12170
|
return super.setValue(index, encodeUtf8(value));
|
|
11835
12171
|
}
|
|
11836
12172
|
// @ts-ignore
|
|
11837
|
-
_flushPending(
|
|
12173
|
+
_flushPending(pending2, pendingLength) {
|
|
11838
12174
|
}
|
|
11839
12175
|
};
|
|
11840
12176
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -13546,8 +13882,8 @@ return true;`);
|
|
|
13546
13882
|
});
|
|
13547
13883
|
|
|
13548
13884
|
// ../../node_modules/apache-arrow/ipc/reader.mjs
|
|
13549
|
-
function shouldAutoDestroy(
|
|
13550
|
-
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] :
|
|
13885
|
+
function shouldAutoDestroy(self2, options) {
|
|
13886
|
+
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
|
|
13551
13887
|
}
|
|
13552
13888
|
function* readAllSync(source) {
|
|
13553
13889
|
const reader = RecordBatchReader.from(source);
|
|
@@ -17481,7 +17817,7 @@ return true;`);
|
|
|
17481
17817
|
"use strict";
|
|
17482
17818
|
init_pcd_format();
|
|
17483
17819
|
init_arrow_transport();
|
|
17484
|
-
VERSION = true ? "5.0.0-beta.
|
|
17820
|
+
VERSION = true ? "5.0.0-beta.4" : "latest";
|
|
17485
17821
|
PCDLoader = {
|
|
17486
17822
|
...PCDFormat,
|
|
17487
17823
|
dataType: null,
|