@loaders.gl/i3s 3.1.6 → 3.2.0-alpha.1

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.
Files changed (39) hide show
  1. package/dist/dist.min.js +957 -244
  2. package/dist/es5/i3s-attribute-loader.js +1 -1
  3. package/dist/es5/i3s-attribute-loader.js.map +1 -1
  4. package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
  5. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
  6. package/dist/es5/i3s-content-loader.js +1 -1
  7. package/dist/es5/i3s-content-loader.js.map +1 -1
  8. package/dist/es5/i3s-loader.js +1 -1
  9. package/dist/es5/i3s-loader.js.map +1 -1
  10. package/dist/es5/i3s-node-page-loader.js +1 -1
  11. package/dist/es5/i3s-node-page-loader.js.map +1 -1
  12. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +46 -42
  13. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  14. package/dist/es5/types.js.map +1 -1
  15. package/dist/esm/i3s-attribute-loader.js +1 -1
  16. package/dist/esm/i3s-attribute-loader.js.map +1 -1
  17. package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
  18. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
  19. package/dist/esm/i3s-content-loader.js +1 -1
  20. package/dist/esm/i3s-content-loader.js.map +1 -1
  21. package/dist/esm/i3s-loader.js +1 -1
  22. package/dist/esm/i3s-loader.js.map +1 -1
  23. package/dist/esm/i3s-node-page-loader.js +1 -1
  24. package/dist/esm/i3s-node-page-loader.js.map +1 -1
  25. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +33 -29
  26. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  27. package/dist/esm/types.js.map +1 -1
  28. package/dist/i3s-building-scene-layer-loader.js +1 -1
  29. package/dist/i3s-content-loader.js +1 -1
  30. package/dist/i3s-content-worker.js +749 -103
  31. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  32. package/dist/lib/parsers/parse-i3s-tile-content.js +33 -29
  33. package/dist/types.d.ts +2 -3
  34. package/dist/types.d.ts.map +1 -1
  35. package/package.json +9 -9
  36. package/src/i3s-building-scene-layer-loader.ts +1 -1
  37. package/src/i3s-content-loader.ts +1 -1
  38. package/src/lib/parsers/parse-i3s-tile-content.ts +37 -32
  39. package/src/types.ts +2 -3
@@ -55,7 +55,7 @@
55
55
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
56
56
 
57
57
  // ../worker-utils/src/lib/env-utils/version.ts
58
- var VERSION = true ? "3.1.6" : DEFAULT_VERSION;
58
+ var VERSION = true ? "3.2.0-alpha.1" : DEFAULT_VERSION;
59
59
  if (false) {
60
60
  console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
61
61
  }
@@ -87,13 +87,13 @@
87
87
  // ../worker-utils/src/lib/worker-farm/worker-job.ts
88
88
  var WorkerJob = class {
89
89
  constructor(jobName, workerThread) {
90
- this.name = jobName;
91
- this.workerThread = workerThread;
92
90
  this.isRunning = true;
93
91
  this._resolve = () => {
94
92
  };
95
93
  this._reject = () => {
96
94
  };
95
+ this.name = jobName;
96
+ this.workerThread = workerThread;
97
97
  this.result = new Promise((resolve, reject) => {
98
98
  this._resolve = resolve;
99
99
  this._reject = reject;
@@ -118,6 +118,16 @@
118
118
  }
119
119
  };
120
120
 
121
+ // ../worker-utils/src/lib/node/worker_threads-browser.js
122
+ var Worker2 = class {
123
+ on(message, cb) {
124
+ }
125
+ postMessage(...args) {
126
+ }
127
+ terminate() {
128
+ }
129
+ };
130
+
121
131
  // ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
122
132
  var workerURLCache = new Map();
123
133
  function getLoadableWorkerURL(props) {
@@ -205,10 +215,10 @@
205
215
  this.url = url;
206
216
  this.onMessage = NOOP;
207
217
  this.onError = (error) => console.log(error);
208
- this.worker = this._createBrowserWorker();
218
+ this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
209
219
  }
210
220
  static isSupported() {
211
- return typeof Worker !== "undefined";
221
+ return typeof Worker !== "undefined" && isBrowser2;
212
222
  }
213
223
  destroy() {
214
224
  this.onMessage = NOOP;
@@ -251,6 +261,27 @@
251
261
  worker.onmessageerror = (event) => console.error(event);
252
262
  return worker;
253
263
  }
264
+ _createNodeWorker() {
265
+ let worker;
266
+ if (this.url) {
267
+ const absolute = this.url.includes(":/") || this.url.startsWith("/");
268
+ const url = absolute ? this.url : `./${this.url}`;
269
+ worker = new Worker2(url, { eval: false });
270
+ } else if (this.source) {
271
+ worker = new Worker2(this.source, { eval: true });
272
+ } else {
273
+ throw new Error("no worker");
274
+ }
275
+ worker.on("message", (data) => {
276
+ this.onMessage(data);
277
+ });
278
+ worker.on("error", (error) => {
279
+ this.onError(error);
280
+ });
281
+ worker.on("exit", (code) => {
282
+ });
283
+ return worker;
284
+ }
254
285
  };
255
286
 
256
287
  // ../worker-utils/src/lib/worker-farm/worker-pool.ts
@@ -271,6 +302,9 @@
271
302
  this.url = props.url;
272
303
  this.setProps(props);
273
304
  }
305
+ static isSupported() {
306
+ return WorkerThread.isSupported();
307
+ }
274
308
  destroy() {
275
309
  this.idleQueue.forEach((worker) => worker.destroy());
276
310
  this.isDestroyed = true;
@@ -360,9 +394,9 @@
360
394
  var DEFAULT_PROPS = {
361
395
  maxConcurrency: 3,
362
396
  maxMobileConcurrency: 1,
397
+ reuseWorkers: true,
363
398
  onDebug: () => {
364
- },
365
- reuseWorkers: true
399
+ }
366
400
  };
367
401
  var WorkerFarm = class {
368
402
  constructor(props) {
@@ -383,6 +417,7 @@
383
417
  for (const workerPool of this.workerPools.values()) {
384
418
  workerPool.destroy();
385
419
  }
420
+ this.workerPools = new Map();
386
421
  }
387
422
  setProps(props) {
388
423
  this.props = { ...this.props, ...props };
@@ -415,16 +450,33 @@
415
450
  };
416
451
 
417
452
  // ../worker-utils/src/lib/worker-farm/worker-body.ts
453
+ function getParentPort() {
454
+ let parentPort;
455
+ try {
456
+ eval("globalThis.parentPort = require('worker_threads').parentPort");
457
+ parentPort = globalThis.parentPort;
458
+ } catch {
459
+ }
460
+ return parentPort;
461
+ }
418
462
  var onMessageWrapperMap = new Map();
419
463
  var WorkerBody = class {
464
+ static inWorkerThread() {
465
+ return typeof self !== "undefined" || Boolean(getParentPort());
466
+ }
420
467
  static set onmessage(onMessage2) {
421
- self.onmessage = (message) => {
422
- if (!isKnownMessage(message)) {
423
- return;
424
- }
425
- const { type, payload } = message.data;
468
+ function handleMessage(message) {
469
+ const parentPort3 = getParentPort();
470
+ const { type, payload } = parentPort3 ? message : message.data;
426
471
  onMessage2(type, payload);
427
- };
472
+ }
473
+ const parentPort2 = getParentPort();
474
+ if (parentPort2) {
475
+ parentPort2.on("message", handleMessage);
476
+ parentPort2.on("exit", () => console.debug("Node worker closing"));
477
+ } else {
478
+ globalThis.onmessage = handleMessage;
479
+ }
428
480
  }
429
481
  static addEventListener(onMessage2) {
430
482
  let onMessageWrapper = onMessageWrapperMap.get(onMessage2);
@@ -433,22 +485,36 @@
433
485
  if (!isKnownMessage(message)) {
434
486
  return;
435
487
  }
436
- const { type, payload } = message.data;
488
+ const parentPort3 = getParentPort();
489
+ const { type, payload } = parentPort3 ? message : message.data;
437
490
  onMessage2(type, payload);
438
491
  };
439
492
  }
440
- self.addEventListener("message", onMessageWrapper);
493
+ const parentPort2 = getParentPort();
494
+ if (parentPort2) {
495
+ console.error("not implemented");
496
+ } else {
497
+ globalThis.addEventListener("message", onMessageWrapper);
498
+ }
441
499
  }
442
500
  static removeEventListener(onMessage2) {
443
501
  const onMessageWrapper = onMessageWrapperMap.get(onMessage2);
444
502
  onMessageWrapperMap.delete(onMessage2);
445
- self.removeEventListener("message", onMessageWrapper);
503
+ const parentPort2 = getParentPort();
504
+ if (parentPort2) {
505
+ console.error("not implemented");
506
+ } else {
507
+ globalThis.removeEventListener("message", onMessageWrapper);
508
+ }
446
509
  }
447
510
  static postMessage(type, payload) {
448
- if (self) {
449
- const data = { source: "loaders.gl", type, payload };
450
- const transferList = getTransferList(payload);
451
- self.postMessage(data, transferList);
511
+ const data = { source: "loaders.gl", type, payload };
512
+ const transferList = getTransferList(payload);
513
+ const parentPort2 = getParentPort();
514
+ if (parentPort2) {
515
+ parentPort2.postMessage(data, transferList);
516
+ } else {
517
+ globalThis.postMessage(data, transferList);
452
518
  }
453
519
  }
454
520
  };
@@ -458,7 +524,7 @@
458
524
  }
459
525
 
460
526
  // ../worker-utils/src/lib/worker-api/get-worker-url.ts
461
- var NPM_TAG = "latest";
527
+ var NPM_TAG = "beta";
462
528
  function getWorkerURL(worker, options = {}) {
463
529
  const workerOptions = options[worker.id] || {};
464
530
  const workerFile = `${worker.id}-worker.js`;
@@ -493,7 +559,7 @@
493
559
 
494
560
  // ../worker-utils/src/lib/library-utils/library-utils.ts
495
561
  var node = __toModule(require_require_utils());
496
- var LATEST = "latest";
562
+ var LATEST = "beta";
497
563
  var VERSION2 = typeof VERSION !== "undefined" ? VERSION : LATEST;
498
564
  var loadLibraryPromises = {};
499
565
  async function loadLibrary(libraryUrl, moduleName = null, options = {}) {
@@ -564,7 +630,7 @@
564
630
  // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
565
631
  var requestId = 0;
566
632
  function createLoaderWorker(loader) {
567
- if (typeof self === "undefined") {
633
+ if (!WorkerBody.inWorkerThread()) {
568
634
  return;
569
635
  }
570
636
  WorkerBody.onmessage = async (type, payload) => {
@@ -640,6 +706,9 @@
640
706
  if (!WorkerFarm.isSupported()) {
641
707
  return false;
642
708
  }
709
+ if (!isBrowser2 && !options?._nodeWorkers) {
710
+ return false;
711
+ }
643
712
  return loader.worker && options?.worker;
644
713
  }
645
714
  async function parseWithWorker(loader, data, options, context, parseOnMainThread2) {
@@ -750,6 +819,21 @@
750
819
  return concatenateArrayBuffers(...arrayBuffers);
751
820
  }
752
821
 
822
+ // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
823
+ function _defineProperty(obj, key, value) {
824
+ if (key in obj) {
825
+ Object.defineProperty(obj, key, {
826
+ value,
827
+ enumerable: true,
828
+ configurable: true,
829
+ writable: true
830
+ });
831
+ } else {
832
+ obj[key] = value;
833
+ }
834
+ return obj;
835
+ }
836
+
753
837
  // ../loader-utils/src/lib/path-utils/file-aliases.ts
754
838
  var pathPrefix = "";
755
839
  var fileAliases = {};
@@ -1001,7 +1085,7 @@
1001
1085
  var process_ = globals3.process || {};
1002
1086
 
1003
1087
  // ../../node_modules/probe.gl/dist/esm/utils/globals.js
1004
- var VERSION3 = true ? "3.1.6" : "untranspiled source";
1088
+ var VERSION3 = true ? "3.2.0-alpha.1" : "untranspiled source";
1005
1089
  var isBrowser4 = isBrowser3();
1006
1090
 
1007
1091
  // ../../node_modules/probe.gl/dist/esm/utils/local-storage.js
@@ -1534,7 +1618,8 @@
1534
1618
  worker: true,
1535
1619
  maxConcurrency: 3,
1536
1620
  maxMobileConcurrency: 1,
1537
- reuseWorkers: true,
1621
+ reuseWorkers: isBrowser,
1622
+ _nodeWorkers: false,
1538
1623
  _workerType: "",
1539
1624
  limit: 0,
1540
1625
  _limitMB: 0,
@@ -1710,6 +1795,555 @@
1710
1795
  return getGlobalLoaderRegistry();
1711
1796
  }
1712
1797
 
1798
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js
1799
+ function isElectron2(mockUserAgent) {
1800
+ if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
1801
+ return true;
1802
+ }
1803
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions.electron)) {
1804
+ return true;
1805
+ }
1806
+ const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
1807
+ const userAgent = mockUserAgent || realUserAgent;
1808
+ if (userAgent && userAgent.indexOf("Electron") >= 0) {
1809
+ return true;
1810
+ }
1811
+ return false;
1812
+ }
1813
+
1814
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js
1815
+ function isBrowser5() {
1816
+ const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
1817
+ return !isNode || isElectron2();
1818
+ }
1819
+
1820
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/globals.js
1821
+ var globals4 = {
1822
+ self: typeof self !== "undefined" && self,
1823
+ window: typeof window !== "undefined" && window,
1824
+ global: typeof global !== "undefined" && global,
1825
+ document: typeof document !== "undefined" && document,
1826
+ process: typeof process === "object" && process
1827
+ };
1828
+ var self_4 = globals4.self || globals4.window || globals4.global;
1829
+ var window_4 = globals4.window || globals4.self || globals4.global;
1830
+ var document_4 = globals4.document || {};
1831
+ var process_2 = globals4.process || {};
1832
+
1833
+ // ../../node_modules/@probe.gl/env/dist/esm/utils/globals.js
1834
+ var VERSION4 = true ? "3.2.0-alpha.1" : "untranspiled source";
1835
+ var isBrowser6 = isBrowser5();
1836
+
1837
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js
1838
+ function getStorage2(type) {
1839
+ try {
1840
+ const storage = window[type];
1841
+ const x = "__storage_test__";
1842
+ storage.setItem(x, x);
1843
+ storage.removeItem(x);
1844
+ return storage;
1845
+ } catch (e2) {
1846
+ return null;
1847
+ }
1848
+ }
1849
+ var LocalStorage2 = class {
1850
+ constructor(id) {
1851
+ let defaultSettings = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1852
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
1853
+ _defineProperty(this, "storage", void 0);
1854
+ _defineProperty(this, "id", void 0);
1855
+ _defineProperty(this, "config", {});
1856
+ this.storage = getStorage2(type);
1857
+ this.id = id;
1858
+ this.config = {};
1859
+ Object.assign(this.config, defaultSettings);
1860
+ this._loadConfiguration();
1861
+ }
1862
+ getConfiguration() {
1863
+ return this.config;
1864
+ }
1865
+ setConfiguration(configuration) {
1866
+ this.config = {};
1867
+ return this.updateConfiguration(configuration);
1868
+ }
1869
+ updateConfiguration(configuration) {
1870
+ Object.assign(this.config, configuration);
1871
+ if (this.storage) {
1872
+ const serialized = JSON.stringify(this.config);
1873
+ this.storage.setItem(this.id, serialized);
1874
+ }
1875
+ return this;
1876
+ }
1877
+ _loadConfiguration() {
1878
+ let configuration = {};
1879
+ if (this.storage) {
1880
+ const serializedConfiguration = this.storage.getItem(this.id);
1881
+ configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
1882
+ }
1883
+ Object.assign(this.config, configuration);
1884
+ return this;
1885
+ }
1886
+ };
1887
+
1888
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js
1889
+ function formatTime2(ms) {
1890
+ let formatted;
1891
+ if (ms < 10) {
1892
+ formatted = "".concat(ms.toFixed(2), "ms");
1893
+ } else if (ms < 100) {
1894
+ formatted = "".concat(ms.toFixed(1), "ms");
1895
+ } else if (ms < 1e3) {
1896
+ formatted = "".concat(ms.toFixed(0), "ms");
1897
+ } else {
1898
+ formatted = "".concat((ms / 1e3).toFixed(2), "s");
1899
+ }
1900
+ return formatted;
1901
+ }
1902
+ function leftPad2(string) {
1903
+ let length2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
1904
+ const padLength = Math.max(length2 - string.length, 0);
1905
+ return "".concat(" ".repeat(padLength)).concat(string);
1906
+ }
1907
+ function formatImage2(image, message, scale2) {
1908
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
1909
+ const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
1910
+ if (image.width > maxWidth) {
1911
+ scale2 = Math.min(scale2, maxWidth / image.width);
1912
+ }
1913
+ const width = image.width * scale2;
1914
+ const height = image.height * scale2;
1915
+ const style = ["font-size:1px;", "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), "color:transparent;"].join("");
1916
+ return ["".concat(message, " %c+"), style];
1917
+ }
1918
+
1919
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/color.js
1920
+ var COLOR2;
1921
+ (function(COLOR3) {
1922
+ COLOR3[COLOR3["BLACK"] = 30] = "BLACK";
1923
+ COLOR3[COLOR3["RED"] = 31] = "RED";
1924
+ COLOR3[COLOR3["GREEN"] = 32] = "GREEN";
1925
+ COLOR3[COLOR3["YELLOW"] = 33] = "YELLOW";
1926
+ COLOR3[COLOR3["BLUE"] = 34] = "BLUE";
1927
+ COLOR3[COLOR3["MAGENTA"] = 35] = "MAGENTA";
1928
+ COLOR3[COLOR3["CYAN"] = 36] = "CYAN";
1929
+ COLOR3[COLOR3["WHITE"] = 37] = "WHITE";
1930
+ COLOR3[COLOR3["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
1931
+ COLOR3[COLOR3["BRIGHT_RED"] = 91] = "BRIGHT_RED";
1932
+ COLOR3[COLOR3["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
1933
+ COLOR3[COLOR3["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
1934
+ COLOR3[COLOR3["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
1935
+ COLOR3[COLOR3["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
1936
+ COLOR3[COLOR3["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
1937
+ COLOR3[COLOR3["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
1938
+ })(COLOR2 || (COLOR2 = {}));
1939
+ function getColor2(color) {
1940
+ return typeof color === "string" ? COLOR2[color.toUpperCase()] || COLOR2.WHITE : color;
1941
+ }
1942
+ function addColor2(string, color, background) {
1943
+ if (!isBrowser5 && typeof string === "string") {
1944
+ if (color) {
1945
+ color = getColor2(color);
1946
+ string = "[".concat(color, "m").concat(string, "");
1947
+ }
1948
+ if (background) {
1949
+ color = getColor2(background);
1950
+ string = "[".concat(background + 10, "m").concat(string, "");
1951
+ }
1952
+ }
1953
+ return string;
1954
+ }
1955
+
1956
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js
1957
+ function autobind2(obj) {
1958
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
1959
+ const proto = Object.getPrototypeOf(obj);
1960
+ const propNames = Object.getOwnPropertyNames(proto);
1961
+ for (const key of propNames) {
1962
+ if (typeof obj[key] === "function") {
1963
+ if (!predefined.find((name) => key === name)) {
1964
+ obj[key] = obj[key].bind(obj);
1965
+ }
1966
+ }
1967
+ }
1968
+ }
1969
+
1970
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/assert.js
1971
+ function assert4(condition, message) {
1972
+ if (!condition) {
1973
+ throw new Error(message || "Assertion failed");
1974
+ }
1975
+ }
1976
+
1977
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js
1978
+ function getHiResTimestamp3() {
1979
+ let timestamp;
1980
+ if (isBrowser5 && "performance" in window_4) {
1981
+ var _window$performance, _window$performance$n;
1982
+ timestamp = window_4 === null || window_4 === void 0 ? void 0 : (_window$performance = window_4.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
1983
+ } else if ("hrtime" in process_2) {
1984
+ var _process$hrtime;
1985
+ const timeParts = process_2 === null || process_2 === void 0 ? void 0 : (_process$hrtime = process_2.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_2);
1986
+ timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
1987
+ } else {
1988
+ timestamp = Date.now();
1989
+ }
1990
+ return timestamp;
1991
+ }
1992
+
1993
+ // ../../node_modules/@probe.gl/log/dist/esm/log.js
1994
+ var originalConsole2 = {
1995
+ debug: isBrowser5 ? console.debug || console.log : console.log,
1996
+ log: console.log,
1997
+ info: console.info,
1998
+ warn: console.warn,
1999
+ error: console.error
2000
+ };
2001
+ var DEFAULT_SETTINGS2 = {
2002
+ enabled: true,
2003
+ level: 0
2004
+ };
2005
+ function noop2() {
2006
+ }
2007
+ var cache2 = {};
2008
+ var ONCE2 = {
2009
+ once: true
2010
+ };
2011
+ var Log2 = class {
2012
+ constructor() {
2013
+ let {
2014
+ id
2015
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
2016
+ id: ""
2017
+ };
2018
+ _defineProperty(this, "id", void 0);
2019
+ _defineProperty(this, "VERSION", VERSION4);
2020
+ _defineProperty(this, "_startTs", getHiResTimestamp3());
2021
+ _defineProperty(this, "_deltaTs", getHiResTimestamp3());
2022
+ _defineProperty(this, "_storage", void 0);
2023
+ _defineProperty(this, "userData", {});
2024
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
2025
+ this.id = id;
2026
+ this._storage = new LocalStorage2("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS2);
2027
+ this.userData = {};
2028
+ this.timeStamp("".concat(this.id, " started"));
2029
+ autobind2(this);
2030
+ Object.seal(this);
2031
+ }
2032
+ set level(newLevel) {
2033
+ this.setLevel(newLevel);
2034
+ }
2035
+ get level() {
2036
+ return this.getLevel();
2037
+ }
2038
+ isEnabled() {
2039
+ return this._storage.config.enabled;
2040
+ }
2041
+ getLevel() {
2042
+ return this._storage.config.level;
2043
+ }
2044
+ getTotal() {
2045
+ return Number((getHiResTimestamp3() - this._startTs).toPrecision(10));
2046
+ }
2047
+ getDelta() {
2048
+ return Number((getHiResTimestamp3() - this._deltaTs).toPrecision(10));
2049
+ }
2050
+ set priority(newPriority) {
2051
+ this.level = newPriority;
2052
+ }
2053
+ get priority() {
2054
+ return this.level;
2055
+ }
2056
+ getPriority() {
2057
+ return this.level;
2058
+ }
2059
+ enable() {
2060
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
2061
+ this._storage.updateConfiguration({
2062
+ enabled
2063
+ });
2064
+ return this;
2065
+ }
2066
+ setLevel(level) {
2067
+ this._storage.updateConfiguration({
2068
+ level
2069
+ });
2070
+ return this;
2071
+ }
2072
+ get(setting) {
2073
+ return this._storage.config[setting];
2074
+ }
2075
+ set(setting, value) {
2076
+ this._storage.updateConfiguration({
2077
+ [setting]: value
2078
+ });
2079
+ }
2080
+ settings() {
2081
+ if (console.table) {
2082
+ console.table(this._storage.config);
2083
+ } else {
2084
+ console.log(this._storage.config);
2085
+ }
2086
+ }
2087
+ assert(condition, message) {
2088
+ assert4(condition, message);
2089
+ }
2090
+ warn(message) {
2091
+ return this._getLogFunction(0, message, originalConsole2.warn, arguments, ONCE2);
2092
+ }
2093
+ error(message) {
2094
+ return this._getLogFunction(0, message, originalConsole2.error, arguments);
2095
+ }
2096
+ deprecated(oldUsage, newUsage) {
2097
+ return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
2098
+ }
2099
+ removed(oldUsage, newUsage) {
2100
+ return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
2101
+ }
2102
+ probe(logLevel, message) {
2103
+ return this._getLogFunction(logLevel, message, originalConsole2.log, arguments, {
2104
+ time: true,
2105
+ once: true
2106
+ });
2107
+ }
2108
+ log(logLevel, message) {
2109
+ return this._getLogFunction(logLevel, message, originalConsole2.debug, arguments);
2110
+ }
2111
+ info(logLevel, message) {
2112
+ return this._getLogFunction(logLevel, message, console.info, arguments);
2113
+ }
2114
+ once(logLevel, message) {
2115
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2116
+ args[_key - 2] = arguments[_key];
2117
+ }
2118
+ return this._getLogFunction(logLevel, message, originalConsole2.debug || originalConsole2.info, arguments, ONCE2);
2119
+ }
2120
+ table(logLevel, table, columns) {
2121
+ if (table) {
2122
+ return this._getLogFunction(logLevel, table, console.table || noop2, columns && [columns], {
2123
+ tag: getTableHeader2(table)
2124
+ });
2125
+ }
2126
+ return noop2;
2127
+ }
2128
+ image(_ref) {
2129
+ let {
2130
+ logLevel,
2131
+ priority,
2132
+ image,
2133
+ message = "",
2134
+ scale: scale2 = 1
2135
+ } = _ref;
2136
+ if (!this._shouldLog(logLevel || priority)) {
2137
+ return noop2;
2138
+ }
2139
+ return isBrowser5 ? logImageInBrowser2({
2140
+ image,
2141
+ message,
2142
+ scale: scale2
2143
+ }) : logImageInNode2({
2144
+ image,
2145
+ message,
2146
+ scale: scale2
2147
+ });
2148
+ }
2149
+ time(logLevel, message) {
2150
+ return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
2151
+ }
2152
+ timeEnd(logLevel, message) {
2153
+ return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
2154
+ }
2155
+ timeStamp(logLevel, message) {
2156
+ return this._getLogFunction(logLevel, message, console.timeStamp || noop2);
2157
+ }
2158
+ group(logLevel, message) {
2159
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
2160
+ collapsed: false
2161
+ };
2162
+ const options = normalizeArguments2({
2163
+ logLevel,
2164
+ message,
2165
+ opts
2166
+ });
2167
+ const {
2168
+ collapsed
2169
+ } = opts;
2170
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
2171
+ return this._getLogFunction(options);
2172
+ }
2173
+ groupCollapsed(logLevel, message) {
2174
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2175
+ return this.group(logLevel, message, Object.assign({}, opts, {
2176
+ collapsed: true
2177
+ }));
2178
+ }
2179
+ groupEnd(logLevel) {
2180
+ return this._getLogFunction(logLevel, "", console.groupEnd || noop2);
2181
+ }
2182
+ withGroup(logLevel, message, func) {
2183
+ this.group(logLevel, message)();
2184
+ try {
2185
+ func();
2186
+ } finally {
2187
+ this.groupEnd(logLevel)();
2188
+ }
2189
+ }
2190
+ trace() {
2191
+ if (console.trace) {
2192
+ console.trace();
2193
+ }
2194
+ }
2195
+ _shouldLog(logLevel) {
2196
+ return this.isEnabled() && this.getLevel() >= normalizeLogLevel2(logLevel);
2197
+ }
2198
+ _getLogFunction(logLevel, message, method, args, opts) {
2199
+ if (this._shouldLog(logLevel)) {
2200
+ opts = normalizeArguments2({
2201
+ logLevel,
2202
+ message,
2203
+ args,
2204
+ opts
2205
+ });
2206
+ method = method || opts.method;
2207
+ assert4(method);
2208
+ opts.total = this.getTotal();
2209
+ opts.delta = this.getDelta();
2210
+ this._deltaTs = getHiResTimestamp3();
2211
+ const tag = opts.tag || opts.message;
2212
+ if (opts.once) {
2213
+ if (!cache2[tag]) {
2214
+ cache2[tag] = getHiResTimestamp3();
2215
+ } else {
2216
+ return noop2;
2217
+ }
2218
+ }
2219
+ message = decorateMessage2(this.id, opts.message, opts);
2220
+ return method.bind(console, message, ...opts.args);
2221
+ }
2222
+ return noop2;
2223
+ }
2224
+ };
2225
+ _defineProperty(Log2, "VERSION", VERSION4);
2226
+ function normalizeLogLevel2(logLevel) {
2227
+ if (!logLevel) {
2228
+ return 0;
2229
+ }
2230
+ let resolvedLevel;
2231
+ switch (typeof logLevel) {
2232
+ case "number":
2233
+ resolvedLevel = logLevel;
2234
+ break;
2235
+ case "object":
2236
+ resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
2237
+ break;
2238
+ default:
2239
+ return 0;
2240
+ }
2241
+ assert4(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
2242
+ return resolvedLevel;
2243
+ }
2244
+ function normalizeArguments2(opts) {
2245
+ const {
2246
+ logLevel,
2247
+ message
2248
+ } = opts;
2249
+ opts.logLevel = normalizeLogLevel2(logLevel);
2250
+ const args = opts.args ? Array.from(opts.args) : [];
2251
+ while (args.length && args.shift() !== message) {
2252
+ }
2253
+ switch (typeof logLevel) {
2254
+ case "string":
2255
+ case "function":
2256
+ if (message !== void 0) {
2257
+ args.unshift(message);
2258
+ }
2259
+ opts.message = logLevel;
2260
+ break;
2261
+ case "object":
2262
+ Object.assign(opts, logLevel);
2263
+ break;
2264
+ default:
2265
+ }
2266
+ if (typeof opts.message === "function") {
2267
+ opts.message = opts.message();
2268
+ }
2269
+ const messageType = typeof opts.message;
2270
+ assert4(messageType === "string" || messageType === "object");
2271
+ return Object.assign(opts, {
2272
+ args
2273
+ }, opts.opts);
2274
+ }
2275
+ function decorateMessage2(id, message, opts) {
2276
+ if (typeof message === "string") {
2277
+ const time = opts.time ? leftPad2(formatTime2(opts.total)) : "";
2278
+ message = opts.time ? "".concat(id, ": ").concat(time, " ").concat(message) : "".concat(id, ": ").concat(message);
2279
+ message = addColor2(message, opts.color, opts.background);
2280
+ }
2281
+ return message;
2282
+ }
2283
+ function logImageInNode2(_ref2) {
2284
+ let {
2285
+ image,
2286
+ message = "",
2287
+ scale: scale2 = 1
2288
+ } = _ref2;
2289
+ let asciify = null;
2290
+ try {
2291
+ asciify = module.require("asciify-image");
2292
+ } catch (error) {
2293
+ }
2294
+ if (asciify) {
2295
+ return () => asciify(image, {
2296
+ fit: "box",
2297
+ width: "".concat(Math.round(80 * scale2), "%")
2298
+ }).then((data) => console.log(data));
2299
+ }
2300
+ return noop2;
2301
+ }
2302
+ function logImageInBrowser2(_ref3) {
2303
+ let {
2304
+ image,
2305
+ message = "",
2306
+ scale: scale2 = 1
2307
+ } = _ref3;
2308
+ if (typeof image === "string") {
2309
+ const img = new Image();
2310
+ img.onload = () => {
2311
+ const args = formatImage2(img, message, scale2);
2312
+ console.log(...args);
2313
+ };
2314
+ img.src = image;
2315
+ return noop2;
2316
+ }
2317
+ const element = image.nodeName || "";
2318
+ if (element.toLowerCase() === "img") {
2319
+ console.log(...formatImage2(image, message, scale2));
2320
+ return noop2;
2321
+ }
2322
+ if (element.toLowerCase() === "canvas") {
2323
+ const img = new Image();
2324
+ img.onload = () => console.log(...formatImage2(img, message, scale2));
2325
+ img.src = image.toDataURL();
2326
+ return noop2;
2327
+ }
2328
+ return noop2;
2329
+ }
2330
+ function getTableHeader2(table) {
2331
+ for (const key in table) {
2332
+ for (const title in table[key]) {
2333
+ return title || "untitled";
2334
+ }
2335
+ }
2336
+ return "empty";
2337
+ }
2338
+
2339
+ // ../../node_modules/@probe.gl/log/dist/esm/index.js
2340
+ var esm_default2 = new Log2({
2341
+ id: "@probe.gl/log"
2342
+ });
2343
+
2344
+ // ../core/src/lib/utils/log.ts
2345
+ var log = new Log2({ id: "loaders.gl" });
2346
+
1713
2347
  // ../core/src/lib/api/select-loader.ts
1714
2348
  var EXT_PATTERN = /\.([^.]+)$/;
1715
2349
  async function selectLoader(data, loaders = [], options, context) {
@@ -1754,13 +2388,22 @@
1754
2388
  const { url, type } = getResourceUrlAndType(data);
1755
2389
  const testUrl = url || context?.url;
1756
2390
  let loader = null;
2391
+ let reason = "";
1757
2392
  if (options?.mimeType) {
1758
2393
  loader = findLoaderByMIMEType(loaders, options?.mimeType);
2394
+ reason = `match forced by supplied MIME type ${options?.mimeType}`;
1759
2395
  }
1760
2396
  loader = loader || findLoaderByUrl(loaders, testUrl);
2397
+ reason = reason || (loader ? `matched url ${testUrl}` : "");
1761
2398
  loader = loader || findLoaderByMIMEType(loaders, type);
2399
+ reason = reason || (loader ? `matched MIME type ${type}` : "");
1762
2400
  loader = loader || findLoaderByInitialBytes(loaders, data);
2401
+ reason = reason || (loader ? `matched initial data ${getFirstCharacters(data)}` : "");
1763
2402
  loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
2403
+ reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
2404
+ if (reason) {
2405
+ log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
2406
+ }
1764
2407
  return loader;
1765
2408
  }
1766
2409
  function validHTTPResponse(data) {
@@ -2118,7 +2761,7 @@
2118
2761
  }
2119
2762
 
2120
2763
  // ../../node_modules/@math.gl/core/dist/esm/lib/assert.js
2121
- function assert4(condition, message) {
2764
+ function assert5(condition, message) {
2122
2765
  if (!condition) {
2123
2766
  throw new Error("math.gl assertion ".concat(message));
2124
2767
  }
@@ -2230,7 +2873,7 @@
2230
2873
  }
2231
2874
  var MathArray = class extends _extendableBuiltin(Array) {
2232
2875
  get ELEMENTS() {
2233
- assert4(false);
2876
+ assert5(false);
2234
2877
  return 0;
2235
2878
  }
2236
2879
  clone() {
@@ -2445,11 +3088,11 @@
2445
3088
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js
2446
3089
  var Vector = class extends MathArray {
2447
3090
  get ELEMENTS() {
2448
- assert4(false);
3091
+ assert5(false);
2449
3092
  return 0;
2450
3093
  }
2451
3094
  copy(vector) {
2452
- assert4(false);
3095
+ assert5(false);
2453
3096
  return this;
2454
3097
  }
2455
3098
  get x() {
@@ -2533,11 +3176,11 @@
2533
3176
  return this.distanceSquared(vector);
2534
3177
  }
2535
3178
  getComponent(i2) {
2536
- assert4(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
3179
+ assert5(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
2537
3180
  return checkNumber(this[i2]);
2538
3181
  }
2539
3182
  setComponent(i2, value) {
2540
- assert4(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
3183
+ assert5(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
2541
3184
  this[i2] = value;
2542
3185
  return this.check();
2543
3186
  }
@@ -2885,11 +3528,11 @@
2885
3528
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js
2886
3529
  var Matrix = class extends MathArray {
2887
3530
  get ELEMENTS() {
2888
- assert4(false);
3531
+ assert5(false);
2889
3532
  return 0;
2890
3533
  }
2891
3534
  get RANK() {
2892
- assert4(false);
3535
+ assert5(false);
2893
3536
  return 0;
2894
3537
  }
2895
3538
  toString() {
@@ -3944,13 +4587,13 @@
3944
4587
  };
3945
4588
 
3946
4589
  // ../../node_modules/@math.gl/core/dist/esm/index.js
3947
- var globals4 = {
4590
+ var globals5 = {
3948
4591
  self: typeof self !== "undefined" && self,
3949
4592
  window: typeof window !== "undefined" && window,
3950
4593
  global: typeof global !== "undefined" && global
3951
4594
  };
3952
- var global_4 = globals4.global || globals4.self || globals4.window;
3953
- global_4.mathgl = {
4595
+ var global_5 = globals5.global || globals5.self || globals5.window;
4596
+ global_5.mathgl = {
3954
4597
  config
3955
4598
  };
3956
4599
 
@@ -3968,9 +4611,9 @@
3968
4611
  };
3969
4612
 
3970
4613
  // ../../node_modules/@math.gl/geospatial/dist/esm/type-utils.js
3971
- var noop2 = (x) => x;
4614
+ var noop3 = (x) => x;
3972
4615
  var scratchVector = new Vector3();
3973
- function fromCartographic(cartographic, result, map3 = noop2) {
4616
+ function fromCartographic(cartographic, result, map3 = noop3) {
3974
4617
  if (isArray(cartographic)) {
3975
4618
  result[0] = map3(cartographic[0]);
3976
4619
  result[1] = map3(cartographic[1]);
@@ -3987,9 +4630,9 @@
3987
4630
  return result;
3988
4631
  }
3989
4632
  function fromCartographicToRadians(cartographic, vector = scratchVector) {
3990
- return fromCartographic(cartographic, vector, config._cartographicRadians ? noop2 : toRadians);
4633
+ return fromCartographic(cartographic, vector, config._cartographicRadians ? noop3 : toRadians);
3991
4634
  }
3992
- function toCartographic(vector, cartographic, map3 = noop2) {
4635
+ function toCartographic(vector, cartographic, map3 = noop3) {
3993
4636
  if (isArray(cartographic)) {
3994
4637
  cartographic[0] = map3(vector[0]);
3995
4638
  cartographic[1] = map3(vector[1]);
@@ -4006,7 +4649,7 @@
4006
4649
  return cartographic;
4007
4650
  }
4008
4651
  function toCartographicFromRadians(vector, cartographic) {
4009
- return toCartographic(vector, cartographic, config._cartographicRadians ? noop2 : toDegrees);
4652
+ return toCartographic(vector, cartographic, config._cartographicRadians ? noop3 : toDegrees);
4010
4653
  }
4011
4654
 
4012
4655
  // ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/scale-to-geodetic-surface.js
@@ -4131,7 +4774,7 @@
4131
4774
  var scratchVector3 = new Vector3();
4132
4775
  function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
4133
4776
  const thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
4134
- assert4(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
4777
+ assert5(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
4135
4778
  let firstAxisVector;
4136
4779
  let secondAxisVector;
4137
4780
  let thirdAxisVector;
@@ -4205,9 +4848,9 @@
4205
4848
  return wgs84;
4206
4849
  }
4207
4850
  constructor(x = 0, y = 0, z = 0) {
4208
- assert4(x >= 0);
4209
- assert4(y >= 0);
4210
- assert4(z >= 0);
4851
+ assert5(x >= 0);
4852
+ assert5(y >= 0);
4853
+ assert5(z >= 0);
4211
4854
  this.radii = new Vector3(x, y, z);
4212
4855
  this.radiiSquared = new Vector3(x * x, y * y, z * z);
4213
4856
  this.radiiToTheFourth = new Vector3(x * x * x * x, y * y * y * y, z * z * z * z);
@@ -4292,8 +4935,8 @@
4292
4935
  return scratchPosition.from(position).scale(this.radii).to(result);
4293
4936
  }
4294
4937
  getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
4295
- assert4(equals(this.radii.x, this.radii.y, math_utils_default.EPSILON15));
4296
- assert4(this.radii.z > 0);
4938
+ assert5(equals(this.radii.x, this.radii.y, math_utils_default.EPSILON15));
4939
+ assert5(this.radii.z > 0);
4297
4940
  scratchPosition.from(position);
4298
4941
  const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);
4299
4942
  if (Math.abs(z) >= this.radii.z - buffer) {
@@ -4304,7 +4947,7 @@
4304
4947
  };
4305
4948
 
4306
4949
  // ../images/src/lib/utils/version.ts
4307
- var VERSION4 = true ? "3.1.6" : "latest";
4950
+ var VERSION5 = true ? "3.2.0-alpha.1" : "latest";
4308
4951
 
4309
4952
  // ../images/src/lib/category-api/image-type.ts
4310
4953
  var { _parseImageNode } = globalThis;
@@ -4643,7 +5286,7 @@
4643
5286
  id: "image",
4644
5287
  module: "images",
4645
5288
  name: "Images",
4646
- version: VERSION4,
5289
+ version: VERSION5,
4647
5290
  mimeTypes: MIME_TYPES,
4648
5291
  extensions: EXTENSIONS,
4649
5292
  parse: parseImage,
@@ -4652,7 +5295,7 @@
4652
5295
  };
4653
5296
 
4654
5297
  // ../draco/src/lib/utils/version.ts
4655
- var VERSION5 = true ? "3.1.6" : "latest";
5298
+ var VERSION6 = true ? "3.2.0-alpha.1" : "latest";
4656
5299
 
4657
5300
  // ../draco/src/draco-loader.ts
4658
5301
  var DEFAULT_DRACO_OPTIONS = {
@@ -4668,7 +5311,7 @@
4668
5311
  id: "draco",
4669
5312
  module: "draco",
4670
5313
  shapes: ["mesh"],
4671
- version: VERSION5,
5314
+ version: VERSION6,
4672
5315
  worker: true,
4673
5316
  extensions: ["drc"],
4674
5317
  mimeTypes: ["application/octet-stream"],
@@ -4705,7 +5348,7 @@
4705
5348
  }
4706
5349
 
4707
5350
  // ../schema/src/lib/utils/assert.ts
4708
- function assert5(condition, message) {
5351
+ function assert6(condition, message) {
4709
5352
  if (!condition) {
4710
5353
  throw new Error(message || "loader assertion failed.");
4711
5354
  }
@@ -4714,7 +5357,7 @@
4714
5357
  // ../schema/src/lib/schema/impl/schema.ts
4715
5358
  var Schema = class {
4716
5359
  constructor(fields, metadata) {
4717
- assert5(Array.isArray(fields));
5360
+ assert6(Array.isArray(fields));
4718
5361
  checkNames(fields);
4719
5362
  this.fields = fields;
4720
5363
  this.metadata = metadata || new Map();
@@ -5636,12 +6279,12 @@
5636
6279
  }
5637
6280
 
5638
6281
  // ../textures/src/lib/utils/version.ts
5639
- var VERSION6 = true ? "3.1.6" : "latest";
6282
+ var VERSION7 = true ? "3.2.0-alpha.1" : "beta";
5640
6283
 
5641
6284
  // ../textures/src/lib/parsers/basis-module-loader.ts
5642
- var VERSION7 = true ? "3.1.6" : "latest";
5643
- var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.wasm`;
5644
- var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.js`;
6285
+ var VERSION8 = true ? "3.2.0-alpha.1" : "beta";
6286
+ var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.wasm`;
6287
+ var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.js`;
5645
6288
  var loadBasisTranscoderPromise;
5646
6289
  async function loadBasisTrascoderModule(options) {
5647
6290
  const modules = options.modules || {};
@@ -6120,7 +6763,7 @@
6120
6763
  const basisFile = new BasisFile(new Uint8Array(data));
6121
6764
  try {
6122
6765
  if (!basisFile.startTranscoding()) {
6123
- return null;
6766
+ throw new Error("Failed to start basis transcoding");
6124
6767
  }
6125
6768
  const imageCount = basisFile.getNumImages();
6126
6769
  const images = [];
@@ -6146,22 +6789,22 @@
6146
6789
  const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
6147
6790
  const decodedData = new Uint8Array(decodedSize);
6148
6791
  if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
6149
- return null;
6792
+ throw new Error("failed to start Basis transcoding");
6150
6793
  }
6151
6794
  return {
6152
6795
  width,
6153
6796
  height,
6154
6797
  data: decodedData,
6155
6798
  compressed,
6156
- hasAlpha,
6157
- format
6799
+ format,
6800
+ hasAlpha
6158
6801
  };
6159
6802
  }
6160
6803
  function parseKTX2File(KTX2File, data, options) {
6161
6804
  const ktx2File = new KTX2File(new Uint8Array(data));
6162
6805
  try {
6163
6806
  if (!ktx2File.startTranscoding()) {
6164
- return null;
6807
+ throw new Error("failed to start KTX2 transcoding");
6165
6808
  }
6166
6809
  const levelsCount = ktx2File.getLevels();
6167
6810
  const levels = [];
@@ -6169,7 +6812,7 @@
6169
6812
  levels.push(transcodeKTX2Image(ktx2File, levelIndex, options));
6170
6813
  break;
6171
6814
  }
6172
- return levels;
6815
+ return [levels];
6173
6816
  } finally {
6174
6817
  ktx2File.close();
6175
6818
  ktx2File.delete();
@@ -6181,14 +6824,14 @@
6181
6824
  const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
6182
6825
  const decodedData = new Uint8Array(decodedSize);
6183
6826
  if (!ktx2File.transcodeImage(decodedData, levelIndex, 0, 0, basisFormat, 0, -1, -1)) {
6184
- return null;
6827
+ throw new Error("Failed to transcode KTX2 image");
6185
6828
  }
6186
6829
  return {
6187
6830
  width,
6188
6831
  height,
6189
6832
  data: decodedData,
6190
6833
  compressed,
6191
- alphaFlag,
6834
+ hasAlpha: alphaFlag,
6192
6835
  format
6193
6836
  };
6194
6837
  }
@@ -6230,7 +6873,7 @@
6230
6873
  name: "Basis",
6231
6874
  id: "basis",
6232
6875
  module: "textures",
6233
- version: VERSION6,
6876
+ version: VERSION7,
6234
6877
  worker: true,
6235
6878
  extensions: ["basis", "ktx2"],
6236
6879
  mimeTypes: ["application/octet-stream", "image/ktx2"],
@@ -6543,7 +7186,7 @@
6543
7186
  name: "Texture Containers",
6544
7187
  id: "compressed-texture",
6545
7188
  module: "textures",
6546
- version: VERSION6,
7189
+ version: VERSION7,
6547
7190
  worker: true,
6548
7191
  extensions: [
6549
7192
  "ktx",
@@ -6574,7 +7217,7 @@
6574
7217
  containerFormat: "ktx2",
6575
7218
  module: "encoder"
6576
7219
  };
6577
- return await parseBasis(arrayBuffer, options);
7220
+ return (await parseBasis(arrayBuffer, options))[0];
6578
7221
  }
6579
7222
  return parseCompressedTexture(arrayBuffer);
6580
7223
  }
@@ -6605,7 +7248,7 @@
6605
7248
  }
6606
7249
 
6607
7250
  // ../../node_modules/@luma.gl/constants/dist/esm/index.js
6608
- var esm_default2 = {
7251
+ var esm_default3 = {
6609
7252
  DEPTH_BUFFER_BIT: 256,
6610
7253
  STENCIL_BUFFER_BIT: 1024,
6611
7254
  COLOR_BUFFER_BIT: 16384,
@@ -7240,11 +7883,11 @@
7240
7883
  }
7241
7884
  }
7242
7885
  var GL_TYPE_MAP = {
7243
- UInt8: esm_default2.UNSIGNED_BYTE,
7244
- UInt16: esm_default2.UNSIGNED_INT,
7245
- Float32: esm_default2.FLOAT,
7246
- UInt32: esm_default2.UNSIGNED_INT,
7247
- UInt64: esm_default2.DOUBLE
7886
+ UInt8: esm_default3.UNSIGNED_BYTE,
7887
+ UInt16: esm_default3.UNSIGNED_INT,
7888
+ Float32: esm_default3.FLOAT,
7889
+ UInt32: esm_default3.UNSIGNED_INT,
7890
+ UInt64: esm_default3.DOUBLE
7248
7891
  };
7249
7892
  function sizeOf(dataType) {
7250
7893
  switch (dataType) {
@@ -7308,7 +7951,10 @@
7308
7951
  tile.content.texture = await parse(arrayBuffer2, loader, options2);
7309
7952
  }
7310
7953
  } else if (loader === CompressedTextureLoader || loader === BasisLoader) {
7311
- const texture = await load(arrayBuffer2, loader, tile.textureLoaderOptions);
7954
+ let texture = await load(arrayBuffer2, loader, tile.textureLoaderOptions);
7955
+ if (loader === BasisLoader) {
7956
+ texture = texture[0];
7957
+ }
7312
7958
  tile.content.texture = {
7313
7959
  compressed: true,
7314
7960
  mipmaps: false,
@@ -7460,38 +8106,38 @@
7460
8106
  byteOffset
7461
8107
  };
7462
8108
  }
7463
- function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder) {
8109
+ function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attributeCount, attributesOrder) {
7464
8110
  const attributes = {};
7465
8111
  for (const attribute of attributesOrder) {
7466
8112
  if (vertexAttributes[attribute]) {
7467
8113
  const { valueType, valuesPerElement } = vertexAttributes[attribute];
7468
- const count = vertexCount;
7469
- if (byteOffset + count * valuesPerElement > arrayBuffer.byteLength) {
8114
+ if (byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <= arrayBuffer.byteLength) {
8115
+ const buffer = arrayBuffer.slice(byteOffset);
8116
+ let value;
8117
+ if (valueType === "UInt64") {
8118
+ value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));
8119
+ } else {
8120
+ const TypedArrayType = getConstructorForDataFormat(valueType);
8121
+ value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);
8122
+ }
8123
+ attributes[attribute] = {
8124
+ value,
8125
+ type: GL_TYPE_MAP[valueType],
8126
+ size: valuesPerElement
8127
+ };
8128
+ switch (attribute) {
8129
+ case "color":
8130
+ attributes.color.normalized = true;
8131
+ break;
8132
+ case "position":
8133
+ case "region":
8134
+ case "normal":
8135
+ default:
8136
+ }
8137
+ byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);
8138
+ } else if (attribute !== "uv0") {
7470
8139
  break;
7471
8140
  }
7472
- const buffer = arrayBuffer.slice(byteOffset);
7473
- let value;
7474
- if (valueType === "UInt64") {
7475
- value = parseUint64Values(buffer, count * valuesPerElement, sizeOf(valueType));
7476
- } else {
7477
- const TypedArrayType = getConstructorForDataFormat(valueType);
7478
- value = new TypedArrayType(buffer, 0, count * valuesPerElement);
7479
- }
7480
- attributes[attribute] = {
7481
- value,
7482
- type: GL_TYPE_MAP[valueType],
7483
- size: valuesPerElement
7484
- };
7485
- switch (attribute) {
7486
- case "color":
7487
- attributes.color.normalized = true;
7488
- break;
7489
- case "position":
7490
- case "region":
7491
- case "normal":
7492
- default:
7493
- }
7494
- byteOffset = byteOffset + count * valuesPerElement * sizeOf(valueType);
7495
8141
  }
7496
8142
  }
7497
8143
  return { attributes, byteOffset };
@@ -7642,13 +8288,13 @@
7642
8288
  }
7643
8289
 
7644
8290
  // src/i3s-content-loader.ts
7645
- var VERSION8 = true ? "3.1.6" : "latest";
8291
+ var VERSION9 = true ? "3.2.0-alpha.1" : "beta";
7646
8292
  var I3SContentLoader = {
7647
8293
  name: "I3S Content (Indexed Scene Layers)",
7648
8294
  id: "i3s-content",
7649
8295
  module: "i3s",
7650
8296
  worker: true,
7651
- version: VERSION8,
8297
+ version: VERSION9,
7652
8298
  mimeTypes: ["application/octet-stream"],
7653
8299
  parse: parse3,
7654
8300
  extensions: ["bin"],