@loaders.gl/draco 4.4.0-alpha.1 → 4.4.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +110 -26
- package/dist/dist.min.js +6 -6
- package/dist/draco-arrow-loader.d.ts +1 -1
- package/dist/draco-arrow-loader.js +1 -0
- package/dist/draco-arrow-loader.js.map +1 -0
- package/dist/draco-format.js +1 -0
- package/dist/draco-format.js.map +1 -0
- package/dist/draco-loader.d.ts +4 -4
- package/dist/draco-loader.d.ts.map +1 -1
- package/dist/draco-loader.js +2 -1
- package/dist/draco-loader.js.map +1 -0
- package/dist/draco-worker-node.js +197 -91
- package/dist/draco-worker-node.js.map +4 -4
- package/dist/draco-worker.js +98 -26
- package/dist/draco-worker.js.map +2 -2
- package/dist/draco-writer-worker-node.js +158 -72
- package/dist/draco-writer-worker-node.js.map +4 -4
- package/dist/draco-writer-worker.js +60 -7
- package/dist/draco-writer-worker.js.map +2 -2
- package/dist/draco-writer.js +2 -1
- package/dist/draco-writer.js.map +1 -0
- package/dist/draco3d/draco3d-types.js +1 -0
- package/dist/draco3d/draco3d-types.js.map +1 -0
- package/dist/index.cjs +49 -11
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/draco-builder.js +1 -0
- package/dist/lib/draco-builder.js.map +1 -0
- package/dist/lib/draco-module-loader.d.ts +3 -2
- package/dist/lib/draco-module-loader.d.ts.map +1 -1
- package/dist/lib/draco-module-loader.js +53 -10
- package/dist/lib/draco-module-loader.js.map +1 -0
- package/dist/lib/draco-parser.js +1 -0
- package/dist/lib/draco-parser.js.map +1 -0
- package/dist/lib/draco-types.js +1 -0
- package/dist/lib/draco-types.js.map +1 -0
- package/dist/lib/utils/get-draco-schema.js +1 -0
- package/dist/lib/utils/get-draco-schema.js.map +1 -0
- package/dist/lib/utils/version.js +2 -1
- package/dist/lib/utils/version.js.map +1 -0
- package/dist/libs/libs/draco_decoder.wasm +0 -0
- package/dist/libs/libs/draco_encoder.js +52 -0
- package/dist/libs/libs/draco_wasm_wrapper.js +117 -0
- package/dist/workers/draco-worker-node.js +1 -0
- package/dist/workers/draco-worker-node.js.map +1 -0
- package/dist/workers/draco-worker.js +1 -0
- package/dist/workers/draco-worker.js.map +1 -0
- package/dist/workers/draco-writer-worker-node.cjs +18 -0
- package/dist/workers/draco-writer-worker-node.cjs.map +1 -0
- package/dist/workers/draco-writer-worker-node.d.cts +2 -0
- package/dist/workers/draco-writer-worker-node.d.cts.map +1 -0
- package/dist/workers/draco-writer-worker-node.js +1 -0
- package/dist/workers/draco-writer-worker-node.js.map +1 -0
- package/dist/workers/draco-writer-worker.js +1 -0
- package/dist/workers/draco-writer-worker.js.map +1 -0
- package/package.json +19 -7
- package/src/draco-loader.ts +6 -3
- package/src/draco-writer.ts +1 -1
- package/src/lib/draco-module-loader.ts +87 -23
- package/src/workers/draco-writer-worker-node.cjs +18 -0
package/dist/draco-worker.js
CHANGED
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
"loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN."
|
|
10
10
|
);
|
|
11
11
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
12
|
+
warningIssued = true;
|
|
12
13
|
} else {
|
|
13
|
-
globalThis._loadersgl_.version = "4.4.0-alpha.
|
|
14
|
+
globalThis._loadersgl_.version = "4.4.0-alpha.11";
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
return globalThis._loadersgl_.version;
|
|
@@ -173,6 +174,9 @@
|
|
|
173
174
|
return await loadLibraryPromises[libraryUrl];
|
|
174
175
|
}
|
|
175
176
|
function getLibraryUrl(library, moduleName, options = {}, libraryName = null) {
|
|
177
|
+
if (options?.core) {
|
|
178
|
+
throw new Error("loadLibrary: options.core must be pre-normalized");
|
|
179
|
+
}
|
|
176
180
|
if (!options.useLocalLibraries && library.startsWith("http")) {
|
|
177
181
|
return library;
|
|
178
182
|
}
|
|
@@ -198,10 +202,20 @@
|
|
|
198
202
|
return await loadAsArrayBuffer(libraryUrl);
|
|
199
203
|
}
|
|
200
204
|
if (!isBrowser) {
|
|
205
|
+
const { requireFromFile } = globalThis.loaders || {};
|
|
201
206
|
try {
|
|
202
|
-
const
|
|
203
|
-
|
|
207
|
+
const result = await requireFromFile?.(libraryUrl);
|
|
208
|
+
if (result || !libraryUrl.includes("/dist/libs/")) {
|
|
209
|
+
return result;
|
|
210
|
+
}
|
|
211
|
+
return await requireFromFile?.(libraryUrl.replace("/dist/libs/", "/src/libs/"));
|
|
204
212
|
} catch (error) {
|
|
213
|
+
if (libraryUrl.includes("/dist/libs/")) {
|
|
214
|
+
try {
|
|
215
|
+
return await requireFromFile?.(libraryUrl.replace("/dist/libs/", "/src/libs/"));
|
|
216
|
+
} catch {
|
|
217
|
+
}
|
|
218
|
+
}
|
|
205
219
|
console.error(error);
|
|
206
220
|
return null;
|
|
207
221
|
}
|
|
@@ -237,7 +251,14 @@
|
|
|
237
251
|
const response = await fetch(url);
|
|
238
252
|
return await response.arrayBuffer();
|
|
239
253
|
}
|
|
240
|
-
|
|
254
|
+
try {
|
|
255
|
+
return await readFileAsArrayBuffer(url);
|
|
256
|
+
} catch {
|
|
257
|
+
if (url.includes("/dist/libs/")) {
|
|
258
|
+
return await readFileAsArrayBuffer(url.replace("/dist/libs/", "/src/libs/"));
|
|
259
|
+
}
|
|
260
|
+
throw new Error(`Failed to load ArrayBuffer from ${url}`);
|
|
261
|
+
}
|
|
241
262
|
}
|
|
242
263
|
async function loadAsText(url) {
|
|
243
264
|
const { readFileAsText } = globalThis.loaders || {};
|
|
@@ -245,7 +266,14 @@
|
|
|
245
266
|
const response = await fetch(url);
|
|
246
267
|
return await response.text();
|
|
247
268
|
}
|
|
248
|
-
|
|
269
|
+
try {
|
|
270
|
+
return await readFileAsText(url);
|
|
271
|
+
} catch {
|
|
272
|
+
if (url.includes("/dist/libs/")) {
|
|
273
|
+
return await readFileAsText(url.replace("/dist/libs/", "/src/libs/"));
|
|
274
|
+
}
|
|
275
|
+
throw new Error(`Failed to load text from ${url}`);
|
|
276
|
+
}
|
|
249
277
|
}
|
|
250
278
|
|
|
251
279
|
// ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
|
|
@@ -324,7 +352,10 @@
|
|
|
324
352
|
options = {
|
|
325
353
|
...options,
|
|
326
354
|
modules: loader && loader.options && loader.options.modules || {},
|
|
327
|
-
|
|
355
|
+
core: {
|
|
356
|
+
...options.core,
|
|
357
|
+
worker: false
|
|
358
|
+
}
|
|
328
359
|
};
|
|
329
360
|
return await parser(data, { ...options }, context, loader);
|
|
330
361
|
}
|
|
@@ -350,21 +381,32 @@
|
|
|
350
381
|
[DRACO_EXTERNAL_LIBRARIES.ENCODER]: `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`
|
|
351
382
|
};
|
|
352
383
|
var loadDecoderPromise;
|
|
353
|
-
async function loadDracoDecoderModule(options) {
|
|
384
|
+
async function loadDracoDecoderModule(options = {}, type) {
|
|
354
385
|
const modules = options.modules || {};
|
|
355
386
|
if (modules.draco3d) {
|
|
356
387
|
loadDecoderPromise ||= modules.draco3d.createDecoderModule({}).then((draco) => {
|
|
357
388
|
return { draco };
|
|
358
389
|
});
|
|
359
390
|
} else {
|
|
360
|
-
loadDecoderPromise ||= loadDracoDecoder(options);
|
|
391
|
+
loadDecoderPromise ||= loadDracoDecoder(options, type);
|
|
361
392
|
}
|
|
362
393
|
return await loadDecoderPromise;
|
|
363
394
|
}
|
|
364
|
-
|
|
395
|
+
function getLibraryExport(library, exportName) {
|
|
396
|
+
if (library && typeof library === "object") {
|
|
397
|
+
if (library.default) {
|
|
398
|
+
return library.default;
|
|
399
|
+
}
|
|
400
|
+
if (library[exportName]) {
|
|
401
|
+
return library[exportName];
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return library;
|
|
405
|
+
}
|
|
406
|
+
async function loadDracoDecoder(options, type) {
|
|
365
407
|
let DracoDecoderModule;
|
|
366
408
|
let wasmBinary;
|
|
367
|
-
switch (
|
|
409
|
+
switch (type) {
|
|
368
410
|
case "js":
|
|
369
411
|
DracoDecoderModule = await loadLibrary(
|
|
370
412
|
DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
|
|
@@ -375,25 +417,52 @@
|
|
|
375
417
|
break;
|
|
376
418
|
case "wasm":
|
|
377
419
|
default:
|
|
378
|
-
|
|
379
|
-
await
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
420
|
+
try {
|
|
421
|
+
[DracoDecoderModule, wasmBinary] = await Promise.all([
|
|
422
|
+
await loadLibrary(
|
|
423
|
+
DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],
|
|
424
|
+
"draco",
|
|
425
|
+
options,
|
|
426
|
+
DRACO_EXTERNAL_LIBRARIES.DECODER
|
|
427
|
+
),
|
|
428
|
+
await loadLibrary(
|
|
429
|
+
DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],
|
|
430
|
+
"draco",
|
|
431
|
+
options,
|
|
432
|
+
DRACO_EXTERNAL_LIBRARIES.DECODER_WASM
|
|
433
|
+
)
|
|
434
|
+
]);
|
|
435
|
+
} catch {
|
|
436
|
+
DracoDecoderModule = null;
|
|
437
|
+
wasmBinary = null;
|
|
438
|
+
}
|
|
392
439
|
}
|
|
440
|
+
DracoDecoderModule = getLibraryExport(DracoDecoderModule, "DracoDecoderModule");
|
|
393
441
|
DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;
|
|
442
|
+
if (!DracoDecoderModule && !isBrowser) {
|
|
443
|
+
[DracoDecoderModule, wasmBinary] = await Promise.all([
|
|
444
|
+
await loadLibrary(
|
|
445
|
+
DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],
|
|
446
|
+
"draco",
|
|
447
|
+
{ ...options, useLocalLibraries: true },
|
|
448
|
+
DRACO_EXTERNAL_LIBRARIES.DECODER
|
|
449
|
+
),
|
|
450
|
+
await loadLibrary(
|
|
451
|
+
DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],
|
|
452
|
+
"draco",
|
|
453
|
+
{ ...options, useLocalLibraries: true },
|
|
454
|
+
DRACO_EXTERNAL_LIBRARIES.DECODER_WASM
|
|
455
|
+
)
|
|
456
|
+
]);
|
|
457
|
+
DracoDecoderModule = getLibraryExport(DracoDecoderModule, "DracoDecoderModule");
|
|
458
|
+
DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;
|
|
459
|
+
}
|
|
394
460
|
return await initializeDracoDecoder(DracoDecoderModule, wasmBinary);
|
|
395
461
|
}
|
|
396
462
|
function initializeDracoDecoder(DracoDecoderModule, wasmBinary) {
|
|
463
|
+
if (typeof DracoDecoderModule !== "function") {
|
|
464
|
+
throw new Error("DracoDecoderModule could not be loaded");
|
|
465
|
+
}
|
|
397
466
|
const options = {};
|
|
398
467
|
if (wasmBinary) {
|
|
399
468
|
options.wasmBinary = wasmBinary;
|
|
@@ -408,7 +477,7 @@
|
|
|
408
477
|
}
|
|
409
478
|
|
|
410
479
|
// src/lib/utils/version.ts
|
|
411
|
-
var VERSION2 = true ? "4.4.0-alpha.
|
|
480
|
+
var VERSION2 = true ? "4.4.0-alpha.11" : "latest";
|
|
412
481
|
|
|
413
482
|
// ../schema-utils/src/lib/schema/data-type.ts
|
|
414
483
|
function getDataTypeFromTypedArray(array) {
|
|
@@ -1013,7 +1082,10 @@
|
|
|
1013
1082
|
parse
|
|
1014
1083
|
};
|
|
1015
1084
|
async function parse(arrayBuffer, options) {
|
|
1016
|
-
const { draco } = await loadDracoDecoderModule(
|
|
1085
|
+
const { draco } = await loadDracoDecoderModule(
|
|
1086
|
+
options?.core,
|
|
1087
|
+
options?.draco?.decoderType || "wasm"
|
|
1088
|
+
);
|
|
1017
1089
|
const dracoParser = new DracoParser(draco);
|
|
1018
1090
|
try {
|
|
1019
1091
|
return dracoParser.parseSync(arrayBuffer, options?.draco);
|
package/dist/draco-worker.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../worker-utils/src/lib/env-utils/version.ts", "../../worker-utils/src/lib/env-utils/assert.ts", "../../worker-utils/src/lib/env-utils/globals.ts", "../../worker-utils/src/lib/node/worker_threads-browser.ts", "../../worker-utils/src/lib/worker-utils/get-transfer-list.ts", "../../worker-utils/src/lib/worker-farm/worker-body.ts", "../../worker-utils/src/lib/library-utils/library-utils.ts", "../../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts", "../src/lib/draco-module-loader.ts", "../src/lib/utils/version.ts", "../../schema-utils/src/lib/schema/data-type.ts", "../../schema-utils/src/lib/mesh/mesh-utils.ts", "../../schema-utils/src/lib/mesh/deduce-mesh-schema.ts", "../src/lib/utils/get-draco-schema.ts", "../src/lib/draco-parser.ts", "../src/draco-loader.ts", "../src/workers/draco-worker.ts"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {NPM_TAG} from '../npm-tag';\n\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\ndeclare let __VERSION__: string;\n\nfunction getVersion() {\n if (!globalThis._loadersgl_?.version) {\n globalThis._loadersgl_ = globalThis._loadersgl_ || {};\n // __VERSION__ is injected by babel-plugin-version-inline\n if (typeof __VERSION__ === 'undefined') {\n // eslint-disable-next-line\n console.warn(\n 'loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.'\n );\n globalThis._loadersgl_.version = NPM_TAG;\n } else {\n globalThis._loadersgl_.version = __VERSION__;\n }\n }\n\n return globalThis._loadersgl_.version;\n}\n\nexport const VERSION = getVersion();\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Replacement for the external assert method to reduce bundle size\n// Note: We don't use the second \"message\" argument in calling code,\n// so no need to support it here\n\n/** Throws an `Error` with the optional `message` if `condition` is falsy */\nexport function assert(condition: any, message?: string): void {\n if (!condition) {\n throw new Error(message || 'loaders.gl assertion failed.');\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Purpose: include this in your module to avoids adding dependencies on\n// micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst globals = {\n self: typeof self !== 'undefined' && self,\n window: typeof window !== 'undefined' && window,\n global: typeof global !== 'undefined' && global,\n document: typeof document !== 'undefined' && document\n};\n\nconst self_: {[key: string]: any} = globals.self || globals.window || globals.global || {};\nconst window_: {[key: string]: any} = globals.window || globals.self || globals.global || {};\nconst global_: {[key: string]: any} = globals.global || globals.self || globals.window || {};\nconst document_: {[key: string]: any} = globals.document || {};\n\nexport {self_ as self, window_ as window, global_ as global, document_ as document};\n\n/** true if running in the browser, false if running in Node.js */\nexport const isBrowser: boolean =\n // @ts-ignore process.browser\n typeof process !== 'object' || String(process) !== '[object process]' || process.browser;\n\n/** true if running on a worker thread */\nexport const isWorker: boolean = typeof importScripts === 'function';\n\n/** true if running on a mobile device */\nexport const isMobile: boolean =\n typeof window !== 'undefined' && typeof window.orientation !== 'undefined';\n\n// Extract node major version\nconst matches =\n typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);\n\n/** Version of Node.js if running under Node, otherwise 0 */\nexport const nodeVersion: number = (matches && parseFloat(matches[1])) || 0;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/** Browser polyfill for Node.js built-in `worker_threads` module.\n * These fills are non-functional, and just intended to ensure that\n * `import 'worker_threads` doesn't break browser builds.\n * The replacement is done in package.json browser field\n */\nexport class NodeWorker {\n terminate() {}\n}\n\nexport type {NodeWorker as NodeWorkerType};\n\nexport const parentPort = null;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// NOTE - there is a copy of this function is both in core and loader-utils\n// core does not need all the utils in loader-utils, just this one.\n\n/**\n * Returns an array of Transferrable objects that can be used with postMessage\n * https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage\n * @param object data to be sent via postMessage\n * @param recursive - not for application use\n * @param transfers - not for application use\n * @returns a transfer list that can be passed to postMessage\n */\nexport function getTransferList(\n object: any,\n recursive: boolean = true,\n transfers?: Set<any>\n): Transferable[] {\n // Make sure that items in the transfer list is unique\n const transfersSet = transfers || new Set();\n\n if (!object) {\n // ignore\n } else if (isTransferable(object)) {\n transfersSet.add(object);\n } else if (isTransferable(object.buffer)) {\n // Typed array\n transfersSet.add(object.buffer);\n } else if (ArrayBuffer.isView(object)) {\n // object is a TypeArray viewing into a SharedArrayBuffer (not transferable)\n // Do not iterate through the content in this case\n } else if (recursive && typeof object === 'object') {\n for (const key in object) {\n // Avoid perf hit - only go one level deep\n getTransferList(object[key], recursive, transfersSet);\n }\n }\n\n // If transfers is defined, is internal recursive call\n // Otherwise it's called by the user\n return transfers === undefined ? Array.from(transfersSet) : [];\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/Transferable\nfunction isTransferable(object: unknown) {\n if (!object) {\n return false;\n }\n if (object instanceof ArrayBuffer) {\n return true;\n }\n if (typeof MessagePort !== 'undefined' && object instanceof MessagePort) {\n return true;\n }\n if (typeof ImageBitmap !== 'undefined' && object instanceof ImageBitmap) {\n return true;\n }\n // @ts-ignore\n if (typeof OffscreenCanvas !== 'undefined' && object instanceof OffscreenCanvas) {\n return true;\n }\n return false;\n}\n\n/**\n * Recursively drop non serializable values like functions and regexps.\n * @param object\n */\nexport function getTransferListForWriter(object: object | null): object {\n if (object === null) {\n return {};\n }\n const clone = Object.assign({}, object);\n\n Object.keys(clone).forEach((key) => {\n // Typed Arrays and Arrays are passed with no change\n if (\n typeof object[key] === 'object' &&\n !ArrayBuffer.isView(object[key]) &&\n !(object[key] instanceof Array)\n ) {\n clone[key] = getTransferListForWriter(object[key]);\n } else if (typeof clone[key] === 'function' || clone[key] instanceof RegExp) {\n clone[key] = {};\n } else {\n clone[key] = object[key];\n }\n });\n\n return clone;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {WorkerMessageData, WorkerMessageType, WorkerMessagePayload} from '../../types';\nimport {getTransferList} from '../worker-utils/get-transfer-list';\n// import type {TransferListItem} from '../node/worker_threads';\nimport {parentPort} from '../node/worker_threads';\n\ntype TransferListItem = any;\n\n/** Vile hack to defeat over-zealous bundlers from stripping out the require */\nasync function getParentPort() {\n // const isNode = globalThis.process;\n // let parentPort;\n // try {\n // // prettier-ignore\n // eval('globalThis.parentPort = require(\\'worker_threads\\').parentPort'); // eslint-disable-line no-eval\n // parentPort = globalThis.parentPort;\n // } catch {\n // try {\n // // prettier-ignore\n // eval('globalThis.workerThreadsPromise = import(\\'worker_threads\\')'); // eslint-disable-line no-eval\n // const workerThreads = await globalThis.workerThreadsPromise;\n // parentPort = workerThreads.parentPort;\n // } catch (error) {\n // console.error((error as Error).message); // eslint-disable-line no-console\n // }\n // }\n return parentPort;\n}\n\nconst onMessageWrapperMap = new Map();\n\n/**\n * Type safe wrapper for worker code\n */\nexport default class WorkerBody {\n /** Check that we are actually in a worker thread */\n static async inWorkerThread(): Promise<boolean> {\n return typeof self !== 'undefined' || Boolean(await getParentPort());\n }\n\n /*\n * (type: WorkerMessageType, payload: WorkerMessagePayload) => any\n */\n static set onmessage(onMessage: (type: WorkerMessageType, payload: WorkerMessagePayload) => any) {\n async function handleMessage(message) {\n const parentPort = await getParentPort();\n // Confusingly the message itself also has a 'type' field which is always set to 'message'\n const {type, payload} = parentPort ? message : message.data;\n // if (!isKnownMessage(message)) {\n // return;\n // }\n onMessage(type, payload);\n }\n\n getParentPort().then((parentPort) => {\n if (parentPort) {\n parentPort.on('message', (message) => {\n handleMessage(message);\n });\n // if (message == 'exit') { parentPort.unref(); }\n // eslint-disable-next-line\n parentPort.on('exit', () => console.debug('Node worker closing'));\n } else {\n // eslint-disable-next-line no-restricted-globals\n globalThis.onmessage = handleMessage;\n }\n });\n }\n\n static async addEventListener(\n onMessage: (type: WorkerMessageType, payload: WorkerMessagePayload) => any\n ) {\n let onMessageWrapper = onMessageWrapperMap.get(onMessage);\n\n if (!onMessageWrapper) {\n onMessageWrapper = async (message: MessageEvent<any>) => {\n if (!isKnownMessage(message)) {\n return;\n }\n\n const parentPort = await getParentPort();\n // Confusingly in the browser, the message itself also has a 'type' field which is always set to 'message'\n const {type, payload} = parentPort ? message : message.data;\n onMessage(type, payload);\n };\n }\n\n const parentPort = await getParentPort();\n if (parentPort) {\n console.error('not implemented'); // eslint-disable-line\n } else {\n globalThis.addEventListener('message', onMessageWrapper);\n }\n }\n\n static async removeEventListener(\n onMessage: (type: WorkerMessageType, payload: WorkerMessagePayload) => any\n ) {\n const onMessageWrapper = onMessageWrapperMap.get(onMessage);\n onMessageWrapperMap.delete(onMessage);\n const parentPort = await getParentPort();\n if (parentPort) {\n console.error('not implemented'); // eslint-disable-line\n } else {\n globalThis.removeEventListener('message', onMessageWrapper);\n }\n }\n\n /**\n * Send a message from a worker to creating thread (main thread)\n * @param type\n * @param payload\n */\n static async postMessage(type: WorkerMessageType, payload: WorkerMessagePayload): Promise<void> {\n const data: WorkerMessageData = {source: 'loaders.gl', type, payload};\n // console.log('posting message', data);\n\n // Cast to Node compatible transfer list\n const transferList = getTransferList(payload) as TransferListItem[];\n\n const parentPort = await getParentPort();\n if (parentPort) {\n parentPort.postMessage(data, transferList);\n // console.log('posted message', data);\n } else {\n // @ts-expect-error Outside of worker scopes this call has a third parameter\n globalThis.postMessage(data, transferList);\n }\n }\n}\n\n// Filter out noise messages sent to workers\nfunction isKnownMessage(message: MessageEvent<any>) {\n const {type, data} = message;\n return (\n type === 'message' &&\n data &&\n typeof data.source === 'string' &&\n data.source.startsWith('loaders.gl')\n );\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* global importScripts */\nimport {isBrowser, isWorker} from '../env-utils/globals';\nimport {assert} from '../env-utils/assert';\nimport {VERSION} from '../env-utils/version';\n\nconst loadLibraryPromises: Record<string, Promise<any>> = {}; // promises\n\n/**\n * Dynamically loads a library (\"module\")\n *\n * - wasm library: Array buffer is returned\n * - js library: Parse JS is returned\n *\n * Method depends on environment\n * - browser - script element is created and installed on document\n * - worker - eval is called on global context\n * - node - file is required\n *\n * @param libraryUrl\n * @param moduleName\n * @param options\n */\nexport async function loadLibrary(\n libraryUrl: string,\n moduleName: string | null = null,\n options: object = {},\n libraryName: string | null = null\n): Promise<any> {\n if (moduleName) {\n libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);\n }\n // Ensure libraries are only loaded once\n\n loadLibraryPromises[libraryUrl] =\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);\n return await loadLibraryPromises[libraryUrl];\n}\n\n// TODO - sort out how to resolve paths for main/worker and dev/prod\nexport function getLibraryUrl(\n library: string,\n moduleName?: string,\n options: any = {},\n libraryName: string | null = null\n): string {\n // Check if already a URL\n if (!options.useLocalLibraries && library.startsWith('http')) {\n return library;\n }\n\n libraryName = libraryName || library;\n\n // Allow application to import and supply libraries through `options.modules`\n // TODO - See js-module-utils in loader-utils\n const modules = options.modules || {};\n if (modules[libraryName]) {\n return modules[libraryName];\n }\n\n // Load from local files, not from CDN scripts in Node.js\n // TODO - needs to locate the modules directory when installed!\n if (!isBrowser) {\n return `modules/${moduleName}/dist/libs/${libraryName}`;\n }\n\n // In browser, load from external scripts\n if (options.CDN) {\n assert(options.CDN.startsWith('http'));\n return `${options.CDN}/${moduleName}@${VERSION}/dist/libs/${libraryName}`;\n }\n\n // TODO - loading inside workers requires paths relative to worker script location...\n if (isWorker) {\n return `../src/libs/${libraryName}`;\n }\n\n return `modules/${moduleName}/src/libs/${libraryName}`;\n}\n\nasync function loadLibraryFromFile(libraryUrl: string): Promise<any> {\n if (libraryUrl.endsWith('wasm')) {\n return await loadAsArrayBuffer(libraryUrl);\n }\n\n if (!isBrowser) {\n // TODO - Node doesn't yet support dynamic import from https URLs\n // try {\n // return await import(libraryUrl);\n // } catch (error) {\n // console.error(error);\n // }\n try {\n const {requireFromFile} = globalThis.loaders || {};\n return await requireFromFile?.(libraryUrl);\n } catch (error) {\n console.error(error); // eslint-disable-line no-console\n return null;\n }\n }\n if (isWorker) {\n return importScripts(libraryUrl);\n }\n // TODO - fix - should be more secure than string parsing since observes CORS\n // if (isBrowser) {\n // return await loadScriptFromFile(libraryUrl);\n // }\n\n const scriptSource = await loadAsText(libraryUrl);\n return loadLibraryFromString(scriptSource, libraryUrl);\n}\n\n/*\nasync function loadScriptFromFile(libraryUrl) {\n const script = document.createElement('script');\n script.src = libraryUrl;\n return await new Promise((resolve, reject) => {\n script.onload = data => {\n resolve(data);\n };\n script.onerror = reject;\n });\n}\n*/\n\n// TODO - Needs security audit...\n// - Raw eval call\n// - Potentially bypasses CORS\n// Upside is that this separates fetching and parsing\n// we could create a`LibraryLoader` or`ModuleLoader`\nfunction loadLibraryFromString(scriptSource: string, id: string): null | any {\n if (!isBrowser) {\n const {requireFromString} = globalThis.loaders || {};\n return requireFromString?.(scriptSource, id);\n }\n\n if (isWorker) {\n // Use lvalue trick to make eval run in global scope\n eval.call(globalThis, scriptSource); // eslint-disable-line no-eval\n // https://stackoverflow.com/questions/9107240/1-evalthis-vs-evalthis-in-javascript\n // http://perfectionkills.com/global-eval-what-are-the-options/\n return null;\n }\n\n const script = document.createElement('script');\n script.id = id;\n // most browsers like a separate text node but some throw an error. The second method covers those.\n try {\n script.appendChild(document.createTextNode(scriptSource));\n } catch (e) {\n script.text = scriptSource;\n }\n document.body.appendChild(script);\n return null;\n}\n\n// TODO - technique for module injection into worker, from THREE.DracoLoader...\n/*\nfunction combineWorkerWithLibrary(worker, jsContent) {\n var fn = wWorker.toString();\n var body = [\n '// injected',\n jsContent,\n '',\n '// worker',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}'))\n ].join('\\n');\n this.workerSourceURL = URL.createObjectURL(new Blob([body]));\n}\n*/\n\nasync function loadAsArrayBuffer(url: string): Promise<ArrayBuffer> {\n const {readFileAsArrayBuffer} = globalThis.loaders || {};\n if (isBrowser || !readFileAsArrayBuffer || url.startsWith('http')) {\n const response = await fetch(url);\n return await response.arrayBuffer();\n }\n return await readFileAsArrayBuffer(url);\n}\n\n/**\n * Load a file from local file system\n * @param filename\n * @returns\n */\nasync function loadAsText(url: string): Promise<string> {\n const {readFileAsText} = globalThis.loaders || {};\n if (isBrowser || !readFileAsText || url.startsWith('http')) {\n const response = await fetch(url);\n return await response.text();\n }\n return await readFileAsText(url);\n}\n", "/* eslint-disable no-restricted-globals */\nimport type {LoaderWithParser, LoaderOptions, LoaderContext} from '../../loader-types';\nimport {WorkerBody} from '@loaders.gl/worker-utils';\n// import {validateLoaderVersion} from './validate-loader-version';\n\nlet requestId = 0;\n\n/**\n * Set up a WebWorkerGlobalScope to talk with the main thread\n * @param loader\n */\nexport async function createLoaderWorker(loader: LoaderWithParser) {\n // Check that we are actually in a worker thread\n if (!(await WorkerBody.inWorkerThread())) {\n return;\n }\n\n WorkerBody.onmessage = async (type, payload) => {\n switch (type) {\n case 'process':\n try {\n // validateLoaderVersion(loader, data.source.split('@')[1]);\n\n const {input, options = {}, context = {}} = payload;\n\n const result = await parseData({\n loader,\n arrayBuffer: input,\n options,\n // @ts-expect-error fetch missing\n context: {\n ...context,\n _parse: parseOnMainThread\n }\n });\n WorkerBody.postMessage('done', {result});\n } catch (error) {\n const message = error instanceof Error ? error.message : '';\n WorkerBody.postMessage('error', {error: message});\n }\n break;\n default:\n }\n };\n}\n\nfunction parseOnMainThread(\n arrayBuffer: ArrayBuffer,\n loader: any,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const id = requestId++;\n\n /**\n */\n const onMessage = (type, payload) => {\n if (payload.id !== id) {\n // not ours\n return;\n }\n\n switch (type) {\n case 'done':\n WorkerBody.removeEventListener(onMessage);\n resolve(payload.result);\n break;\n\n case 'error':\n WorkerBody.removeEventListener(onMessage);\n reject(payload.error);\n break;\n\n default:\n // ignore\n }\n };\n\n WorkerBody.addEventListener(onMessage);\n\n // Ask the main thread to decode data\n const payload = {id, input: arrayBuffer, options};\n WorkerBody.postMessage('process', payload);\n });\n}\n\n// TODO - Support byteOffset and byteLength (enabling parsing of embedded binaries without copies)\n// TODO - Why not support async loader.parse* funcs here?\n// TODO - Why not reuse a common function instead of reimplementing loader.parse* selection logic? Keeping loader small?\n// TODO - Lack of appropriate parser functions can be detected when we create worker, no need to wait until parse\nasync function parseData({\n loader,\n arrayBuffer,\n options,\n context\n}: {\n loader: LoaderWithParser;\n arrayBuffer: ArrayBuffer;\n options: LoaderOptions;\n context: LoaderContext;\n}) {\n let data;\n let parser;\n if (loader.parseSync || loader.parse) {\n data = arrayBuffer;\n parser = loader.parseSync || loader.parse;\n } else if (loader.parseTextSync) {\n const textDecoder = new TextDecoder();\n data = textDecoder.decode(arrayBuffer);\n parser = loader.parseTextSync;\n } else {\n throw new Error(`Could not load data with ${loader.name} loader`);\n }\n\n // TODO - proper merge in of loader options...\n options = {\n ...options,\n modules: (loader && loader.options && loader.options.modules) || {},\n worker: false\n };\n\n return await parser(data, {...options}, context, loader);\n}\n", "// Dynamic DRACO module loading inspired by THREE.DRACOLoader\n// https://github.com/mrdoob/three.js/blob/398c4f39ebdb8b23eefd4a7a5ec49ec0c96c7462/examples/jsm/loaders/DRACOLoader.js\n// by Don McCurdy / https://www.donmccurdy.com / MIT license\n\nimport {loadLibrary} from '@loaders.gl/worker-utils';\n\nconst DRACO_DECODER_VERSION = '1.5.6';\nconst DRACO_ENCODER_VERSION = '1.4.1';\n\nconst STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;\n\nexport const DRACO_EXTERNAL_LIBRARIES = {\n /** The primary Draco3D encoder, javascript wrapper part */\n DECODER: 'draco_wasm_wrapper.js',\n /** The primary draco decoder, compiled web assembly part */\n DECODER_WASM: 'draco_decoder.wasm',\n /** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */\n FALLBACK_DECODER: 'draco_decoder.js',\n /** Draco encoder */\n ENCODER: 'draco_encoder.js'\n};\n\nexport const DRACO_EXTERNAL_LIBRARY_URLS = {\n [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,\n [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,\n [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,\n [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`\n};\n\nlet loadDecoderPromise;\nlet loadEncoderPromise;\n\nexport async function loadDracoDecoderModule(options) {\n const modules = options.modules || {};\n\n // Check if a bundled draco3d library has been supplied by application\n if (modules.draco3d) {\n loadDecoderPromise ||= modules.draco3d.createDecoderModule({}).then((draco) => {\n return {draco};\n });\n } else {\n // If not, dynamically load the WASM script from our CDN\n loadDecoderPromise ||= loadDracoDecoder(options);\n }\n return await loadDecoderPromise;\n}\n\nexport async function loadDracoEncoderModule(options) {\n const modules = options.modules || {};\n\n // Check if a bundled draco3d library has been supplied by application\n if (modules.draco3d) {\n loadEncoderPromise ||= modules.draco3d.createEncoderModule({}).then((draco) => {\n return {draco};\n });\n } else {\n // If not, dynamically load the WASM script from our CDN\n loadEncoderPromise ||= loadDracoEncoder(options);\n }\n return await loadEncoderPromise;\n}\n\n// DRACO DECODER LOADING\n\nasync function loadDracoDecoder(options) {\n let DracoDecoderModule;\n let wasmBinary;\n switch (options.draco && options.draco.decoderType) {\n case 'js':\n DracoDecoderModule = await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],\n 'draco',\n options,\n DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER\n );\n break;\n\n case 'wasm':\n default:\n [DracoDecoderModule, wasmBinary] = await Promise.all([\n await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],\n 'draco',\n options,\n DRACO_EXTERNAL_LIBRARIES.DECODER\n ),\n await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],\n 'draco',\n options,\n DRACO_EXTERNAL_LIBRARIES.DECODER_WASM\n )\n ]);\n }\n // Depends on how import happened...\n // @ts-ignore\n DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;\n return await initializeDracoDecoder(DracoDecoderModule, wasmBinary);\n}\n\nfunction initializeDracoDecoder(DracoDecoderModule, wasmBinary) {\n const options: {wasmBinary?: any} = {};\n if (wasmBinary) {\n options.wasmBinary = wasmBinary;\n }\n\n return new Promise((resolve) => {\n DracoDecoderModule({\n ...options,\n onModuleLoaded: (draco) => resolve({draco}) // Module is Promise-like. Wrap in object to avoid loop.\n });\n });\n}\n\n// ENCODER\n\nasync function loadDracoEncoder(options) {\n let DracoEncoderModule = await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER],\n 'draco',\n options,\n DRACO_EXTERNAL_LIBRARIES.ENCODER\n );\n // @ts-ignore\n DracoEncoderModule = DracoEncoderModule || globalThis.DracoEncoderModule;\n\n return new Promise((resolve) => {\n DracoEncoderModule({\n onModuleLoaded: (draco) => resolve({draco}) // Module is Promise-like. Wrap in object to avoid loop.\n });\n });\n}\n", "// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {DataType, TypedArray, TypedArrayConstructor, ArrayType} from '@loaders.gl/schema';\n\n/** Deduce column types from values */\nexport function getDataTypeFromValue(\n value: unknown,\n defaultNumberType: 'float32' = 'float32'\n): DataType {\n if (value instanceof Date) {\n return 'date-millisecond';\n }\n if (value instanceof Number) {\n return defaultNumberType;\n }\n if (typeof value === 'string') {\n return 'utf8';\n }\n if (value === null || value === 'undefined') {\n return 'null';\n }\n return 'null';\n}\n\n/**\n * Deduces a simple data type \"descriptor from a typed array instance\n */\nexport function getDataTypeFromArray(array: ArrayType): {type: DataType; nullable: boolean} {\n let type = getDataTypeFromTypedArray(array as TypedArray);\n if (type !== 'null') {\n return {type, nullable: false};\n }\n if (array.length > 0) {\n type = getDataTypeFromValue(array[0]);\n return {type, nullable: true};\n }\n\n return {type: 'null', nullable: true};\n}\n\n/**\n * Deduces a simple data type \"descriptor from a typed array instance\n */\nexport function getDataTypeFromTypedArray(array: TypedArray): DataType {\n switch (array.constructor) {\n case Int8Array:\n return 'int8';\n case Uint8Array:\n case Uint8ClampedArray:\n return 'uint8';\n case Int16Array:\n return 'int16';\n case Uint16Array:\n return 'uint16';\n case Int32Array:\n return 'int32';\n case Uint32Array:\n return 'uint32';\n case Float32Array:\n return 'float32';\n case Float64Array:\n return 'float64';\n default:\n return 'null';\n }\n}\n\nexport function getArrayTypeFromDataType(\n type: DataType,\n nullable: boolean | undefined\n): TypedArrayConstructor | ArrayConstructor {\n if (!nullable) {\n switch (type) {\n case 'int8':\n return Int8Array;\n case 'uint8':\n return Uint8Array;\n case 'int16':\n return Int16Array;\n case 'uint16':\n return Uint16Array;\n case 'int32':\n return Int32Array;\n case 'uint32':\n return Uint32Array;\n case 'float32':\n return Float32Array;\n case 'float64':\n return Float64Array;\n default:\n break;\n }\n }\n\n // if (typeof BigInt64Array !== 'undefined') {\n // TYPED_ARRAY_TO_TYPE.BigInt64Array = new Int64();\n // TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();\n // }\n\n return Array;\n}\n", "// Mesh category utilities\n// TODO - move to mesh category module, or to math.gl/geometry module\nimport {MeshAttributes} from '@loaders.gl/schema';\nimport {TypedArray} from '../../types/types';\n\ntype TypedArrays = {[key: string]: TypedArray};\n\n/**\n * Holds an axis aligned bounding box\n * TODO - make sure AxisAlignedBoundingBox in math.gl/culling understands this format (or change this format)\n */\ntype BoundingBox = [[number, number, number], [number, number, number]];\n\n/**\n * Get number of vertices in mesh\n * @param attributes\n */\nexport function getMeshSize(attributes: TypedArrays): number {\n let size = 0;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n if (ArrayBuffer.isView(attribute)) {\n // @ts-ignore DataView doesn't have BYTES_PER_ELEMENT\n size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;\n }\n }\n return size;\n}\n\n/**\n * Get the (axis aligned) bounding box of a mesh\n * @param attributes\n * @returns array of two vectors representing the axis aligned bounding box\n */\n// eslint-disable-next-line complexity\nexport function getMeshBoundingBox(attributes: MeshAttributes): BoundingBox {\n let minX = Infinity;\n let minY = Infinity;\n let minZ = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n let maxZ = -Infinity;\n\n const positions = attributes.POSITION ? attributes.POSITION.value : [];\n const len = positions && positions.length;\n\n for (let i = 0; i < len; i += 3) {\n const x = positions[i];\n const y = positions[i + 1];\n const z = positions[i + 2];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n minZ = z < minZ ? z : minZ;\n\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n maxZ = z > maxZ ? z : maxZ;\n }\n return [\n [minX, minY, minZ],\n [maxX, maxY, maxZ]\n ];\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {MeshAttribute, MeshAttributes, Schema, Field} from '@loaders.gl/schema';\nimport {getDataTypeFromTypedArray} from '../schema/data-type';\n\n/**\n * Create a schema for mesh attributes data\n * @param attributes\n * @param metadata\n * @returns\n */\nexport function deduceMeshSchema(\n attributes: MeshAttributes,\n metadata: Record<string, string> = {}\n): Schema {\n const fields = deduceMeshFields(attributes);\n return {fields, metadata};\n}\n\n/**\n * Create arrow-like schema field for mesh attribute\n * @param attributeName\n * @param attribute\n * @param optionalMetadata\n * @returns\n */\nexport function deduceMeshField(\n name: string,\n attribute: MeshAttribute,\n optionalMetadata?: Record<string, string>\n): Field {\n const type = getDataTypeFromTypedArray(attribute.value);\n const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);\n return {\n name,\n type: {type: 'fixed-size-list', listSize: attribute.size, children: [{name: 'value', type}]},\n nullable: false,\n metadata\n };\n}\n\n/**\n * Create fields array for mesh attributes\n * @param attributes\n * @returns\n */\nfunction deduceMeshFields(attributes: MeshAttributes): Field[] {\n const fields: Field[] = [];\n for (const attributeName in attributes) {\n const attribute: MeshAttribute = attributes[attributeName];\n fields.push(deduceMeshField(attributeName, attribute));\n }\n return fields;\n}\n\n/**\n * Make metadata by mesh attribute properties\n * @param attribute\n * @returns\n */\nexport function makeMeshAttributeMetadata(attribute: MeshAttribute): Record<string, string> {\n const result: Record<string, string> = {};\n if ('byteOffset' in attribute) {\n result.byteOffset = attribute.byteOffset!.toString(10);\n }\n if ('byteStride' in attribute) {\n result.byteStride = attribute.byteStride!.toString(10);\n }\n if ('normalized' in attribute) {\n result.normalized = attribute.normalized!.toString();\n }\n return result;\n}\n", "import {MeshAttribute, Schema, Field} from '@loaders.gl/schema';\nimport {deduceMeshField} from '@loaders.gl/schema-utils';\nimport type {DracoAttribute, DracoLoaderData, DracoMetadataEntry} from '../draco-types';\n\n/** Extract an arrow-like schema from a Draco mesh */\nexport function getDracoSchema(\n attributes: {[attributeName: string]: MeshAttribute},\n loaderData: DracoLoaderData,\n indices?: MeshAttribute\n): Schema {\n const metadata = makeMetadata(loaderData.metadata);\n const fields: Field[] = [];\n const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const field = getArrowFieldFromAttribute(\n attributeName,\n attribute,\n namedLoaderDataAttributes[attributeName]\n );\n fields.push(field);\n }\n if (indices) {\n const indicesField = getArrowFieldFromAttribute('indices', indices);\n fields.push(indicesField);\n }\n return {fields, metadata};\n}\n\nfunction transformAttributesLoaderData(loaderData: {[key: number]: DracoAttribute}): {\n [attributeName: string]: DracoAttribute;\n} {\n const result: {[attributeName: string]: DracoAttribute} = {};\n for (const key in loaderData) {\n const dracoAttribute = loaderData[key];\n result[dracoAttribute.name || 'undefined'] = dracoAttribute;\n }\n return result;\n}\n\nfunction getArrowFieldFromAttribute(\n attributeName: string,\n attribute: MeshAttribute,\n loaderData?: DracoAttribute\n): Field {\n const metadataMap = loaderData ? makeMetadata(loaderData.metadata) : undefined;\n const field = deduceMeshField(attributeName, attribute, metadataMap);\n return field;\n}\n\nfunction makeMetadata(metadata: {[key: string]: DracoMetadataEntry}): Record<string, string> {\n Object.entries(metadata);\n const serializedMetadata: Record<string, string> = {};\n for (const key in metadata) {\n serializedMetadata[`${key}.string`] = JSON.stringify(metadata[key]);\n }\n return serializedMetadata;\n}\n", "/* eslint-disable camelcase */\n\nimport type {TypedArray, MeshAttribute, MeshGeometry} from '@loaders.gl/schema';\n\n// Draco types (input)\nimport type {\n Draco3D,\n Decoder,\n Mesh,\n PointCloud,\n PointAttribute,\n Metadata,\n MetadataQuerier,\n DracoInt32Array,\n draco_DataType\n} from '../draco3d/draco3d-types';\n\n// Parsed data types (output)\nimport type {\n DracoMesh,\n DracoLoaderData,\n DracoAttribute,\n DracoMetadataEntry,\n DracoQuantizationTransform,\n DracoOctahedronTransform\n} from './draco-types';\n\nimport {getMeshBoundingBox} from '@loaders.gl/schema-utils';\nimport {getDracoSchema} from './utils/get-draco-schema';\n\n/** Options to control draco parsing */\nexport type DracoParseOptions = {\n /** How triangle indices should be generated (mesh only) */\n topology?: 'triangle-list' | 'triangle-strip';\n /** Specify which attribute metadata entry stores the attribute name */\n attributeNameEntry?: string;\n /** Names and ids of extra attributes to include in the output */\n extraAttributes?: {[uniqueId: string]: number};\n /** Skip transforms specific quantized attributes */\n quantizedAttributes?: ('POSITION' | 'NORMAL' | 'COLOR' | 'TEX_COORD' | 'GENERIC')[];\n /** Skip transforms specific octahedron encoded attributes */\n octahedronAttributes?: ('POSITION' | 'NORMAL' | 'COLOR' | 'TEX_COORD' | 'GENERIC')[];\n};\n\n// @ts-ignore\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst GEOMETRY_TYPE = {\n TRIANGULAR_MESH: 0,\n POINT_CLOUD: 1\n};\n\n// Native Draco attribute names to GLTF attribute names.\nconst DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP = {\n POSITION: 'POSITION',\n NORMAL: 'NORMAL',\n COLOR: 'COLOR_0',\n TEX_COORD: 'TEXCOORD_0'\n};\n\nconst DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP = {\n 1: Int8Array,\n 2: Uint8Array,\n 3: Int16Array,\n 4: Uint16Array,\n 5: Int32Array,\n 6: Uint32Array,\n // 7: BigInt64Array,\n // 8: BigUint64Array,\n 9: Float32Array\n // 10: Float64Array\n // 11: BOOL - What array type do we use for this?\n};\n\nconst INDEX_ITEM_SIZE = 4;\n\nexport default class DracoParser {\n draco: Draco3D;\n decoder: Decoder;\n metadataQuerier: MetadataQuerier;\n\n // draco - the draco decoder, either import `draco3d` or load dynamically\n constructor(draco: Draco3D) {\n this.draco = draco;\n this.decoder = new this.draco.Decoder();\n this.metadataQuerier = new this.draco.MetadataQuerier();\n }\n\n /**\n * Destroy draco resources\n */\n destroy(): void {\n this.draco.destroy(this.decoder);\n this.draco.destroy(this.metadataQuerier);\n }\n\n /**\n * NOTE: caller must call `destroyGeometry` on the return value after using it\n * @param arrayBuffer\n * @param options\n */\n parseSync(arrayBuffer: ArrayBuffer, options: DracoParseOptions = {}): DracoMesh {\n const buffer = new this.draco.DecoderBuffer();\n buffer.Init(new Int8Array(arrayBuffer), arrayBuffer.byteLength);\n\n this._disableAttributeTransforms(options);\n\n const geometry_type = this.decoder.GetEncodedGeometryType(buffer);\n const dracoGeometry =\n geometry_type === this.draco.TRIANGULAR_MESH\n ? new this.draco.Mesh()\n : new this.draco.PointCloud();\n\n try {\n let dracoStatus;\n switch (geometry_type) {\n case this.draco.TRIANGULAR_MESH:\n dracoStatus = this.decoder.DecodeBufferToMesh(buffer, dracoGeometry as Mesh);\n break;\n\n case this.draco.POINT_CLOUD:\n dracoStatus = this.decoder.DecodeBufferToPointCloud(buffer, dracoGeometry);\n break;\n\n default:\n throw new Error('DRACO: Unknown geometry type.');\n }\n\n if (!dracoStatus.ok() || !dracoGeometry.ptr) {\n const message = `DRACO decompression failed: ${dracoStatus.error_msg()}`;\n // console.error(message);\n throw new Error(message);\n }\n\n const loaderData = this._getDracoLoaderData(dracoGeometry, geometry_type, options);\n\n const geometry = this._getMeshData(dracoGeometry, loaderData, options);\n\n const boundingBox = getMeshBoundingBox(geometry.attributes);\n\n const schema = getDracoSchema(geometry.attributes, loaderData, geometry.indices);\n\n const data: DracoMesh = {\n loader: 'draco',\n loaderData,\n header: {\n vertexCount: dracoGeometry.num_points(),\n boundingBox\n },\n ...geometry,\n schema\n };\n return data;\n } finally {\n this.draco.destroy(buffer);\n if (dracoGeometry) {\n this.draco.destroy(dracoGeometry);\n }\n }\n }\n\n // Draco specific \"loader data\"\n\n /**\n * Extract\n * @param dracoGeometry\n * @param geometry_type\n * @param options\n * @returns\n */\n _getDracoLoaderData(\n dracoGeometry: Mesh | PointCloud,\n geometry_type,\n options: DracoParseOptions\n ): DracoLoaderData {\n const metadata = this._getTopLevelMetadata(dracoGeometry);\n const attributes = this._getDracoAttributes(dracoGeometry, options);\n\n return {\n geometry_type,\n num_attributes: dracoGeometry.num_attributes(),\n num_points: dracoGeometry.num_points(),\n num_faces: dracoGeometry instanceof this.draco.Mesh ? dracoGeometry.num_faces() : 0,\n metadata,\n attributes\n };\n }\n\n /**\n * Extract all draco provided information and metadata for each attribute\n * @param dracoGeometry\n * @param options\n * @returns\n */\n _getDracoAttributes(\n dracoGeometry: Mesh | PointCloud,\n options: DracoParseOptions\n ): {[unique_id: number]: DracoAttribute} {\n const dracoAttributes: {[unique_id: number]: DracoAttribute} = {};\n\n for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {\n // Note: Draco docs do not seem clear on `GetAttribute` ids just being a zero-based index,\n // but it does seems to work this way\n const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);\n\n const metadata = this._getAttributeMetadata(dracoGeometry, attributeId);\n\n dracoAttributes[dracoAttribute.unique_id()] = {\n unique_id: dracoAttribute.unique_id(),\n attribute_type: dracoAttribute.attribute_type(),\n data_type: dracoAttribute.data_type(),\n num_components: dracoAttribute.num_components(),\n\n byte_offset: dracoAttribute.byte_offset(),\n byte_stride: dracoAttribute.byte_stride(),\n normalized: dracoAttribute.normalized(),\n attribute_index: attributeId,\n\n metadata\n };\n\n // Add transformation parameters for any attributes app wants untransformed\n const quantization = this._getQuantizationTransform(dracoAttribute, options);\n if (quantization) {\n dracoAttributes[dracoAttribute.unique_id()].quantization_transform = quantization;\n }\n\n const octahedron = this._getOctahedronTransform(dracoAttribute, options);\n if (octahedron) {\n dracoAttributes[dracoAttribute.unique_id()].octahedron_transform = octahedron;\n }\n }\n\n return dracoAttributes;\n }\n\n /**\n * Get standard loaders.gl mesh category data\n * Extracts the geometry from draco\n * @param dracoGeometry\n * @param options\n */\n _getMeshData(\n dracoGeometry: Mesh | PointCloud,\n loaderData: DracoLoaderData,\n options: DracoParseOptions\n ): MeshGeometry {\n const attributes = this._getMeshAttributes(loaderData, dracoGeometry, options);\n\n const positionAttribute = attributes.POSITION;\n if (!positionAttribute) {\n throw new Error('DRACO: No position attribute found.');\n }\n\n // For meshes, we need indices to define the faces.\n if (dracoGeometry instanceof this.draco.Mesh) {\n switch (options.topology) {\n case 'triangle-strip':\n return {\n topology: 'triangle-strip',\n // TODO - mode is wrong?\n mode: 4, // GL.TRIANGLES\n attributes,\n indices: {\n value: this._getTriangleStripIndices(dracoGeometry),\n size: 1\n }\n };\n case 'triangle-list':\n default:\n return {\n topology: 'triangle-list',\n // TODO - mode is wrong?\n mode: 5, // GL.TRIANGLE_STRIP\n attributes,\n indices: {\n value: this._getTriangleListIndices(dracoGeometry),\n size: 1\n }\n };\n }\n }\n\n // PointCloud - must come last as Mesh inherits from PointCloud\n return {\n topology: 'point-list',\n mode: 0, // GL.POINTS\n attributes\n };\n }\n\n _getMeshAttributes(\n loaderData: DracoLoaderData,\n dracoGeometry: Mesh | PointCloud,\n options: DracoParseOptions\n ): {[attributeName: string]: MeshAttribute} {\n const attributes: {[key: string]: MeshAttribute} = {};\n\n for (const loaderAttribute of Object.values(loaderData.attributes)) {\n const attributeName = this._deduceAttributeName(loaderAttribute, options);\n loaderAttribute.name = attributeName;\n const values = this._getAttributeValues(dracoGeometry, loaderAttribute);\n if (values) {\n const {value, size} = values;\n attributes[attributeName] = {\n value,\n size,\n byteOffset: loaderAttribute.byte_offset,\n byteStride: loaderAttribute.byte_stride,\n normalized: loaderAttribute.normalized\n };\n }\n }\n\n return attributes;\n }\n\n // MESH INDICES EXTRACTION\n\n /**\n * For meshes, we need indices to define the faces.\n * @param dracoGeometry\n */\n _getTriangleListIndices(dracoGeometry: Mesh) {\n // Example on how to retrieve mesh and attributes.\n const numFaces = dracoGeometry.num_faces();\n const numIndices = numFaces * 3;\n const byteLength = numIndices * INDEX_ITEM_SIZE;\n\n const ptr = this.draco._malloc(byteLength);\n try {\n this.decoder.GetTrianglesUInt32Array(dracoGeometry, byteLength, ptr);\n return new Uint32Array(this.draco.HEAPF32.buffer, ptr, numIndices).slice();\n } finally {\n this.draco._free(ptr);\n }\n }\n\n /**\n * For meshes, we need indices to define the faces.\n * @param dracoGeometry\n */\n _getTriangleStripIndices(dracoGeometry: Mesh) {\n const dracoArray = new this.draco.DracoInt32Array();\n try {\n /* const numStrips = */ this.decoder.GetTriangleStripsFromMesh(dracoGeometry, dracoArray);\n return getUint32Array(dracoArray);\n } finally {\n this.draco.destroy(dracoArray);\n }\n }\n\n /**\n *\n * @param dracoGeometry\n * @param dracoAttribute\n * @param attributeName\n */\n _getAttributeValues(\n dracoGeometry: Mesh | PointCloud,\n attribute: DracoAttribute\n ): {value: TypedArray; size: number} | null {\n const TypedArrayCtor = DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];\n if (!TypedArrayCtor) {\n // eslint-disable-next-line no-console\n console.warn(`DRACO: Unsupported attribute type ${attribute.data_type}`);\n return null;\n }\n const numComponents = attribute.num_components;\n const numPoints = dracoGeometry.num_points();\n const numValues = numPoints * numComponents;\n\n const byteLength = numValues * TypedArrayCtor.BYTES_PER_ELEMENT;\n const dataType = getDracoDataType(this.draco, TypedArrayCtor);\n\n let value: TypedArray;\n\n const ptr = this.draco._malloc(byteLength);\n try {\n const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attribute.attribute_index);\n this.decoder.GetAttributeDataArrayForAllPoints(\n dracoGeometry,\n dracoAttribute,\n dataType,\n byteLength,\n ptr\n );\n value = new TypedArrayCtor(this.draco.HEAPF32.buffer, ptr, numValues).slice();\n } finally {\n this.draco._free(ptr);\n }\n\n return {value, size: numComponents};\n }\n\n // Attribute names\n\n /** \n * DRACO does not store attribute names - We need to deduce an attribute name\n * for each attribute\n _getAttributeNames(\n dracoGeometry: Mesh | PointCloud,\n options: DracoParseOptions\n ): {[unique_id: number]: string} {\n const attributeNames: {[unique_id: number]: string} = {};\n for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {\n const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);\n const attributeName = this._deduceAttributeName(dracoAttribute, options);\n attributeNames[attributeName] = attributeName;\n }\n return attributeNames;\n }\n */\n\n /**\n * Deduce an attribute name.\n * @note DRACO does not save attribute names, just general type (POSITION, COLOR)\n * to help optimize compression. We generate GLTF compatible names for the Draco-recognized\n * types\n * @param attributeData\n */\n _deduceAttributeName(attribute: DracoAttribute, options: DracoParseOptions): string {\n // Deduce name based on application provided map\n const uniqueId = attribute.unique_id;\n for (const [attributeName, attributeUniqueId] of Object.entries(\n options.extraAttributes || {}\n )) {\n if (attributeUniqueId === uniqueId) {\n return attributeName;\n }\n }\n\n // Deduce name based on attribute type\n const thisAttributeType = attribute.attribute_type;\n for (const dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP) {\n const attributeType = this.draco[dracoAttributeConstant];\n if (attributeType === thisAttributeType) {\n // TODO - Return unique names if there multiple attributes per type\n // (e.g. multiple TEX_COORDS or COLORS)\n return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];\n }\n }\n\n // Look up in metadata\n // TODO - shouldn't this have priority?\n const entryName = options.attributeNameEntry || 'name';\n if (attribute.metadata[entryName]) {\n return attribute.metadata[entryName].string;\n }\n\n // Attribute of \"GENERIC\" type, we need to assign some name\n return `CUSTOM_ATTRIBUTE_${uniqueId}`;\n }\n\n // METADATA EXTRACTION\n\n /** Get top level metadata */\n _getTopLevelMetadata(dracoGeometry: Mesh | PointCloud) {\n const dracoMetadata = this.decoder.GetMetadata(dracoGeometry);\n return this._getDracoMetadata(dracoMetadata);\n }\n\n /** Get per attribute metadata */\n _getAttributeMetadata(dracoGeometry: Mesh | PointCloud, attributeId: number) {\n const dracoMetadata = this.decoder.GetAttributeMetadata(dracoGeometry, attributeId);\n return this._getDracoMetadata(dracoMetadata);\n }\n\n /**\n * Extract metadata field values\n * @param dracoMetadata\n * @returns\n */\n _getDracoMetadata(dracoMetadata: Metadata): {[entry: string]: DracoMetadataEntry} {\n // The not so wonderful world of undocumented Draco APIs :(\n if (!dracoMetadata || !dracoMetadata.ptr) {\n return {};\n }\n const result = {};\n const numEntries = this.metadataQuerier.NumEntries(dracoMetadata);\n for (let entryIndex = 0; entryIndex < numEntries; entryIndex++) {\n const entryName = this.metadataQuerier.GetEntryName(dracoMetadata, entryIndex);\n result[entryName] = this._getDracoMetadataField(dracoMetadata, entryName);\n }\n return result;\n }\n\n /**\n * Extracts possible values for one metadata entry by name\n * @param dracoMetadata\n * @param entryName\n */\n _getDracoMetadataField(dracoMetadata: Metadata, entryName: string): DracoMetadataEntry {\n const dracoArray = new this.draco.DracoInt32Array();\n try {\n // Draco metadata fields can hold int32 arrays\n this.metadataQuerier.GetIntEntryArray(dracoMetadata, entryName, dracoArray);\n const intArray = getInt32Array(dracoArray);\n return {\n int: this.metadataQuerier.GetIntEntry(dracoMetadata, entryName),\n string: this.metadataQuerier.GetStringEntry(dracoMetadata, entryName),\n double: this.metadataQuerier.GetDoubleEntry(dracoMetadata, entryName),\n intArray\n };\n } finally {\n this.draco.destroy(dracoArray);\n }\n }\n\n // QUANTIZED ATTRIBUTE SUPPORT (NO DECOMPRESSION)\n\n /** Skip transforms for specific attribute types */\n _disableAttributeTransforms(options: DracoParseOptions) {\n const {quantizedAttributes = [], octahedronAttributes = []} = options;\n const skipAttributes = [...quantizedAttributes, ...octahedronAttributes];\n for (const dracoAttributeName of skipAttributes) {\n this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);\n }\n }\n\n /**\n * Extract (and apply?) Position Transform\n * @todo not used\n */\n _getQuantizationTransform(\n dracoAttribute: PointAttribute,\n options: DracoParseOptions\n ): DracoQuantizationTransform | null {\n const {quantizedAttributes = []} = options;\n const attribute_type = dracoAttribute.attribute_type();\n const skip = quantizedAttributes.map((type) => this.decoder[type]).includes(attribute_type);\n if (skip) {\n const transform = new this.draco.AttributeQuantizationTransform();\n try {\n if (transform.InitFromAttribute(dracoAttribute)) {\n return {\n quantization_bits: transform.quantization_bits(),\n range: transform.range(),\n min_values: new Float32Array([1, 2, 3]).map((i) => transform.min_value(i))\n };\n }\n } finally {\n this.draco.destroy(transform);\n }\n }\n return null;\n }\n\n _getOctahedronTransform(\n dracoAttribute: PointAttribute,\n options: DracoParseOptions\n ): DracoOctahedronTransform | null {\n const {octahedronAttributes = []} = options;\n const attribute_type = dracoAttribute.attribute_type();\n const octahedron = octahedronAttributes\n .map((type) => this.decoder[type])\n .includes(attribute_type);\n if (octahedron) {\n const transform = new this.draco.AttributeQuantizationTransform();\n try {\n if (transform.InitFromAttribute(dracoAttribute)) {\n return {\n quantization_bits: transform.quantization_bits()\n };\n }\n } finally {\n this.draco.destroy(transform);\n }\n }\n return null;\n }\n\n // HELPERS\n}\n\n/**\n * Get draco specific data type by TypedArray constructor type\n * @param attributeType\n * @returns draco specific data type\n */\nfunction getDracoDataType(draco: Draco3D, attributeType: any): draco_DataType {\n switch (attributeType) {\n case Float32Array:\n return draco.DT_FLOAT32;\n case Int8Array:\n return draco.DT_INT8;\n case Int16Array:\n return draco.DT_INT16;\n case Int32Array:\n return draco.DT_INT32;\n case Uint8Array:\n return draco.DT_UINT8;\n case Uint16Array:\n return draco.DT_UINT16;\n case Uint32Array:\n return draco.DT_UINT32;\n default:\n return draco.DT_INVALID;\n }\n}\n\n/**\n * Copy a Draco int32 array into a JS typed array\n */\nfunction getInt32Array(dracoArray: DracoInt32Array): Int32Array {\n const numValues = dracoArray.size();\n const intArray = new Int32Array(numValues);\n for (let i = 0; i < numValues; i++) {\n intArray[i] = dracoArray.GetValue(i);\n }\n return intArray;\n}\n\n/**\n * Copy a Draco int32 array into a JS typed array\n */\nfunction getUint32Array(dracoArray: DracoInt32Array): Int32Array {\n const numValues = dracoArray.size();\n const intArray = new Int32Array(numValues);\n for (let i = 0; i < numValues; i++) {\n intArray[i] = dracoArray.GetValue(i);\n }\n return intArray;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {DracoMesh} from './lib/draco-types';\nimport type {DracoParseOptions} from './lib/draco-parser';\nimport {VERSION} from './lib/utils/version';\nimport DracoParser from './lib/draco-parser';\nimport {loadDracoDecoderModule} from './lib/draco-module-loader';\n\nexport type DracoLoaderOptions = LoaderOptions & {\n draco?: DracoParseOptions & {\n /** @deprecated WASM decoding is faster but JS is more backwards compatible */\n decoderType?: 'wasm' | 'js';\n /** @deprecated Specify where to load the Draco decoder library */\n libraryPath?: string;\n /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n workerUrl?: string;\n };\n};\n\n/**\n * Worker loader for Draco3D compressed geometries\n */\nexport const DracoWorkerLoader = {\n dataType: null as unknown as DracoMesh,\n batchType: null as never,\n name: 'Draco',\n id: 'draco',\n module: 'draco',\n // shapes: ['mesh'],\n version: VERSION,\n worker: true,\n extensions: ['drc'],\n mimeTypes: ['application/octet-stream'],\n binary: true,\n tests: ['DRACO'],\n options: {\n draco: {\n decoderType: typeof WebAssembly === 'object' ? 'wasm' : 'js', // 'js' for IE11\n libraryPath: 'libs/',\n extraAttributes: {},\n attributeNameEntry: undefined\n }\n }\n} as const satisfies Loader<DracoMesh, never, DracoLoaderOptions>;\n\n/**\n * Loader for Draco3D compressed geometries\n */\nexport const DracoLoader = {\n ...DracoWorkerLoader,\n parse\n} as const satisfies LoaderWithParser<DracoMesh, never, DracoLoaderOptions>;\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: DracoLoaderOptions): Promise<DracoMesh> {\n const {draco} = await loadDracoDecoderModule(options);\n const dracoParser = new DracoParser(draco);\n try {\n return dracoParser.parseSync(arrayBuffer, options?.draco);\n } finally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ACJ,QAAQ;AAAA;AAAA,IAER,SAASC;AAAA,IACT,QAAQ;AAAA,IACR,YAAY,CAAC,KAAK;AAAA,IAClB,WAAW,CAAC,0BAA0B;AAAA,IACtC,QAAQ;AAAA,IACR,OAAO,CAAC,OAAO;AAAA,IACf,SAAS;AAAA,MACP,OAAO;AAAA,QACL,aAAa,OAAO,gBAAgB,WAAW,SAAS;AAAA;AAAA,QACxD,aAAa;AAAA,QACb,iBAAiB,CAAC;AAAA,QAClB,oBAAoB;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AAKO,MAAM,cAAc;AAAA,IACzB,GAAG;AAAA,IACH;AAAA,EACF;AAEA,iBAAe,MAAM,aAA0B,SAAkD;AAC/F,UAAM,EAAC,MAAK,IAAI,MAAM,uBAAuB,OAAO;AACpD,UAAM,cAAc,IAAI,YAAY,KAAK;AACzC,QAAI;AACF,aAAO,YAAY,UAAU,aAAa,SAAS,KAAK;AAAA,IAC1D,UAAE;AACA,kBAAY,QAAQ;AAAA,IACtB;AAAA,EACF;;;AC7DA,qBAAmB,WAAW;",
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {NPM_TAG} from '../npm-tag';\n\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\ndeclare let __VERSION__: string;\n\nlet warningIssued = false;\n\nfunction getVersion() {\n if (!globalThis._loadersgl_?.version) {\n globalThis._loadersgl_ = globalThis._loadersgl_ || {};\n // __VERSION__ is injected by babel-plugin-version-inline\n if (typeof __VERSION__ === 'undefined' && !warningIssued) {\n // eslint-disable-next-line\n console.warn(\n 'loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.'\n );\n globalThis._loadersgl_.version = NPM_TAG;\n warningIssued = true;\n } else {\n globalThis._loadersgl_.version = __VERSION__;\n }\n }\n\n return globalThis._loadersgl_.version;\n}\n\nexport const VERSION = getVersion();\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Replacement for the external assert method to reduce bundle size\n// Note: We don't use the second \"message\" argument in calling code,\n// so no need to support it here\n\n/** Throws an `Error` with the optional `message` if `condition` is falsy */\nexport function assert(condition: any, message?: string): void {\n if (!condition) {\n throw new Error(message || 'loaders.gl assertion failed.');\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Purpose: include this in your module to avoids adding dependencies on\n// micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst globals = {\n self: typeof self !== 'undefined' && self,\n window: typeof window !== 'undefined' && window,\n global: typeof global !== 'undefined' && global,\n document: typeof document !== 'undefined' && document\n};\n\nconst self_: {[key: string]: any} = globals.self || globals.window || globals.global || {};\nconst window_: {[key: string]: any} = globals.window || globals.self || globals.global || {};\nconst global_: {[key: string]: any} = globals.global || globals.self || globals.window || {};\nconst document_: {[key: string]: any} = globals.document || {};\n\nexport {self_ as self, window_ as window, global_ as global, document_ as document};\n\n/** true if running in the browser, false if running in Node.js */\nexport const isBrowser: boolean =\n // @ts-ignore process.browser\n typeof process !== 'object' || String(process) !== '[object process]' || process.browser;\n\n/** true if running on a worker thread */\nexport const isWorker: boolean = typeof importScripts === 'function';\n\n/** true if running on a mobile device */\nexport const isMobile: boolean =\n typeof window !== 'undefined' && typeof window.orientation !== 'undefined';\n\n// Extract node major version\nconst matches =\n typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);\n\n/** Version of Node.js if running under Node, otherwise 0 */\nexport const nodeVersion: number = (matches && parseFloat(matches[1])) || 0;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/** Browser polyfill for Node.js built-in `worker_threads` module.\n * These fills are non-functional, and just intended to ensure that\n * `import 'worker_threads` doesn't break browser builds.\n * The replacement is done in package.json browser field\n */\nexport class NodeWorker {\n terminate() {}\n}\n\nexport type {NodeWorker as NodeWorkerType};\n\nexport const parentPort = null;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// NOTE - there is a copy of this function is both in core and loader-utils\n// core does not need all the utils in loader-utils, just this one.\n\n/**\n * Returns an array of Transferrable objects that can be used with postMessage\n * https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage\n * @param object data to be sent via postMessage\n * @param recursive - not for application use\n * @param transfers - not for application use\n * @returns a transfer list that can be passed to postMessage\n */\nexport function getTransferList(\n object: any,\n recursive: boolean = true,\n transfers?: Set<any>\n): Transferable[] {\n // Make sure that items in the transfer list is unique\n const transfersSet = transfers || new Set();\n\n if (!object) {\n // ignore\n } else if (isTransferable(object)) {\n transfersSet.add(object);\n } else if (isTransferable(object.buffer)) {\n // Typed array\n transfersSet.add(object.buffer);\n } else if (ArrayBuffer.isView(object)) {\n // object is a TypeArray viewing into a SharedArrayBuffer (not transferable)\n // Do not iterate through the content in this case\n } else if (recursive && typeof object === 'object') {\n for (const key in object) {\n // Avoid perf hit - only go one level deep\n getTransferList(object[key], recursive, transfersSet);\n }\n }\n\n // If transfers is defined, is internal recursive call\n // Otherwise it's called by the user\n return transfers === undefined ? Array.from(transfersSet) : [];\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/Transferable\nfunction isTransferable(object: unknown) {\n if (!object) {\n return false;\n }\n if (object instanceof ArrayBuffer) {\n return true;\n }\n if (typeof MessagePort !== 'undefined' && object instanceof MessagePort) {\n return true;\n }\n if (typeof ImageBitmap !== 'undefined' && object instanceof ImageBitmap) {\n return true;\n }\n // @ts-ignore\n if (typeof OffscreenCanvas !== 'undefined' && object instanceof OffscreenCanvas) {\n return true;\n }\n return false;\n}\n\n/**\n * Recursively drop non serializable values like functions and regexps.\n * @param object\n */\nexport function getTransferListForWriter(object: object | null): object {\n if (object === null) {\n return {};\n }\n const clone = Object.assign({}, object);\n\n Object.keys(clone).forEach((key) => {\n // Typed Arrays and Arrays are passed with no change\n if (\n typeof object[key] === 'object' &&\n !ArrayBuffer.isView(object[key]) &&\n !(object[key] instanceof Array)\n ) {\n clone[key] = getTransferListForWriter(object[key]);\n } else if (typeof clone[key] === 'function' || clone[key] instanceof RegExp) {\n clone[key] = {};\n } else {\n clone[key] = object[key];\n }\n });\n\n return clone;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {WorkerMessageData, WorkerMessageType, WorkerMessagePayload} from '../../types';\nimport {getTransferList} from '../worker-utils/get-transfer-list';\n// import type {TransferListItem} from '../node/worker_threads';\nimport {parentPort} from '../node/worker_threads';\n\ntype TransferListItem = any;\n\n/** Vile hack to defeat over-zealous bundlers from stripping out the require */\nasync function getParentPort() {\n // const isNode = globalThis.process;\n // let parentPort;\n // try {\n // // prettier-ignore\n // eval('globalThis.parentPort = require(\\'worker_threads\\').parentPort'); // eslint-disable-line no-eval\n // parentPort = globalThis.parentPort;\n // } catch {\n // try {\n // // prettier-ignore\n // eval('globalThis.workerThreadsPromise = import(\\'worker_threads\\')'); // eslint-disable-line no-eval\n // const workerThreads = await globalThis.workerThreadsPromise;\n // parentPort = workerThreads.parentPort;\n // } catch (error) {\n // console.error((error as Error).message); // eslint-disable-line no-console\n // }\n // }\n return parentPort;\n}\n\nconst onMessageWrapperMap = new Map();\n\n/**\n * Type safe wrapper for worker code\n */\nexport default class WorkerBody {\n /** Check that we are actually in a worker thread */\n static async inWorkerThread(): Promise<boolean> {\n return typeof self !== 'undefined' || Boolean(await getParentPort());\n }\n\n /*\n * (type: WorkerMessageType, payload: WorkerMessagePayload) => any\n */\n static set onmessage(onMessage: (type: WorkerMessageType, payload: WorkerMessagePayload) => any) {\n async function handleMessage(message) {\n const parentPort = await getParentPort();\n // Confusingly the message itself also has a 'type' field which is always set to 'message'\n const {type, payload} = parentPort ? message : message.data;\n // if (!isKnownMessage(message)) {\n // return;\n // }\n onMessage(type, payload);\n }\n\n getParentPort().then((parentPort) => {\n if (parentPort) {\n parentPort.on('message', (message) => {\n handleMessage(message);\n });\n // if (message == 'exit') { parentPort.unref(); }\n // eslint-disable-next-line\n parentPort.on('exit', () => console.debug('Node worker closing'));\n } else {\n // eslint-disable-next-line no-restricted-globals\n globalThis.onmessage = handleMessage;\n }\n });\n }\n\n static async addEventListener(\n onMessage: (type: WorkerMessageType, payload: WorkerMessagePayload) => any\n ) {\n let onMessageWrapper = onMessageWrapperMap.get(onMessage);\n\n if (!onMessageWrapper) {\n onMessageWrapper = async (message: MessageEvent<any>) => {\n if (!isKnownMessage(message)) {\n return;\n }\n\n const parentPort = await getParentPort();\n // Confusingly in the browser, the message itself also has a 'type' field which is always set to 'message'\n const {type, payload} = parentPort ? message : message.data;\n onMessage(type, payload);\n };\n }\n\n const parentPort = await getParentPort();\n if (parentPort) {\n console.error('not implemented'); // eslint-disable-line\n } else {\n globalThis.addEventListener('message', onMessageWrapper);\n }\n }\n\n static async removeEventListener(\n onMessage: (type: WorkerMessageType, payload: WorkerMessagePayload) => any\n ) {\n const onMessageWrapper = onMessageWrapperMap.get(onMessage);\n onMessageWrapperMap.delete(onMessage);\n const parentPort = await getParentPort();\n if (parentPort) {\n console.error('not implemented'); // eslint-disable-line\n } else {\n globalThis.removeEventListener('message', onMessageWrapper);\n }\n }\n\n /**\n * Send a message from a worker to creating thread (main thread)\n * @param type\n * @param payload\n */\n static async postMessage(type: WorkerMessageType, payload: WorkerMessagePayload): Promise<void> {\n const data: WorkerMessageData = {source: 'loaders.gl', type, payload};\n // console.log('posting message', data);\n\n // Cast to Node compatible transfer list\n const transferList = getTransferList(payload) as TransferListItem[];\n\n const parentPort = await getParentPort();\n if (parentPort) {\n parentPort.postMessage(data, transferList);\n // console.log('posted message', data);\n } else {\n // @ts-expect-error Outside of worker scopes this call has a third parameter\n globalThis.postMessage(data, transferList);\n }\n }\n}\n\n// Filter out noise messages sent to workers\nfunction isKnownMessage(message: MessageEvent<any>) {\n const {type, data} = message;\n return (\n type === 'message' &&\n data &&\n typeof data.source === 'string' &&\n data.source.startsWith('loaders.gl')\n );\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* global importScripts */\nimport {isBrowser, isWorker} from '../env-utils/globals';\nimport {assert} from '../env-utils/assert';\nimport {VERSION} from '../env-utils/version';\n\nexport type LoadLibraryOptions<ModulesT extends Record<string, any> = Record<string, any>> = {\n useLocalLibraries?: boolean;\n CDN?: string | null;\n modules?: ModulesT;\n // Core must not be supplied\n core?: never;\n};\n\nconst loadLibraryPromises: Record<string, Promise<any>> = {}; // promises\n\n/**\n * Dynamically loads a library (\"module\")\n *\n * - wasm library: Array buffer is returned\n * - js library: Parse JS is returned\n *\n * Method depends on environment\n * - browser - script element is created and installed on document\n * - worker - eval is called on global context\n * - node - file is required\n *\n * @param libraryUrl\n * @param moduleName\n * @param options\n */\nexport async function loadLibrary(\n libraryUrl: string,\n moduleName: string | null = null,\n options: LoadLibraryOptions = {},\n libraryName: string | null = null\n): Promise<any> {\n if (moduleName) {\n libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);\n }\n // Ensure libraries are only loaded once\n\n loadLibraryPromises[libraryUrl] =\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);\n return await loadLibraryPromises[libraryUrl];\n}\n\n// TODO - sort out how to resolve paths for main/worker and dev/prod\nexport function getLibraryUrl(\n library: string,\n moduleName?: string,\n options: LoadLibraryOptions = {},\n libraryName: string | null = null\n): string {\n if (options?.core) {\n throw new Error('loadLibrary: options.core must be pre-normalized');\n }\n\n // Check if already a URL\n if (!options.useLocalLibraries && library.startsWith('http')) {\n return library;\n }\n\n libraryName = libraryName || library;\n\n // Allow application to import and supply libraries through `options.modules`\n // TODO - See js-module-utils in loader-utils\n const modules = options.modules || {};\n if (modules[libraryName]) {\n return modules[libraryName];\n }\n\n // Load from local files, not from CDN scripts in Node.js\n // TODO - needs to locate the modules directory when installed!\n if (!isBrowser) {\n return `modules/${moduleName}/dist/libs/${libraryName}`;\n }\n\n // In browser, load from external scripts\n if (options.CDN) {\n assert(options.CDN.startsWith('http'));\n return `${options.CDN}/${moduleName}@${VERSION}/dist/libs/${libraryName}`;\n }\n\n // TODO - loading inside workers requires paths relative to worker script location...\n if (isWorker) {\n return `../src/libs/${libraryName}`;\n }\n\n return `modules/${moduleName}/src/libs/${libraryName}`;\n}\n\nasync function loadLibraryFromFile(libraryUrl: string): Promise<any> {\n if (libraryUrl.endsWith('wasm')) {\n return await loadAsArrayBuffer(libraryUrl);\n }\n\n if (!isBrowser) {\n // TODO - Node doesn't yet support dynamic import from https URLs\n // try {\n // return await import(libraryUrl);\n // } catch (error) {\n // console.error(error);\n // }\n const {requireFromFile} = globalThis.loaders || {};\n try {\n const result = await requireFromFile?.(libraryUrl);\n if (result || !libraryUrl.includes('/dist/libs/')) {\n return result;\n }\n return await requireFromFile?.(libraryUrl.replace('/dist/libs/', '/src/libs/'));\n } catch (error) {\n if (libraryUrl.includes('/dist/libs/')) {\n try {\n return await requireFromFile?.(libraryUrl.replace('/dist/libs/', '/src/libs/'));\n } catch {\n // ignore\n }\n }\n console.error(error); // eslint-disable-line no-console\n return null;\n }\n }\n if (isWorker) {\n return importScripts(libraryUrl);\n }\n // TODO - fix - should be more secure than string parsing since observes CORS\n // if (isBrowser) {\n // return await loadScriptFromFile(libraryUrl);\n // }\n\n const scriptSource = await loadAsText(libraryUrl);\n return loadLibraryFromString(scriptSource, libraryUrl);\n}\n\n// TODO - Needs security audit...\n// - Raw eval call\n// - Potentially bypasses CORS\n// Upside is that this separates fetching and parsing\n// we could create a`LibraryLoader` or`ModuleLoader`\nfunction loadLibraryFromString(scriptSource: string, id: string): null | any {\n if (!isBrowser) {\n const {requireFromString} = globalThis.loaders || {};\n return requireFromString?.(scriptSource, id);\n }\n\n if (isWorker) {\n // Use lvalue trick to make eval run in global scope\n eval.call(globalThis, scriptSource); // eslint-disable-line no-eval\n // https://stackoverflow.com/questions/9107240/1-evalthis-vs-evalthis-in-javascript\n // http://perfectionkills.com/global-eval-what-are-the-options/\n return null;\n }\n\n const script = document.createElement('script');\n script.id = id;\n // most browsers like a separate text node but some throw an error. The second method covers those.\n try {\n script.appendChild(document.createTextNode(scriptSource));\n } catch (e) {\n script.text = scriptSource;\n }\n document.body.appendChild(script);\n return null;\n}\n\nasync function loadAsArrayBuffer(url: string): Promise<ArrayBuffer> {\n const {readFileAsArrayBuffer} = globalThis.loaders || {};\n if (isBrowser || !readFileAsArrayBuffer || url.startsWith('http')) {\n const response = await fetch(url);\n return await response.arrayBuffer();\n }\n try {\n return await readFileAsArrayBuffer(url);\n } catch {\n if (url.includes('/dist/libs/')) {\n return await readFileAsArrayBuffer(url.replace('/dist/libs/', '/src/libs/'));\n }\n throw new Error(`Failed to load ArrayBuffer from ${url}`);\n }\n}\n\n/**\n * Load a file from local file system\n * @param filename\n * @returns\n */\nasync function loadAsText(url: string): Promise<string> {\n const {readFileAsText} = globalThis.loaders || {};\n if (isBrowser || !readFileAsText || url.startsWith('http')) {\n const response = await fetch(url);\n return await response.text();\n }\n try {\n return await readFileAsText(url);\n } catch {\n if (url.includes('/dist/libs/')) {\n return await readFileAsText(url.replace('/dist/libs/', '/src/libs/'));\n }\n throw new Error(`Failed to load text from ${url}`);\n }\n}\n\n/*\nasync function loadScriptFromFile(libraryUrl) {\n const script = document.createElement('script');\n script.src = libraryUrl;\n return await new Promise((resolve, reject) => {\n script.onload = data => {\n resolve(data);\n };\n script.onerror = reject;\n });\n}\n*/\n\n// TODO - technique for module injection into worker, from THREE.DracoLoader...\n/*\nfunction combineWorkerWithLibrary(worker, jsContent) {\n var fn = wWorker.toString();\n var body = [\n '// injected',\n jsContent,\n '',\n '// worker',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}'))\n ].join('\\n');\n this.workerSourceURL = URL.createObjectURL(new Blob([body]));\n}\n*/\n", "/* eslint-disable no-restricted-globals */\nimport type {LoaderWithParser, LoaderOptions, LoaderContext} from '../../loader-types';\nimport {WorkerBody} from '@loaders.gl/worker-utils';\n// import {validateLoaderVersion} from './validate-loader-version';\n\nlet requestId = 0;\n\n/**\n * Set up a WebWorkerGlobalScope to talk with the main thread\n * @param loader\n */\nexport async function createLoaderWorker(loader: LoaderWithParser) {\n // Check that we are actually in a worker thread\n if (!(await WorkerBody.inWorkerThread())) {\n return;\n }\n\n WorkerBody.onmessage = async (type, payload) => {\n switch (type) {\n case 'process':\n try {\n // validateLoaderVersion(loader, data.source.split('@')[1]);\n\n const {input, options = {}, context = {}} = payload;\n\n const result = await parseData({\n loader,\n arrayBuffer: input,\n options,\n // @ts-expect-error fetch missing\n context: {\n ...context,\n _parse: parseOnMainThread\n }\n });\n WorkerBody.postMessage('done', {result});\n } catch (error) {\n const message = error instanceof Error ? error.message : '';\n WorkerBody.postMessage('error', {error: message});\n }\n break;\n default:\n }\n };\n}\n\nfunction parseOnMainThread(\n arrayBuffer: ArrayBuffer,\n loader: any,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const id = requestId++;\n\n /**\n */\n const onMessage = (type, payload) => {\n if (payload.id !== id) {\n // not ours\n return;\n }\n\n switch (type) {\n case 'done':\n WorkerBody.removeEventListener(onMessage);\n resolve(payload.result);\n break;\n\n case 'error':\n WorkerBody.removeEventListener(onMessage);\n reject(payload.error);\n break;\n\n default:\n // ignore\n }\n };\n\n WorkerBody.addEventListener(onMessage);\n\n // Ask the main thread to decode data\n const payload = {id, input: arrayBuffer, options};\n WorkerBody.postMessage('process', payload);\n });\n}\n\n// TODO - Support byteOffset and byteLength (enabling parsing of embedded binaries without copies)\n// TODO - Why not support async loader.parse* funcs here?\n// TODO - Why not reuse a common function instead of reimplementing loader.parse* selection logic? Keeping loader small?\n// TODO - Lack of appropriate parser functions can be detected when we create worker, no need to wait until parse\nasync function parseData({\n loader,\n arrayBuffer,\n options,\n context\n}: {\n loader: LoaderWithParser;\n arrayBuffer: ArrayBuffer;\n options: LoaderOptions;\n context: LoaderContext;\n}) {\n let data;\n let parser;\n if (loader.parseSync || loader.parse) {\n data = arrayBuffer;\n parser = loader.parseSync || loader.parse;\n } else if (loader.parseTextSync) {\n const textDecoder = new TextDecoder();\n data = textDecoder.decode(arrayBuffer);\n parser = loader.parseTextSync;\n } else {\n throw new Error(`Could not load data with ${loader.name} loader`);\n }\n\n // TODO - proper merge in of loader options...\n options = {\n ...options,\n modules: (loader && loader.options && loader.options.modules) || {},\n core: {\n ...options.core,\n worker: false\n }\n };\n\n return await parser(data, {...options}, context, loader);\n}\n", "// Dynamic DRACO module loading inspired by THREE.DRACOLoader\n// https://github.com/mrdoob/three.js/blob/398c4f39ebdb8b23eefd4a7a5ec49ec0c96c7462/examples/jsm/loaders/DRACOLoader.js\n// by Don McCurdy / https://www.donmccurdy.com / MIT license\n\nimport {isBrowser, loadLibrary, type LoadLibraryOptions} from '@loaders.gl/worker-utils';\n\nconst DRACO_DECODER_VERSION = '1.5.6';\nconst DRACO_ENCODER_VERSION = '1.4.1';\n\nconst STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;\n\nexport const DRACO_EXTERNAL_LIBRARIES = {\n /** The primary Draco3D encoder, javascript wrapper part */\n DECODER: 'draco_wasm_wrapper.js',\n /** The primary draco decoder, compiled web assembly part */\n DECODER_WASM: 'draco_decoder.wasm',\n /** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */\n FALLBACK_DECODER: 'draco_decoder.js',\n /** Draco encoder */\n ENCODER: 'draco_encoder.js'\n};\n\nexport const DRACO_EXTERNAL_LIBRARY_URLS = {\n [DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,\n [DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,\n [DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,\n [DRACO_EXTERNAL_LIBRARIES.ENCODER]: `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`\n};\n\nlet loadDecoderPromise;\nlet loadEncoderPromise;\n\nexport async function loadDracoDecoderModule(\n options: LoadLibraryOptions = {},\n type: 'wasm' | 'js'\n) {\n const modules = options.modules || {};\n\n // Check if a bundled draco3d library has been supplied by application\n if (modules.draco3d) {\n loadDecoderPromise ||= modules.draco3d.createDecoderModule({}).then((draco) => {\n return {draco};\n });\n } else {\n // If not, dynamically load the WASM script from our CDN\n loadDecoderPromise ||= loadDracoDecoder(options, type);\n }\n return await loadDecoderPromise;\n}\n\nexport async function loadDracoEncoderModule(options: LoadLibraryOptions) {\n const modules = options.modules || {};\n\n // Check if a bundled draco3d library has been supplied by application\n if (modules.draco3d) {\n loadEncoderPromise ||= modules.draco3d.createEncoderModule({}).then((draco) => {\n return {draco};\n });\n } else {\n // If not, dynamically load the WASM script from our CDN\n loadEncoderPromise ||= loadDracoEncoder(options);\n }\n return await loadEncoderPromise;\n}\n\nfunction getLibraryExport(library: any, exportName: string): any {\n if (library && typeof library === 'object') {\n if (library.default) {\n return library.default;\n }\n if (library[exportName]) {\n return library[exportName];\n }\n }\n return library;\n}\n\n// DRACO DECODER LOADING\n/** @todo - type the options, they are inconsistent */\nasync function loadDracoDecoder(options: LoadLibraryOptions, type: 'wasm' | 'js') {\n let DracoDecoderModule;\n let wasmBinary;\n switch (type) {\n case 'js':\n DracoDecoderModule = await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],\n 'draco',\n options,\n DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER\n );\n break;\n\n case 'wasm':\n default:\n try {\n [DracoDecoderModule, wasmBinary] = await Promise.all([\n await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],\n 'draco',\n options,\n DRACO_EXTERNAL_LIBRARIES.DECODER\n ),\n await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],\n 'draco',\n options,\n DRACO_EXTERNAL_LIBRARIES.DECODER_WASM\n )\n ]);\n } catch {\n DracoDecoderModule = null;\n wasmBinary = null;\n }\n }\n DracoDecoderModule = getLibraryExport(DracoDecoderModule, 'DracoDecoderModule');\n // @ts-ignore\n DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;\n\n // In Node environments without network access, fall back to local copies in the repo.\n if (!DracoDecoderModule && !isBrowser) {\n [DracoDecoderModule, wasmBinary] = await Promise.all([\n await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],\n 'draco',\n {...options, useLocalLibraries: true},\n DRACO_EXTERNAL_LIBRARIES.DECODER\n ),\n await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],\n 'draco',\n {...options, useLocalLibraries: true},\n DRACO_EXTERNAL_LIBRARIES.DECODER_WASM\n )\n ]);\n DracoDecoderModule = getLibraryExport(DracoDecoderModule, 'DracoDecoderModule');\n // @ts-ignore\n DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;\n }\n\n return await initializeDracoDecoder(DracoDecoderModule, wasmBinary);\n}\n\nfunction initializeDracoDecoder(DracoDecoderModule, wasmBinary) {\n if (typeof DracoDecoderModule !== 'function') {\n throw new Error('DracoDecoderModule could not be loaded');\n }\n\n const options: {wasmBinary?: any} = {};\n if (wasmBinary) {\n options.wasmBinary = wasmBinary;\n }\n\n return new Promise((resolve) => {\n DracoDecoderModule({\n ...options,\n onModuleLoaded: (draco) => resolve({draco}) // Module is Promise-like. Wrap in object to avoid loop.\n });\n });\n}\n\n// ENCODER\n\nasync function loadDracoEncoder(options: LoadLibraryOptions) {\n let DracoEncoderModule = await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER],\n 'draco',\n options,\n DRACO_EXTERNAL_LIBRARIES.ENCODER\n );\n DracoEncoderModule = getLibraryExport(DracoEncoderModule, 'DracoEncoderModule');\n // @ts-ignore\n DracoEncoderModule = DracoEncoderModule || globalThis.DracoEncoderModule;\n\n // In Node environments without network access, fall back to local copies in the repo.\n if (!DracoEncoderModule && !isBrowser) {\n DracoEncoderModule = await loadLibrary(\n DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER],\n 'draco',\n {...options, useLocalLibraries: true},\n DRACO_EXTERNAL_LIBRARIES.ENCODER\n );\n DracoEncoderModule = getLibraryExport(DracoEncoderModule, 'DracoEncoderModule');\n // @ts-ignore\n DracoEncoderModule = DracoEncoderModule || globalThis.DracoEncoderModule;\n }\n\n if (typeof DracoEncoderModule !== 'function') {\n throw new Error('DracoEncoderModule could not be loaded');\n }\n\n return new Promise((resolve) => {\n DracoEncoderModule({\n onModuleLoaded: (draco) => resolve({draco}) // Module is Promise-like. Wrap in object to avoid loop.\n });\n });\n}\n", "// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {DataType, TypedArray, TypedArrayConstructor, ArrayType} from '@loaders.gl/schema';\n\n/** Deduce column types from values */\nexport function getDataTypeFromValue(\n value: unknown,\n defaultNumberType: 'float32' = 'float32'\n): DataType {\n if (value instanceof Date) {\n return 'date-millisecond';\n }\n if (value instanceof Number) {\n return defaultNumberType;\n }\n if (typeof value === 'string') {\n return 'utf8';\n }\n if (value === null || value === 'undefined') {\n return 'null';\n }\n return 'null';\n}\n\n/**\n * Deduces a simple data type \"descriptor from a typed array instance\n */\nexport function getDataTypeFromArray(array: ArrayType): {type: DataType; nullable: boolean} {\n let type = getDataTypeFromTypedArray(array as TypedArray);\n if (type !== 'null') {\n return {type, nullable: false};\n }\n if (array.length > 0) {\n type = getDataTypeFromValue(array[0]);\n return {type, nullable: true};\n }\n\n return {type: 'null', nullable: true};\n}\n\n/**\n * Deduces a simple data type \"descriptor from a typed array instance\n */\nexport function getDataTypeFromTypedArray(array: TypedArray): DataType {\n switch (array.constructor) {\n case Int8Array:\n return 'int8';\n case Uint8Array:\n case Uint8ClampedArray:\n return 'uint8';\n case Int16Array:\n return 'int16';\n case Uint16Array:\n return 'uint16';\n case Int32Array:\n return 'int32';\n case Uint32Array:\n return 'uint32';\n case Float32Array:\n return 'float32';\n case Float64Array:\n return 'float64';\n default:\n return 'null';\n }\n}\n\nexport function getArrayTypeFromDataType(\n type: DataType,\n nullable: boolean | undefined\n): TypedArrayConstructor | ArrayConstructor {\n if (!nullable) {\n switch (type) {\n case 'int8':\n return Int8Array;\n case 'uint8':\n return Uint8Array;\n case 'int16':\n return Int16Array;\n case 'uint16':\n return Uint16Array;\n case 'int32':\n return Int32Array;\n case 'uint32':\n return Uint32Array;\n case 'float32':\n return Float32Array;\n case 'float64':\n return Float64Array;\n default:\n break;\n }\n }\n\n // if (typeof BigInt64Array !== 'undefined') {\n // TYPED_ARRAY_TO_TYPE.BigInt64Array = new Int64();\n // TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();\n // }\n\n return Array;\n}\n", "// Mesh category utilities\n// TODO - move to mesh category module, or to math.gl/geometry module\nimport {MeshAttributes} from '@loaders.gl/schema';\nimport {TypedArray} from '../../types/types';\n\ntype TypedArrays = {[key: string]: TypedArray};\n\n/**\n * Holds an axis aligned bounding box\n * TODO - make sure AxisAlignedBoundingBox in math.gl/culling understands this format (or change this format)\n */\ntype BoundingBox = [[number, number, number], [number, number, number]];\n\n/**\n * Get number of vertices in mesh\n * @param attributes\n */\nexport function getMeshSize(attributes: TypedArrays): number {\n let size = 0;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n if (ArrayBuffer.isView(attribute)) {\n // @ts-ignore DataView doesn't have BYTES_PER_ELEMENT\n size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;\n }\n }\n return size;\n}\n\n/**\n * Get the (axis aligned) bounding box of a mesh\n * @param attributes\n * @returns array of two vectors representing the axis aligned bounding box\n */\n// eslint-disable-next-line complexity\nexport function getMeshBoundingBox(attributes: MeshAttributes): BoundingBox {\n let minX = Infinity;\n let minY = Infinity;\n let minZ = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n let maxZ = -Infinity;\n\n const positions = attributes.POSITION ? attributes.POSITION.value : [];\n const len = positions && positions.length;\n\n for (let i = 0; i < len; i += 3) {\n const x = positions[i];\n const y = positions[i + 1];\n const z = positions[i + 2];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n minZ = z < minZ ? z : minZ;\n\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n maxZ = z > maxZ ? z : maxZ;\n }\n return [\n [minX, minY, minZ],\n [maxX, maxY, maxZ]\n ];\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {MeshAttribute, MeshAttributes, Schema, Field} from '@loaders.gl/schema';\nimport {getDataTypeFromTypedArray} from '../schema/data-type';\n\n/**\n * Create a schema for mesh attributes data\n * @param attributes\n * @param metadata\n * @returns\n */\nexport function deduceMeshSchema(\n attributes: MeshAttributes,\n metadata: Record<string, string> = {}\n): Schema {\n const fields = deduceMeshFields(attributes);\n return {fields, metadata};\n}\n\n/**\n * Create arrow-like schema field for mesh attribute\n * @param attributeName\n * @param attribute\n * @param optionalMetadata\n * @returns\n */\nexport function deduceMeshField(\n name: string,\n attribute: MeshAttribute,\n optionalMetadata?: Record<string, string>\n): Field {\n const type = getDataTypeFromTypedArray(attribute.value);\n const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);\n return {\n name,\n type: {type: 'fixed-size-list', listSize: attribute.size, children: [{name: 'value', type}]},\n nullable: false,\n metadata\n };\n}\n\n/**\n * Create fields array for mesh attributes\n * @param attributes\n * @returns\n */\nfunction deduceMeshFields(attributes: MeshAttributes): Field[] {\n const fields: Field[] = [];\n for (const attributeName in attributes) {\n const attribute: MeshAttribute = attributes[attributeName];\n fields.push(deduceMeshField(attributeName, attribute));\n }\n return fields;\n}\n\n/**\n * Make metadata by mesh attribute properties\n * @param attribute\n * @returns\n */\nexport function makeMeshAttributeMetadata(attribute: MeshAttribute): Record<string, string> {\n const result: Record<string, string> = {};\n if ('byteOffset' in attribute) {\n result.byteOffset = attribute.byteOffset!.toString(10);\n }\n if ('byteStride' in attribute) {\n result.byteStride = attribute.byteStride!.toString(10);\n }\n if ('normalized' in attribute) {\n result.normalized = attribute.normalized!.toString();\n }\n return result;\n}\n", "import {MeshAttribute, Schema, Field} from '@loaders.gl/schema';\nimport {deduceMeshField} from '@loaders.gl/schema-utils';\nimport type {DracoAttribute, DracoLoaderData, DracoMetadataEntry} from '../draco-types';\n\n/** Extract an arrow-like schema from a Draco mesh */\nexport function getDracoSchema(\n attributes: {[attributeName: string]: MeshAttribute},\n loaderData: DracoLoaderData,\n indices?: MeshAttribute\n): Schema {\n const metadata = makeMetadata(loaderData.metadata);\n const fields: Field[] = [];\n const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const field = getArrowFieldFromAttribute(\n attributeName,\n attribute,\n namedLoaderDataAttributes[attributeName]\n );\n fields.push(field);\n }\n if (indices) {\n const indicesField = getArrowFieldFromAttribute('indices', indices);\n fields.push(indicesField);\n }\n return {fields, metadata};\n}\n\nfunction transformAttributesLoaderData(loaderData: {[key: number]: DracoAttribute}): {\n [attributeName: string]: DracoAttribute;\n} {\n const result: {[attributeName: string]: DracoAttribute} = {};\n for (const key in loaderData) {\n const dracoAttribute = loaderData[key];\n result[dracoAttribute.name || 'undefined'] = dracoAttribute;\n }\n return result;\n}\n\nfunction getArrowFieldFromAttribute(\n attributeName: string,\n attribute: MeshAttribute,\n loaderData?: DracoAttribute\n): Field {\n const metadataMap = loaderData ? makeMetadata(loaderData.metadata) : undefined;\n const field = deduceMeshField(attributeName, attribute, metadataMap);\n return field;\n}\n\nfunction makeMetadata(metadata: {[key: string]: DracoMetadataEntry}): Record<string, string> {\n Object.entries(metadata);\n const serializedMetadata: Record<string, string> = {};\n for (const key in metadata) {\n serializedMetadata[`${key}.string`] = JSON.stringify(metadata[key]);\n }\n return serializedMetadata;\n}\n", "/* eslint-disable camelcase */\n\nimport type {TypedArray, MeshAttribute, MeshGeometry} from '@loaders.gl/schema';\n\n// Draco types (input)\nimport type {\n Draco3D,\n Decoder,\n Mesh,\n PointCloud,\n PointAttribute,\n Metadata,\n MetadataQuerier,\n DracoInt32Array,\n draco_DataType\n} from '../draco3d/draco3d-types';\n\n// Parsed data types (output)\nimport type {\n DracoMesh,\n DracoLoaderData,\n DracoAttribute,\n DracoMetadataEntry,\n DracoQuantizationTransform,\n DracoOctahedronTransform\n} from './draco-types';\n\nimport {getMeshBoundingBox} from '@loaders.gl/schema-utils';\nimport {getDracoSchema} from './utils/get-draco-schema';\n\n/** Options to control draco parsing */\nexport type DracoParseOptions = {\n /** How triangle indices should be generated (mesh only) */\n topology?: 'triangle-list' | 'triangle-strip';\n /** Specify which attribute metadata entry stores the attribute name */\n attributeNameEntry?: string;\n /** Names and ids of extra attributes to include in the output */\n extraAttributes?: {[uniqueId: string]: number};\n /** Skip transforms specific quantized attributes */\n quantizedAttributes?: ('POSITION' | 'NORMAL' | 'COLOR' | 'TEX_COORD' | 'GENERIC')[];\n /** Skip transforms specific octahedron encoded attributes */\n octahedronAttributes?: ('POSITION' | 'NORMAL' | 'COLOR' | 'TEX_COORD' | 'GENERIC')[];\n};\n\n// @ts-ignore\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst GEOMETRY_TYPE = {\n TRIANGULAR_MESH: 0,\n POINT_CLOUD: 1\n};\n\n// Native Draco attribute names to GLTF attribute names.\nconst DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP = {\n POSITION: 'POSITION',\n NORMAL: 'NORMAL',\n COLOR: 'COLOR_0',\n TEX_COORD: 'TEXCOORD_0'\n};\n\nconst DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP = {\n 1: Int8Array,\n 2: Uint8Array,\n 3: Int16Array,\n 4: Uint16Array,\n 5: Int32Array,\n 6: Uint32Array,\n // 7: BigInt64Array,\n // 8: BigUint64Array,\n 9: Float32Array\n // 10: Float64Array\n // 11: BOOL - What array type do we use for this?\n};\n\nconst INDEX_ITEM_SIZE = 4;\n\nexport default class DracoParser {\n draco: Draco3D;\n decoder: Decoder;\n metadataQuerier: MetadataQuerier;\n\n // draco - the draco decoder, either import `draco3d` or load dynamically\n constructor(draco: Draco3D) {\n this.draco = draco;\n this.decoder = new this.draco.Decoder();\n this.metadataQuerier = new this.draco.MetadataQuerier();\n }\n\n /**\n * Destroy draco resources\n */\n destroy(): void {\n this.draco.destroy(this.decoder);\n this.draco.destroy(this.metadataQuerier);\n }\n\n /**\n * NOTE: caller must call `destroyGeometry` on the return value after using it\n * @param arrayBuffer\n * @param options\n */\n parseSync(arrayBuffer: ArrayBuffer, options: DracoParseOptions = {}): DracoMesh {\n const buffer = new this.draco.DecoderBuffer();\n buffer.Init(new Int8Array(arrayBuffer), arrayBuffer.byteLength);\n\n this._disableAttributeTransforms(options);\n\n const geometry_type = this.decoder.GetEncodedGeometryType(buffer);\n const dracoGeometry =\n geometry_type === this.draco.TRIANGULAR_MESH\n ? new this.draco.Mesh()\n : new this.draco.PointCloud();\n\n try {\n let dracoStatus;\n switch (geometry_type) {\n case this.draco.TRIANGULAR_MESH:\n dracoStatus = this.decoder.DecodeBufferToMesh(buffer, dracoGeometry as Mesh);\n break;\n\n case this.draco.POINT_CLOUD:\n dracoStatus = this.decoder.DecodeBufferToPointCloud(buffer, dracoGeometry);\n break;\n\n default:\n throw new Error('DRACO: Unknown geometry type.');\n }\n\n if (!dracoStatus.ok() || !dracoGeometry.ptr) {\n const message = `DRACO decompression failed: ${dracoStatus.error_msg()}`;\n // console.error(message);\n throw new Error(message);\n }\n\n const loaderData = this._getDracoLoaderData(dracoGeometry, geometry_type, options);\n\n const geometry = this._getMeshData(dracoGeometry, loaderData, options);\n\n const boundingBox = getMeshBoundingBox(geometry.attributes);\n\n const schema = getDracoSchema(geometry.attributes, loaderData, geometry.indices);\n\n const data: DracoMesh = {\n loader: 'draco',\n loaderData,\n header: {\n vertexCount: dracoGeometry.num_points(),\n boundingBox\n },\n ...geometry,\n schema\n };\n return data;\n } finally {\n this.draco.destroy(buffer);\n if (dracoGeometry) {\n this.draco.destroy(dracoGeometry);\n }\n }\n }\n\n // Draco specific \"loader data\"\n\n /**\n * Extract\n * @param dracoGeometry\n * @param geometry_type\n * @param options\n * @returns\n */\n _getDracoLoaderData(\n dracoGeometry: Mesh | PointCloud,\n geometry_type,\n options: DracoParseOptions\n ): DracoLoaderData {\n const metadata = this._getTopLevelMetadata(dracoGeometry);\n const attributes = this._getDracoAttributes(dracoGeometry, options);\n\n return {\n geometry_type,\n num_attributes: dracoGeometry.num_attributes(),\n num_points: dracoGeometry.num_points(),\n num_faces: dracoGeometry instanceof this.draco.Mesh ? dracoGeometry.num_faces() : 0,\n metadata,\n attributes\n };\n }\n\n /**\n * Extract all draco provided information and metadata for each attribute\n * @param dracoGeometry\n * @param options\n * @returns\n */\n _getDracoAttributes(\n dracoGeometry: Mesh | PointCloud,\n options: DracoParseOptions\n ): {[unique_id: number]: DracoAttribute} {\n const dracoAttributes: {[unique_id: number]: DracoAttribute} = {};\n\n for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {\n // Note: Draco docs do not seem clear on `GetAttribute` ids just being a zero-based index,\n // but it does seems to work this way\n const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);\n\n const metadata = this._getAttributeMetadata(dracoGeometry, attributeId);\n\n dracoAttributes[dracoAttribute.unique_id()] = {\n unique_id: dracoAttribute.unique_id(),\n attribute_type: dracoAttribute.attribute_type(),\n data_type: dracoAttribute.data_type(),\n num_components: dracoAttribute.num_components(),\n\n byte_offset: dracoAttribute.byte_offset(),\n byte_stride: dracoAttribute.byte_stride(),\n normalized: dracoAttribute.normalized(),\n attribute_index: attributeId,\n\n metadata\n };\n\n // Add transformation parameters for any attributes app wants untransformed\n const quantization = this._getQuantizationTransform(dracoAttribute, options);\n if (quantization) {\n dracoAttributes[dracoAttribute.unique_id()].quantization_transform = quantization;\n }\n\n const octahedron = this._getOctahedronTransform(dracoAttribute, options);\n if (octahedron) {\n dracoAttributes[dracoAttribute.unique_id()].octahedron_transform = octahedron;\n }\n }\n\n return dracoAttributes;\n }\n\n /**\n * Get standard loaders.gl mesh category data\n * Extracts the geometry from draco\n * @param dracoGeometry\n * @param options\n */\n _getMeshData(\n dracoGeometry: Mesh | PointCloud,\n loaderData: DracoLoaderData,\n options: DracoParseOptions\n ): MeshGeometry {\n const attributes = this._getMeshAttributes(loaderData, dracoGeometry, options);\n\n const positionAttribute = attributes.POSITION;\n if (!positionAttribute) {\n throw new Error('DRACO: No position attribute found.');\n }\n\n // For meshes, we need indices to define the faces.\n if (dracoGeometry instanceof this.draco.Mesh) {\n switch (options.topology) {\n case 'triangle-strip':\n return {\n topology: 'triangle-strip',\n // TODO - mode is wrong?\n mode: 4, // GL.TRIANGLES\n attributes,\n indices: {\n value: this._getTriangleStripIndices(dracoGeometry),\n size: 1\n }\n };\n case 'triangle-list':\n default:\n return {\n topology: 'triangle-list',\n // TODO - mode is wrong?\n mode: 5, // GL.TRIANGLE_STRIP\n attributes,\n indices: {\n value: this._getTriangleListIndices(dracoGeometry),\n size: 1\n }\n };\n }\n }\n\n // PointCloud - must come last as Mesh inherits from PointCloud\n return {\n topology: 'point-list',\n mode: 0, // GL.POINTS\n attributes\n };\n }\n\n _getMeshAttributes(\n loaderData: DracoLoaderData,\n dracoGeometry: Mesh | PointCloud,\n options: DracoParseOptions\n ): {[attributeName: string]: MeshAttribute} {\n const attributes: {[key: string]: MeshAttribute} = {};\n\n for (const loaderAttribute of Object.values(loaderData.attributes)) {\n const attributeName = this._deduceAttributeName(loaderAttribute, options);\n loaderAttribute.name = attributeName;\n const values = this._getAttributeValues(dracoGeometry, loaderAttribute);\n if (values) {\n const {value, size} = values;\n attributes[attributeName] = {\n value,\n size,\n byteOffset: loaderAttribute.byte_offset,\n byteStride: loaderAttribute.byte_stride,\n normalized: loaderAttribute.normalized\n };\n }\n }\n\n return attributes;\n }\n\n // MESH INDICES EXTRACTION\n\n /**\n * For meshes, we need indices to define the faces.\n * @param dracoGeometry\n */\n _getTriangleListIndices(dracoGeometry: Mesh) {\n // Example on how to retrieve mesh and attributes.\n const numFaces = dracoGeometry.num_faces();\n const numIndices = numFaces * 3;\n const byteLength = numIndices * INDEX_ITEM_SIZE;\n\n const ptr = this.draco._malloc(byteLength);\n try {\n this.decoder.GetTrianglesUInt32Array(dracoGeometry, byteLength, ptr);\n return new Uint32Array(this.draco.HEAPF32.buffer, ptr, numIndices).slice();\n } finally {\n this.draco._free(ptr);\n }\n }\n\n /**\n * For meshes, we need indices to define the faces.\n * @param dracoGeometry\n */\n _getTriangleStripIndices(dracoGeometry: Mesh) {\n const dracoArray = new this.draco.DracoInt32Array();\n try {\n /* const numStrips = */ this.decoder.GetTriangleStripsFromMesh(dracoGeometry, dracoArray);\n return getUint32Array(dracoArray);\n } finally {\n this.draco.destroy(dracoArray);\n }\n }\n\n /**\n *\n * @param dracoGeometry\n * @param dracoAttribute\n * @param attributeName\n */\n _getAttributeValues(\n dracoGeometry: Mesh | PointCloud,\n attribute: DracoAttribute\n ): {value: TypedArray; size: number} | null {\n const TypedArrayCtor = DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];\n if (!TypedArrayCtor) {\n // eslint-disable-next-line no-console\n console.warn(`DRACO: Unsupported attribute type ${attribute.data_type}`);\n return null;\n }\n const numComponents = attribute.num_components;\n const numPoints = dracoGeometry.num_points();\n const numValues = numPoints * numComponents;\n\n const byteLength = numValues * TypedArrayCtor.BYTES_PER_ELEMENT;\n const dataType = getDracoDataType(this.draco, TypedArrayCtor);\n\n let value: TypedArray;\n\n const ptr = this.draco._malloc(byteLength);\n try {\n const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attribute.attribute_index);\n this.decoder.GetAttributeDataArrayForAllPoints(\n dracoGeometry,\n dracoAttribute,\n dataType,\n byteLength,\n ptr\n );\n value = new TypedArrayCtor(this.draco.HEAPF32.buffer, ptr, numValues).slice();\n } finally {\n this.draco._free(ptr);\n }\n\n return {value, size: numComponents};\n }\n\n // Attribute names\n\n /** \n * DRACO does not store attribute names - We need to deduce an attribute name\n * for each attribute\n _getAttributeNames(\n dracoGeometry: Mesh | PointCloud,\n options: DracoParseOptions\n ): {[unique_id: number]: string} {\n const attributeNames: {[unique_id: number]: string} = {};\n for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {\n const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);\n const attributeName = this._deduceAttributeName(dracoAttribute, options);\n attributeNames[attributeName] = attributeName;\n }\n return attributeNames;\n }\n */\n\n /**\n * Deduce an attribute name.\n * @note DRACO does not save attribute names, just general type (POSITION, COLOR)\n * to help optimize compression. We generate GLTF compatible names for the Draco-recognized\n * types\n * @param attributeData\n */\n _deduceAttributeName(attribute: DracoAttribute, options: DracoParseOptions): string {\n // Deduce name based on application provided map\n const uniqueId = attribute.unique_id;\n for (const [attributeName, attributeUniqueId] of Object.entries(\n options.extraAttributes || {}\n )) {\n if (attributeUniqueId === uniqueId) {\n return attributeName;\n }\n }\n\n // Deduce name based on attribute type\n const thisAttributeType = attribute.attribute_type;\n for (const dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP) {\n const attributeType = this.draco[dracoAttributeConstant];\n if (attributeType === thisAttributeType) {\n // TODO - Return unique names if there multiple attributes per type\n // (e.g. multiple TEX_COORDS or COLORS)\n return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];\n }\n }\n\n // Look up in metadata\n // TODO - shouldn't this have priority?\n const entryName = options.attributeNameEntry || 'name';\n if (attribute.metadata[entryName]) {\n return attribute.metadata[entryName].string;\n }\n\n // Attribute of \"GENERIC\" type, we need to assign some name\n return `CUSTOM_ATTRIBUTE_${uniqueId}`;\n }\n\n // METADATA EXTRACTION\n\n /** Get top level metadata */\n _getTopLevelMetadata(dracoGeometry: Mesh | PointCloud) {\n const dracoMetadata = this.decoder.GetMetadata(dracoGeometry);\n return this._getDracoMetadata(dracoMetadata);\n }\n\n /** Get per attribute metadata */\n _getAttributeMetadata(dracoGeometry: Mesh | PointCloud, attributeId: number) {\n const dracoMetadata = this.decoder.GetAttributeMetadata(dracoGeometry, attributeId);\n return this._getDracoMetadata(dracoMetadata);\n }\n\n /**\n * Extract metadata field values\n * @param dracoMetadata\n * @returns\n */\n _getDracoMetadata(dracoMetadata: Metadata): {[entry: string]: DracoMetadataEntry} {\n // The not so wonderful world of undocumented Draco APIs :(\n if (!dracoMetadata || !dracoMetadata.ptr) {\n return {};\n }\n const result = {};\n const numEntries = this.metadataQuerier.NumEntries(dracoMetadata);\n for (let entryIndex = 0; entryIndex < numEntries; entryIndex++) {\n const entryName = this.metadataQuerier.GetEntryName(dracoMetadata, entryIndex);\n result[entryName] = this._getDracoMetadataField(dracoMetadata, entryName);\n }\n return result;\n }\n\n /**\n * Extracts possible values for one metadata entry by name\n * @param dracoMetadata\n * @param entryName\n */\n _getDracoMetadataField(dracoMetadata: Metadata, entryName: string): DracoMetadataEntry {\n const dracoArray = new this.draco.DracoInt32Array();\n try {\n // Draco metadata fields can hold int32 arrays\n this.metadataQuerier.GetIntEntryArray(dracoMetadata, entryName, dracoArray);\n const intArray = getInt32Array(dracoArray);\n return {\n int: this.metadataQuerier.GetIntEntry(dracoMetadata, entryName),\n string: this.metadataQuerier.GetStringEntry(dracoMetadata, entryName),\n double: this.metadataQuerier.GetDoubleEntry(dracoMetadata, entryName),\n intArray\n };\n } finally {\n this.draco.destroy(dracoArray);\n }\n }\n\n // QUANTIZED ATTRIBUTE SUPPORT (NO DECOMPRESSION)\n\n /** Skip transforms for specific attribute types */\n _disableAttributeTransforms(options: DracoParseOptions) {\n const {quantizedAttributes = [], octahedronAttributes = []} = options;\n const skipAttributes = [...quantizedAttributes, ...octahedronAttributes];\n for (const dracoAttributeName of skipAttributes) {\n this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);\n }\n }\n\n /**\n * Extract (and apply?) Position Transform\n * @todo not used\n */\n _getQuantizationTransform(\n dracoAttribute: PointAttribute,\n options: DracoParseOptions\n ): DracoQuantizationTransform | null {\n const {quantizedAttributes = []} = options;\n const attribute_type = dracoAttribute.attribute_type();\n const skip = quantizedAttributes.map((type) => this.decoder[type]).includes(attribute_type);\n if (skip) {\n const transform = new this.draco.AttributeQuantizationTransform();\n try {\n if (transform.InitFromAttribute(dracoAttribute)) {\n return {\n quantization_bits: transform.quantization_bits(),\n range: transform.range(),\n min_values: new Float32Array([1, 2, 3]).map((i) => transform.min_value(i))\n };\n }\n } finally {\n this.draco.destroy(transform);\n }\n }\n return null;\n }\n\n _getOctahedronTransform(\n dracoAttribute: PointAttribute,\n options: DracoParseOptions\n ): DracoOctahedronTransform | null {\n const {octahedronAttributes = []} = options;\n const attribute_type = dracoAttribute.attribute_type();\n const octahedron = octahedronAttributes\n .map((type) => this.decoder[type])\n .includes(attribute_type);\n if (octahedron) {\n const transform = new this.draco.AttributeQuantizationTransform();\n try {\n if (transform.InitFromAttribute(dracoAttribute)) {\n return {\n quantization_bits: transform.quantization_bits()\n };\n }\n } finally {\n this.draco.destroy(transform);\n }\n }\n return null;\n }\n\n // HELPERS\n}\n\n/**\n * Get draco specific data type by TypedArray constructor type\n * @param attributeType\n * @returns draco specific data type\n */\nfunction getDracoDataType(draco: Draco3D, attributeType: any): draco_DataType {\n switch (attributeType) {\n case Float32Array:\n return draco.DT_FLOAT32;\n case Int8Array:\n return draco.DT_INT8;\n case Int16Array:\n return draco.DT_INT16;\n case Int32Array:\n return draco.DT_INT32;\n case Uint8Array:\n return draco.DT_UINT8;\n case Uint16Array:\n return draco.DT_UINT16;\n case Uint32Array:\n return draco.DT_UINT32;\n default:\n return draco.DT_INVALID;\n }\n}\n\n/**\n * Copy a Draco int32 array into a JS typed array\n */\nfunction getInt32Array(dracoArray: DracoInt32Array): Int32Array {\n const numValues = dracoArray.size();\n const intArray = new Int32Array(numValues);\n for (let i = 0; i < numValues; i++) {\n intArray[i] = dracoArray.GetValue(i);\n }\n return intArray;\n}\n\n/**\n * Copy a Draco int32 array into a JS typed array\n */\nfunction getUint32Array(dracoArray: DracoInt32Array): Int32Array {\n const numValues = dracoArray.size();\n const intArray = new Int32Array(numValues);\n for (let i = 0; i < numValues; i++) {\n intArray[i] = dracoArray.GetValue(i);\n }\n return intArray;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderWithParser, StrictLoaderOptions} from '@loaders.gl/loader-utils';\nimport type {DracoMesh} from './lib/draco-types';\nimport type {DracoParseOptions} from './lib/draco-parser';\nimport {VERSION} from './lib/utils/version';\nimport DracoParser from './lib/draco-parser';\nimport {loadDracoDecoderModule} from './lib/draco-module-loader';\n\nexport type DracoLoaderOptions = StrictLoaderOptions & {\n draco?: DracoParseOptions & {\n /** @deprecated WASM decoding is faster but JS is more backwards compatible */\n decoderType?: 'wasm' | 'js';\n /** @deprecated Specify where to load the Draco decoder library */\n libraryPath?: string;\n /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n workerUrl?: string;\n };\n};\n\n/**\n * Worker loader for Draco3D compressed geometries\n */\nexport const DracoWorkerLoader = {\n dataType: null as unknown as DracoMesh,\n batchType: null as never,\n name: 'Draco',\n id: 'draco',\n module: 'draco',\n // shapes: ['mesh'],\n version: VERSION,\n worker: true,\n extensions: ['drc'],\n mimeTypes: ['application/octet-stream'],\n binary: true,\n tests: ['DRACO'],\n options: {\n draco: {\n decoderType: typeof WebAssembly === 'object' ? 'wasm' : 'js', // 'js' for IE11\n libraryPath: 'libs/',\n extraAttributes: {},\n attributeNameEntry: undefined\n }\n }\n} as const satisfies Loader<DracoMesh, never, DracoLoaderOptions>;\n\n/**\n * Loader for Draco3D compressed geometries\n */\nexport const DracoLoader = {\n ...DracoWorkerLoader,\n parse\n} as const satisfies LoaderWithParser<DracoMesh, never, DracoLoaderOptions>;\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: DracoLoaderOptions): Promise<DracoMesh> {\n const {draco} = await loadDracoDecoderModule(\n options?.core,\n options?.draco?.decoderType || 'wasm'\n );\n const dracoParser = new DracoParser(draco);\n try {\n return dracoParser.parseSync(arrayBuffer, options?.draco);\n } finally {\n dracoParser.destroy();\n }\n}\n", "import {createLoaderWorker} from '@loaders.gl/loader-utils';\nimport {DracoLoader} from '../index';\n\ncreateLoaderWorker(DracoLoader);\n"],
|
|
5
|
+
"mappings": ";;;AAWA,WAAS,aAAa;AACpB,QAAI,CAAC,WAAW,aAAa,SAAS;AACpC,iBAAW,cAAc,WAAW,eAAe,CAAC;AAEpD,UAAI,OAAsD;AAExD,gBAAQ;AAAA,UACN;AAAA,QACF;AACA,mBAAW,YAAY,UAAU;AACjC,wBAAgB;AAAA,MAClB,OAAO;AACL,mBAAW,YAAY,UAAU;AAAA,MACnC;AAAA,IACF;AAEA,WAAO,WAAW,YAAY;AAAA,EAChC;AAEO,MAAM,UAAU,WAAW;;;ACrB3B,WAAS,OAAO,WAAgB,SAAwB;AAC7D,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,WAAW,8BAA8B;AAAA,IAC3D;AAAA,EACF;;;ACLA,MAAM,UAAU;AAAA,IACd,MAAM,OAAO,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