@loaders.gl/raster 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/README.md +1 -1
- package/THIRD-PARTY-NOTICES.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 +985 -368
- package/dist/terrain/index.cjs +26 -525
- package/dist/terrain/index.cjs.map +4 -4
- package/dist/terrain/lib/parse-terrain.d.ts +2 -0
- package/dist/terrain/lib/parse-terrain.d.ts.map +1 -1
- package/dist/terrain/lib/parse-terrain.js +23 -38
- package/dist/terrain/lib/parse-terrain.js.map +1 -1
- package/dist/terrain/lib/utils/version.js +1 -1
- package/dist/terrain/quantized-mesh-loader.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 +16699 -15463
- package/package.json +6 -7
- package/src/terrain/lib/parse-terrain.ts +36 -40
- package/src/terrain/quantized-mesh-loader.ts +1 -1
- package/src/terrain/terrain-loader.ts +1 -1
- package/dist/terrain/libs/README.md +0 -10
- package/dist/terrain/libs/martini-LICENSE +0 -15
- package/dist/terrain/libs/martini.d.mts +0 -19
- package/dist/terrain/libs/martini.mjs +0 -164
- package/src/terrain/libs/README.md +0 -10
- package/src/terrain/libs/martini-LICENSE +0 -15
- package/src/terrain/libs/martini.d.mts +0 -19
- package/src/terrain/libs/martini.mjs +0 -164
|
@@ -15,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, preload) {
|
|
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 preload?.();
|
|
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,
|
|
@@ -815,7 +1393,7 @@
|
|
|
815
1393
|
});
|
|
816
1394
|
|
|
817
1395
|
// ../../node_modules/@math.gl/core/dist/index.js
|
|
818
|
-
var
|
|
1396
|
+
var init_dist2 = __esm({
|
|
819
1397
|
"../../node_modules/@math.gl/core/dist/index.js"() {
|
|
820
1398
|
init_math_utils();
|
|
821
1399
|
init_types2();
|
|
@@ -8487,11 +9065,11 @@ return true;`);
|
|
|
8487
9065
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8488
9066
|
}
|
|
8489
9067
|
setValue(index, value) {
|
|
8490
|
-
const
|
|
8491
|
-
const current =
|
|
9068
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
9069
|
+
const current = pending2.get(index);
|
|
8492
9070
|
current && (this._pendingLength -= current.length);
|
|
8493
9071
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8494
|
-
|
|
9072
|
+
pending2.set(index, value);
|
|
8495
9073
|
}
|
|
8496
9074
|
setValid(index, isValid) {
|
|
8497
9075
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8514,12 +9092,12 @@ return true;`);
|
|
|
8514
9092
|
return super.finish();
|
|
8515
9093
|
}
|
|
8516
9094
|
_flush() {
|
|
8517
|
-
const
|
|
9095
|
+
const pending2 = this._pending;
|
|
8518
9096
|
const pendingLength = this._pendingLength;
|
|
8519
9097
|
this._pendingLength = 0;
|
|
8520
9098
|
this._pending = void 0;
|
|
8521
|
-
if (
|
|
8522
|
-
this._flushPending(
|
|
9099
|
+
if (pending2 && pending2.size > 0) {
|
|
9100
|
+
this._flushPending(pending2, pendingLength);
|
|
8523
9101
|
}
|
|
8524
9102
|
return this;
|
|
8525
9103
|
}
|
|
@@ -11105,11 +11683,11 @@ return true;`);
|
|
|
11105
11683
|
setValue(index, value) {
|
|
11106
11684
|
return super.setValue(index, toUint8Array(value));
|
|
11107
11685
|
}
|
|
11108
|
-
_flushPending(
|
|
11686
|
+
_flushPending(pending2, pendingLength) {
|
|
11109
11687
|
const offsets = this._offsets;
|
|
11110
11688
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11111
11689
|
let offset = 0;
|
|
11112
|
-
for (const [index, value] of
|
|
11690
|
+
for (const [index, value] of pending2) {
|
|
11113
11691
|
if (value === void 0) {
|
|
11114
11692
|
offsets.set(index, 0);
|
|
11115
11693
|
} else {
|
|
@@ -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, BigInt(0));
|
|
11156
11734
|
} else {
|
|
@@ -11461,10 +12039,10 @@ return true;`);
|
|
|
11461
12039
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11462
12040
|
return this.numChildren - 1;
|
|
11463
12041
|
}
|
|
11464
|
-
_flushPending(
|
|
12042
|
+
_flushPending(pending2) {
|
|
11465
12043
|
const offsets = this._offsets;
|
|
11466
12044
|
const [child] = this.children;
|
|
11467
|
-
for (const [index, value] of
|
|
12045
|
+
for (const [index, value] of pending2) {
|
|
11468
12046
|
if (typeof value === "undefined") {
|
|
11469
12047
|
offsets.set(index, 0);
|
|
11470
12048
|
} else {
|
|
@@ -11503,10 +12081,10 @@ return true;`);
|
|
|
11503
12081
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11504
12082
|
return this.numChildren - 1;
|
|
11505
12083
|
}
|
|
11506
|
-
_flushPending(
|
|
12084
|
+
_flushPending(pending2) {
|
|
11507
12085
|
const offsets = this._offsets;
|
|
11508
12086
|
const [child] = this.children;
|
|
11509
|
-
for (const [index, value] of
|
|
12087
|
+
for (const [index, value] of pending2) {
|
|
11510
12088
|
if (typeof value === "undefined") {
|
|
11511
12089
|
offsets.set(index, BigInt(0));
|
|
11512
12090
|
} else {
|
|
@@ -11536,11 +12114,11 @@ return true;`);
|
|
|
11536
12114
|
}
|
|
11537
12115
|
setValue(index, value) {
|
|
11538
12116
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11539
|
-
const
|
|
11540
|
-
const current =
|
|
12117
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
12118
|
+
const current = pending2.get(index);
|
|
11541
12119
|
current && (this._pendingLength -= current.size);
|
|
11542
12120
|
this._pendingLength += row.size;
|
|
11543
|
-
|
|
12121
|
+
pending2.set(index, row);
|
|
11544
12122
|
}
|
|
11545
12123
|
addChild(child, name = `${this.numChildren}`) {
|
|
11546
12124
|
if (this.numChildren > 0) {
|
|
@@ -11550,10 +12128,10 @@ return true;`);
|
|
|
11550
12128
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11551
12129
|
return this.numChildren - 1;
|
|
11552
12130
|
}
|
|
11553
|
-
_flushPending(
|
|
12131
|
+
_flushPending(pending2) {
|
|
11554
12132
|
const offsets = this._offsets;
|
|
11555
12133
|
const [child] = this.children;
|
|
11556
|
-
for (const [index, value] of
|
|
12134
|
+
for (const [index, value] of pending2) {
|
|
11557
12135
|
if (value === void 0) {
|
|
11558
12136
|
offsets.set(index, 0);
|
|
11559
12137
|
} else {
|
|
@@ -11762,7 +12340,7 @@ return true;`);
|
|
|
11762
12340
|
return super.setValue(index, encodeUtf8(value));
|
|
11763
12341
|
}
|
|
11764
12342
|
// @ts-ignore
|
|
11765
|
-
_flushPending(
|
|
12343
|
+
_flushPending(pending2, pendingLength) {
|
|
11766
12344
|
}
|
|
11767
12345
|
};
|
|
11768
12346
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -11793,7 +12371,7 @@ return true;`);
|
|
|
11793
12371
|
return super.setValue(index, encodeUtf8(value));
|
|
11794
12372
|
}
|
|
11795
12373
|
// @ts-ignore
|
|
11796
|
-
_flushPending(
|
|
12374
|
+
_flushPending(pending2, pendingLength) {
|
|
11797
12375
|
}
|
|
11798
12376
|
};
|
|
11799
12377
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -13505,8 +14083,8 @@ return true;`);
|
|
|
13505
14083
|
});
|
|
13506
14084
|
|
|
13507
14085
|
// ../../node_modules/apache-arrow/ipc/reader.mjs
|
|
13508
|
-
function shouldAutoDestroy(
|
|
13509
|
-
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] :
|
|
14086
|
+
function shouldAutoDestroy(self2, options) {
|
|
14087
|
+
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
|
|
13510
14088
|
}
|
|
13511
14089
|
function* readAllSync(source) {
|
|
13512
14090
|
const reader = RecordBatchReader.from(source);
|
|
@@ -15737,53 +16315,346 @@ return true;`);
|
|
|
15737
16315
|
}
|
|
15738
16316
|
});
|
|
15739
16317
|
|
|
15740
|
-
//
|
|
15741
|
-
function
|
|
15742
|
-
return
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
16318
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
|
|
16319
|
+
function getArrowVariadicBuffers(data) {
|
|
16320
|
+
return data.variadicBuffers ?? [];
|
|
16321
|
+
}
|
|
16322
|
+
function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
|
|
16323
|
+
return Reflect.construct(Data, [
|
|
16324
|
+
type,
|
|
16325
|
+
offset,
|
|
16326
|
+
length,
|
|
16327
|
+
nullCount,
|
|
16328
|
+
buffers,
|
|
16329
|
+
children,
|
|
16330
|
+
dictionary,
|
|
16331
|
+
variadicBuffers
|
|
16332
|
+
]);
|
|
15746
16333
|
}
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
16334
|
+
var init_arrow_data = __esm({
|
|
16335
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
|
|
16336
|
+
init_Arrow_dom();
|
|
16337
|
+
}
|
|
16338
|
+
});
|
|
16339
|
+
|
|
16340
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
|
|
16341
|
+
function splitArrowBuffers(input, options = {}) {
|
|
16342
|
+
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
16343
|
+
if (isArrowTable2(input)) {
|
|
16344
|
+
return splitArrowTableBuffersInternal(input, context);
|
|
16345
|
+
}
|
|
16346
|
+
if (isArrowRecordBatch2(input)) {
|
|
16347
|
+
return splitArrowRecordBatchBuffers(input, context);
|
|
16348
|
+
}
|
|
16349
|
+
if (isArrowVector2(input)) {
|
|
16350
|
+
return splitArrowVectorBuffers(input, context);
|
|
16351
|
+
}
|
|
16352
|
+
return splitArrowDataBuffers(input, context);
|
|
15752
16353
|
}
|
|
15753
|
-
function
|
|
15754
|
-
return
|
|
16354
|
+
function isArrowTable2(input) {
|
|
16355
|
+
return "batches" in input;
|
|
15755
16356
|
}
|
|
15756
|
-
function
|
|
15757
|
-
return
|
|
16357
|
+
function isArrowRecordBatch2(input) {
|
|
16358
|
+
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
15758
16359
|
}
|
|
15759
|
-
function
|
|
15760
|
-
return
|
|
15761
|
-
name: field.name,
|
|
15762
|
-
type: serializeArrowType(field.type),
|
|
15763
|
-
nullable: field.nullable,
|
|
15764
|
-
metadata: serializeArrowMetadata(field.metadata)
|
|
15765
|
-
};
|
|
16360
|
+
function isArrowVector2(input) {
|
|
16361
|
+
return "data" in input && Array.isArray(input.data);
|
|
15766
16362
|
}
|
|
15767
|
-
function
|
|
15768
|
-
|
|
15769
|
-
|
|
15770
|
-
|
|
15771
|
-
|
|
15772
|
-
|
|
16363
|
+
function splitArrowTableBuffersInternal(arrowTable, options) {
|
|
16364
|
+
const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
|
|
16365
|
+
return new Table(arrowTable.schema, recordBatches);
|
|
16366
|
+
}
|
|
16367
|
+
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
16368
|
+
return new RecordBatch3(recordBatch.schema, splitArrowDataBuffers(recordBatch.data, options));
|
|
16369
|
+
}
|
|
16370
|
+
function splitArrowDataBuffers(data, options) {
|
|
16371
|
+
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
16372
|
+
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
16373
|
+
const buffers = {
|
|
16374
|
+
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
16375
|
+
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
16376
|
+
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
16377
|
+
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
16378
|
+
};
|
|
16379
|
+
return createArrowData(
|
|
16380
|
+
data.type,
|
|
16381
|
+
data.offset,
|
|
16382
|
+
data.length,
|
|
16383
|
+
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
16384
|
+
data._nullCount,
|
|
16385
|
+
buffers,
|
|
16386
|
+
children,
|
|
16387
|
+
dictionary,
|
|
16388
|
+
getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
|
|
15773
16389
|
);
|
|
15774
16390
|
}
|
|
15775
|
-
function
|
|
15776
|
-
|
|
15777
|
-
|
|
16391
|
+
function splitArrowVectorBuffers(vector, options) {
|
|
16392
|
+
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
16393
|
+
}
|
|
16394
|
+
function splitArrowBuffer(array, options) {
|
|
16395
|
+
if (!isArrowTypedArray(array)) {
|
|
16396
|
+
return array;
|
|
15778
16397
|
}
|
|
15779
|
-
if (
|
|
15780
|
-
return
|
|
16398
|
+
if (options.copy === "none") {
|
|
16399
|
+
return array;
|
|
15781
16400
|
}
|
|
15782
|
-
if (
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
16401
|
+
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
16402
|
+
return array;
|
|
16403
|
+
}
|
|
16404
|
+
let copy = options.copies.get(array);
|
|
16405
|
+
if (!copy) {
|
|
16406
|
+
copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
|
|
16407
|
+
options.copies.set(array, copy);
|
|
16408
|
+
}
|
|
16409
|
+
return copy;
|
|
16410
|
+
}
|
|
16411
|
+
function isArrowTypedArray(value) {
|
|
16412
|
+
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
16413
|
+
}
|
|
16414
|
+
var init_split_arrow_buffers = __esm({
|
|
16415
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
|
|
16416
|
+
init_Arrow_dom();
|
|
16417
|
+
init_arrow_data();
|
|
16418
|
+
}
|
|
16419
|
+
});
|
|
16420
|
+
|
|
16421
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
|
|
16422
|
+
var init_indexed_arrow_vector = __esm({
|
|
16423
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
|
|
16424
|
+
}
|
|
16425
|
+
});
|
|
16426
|
+
|
|
16427
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
|
|
16428
|
+
var init_indexed_arrow_table = __esm({
|
|
16429
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
|
|
16430
|
+
}
|
|
16431
|
+
});
|
|
16432
|
+
|
|
16433
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
|
|
16434
|
+
var init_mapped_arrow_table = __esm({
|
|
16435
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
|
|
16436
|
+
}
|
|
16437
|
+
});
|
|
16438
|
+
|
|
16439
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
|
|
16440
|
+
var init_rename_arrow_columns = __esm({
|
|
16441
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
|
|
16442
|
+
}
|
|
16443
|
+
});
|
|
16444
|
+
|
|
16445
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
|
|
16446
|
+
function dehydrateArrowTable(arrowTable, options) {
|
|
16447
|
+
const splitTable = splitArrowBuffers(arrowTable, options);
|
|
16448
|
+
return {
|
|
16449
|
+
transport: "arrow-js",
|
|
16450
|
+
version: 1,
|
|
16451
|
+
schema: tableToIPC(new Table(splitTable.schema, [])),
|
|
16452
|
+
metadataVersion: splitTable.schema.metadataVersion,
|
|
16453
|
+
batches: splitTable.batches.map((batch) => dehydrateArrowData(batch.data))
|
|
16454
|
+
};
|
|
16455
|
+
}
|
|
16456
|
+
function hydrateArrowTable(table) {
|
|
16457
|
+
if (table.transport !== "arrow-js" || table.version !== 1) {
|
|
16458
|
+
throw new Error("Unsupported Arrow column-buffer transport protocol.");
|
|
16459
|
+
}
|
|
16460
|
+
const decodedSchema = tableFromIPC(table.schema).schema;
|
|
16461
|
+
const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
|
|
16462
|
+
const type = new Struct(schema.fields);
|
|
16463
|
+
const batches = table.batches.map((data) => new RecordBatch3(schema, hydrateArrowData(data, type)));
|
|
16464
|
+
return new Table(schema, batches);
|
|
16465
|
+
}
|
|
16466
|
+
function dehydrateArrowData(data) {
|
|
16467
|
+
return {
|
|
16468
|
+
offset: data.offset,
|
|
16469
|
+
length: data.length,
|
|
16470
|
+
nullCount: data.nullCount,
|
|
16471
|
+
buffers: {
|
|
16472
|
+
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
16473
|
+
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
16474
|
+
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
16475
|
+
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
16476
|
+
},
|
|
16477
|
+
children: data.children.map((child) => dehydrateArrowData(child)),
|
|
16478
|
+
variadicBuffers: getArrowVariadicBuffers(data),
|
|
16479
|
+
dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
|
|
16480
|
+
};
|
|
16481
|
+
}
|
|
16482
|
+
function hydrateArrowData(data, type) {
|
|
16483
|
+
const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
|
|
16484
|
+
const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
|
|
16485
|
+
return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
|
|
16486
|
+
}
|
|
16487
|
+
var init_arrow_table_transport = __esm({
|
|
16488
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
|
|
16489
|
+
init_Arrow_dom();
|
|
16490
|
+
init_arrow_data();
|
|
16491
|
+
init_split_arrow_buffers();
|
|
16492
|
+
}
|
|
16493
|
+
});
|
|
16494
|
+
|
|
16495
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/index.js
|
|
16496
|
+
var init_arrow = __esm({
|
|
16497
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
|
|
16498
|
+
init_indexed_arrow_table();
|
|
16499
|
+
init_indexed_arrow_vector();
|
|
16500
|
+
init_mapped_arrow_table();
|
|
16501
|
+
init_rename_arrow_columns();
|
|
16502
|
+
init_split_arrow_buffers();
|
|
16503
|
+
init_arrow_table_transport();
|
|
16504
|
+
}
|
|
16505
|
+
});
|
|
16506
|
+
|
|
16507
|
+
// ../../node_modules/@math.gl/arrow/dist/index.js
|
|
16508
|
+
var init_dist3 = __esm({
|
|
16509
|
+
"../../node_modules/@math.gl/arrow/dist/index.js"() {
|
|
16510
|
+
init_arrow();
|
|
16511
|
+
}
|
|
16512
|
+
});
|
|
16513
|
+
|
|
16514
|
+
// ../core/src/arrow-worker-transport.ts
|
|
16515
|
+
function serializeArrowWorkerResult(result, options) {
|
|
16516
|
+
if (!isArrowTableWrapper(result)) {
|
|
16517
|
+
return result;
|
|
16518
|
+
}
|
|
16519
|
+
const workerOptions = options;
|
|
16520
|
+
const bufferCopyMode = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
|
|
16521
|
+
return {
|
|
16522
|
+
...result,
|
|
16523
|
+
data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
|
|
16524
|
+
};
|
|
16525
|
+
}
|
|
16526
|
+
function deserializeArrowWorkerResult(result) {
|
|
16527
|
+
if (!isDehydratedArrowTableWrapper(result)) {
|
|
16528
|
+
return result;
|
|
16529
|
+
}
|
|
16530
|
+
return { ...result, data: hydrateArrowTable(result.data) };
|
|
16531
|
+
}
|
|
16532
|
+
function isArrowTableWrapper(value) {
|
|
16533
|
+
const table = value;
|
|
16534
|
+
return Boolean(
|
|
16535
|
+
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
16536
|
+
);
|
|
16537
|
+
}
|
|
16538
|
+
function isDehydratedArrowTableWrapper(value) {
|
|
16539
|
+
const table = value;
|
|
16540
|
+
return Boolean(
|
|
16541
|
+
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
16542
|
+
);
|
|
16543
|
+
}
|
|
16544
|
+
var init_arrow_worker_transport = __esm({
|
|
16545
|
+
"../core/src/arrow-worker-transport.ts"() {
|
|
16546
|
+
"use strict";
|
|
16547
|
+
init_dist3();
|
|
16548
|
+
}
|
|
16549
|
+
});
|
|
16550
|
+
|
|
16551
|
+
// ../core/src/schema-utils/lib/schema/data-type.ts
|
|
16552
|
+
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
16553
|
+
if (value instanceof Date) {
|
|
16554
|
+
return "date-millisecond";
|
|
16555
|
+
}
|
|
16556
|
+
if (typeof value === "number") {
|
|
16557
|
+
return defaultNumberType;
|
|
16558
|
+
}
|
|
16559
|
+
if (typeof value === "boolean") {
|
|
16560
|
+
return "bool";
|
|
16561
|
+
}
|
|
16562
|
+
if (typeof value === "string") {
|
|
16563
|
+
return "utf8";
|
|
16564
|
+
}
|
|
16565
|
+
if (value === null || value === "undefined") {
|
|
16566
|
+
return "null";
|
|
16567
|
+
}
|
|
16568
|
+
return "null";
|
|
16569
|
+
}
|
|
16570
|
+
function getDataTypeFromArray(array) {
|
|
16571
|
+
let type = getDataTypeFromTypedArray(array);
|
|
16572
|
+
if (type !== "null") {
|
|
16573
|
+
return { type, nullable: false };
|
|
16574
|
+
}
|
|
16575
|
+
if (array.length > 0) {
|
|
16576
|
+
type = getDataTypeFromValue(array[0]);
|
|
16577
|
+
return { type, nullable: true };
|
|
16578
|
+
}
|
|
16579
|
+
return { type: "null", nullable: true };
|
|
16580
|
+
}
|
|
16581
|
+
function getDataTypeFromTypedArray(array) {
|
|
16582
|
+
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
16583
|
+
return "float16";
|
|
16584
|
+
}
|
|
16585
|
+
switch (array.constructor) {
|
|
16586
|
+
case Int8Array:
|
|
16587
|
+
return "int8";
|
|
16588
|
+
case Uint8Array:
|
|
16589
|
+
case Uint8ClampedArray:
|
|
16590
|
+
return "uint8";
|
|
16591
|
+
case Int16Array:
|
|
16592
|
+
return "int16";
|
|
16593
|
+
case Uint16Array:
|
|
16594
|
+
return "uint16";
|
|
16595
|
+
case Int32Array:
|
|
16596
|
+
return "int32";
|
|
16597
|
+
case Uint32Array:
|
|
16598
|
+
return "uint32";
|
|
16599
|
+
case BigInt64Array:
|
|
16600
|
+
return "int64";
|
|
16601
|
+
case BigUint64Array:
|
|
16602
|
+
return "uint64";
|
|
16603
|
+
case Float32Array:
|
|
16604
|
+
return "float32";
|
|
16605
|
+
case Float64Array:
|
|
16606
|
+
return "float64";
|
|
16607
|
+
default:
|
|
16608
|
+
return "null";
|
|
16609
|
+
}
|
|
16610
|
+
}
|
|
16611
|
+
var init_data_type = __esm({
|
|
16612
|
+
"../core/src/schema-utils/lib/schema/data-type.ts"() {
|
|
16613
|
+
"use strict";
|
|
16614
|
+
}
|
|
16615
|
+
});
|
|
16616
|
+
|
|
16617
|
+
// ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
|
|
16618
|
+
function serializeArrowSchema(arrowSchema) {
|
|
16619
|
+
return {
|
|
16620
|
+
fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
|
|
16621
|
+
metadata: serializeArrowMetadata(arrowSchema.metadata)
|
|
16622
|
+
};
|
|
16623
|
+
}
|
|
16624
|
+
function serializeArrowMetadata(arrowMetadata) {
|
|
16625
|
+
return Object.fromEntries(arrowMetadata);
|
|
16626
|
+
}
|
|
16627
|
+
function deserializeArrowMetadata(metadata) {
|
|
16628
|
+
return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
|
|
16629
|
+
}
|
|
16630
|
+
function serializeArrowField(field) {
|
|
16631
|
+
return {
|
|
16632
|
+
name: field.name,
|
|
16633
|
+
type: serializeArrowType(field.type),
|
|
16634
|
+
nullable: field.nullable,
|
|
16635
|
+
metadata: serializeArrowMetadata(field.metadata)
|
|
16636
|
+
};
|
|
16637
|
+
}
|
|
16638
|
+
function deserializeArrowField(field, options) {
|
|
16639
|
+
return new Field2(
|
|
16640
|
+
field.name,
|
|
16641
|
+
deserializeArrowType(field.type, options),
|
|
16642
|
+
field.nullable,
|
|
16643
|
+
deserializeArrowMetadata(field.metadata)
|
|
16644
|
+
);
|
|
16645
|
+
}
|
|
16646
|
+
function serializeArrowType(arrowType) {
|
|
16647
|
+
if (isArrowViewType(arrowType, "BinaryView")) {
|
|
16648
|
+
return "binary-view";
|
|
16649
|
+
}
|
|
16650
|
+
if (isArrowViewType(arrowType, "Utf8View")) {
|
|
16651
|
+
return "utf8-view";
|
|
16652
|
+
}
|
|
16653
|
+
if (isOptionalArrowType(arrowType, "LargeList")) {
|
|
16654
|
+
const largeListType = arrowType;
|
|
16655
|
+
return {
|
|
16656
|
+
type: "large-list",
|
|
16657
|
+
children: [serializeArrowField(largeListType.valueField)]
|
|
15787
16658
|
};
|
|
15788
16659
|
}
|
|
15789
16660
|
switch (arrowType.constructor) {
|
|
@@ -16172,260 +17043,6 @@ return true;`);
|
|
|
16172
17043
|
}
|
|
16173
17044
|
});
|
|
16174
17045
|
|
|
16175
|
-
// ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
|
|
16176
|
-
function splitArrowBuffers(input, options = {}) {
|
|
16177
|
-
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
16178
|
-
if (isArrowTable2(input)) {
|
|
16179
|
-
return splitArrowTableBuffersInternal(input, context);
|
|
16180
|
-
}
|
|
16181
|
-
if (isArrowRecordBatch2(input)) {
|
|
16182
|
-
return splitArrowRecordBatchBuffers(input, context);
|
|
16183
|
-
}
|
|
16184
|
-
if (isArrowVector2(input)) {
|
|
16185
|
-
return splitArrowVectorBuffers(input, context);
|
|
16186
|
-
}
|
|
16187
|
-
return splitArrowDataBuffers(input, context);
|
|
16188
|
-
}
|
|
16189
|
-
function isArrowTable2(input) {
|
|
16190
|
-
return "batches" in input;
|
|
16191
|
-
}
|
|
16192
|
-
function isArrowRecordBatch2(input) {
|
|
16193
|
-
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
16194
|
-
}
|
|
16195
|
-
function isArrowVector2(input) {
|
|
16196
|
-
return "data" in input && Array.isArray(input.data);
|
|
16197
|
-
}
|
|
16198
|
-
function splitArrowTableBuffersInternal(table, options) {
|
|
16199
|
-
const recordBatches = table.batches.map(
|
|
16200
|
-
(recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
|
|
16201
|
-
);
|
|
16202
|
-
return new Table(table.schema, recordBatches);
|
|
16203
|
-
}
|
|
16204
|
-
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
16205
|
-
return new RecordBatch3(
|
|
16206
|
-
recordBatch.schema,
|
|
16207
|
-
splitArrowDataBuffers(recordBatch.data, options)
|
|
16208
|
-
);
|
|
16209
|
-
}
|
|
16210
|
-
function splitArrowDataBuffers(data, options) {
|
|
16211
|
-
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
16212
|
-
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
16213
|
-
const buffers = {
|
|
16214
|
-
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
16215
|
-
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
16216
|
-
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
16217
|
-
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
16218
|
-
};
|
|
16219
|
-
return new Data(
|
|
16220
|
-
data.type,
|
|
16221
|
-
data.offset,
|
|
16222
|
-
data.length,
|
|
16223
|
-
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
16224
|
-
data._nullCount,
|
|
16225
|
-
buffers,
|
|
16226
|
-
children,
|
|
16227
|
-
dictionary
|
|
16228
|
-
);
|
|
16229
|
-
}
|
|
16230
|
-
function splitArrowVectorBuffers(vector, options) {
|
|
16231
|
-
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
16232
|
-
}
|
|
16233
|
-
function splitArrowBuffer(array, options) {
|
|
16234
|
-
if (!isArrowTypedArray(array)) {
|
|
16235
|
-
return array;
|
|
16236
|
-
}
|
|
16237
|
-
if (options.copy === "none") {
|
|
16238
|
-
return array;
|
|
16239
|
-
}
|
|
16240
|
-
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
16241
|
-
return array;
|
|
16242
|
-
}
|
|
16243
|
-
let copy = options.copies.get(array);
|
|
16244
|
-
if (!copy) {
|
|
16245
|
-
copy = array.slice();
|
|
16246
|
-
options.copies.set(array, copy);
|
|
16247
|
-
}
|
|
16248
|
-
return copy;
|
|
16249
|
-
}
|
|
16250
|
-
function isArrowTypedArray(value) {
|
|
16251
|
-
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
16252
|
-
}
|
|
16253
|
-
var init_split_arrow_buffers = __esm({
|
|
16254
|
-
"../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
|
|
16255
|
-
"use strict";
|
|
16256
|
-
init_Arrow_dom();
|
|
16257
|
-
}
|
|
16258
|
-
});
|
|
16259
|
-
|
|
16260
|
-
// ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
|
|
16261
|
-
function dehydrateArrowTable(table, options) {
|
|
16262
|
-
const splitTable = splitArrowBuffers(table, options);
|
|
16263
|
-
return {
|
|
16264
|
-
shape: "arrow-table",
|
|
16265
|
-
transport: "arrow-js",
|
|
16266
|
-
schema: serializeArrowSchema(splitTable.schema),
|
|
16267
|
-
batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
|
|
16268
|
-
};
|
|
16269
|
-
}
|
|
16270
|
-
function hydrateArrowTable(table) {
|
|
16271
|
-
const schema = deserializeArrowSchema(table.schema);
|
|
16272
|
-
const recordBatches = table.batches.map(
|
|
16273
|
-
(recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
|
|
16274
|
-
);
|
|
16275
|
-
return new Table(schema, recordBatches);
|
|
16276
|
-
}
|
|
16277
|
-
function serializeArrowWorkerResult(result, options) {
|
|
16278
|
-
if (!isArrowTableWrapper(result)) {
|
|
16279
|
-
return result;
|
|
16280
|
-
}
|
|
16281
|
-
const workerOptions = options;
|
|
16282
|
-
const bufferCopyMode = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
|
|
16283
|
-
return {
|
|
16284
|
-
...result,
|
|
16285
|
-
data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
|
|
16286
|
-
};
|
|
16287
|
-
}
|
|
16288
|
-
function deserializeArrowWorkerResult(result) {
|
|
16289
|
-
if (!isDehydratedArrowTableWrapper(result)) {
|
|
16290
|
-
return result;
|
|
16291
|
-
}
|
|
16292
|
-
return { ...result, data: hydrateArrowTable(result.data) };
|
|
16293
|
-
}
|
|
16294
|
-
function isArrowTableWrapper(value) {
|
|
16295
|
-
const table = value;
|
|
16296
|
-
return Boolean(
|
|
16297
|
-
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
16298
|
-
);
|
|
16299
|
-
}
|
|
16300
|
-
function isDehydratedArrowTableWrapper(value) {
|
|
16301
|
-
const table = value;
|
|
16302
|
-
return Boolean(
|
|
16303
|
-
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
16304
|
-
);
|
|
16305
|
-
}
|
|
16306
|
-
function dehydrateArrowRecordBatch(recordBatch) {
|
|
16307
|
-
return { data: dehydrateArrowData(recordBatch.data) };
|
|
16308
|
-
}
|
|
16309
|
-
function dehydrateArrowData(data) {
|
|
16310
|
-
return {
|
|
16311
|
-
type: serializeArrowType(data.type),
|
|
16312
|
-
offset: data.offset,
|
|
16313
|
-
length: data.length,
|
|
16314
|
-
// @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
|
|
16315
|
-
nullCount: data._nullCount,
|
|
16316
|
-
buffers: {
|
|
16317
|
-
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
16318
|
-
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
16319
|
-
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
16320
|
-
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
16321
|
-
},
|
|
16322
|
-
children: data.children.map((childData) => dehydrateArrowData(childData)),
|
|
16323
|
-
dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
|
|
16324
|
-
};
|
|
16325
|
-
}
|
|
16326
|
-
function dehydrateArrowVector(vector) {
|
|
16327
|
-
return { data: vector.data.map((data) => dehydrateArrowData(data)) };
|
|
16328
|
-
}
|
|
16329
|
-
function hydrateArrowData(data) {
|
|
16330
|
-
const children = data.children.map((childData) => hydrateArrowData(childData));
|
|
16331
|
-
const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
|
|
16332
|
-
return new Data(
|
|
16333
|
-
deserializeArrowType(data.type),
|
|
16334
|
-
data.offset,
|
|
16335
|
-
data.length,
|
|
16336
|
-
data.nullCount,
|
|
16337
|
-
data.buffers,
|
|
16338
|
-
children,
|
|
16339
|
-
dictionary
|
|
16340
|
-
);
|
|
16341
|
-
}
|
|
16342
|
-
function hydrateArrowVector(vector) {
|
|
16343
|
-
return new Vector(vector.data.map((data) => hydrateArrowData(data)));
|
|
16344
|
-
}
|
|
16345
|
-
var init_arrow_table_transport = __esm({
|
|
16346
|
-
"../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
|
|
16347
|
-
"use strict";
|
|
16348
|
-
init_Arrow_dom();
|
|
16349
|
-
init_convert_arrow_schema();
|
|
16350
|
-
init_split_arrow_buffers();
|
|
16351
|
-
}
|
|
16352
|
-
});
|
|
16353
|
-
|
|
16354
|
-
// ../core/src/schema-utils/arrow-transport.ts
|
|
16355
|
-
var init_arrow_transport = __esm({
|
|
16356
|
-
"../core/src/schema-utils/arrow-transport.ts"() {
|
|
16357
|
-
"use strict";
|
|
16358
|
-
init_arrow_table_transport();
|
|
16359
|
-
init_split_arrow_buffers();
|
|
16360
|
-
}
|
|
16361
|
-
});
|
|
16362
|
-
|
|
16363
|
-
// ../core/src/schema-utils/lib/schema/data-type.ts
|
|
16364
|
-
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
16365
|
-
if (value instanceof Date) {
|
|
16366
|
-
return "date-millisecond";
|
|
16367
|
-
}
|
|
16368
|
-
if (typeof value === "number") {
|
|
16369
|
-
return defaultNumberType;
|
|
16370
|
-
}
|
|
16371
|
-
if (typeof value === "boolean") {
|
|
16372
|
-
return "bool";
|
|
16373
|
-
}
|
|
16374
|
-
if (typeof value === "string") {
|
|
16375
|
-
return "utf8";
|
|
16376
|
-
}
|
|
16377
|
-
if (value === null || value === "undefined") {
|
|
16378
|
-
return "null";
|
|
16379
|
-
}
|
|
16380
|
-
return "null";
|
|
16381
|
-
}
|
|
16382
|
-
function getDataTypeFromArray(array) {
|
|
16383
|
-
let type = getDataTypeFromTypedArray(array);
|
|
16384
|
-
if (type !== "null") {
|
|
16385
|
-
return { type, nullable: false };
|
|
16386
|
-
}
|
|
16387
|
-
if (array.length > 0) {
|
|
16388
|
-
type = getDataTypeFromValue(array[0]);
|
|
16389
|
-
return { type, nullable: true };
|
|
16390
|
-
}
|
|
16391
|
-
return { type: "null", nullable: true };
|
|
16392
|
-
}
|
|
16393
|
-
function getDataTypeFromTypedArray(array) {
|
|
16394
|
-
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
16395
|
-
return "float16";
|
|
16396
|
-
}
|
|
16397
|
-
switch (array.constructor) {
|
|
16398
|
-
case Int8Array:
|
|
16399
|
-
return "int8";
|
|
16400
|
-
case Uint8Array:
|
|
16401
|
-
case Uint8ClampedArray:
|
|
16402
|
-
return "uint8";
|
|
16403
|
-
case Int16Array:
|
|
16404
|
-
return "int16";
|
|
16405
|
-
case Uint16Array:
|
|
16406
|
-
return "uint16";
|
|
16407
|
-
case Int32Array:
|
|
16408
|
-
return "int32";
|
|
16409
|
-
case Uint32Array:
|
|
16410
|
-
return "uint32";
|
|
16411
|
-
case BigInt64Array:
|
|
16412
|
-
return "int64";
|
|
16413
|
-
case BigUint64Array:
|
|
16414
|
-
return "uint64";
|
|
16415
|
-
case Float32Array:
|
|
16416
|
-
return "float32";
|
|
16417
|
-
case Float64Array:
|
|
16418
|
-
return "float64";
|
|
16419
|
-
default:
|
|
16420
|
-
return "null";
|
|
16421
|
-
}
|
|
16422
|
-
}
|
|
16423
|
-
var init_data_type = __esm({
|
|
16424
|
-
"../core/src/schema-utils/lib/schema/data-type.ts"() {
|
|
16425
|
-
"use strict";
|
|
16426
|
-
}
|
|
16427
|
-
});
|
|
16428
|
-
|
|
16429
17046
|
// ../core/src/schema-utils/lib/mesh/mesh-utils.ts
|
|
16430
17047
|
function getMeshBoundingBox(attributes) {
|
|
16431
17048
|
const positionAttribute = attributes?.POSITION;
|
|
@@ -16527,7 +17144,7 @@ return true;`);
|
|
|
16527
17144
|
var init_float162 = __esm({
|
|
16528
17145
|
"../core/src/schema/float16.ts"() {
|
|
16529
17146
|
"use strict";
|
|
16530
|
-
|
|
17147
|
+
init_dist2();
|
|
16531
17148
|
}
|
|
16532
17149
|
});
|
|
16533
17150
|
|
|
@@ -17466,7 +18083,7 @@ return true;`);
|
|
|
17466
18083
|
var init_version = __esm({
|
|
17467
18084
|
"src/terrain/lib/utils/version.ts"() {
|
|
17468
18085
|
"use strict";
|
|
17469
|
-
VERSION = true ? "5.0.0-beta.
|
|
18086
|
+
VERSION = true ? "5.0.0-beta.5" : "latest";
|
|
17470
18087
|
}
|
|
17471
18088
|
});
|
|
17472
18089
|
|
|
@@ -17543,7 +18160,7 @@ return true;`);
|
|
|
17543
18160
|
var init_quantized_mesh_loader2 = __esm({
|
|
17544
18161
|
"src/terrain/quantized-mesh-loader.ts"() {
|
|
17545
18162
|
"use strict";
|
|
17546
|
-
|
|
18163
|
+
init_arrow_worker_transport();
|
|
17547
18164
|
init_schema_utils();
|
|
17548
18165
|
init_parse_quantized_mesh();
|
|
17549
18166
|
init_quantized_mesh_loader_types();
|