@loaders.gl/tiles-3d 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/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
- package/dist/3d-tiles/dist.dev.js +1393 -962
- package/dist/3d-tiles/dist.min.js +37 -37
- package/dist/3d-tiles/index.cjs +989 -987
- package/dist/3d-tiles/index.cjs.map +3 -3
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table.js +12 -8
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +5 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
- package/dist/3d-tiles/lib/utils/version.js +1 -1
- package/dist/3d-tiles-archive-writer.cjs +1 -1
- package/dist/cesium-ion-loader-with-parser.cjs +983 -981
- package/dist/cesium-ion-loader-with-parser.cjs.map +3 -3
- package/dist/copc/copc-source-loader.js +2 -2
- package/dist/copc/copc-source-loader.js.map +1 -1
- package/dist/copc/copc-writer.js +1 -1
- package/dist/copc/index.cjs +365 -170
- package/dist/copc/index.cjs.map +3 -3
- package/dist/dist.dev.js +231 -38
- package/dist/dist.min.js +10 -10
- package/dist/i3s/arcgis-webscene-loader.js +1 -1
- package/dist/i3s/dist.dev.js +6591 -1184
- package/dist/i3s/dist.min.js +55 -47
- package/dist/i3s/i3s-attribute-loader.js +1 -1
- package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s/i3s-content-loader.js +1 -1
- package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
- package/dist/i3s/i3s-loader.js +1 -1
- package/dist/i3s/i3s-node-page-loader.js +1 -1
- package/dist/i3s/i3s-slpk-loader.js +1 -1
- package/dist/i3s/i3s-slpk-writer.js +1 -1
- package/dist/i3s/index.cjs +4763 -1136
- package/dist/i3s/index.cjs.map +3 -3
- package/dist/i3s-content-worker-node.js +11 -11
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +1148 -391
- package/dist/i3s-lepcc-worker-node.js +609 -44
- package/dist/i3s-lepcc-worker-node.js.map +4 -4
- package/dist/i3s-lepcc-worker.js +575 -40
- package/dist/i3s-mesh-writer.cjs +8880 -5253
- package/dist/i3s-mesh-writer.cjs.map +3 -3
- package/dist/i3s-slpk-writer.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/point-cloud-tile-source-loader-types.js +1 -1
- package/dist/point-cloud-tile-source-loader.cjs +1 -1
- package/dist/potree/dist.dev.js +310 -110
- package/dist/potree/dist.min.js +31 -31
- package/dist/potree/index.cjs +19 -166
- package/dist/potree/index.cjs.map +3 -3
- package/dist/potree/potree-bin-loader.js +1 -1
- package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
- package/dist/potree/potree-loader-types.js +1 -1
- package/dist/potree/potree-source-loader.js +1 -1
- package/dist/potree/potree-writer.js +1 -1
- package/dist/potree-loader.cjs +1 -1
- package/package.json +13 -13
- package/src/3d-tiles/lib/classes/tile-3d-batch-table.ts +12 -8
- package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +4 -1
- package/src/copc/copc-source-loader.ts +1 -1
|
@@ -6054,14 +6054,14 @@ var require_color = __commonJS({
|
|
|
6054
6054
|
return this[this.model]();
|
|
6055
6055
|
},
|
|
6056
6056
|
string(places) {
|
|
6057
|
-
let
|
|
6058
|
-
|
|
6059
|
-
const arguments_ =
|
|
6060
|
-
return color_string_default.to[
|
|
6057
|
+
let self2 = this.model in color_string_default.to ? this : this.rgb();
|
|
6058
|
+
self2 = self2.round(typeof places === "number" ? places : 1);
|
|
6059
|
+
const arguments_ = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
|
|
6060
|
+
return color_string_default.to[self2.model](...arguments_);
|
|
6061
6061
|
},
|
|
6062
6062
|
percentString(places) {
|
|
6063
|
-
const
|
|
6064
|
-
const arguments_ =
|
|
6063
|
+
const self2 = this.rgb().round(typeof places === "number" ? places : 1);
|
|
6064
|
+
const arguments_ = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
|
|
6065
6065
|
return color_string_default.to.rgb.percent(...arguments_);
|
|
6066
6066
|
},
|
|
6067
6067
|
array() {
|
|
@@ -7580,6 +7580,48 @@ var init_dist = __esm({
|
|
|
7580
7580
|
}
|
|
7581
7581
|
});
|
|
7582
7582
|
|
|
7583
|
+
// ../core/src/worker-utils/lib/node/worker_threads.ts
|
|
7584
|
+
var worker_threads_exports = {};
|
|
7585
|
+
__export(worker_threads_exports, {
|
|
7586
|
+
BroadcastChannel: () => import_worker_threads3.BroadcastChannel,
|
|
7587
|
+
MessageChannel: () => import_worker_threads3.MessageChannel,
|
|
7588
|
+
MessagePort: () => import_worker_threads3.MessagePort,
|
|
7589
|
+
NodeWorker: () => NodeWorker,
|
|
7590
|
+
SHARE_ENV: () => import_worker_threads3.SHARE_ENV,
|
|
7591
|
+
Worker: () => import_worker_threads3.Worker,
|
|
7592
|
+
getEnvironmentData: () => import_worker_threads3.getEnvironmentData,
|
|
7593
|
+
isInternalThread: () => isInternalThread2,
|
|
7594
|
+
isMainThread: () => import_worker_threads3.isMainThread,
|
|
7595
|
+
isMarkedAsUntransferable: () => import_worker_threads3.isMarkedAsUntransferable,
|
|
7596
|
+
locks: () => locks2,
|
|
7597
|
+
markAsUncloneable: () => import_worker_threads3.markAsUncloneable,
|
|
7598
|
+
markAsUntransferable: () => import_worker_threads3.markAsUntransferable,
|
|
7599
|
+
moveMessagePortToContext: () => import_worker_threads3.moveMessagePortToContext,
|
|
7600
|
+
parentPort: () => parentPort2,
|
|
7601
|
+
postMessageToThread: () => import_worker_threads3.postMessageToThread,
|
|
7602
|
+
receiveMessageOnPort: () => import_worker_threads3.receiveMessageOnPort,
|
|
7603
|
+
resourceLimits: () => import_worker_threads3.resourceLimits,
|
|
7604
|
+
setEnvironmentData: () => import_worker_threads3.setEnvironmentData,
|
|
7605
|
+
structuredClone: () => structuredClone3,
|
|
7606
|
+
threadId: () => import_worker_threads3.threadId,
|
|
7607
|
+
threadName: () => threadName2,
|
|
7608
|
+
workerData: () => import_worker_threads3.workerData
|
|
7609
|
+
});
|
|
7610
|
+
var WorkerThreads, import_worker_threads3, parentPort2, NodeWorker, isInternalThread2, threadName2, locks2, structuredClone3;
|
|
7611
|
+
var init_worker_threads = __esm({
|
|
7612
|
+
"../core/src/worker-utils/lib/node/worker_threads.ts"() {
|
|
7613
|
+
"use strict";
|
|
7614
|
+
WorkerThreads = __toESM(require("worker_threads"), 1);
|
|
7615
|
+
import_worker_threads3 = require("worker_threads");
|
|
7616
|
+
parentPort2 = WorkerThreads == null ? void 0 : WorkerThreads.parentPort;
|
|
7617
|
+
NodeWorker = WorkerThreads.Worker;
|
|
7618
|
+
isInternalThread2 = WorkerThreads.isInternalThread;
|
|
7619
|
+
threadName2 = WorkerThreads.threadName;
|
|
7620
|
+
locks2 = WorkerThreads.locks;
|
|
7621
|
+
structuredClone3 = WorkerThreads.structuredClone;
|
|
7622
|
+
}
|
|
7623
|
+
});
|
|
7624
|
+
|
|
7583
7625
|
// dist/i3s/i3s-lepcc.js
|
|
7584
7626
|
function readMagic2(bytes) {
|
|
7585
7627
|
if (bytes.byteLength < 10) {
|
|
@@ -8106,7 +8148,7 @@ var init_i3s_lepcc_loader_types = __esm({
|
|
|
8106
8148
|
"dist/i3s/i3s-lepcc-loader-types.js"() {
|
|
8107
8149
|
"use strict";
|
|
8108
8150
|
init_i3s_format();
|
|
8109
|
-
VERSION = true ? "5.0.0-beta.
|
|
8151
|
+
VERSION = true ? "5.0.0-beta.5" : "latest";
|
|
8110
8152
|
I3SLEPCCLoader = {
|
|
8111
8153
|
...I3SLEPCCFormat2,
|
|
8112
8154
|
dataType: null,
|
|
@@ -10325,11 +10367,11 @@ globalThis.loaders.readFileAsText = readFileAsText;
|
|
|
10325
10367
|
globalThis.loaders.requireFromFile = requireFromFile;
|
|
10326
10368
|
globalThis.loaders.requireFromString = requireFromString;
|
|
10327
10369
|
|
|
10328
|
-
// ../../node_modules/@math.gl/
|
|
10370
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads.js
|
|
10329
10371
|
var import_worker_threads = require("worker_threads");
|
|
10330
10372
|
var parentPort = import_worker_threads.parentPort;
|
|
10331
10373
|
|
|
10332
|
-
// ../../node_modules/@math.gl/
|
|
10374
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
10333
10375
|
function getTransferList(object2, recursive = true, transfers) {
|
|
10334
10376
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
10335
10377
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -10342,6 +10384,9 @@ function getTransferList(object2, recursive = true, transfers) {
|
|
|
10342
10384
|
else if (ArrayBuffer.isView(value)) {
|
|
10343
10385
|
if (isTransferable(value.buffer))
|
|
10344
10386
|
transfersSet.add(value.buffer);
|
|
10387
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
|
|
10388
|
+
visit(value.port1);
|
|
10389
|
+
visit(value.port2);
|
|
10345
10390
|
} else if (recursive && value instanceof Map) {
|
|
10346
10391
|
for (const [key, item] of value) {
|
|
10347
10392
|
visit(key);
|
|
@@ -10377,7 +10422,7 @@ function isTransferable(object2) {
|
|
|
10377
10422
|
return false;
|
|
10378
10423
|
}
|
|
10379
10424
|
|
|
10380
|
-
// ../../node_modules/@math.gl/
|
|
10425
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
10381
10426
|
async function getParentPort() {
|
|
10382
10427
|
return parentPort;
|
|
10383
10428
|
}
|
|
@@ -10393,16 +10438,16 @@ var WorkerBody = class {
|
|
|
10393
10438
|
*/
|
|
10394
10439
|
static set onmessage(onMessage) {
|
|
10395
10440
|
async function handleMessage(message) {
|
|
10396
|
-
const
|
|
10397
|
-
const { type, payload } =
|
|
10441
|
+
const parentPort3 = await getParentPort();
|
|
10442
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
10398
10443
|
onMessage(type, payload);
|
|
10399
10444
|
}
|
|
10400
|
-
getParentPort().then((
|
|
10401
|
-
if (
|
|
10402
|
-
|
|
10445
|
+
getParentPort().then((parentPort3) => {
|
|
10446
|
+
if (parentPort3) {
|
|
10447
|
+
parentPort3.on("message", (message) => {
|
|
10403
10448
|
handleMessage(message);
|
|
10404
10449
|
});
|
|
10405
|
-
|
|
10450
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
10406
10451
|
} else {
|
|
10407
10452
|
globalThis.onmessage = handleMessage;
|
|
10408
10453
|
}
|
|
@@ -10420,9 +10465,9 @@ var WorkerBody = class {
|
|
|
10420
10465
|
};
|
|
10421
10466
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
10422
10467
|
}
|
|
10423
|
-
const
|
|
10424
|
-
if (
|
|
10425
|
-
|
|
10468
|
+
const parentPort3 = await getParentPort();
|
|
10469
|
+
if (parentPort3) {
|
|
10470
|
+
parentPort3.on("message", onMessageWrapper);
|
|
10426
10471
|
} else {
|
|
10427
10472
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
10428
10473
|
}
|
|
@@ -10433,9 +10478,9 @@ var WorkerBody = class {
|
|
|
10433
10478
|
if (!onMessageWrapper) {
|
|
10434
10479
|
return;
|
|
10435
10480
|
}
|
|
10436
|
-
const
|
|
10437
|
-
if (
|
|
10438
|
-
|
|
10481
|
+
const parentPort3 = await getParentPort();
|
|
10482
|
+
if (parentPort3) {
|
|
10483
|
+
parentPort3.off("message", onMessageWrapper);
|
|
10439
10484
|
} else {
|
|
10440
10485
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
10441
10486
|
}
|
|
@@ -10445,12 +10490,12 @@ var WorkerBody = class {
|
|
|
10445
10490
|
* @param type
|
|
10446
10491
|
* @param payload
|
|
10447
10492
|
*/
|
|
10448
|
-
static async postMessage(type, payload) {
|
|
10493
|
+
static async postMessage(type, payload, copy = false) {
|
|
10449
10494
|
const data = { source: "loaders.gl", type, payload };
|
|
10450
|
-
const transferList = getTransferList(payload);
|
|
10451
|
-
const
|
|
10452
|
-
if (
|
|
10453
|
-
|
|
10495
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
10496
|
+
const parentPort3 = await getParentPort();
|
|
10497
|
+
if (parentPort3) {
|
|
10498
|
+
parentPort3.postMessage(data, transferList);
|
|
10454
10499
|
} else {
|
|
10455
10500
|
globalThis.postMessage(data, transferList);
|
|
10456
10501
|
}
|
|
@@ -10464,7 +10509,7 @@ function getWorkerMessageData(message) {
|
|
|
10464
10509
|
return messageData && typeof messageData.source === "string" && messageData.source.startsWith("loaders.gl") ? messageData : null;
|
|
10465
10510
|
}
|
|
10466
10511
|
|
|
10467
|
-
// ../../node_modules/@math.gl/
|
|
10512
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
|
|
10468
10513
|
var AsyncQueue = class {
|
|
10469
10514
|
constructor() {
|
|
10470
10515
|
this._values = [];
|
|
@@ -10531,7 +10576,7 @@ var AsyncQueue = class {
|
|
|
10531
10576
|
}
|
|
10532
10577
|
};
|
|
10533
10578
|
|
|
10534
|
-
// ../../node_modules/@math.gl/
|
|
10579
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
|
|
10535
10580
|
var SharedWorkerState = class {
|
|
10536
10581
|
constructor(buffer2) {
|
|
10537
10582
|
if (typeof SharedArrayBuffer === "undefined" || !(buffer2 instanceof SharedArrayBuffer) || buffer2.byteLength !== 16)
|
|
@@ -10570,12 +10615,19 @@ var SharedWorkerState = class {
|
|
|
10570
10615
|
}
|
|
10571
10616
|
};
|
|
10572
10617
|
|
|
10573
|
-
// ../../node_modules/@math.gl/
|
|
10618
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
|
|
10619
|
+
function validateOutputOwnership(ownership) {
|
|
10620
|
+
if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
|
|
10621
|
+
throw new Error("Invalid worker output ownership");
|
|
10622
|
+
}
|
|
10623
|
+
}
|
|
10624
|
+
|
|
10625
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
|
|
10574
10626
|
var requestId = 0;
|
|
10575
10627
|
var activeController = null;
|
|
10576
10628
|
var activeInputBatches = null;
|
|
10577
10629
|
var activeOutputAcknowledgements = null;
|
|
10578
|
-
async function createWorker(process2, processInBatches) {
|
|
10630
|
+
async function createWorker(process2, processInBatches, preload) {
|
|
10579
10631
|
if (!await WorkerBody.inWorkerThread()) {
|
|
10580
10632
|
return;
|
|
10581
10633
|
}
|
|
@@ -10583,7 +10635,7 @@ async function createWorker(process2, processInBatches) {
|
|
|
10583
10635
|
process: processOnMainThread
|
|
10584
10636
|
};
|
|
10585
10637
|
WorkerBody.onmessage = async (type, payload) => {
|
|
10586
|
-
var _a;
|
|
10638
|
+
var _a, _b, _c, _d, _e;
|
|
10587
10639
|
if (type === "cancel") {
|
|
10588
10640
|
activeController == null ? void 0 : activeController.abort();
|
|
10589
10641
|
activeInputBatches == null ? void 0 : activeInputBatches.close();
|
|
@@ -10617,10 +10669,12 @@ async function createWorker(process2, processInBatches) {
|
|
|
10617
10669
|
}
|
|
10618
10670
|
switch (type) {
|
|
10619
10671
|
case "preload":
|
|
10672
|
+
await (preload == null ? void 0 : preload());
|
|
10620
10673
|
WorkerBody.postMessage("done", {});
|
|
10621
10674
|
break;
|
|
10622
10675
|
case "process":
|
|
10623
10676
|
throwIfAborted();
|
|
10677
|
+
validateOutputOwnership((_b = payload.options) == null ? void 0 : _b["outputOwnership"]);
|
|
10624
10678
|
if (!process2) {
|
|
10625
10679
|
throw new Error("Worker does not support atomic processing");
|
|
10626
10680
|
}
|
|
@@ -10630,10 +10684,11 @@ async function createWorker(process2, processInBatches) {
|
|
|
10630
10684
|
await WorkerBody.postMessage("done", {
|
|
10631
10685
|
result,
|
|
10632
10686
|
executionMs: performance.now() - startedAt
|
|
10633
|
-
});
|
|
10687
|
+
}, ((_c = payload.options) == null ? void 0 : _c["outputOwnership"]) === "copy");
|
|
10634
10688
|
break;
|
|
10635
10689
|
case "process-in-batches":
|
|
10636
10690
|
throwIfAborted();
|
|
10691
|
+
validateOutputOwnership((_d = payload.options) == null ? void 0 : _d["outputOwnership"]);
|
|
10637
10692
|
if (!processInBatches) {
|
|
10638
10693
|
throw new Error("Worker does not support batched processing");
|
|
10639
10694
|
}
|
|
@@ -10645,7 +10700,7 @@ async function createWorker(process2, processInBatches) {
|
|
|
10645
10700
|
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
10646
10701
|
for await (const batch of resultIterator) {
|
|
10647
10702
|
throwIfAborted();
|
|
10648
|
-
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
10703
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, ((_e = payload.options) == null ? void 0 : _e["outputOwnership"]) === "copy");
|
|
10649
10704
|
await outputAcknowledgements.next();
|
|
10650
10705
|
}
|
|
10651
10706
|
throwIfAborted();
|
|
@@ -10743,14 +10798,14 @@ function processOnMainThread(arrayBuffer2, options = {}, jobContext = {}) {
|
|
|
10743
10798
|
});
|
|
10744
10799
|
}
|
|
10745
10800
|
function createProgressReporter() {
|
|
10746
|
-
let
|
|
10801
|
+
let pending2;
|
|
10747
10802
|
let finished2 = false;
|
|
10748
10803
|
let scheduled = false;
|
|
10749
10804
|
const flush = () => {
|
|
10750
10805
|
scheduled = false;
|
|
10751
|
-
if (
|
|
10752
|
-
WorkerBody.postMessage("progress", { progress:
|
|
10753
|
-
|
|
10806
|
+
if (pending2) {
|
|
10807
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
10808
|
+
pending2 = void 0;
|
|
10754
10809
|
}
|
|
10755
10810
|
};
|
|
10756
10811
|
return {
|
|
@@ -10758,9 +10813,9 @@ function createProgressReporter() {
|
|
|
10758
10813
|
report(progress) {
|
|
10759
10814
|
if (finished2)
|
|
10760
10815
|
return;
|
|
10761
|
-
if (
|
|
10816
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
10762
10817
|
flush();
|
|
10763
|
-
|
|
10818
|
+
pending2 = { ...progress };
|
|
10764
10819
|
if (!scheduled) {
|
|
10765
10820
|
scheduled = true;
|
|
10766
10821
|
setTimeout(flush, 0);
|
|
@@ -10769,21 +10824,531 @@ function createProgressReporter() {
|
|
|
10769
10824
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
10770
10825
|
finish(discard = false) {
|
|
10771
10826
|
if (discard)
|
|
10772
|
-
|
|
10827
|
+
pending2 = void 0;
|
|
10773
10828
|
flush();
|
|
10774
10829
|
finished2 = true;
|
|
10775
10830
|
}
|
|
10776
10831
|
};
|
|
10777
10832
|
}
|
|
10778
10833
|
|
|
10779
|
-
// ../../node_modules/@math.gl/
|
|
10834
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
|
|
10780
10835
|
var import_meta3 = {};
|
|
10781
10836
|
var path3 = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
10782
10837
|
var moduleUrl = path3 ? `file://${path3.startsWith("/") ? "" : "/"}${encodeURI(path3).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta3.url;
|
|
10783
10838
|
|
|
10839
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
|
|
10840
|
+
var pending = /* @__PURE__ */ new WeakMap();
|
|
10841
|
+
var loaded = /* @__PURE__ */ new WeakSet();
|
|
10842
|
+
function preloadTaskCode(task, signal) {
|
|
10843
|
+
if (!task.preload)
|
|
10844
|
+
return Promise.resolve();
|
|
10845
|
+
let promise = pending.get(task);
|
|
10846
|
+
if (!promise) {
|
|
10847
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
10848
|
+
loaded.add(task);
|
|
10849
|
+
});
|
|
10850
|
+
pending.set(task, promise);
|
|
10851
|
+
void promise.catch(() => pending.delete(task));
|
|
10852
|
+
}
|
|
10853
|
+
return withSignal(promise, signal);
|
|
10854
|
+
}
|
|
10855
|
+
function withSignal(operation, signal) {
|
|
10856
|
+
if (!signal)
|
|
10857
|
+
return operation;
|
|
10858
|
+
return new Promise((resolve, reject) => {
|
|
10859
|
+
const abort = () => {
|
|
10860
|
+
signal.removeEventListener("abort", abort);
|
|
10861
|
+
reject(signal.reason);
|
|
10862
|
+
};
|
|
10863
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
10864
|
+
if (signal.aborted)
|
|
10865
|
+
abort();
|
|
10866
|
+
operation.then((value) => {
|
|
10867
|
+
signal.removeEventListener("abort", abort);
|
|
10868
|
+
resolve(value);
|
|
10869
|
+
}, (error) => {
|
|
10870
|
+
signal.removeEventListener("abort", abort);
|
|
10871
|
+
reject(error);
|
|
10872
|
+
});
|
|
10873
|
+
});
|
|
10874
|
+
}
|
|
10875
|
+
|
|
10876
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
|
|
10877
|
+
var TaskRequestError = class extends Error {
|
|
10878
|
+
};
|
|
10879
|
+
var TaskChannel = class {
|
|
10880
|
+
constructor(options) {
|
|
10881
|
+
this.options = options;
|
|
10882
|
+
this.nextId = 1;
|
|
10883
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
10884
|
+
this.incoming = /* @__PURE__ */ new Map();
|
|
10885
|
+
}
|
|
10886
|
+
/** Send a request without serializing other in-flight requests. */
|
|
10887
|
+
request(operation, value, signal, transfer = []) {
|
|
10888
|
+
if (this.failure)
|
|
10889
|
+
return Promise.reject(this.failure.reason);
|
|
10890
|
+
if (signal == null ? void 0 : signal.aborted)
|
|
10891
|
+
return Promise.reject(signal.reason);
|
|
10892
|
+
const id = this.nextId++;
|
|
10893
|
+
return new Promise((resolve, reject) => {
|
|
10894
|
+
const abort = () => {
|
|
10895
|
+
const pending2 = this.pending.get(id);
|
|
10896
|
+
if (!pending2)
|
|
10897
|
+
return;
|
|
10898
|
+
this.pending.delete(id);
|
|
10899
|
+
pending2.cleanup();
|
|
10900
|
+
reject(signal == null ? void 0 : signal.reason);
|
|
10901
|
+
this.send({ source: "math.gl/tasks", kind: "cancel", id });
|
|
10902
|
+
};
|
|
10903
|
+
this.pending.set(id, {
|
|
10904
|
+
resolve,
|
|
10905
|
+
reject,
|
|
10906
|
+
cleanup: () => signal == null ? void 0 : signal.removeEventListener("abort", abort)
|
|
10907
|
+
});
|
|
10908
|
+
signal == null ? void 0 : signal.addEventListener("abort", abort, { once: true });
|
|
10909
|
+
this.send({ source: "math.gl/tasks", kind: "request", id, operation, value }, transfer);
|
|
10910
|
+
});
|
|
10911
|
+
}
|
|
10912
|
+
/** Send a one-way notification. */
|
|
10913
|
+
emit(operation, value, transfer = []) {
|
|
10914
|
+
if (this.failure)
|
|
10915
|
+
throw this.failure.reason;
|
|
10916
|
+
this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation, value }, transfer);
|
|
10917
|
+
}
|
|
10918
|
+
/** Dispatch a transport message; unrelated protocols are ignored. */
|
|
10919
|
+
receive(message) {
|
|
10920
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10921
|
+
if (this.failure || (message == null ? void 0 : message.source) !== "math.gl/tasks")
|
|
10922
|
+
return;
|
|
10923
|
+
if (message.kind === "failure") {
|
|
10924
|
+
const reason = new Error(((_a = message.error) == null ? void 0 : _a.message) ?? "Task channel failed");
|
|
10925
|
+
this.close(reason);
|
|
10926
|
+
(_c = (_b = this.options).onFailure) == null ? void 0 : _c.call(_b, reason);
|
|
10927
|
+
} else if (message.kind === "result" || message.kind === "error") {
|
|
10928
|
+
const pending2 = this.pending.get(message.id);
|
|
10929
|
+
if (!pending2)
|
|
10930
|
+
return;
|
|
10931
|
+
this.pending.delete(message.id);
|
|
10932
|
+
pending2.cleanup();
|
|
10933
|
+
if (message.kind === "result")
|
|
10934
|
+
pending2.resolve(message.value);
|
|
10935
|
+
else {
|
|
10936
|
+
const error = new TaskRequestError(((_d = message.error) == null ? void 0 : _d.message) ?? "Task request failed");
|
|
10937
|
+
error.name = ((_e = message.error) == null ? void 0 : _e.name) ?? "Error";
|
|
10938
|
+
pending2.reject(error);
|
|
10939
|
+
}
|
|
10940
|
+
} else if (message.kind === "cancel") {
|
|
10941
|
+
(_f = this.incoming.get(message.id)) == null ? void 0 : _f.abort(new DOMException("Task request cancelled", "AbortError"));
|
|
10942
|
+
} else if (message.kind === "event") {
|
|
10943
|
+
try {
|
|
10944
|
+
(_h = (_g = this.options).handleEvent) == null ? void 0 : _h.call(_g, message.operation, message.value);
|
|
10945
|
+
} catch (error) {
|
|
10946
|
+
this.fail(error);
|
|
10947
|
+
}
|
|
10948
|
+
} else if (message.kind === "request") {
|
|
10949
|
+
if (this.incoming.has(message.id)) {
|
|
10950
|
+
this.fail(new Error("Duplicate task request identifier"));
|
|
10951
|
+
return;
|
|
10952
|
+
}
|
|
10953
|
+
const controller = new AbortController();
|
|
10954
|
+
this.incoming.set(message.id, controller);
|
|
10955
|
+
void Promise.resolve().then(() => {
|
|
10956
|
+
controller.signal.throwIfAborted();
|
|
10957
|
+
return this.options.handleRequest(message.operation, message.value, controller.signal);
|
|
10958
|
+
}).then((value) => {
|
|
10959
|
+
var _a2, _b2;
|
|
10960
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
10961
|
+
this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value }, (_b2 = (_a2 = this.options).getResultTransferList) == null ? void 0 : _b2.call(_a2, value, message.value));
|
|
10962
|
+
}
|
|
10963
|
+
}).catch((reason) => {
|
|
10964
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
10965
|
+
this.send({
|
|
10966
|
+
source: "math.gl/tasks",
|
|
10967
|
+
kind: "error",
|
|
10968
|
+
id: message.id,
|
|
10969
|
+
error: {
|
|
10970
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
10971
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
10972
|
+
}
|
|
10973
|
+
});
|
|
10974
|
+
}
|
|
10975
|
+
}).finally(() => this.incoming.delete(message.id));
|
|
10976
|
+
}
|
|
10977
|
+
}
|
|
10978
|
+
/** Reject all outstanding calls with a common cause and abort incoming callbacks. */
|
|
10979
|
+
close(reason = new Error("Task channel closed")) {
|
|
10980
|
+
if (this.failure)
|
|
10981
|
+
return;
|
|
10982
|
+
this.failure = { reason };
|
|
10983
|
+
for (const pending2 of this.pending.values()) {
|
|
10984
|
+
pending2.cleanup();
|
|
10985
|
+
pending2.reject(reason);
|
|
10986
|
+
}
|
|
10987
|
+
this.pending.clear();
|
|
10988
|
+
for (const controller of this.incoming.values())
|
|
10989
|
+
controller.abort(reason);
|
|
10990
|
+
this.incoming.clear();
|
|
10991
|
+
}
|
|
10992
|
+
send(message, transfer = []) {
|
|
10993
|
+
if (this.failure)
|
|
10994
|
+
return;
|
|
10995
|
+
try {
|
|
10996
|
+
this.options.send(message, transfer);
|
|
10997
|
+
} catch (error) {
|
|
10998
|
+
this.fail(error);
|
|
10999
|
+
}
|
|
11000
|
+
}
|
|
11001
|
+
/** Invalidate the channel and notify the peer when the transport still works. */
|
|
11002
|
+
fail(reason) {
|
|
11003
|
+
var _a, _b;
|
|
11004
|
+
if (this.failure)
|
|
11005
|
+
return;
|
|
11006
|
+
this.close(reason);
|
|
11007
|
+
try {
|
|
11008
|
+
this.options.send({
|
|
11009
|
+
source: "math.gl/tasks",
|
|
11010
|
+
kind: "failure",
|
|
11011
|
+
id: 0,
|
|
11012
|
+
error: {
|
|
11013
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
11014
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
11015
|
+
}
|
|
11016
|
+
}, []);
|
|
11017
|
+
} catch {
|
|
11018
|
+
}
|
|
11019
|
+
(_b = (_a = this.options).onFailure) == null ? void 0 : _b.call(_a, reason);
|
|
11020
|
+
}
|
|
11021
|
+
};
|
|
11022
|
+
|
|
11023
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
|
|
11024
|
+
function assertPayload(value) {
|
|
11025
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
11026
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
11027
|
+
}
|
|
11028
|
+
}
|
|
11029
|
+
function clonePayload(value, ownership = "copy") {
|
|
11030
|
+
assertPayload(value);
|
|
11031
|
+
if (!["copy", "transfer", "share"].includes(ownership))
|
|
11032
|
+
throw new TypeError("Invalid input ownership");
|
|
11033
|
+
const transfer = getTransferList(value);
|
|
11034
|
+
if (ownership === "share" && transfer.length)
|
|
11035
|
+
throw new TypeError("Share requires shared storage");
|
|
11036
|
+
return structuredClone(value, {
|
|
11037
|
+
transfer: ownership === "transfer" ? transfer : []
|
|
11038
|
+
});
|
|
11039
|
+
}
|
|
11040
|
+
function taskContext(state, context = {}) {
|
|
11041
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
11042
|
+
return {
|
|
11043
|
+
state,
|
|
11044
|
+
signal,
|
|
11045
|
+
requestHost: async (operation, payload, controls) => {
|
|
11046
|
+
signal.throwIfAborted();
|
|
11047
|
+
if (!context.requestHost)
|
|
11048
|
+
throw new Error("No host request handler configured");
|
|
11049
|
+
return context.requestHost(operation, payload, controls);
|
|
11050
|
+
},
|
|
11051
|
+
emitHost: (operation, payload) => {
|
|
11052
|
+
var _a;
|
|
11053
|
+
signal.throwIfAborted();
|
|
11054
|
+
(_a = context.emitHost) == null ? void 0 : _a.call(context, operation, payload);
|
|
11055
|
+
},
|
|
11056
|
+
throwIfAborted: () => {
|
|
11057
|
+
var _a;
|
|
11058
|
+
signal.throwIfAborted();
|
|
11059
|
+
(_a = context.throwIfAborted) == null ? void 0 : _a.call(context);
|
|
11060
|
+
},
|
|
11061
|
+
reportProgress: (progress) => {
|
|
11062
|
+
var _a;
|
|
11063
|
+
return (_a = context.reportProgress) == null ? void 0 : _a.call(context, {
|
|
11064
|
+
...progress,
|
|
11065
|
+
phase: progress.phase ?? "process",
|
|
11066
|
+
unit: progress.unit ?? "items"
|
|
11067
|
+
});
|
|
11068
|
+
}
|
|
11069
|
+
};
|
|
11070
|
+
}
|
|
11071
|
+
var TaskRuntime = class {
|
|
11072
|
+
constructor(task) {
|
|
11073
|
+
this.task = task;
|
|
11074
|
+
this.initialized = false;
|
|
11075
|
+
}
|
|
11076
|
+
async initialize(input, context = {}) {
|
|
11077
|
+
var _a, _b, _c;
|
|
11078
|
+
if (this.initialized)
|
|
11079
|
+
throw new Error("Task is already initialized");
|
|
11080
|
+
assertPayload(input);
|
|
11081
|
+
await preloadTaskCode(this.task, context.signal);
|
|
11082
|
+
(_a = context.signal) == null ? void 0 : _a.throwIfAborted();
|
|
11083
|
+
this.state = await ((_c = (_b = this.task).initialize) == null ? void 0 : _c.call(_b, input, taskContext(void 0, context)));
|
|
11084
|
+
this.initialized = true;
|
|
11085
|
+
return {};
|
|
11086
|
+
}
|
|
11087
|
+
async destroy() {
|
|
11088
|
+
var _a, _b;
|
|
11089
|
+
if (this.initialized) {
|
|
11090
|
+
this.initialized = false;
|
|
11091
|
+
const state = this.state;
|
|
11092
|
+
this.state = void 0;
|
|
11093
|
+
if (this.task.initialize)
|
|
11094
|
+
await ((_b = (_a = this.task).destroy) == null ? void 0 : _b.call(_a, state));
|
|
11095
|
+
}
|
|
11096
|
+
return {};
|
|
11097
|
+
}
|
|
11098
|
+
async process(input, options, context = {}) {
|
|
11099
|
+
if (!this.initialized)
|
|
11100
|
+
throw new Error("Task is not initialized");
|
|
11101
|
+
if (!this.task.process)
|
|
11102
|
+
throw new Error("Task has no atomic processor");
|
|
11103
|
+
assertPayload(input);
|
|
11104
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
11105
|
+
assertPayload(result);
|
|
11106
|
+
return result;
|
|
11107
|
+
}
|
|
11108
|
+
async *stream(inputs, options, context = {}) {
|
|
11109
|
+
if (!this.initialized)
|
|
11110
|
+
throw new Error("Task is not initialized");
|
|
11111
|
+
if (!this.task.processInBatches)
|
|
11112
|
+
throw new Error("Task has no streaming processor");
|
|
11113
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
11114
|
+
assertPayload(output);
|
|
11115
|
+
yield output;
|
|
11116
|
+
}
|
|
11117
|
+
}
|
|
11118
|
+
};
|
|
11119
|
+
async function initializeTaskWorker(task) {
|
|
11120
|
+
if (!await WorkerBody.inWorkerThread())
|
|
11121
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
11122
|
+
if (installed)
|
|
11123
|
+
throw new Error("A task is already installed in this worker");
|
|
11124
|
+
installed = true;
|
|
11125
|
+
const runtime = new TaskRuntime(task);
|
|
11126
|
+
let channelStream;
|
|
11127
|
+
const channel = new TaskChannel({
|
|
11128
|
+
getResultTransferList: (value, request) => request.outputOwnership === "transfer" ? getTransferList(value) : [],
|
|
11129
|
+
send: (message, transfer) => {
|
|
11130
|
+
const snapshot = structuredClone(message, { transfer });
|
|
11131
|
+
void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
|
|
11132
|
+
},
|
|
11133
|
+
handleRequest: async (operation, value, signal) => {
|
|
11134
|
+
var _a;
|
|
11135
|
+
const request = value;
|
|
11136
|
+
const context = {
|
|
11137
|
+
signal,
|
|
11138
|
+
reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
|
|
11139
|
+
requestHost: (operation2, payload, controls = {}) => {
|
|
11140
|
+
const request2 = {
|
|
11141
|
+
operation: operation2,
|
|
11142
|
+
payload: clonePayload(payload, controls.inputOwnership),
|
|
11143
|
+
outputOwnership: controls.outputOwnership ?? "copy"
|
|
11144
|
+
};
|
|
11145
|
+
return channel.request("task:host-request", request2, signal, getTransferList(request2));
|
|
11146
|
+
},
|
|
11147
|
+
emitHost: (operation2, payload) => channel.emit("task:host-event", { operation: operation2, payload, id: request.progressId })
|
|
11148
|
+
};
|
|
11149
|
+
switch (operation) {
|
|
11150
|
+
case "initialize":
|
|
11151
|
+
return runtime.initialize(request.input, context);
|
|
11152
|
+
case "process":
|
|
11153
|
+
return runtime.process(request.input, request.options, context);
|
|
11154
|
+
case "stream-open": {
|
|
11155
|
+
if (channelStream)
|
|
11156
|
+
throw new Error("A task stream is already open");
|
|
11157
|
+
async function* inputs() {
|
|
11158
|
+
while (true) {
|
|
11159
|
+
const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
|
|
11160
|
+
if (result.done)
|
|
11161
|
+
return;
|
|
11162
|
+
yield result.value;
|
|
11163
|
+
}
|
|
11164
|
+
}
|
|
11165
|
+
channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
|
|
11166
|
+
return {};
|
|
11167
|
+
}
|
|
11168
|
+
case "stream-next":
|
|
11169
|
+
if (!channelStream)
|
|
11170
|
+
throw new Error("No active task stream");
|
|
11171
|
+
return channelStream.next();
|
|
11172
|
+
case "stream-close":
|
|
11173
|
+
try {
|
|
11174
|
+
await ((_a = channelStream == null ? void 0 : channelStream.return) == null ? void 0 : _a.call(channelStream));
|
|
11175
|
+
} finally {
|
|
11176
|
+
channelStream = void 0;
|
|
11177
|
+
}
|
|
11178
|
+
return {};
|
|
11179
|
+
case "destroy":
|
|
11180
|
+
return runtime.destroy();
|
|
11181
|
+
default:
|
|
11182
|
+
throw new Error("Unknown task channel operation");
|
|
11183
|
+
}
|
|
11184
|
+
}
|
|
11185
|
+
});
|
|
11186
|
+
await WorkerBody.addEventListener((type, payload) => {
|
|
11187
|
+
if (type === "task-channel")
|
|
11188
|
+
channel.receive(payload);
|
|
11189
|
+
});
|
|
11190
|
+
let streamOptions = {};
|
|
11191
|
+
return createWorker(async (request, _options, context) => {
|
|
11192
|
+
switch (request.operation) {
|
|
11193
|
+
case "initialize":
|
|
11194
|
+
return runtime.initialize(request.input, context);
|
|
11195
|
+
case "destroy":
|
|
11196
|
+
return runtime.destroy();
|
|
11197
|
+
case "stream-options":
|
|
11198
|
+
streamOptions = request.options;
|
|
11199
|
+
return {};
|
|
11200
|
+
case "process":
|
|
11201
|
+
return runtime.process(request.input, request.options, context);
|
|
11202
|
+
default:
|
|
11203
|
+
throw new Error("Unknown task operation");
|
|
11204
|
+
}
|
|
11205
|
+
}, async function* (inputs, _options, context) {
|
|
11206
|
+
async function* batches() {
|
|
11207
|
+
for await (const input of inputs) {
|
|
11208
|
+
assertPayload(input);
|
|
11209
|
+
yield input;
|
|
11210
|
+
}
|
|
11211
|
+
}
|
|
11212
|
+
try {
|
|
11213
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
11214
|
+
} finally {
|
|
11215
|
+
streamOptions = {};
|
|
11216
|
+
}
|
|
11217
|
+
}, () => preloadTaskCode(task));
|
|
11218
|
+
}
|
|
11219
|
+
var installed = false;
|
|
11220
|
+
|
|
11221
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
11222
|
+
function normalizeTaskProgress(progress) {
|
|
11223
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
11224
|
+
}
|
|
11225
|
+
async function isWorkerThread() {
|
|
11226
|
+
var _a;
|
|
11227
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
11228
|
+
return true;
|
|
11229
|
+
if (typeof process !== "undefined" && ((_a = process.versions) == null ? void 0 : _a.node)) {
|
|
11230
|
+
const { isMainThread: isMainThread2 } = await Promise.resolve().then(() => (init_worker_threads(), worker_threads_exports));
|
|
11231
|
+
return !isMainThread2;
|
|
11232
|
+
}
|
|
11233
|
+
return false;
|
|
11234
|
+
}
|
|
11235
|
+
var initializeTaskWorker2 = initializeTaskWorker;
|
|
11236
|
+
|
|
11237
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
11238
|
+
function getTransferList2(object2, recursive = true, transfers) {
|
|
11239
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
11240
|
+
if (!object2) {
|
|
11241
|
+
} else if (isTransferable2(object2)) {
|
|
11242
|
+
transfersSet.add(object2);
|
|
11243
|
+
} else if (isTransferable2(object2.buffer)) {
|
|
11244
|
+
transfersSet.add(object2.buffer);
|
|
11245
|
+
} else if (ArrayBuffer.isView(object2)) {
|
|
11246
|
+
} else if (recursive && typeof object2 === "object") {
|
|
11247
|
+
for (const key in object2) {
|
|
11248
|
+
getTransferList2(object2[key], recursive, transfersSet);
|
|
11249
|
+
}
|
|
11250
|
+
}
|
|
11251
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
11252
|
+
}
|
|
11253
|
+
function isTransferable2(object2) {
|
|
11254
|
+
if (!object2) {
|
|
11255
|
+
return false;
|
|
11256
|
+
}
|
|
11257
|
+
if (object2 instanceof ArrayBuffer) {
|
|
11258
|
+
return true;
|
|
11259
|
+
}
|
|
11260
|
+
if (typeof MessagePort !== "undefined" && object2 instanceof MessagePort) {
|
|
11261
|
+
return true;
|
|
11262
|
+
}
|
|
11263
|
+
if (typeof ImageBitmap !== "undefined" && object2 instanceof ImageBitmap) {
|
|
11264
|
+
return true;
|
|
11265
|
+
}
|
|
11266
|
+
if (typeof OffscreenCanvas !== "undefined" && object2 instanceof OffscreenCanvas) {
|
|
11267
|
+
return true;
|
|
11268
|
+
}
|
|
11269
|
+
return false;
|
|
11270
|
+
}
|
|
11271
|
+
|
|
11272
|
+
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
11273
|
+
async function createWorker2(process2, processInBatches) {
|
|
11274
|
+
if (!await isWorkerThread()) return;
|
|
11275
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
11276
|
+
}
|
|
11277
|
+
function createWorkerTask(process2, processInBatches) {
|
|
11278
|
+
return {
|
|
11279
|
+
id: "loaders.gl",
|
|
11280
|
+
initialize: (state) => state,
|
|
11281
|
+
destroy: (state) => {
|
|
11282
|
+
var _a;
|
|
11283
|
+
return (_a = state.port) == null ? void 0 : _a.close();
|
|
11284
|
+
},
|
|
11285
|
+
process: async ({ value }, options, context) => {
|
|
11286
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
11287
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
11288
|
+
},
|
|
11289
|
+
...processInBatches ? {
|
|
11290
|
+
processInBatches: async function* (inputs, options, context) {
|
|
11291
|
+
async function* values() {
|
|
11292
|
+
for await (const input of inputs) yield input.value;
|
|
11293
|
+
}
|
|
11294
|
+
for await (const value of processInBatches(
|
|
11295
|
+
values(),
|
|
11296
|
+
options,
|
|
11297
|
+
createContext(context),
|
|
11298
|
+
context.state.context
|
|
11299
|
+
)) {
|
|
11300
|
+
yield { value };
|
|
11301
|
+
}
|
|
11302
|
+
}
|
|
11303
|
+
} : {}
|
|
11304
|
+
};
|
|
11305
|
+
}
|
|
11306
|
+
function createContext(context) {
|
|
11307
|
+
let requestIdentifier = 0;
|
|
11308
|
+
const port = context.state.port;
|
|
11309
|
+
return {
|
|
11310
|
+
signal: context.signal,
|
|
11311
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
11312
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
11313
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
11314
|
+
context.throwIfAborted();
|
|
11315
|
+
const identifier = ++requestIdentifier;
|
|
11316
|
+
return new Promise((resolve, reject) => {
|
|
11317
|
+
const onMessage = (event) => {
|
|
11318
|
+
if (event.data.identifier !== identifier) return;
|
|
11319
|
+
cleanup();
|
|
11320
|
+
if (event.data.error) {
|
|
11321
|
+
const error = new Error(event.data.error.message);
|
|
11322
|
+
error.name = event.data.error.name;
|
|
11323
|
+
reject(error);
|
|
11324
|
+
} else resolve(event.data.value);
|
|
11325
|
+
};
|
|
11326
|
+
const onAbort = () => {
|
|
11327
|
+
cleanup();
|
|
11328
|
+
reject(context.signal.reason);
|
|
11329
|
+
};
|
|
11330
|
+
const cleanup = () => {
|
|
11331
|
+
port.removeEventListener("message", onMessage);
|
|
11332
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
11333
|
+
};
|
|
11334
|
+
port.addEventListener("message", onMessage);
|
|
11335
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
11336
|
+
port.start();
|
|
11337
|
+
try {
|
|
11338
|
+
const request = { identifier, input, options, context: jobContext };
|
|
11339
|
+
port.postMessage(request, getTransferList2(request));
|
|
11340
|
+
} catch (error) {
|
|
11341
|
+
cleanup();
|
|
11342
|
+
reject(error);
|
|
11343
|
+
}
|
|
11344
|
+
});
|
|
11345
|
+
} : void 0
|
|
11346
|
+
};
|
|
11347
|
+
}
|
|
11348
|
+
|
|
10784
11349
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
10785
11350
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
10786
|
-
await
|
|
11351
|
+
await createWorker2(
|
|
10787
11352
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
10788
11353
|
selectLoader(options || {}),
|
|
10789
11354
|
input,
|
|
@@ -11440,7 +12005,7 @@ var I3SBuildingSceneLayerFormat = json(
|
|
|
11440
12005
|
);
|
|
11441
12006
|
|
|
11442
12007
|
// src/i3s/i3s-lepcc-loader-types.ts
|
|
11443
|
-
var VERSION2 = true ? "5.0.0-beta.
|
|
12008
|
+
var VERSION2 = true ? "5.0.0-beta.5" : "latest";
|
|
11444
12009
|
var I3SLEPCCLoader2 = {
|
|
11445
12010
|
...I3SLEPCCFormat,
|
|
11446
12011
|
dataType: null,
|