@loaders.gl/raster 5.0.0-beta.4 → 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/README.md +1 -1
- package/dist/geotiff/advanced.cjs +4 -4
- package/dist/geotiff/geotiff-loader-types.js +1 -1
- package/dist/geotiff/geotiff-raster-loader-types.js +1 -1
- package/dist/geotiff/geotiff-source-loader.js +1 -1
- package/dist/geotiff/loaders.js +1 -1
- package/dist/geotiff/ometiff-source-loader.js +1 -1
- package/dist/index.cjs +4 -4
- package/dist/lerc/lerc-loader-types.js +1 -1
- package/dist/quantized-mesh-worker.js +568 -287
- package/dist/terrain/index.cjs +7 -7
- package/dist/terrain/index.cjs.map +3 -3
- package/dist/terrain/lib/utils/version.js +1 -1
- package/dist/terrain/quantized-mesh-loader.js +1 -1
- package/dist/terrain/quantized-mesh-loader.js.map +1 -1
- package/dist/terrain/terrain-loader.js +1 -1
- package/dist/terrain/terrain-loader.js.map +1 -1
- package/dist/terrain-worker.js +607 -290
- package/package.json +5 -5
- package/src/terrain/quantized-mesh-loader.ts +1 -1
- package/src/terrain/terrain-loader.ts +1 -1
package/dist/terrain-worker.js
CHANGED
|
@@ -59,15 +59,15 @@
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
// ../../node_modules/@math.gl/
|
|
62
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js
|
|
63
63
|
var parentPort;
|
|
64
64
|
var init_worker_threads_browser = __esm({
|
|
65
|
-
"../../node_modules/@math.gl/
|
|
65
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
66
66
|
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
// ../../node_modules/@math.gl/
|
|
70
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
71
71
|
function getTransferList(object, recursive = true, transfers) {
|
|
72
72
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
73
73
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -118,11 +118,11 @@
|
|
|
118
118
|
return false;
|
|
119
119
|
}
|
|
120
120
|
var init_get_transfer_list = __esm({
|
|
121
|
-
"../../node_modules/@math.gl/
|
|
121
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
// ../../node_modules/@math.gl/
|
|
125
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
126
126
|
async function getParentPort() {
|
|
127
127
|
return parentPort;
|
|
128
128
|
}
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
}
|
|
136
136
|
var onMessageWrapperMap, WorkerBody;
|
|
137
137
|
var init_worker_body = __esm({
|
|
138
|
-
"../../node_modules/@math.gl/
|
|
138
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
|
|
139
139
|
init_get_transfer_list();
|
|
140
140
|
init_worker_threads_browser();
|
|
141
141
|
onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
@@ -216,10 +216,10 @@
|
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
218
|
|
|
219
|
-
// ../../node_modules/@math.gl/
|
|
219
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
|
|
220
220
|
var AsyncQueue;
|
|
221
221
|
var init_async_queue = __esm({
|
|
222
|
-
"../../node_modules/@math.gl/
|
|
222
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
|
|
223
223
|
AsyncQueue = class {
|
|
224
224
|
constructor() {
|
|
225
225
|
this._values = [];
|
|
@@ -288,10 +288,10 @@
|
|
|
288
288
|
}
|
|
289
289
|
});
|
|
290
290
|
|
|
291
|
-
// ../../node_modules/@math.gl/
|
|
291
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
|
|
292
292
|
var SharedWorkerState;
|
|
293
293
|
var init_shared_state = __esm({
|
|
294
|
-
"../../node_modules/@math.gl/
|
|
294
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
|
|
295
295
|
SharedWorkerState = class {
|
|
296
296
|
constructor(buffer) {
|
|
297
297
|
if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
|
|
@@ -332,18 +332,18 @@
|
|
|
332
332
|
}
|
|
333
333
|
});
|
|
334
334
|
|
|
335
|
-
// ../../node_modules/@math.gl/
|
|
335
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
|
|
336
336
|
function validateOutputOwnership(ownership) {
|
|
337
337
|
if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
|
|
338
338
|
throw new Error("Invalid worker output ownership");
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
var init_validate_output_ownership = __esm({
|
|
342
|
-
"../../node_modules/@math.gl/
|
|
342
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
|
|
346
|
-
// ../../node_modules/@math.gl/
|
|
346
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
|
|
347
347
|
async function createWorker(process2, processInBatches, preload2) {
|
|
348
348
|
if (!await WorkerBody.inWorkerThread()) {
|
|
349
349
|
return;
|
|
@@ -548,7 +548,7 @@
|
|
|
548
548
|
}
|
|
549
549
|
var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
|
|
550
550
|
var init_create_worker = __esm({
|
|
551
|
-
"../../node_modules/@math.gl/
|
|
551
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
|
|
552
552
|
init_shared_state();
|
|
553
553
|
init_async_queue();
|
|
554
554
|
init_worker_body();
|
|
@@ -560,19 +560,20 @@
|
|
|
560
560
|
}
|
|
561
561
|
});
|
|
562
562
|
|
|
563
|
-
// ../../node_modules/@math.gl/
|
|
563
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
|
|
564
564
|
var import_meta, path, moduleUrl;
|
|
565
565
|
var init_worker_utils = __esm({
|
|
566
|
-
"../../node_modules/@math.gl/
|
|
566
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
|
|
567
567
|
init_worker_body();
|
|
568
568
|
init_create_worker();
|
|
569
|
+
init_get_transfer_list();
|
|
569
570
|
import_meta = {};
|
|
570
571
|
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
571
572
|
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
572
573
|
}
|
|
573
574
|
});
|
|
574
575
|
|
|
575
|
-
// ../../node_modules/@math.gl/
|
|
576
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
|
|
576
577
|
function preloadTaskCode(task, signal) {
|
|
577
578
|
if (!task.preload)
|
|
578
579
|
return Promise.resolve();
|
|
@@ -608,23 +609,193 @@
|
|
|
608
609
|
}
|
|
609
610
|
var pending, loaded;
|
|
610
611
|
var init_task_preload = __esm({
|
|
611
|
-
"../../node_modules/@math.gl/
|
|
612
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
|
|
612
613
|
pending = /* @__PURE__ */ new WeakMap();
|
|
613
614
|
loaded = /* @__PURE__ */ new WeakSet();
|
|
614
615
|
}
|
|
615
616
|
});
|
|
616
617
|
|
|
617
|
-
// ../../node_modules/@math.gl/
|
|
618
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
|
|
619
|
+
var TaskRequestError, TaskChannel;
|
|
620
|
+
var init_task_channel = __esm({
|
|
621
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js"() {
|
|
622
|
+
TaskRequestError = class extends Error {
|
|
623
|
+
};
|
|
624
|
+
TaskChannel = class {
|
|
625
|
+
constructor(options) {
|
|
626
|
+
this.options = options;
|
|
627
|
+
this.nextId = 1;
|
|
628
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
629
|
+
this.incoming = /* @__PURE__ */ new Map();
|
|
630
|
+
}
|
|
631
|
+
/** Send a request without serializing other in-flight requests. */
|
|
632
|
+
request(operation, value, signal, transfer = []) {
|
|
633
|
+
if (this.failure)
|
|
634
|
+
return Promise.reject(this.failure.reason);
|
|
635
|
+
if (signal?.aborted)
|
|
636
|
+
return Promise.reject(signal.reason);
|
|
637
|
+
const id = this.nextId++;
|
|
638
|
+
return new Promise((resolve, reject) => {
|
|
639
|
+
const abort = () => {
|
|
640
|
+
const pending2 = this.pending.get(id);
|
|
641
|
+
if (!pending2)
|
|
642
|
+
return;
|
|
643
|
+
this.pending.delete(id);
|
|
644
|
+
pending2.cleanup();
|
|
645
|
+
reject(signal?.reason);
|
|
646
|
+
this.send({ source: "math.gl/tasks", kind: "cancel", id });
|
|
647
|
+
};
|
|
648
|
+
this.pending.set(id, {
|
|
649
|
+
resolve,
|
|
650
|
+
reject,
|
|
651
|
+
cleanup: () => signal?.removeEventListener("abort", abort)
|
|
652
|
+
});
|
|
653
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
654
|
+
this.send({ source: "math.gl/tasks", kind: "request", id, operation, value }, transfer);
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
/** Send a one-way notification. */
|
|
658
|
+
emit(operation, value, transfer = []) {
|
|
659
|
+
if (this.failure)
|
|
660
|
+
throw this.failure.reason;
|
|
661
|
+
this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation, value }, transfer);
|
|
662
|
+
}
|
|
663
|
+
/** Dispatch a transport message; unrelated protocols are ignored. */
|
|
664
|
+
receive(message) {
|
|
665
|
+
if (this.failure || message?.source !== "math.gl/tasks")
|
|
666
|
+
return;
|
|
667
|
+
if (message.kind === "failure") {
|
|
668
|
+
const reason = new Error(message.error?.message ?? "Task channel failed");
|
|
669
|
+
this.close(reason);
|
|
670
|
+
this.options.onFailure?.(reason);
|
|
671
|
+
} else if (message.kind === "result" || message.kind === "error") {
|
|
672
|
+
const pending2 = this.pending.get(message.id);
|
|
673
|
+
if (!pending2)
|
|
674
|
+
return;
|
|
675
|
+
this.pending.delete(message.id);
|
|
676
|
+
pending2.cleanup();
|
|
677
|
+
if (message.kind === "result")
|
|
678
|
+
pending2.resolve(message.value);
|
|
679
|
+
else {
|
|
680
|
+
const error = new TaskRequestError(message.error?.message ?? "Task request failed");
|
|
681
|
+
error.name = message.error?.name ?? "Error";
|
|
682
|
+
pending2.reject(error);
|
|
683
|
+
}
|
|
684
|
+
} else if (message.kind === "cancel") {
|
|
685
|
+
this.incoming.get(message.id)?.abort(new DOMException("Task request cancelled", "AbortError"));
|
|
686
|
+
} else if (message.kind === "event") {
|
|
687
|
+
try {
|
|
688
|
+
this.options.handleEvent?.(message.operation, message.value);
|
|
689
|
+
} catch (error) {
|
|
690
|
+
this.fail(error);
|
|
691
|
+
}
|
|
692
|
+
} else if (message.kind === "request") {
|
|
693
|
+
if (this.incoming.has(message.id)) {
|
|
694
|
+
this.fail(new Error("Duplicate task request identifier"));
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
const controller = new AbortController();
|
|
698
|
+
this.incoming.set(message.id, controller);
|
|
699
|
+
void Promise.resolve().then(() => {
|
|
700
|
+
controller.signal.throwIfAborted();
|
|
701
|
+
return this.options.handleRequest(message.operation, message.value, controller.signal);
|
|
702
|
+
}).then((value) => {
|
|
703
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
704
|
+
this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value }, this.options.getResultTransferList?.(value, message.value));
|
|
705
|
+
}
|
|
706
|
+
}).catch((reason) => {
|
|
707
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
708
|
+
this.send({
|
|
709
|
+
source: "math.gl/tasks",
|
|
710
|
+
kind: "error",
|
|
711
|
+
id: message.id,
|
|
712
|
+
error: {
|
|
713
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
714
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
}).finally(() => this.incoming.delete(message.id));
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
/** Reject all outstanding calls with a common cause and abort incoming callbacks. */
|
|
722
|
+
close(reason = new Error("Task channel closed")) {
|
|
723
|
+
if (this.failure)
|
|
724
|
+
return;
|
|
725
|
+
this.failure = { reason };
|
|
726
|
+
for (const pending2 of this.pending.values()) {
|
|
727
|
+
pending2.cleanup();
|
|
728
|
+
pending2.reject(reason);
|
|
729
|
+
}
|
|
730
|
+
this.pending.clear();
|
|
731
|
+
for (const controller of this.incoming.values())
|
|
732
|
+
controller.abort(reason);
|
|
733
|
+
this.incoming.clear();
|
|
734
|
+
}
|
|
735
|
+
send(message, transfer = []) {
|
|
736
|
+
if (this.failure)
|
|
737
|
+
return;
|
|
738
|
+
try {
|
|
739
|
+
this.options.send(message, transfer);
|
|
740
|
+
} catch (error) {
|
|
741
|
+
this.fail(error);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
/** Invalidate the channel and notify the peer when the transport still works. */
|
|
745
|
+
fail(reason) {
|
|
746
|
+
if (this.failure)
|
|
747
|
+
return;
|
|
748
|
+
this.close(reason);
|
|
749
|
+
try {
|
|
750
|
+
this.options.send({
|
|
751
|
+
source: "math.gl/tasks",
|
|
752
|
+
kind: "failure",
|
|
753
|
+
id: 0,
|
|
754
|
+
error: {
|
|
755
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
756
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
757
|
+
}
|
|
758
|
+
}, []);
|
|
759
|
+
} catch {
|
|
760
|
+
}
|
|
761
|
+
this.options.onFailure?.(reason);
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
|
|
618
768
|
function assertPayload(value) {
|
|
619
769
|
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
620
770
|
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
621
771
|
}
|
|
622
772
|
}
|
|
773
|
+
function clonePayload(value, ownership = "copy") {
|
|
774
|
+
assertPayload(value);
|
|
775
|
+
if (!["copy", "transfer", "share"].includes(ownership))
|
|
776
|
+
throw new TypeError("Invalid input ownership");
|
|
777
|
+
const transfer = getTransferList(value);
|
|
778
|
+
if (ownership === "share" && transfer.length)
|
|
779
|
+
throw new TypeError("Share requires shared storage");
|
|
780
|
+
return structuredClone(value, {
|
|
781
|
+
transfer: ownership === "transfer" ? transfer : []
|
|
782
|
+
});
|
|
783
|
+
}
|
|
623
784
|
function taskContext(state, context = {}) {
|
|
624
785
|
const signal = context.signal ?? new AbortController().signal;
|
|
625
786
|
return {
|
|
626
787
|
state,
|
|
627
788
|
signal,
|
|
789
|
+
requestHost: async (operation, payload, controls) => {
|
|
790
|
+
signal.throwIfAborted();
|
|
791
|
+
if (!context.requestHost)
|
|
792
|
+
throw new Error("No host request handler configured");
|
|
793
|
+
return context.requestHost(operation, payload, controls);
|
|
794
|
+
},
|
|
795
|
+
emitHost: (operation, payload) => {
|
|
796
|
+
signal.throwIfAborted();
|
|
797
|
+
context.emitHost?.(operation, payload);
|
|
798
|
+
},
|
|
628
799
|
throwIfAborted: () => {
|
|
629
800
|
signal.throwIfAborted();
|
|
630
801
|
context.throwIfAborted?.();
|
|
@@ -643,6 +814,69 @@
|
|
|
643
814
|
throw new Error("A task is already installed in this worker");
|
|
644
815
|
installed = true;
|
|
645
816
|
const runtime = new TaskRuntime(task);
|
|
817
|
+
let channelStream;
|
|
818
|
+
const channel = new TaskChannel({
|
|
819
|
+
getResultTransferList: (value, request) => request.outputOwnership === "transfer" ? getTransferList(value) : [],
|
|
820
|
+
send: (message, transfer) => {
|
|
821
|
+
const snapshot = structuredClone(message, { transfer });
|
|
822
|
+
void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
|
|
823
|
+
},
|
|
824
|
+
handleRequest: async (operation, value, signal) => {
|
|
825
|
+
const request = value;
|
|
826
|
+
const context = {
|
|
827
|
+
signal,
|
|
828
|
+
reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
|
|
829
|
+
requestHost: (operation2, payload, controls = {}) => {
|
|
830
|
+
const request2 = {
|
|
831
|
+
operation: operation2,
|
|
832
|
+
payload: clonePayload(payload, controls.inputOwnership),
|
|
833
|
+
outputOwnership: controls.outputOwnership ?? "copy"
|
|
834
|
+
};
|
|
835
|
+
return channel.request("task:host-request", request2, signal, getTransferList(request2));
|
|
836
|
+
},
|
|
837
|
+
emitHost: (operation2, payload) => channel.emit("task:host-event", { operation: operation2, payload, id: request.progressId })
|
|
838
|
+
};
|
|
839
|
+
switch (operation) {
|
|
840
|
+
case "initialize":
|
|
841
|
+
return runtime.initialize(request.input, context);
|
|
842
|
+
case "process":
|
|
843
|
+
return runtime.process(request.input, request.options, context);
|
|
844
|
+
case "stream-open": {
|
|
845
|
+
if (channelStream)
|
|
846
|
+
throw new Error("A task stream is already open");
|
|
847
|
+
async function* inputs() {
|
|
848
|
+
while (true) {
|
|
849
|
+
const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
|
|
850
|
+
if (result.done)
|
|
851
|
+
return;
|
|
852
|
+
yield result.value;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
|
|
856
|
+
return {};
|
|
857
|
+
}
|
|
858
|
+
case "stream-next":
|
|
859
|
+
if (!channelStream)
|
|
860
|
+
throw new Error("No active task stream");
|
|
861
|
+
return channelStream.next();
|
|
862
|
+
case "stream-close":
|
|
863
|
+
try {
|
|
864
|
+
await channelStream?.return?.();
|
|
865
|
+
} finally {
|
|
866
|
+
channelStream = void 0;
|
|
867
|
+
}
|
|
868
|
+
return {};
|
|
869
|
+
case "destroy":
|
|
870
|
+
return runtime.destroy();
|
|
871
|
+
default:
|
|
872
|
+
throw new Error("Unknown task channel operation");
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
await WorkerBody.addEventListener((type, payload) => {
|
|
877
|
+
if (type === "task-channel")
|
|
878
|
+
channel.receive(payload);
|
|
879
|
+
});
|
|
646
880
|
let streamOptions = {};
|
|
647
881
|
return createWorker(async (request, _options, context) => {
|
|
648
882
|
switch (request.operation) {
|
|
@@ -674,9 +908,10 @@
|
|
|
674
908
|
}
|
|
675
909
|
var TaskRuntime, installed;
|
|
676
910
|
var init_task_runtime = __esm({
|
|
677
|
-
"../../node_modules/@math.gl/
|
|
911
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
|
|
678
912
|
init_worker_utils();
|
|
679
913
|
init_task_preload();
|
|
914
|
+
init_task_channel();
|
|
680
915
|
TaskRuntime = class {
|
|
681
916
|
constructor(task) {
|
|
682
917
|
this.task = task;
|
|
@@ -727,13 +962,20 @@
|
|
|
727
962
|
}
|
|
728
963
|
});
|
|
729
964
|
|
|
730
|
-
// ../../node_modules/@math.gl/
|
|
965
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/index.js
|
|
731
966
|
var init_tasks = __esm({
|
|
732
|
-
"../../node_modules/@math.gl/
|
|
967
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
|
|
733
968
|
init_task_runtime();
|
|
734
969
|
}
|
|
735
970
|
});
|
|
736
971
|
|
|
972
|
+
// ../../node_modules/@math.gl/tasks/dist/index.js
|
|
973
|
+
var init_dist = __esm({
|
|
974
|
+
"../../node_modules/@math.gl/tasks/dist/index.js"() {
|
|
975
|
+
init_tasks();
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
|
|
737
979
|
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
738
980
|
var worker_threads_browser_exports = {};
|
|
739
981
|
__export(worker_threads_browser_exports, {
|
|
@@ -778,7 +1020,7 @@
|
|
|
778
1020
|
var init_task_runtime2 = __esm({
|
|
779
1021
|
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
780
1022
|
"use strict";
|
|
781
|
-
|
|
1023
|
+
init_dist();
|
|
782
1024
|
initializeTaskWorker2 = initializeTaskWorker;
|
|
783
1025
|
}
|
|
784
1026
|
});
|
|
@@ -1195,7 +1437,7 @@
|
|
|
1195
1437
|
});
|
|
1196
1438
|
|
|
1197
1439
|
// ../../node_modules/@math.gl/core/dist/index.js
|
|
1198
|
-
var
|
|
1440
|
+
var init_dist2 = __esm({
|
|
1199
1441
|
"../../node_modules/@math.gl/core/dist/index.js"() {
|
|
1200
1442
|
init_math_utils();
|
|
1201
1443
|
init_types2();
|
|
@@ -1371,6 +1613,12 @@
|
|
|
1371
1613
|
if (interpolation !== "nearest" && interpolation !== "bilinear" && interpolation !== "triangle") {
|
|
1372
1614
|
throw new Error("Unknown terrain interpolation");
|
|
1373
1615
|
}
|
|
1616
|
+
const domain = options?.domain ?? "samples";
|
|
1617
|
+
const noData = options?.noData ?? "cell";
|
|
1618
|
+
if (domain !== "samples" && domain !== "footprint")
|
|
1619
|
+
throw new Error("Unknown terrain sample domain");
|
|
1620
|
+
if (noData !== "cell" && noData !== "support")
|
|
1621
|
+
throw new Error("Unknown terrain nodata policy");
|
|
1374
1622
|
if (!Number.isFinite(x) || !Number.isFinite(y))
|
|
1375
1623
|
return result;
|
|
1376
1624
|
const dx = x - this.origin[0];
|
|
@@ -1385,11 +1633,23 @@
|
|
|
1385
1633
|
const errorY = 4 * Number.EPSILON * Math.abs(y) + 4 * Number.EPSILON * Math.abs(this.origin[1]);
|
|
1386
1634
|
const toleranceU = tolerance + Math.abs(this.inverse[0]) * errorX + Math.abs(this.inverse[1]) * errorY;
|
|
1387
1635
|
const toleranceV = tolerance + Math.abs(this.inverse[2]) * errorX + Math.abs(this.inverse[3]) * errorY;
|
|
1388
|
-
|
|
1636
|
+
const margin = domain === "footprint" && this.registration === "cell" ? 0.5 : 0;
|
|
1637
|
+
if (u < -margin - toleranceU || v < -margin - toleranceV || u > this.width - 1 + margin + toleranceU || v > this.height - 1 + margin + toleranceV) {
|
|
1389
1638
|
return resetSample(result, TerrainSampleStatus.OUTSIDE_DOMAIN);
|
|
1390
1639
|
}
|
|
1640
|
+
const edgeToleranceU = Math.min(1e-6, toleranceU);
|
|
1641
|
+
const edgeToleranceV = Math.min(1e-6, toleranceV);
|
|
1642
|
+
const clampedColumn = margin > 0 && (u < -edgeToleranceU || u > this.width - 1 + edgeToleranceU);
|
|
1643
|
+
const clampedRow = margin > 0 && (v < -edgeToleranceV || v > this.height - 1 + edgeToleranceV);
|
|
1391
1644
|
u = Math.max(0, Math.min(this.width - 1, u));
|
|
1392
1645
|
v = Math.max(0, Math.min(this.height - 1, v));
|
|
1646
|
+
if (noData === "support" && interpolation === "bilinear") {
|
|
1647
|
+
const column2 = Math.round(u), row2 = Math.round(v);
|
|
1648
|
+
if (Math.abs(u - column2) <= Math.min(1e-6, toleranceU))
|
|
1649
|
+
u = column2;
|
|
1650
|
+
if (Math.abs(v - row2) <= Math.min(1e-6, toleranceV))
|
|
1651
|
+
v = row2;
|
|
1652
|
+
}
|
|
1393
1653
|
if (interpolation === "nearest") {
|
|
1394
1654
|
const value = this.getHeight(Math.floor(u + 0.5), Math.floor(v + 0.5));
|
|
1395
1655
|
if (value === void 0)
|
|
@@ -1415,7 +1675,21 @@
|
|
|
1415
1675
|
let dv;
|
|
1416
1676
|
if (interpolation === "bilinear") {
|
|
1417
1677
|
if (!this.validity[a] || !this.validity[b] || !this.validity[c] || !this.validity[d]) {
|
|
1418
|
-
|
|
1678
|
+
if (noData === "cell")
|
|
1679
|
+
return resetSample(result, TerrainSampleStatus.NO_DATA);
|
|
1680
|
+
const weightA = (1 - u) * (1 - v);
|
|
1681
|
+
const weightB = u * (1 - v);
|
|
1682
|
+
const weightC = (1 - u) * v;
|
|
1683
|
+
const weightD = u * v;
|
|
1684
|
+
if (weightA > 0 && !this.validity[a] || weightB > 0 && !this.validity[b] || weightC > 0 && !this.validity[c] || weightD > 0 && !this.validity[d])
|
|
1685
|
+
return resetSample(result, TerrainSampleStatus.NO_DATA);
|
|
1686
|
+
const height = weightA * za + weightB * zb + weightC * zc + weightD * zd;
|
|
1687
|
+
if (!Number.isFinite(height))
|
|
1688
|
+
return resetSample(result, TerrainSampleStatus.NUMERIC_ERROR);
|
|
1689
|
+
result.status = TerrainSampleStatus.VALID;
|
|
1690
|
+
result.height = height;
|
|
1691
|
+
result.gradientStatus = TerrainSampleStatus.NO_DATA;
|
|
1692
|
+
return result;
|
|
1419
1693
|
}
|
|
1420
1694
|
result.height = (1 - v) * ((1 - u) * za + u * zb) + v * ((1 - u) * zc + u * zd);
|
|
1421
1695
|
du = (1 - v) * (zb - za) + v * (zd - zc);
|
|
@@ -1440,6 +1714,10 @@
|
|
|
1440
1714
|
if (!Number.isFinite(result.height))
|
|
1441
1715
|
return resetSample(result, TerrainSampleStatus.NUMERIC_ERROR);
|
|
1442
1716
|
result.status = TerrainSampleStatus.VALID;
|
|
1717
|
+
if (clampedColumn)
|
|
1718
|
+
du = 0;
|
|
1719
|
+
if (clampedRow)
|
|
1720
|
+
dv = 0;
|
|
1443
1721
|
const gx = du * this.inverse[0] + dv * this.inverse[2];
|
|
1444
1722
|
const gy = du * this.inverse[1] + dv * this.inverse[3];
|
|
1445
1723
|
if (!Number.isFinite(gx) || !Number.isFinite(gy)) {
|
|
@@ -17233,6 +17511,305 @@ return true;`);
|
|
|
17233
17511
|
}
|
|
17234
17512
|
});
|
|
17235
17513
|
|
|
17514
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
|
|
17515
|
+
function getArrowVariadicBuffers(data) {
|
|
17516
|
+
return data.variadicBuffers ?? [];
|
|
17517
|
+
}
|
|
17518
|
+
function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
|
|
17519
|
+
return Reflect.construct(Data, [
|
|
17520
|
+
type,
|
|
17521
|
+
offset,
|
|
17522
|
+
length,
|
|
17523
|
+
nullCount,
|
|
17524
|
+
buffers,
|
|
17525
|
+
children,
|
|
17526
|
+
dictionary,
|
|
17527
|
+
variadicBuffers
|
|
17528
|
+
]);
|
|
17529
|
+
}
|
|
17530
|
+
var init_arrow_data = __esm({
|
|
17531
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
|
|
17532
|
+
init_Arrow_dom();
|
|
17533
|
+
}
|
|
17534
|
+
});
|
|
17535
|
+
|
|
17536
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
|
|
17537
|
+
function splitArrowBuffers(input, options = {}) {
|
|
17538
|
+
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
17539
|
+
if (isArrowTable2(input)) {
|
|
17540
|
+
return splitArrowTableBuffersInternal(input, context);
|
|
17541
|
+
}
|
|
17542
|
+
if (isArrowRecordBatch2(input)) {
|
|
17543
|
+
return splitArrowRecordBatchBuffers(input, context);
|
|
17544
|
+
}
|
|
17545
|
+
if (isArrowVector2(input)) {
|
|
17546
|
+
return splitArrowVectorBuffers(input, context);
|
|
17547
|
+
}
|
|
17548
|
+
return splitArrowDataBuffers(input, context);
|
|
17549
|
+
}
|
|
17550
|
+
function isArrowTable2(input) {
|
|
17551
|
+
return "batches" in input;
|
|
17552
|
+
}
|
|
17553
|
+
function isArrowRecordBatch2(input) {
|
|
17554
|
+
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
17555
|
+
}
|
|
17556
|
+
function isArrowVector2(input) {
|
|
17557
|
+
return "data" in input && Array.isArray(input.data);
|
|
17558
|
+
}
|
|
17559
|
+
function splitArrowTableBuffersInternal(arrowTable, options) {
|
|
17560
|
+
const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
|
|
17561
|
+
return new Table(arrowTable.schema, recordBatches);
|
|
17562
|
+
}
|
|
17563
|
+
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
17564
|
+
return new RecordBatch3(recordBatch.schema, splitArrowDataBuffers(recordBatch.data, options));
|
|
17565
|
+
}
|
|
17566
|
+
function splitArrowDataBuffers(data, options) {
|
|
17567
|
+
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
17568
|
+
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
17569
|
+
const buffers = {
|
|
17570
|
+
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
17571
|
+
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
17572
|
+
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
17573
|
+
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
17574
|
+
};
|
|
17575
|
+
return createArrowData(
|
|
17576
|
+
data.type,
|
|
17577
|
+
data.offset,
|
|
17578
|
+
data.length,
|
|
17579
|
+
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
17580
|
+
data._nullCount,
|
|
17581
|
+
buffers,
|
|
17582
|
+
children,
|
|
17583
|
+
dictionary,
|
|
17584
|
+
getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
|
|
17585
|
+
);
|
|
17586
|
+
}
|
|
17587
|
+
function splitArrowVectorBuffers(vector, options) {
|
|
17588
|
+
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
17589
|
+
}
|
|
17590
|
+
function splitArrowBuffer(array, options) {
|
|
17591
|
+
if (!isArrowTypedArray(array)) {
|
|
17592
|
+
return array;
|
|
17593
|
+
}
|
|
17594
|
+
if (options.copy === "none") {
|
|
17595
|
+
return array;
|
|
17596
|
+
}
|
|
17597
|
+
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
17598
|
+
return array;
|
|
17599
|
+
}
|
|
17600
|
+
let copy = options.copies.get(array);
|
|
17601
|
+
if (!copy) {
|
|
17602
|
+
copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
|
|
17603
|
+
options.copies.set(array, copy);
|
|
17604
|
+
}
|
|
17605
|
+
return copy;
|
|
17606
|
+
}
|
|
17607
|
+
function isArrowTypedArray(value) {
|
|
17608
|
+
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
17609
|
+
}
|
|
17610
|
+
var init_split_arrow_buffers = __esm({
|
|
17611
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
|
|
17612
|
+
init_Arrow_dom();
|
|
17613
|
+
init_arrow_data();
|
|
17614
|
+
}
|
|
17615
|
+
});
|
|
17616
|
+
|
|
17617
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
|
|
17618
|
+
var init_indexed_arrow_vector = __esm({
|
|
17619
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
|
|
17620
|
+
}
|
|
17621
|
+
});
|
|
17622
|
+
|
|
17623
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
|
|
17624
|
+
var init_indexed_arrow_table = __esm({
|
|
17625
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
|
|
17626
|
+
}
|
|
17627
|
+
});
|
|
17628
|
+
|
|
17629
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
|
|
17630
|
+
var init_mapped_arrow_table = __esm({
|
|
17631
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
|
|
17632
|
+
}
|
|
17633
|
+
});
|
|
17634
|
+
|
|
17635
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
|
|
17636
|
+
var init_rename_arrow_columns = __esm({
|
|
17637
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
|
|
17638
|
+
}
|
|
17639
|
+
});
|
|
17640
|
+
|
|
17641
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
|
|
17642
|
+
function dehydrateArrowTable(arrowTable, options) {
|
|
17643
|
+
const splitTable = splitArrowBuffers(arrowTable, options);
|
|
17644
|
+
return {
|
|
17645
|
+
transport: "arrow-js",
|
|
17646
|
+
version: 1,
|
|
17647
|
+
schema: tableToIPC(new Table(splitTable.schema, [])),
|
|
17648
|
+
metadataVersion: splitTable.schema.metadataVersion,
|
|
17649
|
+
batches: splitTable.batches.map((batch) => dehydrateArrowData(batch.data))
|
|
17650
|
+
};
|
|
17651
|
+
}
|
|
17652
|
+
function hydrateArrowTable(table) {
|
|
17653
|
+
if (table.transport !== "arrow-js" || table.version !== 1) {
|
|
17654
|
+
throw new Error("Unsupported Arrow column-buffer transport protocol.");
|
|
17655
|
+
}
|
|
17656
|
+
const decodedSchema = tableFromIPC(table.schema).schema;
|
|
17657
|
+
const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
|
|
17658
|
+
const type = new Struct(schema.fields);
|
|
17659
|
+
const batches = table.batches.map((data) => new RecordBatch3(schema, hydrateArrowData(data, type)));
|
|
17660
|
+
return new Table(schema, batches);
|
|
17661
|
+
}
|
|
17662
|
+
function dehydrateArrowData(data) {
|
|
17663
|
+
return {
|
|
17664
|
+
offset: data.offset,
|
|
17665
|
+
length: data.length,
|
|
17666
|
+
nullCount: data.nullCount,
|
|
17667
|
+
buffers: {
|
|
17668
|
+
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
17669
|
+
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
17670
|
+
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
17671
|
+
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
17672
|
+
},
|
|
17673
|
+
children: data.children.map((child) => dehydrateArrowData(child)),
|
|
17674
|
+
variadicBuffers: getArrowVariadicBuffers(data),
|
|
17675
|
+
dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
|
|
17676
|
+
};
|
|
17677
|
+
}
|
|
17678
|
+
function hydrateArrowData(data, type) {
|
|
17679
|
+
const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
|
|
17680
|
+
const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
|
|
17681
|
+
return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
|
|
17682
|
+
}
|
|
17683
|
+
var init_arrow_table_transport = __esm({
|
|
17684
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
|
|
17685
|
+
init_Arrow_dom();
|
|
17686
|
+
init_arrow_data();
|
|
17687
|
+
init_split_arrow_buffers();
|
|
17688
|
+
}
|
|
17689
|
+
});
|
|
17690
|
+
|
|
17691
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/index.js
|
|
17692
|
+
var init_arrow = __esm({
|
|
17693
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
|
|
17694
|
+
init_indexed_arrow_table();
|
|
17695
|
+
init_indexed_arrow_vector();
|
|
17696
|
+
init_mapped_arrow_table();
|
|
17697
|
+
init_rename_arrow_columns();
|
|
17698
|
+
init_split_arrow_buffers();
|
|
17699
|
+
init_arrow_table_transport();
|
|
17700
|
+
}
|
|
17701
|
+
});
|
|
17702
|
+
|
|
17703
|
+
// ../../node_modules/@math.gl/arrow/dist/index.js
|
|
17704
|
+
var init_dist3 = __esm({
|
|
17705
|
+
"../../node_modules/@math.gl/arrow/dist/index.js"() {
|
|
17706
|
+
init_arrow();
|
|
17707
|
+
}
|
|
17708
|
+
});
|
|
17709
|
+
|
|
17710
|
+
// ../core/src/arrow-worker-transport.ts
|
|
17711
|
+
function serializeArrowWorkerResult(result, options) {
|
|
17712
|
+
if (!isArrowTableWrapper(result)) {
|
|
17713
|
+
return result;
|
|
17714
|
+
}
|
|
17715
|
+
const workerOptions = options;
|
|
17716
|
+
const bufferCopyMode = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
|
|
17717
|
+
return {
|
|
17718
|
+
...result,
|
|
17719
|
+
data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
|
|
17720
|
+
};
|
|
17721
|
+
}
|
|
17722
|
+
function deserializeArrowWorkerResult(result) {
|
|
17723
|
+
if (!isDehydratedArrowTableWrapper(result)) {
|
|
17724
|
+
return result;
|
|
17725
|
+
}
|
|
17726
|
+
return { ...result, data: hydrateArrowTable(result.data) };
|
|
17727
|
+
}
|
|
17728
|
+
function isArrowTableWrapper(value) {
|
|
17729
|
+
const table = value;
|
|
17730
|
+
return Boolean(
|
|
17731
|
+
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
17732
|
+
);
|
|
17733
|
+
}
|
|
17734
|
+
function isDehydratedArrowTableWrapper(value) {
|
|
17735
|
+
const table = value;
|
|
17736
|
+
return Boolean(
|
|
17737
|
+
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
17738
|
+
);
|
|
17739
|
+
}
|
|
17740
|
+
var init_arrow_worker_transport = __esm({
|
|
17741
|
+
"../core/src/arrow-worker-transport.ts"() {
|
|
17742
|
+
"use strict";
|
|
17743
|
+
init_dist3();
|
|
17744
|
+
}
|
|
17745
|
+
});
|
|
17746
|
+
|
|
17747
|
+
// ../core/src/schema-utils/lib/schema/data-type.ts
|
|
17748
|
+
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
17749
|
+
if (value instanceof Date) {
|
|
17750
|
+
return "date-millisecond";
|
|
17751
|
+
}
|
|
17752
|
+
if (typeof value === "number") {
|
|
17753
|
+
return defaultNumberType;
|
|
17754
|
+
}
|
|
17755
|
+
if (typeof value === "boolean") {
|
|
17756
|
+
return "bool";
|
|
17757
|
+
}
|
|
17758
|
+
if (typeof value === "string") {
|
|
17759
|
+
return "utf8";
|
|
17760
|
+
}
|
|
17761
|
+
if (value === null || value === "undefined") {
|
|
17762
|
+
return "null";
|
|
17763
|
+
}
|
|
17764
|
+
return "null";
|
|
17765
|
+
}
|
|
17766
|
+
function getDataTypeFromArray(array) {
|
|
17767
|
+
let type = getDataTypeFromTypedArray(array);
|
|
17768
|
+
if (type !== "null") {
|
|
17769
|
+
return { type, nullable: false };
|
|
17770
|
+
}
|
|
17771
|
+
if (array.length > 0) {
|
|
17772
|
+
type = getDataTypeFromValue(array[0]);
|
|
17773
|
+
return { type, nullable: true };
|
|
17774
|
+
}
|
|
17775
|
+
return { type: "null", nullable: true };
|
|
17776
|
+
}
|
|
17777
|
+
function getDataTypeFromTypedArray(array) {
|
|
17778
|
+
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
17779
|
+
return "float16";
|
|
17780
|
+
}
|
|
17781
|
+
switch (array.constructor) {
|
|
17782
|
+
case Int8Array:
|
|
17783
|
+
return "int8";
|
|
17784
|
+
case Uint8Array:
|
|
17785
|
+
case Uint8ClampedArray:
|
|
17786
|
+
return "uint8";
|
|
17787
|
+
case Int16Array:
|
|
17788
|
+
return "int16";
|
|
17789
|
+
case Uint16Array:
|
|
17790
|
+
return "uint16";
|
|
17791
|
+
case Int32Array:
|
|
17792
|
+
return "int32";
|
|
17793
|
+
case Uint32Array:
|
|
17794
|
+
return "uint32";
|
|
17795
|
+
case BigInt64Array:
|
|
17796
|
+
return "int64";
|
|
17797
|
+
case BigUint64Array:
|
|
17798
|
+
return "uint64";
|
|
17799
|
+
case Float32Array:
|
|
17800
|
+
return "float32";
|
|
17801
|
+
case Float64Array:
|
|
17802
|
+
return "float64";
|
|
17803
|
+
default:
|
|
17804
|
+
return "null";
|
|
17805
|
+
}
|
|
17806
|
+
}
|
|
17807
|
+
var init_data_type = __esm({
|
|
17808
|
+
"../core/src/schema-utils/lib/schema/data-type.ts"() {
|
|
17809
|
+
"use strict";
|
|
17810
|
+
}
|
|
17811
|
+
});
|
|
17812
|
+
|
|
17236
17813
|
// ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
|
|
17237
17814
|
function serializeArrowSchema(arrowSchema) {
|
|
17238
17815
|
return {
|
|
@@ -17240,12 +17817,6 @@ return true;`);
|
|
|
17240
17817
|
metadata: serializeArrowMetadata(arrowSchema.metadata)
|
|
17241
17818
|
};
|
|
17242
17819
|
}
|
|
17243
|
-
function deserializeArrowSchema(schema, options) {
|
|
17244
|
-
return new Schema2(
|
|
17245
|
-
schema.fields.map((field) => deserializeArrowField(field, options)),
|
|
17246
|
-
deserializeArrowMetadata(schema.metadata)
|
|
17247
|
-
);
|
|
17248
|
-
}
|
|
17249
17820
|
function serializeArrowMetadata(arrowMetadata) {
|
|
17250
17821
|
return Object.fromEntries(arrowMetadata);
|
|
17251
17822
|
}
|
|
@@ -17668,260 +18239,6 @@ return true;`);
|
|
|
17668
18239
|
}
|
|
17669
18240
|
});
|
|
17670
18241
|
|
|
17671
|
-
// ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
|
|
17672
|
-
function splitArrowBuffers(input, options = {}) {
|
|
17673
|
-
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
17674
|
-
if (isArrowTable2(input)) {
|
|
17675
|
-
return splitArrowTableBuffersInternal(input, context);
|
|
17676
|
-
}
|
|
17677
|
-
if (isArrowRecordBatch2(input)) {
|
|
17678
|
-
return splitArrowRecordBatchBuffers(input, context);
|
|
17679
|
-
}
|
|
17680
|
-
if (isArrowVector2(input)) {
|
|
17681
|
-
return splitArrowVectorBuffers(input, context);
|
|
17682
|
-
}
|
|
17683
|
-
return splitArrowDataBuffers(input, context);
|
|
17684
|
-
}
|
|
17685
|
-
function isArrowTable2(input) {
|
|
17686
|
-
return "batches" in input;
|
|
17687
|
-
}
|
|
17688
|
-
function isArrowRecordBatch2(input) {
|
|
17689
|
-
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
17690
|
-
}
|
|
17691
|
-
function isArrowVector2(input) {
|
|
17692
|
-
return "data" in input && Array.isArray(input.data);
|
|
17693
|
-
}
|
|
17694
|
-
function splitArrowTableBuffersInternal(table, options) {
|
|
17695
|
-
const recordBatches = table.batches.map(
|
|
17696
|
-
(recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
|
|
17697
|
-
);
|
|
17698
|
-
return new Table(table.schema, recordBatches);
|
|
17699
|
-
}
|
|
17700
|
-
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
17701
|
-
return new RecordBatch3(
|
|
17702
|
-
recordBatch.schema,
|
|
17703
|
-
splitArrowDataBuffers(recordBatch.data, options)
|
|
17704
|
-
);
|
|
17705
|
-
}
|
|
17706
|
-
function splitArrowDataBuffers(data, options) {
|
|
17707
|
-
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
17708
|
-
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
17709
|
-
const buffers = {
|
|
17710
|
-
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
17711
|
-
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
17712
|
-
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
17713
|
-
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
17714
|
-
};
|
|
17715
|
-
return new Data(
|
|
17716
|
-
data.type,
|
|
17717
|
-
data.offset,
|
|
17718
|
-
data.length,
|
|
17719
|
-
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
17720
|
-
data._nullCount,
|
|
17721
|
-
buffers,
|
|
17722
|
-
children,
|
|
17723
|
-
dictionary
|
|
17724
|
-
);
|
|
17725
|
-
}
|
|
17726
|
-
function splitArrowVectorBuffers(vector, options) {
|
|
17727
|
-
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
17728
|
-
}
|
|
17729
|
-
function splitArrowBuffer(array, options) {
|
|
17730
|
-
if (!isArrowTypedArray(array)) {
|
|
17731
|
-
return array;
|
|
17732
|
-
}
|
|
17733
|
-
if (options.copy === "none") {
|
|
17734
|
-
return array;
|
|
17735
|
-
}
|
|
17736
|
-
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
17737
|
-
return array;
|
|
17738
|
-
}
|
|
17739
|
-
let copy = options.copies.get(array);
|
|
17740
|
-
if (!copy) {
|
|
17741
|
-
copy = array.slice();
|
|
17742
|
-
options.copies.set(array, copy);
|
|
17743
|
-
}
|
|
17744
|
-
return copy;
|
|
17745
|
-
}
|
|
17746
|
-
function isArrowTypedArray(value) {
|
|
17747
|
-
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
17748
|
-
}
|
|
17749
|
-
var init_split_arrow_buffers = __esm({
|
|
17750
|
-
"../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
|
|
17751
|
-
"use strict";
|
|
17752
|
-
init_Arrow_dom();
|
|
17753
|
-
}
|
|
17754
|
-
});
|
|
17755
|
-
|
|
17756
|
-
// ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
|
|
17757
|
-
function dehydrateArrowTable(table, options) {
|
|
17758
|
-
const splitTable = splitArrowBuffers(table, options);
|
|
17759
|
-
return {
|
|
17760
|
-
shape: "arrow-table",
|
|
17761
|
-
transport: "arrow-js",
|
|
17762
|
-
schema: serializeArrowSchema(splitTable.schema),
|
|
17763
|
-
batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
|
|
17764
|
-
};
|
|
17765
|
-
}
|
|
17766
|
-
function hydrateArrowTable(table) {
|
|
17767
|
-
const schema = deserializeArrowSchema(table.schema);
|
|
17768
|
-
const recordBatches = table.batches.map(
|
|
17769
|
-
(recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
|
|
17770
|
-
);
|
|
17771
|
-
return new Table(schema, recordBatches);
|
|
17772
|
-
}
|
|
17773
|
-
function serializeArrowWorkerResult(result, options) {
|
|
17774
|
-
if (!isArrowTableWrapper(result)) {
|
|
17775
|
-
return result;
|
|
17776
|
-
}
|
|
17777
|
-
const workerOptions = options;
|
|
17778
|
-
const bufferCopyMode = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
|
|
17779
|
-
return {
|
|
17780
|
-
...result,
|
|
17781
|
-
data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
|
|
17782
|
-
};
|
|
17783
|
-
}
|
|
17784
|
-
function deserializeArrowWorkerResult(result) {
|
|
17785
|
-
if (!isDehydratedArrowTableWrapper(result)) {
|
|
17786
|
-
return result;
|
|
17787
|
-
}
|
|
17788
|
-
return { ...result, data: hydrateArrowTable(result.data) };
|
|
17789
|
-
}
|
|
17790
|
-
function isArrowTableWrapper(value) {
|
|
17791
|
-
const table = value;
|
|
17792
|
-
return Boolean(
|
|
17793
|
-
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
17794
|
-
);
|
|
17795
|
-
}
|
|
17796
|
-
function isDehydratedArrowTableWrapper(value) {
|
|
17797
|
-
const table = value;
|
|
17798
|
-
return Boolean(
|
|
17799
|
-
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
17800
|
-
);
|
|
17801
|
-
}
|
|
17802
|
-
function dehydrateArrowRecordBatch(recordBatch) {
|
|
17803
|
-
return { data: dehydrateArrowData(recordBatch.data) };
|
|
17804
|
-
}
|
|
17805
|
-
function dehydrateArrowData(data) {
|
|
17806
|
-
return {
|
|
17807
|
-
type: serializeArrowType(data.type),
|
|
17808
|
-
offset: data.offset,
|
|
17809
|
-
length: data.length,
|
|
17810
|
-
// @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
|
|
17811
|
-
nullCount: data._nullCount,
|
|
17812
|
-
buffers: {
|
|
17813
|
-
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
17814
|
-
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
17815
|
-
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
17816
|
-
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
17817
|
-
},
|
|
17818
|
-
children: data.children.map((childData) => dehydrateArrowData(childData)),
|
|
17819
|
-
dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
|
|
17820
|
-
};
|
|
17821
|
-
}
|
|
17822
|
-
function dehydrateArrowVector(vector) {
|
|
17823
|
-
return { data: vector.data.map((data) => dehydrateArrowData(data)) };
|
|
17824
|
-
}
|
|
17825
|
-
function hydrateArrowData(data) {
|
|
17826
|
-
const children = data.children.map((childData) => hydrateArrowData(childData));
|
|
17827
|
-
const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
|
|
17828
|
-
return new Data(
|
|
17829
|
-
deserializeArrowType(data.type),
|
|
17830
|
-
data.offset,
|
|
17831
|
-
data.length,
|
|
17832
|
-
data.nullCount,
|
|
17833
|
-
data.buffers,
|
|
17834
|
-
children,
|
|
17835
|
-
dictionary
|
|
17836
|
-
);
|
|
17837
|
-
}
|
|
17838
|
-
function hydrateArrowVector(vector) {
|
|
17839
|
-
return new Vector(vector.data.map((data) => hydrateArrowData(data)));
|
|
17840
|
-
}
|
|
17841
|
-
var init_arrow_table_transport = __esm({
|
|
17842
|
-
"../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
|
|
17843
|
-
"use strict";
|
|
17844
|
-
init_Arrow_dom();
|
|
17845
|
-
init_convert_arrow_schema();
|
|
17846
|
-
init_split_arrow_buffers();
|
|
17847
|
-
}
|
|
17848
|
-
});
|
|
17849
|
-
|
|
17850
|
-
// ../core/src/schema-utils/arrow-transport.ts
|
|
17851
|
-
var init_arrow_transport = __esm({
|
|
17852
|
-
"../core/src/schema-utils/arrow-transport.ts"() {
|
|
17853
|
-
"use strict";
|
|
17854
|
-
init_arrow_table_transport();
|
|
17855
|
-
init_split_arrow_buffers();
|
|
17856
|
-
}
|
|
17857
|
-
});
|
|
17858
|
-
|
|
17859
|
-
// ../core/src/schema-utils/lib/schema/data-type.ts
|
|
17860
|
-
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
17861
|
-
if (value instanceof Date) {
|
|
17862
|
-
return "date-millisecond";
|
|
17863
|
-
}
|
|
17864
|
-
if (typeof value === "number") {
|
|
17865
|
-
return defaultNumberType;
|
|
17866
|
-
}
|
|
17867
|
-
if (typeof value === "boolean") {
|
|
17868
|
-
return "bool";
|
|
17869
|
-
}
|
|
17870
|
-
if (typeof value === "string") {
|
|
17871
|
-
return "utf8";
|
|
17872
|
-
}
|
|
17873
|
-
if (value === null || value === "undefined") {
|
|
17874
|
-
return "null";
|
|
17875
|
-
}
|
|
17876
|
-
return "null";
|
|
17877
|
-
}
|
|
17878
|
-
function getDataTypeFromArray(array) {
|
|
17879
|
-
let type = getDataTypeFromTypedArray(array);
|
|
17880
|
-
if (type !== "null") {
|
|
17881
|
-
return { type, nullable: false };
|
|
17882
|
-
}
|
|
17883
|
-
if (array.length > 0) {
|
|
17884
|
-
type = getDataTypeFromValue(array[0]);
|
|
17885
|
-
return { type, nullable: true };
|
|
17886
|
-
}
|
|
17887
|
-
return { type: "null", nullable: true };
|
|
17888
|
-
}
|
|
17889
|
-
function getDataTypeFromTypedArray(array) {
|
|
17890
|
-
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
17891
|
-
return "float16";
|
|
17892
|
-
}
|
|
17893
|
-
switch (array.constructor) {
|
|
17894
|
-
case Int8Array:
|
|
17895
|
-
return "int8";
|
|
17896
|
-
case Uint8Array:
|
|
17897
|
-
case Uint8ClampedArray:
|
|
17898
|
-
return "uint8";
|
|
17899
|
-
case Int16Array:
|
|
17900
|
-
return "int16";
|
|
17901
|
-
case Uint16Array:
|
|
17902
|
-
return "uint16";
|
|
17903
|
-
case Int32Array:
|
|
17904
|
-
return "int32";
|
|
17905
|
-
case Uint32Array:
|
|
17906
|
-
return "uint32";
|
|
17907
|
-
case BigInt64Array:
|
|
17908
|
-
return "int64";
|
|
17909
|
-
case BigUint64Array:
|
|
17910
|
-
return "uint64";
|
|
17911
|
-
case Float32Array:
|
|
17912
|
-
return "float32";
|
|
17913
|
-
case Float64Array:
|
|
17914
|
-
return "float64";
|
|
17915
|
-
default:
|
|
17916
|
-
return "null";
|
|
17917
|
-
}
|
|
17918
|
-
}
|
|
17919
|
-
var init_data_type = __esm({
|
|
17920
|
-
"../core/src/schema-utils/lib/schema/data-type.ts"() {
|
|
17921
|
-
"use strict";
|
|
17922
|
-
}
|
|
17923
|
-
});
|
|
17924
|
-
|
|
17925
18242
|
// ../core/src/schema-utils/lib/mesh/mesh-utils.ts
|
|
17926
18243
|
function getMeshBoundingBox(attributes) {
|
|
17927
18244
|
const positionAttribute = attributes?.POSITION;
|
|
@@ -18023,7 +18340,7 @@ return true;`);
|
|
|
18023
18340
|
var init_float162 = __esm({
|
|
18024
18341
|
"../core/src/schema/float16.ts"() {
|
|
18025
18342
|
"use strict";
|
|
18026
|
-
|
|
18343
|
+
init_dist2();
|
|
18027
18344
|
}
|
|
18028
18345
|
});
|
|
18029
18346
|
|
|
@@ -18731,7 +19048,7 @@ return true;`);
|
|
|
18731
19048
|
var init_version = __esm({
|
|
18732
19049
|
"../images/src/lib/utils/version.ts"() {
|
|
18733
19050
|
"use strict";
|
|
18734
|
-
VERSION = true ? "5.0.0-beta.
|
|
19051
|
+
VERSION = true ? "5.0.0-beta.5" : "latest";
|
|
18735
19052
|
}
|
|
18736
19053
|
});
|
|
18737
19054
|
|
|
@@ -19322,7 +19639,7 @@ return true;`);
|
|
|
19322
19639
|
var init_version2 = __esm({
|
|
19323
19640
|
"src/terrain/lib/utils/version.ts"() {
|
|
19324
19641
|
"use strict";
|
|
19325
|
-
VERSION2 = true ? "5.0.0-beta.
|
|
19642
|
+
VERSION2 = true ? "5.0.0-beta.5" : "latest";
|
|
19326
19643
|
}
|
|
19327
19644
|
});
|
|
19328
19645
|
|
|
@@ -19426,7 +19743,7 @@ return true;`);
|
|
|
19426
19743
|
var init_terrain_loader2 = __esm({
|
|
19427
19744
|
"src/terrain/terrain-loader.ts"() {
|
|
19428
19745
|
"use strict";
|
|
19429
|
-
|
|
19746
|
+
init_arrow_worker_transport();
|
|
19430
19747
|
init_loader_utils();
|
|
19431
19748
|
init_schema_utils();
|
|
19432
19749
|
init_src();
|