@loaders.gl/i3s 4.0.0-alpha.4 → 4.0.0-alpha.6

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 (186) hide show
  1. package/dist/arcgis-webscene-loader.d.ts +7 -0
  2. package/dist/arcgis-webscene-loader.d.ts.map +1 -0
  3. package/dist/arcgis-webscene-loader.js +28 -0
  4. package/dist/bundle.d.ts +2 -0
  5. package/dist/bundle.d.ts.map +1 -0
  6. package/dist/bundle.js +2 -2
  7. package/dist/dist.min.js +10631 -0
  8. package/dist/es5/arcgis-webscene-loader.js +40 -0
  9. package/dist/es5/arcgis-webscene-loader.js.map +1 -0
  10. package/dist/es5/bundle.js +6 -0
  11. package/dist/es5/bundle.js.map +1 -0
  12. package/dist/es5/i3s-attribute-loader.js +195 -0
  13. package/dist/es5/i3s-attribute-loader.js.map +1 -0
  14. package/dist/es5/i3s-building-scene-layer-loader.js +46 -0
  15. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -0
  16. package/dist/es5/i3s-content-loader.js +57 -0
  17. package/dist/es5/i3s-content-loader.js.map +1 -0
  18. package/dist/es5/i3s-loader.js +193 -0
  19. package/dist/es5/i3s-loader.js.map +1 -0
  20. package/dist/es5/i3s-node-page-loader.js +39 -0
  21. package/dist/es5/i3s-node-page-loader.js.map +1 -0
  22. package/dist/es5/index.js +61 -0
  23. package/dist/es5/index.js.map +1 -0
  24. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +312 -0
  25. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
  26. package/dist/es5/lib/parsers/constants.js +72 -0
  27. package/dist/es5/lib/parsers/constants.js.map +1 -0
  28. package/dist/es5/lib/parsers/parse-arcgis-webscene.js +158 -0
  29. package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -0
  30. package/dist/es5/lib/parsers/parse-i3s-attribute.js +76 -0
  31. package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -0
  32. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +65 -0
  33. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
  34. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +510 -0
  35. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -0
  36. package/dist/es5/lib/parsers/parse-i3s.js +116 -0
  37. package/dist/es5/lib/parsers/parse-i3s.js.map +1 -0
  38. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +17 -0
  39. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  40. package/dist/es5/lib/utils/customizeColors.js +159 -0
  41. package/dist/es5/lib/utils/customizeColors.js.map +1 -0
  42. package/dist/es5/lib/utils/url-utils.js +33 -0
  43. package/dist/es5/lib/utils/url-utils.js.map +1 -0
  44. package/dist/es5/types.js +26 -0
  45. package/dist/es5/types.js.map +1 -0
  46. package/dist/es5/workers/i3s-content-nodejs-worker.js +7 -0
  47. package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -0
  48. package/dist/es5/workers/i3s-content-worker.js +6 -0
  49. package/dist/es5/workers/i3s-content-worker.js.map +1 -0
  50. package/dist/esm/arcgis-webscene-loader.js +16 -0
  51. package/dist/esm/arcgis-webscene-loader.js.map +1 -0
  52. package/dist/esm/bundle.js +4 -0
  53. package/dist/esm/bundle.js.map +1 -0
  54. package/dist/esm/i3s-attribute-loader.js +119 -0
  55. package/dist/esm/i3s-attribute-loader.js.map +1 -0
  56. package/dist/esm/i3s-building-scene-layer-loader.js +19 -0
  57. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -0
  58. package/dist/esm/i3s-content-loader.js +31 -0
  59. package/dist/esm/i3s-content-loader.js.map +1 -0
  60. package/dist/esm/i3s-loader.js +87 -0
  61. package/dist/esm/i3s-loader.js.map +1 -0
  62. package/dist/esm/i3s-node-page-loader.js +15 -0
  63. package/dist/esm/i3s-node-page-loader.js.map +1 -0
  64. package/dist/esm/index.js +8 -0
  65. package/dist/esm/index.js.map +1 -0
  66. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +198 -0
  67. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
  68. package/dist/esm/lib/parsers/constants.js +57 -0
  69. package/dist/esm/lib/parsers/constants.js.map +1 -0
  70. package/dist/esm/lib/parsers/parse-arcgis-webscene.js +70 -0
  71. package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -0
  72. package/dist/esm/lib/parsers/parse-i3s-attribute.js +60 -0
  73. package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -0
  74. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +39 -0
  75. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
  76. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +435 -0
  77. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -0
  78. package/dist/esm/lib/parsers/parse-i3s.js +83 -0
  79. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -0
  80. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js +9 -0
  81. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  82. package/dist/esm/lib/utils/customizeColors.js +92 -0
  83. package/dist/esm/lib/utils/customizeColors.js.map +1 -0
  84. package/dist/esm/lib/utils/url-utils.js +28 -0
  85. package/dist/esm/lib/utils/url-utils.js.map +1 -0
  86. package/dist/esm/types.js +18 -0
  87. package/dist/esm/types.js.map +1 -0
  88. package/dist/esm/workers/i3s-content-nodejs-worker.js +5 -0
  89. package/dist/esm/workers/i3s-content-nodejs-worker.js.map +1 -0
  90. package/dist/esm/workers/i3s-content-worker.js +4 -0
  91. package/dist/esm/workers/i3s-content-worker.js.map +1 -0
  92. package/dist/i3s-attribute-loader.d.ts +21 -0
  93. package/dist/i3s-attribute-loader.d.ts.map +1 -0
  94. package/dist/i3s-attribute-loader.js +155 -132
  95. package/dist/i3s-building-scene-layer-loader.d.ts +6 -0
  96. package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -0
  97. package/dist/i3s-building-scene-layer-loader.js +23 -18
  98. package/dist/i3s-content-loader.d.ts +6 -0
  99. package/dist/i3s-content-loader.d.ts.map +1 -0
  100. package/dist/i3s-content-loader.js +30 -22
  101. package/dist/i3s-content-nodejs-worker.js +198 -0
  102. package/dist/i3s-content-nodejs-worker.js.map +7 -0
  103. package/dist/i3s-content-worker.js +1523 -1383
  104. package/dist/i3s-loader.d.ts +11 -0
  105. package/dist/i3s-loader.d.ts.map +1 -0
  106. package/dist/i3s-loader.js +88 -83
  107. package/dist/i3s-node-page-loader.d.ts +7 -0
  108. package/dist/i3s-node-page-loader.d.ts.map +1 -0
  109. package/dist/i3s-node-page-loader.js +20 -20
  110. package/dist/index.d.ts +9 -0
  111. package/dist/index.d.ts.map +1 -0
  112. package/dist/index.js +19 -6
  113. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +74 -0
  114. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -0
  115. package/dist/lib/helpers/i3s-nodepages-tiles.js +232 -219
  116. package/dist/lib/parsers/constants.d.ts +40 -0
  117. package/dist/lib/parsers/constants.d.ts.map +1 -0
  118. package/dist/lib/parsers/constants.js +87 -49
  119. package/dist/lib/parsers/parse-arcgis-webscene.d.ts +7 -0
  120. package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -0
  121. package/dist/lib/parsers/parse-arcgis-webscene.js +88 -0
  122. package/dist/lib/parsers/parse-i3s-attribute.d.ts +12 -0
  123. package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -0
  124. package/dist/lib/parsers/parse-i3s-attribute.js +87 -62
  125. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +9 -0
  126. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -0
  127. package/dist/lib/parsers/parse-i3s-building-scene-layer.js +41 -38
  128. package/dist/lib/parsers/parse-i3s-tile-content.d.ts +4 -0
  129. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -0
  130. package/dist/lib/parsers/parse-i3s-tile-content.js +458 -461
  131. package/dist/lib/parsers/parse-i3s.d.ts +6 -0
  132. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -0
  133. package/dist/lib/parsers/parse-i3s.js +92 -73
  134. package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts +2 -0
  135. package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts.map +1 -0
  136. package/dist/lib/utils/convert-i3s-obb-to-mbs.js +19 -8
  137. package/dist/lib/utils/customizeColors.d.ts +14 -0
  138. package/dist/lib/utils/customizeColors.d.ts.map +1 -0
  139. package/dist/lib/utils/customizeColors.js +94 -0
  140. package/dist/lib/utils/url-utils.d.ts +22 -0
  141. package/dist/lib/utils/url-utils.d.ts.map +1 -0
  142. package/dist/lib/utils/url-utils.js +41 -29
  143. package/dist/types.d.ts +1064 -0
  144. package/dist/types.d.ts.map +1 -0
  145. package/dist/types.js +20 -2
  146. package/dist/workers/i3s-content-nodejs-worker.d.ts +2 -0
  147. package/dist/workers/i3s-content-nodejs-worker.d.ts.map +1 -0
  148. package/dist/workers/i3s-content-nodejs-worker.js +6 -0
  149. package/dist/workers/i3s-content-worker.d.ts +2 -0
  150. package/dist/workers/i3s-content-worker.d.ts.map +1 -0
  151. package/dist/workers/i3s-content-worker.js +5 -4
  152. package/package.json +17 -17
  153. package/src/arcgis-webscene-loader.ts +31 -0
  154. package/src/i3s-attribute-loader.ts +9 -9
  155. package/src/i3s-content-loader.ts +19 -6
  156. package/src/i3s-loader.ts +22 -13
  157. package/src/i3s-node-page-loader.ts +6 -10
  158. package/src/index.ts +24 -7
  159. package/src/lib/helpers/i3s-nodepages-tiles.ts +84 -57
  160. package/src/lib/parsers/constants.ts +68 -55
  161. package/src/lib/parsers/parse-arcgis-webscene.ts +102 -0
  162. package/src/lib/parsers/parse-i3s-attribute.ts +21 -14
  163. package/src/lib/parsers/parse-i3s-building-scene-layer.ts +2 -1
  164. package/src/lib/parsers/parse-i3s-tile-content.ts +227 -200
  165. package/src/lib/parsers/parse-i3s.ts +55 -39
  166. package/src/lib/utils/customizeColors.ts +134 -0
  167. package/src/lib/utils/url-utils.ts +7 -7
  168. package/src/types.ts +874 -86
  169. package/src/workers/i3s-content-nodejs-worker.ts +5 -0
  170. package/dist/bundle.js.map +0 -1
  171. package/dist/i3s-attribute-loader.js.map +0 -1
  172. package/dist/i3s-building-scene-layer-loader.js.map +0 -1
  173. package/dist/i3s-content-loader.js.map +0 -1
  174. package/dist/i3s-loader.js.map +0 -1
  175. package/dist/i3s-node-page-loader.js.map +0 -1
  176. package/dist/index.js.map +0 -1
  177. package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
  178. package/dist/lib/parsers/constants.js.map +0 -1
  179. package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
  180. package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
  181. package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
  182. package/dist/lib/parsers/parse-i3s.js.map +0 -1
  183. package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
  184. package/dist/lib/utils/url-utils.js.map +0 -1
  185. package/dist/types.js.map +0 -1
  186. package/dist/workers/i3s-content-worker.js.map +0 -1
@@ -1,11 +1,36 @@
1
1
  (() => {
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3
8
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
9
+ var __commonJS = (cb, mod) => function __require() {
10
+ return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ };
4
12
  var __export = (target, all) => {
5
13
  __markAsModule(target);
6
14
  for (var name in all)
7
15
  __defProp(target, name, { get: all[name], enumerable: true });
8
16
  };
17
+ var __reExport = (target, module, desc) => {
18
+ if (module && typeof module === "object" || typeof module === "function") {
19
+ for (let key of __getOwnPropNames(module))
20
+ if (!__hasOwnProp.call(target, key) && key !== "default")
21
+ __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
22
+ }
23
+ return target;
24
+ };
25
+ var __toModule = (module) => {
26
+ return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
27
+ };
28
+
29
+ // (disabled):../worker-utils/src/lib/node/require-utils.node
30
+ var require_require_utils = __commonJS({
31
+ "(disabled):../worker-utils/src/lib/node/require-utils.node"() {
32
+ }
33
+ });
9
34
 
10
35
  // ../loader-utils/src/lib/env-utils/assert.ts
11
36
  function assert(condition, message) {
@@ -30,9 +55,8 @@
30
55
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
31
56
 
32
57
  // ../worker-utils/src/lib/env-utils/version.ts
33
- var DEFAULT_VERSION = "beta";
34
- var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : DEFAULT_VERSION;
35
- if (typeof __VERSION__ === "undefined") {
58
+ var VERSION = true ? "4.0.0-alpha.6" : DEFAULT_VERSION;
59
+ if (false) {
36
60
  console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
37
61
  }
38
62
 
@@ -63,15 +87,15 @@
63
87
  // ../worker-utils/src/lib/worker-farm/worker-job.ts
64
88
  var WorkerJob = class {
65
89
  constructor(jobName, workerThread) {
66
- this.name = jobName;
67
- this.workerThread = workerThread;
68
90
  this.isRunning = true;
69
91
  this._resolve = () => {
70
92
  };
71
93
  this._reject = () => {
72
94
  };
73
- this.result = new Promise((resolve, reject) => {
74
- this._resolve = resolve;
95
+ this.name = jobName;
96
+ this.workerThread = workerThread;
97
+ this.result = new Promise((resolve2, reject) => {
98
+ this._resolve = resolve2;
75
99
  this._reject = reject;
76
100
  });
77
101
  }
@@ -94,6 +118,12 @@
94
118
  }
95
119
  };
96
120
 
121
+ // ../worker-utils/src/lib/node/worker_threads-browser.ts
122
+ var Worker2 = class {
123
+ terminate() {
124
+ }
125
+ };
126
+
97
127
  // ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
98
128
  var workerURLCache = new Map();
99
129
  function getLoadableWorkerURL(props) {
@@ -181,10 +211,10 @@
181
211
  this.url = url;
182
212
  this.onMessage = NOOP;
183
213
  this.onError = (error) => console.log(error);
184
- this.worker = this._createBrowserWorker();
214
+ this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
185
215
  }
186
216
  static isSupported() {
187
- return typeof Worker !== "undefined";
217
+ return typeof Worker !== "undefined" && isBrowser2 || typeof Worker2 !== "undefined" && !isBrowser2;
188
218
  }
189
219
  destroy() {
190
220
  this.onMessage = NOOP;
@@ -227,6 +257,27 @@
227
257
  worker.onmessageerror = (event) => console.error(event);
228
258
  return worker;
229
259
  }
260
+ _createNodeWorker() {
261
+ let worker;
262
+ if (this.url) {
263
+ const absolute = this.url.includes(":/") || this.url.startsWith("/");
264
+ const url = absolute ? this.url : `./${this.url}`;
265
+ worker = new Worker2(url, { eval: false });
266
+ } else if (this.source) {
267
+ worker = new Worker2(this.source, { eval: true });
268
+ } else {
269
+ throw new Error("no worker");
270
+ }
271
+ worker.on("message", (data) => {
272
+ this.onMessage(data);
273
+ });
274
+ worker.on("error", (error) => {
275
+ this.onError(error);
276
+ });
277
+ worker.on("exit", (code) => {
278
+ });
279
+ return worker;
280
+ }
230
281
  };
231
282
 
232
283
  // ../worker-utils/src/lib/worker-farm/worker-pool.ts
@@ -247,6 +298,9 @@
247
298
  this.url = props.url;
248
299
  this.setProps(props);
249
300
  }
301
+ static isSupported() {
302
+ return WorkerThread.isSupported();
303
+ }
250
304
  destroy() {
251
305
  this.idleQueue.forEach((worker) => worker.destroy());
252
306
  this.isDestroyed = true;
@@ -336,9 +390,9 @@
336
390
  var DEFAULT_PROPS = {
337
391
  maxConcurrency: 3,
338
392
  maxMobileConcurrency: 1,
393
+ reuseWorkers: true,
339
394
  onDebug: () => {
340
- },
341
- reuseWorkers: true
395
+ }
342
396
  };
343
397
  var WorkerFarm = class {
344
398
  constructor(props) {
@@ -359,6 +413,7 @@
359
413
  for (const workerPool of this.workerPools.values()) {
360
414
  workerPool.destroy();
361
415
  }
416
+ this.workerPools = new Map();
362
417
  }
363
418
  setProps(props) {
364
419
  this.props = { ...this.props, ...props };
@@ -391,16 +446,33 @@
391
446
  };
392
447
 
393
448
  // ../worker-utils/src/lib/worker-farm/worker-body.ts
449
+ function getParentPort() {
450
+ let parentPort;
451
+ try {
452
+ eval("globalThis.parentPort = require('worker_threads').parentPort");
453
+ parentPort = globalThis.parentPort;
454
+ } catch {
455
+ }
456
+ return parentPort;
457
+ }
394
458
  var onMessageWrapperMap = new Map();
395
459
  var WorkerBody = class {
460
+ static inWorkerThread() {
461
+ return typeof self !== "undefined" || Boolean(getParentPort());
462
+ }
396
463
  static set onmessage(onMessage2) {
397
- self.onmessage = (message) => {
398
- if (!isKnownMessage(message)) {
399
- return;
400
- }
401
- const { type, payload } = message.data;
464
+ function handleMessage(message) {
465
+ const parentPort3 = getParentPort();
466
+ const { type, payload } = parentPort3 ? message : message.data;
402
467
  onMessage2(type, payload);
403
- };
468
+ }
469
+ const parentPort2 = getParentPort();
470
+ if (parentPort2) {
471
+ parentPort2.on("message", handleMessage);
472
+ parentPort2.on("exit", () => console.debug("Node worker closing"));
473
+ } else {
474
+ globalThis.onmessage = handleMessage;
475
+ }
404
476
  }
405
477
  static addEventListener(onMessage2) {
406
478
  let onMessageWrapper = onMessageWrapperMap.get(onMessage2);
@@ -409,22 +481,36 @@
409
481
  if (!isKnownMessage(message)) {
410
482
  return;
411
483
  }
412
- const { type, payload } = message.data;
484
+ const parentPort3 = getParentPort();
485
+ const { type, payload } = parentPort3 ? message : message.data;
413
486
  onMessage2(type, payload);
414
487
  };
415
488
  }
416
- self.addEventListener("message", onMessageWrapper);
489
+ const parentPort2 = getParentPort();
490
+ if (parentPort2) {
491
+ console.error("not implemented");
492
+ } else {
493
+ globalThis.addEventListener("message", onMessageWrapper);
494
+ }
417
495
  }
418
496
  static removeEventListener(onMessage2) {
419
497
  const onMessageWrapper = onMessageWrapperMap.get(onMessage2);
420
498
  onMessageWrapperMap.delete(onMessage2);
421
- self.removeEventListener("message", onMessageWrapper);
499
+ const parentPort2 = getParentPort();
500
+ if (parentPort2) {
501
+ console.error("not implemented");
502
+ } else {
503
+ globalThis.removeEventListener("message", onMessageWrapper);
504
+ }
422
505
  }
423
506
  static postMessage(type, payload) {
424
- if (self) {
425
- const data = { source: "loaders.gl", type, payload };
426
- const transferList = getTransferList(payload);
427
- self.postMessage(data, transferList);
507
+ const data = { source: "loaders.gl", type, payload };
508
+ const transferList = getTransferList(payload);
509
+ const parentPort2 = getParentPort();
510
+ if (parentPort2) {
511
+ parentPort2.postMessage(data, transferList);
512
+ } else {
513
+ globalThis.postMessage(data, transferList);
428
514
  }
429
515
  }
430
516
  };
@@ -439,6 +525,9 @@
439
525
  const workerOptions = options[worker.id] || {};
440
526
  const workerFile = `${worker.id}-worker.js`;
441
527
  let url = workerOptions.workerUrl;
528
+ if (!url && worker.id === "compression") {
529
+ url = options.workerUrl;
530
+ }
442
531
  if (options._workerType === "test") {
443
532
  url = `modules/${worker.module}/dist/${workerFile}`;
444
533
  }
@@ -465,6 +554,7 @@
465
554
  }
466
555
 
467
556
  // ../worker-utils/src/lib/library-utils/library-utils.ts
557
+ var node = __toModule(require_require_utils());
468
558
  var LATEST = "beta";
469
559
  var VERSION2 = typeof VERSION !== "undefined" ? VERSION : LATEST;
470
560
  var loadLibraryPromises = {};
@@ -501,7 +591,11 @@
501
591
  return await response2.arrayBuffer();
502
592
  }
503
593
  if (!isBrowser2) {
504
- return node.requireFromFile && await node.requireFromFile(libraryUrl);
594
+ try {
595
+ return node && node.requireFromFile && await node.requireFromFile(libraryUrl);
596
+ } catch {
597
+ return null;
598
+ }
505
599
  }
506
600
  if (isWorker) {
507
601
  return importScripts(libraryUrl);
@@ -532,19 +626,20 @@
532
626
  // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
533
627
  var requestId = 0;
534
628
  function createLoaderWorker(loader) {
535
- if (typeof self === "undefined") {
629
+ if (!WorkerBody.inWorkerThread()) {
536
630
  return;
537
631
  }
538
632
  WorkerBody.onmessage = async (type, payload) => {
539
633
  switch (type) {
540
634
  case "process":
541
635
  try {
542
- const { input, options = {} } = payload;
636
+ const { input, options = {}, context = {} } = payload;
543
637
  const result = await parseData({
544
638
  loader,
545
639
  arrayBuffer: input,
546
640
  options,
547
641
  context: {
642
+ ...context,
548
643
  parse: parseOnMainThread
549
644
  }
550
645
  });
@@ -559,7 +654,7 @@
559
654
  };
560
655
  }
561
656
  function parseOnMainThread(arrayBuffer, options) {
562
- return new Promise((resolve, reject) => {
657
+ return new Promise((resolve2, reject) => {
563
658
  const id = requestId++;
564
659
  const onMessage2 = (type, payload2) => {
565
660
  if (payload2.id !== id) {
@@ -568,7 +663,7 @@
568
663
  switch (type) {
569
664
  case "done":
570
665
  WorkerBody.removeEventListener(onMessage2);
571
- resolve(payload2.result);
666
+ resolve2(payload2.result);
572
667
  break;
573
668
  case "error":
574
669
  WorkerBody.removeEventListener(onMessage2);
@@ -608,6 +703,9 @@
608
703
  if (!WorkerFarm.isSupported()) {
609
704
  return false;
610
705
  }
706
+ if (!isBrowser2 && !options?._nodeWorkers) {
707
+ return false;
708
+ }
611
709
  return loader.worker && options?.worker;
612
710
  }
613
711
  async function parseWithWorker(loader, data, options, context, parseOnMainThread2) {
@@ -616,10 +714,12 @@
616
714
  const workerFarm = WorkerFarm.getWorkerFarm(options);
617
715
  const workerPool = workerFarm.getWorkerPool({ name, url });
618
716
  options = JSON.parse(JSON.stringify(options));
717
+ context = JSON.parse(JSON.stringify(context || {}));
619
718
  const job = await workerPool.startJob("process-on-worker", onMessage.bind(null, parseOnMainThread2));
620
719
  job.postMessage("process", {
621
720
  input: data,
622
- options
721
+ options,
722
+ context
623
723
  });
624
724
  const result = await job.result;
625
725
  return await result.result;
@@ -647,42 +747,7 @@
647
747
  }
648
748
  }
649
749
 
650
- // ../loader-utils/src/lib/binary-utils/buffer-utils.ts
651
- function isBuffer(value) {
652
- return value && typeof value === "object" && value.isBuffer;
653
- }
654
- function bufferToArrayBuffer(buffer) {
655
- if (isBuffer(buffer)) {
656
- const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
657
- return typedArray.slice().buffer;
658
- }
659
- return buffer;
660
- }
661
-
662
750
  // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
663
- function toArrayBuffer(data) {
664
- if (isBuffer(data)) {
665
- return bufferToArrayBuffer(data);
666
- }
667
- if (data instanceof ArrayBuffer) {
668
- return data;
669
- }
670
- if (ArrayBuffer.isView(data)) {
671
- if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
672
- return data.buffer;
673
- }
674
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
675
- }
676
- if (typeof data === "string") {
677
- const text = data;
678
- const uint8Array = new TextEncoder().encode(text);
679
- return uint8Array.buffer;
680
- }
681
- if (data && typeof data === "object" && data._toArrayBuffer) {
682
- return data._toArrayBuffer();
683
- }
684
- throw new Error("toArrayBuffer");
685
- }
686
751
  function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
687
752
  byteLength = byteLength || arrayBuffer1.byteLength;
688
753
  if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
@@ -718,6 +783,52 @@
718
783
  return concatenateArrayBuffers(...arrayBuffers);
719
784
  }
720
785
 
786
+ // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
787
+ function _typeof(obj) {
788
+ "@babel/helpers - typeof";
789
+ return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
790
+ return typeof obj2;
791
+ } : function(obj2) {
792
+ return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
793
+ }, _typeof(obj);
794
+ }
795
+
796
+ // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
797
+ function _toPrimitive(input, hint) {
798
+ if (_typeof(input) !== "object" || input === null)
799
+ return input;
800
+ var prim = input[Symbol.toPrimitive];
801
+ if (prim !== void 0) {
802
+ var res = prim.call(input, hint || "default");
803
+ if (_typeof(res) !== "object")
804
+ return res;
805
+ throw new TypeError("@@toPrimitive must return a primitive value.");
806
+ }
807
+ return (hint === "string" ? String : Number)(input);
808
+ }
809
+
810
+ // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
811
+ function _toPropertyKey(arg) {
812
+ var key = _toPrimitive(arg, "string");
813
+ return _typeof(key) === "symbol" ? key : String(key);
814
+ }
815
+
816
+ // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
817
+ function _defineProperty(obj, key, value) {
818
+ key = _toPropertyKey(key);
819
+ if (key in obj) {
820
+ Object.defineProperty(obj, key, {
821
+ value,
822
+ enumerable: true,
823
+ configurable: true,
824
+ writable: true
825
+ });
826
+ } else {
827
+ obj[key] = value;
828
+ }
829
+ return obj;
830
+ }
831
+
721
832
  // ../loader-utils/src/lib/path-utils/file-aliases.ts
722
833
  var pathPrefix = "";
723
834
  var fileAliases = {};
@@ -734,19 +845,64 @@
734
845
  return filename2;
735
846
  }
736
847
 
848
+ // ../loader-utils/src/lib/node/buffer.browser.ts
849
+ function toArrayBuffer(buffer) {
850
+ return buffer;
851
+ }
852
+
853
+ // ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
854
+ function isBuffer(value) {
855
+ return value && typeof value === "object" && value.isBuffer;
856
+ }
857
+ function toArrayBuffer2(data) {
858
+ if (isBuffer(data)) {
859
+ return toArrayBuffer(data);
860
+ }
861
+ if (data instanceof ArrayBuffer) {
862
+ return data;
863
+ }
864
+ if (ArrayBuffer.isView(data)) {
865
+ if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
866
+ return data.buffer;
867
+ }
868
+ return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
869
+ }
870
+ if (typeof data === "string") {
871
+ const text = data;
872
+ const uint8Array = new TextEncoder().encode(text);
873
+ return uint8Array.buffer;
874
+ }
875
+ if (data && typeof data === "object" && data._toArrayBuffer) {
876
+ return data._toArrayBuffer();
877
+ }
878
+ throw new Error("toArrayBuffer");
879
+ }
880
+
737
881
  // ../loader-utils/src/lib/path-utils/path.ts
738
882
  var path_exports = {};
739
883
  __export(path_exports, {
740
884
  dirname: () => dirname,
741
885
  filename: () => filename,
742
- join: () => join
886
+ join: () => join,
887
+ resolve: () => resolve
743
888
  });
889
+
890
+ // ../loader-utils/src/lib/path-utils/get-cwd.ts
891
+ function getCWD() {
892
+ if (typeof process !== "undefined" && typeof process.cwd !== "undefined") {
893
+ return process.cwd();
894
+ }
895
+ const pathname = window.location?.pathname;
896
+ return pathname?.slice(0, pathname.lastIndexOf("/") + 1) || "";
897
+ }
898
+
899
+ // ../loader-utils/src/lib/path-utils/path.ts
744
900
  function filename(url) {
745
- const slashIndex = url && url.lastIndexOf("/");
901
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
746
902
  return slashIndex >= 0 ? url.substr(slashIndex + 1) : "";
747
903
  }
748
904
  function dirname(url) {
749
- const slashIndex = url && url.lastIndexOf("/");
905
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
750
906
  return slashIndex >= 0 ? url.substr(0, slashIndex) : "";
751
907
  }
752
908
  function join(...parts) {
@@ -762,6 +918,108 @@
762
918
  });
763
919
  return parts.join(separator);
764
920
  }
921
+ function resolve(...components) {
922
+ const paths = [];
923
+ for (let _i = 0; _i < components.length; _i++) {
924
+ paths[_i] = components[_i];
925
+ }
926
+ let resolvedPath = "";
927
+ let resolvedAbsolute = false;
928
+ let cwd;
929
+ for (let i2 = paths.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) {
930
+ let path;
931
+ if (i2 >= 0) {
932
+ path = paths[i2];
933
+ } else {
934
+ if (cwd === void 0) {
935
+ cwd = getCWD();
936
+ }
937
+ path = cwd;
938
+ }
939
+ if (path.length === 0) {
940
+ continue;
941
+ }
942
+ resolvedPath = `${path}/${resolvedPath}`;
943
+ resolvedAbsolute = path.charCodeAt(0) === SLASH;
944
+ }
945
+ resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
946
+ if (resolvedAbsolute) {
947
+ return `/${resolvedPath}`;
948
+ } else if (resolvedPath.length > 0) {
949
+ return resolvedPath;
950
+ }
951
+ return ".";
952
+ }
953
+ var SLASH = 47;
954
+ var DOT = 46;
955
+ function normalizeStringPosix(path, allowAboveRoot) {
956
+ let res = "";
957
+ let lastSlash = -1;
958
+ let dots = 0;
959
+ let code;
960
+ let isAboveRoot = false;
961
+ for (let i2 = 0; i2 <= path.length; ++i2) {
962
+ if (i2 < path.length) {
963
+ code = path.charCodeAt(i2);
964
+ } else if (code === SLASH) {
965
+ break;
966
+ } else {
967
+ code = SLASH;
968
+ }
969
+ if (code === SLASH) {
970
+ if (lastSlash === i2 - 1 || dots === 1) {
971
+ } else if (lastSlash !== i2 - 1 && dots === 2) {
972
+ if (res.length < 2 || !isAboveRoot || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
973
+ if (res.length > 2) {
974
+ const start = res.length - 1;
975
+ let j = start;
976
+ for (; j >= 0; --j) {
977
+ if (res.charCodeAt(j) === SLASH) {
978
+ break;
979
+ }
980
+ }
981
+ if (j !== start) {
982
+ res = j === -1 ? "" : res.slice(0, j);
983
+ lastSlash = i2;
984
+ dots = 0;
985
+ isAboveRoot = false;
986
+ continue;
987
+ }
988
+ } else if (res.length === 2 || res.length === 1) {
989
+ res = "";
990
+ lastSlash = i2;
991
+ dots = 0;
992
+ isAboveRoot = false;
993
+ continue;
994
+ }
995
+ }
996
+ if (allowAboveRoot) {
997
+ if (res.length > 0) {
998
+ res += "/..";
999
+ } else {
1000
+ res = "..";
1001
+ }
1002
+ isAboveRoot = true;
1003
+ }
1004
+ } else {
1005
+ const slice = path.slice(lastSlash + 1, i2);
1006
+ if (res.length > 0) {
1007
+ res += `/${slice}`;
1008
+ } else {
1009
+ res = slice;
1010
+ }
1011
+ isAboveRoot = false;
1012
+ }
1013
+ lastSlash = i2;
1014
+ dots = 0;
1015
+ } else if (code === DOT && dots !== -1) {
1016
+ ++dots;
1017
+ } else {
1018
+ dots = -1;
1019
+ }
1020
+ }
1021
+ return res;
1022
+ }
765
1023
 
766
1024
  // ../core/src/javascript-utils/is-type.ts
767
1025
  var isBoolean = (x) => typeof x === "boolean";
@@ -885,7 +1143,7 @@
885
1143
  text += ` ${await response.text()}`;
886
1144
  }
887
1145
  message += text;
888
- message = message.length > 60 ? `${message.slice(60)}...` : message;
1146
+ message = message.length > 60 ? `${message.slice(0, 60)}...` : message;
889
1147
  } catch (error) {
890
1148
  }
891
1149
  return message;
@@ -897,9 +1155,9 @@
897
1155
  }
898
1156
  if (resource instanceof Blob) {
899
1157
  const blobSlice = resource.slice(0, 5);
900
- return await new Promise((resolve) => {
1158
+ return await new Promise((resolve2) => {
901
1159
  const reader = new FileReader();
902
- reader.onload = (event) => resolve(event?.target?.result);
1160
+ reader.onload = (event) => resolve2(event?.target?.result);
903
1161
  reader.readAsDataURL(blobSlice);
904
1162
  });
905
1163
  }
@@ -932,12 +1190,12 @@
932
1190
  return await makeResponse(url);
933
1191
  }
934
1192
 
935
- // ../../node_modules/probe.gl/dist/esm/env/is-electron.js
1193
+ // ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
936
1194
  function isElectron(mockUserAgent) {
937
1195
  if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
938
1196
  return true;
939
1197
  }
940
- if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions.electron)) {
1198
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
941
1199
  return true;
942
1200
  }
943
1201
  const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
@@ -948,31 +1206,25 @@
948
1206
  return false;
949
1207
  }
950
1208
 
951
- // ../../node_modules/probe.gl/dist/esm/env/is-browser.js
1209
+ // ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
952
1210
  function isBrowser3() {
953
1211
  const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
954
1212
  return !isNode || isElectron();
955
1213
  }
956
1214
 
957
- // ../../node_modules/probe.gl/dist/esm/env/globals.js
958
- var globals3 = {
959
- self: typeof self !== "undefined" && self,
960
- window: typeof window !== "undefined" && window,
961
- global: typeof global !== "undefined" && global,
962
- document: typeof document !== "undefined" && document,
963
- process: typeof process === "object" && process
964
- };
965
- var self_3 = globals3.self || globals3.window || globals3.global;
966
- var window_3 = globals3.window || globals3.self || globals3.global;
967
- var global_3 = globals3.global || globals3.self || globals3.window;
968
- var document_3 = globals3.document || {};
969
- var process_ = globals3.process || {};
970
-
971
- // ../../node_modules/probe.gl/dist/esm/utils/globals.js
972
- var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
1215
+ // ../../node_modules/@probe.gl/env/dist/lib/globals.js
1216
+ var self_3 = globalThis.self || globalThis.window || globalThis.global;
1217
+ var window_3 = globalThis.window || globalThis.self || globalThis.global;
1218
+ var document_3 = globalThis.document || {};
1219
+ var process_ = globalThis.process || {};
1220
+ var console_ = globalThis.console;
1221
+ var navigator_ = globalThis.navigator || {};
1222
+
1223
+ // ../../node_modules/@probe.gl/env/dist/utils/globals.js
1224
+ var VERSION3 = true ? "4.0.0-alpha.6" : "untranspiled source";
973
1225
  var isBrowser4 = isBrowser3();
974
1226
 
975
- // ../../node_modules/probe.gl/dist/esm/utils/local-storage.js
1227
+ // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
976
1228
  function getStorage(type) {
977
1229
  try {
978
1230
  const storage = window[type];
@@ -985,27 +1237,25 @@
985
1237
  }
986
1238
  }
987
1239
  var LocalStorage = class {
988
- constructor(id, defaultSettings, type = "sessionStorage") {
1240
+ constructor(id, defaultConfig) {
1241
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
1242
+ _defineProperty(this, "storage", void 0);
1243
+ _defineProperty(this, "id", void 0);
1244
+ _defineProperty(this, "config", void 0);
989
1245
  this.storage = getStorage(type);
990
1246
  this.id = id;
991
- this.config = {};
992
- Object.assign(this.config, defaultSettings);
1247
+ this.config = defaultConfig;
993
1248
  this._loadConfiguration();
994
1249
  }
995
1250
  getConfiguration() {
996
1251
  return this.config;
997
1252
  }
998
1253
  setConfiguration(configuration) {
999
- this.config = {};
1000
- return this.updateConfiguration(configuration);
1001
- }
1002
- updateConfiguration(configuration) {
1003
1254
  Object.assign(this.config, configuration);
1004
1255
  if (this.storage) {
1005
1256
  const serialized = JSON.stringify(this.config);
1006
1257
  this.storage.setItem(this.id, serialized);
1007
1258
  }
1008
- return this;
1009
1259
  }
1010
1260
  _loadConfiguration() {
1011
1261
  let configuration = {};
@@ -1018,7 +1268,7 @@
1018
1268
  }
1019
1269
  };
1020
1270
 
1021
- // ../../node_modules/probe.gl/dist/esm/utils/formatters.js
1271
+ // ../../node_modules/@probe.gl/log/dist/utils/formatters.js
1022
1272
  function formatTime(ms) {
1023
1273
  let formatted;
1024
1274
  if (ms < 10) {
@@ -1032,11 +1282,13 @@
1032
1282
  }
1033
1283
  return formatted;
1034
1284
  }
1035
- function leftPad(string, length2 = 8) {
1285
+ function leftPad(string) {
1286
+ let length2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
1036
1287
  const padLength = Math.max(length2 - string.length, 0);
1037
1288
  return "".concat(" ".repeat(padLength)).concat(string);
1038
1289
  }
1039
- function formatImage(image, message, scale2, maxWidth = 600) {
1290
+ function formatImage(image, message, scale2) {
1291
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
1040
1292
  const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
1041
1293
  if (image.width > maxWidth) {
1042
1294
  scale2 = Math.min(scale2, maxWidth / image.width);
@@ -1047,69 +1299,80 @@
1047
1299
  return ["".concat(message, " %c+"), style];
1048
1300
  }
1049
1301
 
1050
- // ../../node_modules/probe.gl/dist/esm/utils/color.js
1051
- var COLOR = {
1052
- BLACK: 30,
1053
- RED: 31,
1054
- GREEN: 32,
1055
- YELLOW: 33,
1056
- BLUE: 34,
1057
- MAGENTA: 35,
1058
- CYAN: 36,
1059
- WHITE: 37,
1060
- BRIGHT_BLACK: 90,
1061
- BRIGHT_RED: 91,
1062
- BRIGHT_GREEN: 92,
1063
- BRIGHT_YELLOW: 93,
1064
- BRIGHT_BLUE: 94,
1065
- BRIGHT_MAGENTA: 95,
1066
- BRIGHT_CYAN: 96,
1067
- BRIGHT_WHITE: 97
1068
- };
1302
+ // ../../node_modules/@probe.gl/log/dist/utils/color.js
1303
+ var COLOR;
1304
+ (function(COLOR2) {
1305
+ COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
1306
+ COLOR2[COLOR2["RED"] = 31] = "RED";
1307
+ COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
1308
+ COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
1309
+ COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
1310
+ COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
1311
+ COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
1312
+ COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
1313
+ COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
1314
+ COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
1315
+ COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
1316
+ COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
1317
+ COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
1318
+ COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
1319
+ COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
1320
+ COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
1321
+ })(COLOR || (COLOR = {}));
1322
+ var BACKGROUND_INCREMENT = 10;
1069
1323
  function getColor(color) {
1070
- return typeof color === "string" ? COLOR[color.toUpperCase()] || COLOR.WHITE : color;
1324
+ if (typeof color !== "string") {
1325
+ return color;
1326
+ }
1327
+ color = color.toUpperCase();
1328
+ return COLOR[color] || COLOR.WHITE;
1071
1329
  }
1072
1330
  function addColor(string, color, background) {
1073
- if (!isBrowser4 && typeof string === "string") {
1331
+ if (!isBrowser3 && typeof string === "string") {
1074
1332
  if (color) {
1075
- color = getColor(color);
1076
- string = "[".concat(color, "m").concat(string, "");
1333
+ const colorCode = getColor(color);
1334
+ string = "[".concat(colorCode, "m").concat(string, "");
1077
1335
  }
1078
1336
  if (background) {
1079
- color = getColor(background);
1080
- string = "[".concat(background + 10, "m").concat(string, "");
1337
+ const colorCode = getColor(background);
1338
+ string = "[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "");
1081
1339
  }
1082
1340
  }
1083
1341
  return string;
1084
1342
  }
1085
1343
 
1086
- // ../../node_modules/probe.gl/dist/esm/utils/autobind.js
1087
- function autobind(obj, predefined = ["constructor"]) {
1344
+ // ../../node_modules/@probe.gl/log/dist/utils/autobind.js
1345
+ function autobind(obj) {
1346
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
1088
1347
  const proto = Object.getPrototypeOf(obj);
1089
1348
  const propNames = Object.getOwnPropertyNames(proto);
1349
+ const object = obj;
1090
1350
  for (const key of propNames) {
1091
- if (typeof obj[key] === "function") {
1351
+ const value = object[key];
1352
+ if (typeof value === "function") {
1092
1353
  if (!predefined.find((name) => key === name)) {
1093
- obj[key] = obj[key].bind(obj);
1354
+ object[key] = value.bind(obj);
1094
1355
  }
1095
1356
  }
1096
1357
  }
1097
1358
  }
1098
1359
 
1099
- // ../../node_modules/probe.gl/dist/esm/utils/assert.js
1360
+ // ../../node_modules/@probe.gl/log/dist/utils/assert.js
1100
1361
  function assert3(condition, message) {
1101
1362
  if (!condition) {
1102
1363
  throw new Error(message || "Assertion failed");
1103
1364
  }
1104
1365
  }
1105
1366
 
1106
- // ../../node_modules/probe.gl/dist/esm/utils/hi-res-timestamp.js
1107
- function getHiResTimestamp2() {
1367
+ // ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
1368
+ function getHiResTimestamp() {
1108
1369
  let timestamp;
1109
- if (isBrowser4 && window_3.performance) {
1110
- timestamp = window_3.performance.now();
1111
- } else if (process_.hrtime) {
1112
- const timeParts = process_.hrtime();
1370
+ if (isBrowser3() && window_3.performance) {
1371
+ var _window$performance, _window$performance$n;
1372
+ timestamp = window_3 === null || window_3 === void 0 ? void 0 : (_window$performance = window_3.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);
1373
+ } else if ("hrtime" in process_) {
1374
+ var _process$hrtime;
1375
+ const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
1113
1376
  timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
1114
1377
  } else {
1115
1378
  timestamp = Date.now();
@@ -1117,15 +1380,15 @@
1117
1380
  return timestamp;
1118
1381
  }
1119
1382
 
1120
- // ../../node_modules/probe.gl/dist/esm/lib/log.js
1383
+ // ../../node_modules/@probe.gl/log/dist/log.js
1121
1384
  var originalConsole = {
1122
- debug: isBrowser4 ? console.debug || console.log : console.log,
1385
+ debug: isBrowser3() ? console.debug || console.log : console.log,
1123
1386
  log: console.log,
1124
1387
  info: console.info,
1125
1388
  warn: console.warn,
1126
1389
  error: console.error
1127
1390
  };
1128
- var DEFAULT_SETTINGS = {
1391
+ var DEFAULT_LOG_CONFIGURATION = {
1129
1392
  enabled: true,
1130
1393
  level: 0
1131
1394
  };
@@ -1135,27 +1398,23 @@
1135
1398
  var ONCE = {
1136
1399
  once: true
1137
1400
  };
1138
- function getTableHeader(table) {
1139
- for (const key in table) {
1140
- for (const title in table[key]) {
1141
- return title || "untitled";
1142
- }
1143
- }
1144
- return "empty";
1145
- }
1146
1401
  var Log = class {
1147
- constructor({
1148
- id
1149
- } = {
1150
- id: ""
1151
- }) {
1402
+ constructor() {
1403
+ let {
1404
+ id
1405
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
1406
+ id: ""
1407
+ };
1408
+ _defineProperty(this, "id", void 0);
1409
+ _defineProperty(this, "VERSION", VERSION3);
1410
+ _defineProperty(this, "_startTs", getHiResTimestamp());
1411
+ _defineProperty(this, "_deltaTs", getHiResTimestamp());
1412
+ _defineProperty(this, "_storage", void 0);
1413
+ _defineProperty(this, "userData", {});
1414
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
1152
1415
  this.id = id;
1153
- this.VERSION = VERSION3;
1154
- this._startTs = getHiResTimestamp2();
1155
- this._deltaTs = getHiResTimestamp2();
1156
- this.LOG_THROTTLE_TIMEOUT = 0;
1157
- this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS);
1158
1416
  this.userData = {};
1417
+ this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
1159
1418
  this.timeStamp("".concat(this.id, " started"));
1160
1419
  autobind(this);
1161
1420
  Object.seal(this);
@@ -1173,10 +1432,10 @@
1173
1432
  return this._storage.config.level;
1174
1433
  }
1175
1434
  getTotal() {
1176
- return Number((getHiResTimestamp2() - this._startTs).toPrecision(10));
1435
+ return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
1177
1436
  }
1178
1437
  getDelta() {
1179
- return Number((getHiResTimestamp2() - this._deltaTs).toPrecision(10));
1438
+ return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
1180
1439
  }
1181
1440
  set priority(newPriority) {
1182
1441
  this.level = newPriority;
@@ -1187,18 +1446,34 @@
1187
1446
  getPriority() {
1188
1447
  return this.level;
1189
1448
  }
1190
- enable(enabled = true) {
1191
- this._storage.updateConfiguration({
1449
+ enable() {
1450
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
1451
+ this._storage.setConfiguration({
1192
1452
  enabled
1193
1453
  });
1194
1454
  return this;
1195
1455
  }
1196
1456
  setLevel(level) {
1197
- this._storage.updateConfiguration({
1457
+ this._storage.setConfiguration({
1198
1458
  level
1199
1459
  });
1200
1460
  return this;
1201
1461
  }
1462
+ get(setting) {
1463
+ return this._storage.config[setting];
1464
+ }
1465
+ set(setting, value) {
1466
+ this._storage.setConfiguration({
1467
+ [setting]: value
1468
+ });
1469
+ }
1470
+ settings() {
1471
+ if (console.table) {
1472
+ console.table(this._storage.config);
1473
+ } else {
1474
+ console.log(this._storage.config);
1475
+ }
1476
+ }
1202
1477
  assert(condition, message) {
1203
1478
  assert3(condition, message);
1204
1479
  }
@@ -1237,17 +1512,18 @@
1237
1512
  }
1238
1513
  return noop;
1239
1514
  }
1240
- image({
1241
- logLevel,
1242
- priority,
1243
- image,
1244
- message = "",
1245
- scale: scale2 = 1
1246
- }) {
1515
+ image(_ref) {
1516
+ let {
1517
+ logLevel,
1518
+ priority,
1519
+ image,
1520
+ message = "",
1521
+ scale: scale2 = 1
1522
+ } = _ref;
1247
1523
  if (!this._shouldLog(logLevel || priority)) {
1248
1524
  return noop;
1249
1525
  }
1250
- return isBrowser4 ? logImageInBrowser({
1526
+ return isBrowser3() ? logImageInBrowser({
1251
1527
  image,
1252
1528
  message,
1253
1529
  scale: scale2
@@ -1257,21 +1533,6 @@
1257
1533
  scale: scale2
1258
1534
  });
1259
1535
  }
1260
- settings() {
1261
- if (console.table) {
1262
- console.table(this._storage.config);
1263
- } else {
1264
- console.log(this._storage.config);
1265
- }
1266
- }
1267
- get(setting) {
1268
- return this._storage.config[setting];
1269
- }
1270
- set(setting, value) {
1271
- this._storage.updateConfiguration({
1272
- [setting]: value
1273
- });
1274
- }
1275
1536
  time(logLevel, message) {
1276
1537
  return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
1277
1538
  }
@@ -1281,10 +1542,11 @@
1281
1542
  timeStamp(logLevel, message) {
1282
1543
  return this._getLogFunction(logLevel, message, console.timeStamp || noop);
1283
1544
  }
1284
- group(logLevel, message, opts = {
1285
- collapsed: false
1286
- }) {
1287
- opts = normalizeArguments({
1545
+ group(logLevel, message) {
1546
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
1547
+ collapsed: false
1548
+ };
1549
+ const options = normalizeArguments({
1288
1550
  logLevel,
1289
1551
  message,
1290
1552
  opts
@@ -1292,10 +1554,11 @@
1292
1554
  const {
1293
1555
  collapsed
1294
1556
  } = opts;
1295
- opts.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
1296
- return this._getLogFunction(opts);
1557
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
1558
+ return this._getLogFunction(options);
1297
1559
  }
1298
- groupCollapsed(logLevel, message, opts = {}) {
1560
+ groupCollapsed(logLevel, message) {
1561
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1299
1562
  return this.group(logLevel, message, Object.assign({}, opts, {
1300
1563
  collapsed: true
1301
1564
  }));
@@ -1319,7 +1582,7 @@
1319
1582
  _shouldLog(logLevel) {
1320
1583
  return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
1321
1584
  }
1322
- _getLogFunction(logLevel, message, method, args = [], opts) {
1585
+ _getLogFunction(logLevel, message, method, args, opts) {
1323
1586
  if (this._shouldLog(logLevel)) {
1324
1587
  opts = normalizeArguments({
1325
1588
  logLevel,
@@ -1331,11 +1594,11 @@
1331
1594
  assert3(method);
1332
1595
  opts.total = this.getTotal();
1333
1596
  opts.delta = this.getDelta();
1334
- this._deltaTs = getHiResTimestamp2();
1597
+ this._deltaTs = getHiResTimestamp();
1335
1598
  const tag = opts.tag || opts.message;
1336
- if (opts.once) {
1599
+ if (opts.once && tag) {
1337
1600
  if (!cache[tag]) {
1338
- cache[tag] = getHiResTimestamp2();
1601
+ cache[tag] = getHiResTimestamp();
1339
1602
  } else {
1340
1603
  return noop;
1341
1604
  }
@@ -1346,7 +1609,7 @@
1346
1609
  return noop;
1347
1610
  }
1348
1611
  };
1349
- Log.VERSION = VERSION3;
1612
+ _defineProperty(Log, "VERSION", VERSION3);
1350
1613
  function normalizeLogLevel(logLevel) {
1351
1614
  if (!logLevel) {
1352
1615
  return 0;
@@ -1374,7 +1637,6 @@
1374
1637
  const args = opts.args ? Array.from(opts.args) : [];
1375
1638
  while (args.length && args.shift() !== message) {
1376
1639
  }
1377
- opts.args = args;
1378
1640
  switch (typeof logLevel) {
1379
1641
  case "string":
1380
1642
  case "function":
@@ -1393,7 +1655,9 @@
1393
1655
  }
1394
1656
  const messageType = typeof opts.message;
1395
1657
  assert3(messageType === "string" || messageType === "object");
1396
- return Object.assign(opts, opts.opts);
1658
+ return Object.assign(opts, {
1659
+ args
1660
+ }, opts.opts);
1397
1661
  }
1398
1662
  function decorateMessage(id, message, opts) {
1399
1663
  if (typeof message === "string") {
@@ -1403,29 +1667,21 @@
1403
1667
  }
1404
1668
  return message;
1405
1669
  }
1406
- function logImageInNode({
1407
- image,
1408
- message = "",
1409
- scale: scale2 = 1
1410
- }) {
1411
- let asciify = null;
1412
- try {
1413
- asciify = module.require("asciify-image");
1414
- } catch (error) {
1415
- }
1416
- if (asciify) {
1417
- return () => asciify(image, {
1418
- fit: "box",
1419
- width: "".concat(Math.round(80 * scale2), "%")
1420
- }).then((data) => console.log(data));
1421
- }
1670
+ function logImageInNode(_ref2) {
1671
+ let {
1672
+ image,
1673
+ message = "",
1674
+ scale: scale2 = 1
1675
+ } = _ref2;
1676
+ console.warn("removed");
1422
1677
  return noop;
1423
1678
  }
1424
- function logImageInBrowser({
1425
- image,
1426
- message = "",
1427
- scale: scale2 = 1
1428
- }) {
1679
+ function logImageInBrowser(_ref3) {
1680
+ let {
1681
+ image,
1682
+ message = "",
1683
+ scale: scale2 = 1
1684
+ } = _ref3;
1429
1685
  if (typeof image === "string") {
1430
1686
  const img = new Image();
1431
1687
  img.onload = () => {
@@ -1448,10 +1704,18 @@
1448
1704
  }
1449
1705
  return noop;
1450
1706
  }
1707
+ function getTableHeader(table) {
1708
+ for (const key in table) {
1709
+ for (const title in table[key]) {
1710
+ return title || "untitled";
1711
+ }
1712
+ }
1713
+ return "empty";
1714
+ }
1451
1715
 
1452
- // ../../node_modules/probe.gl/dist/esm/index.js
1453
- var esm_default = new Log({
1454
- id: "probe.gl"
1716
+ // ../../node_modules/@probe.gl/log/dist/index.js
1717
+ var dist_default = new Log({
1718
+ id: "@probe.gl/log"
1455
1719
  });
1456
1720
 
1457
1721
  // ../core/src/lib/loader-utils/loggers.ts
@@ -1502,7 +1766,8 @@
1502
1766
  worker: true,
1503
1767
  maxConcurrency: 3,
1504
1768
  maxMobileConcurrency: 1,
1505
- reuseWorkers: true,
1769
+ reuseWorkers: isBrowser,
1770
+ _nodeWorkers: false,
1506
1771
  _workerType: "",
1507
1772
  limit: 0,
1508
1773
  _limitMB: 0,
@@ -1547,20 +1812,6 @@
1547
1812
  validateOptions(options, loaders);
1548
1813
  return normalizeOptionsInternal(loader, options, url);
1549
1814
  }
1550
- function getFetchFunction(options, context) {
1551
- const globalOptions = getGlobalLoaderOptions();
1552
- const fetchOptions = options || globalOptions;
1553
- if (typeof fetchOptions.fetch === "function") {
1554
- return fetchOptions.fetch;
1555
- }
1556
- if (isObject(fetchOptions.fetch)) {
1557
- return (url) => fetchFile(url, fetchOptions);
1558
- }
1559
- if (context?.fetch) {
1560
- return context?.fetch;
1561
- }
1562
- return fetchFile;
1563
- }
1564
1815
  function validateOptions(options, loaders) {
1565
1816
  validateOptionsObject(options, null, DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS, loaders);
1566
1817
  for (const loader of loaders) {
@@ -1678,6 +1929,9 @@
1678
1929
  return getGlobalLoaderRegistry();
1679
1930
  }
1680
1931
 
1932
+ // ../core/src/lib/utils/log.ts
1933
+ var log = new Log({ id: "loaders.gl" });
1934
+
1681
1935
  // ../core/src/lib/api/select-loader.ts
1682
1936
  var EXT_PATTERN = /\.([^.]+)$/;
1683
1937
  async function selectLoader(data, loaders = [], options, context) {
@@ -1722,13 +1976,22 @@
1722
1976
  const { url, type } = getResourceUrlAndType(data);
1723
1977
  const testUrl = url || context?.url;
1724
1978
  let loader = null;
1979
+ let reason = "";
1725
1980
  if (options?.mimeType) {
1726
1981
  loader = findLoaderByMIMEType(loaders, options?.mimeType);
1982
+ reason = `match forced by supplied MIME type ${options?.mimeType}`;
1727
1983
  }
1728
1984
  loader = loader || findLoaderByUrl(loaders, testUrl);
1985
+ reason = reason || (loader ? `matched url ${testUrl}` : "");
1729
1986
  loader = loader || findLoaderByMIMEType(loaders, type);
1987
+ reason = reason || (loader ? `matched MIME type ${type}` : "");
1730
1988
  loader = loader || findLoaderByInitialBytes(loaders, data);
1989
+ reason = reason || (loader ? `matched initial data ${getFirstCharacters(data)}` : "");
1731
1990
  loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
1991
+ reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
1992
+ if (reason) {
1993
+ log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
1994
+ }
1732
1995
  return loader;
1733
1996
  }
1734
1997
  function validHTTPResponse(data) {
@@ -1911,7 +2174,7 @@
1911
2174
  if (done) {
1912
2175
  return;
1913
2176
  }
1914
- yield toArrayBuffer(value);
2177
+ yield toArrayBuffer2(value);
1915
2178
  }
1916
2179
  } catch (error) {
1917
2180
  reader.releaseLock();
@@ -1919,7 +2182,7 @@
1919
2182
  }
1920
2183
  async function* makeNodeStreamIterator(stream, options) {
1921
2184
  for await (const chunk of stream) {
1922
- yield toArrayBuffer(chunk);
2185
+ yield toArrayBuffer2(chunk);
1923
2186
  }
1924
2187
  }
1925
2188
 
@@ -1997,6 +2260,22 @@
1997
2260
  throw new Error(ERR_DATA);
1998
2261
  }
1999
2262
 
2263
+ // ../core/src/lib/loader-utils/get-fetch-function.ts
2264
+ function getFetchFunction(options, context) {
2265
+ const globalOptions = getGlobalLoaderOptions();
2266
+ const fetchOptions = options || globalOptions;
2267
+ if (typeof fetchOptions.fetch === "function") {
2268
+ return fetchOptions.fetch;
2269
+ }
2270
+ if (isObject(fetchOptions.fetch)) {
2271
+ return (url) => fetchFile(url, fetchOptions);
2272
+ }
2273
+ if (context?.fetch) {
2274
+ return context?.fetch;
2275
+ }
2276
+ return fetchFile;
2277
+ }
2278
+
2000
2279
  // ../core/src/lib/loader-utils/loader-context.ts
2001
2280
  function getLoaderContext(context, options, previousContext = null) {
2002
2281
  if (previousContext) {
@@ -2049,6 +2328,12 @@
2049
2328
  }
2050
2329
  async function parseWithLoader(loader, data, options, context) {
2051
2330
  validateWorkerVersion(loader);
2331
+ if (isResponse(data)) {
2332
+ const response = data;
2333
+ const { ok, redirected, status, statusText, type, url } = response;
2334
+ const headers = Object.fromEntries(response.headers.entries());
2335
+ context.response = { headers, ok, redirected, status, statusText, type, url };
2336
+ }
2052
2337
  data = await getArrayBufferOrStringFromData(data, loader, options);
2053
2338
  if (loader.parseTextSync && typeof data === "string") {
2054
2339
  options.dataType = "text";
@@ -2069,12 +2354,17 @@
2069
2354
 
2070
2355
  // ../core/src/lib/api/load.ts
2071
2356
  async function load(url, loaders, options, context) {
2357
+ let resolvedLoaders;
2358
+ let resolvedOptions;
2072
2359
  if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
2360
+ resolvedLoaders = [];
2361
+ resolvedOptions = loaders;
2073
2362
  context = void 0;
2074
- options = loaders;
2075
- loaders = void 0;
2363
+ } else {
2364
+ resolvedLoaders = loaders;
2365
+ resolvedOptions = options;
2076
2366
  }
2077
- const fetch2 = getFetchFunction(options);
2367
+ const fetch2 = getFetchFunction(resolvedOptions);
2078
2368
  let data = url;
2079
2369
  if (typeof url === "string") {
2080
2370
  data = await fetch2(url);
@@ -2082,7 +2372,7 @@
2082
2372
  if (isBlob(url)) {
2083
2373
  data = await fetch2(url);
2084
2374
  }
2085
- return await parse(data, loaders, options);
2375
+ return Array.isArray(resolvedLoaders) ? await parse(data, resolvedLoaders, resolvedOptions) : await parse(data, resolvedLoaders, resolvedOptions);
2086
2376
  }
2087
2377
 
2088
2378
  // ../../node_modules/@math.gl/core/dist/esm/lib/assert.js
@@ -2095,18 +2385,16 @@
2095
2385
  // ../../node_modules/@math.gl/core/dist/esm/lib/common.js
2096
2386
  var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
2097
2387
  var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
2098
- var config = {};
2099
- config.EPSILON = 1e-12;
2100
- config.debug = false;
2101
- config.precision = 4;
2102
- config.printTypes = false;
2103
- config.printDegrees = false;
2104
- config.printRowMajor = true;
2105
- function round(value) {
2106
- return Math.round(value / config.EPSILON) * config.EPSILON;
2107
- }
2388
+ var config = {
2389
+ EPSILON: 1e-12,
2390
+ debug: false,
2391
+ precision: 4,
2392
+ printTypes: false,
2393
+ printDegrees: false,
2394
+ printRowMajor: true
2395
+ };
2108
2396
  function formatValue(value, {
2109
- precision = config.precision || 4
2397
+ precision = config.precision
2110
2398
  } = {}) {
2111
2399
  value = round(value);
2112
2400
  return "".concat(parseFloat(value.toPrecision(precision)));
@@ -2114,19 +2402,6 @@
2114
2402
  function isArray(value) {
2115
2403
  return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
2116
2404
  }
2117
- function duplicateArray(array) {
2118
- return array.clone ? array.clone() : new Array(array.length);
2119
- }
2120
- function map(value, func, result) {
2121
- if (isArray(value)) {
2122
- result = result || duplicateArray(value);
2123
- for (let i2 = 0; i2 < result.length && i2 < value.length; ++i2) {
2124
- result[i2] = func(value[i2], i2, result);
2125
- }
2126
- return result;
2127
- }
2128
- return func(value);
2129
- }
2130
2405
  function toRadians(degrees2) {
2131
2406
  return radians(degrees2);
2132
2407
  }
@@ -2165,7 +2440,7 @@
2165
2440
  if (b && b.equals) {
2166
2441
  return b.equals(a2);
2167
2442
  }
2168
- if (Number.isFinite(a2) && Number.isFinite(b)) {
2443
+ if (typeof a2 === "number" && typeof b === "number") {
2169
2444
  return Math.abs(a2 - b) <= config.EPSILON * Math.max(1, Math.abs(a2), Math.abs(b));
2170
2445
  }
2171
2446
  return false;
@@ -2173,6 +2448,23 @@
2173
2448
  config.EPSILON = oldEpsilon;
2174
2449
  }
2175
2450
  }
2451
+ function round(value) {
2452
+ return Math.round(value / config.EPSILON) * config.EPSILON;
2453
+ }
2454
+ function duplicateArray(array) {
2455
+ return array.clone ? array.clone() : new Array(array.length);
2456
+ }
2457
+ function map(value, func, result) {
2458
+ if (isArray(value)) {
2459
+ const array = value;
2460
+ result = result || duplicateArray(array);
2461
+ for (let i2 = 0; i2 < result.length && i2 < array.length; ++i2) {
2462
+ result[i2] = func(value[i2], i2, result);
2463
+ }
2464
+ return result;
2465
+ }
2466
+ return func(value);
2467
+ }
2176
2468
 
2177
2469
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js
2178
2470
  function _extendableBuiltin(cls) {
@@ -2197,22 +2489,24 @@
2197
2489
  return ExtendableBuiltin;
2198
2490
  }
2199
2491
  var MathArray = class extends _extendableBuiltin(Array) {
2200
- get ELEMENTS() {
2201
- assert4(false);
2202
- return 0;
2203
- }
2204
2492
  clone() {
2205
2493
  return new this.constructor().copy(this);
2206
2494
  }
2207
- from(arrayOrObject) {
2208
- return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
2209
- }
2210
2495
  fromArray(array, offset = 0) {
2211
2496
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2212
2497
  this[i2] = array[i2 + offset];
2213
2498
  }
2214
2499
  return this.check();
2215
2500
  }
2501
+ toArray(targetArray = [], offset = 0) {
2502
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2503
+ targetArray[offset + i2] = this[i2];
2504
+ }
2505
+ return targetArray;
2506
+ }
2507
+ from(arrayOrObject) {
2508
+ return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
2509
+ }
2216
2510
  to(arrayOrObject) {
2217
2511
  if (arrayOrObject === this) {
2218
2512
  return this;
@@ -2222,12 +2516,6 @@
2222
2516
  toTarget(target) {
2223
2517
  return target ? this.to(target) : this;
2224
2518
  }
2225
- toArray(array = [], offset = 0) {
2226
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2227
- array[offset + i2] = this[i2];
2228
- }
2229
- return array;
2230
- }
2231
2519
  toFloat32Array() {
2232
2520
  return new Float32Array(this);
2233
2521
  }
@@ -2271,9 +2559,7 @@
2271
2559
  }
2272
2560
  lerp(a2, b, t2) {
2273
2561
  if (t2 === void 0) {
2274
- t2 = b;
2275
- b = a2;
2276
- a2 = this;
2562
+ return this.lerp(this, a2, b);
2277
2563
  }
2278
2564
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2279
2565
  const ai = a2[i2];
@@ -2316,14 +2602,36 @@
2316
2602
  return this.check();
2317
2603
  }
2318
2604
  scale(scale2) {
2319
- if (Array.isArray(scale2)) {
2320
- return this.multiply(scale2);
2605
+ if (typeof scale2 === "number") {
2606
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2607
+ this[i2] *= scale2;
2608
+ }
2609
+ } else {
2610
+ for (let i2 = 0; i2 < this.ELEMENTS && i2 < scale2.length; ++i2) {
2611
+ this[i2] *= scale2[i2];
2612
+ }
2321
2613
  }
2614
+ return this.check();
2615
+ }
2616
+ multiplyByScalar(scalar) {
2322
2617
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2323
- this[i2] *= scale2;
2618
+ this[i2] *= scalar;
2324
2619
  }
2325
2620
  return this.check();
2326
2621
  }
2622
+ check() {
2623
+ if (config.debug && !this.validate()) {
2624
+ throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
2625
+ }
2626
+ return this;
2627
+ }
2628
+ validate() {
2629
+ let valid = this.length === this.ELEMENTS;
2630
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2631
+ valid = valid && Number.isFinite(this[i2]);
2632
+ }
2633
+ return valid;
2634
+ }
2327
2635
  sub(a2) {
2328
2636
  return this.subtract(a2);
2329
2637
  }
@@ -2349,7 +2657,7 @@
2349
2657
  return this.check();
2350
2658
  }
2351
2659
  divideScalar(a2) {
2352
- return this.scale(1 / a2);
2660
+ return this.multiplyByScalar(1 / a2);
2353
2661
  }
2354
2662
  clampScalar(min, max) {
2355
2663
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
@@ -2357,25 +2665,9 @@
2357
2665
  }
2358
2666
  return this.check();
2359
2667
  }
2360
- multiplyByScalar(scalar) {
2361
- return this.scale(scalar);
2362
- }
2363
2668
  get elements() {
2364
2669
  return this;
2365
2670
  }
2366
- check() {
2367
- if (config.debug && !this.validate()) {
2368
- throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
2369
- }
2370
- return this;
2371
- }
2372
- validate() {
2373
- let valid = this.length === this.ELEMENTS;
2374
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2375
- valid = valid && Number.isFinite(this[i2]);
2376
- }
2377
- return valid;
2378
- }
2379
2671
  };
2380
2672
 
2381
2673
  // ../../node_modules/@math.gl/core/dist/esm/lib/validators.js
@@ -2402,24 +2694,9 @@
2402
2694
  }
2403
2695
  return v;
2404
2696
  }
2405
- var map2 = {};
2406
- function deprecated(method, version) {
2407
- if (!map2[method]) {
2408
- map2[method] = true;
2409
- console.warn("".concat(method, " has been removed in version ").concat(version, ", see upgrade guide for more information"));
2410
- }
2411
- }
2412
2697
 
2413
2698
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js
2414
2699
  var Vector = class extends MathArray {
2415
- get ELEMENTS() {
2416
- assert4(false);
2417
- return 0;
2418
- }
2419
- copy(vector) {
2420
- assert4(false);
2421
- return this;
2422
- }
2423
2700
  get x() {
2424
2701
  return this[0];
2425
2702
  }
@@ -2739,10 +3016,14 @@
2739
3016
 
2740
3017
  // ../../node_modules/@math.gl/core/dist/esm/classes/vector3.js
2741
3018
  var ORIGIN = [0, 0, 0];
2742
- var constants = {};
3019
+ var ZERO;
2743
3020
  var Vector3 = class extends Vector {
2744
3021
  static get ZERO() {
2745
- return constants.ZERO = constants.ZERO || Object.freeze(new Vector3(0, 0, 0, 0));
3022
+ if (!ZERO) {
3023
+ ZERO = new Vector3(0, 0, 0);
3024
+ Object.freeze(ZERO);
3025
+ }
3026
+ return ZERO;
2746
3027
  }
2747
3028
  constructor(x = 0, y = 0, z = 0) {
2748
3029
  super(-0, -0, -0);
@@ -2852,14 +3133,6 @@
2852
3133
 
2853
3134
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js
2854
3135
  var Matrix = class extends MathArray {
2855
- get ELEMENTS() {
2856
- assert4(false);
2857
- return 0;
2858
- }
2859
- get RANK() {
2860
- assert4(false);
2861
- return 0;
2862
- }
2863
3136
  toString() {
2864
3137
  let string = "[";
2865
3138
  if (config.printRowMajor) {
@@ -3326,7 +3599,7 @@
3326
3599
  out[15] = 0;
3327
3600
  return out;
3328
3601
  }
3329
- function perspective(out, fovy, aspect, near, far) {
3602
+ function perspectiveNO(out, fovy, aspect, near, far) {
3330
3603
  var f2 = 1 / Math.tan(fovy / 2), nf;
3331
3604
  out[0] = f2 / aspect;
3332
3605
  out[1] = 0;
@@ -3352,7 +3625,8 @@
3352
3625
  }
3353
3626
  return out;
3354
3627
  }
3355
- function ortho(out, left, right, bottom, top, near, far) {
3628
+ var perspective = perspectiveNO;
3629
+ function orthoNO(out, left, right, bottom, top, near, far) {
3356
3630
  var lr = 1 / (left - right);
3357
3631
  var bt = 1 / (bottom - top);
3358
3632
  var nf = 1 / (near - far);
@@ -3374,6 +3648,7 @@
3374
3648
  out[15] = 1;
3375
3649
  return out;
3376
3650
  }
3651
+ var ortho = orthoNO;
3377
3652
  function lookAt(out, eye, center, up) {
3378
3653
  var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;
3379
3654
  var eyex = eye[0];
@@ -3492,38 +3767,36 @@
3492
3767
  }();
3493
3768
 
3494
3769
  // ../../node_modules/@math.gl/core/dist/esm/classes/matrix4.js
3495
- var IDENTITY = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3496
- var ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
3497
- var INDICES = Object.freeze({
3498
- COL0ROW0: 0,
3499
- COL0ROW1: 1,
3500
- COL0ROW2: 2,
3501
- COL0ROW3: 3,
3502
- COL1ROW0: 4,
3503
- COL1ROW1: 5,
3504
- COL1ROW2: 6,
3505
- COL1ROW3: 7,
3506
- COL2ROW0: 8,
3507
- COL2ROW1: 9,
3508
- COL2ROW2: 10,
3509
- COL2ROW3: 11,
3510
- COL3ROW0: 12,
3511
- COL3ROW1: 13,
3512
- COL3ROW2: 14,
3513
- COL3ROW3: 15
3514
- });
3515
- var constants2 = {};
3770
+ var INDICES;
3771
+ (function(INDICES2) {
3772
+ INDICES2[INDICES2["COL0ROW0"] = 0] = "COL0ROW0";
3773
+ INDICES2[INDICES2["COL0ROW1"] = 1] = "COL0ROW1";
3774
+ INDICES2[INDICES2["COL0ROW2"] = 2] = "COL0ROW2";
3775
+ INDICES2[INDICES2["COL0ROW3"] = 3] = "COL0ROW3";
3776
+ INDICES2[INDICES2["COL1ROW0"] = 4] = "COL1ROW0";
3777
+ INDICES2[INDICES2["COL1ROW1"] = 5] = "COL1ROW1";
3778
+ INDICES2[INDICES2["COL1ROW2"] = 6] = "COL1ROW2";
3779
+ INDICES2[INDICES2["COL1ROW3"] = 7] = "COL1ROW3";
3780
+ INDICES2[INDICES2["COL2ROW0"] = 8] = "COL2ROW0";
3781
+ INDICES2[INDICES2["COL2ROW1"] = 9] = "COL2ROW1";
3782
+ INDICES2[INDICES2["COL2ROW2"] = 10] = "COL2ROW2";
3783
+ INDICES2[INDICES2["COL2ROW3"] = 11] = "COL2ROW3";
3784
+ INDICES2[INDICES2["COL3ROW0"] = 12] = "COL3ROW0";
3785
+ INDICES2[INDICES2["COL3ROW1"] = 13] = "COL3ROW1";
3786
+ INDICES2[INDICES2["COL3ROW2"] = 14] = "COL3ROW2";
3787
+ INDICES2[INDICES2["COL3ROW3"] = 15] = "COL3ROW3";
3788
+ })(INDICES || (INDICES = {}));
3789
+ var DEFAULT_FOVY = 45 * Math.PI / 180;
3790
+ var DEFAULT_ASPECT = 1;
3791
+ var DEFAULT_NEAR = 0.1;
3792
+ var DEFAULT_FAR = 500;
3793
+ var IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3516
3794
  var Matrix4 = class extends Matrix {
3517
3795
  static get IDENTITY() {
3518
- constants2.IDENTITY = constants2.IDENTITY || Object.freeze(new Matrix4(IDENTITY));
3519
- return constants2.IDENTITY;
3796
+ return getIdentityMatrix();
3520
3797
  }
3521
3798
  static get ZERO() {
3522
- constants2.ZERO = constants2.ZERO || Object.freeze(new Matrix4(ZERO));
3523
- return constants2.ZERO;
3524
- }
3525
- get INDICES() {
3526
- return INDICES;
3799
+ return getZeroMatrix();
3527
3800
  }
3528
3801
  get ELEMENTS() {
3529
3802
  return 16;
@@ -3531,6 +3804,9 @@
3531
3804
  get RANK() {
3532
3805
  return 4;
3533
3806
  }
3807
+ get INDICES() {
3808
+ return INDICES;
3809
+ }
3534
3810
  constructor(array) {
3535
3811
  super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
3536
3812
  if (arguments.length === 1 && Array.isArray(array)) {
@@ -3616,91 +3892,65 @@
3616
3892
  return result;
3617
3893
  }
3618
3894
  identity() {
3619
- return this.copy(IDENTITY);
3895
+ return this.copy(IDENTITY_MATRIX);
3620
3896
  }
3621
- fromQuaternion(q) {
3622
- fromQuat(this, q);
3897
+ fromObject(object) {
3623
3898
  return this.check();
3624
3899
  }
3625
- frustum({
3626
- left,
3627
- right,
3628
- bottom,
3629
- top,
3630
- near,
3631
- far
3632
- }) {
3900
+ fromQuaternion(quaternion) {
3901
+ fromQuat(this, quaternion);
3902
+ return this.check();
3903
+ }
3904
+ frustum(view) {
3905
+ const {
3906
+ left,
3907
+ right,
3908
+ bottom,
3909
+ top,
3910
+ near = DEFAULT_NEAR,
3911
+ far = DEFAULT_FAR
3912
+ } = view;
3633
3913
  if (far === Infinity) {
3634
- Matrix4._computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
3914
+ computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
3635
3915
  } else {
3636
3916
  frustum(this, left, right, bottom, top, near, far);
3637
3917
  }
3638
3918
  return this.check();
3639
3919
  }
3640
- static _computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
3641
- const column0Row0 = 2 * near / (right - left);
3642
- const column1Row1 = 2 * near / (top - bottom);
3643
- const column2Row0 = (right + left) / (right - left);
3644
- const column2Row1 = (top + bottom) / (top - bottom);
3645
- const column2Row2 = -1;
3646
- const column2Row3 = -1;
3647
- const column3Row2 = -2 * near;
3648
- result[0] = column0Row0;
3649
- result[1] = 0;
3650
- result[2] = 0;
3651
- result[3] = 0;
3652
- result[4] = 0;
3653
- result[5] = column1Row1;
3654
- result[6] = 0;
3655
- result[7] = 0;
3656
- result[8] = column2Row0;
3657
- result[9] = column2Row1;
3658
- result[10] = column2Row2;
3659
- result[11] = column2Row3;
3660
- result[12] = 0;
3661
- result[13] = 0;
3662
- result[14] = column3Row2;
3663
- result[15] = 0;
3664
- return result;
3665
- }
3666
- lookAt(eye, center, up) {
3667
- if (arguments.length === 1) {
3668
- ({
3669
- eye,
3670
- center,
3671
- up
3672
- } = eye);
3673
- }
3674
- center = center || [0, 0, 0];
3675
- up = up || [0, 1, 0];
3920
+ lookAt(view) {
3921
+ const {
3922
+ eye,
3923
+ center = [0, 0, 0],
3924
+ up = [0, 1, 0]
3925
+ } = view;
3676
3926
  lookAt(this, eye, center, up);
3677
3927
  return this.check();
3678
3928
  }
3679
- ortho({
3680
- left,
3681
- right,
3682
- bottom,
3683
- top,
3684
- near = 0.1,
3685
- far = 500
3686
- }) {
3929
+ ortho(view) {
3930
+ const {
3931
+ left,
3932
+ right,
3933
+ bottom,
3934
+ top,
3935
+ near = DEFAULT_NEAR,
3936
+ far = DEFAULT_FAR
3937
+ } = view;
3687
3938
  ortho(this, left, right, bottom, top, near, far);
3688
3939
  return this.check();
3689
3940
  }
3690
- orthographic({
3691
- fovy = 45 * Math.PI / 180,
3692
- aspect = 1,
3693
- focalDistance = 1,
3694
- near = 0.1,
3695
- far = 500
3696
- }) {
3697
- if (fovy > Math.PI * 2) {
3698
- throw Error("radians");
3699
- }
3941
+ orthographic(view) {
3942
+ const {
3943
+ fovy = DEFAULT_FOVY,
3944
+ aspect = DEFAULT_ASPECT,
3945
+ focalDistance = 1,
3946
+ near = DEFAULT_NEAR,
3947
+ far = DEFAULT_FAR
3948
+ } = view;
3949
+ checkRadians(fovy);
3700
3950
  const halfY = fovy / 2;
3701
3951
  const top = focalDistance * Math.tan(halfY);
3702
3952
  const right = top * aspect;
3703
- return new Matrix4().ortho({
3953
+ return this.ortho({
3704
3954
  left: -right,
3705
3955
  right,
3706
3956
  bottom: -top,
@@ -3709,17 +3959,14 @@
3709
3959
  far
3710
3960
  });
3711
3961
  }
3712
- perspective({
3713
- fovy = void 0,
3714
- fov = 45 * Math.PI / 180,
3715
- aspect = 1,
3716
- near = 0.1,
3717
- far = 500
3718
- } = {}) {
3719
- fovy = fovy || fov;
3720
- if (fovy > Math.PI * 2) {
3721
- throw Error("radians");
3722
- }
3962
+ perspective(view) {
3963
+ const {
3964
+ fovy = 45 * Math.PI / 180,
3965
+ aspect = 1,
3966
+ near = 0.1,
3967
+ far = 500
3968
+ } = view;
3969
+ checkRadians(fovy);
3723
3970
  perspective(this, fovy, aspect, near, far);
3724
3971
  return this.check();
3725
3972
  }
@@ -3738,8 +3985,10 @@
3738
3985
  result[2] = this[14];
3739
3986
  return result;
3740
3987
  }
3741
- getRotation(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
3742
- const scale2 = this.getScale(scaleResult || [-0, -0, -0]);
3988
+ getRotation(result, scaleResult) {
3989
+ result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
3990
+ scaleResult = scaleResult || [-0, -0, -0];
3991
+ const scale2 = this.getScale(scaleResult);
3743
3992
  const inverseScale0 = 1 / scale2[0];
3744
3993
  const inverseScale1 = 1 / scale2[1];
3745
3994
  const inverseScale2 = 1 / scale2[2];
@@ -3761,8 +4010,10 @@
3761
4010
  result[15] = 1;
3762
4011
  return result;
3763
4012
  }
3764
- getRotationMatrix3(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
3765
- const scale2 = this.getScale(scaleResult || [-0, -0, -0]);
4013
+ getRotationMatrix3(result, scaleResult) {
4014
+ result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
4015
+ scaleResult = scaleResult || [-0, -0, -0];
4016
+ const scale2 = this.getScale(scaleResult);
3766
4017
  const inverseScale0 = 1 / scale2[0];
3767
4018
  const inverseScale1 = 1 / scale2[1];
3768
4019
  const inverseScale2 = 1 / scale2[2];
@@ -3805,23 +4056,19 @@
3805
4056
  rotateZ2(this, this, radians2);
3806
4057
  return this.check();
3807
4058
  }
3808
- rotateXYZ([rx, ry, rz]) {
3809
- return this.rotateX(rx).rotateY(ry).rotateZ(rz);
4059
+ rotateXYZ(angleXYZ) {
4060
+ return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
3810
4061
  }
3811
4062
  rotateAxis(radians2, axis) {
3812
4063
  rotate(this, this, radians2, axis);
3813
4064
  return this.check();
3814
4065
  }
3815
4066
  scale(factor) {
3816
- if (Array.isArray(factor)) {
3817
- scale(this, this, factor);
3818
- } else {
3819
- scale(this, this, [factor, factor, factor]);
3820
- }
4067
+ scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
3821
4068
  return this.check();
3822
4069
  }
3823
- translate(vec) {
3824
- translate(this, this, vec);
4070
+ translate(vector) {
4071
+ translate(this, this, vector);
3825
4072
  return this.check();
3826
4073
  }
3827
4074
  transform(vector, result) {
@@ -3836,52 +4083,98 @@
3836
4083
  const {
3837
4084
  length: length2
3838
4085
  } = vector;
4086
+ let out;
3839
4087
  switch (length2) {
3840
4088
  case 2:
3841
- result = transformMat4(result || [-0, -0], vector, this);
4089
+ out = transformMat4(result || [-0, -0], vector, this);
3842
4090
  break;
3843
4091
  case 3:
3844
- result = transformMat42(result || [-0, -0, -0], vector, this);
4092
+ out = transformMat42(result || [-0, -0, -0], vector, this);
3845
4093
  break;
3846
4094
  default:
3847
4095
  throw new Error("Illegal vector");
3848
4096
  }
3849
- checkVector(result, vector.length);
3850
- return result;
4097
+ checkVector(out, vector.length);
4098
+ return out;
3851
4099
  }
3852
4100
  transformAsVector(vector, result) {
4101
+ let out;
3853
4102
  switch (vector.length) {
3854
4103
  case 2:
3855
- result = vec2_transformMat4AsVector(result || [-0, -0], vector, this);
4104
+ out = vec2_transformMat4AsVector(result || [-0, -0], vector, this);
3856
4105
  break;
3857
4106
  case 3:
3858
- result = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);
4107
+ out = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);
3859
4108
  break;
3860
4109
  default:
3861
4110
  throw new Error("Illegal vector");
3862
4111
  }
3863
- checkVector(result, vector.length);
3864
- return result;
3865
- }
3866
- makeRotationX(radians2) {
3867
- return this.identity().rotateX(radians2);
3868
- }
3869
- makeTranslation(x, y, z) {
3870
- return this.identity().translate([x, y, z]);
4112
+ checkVector(out, vector.length);
4113
+ return out;
3871
4114
  }
3872
4115
  transformPoint(vector, result) {
3873
- deprecated("Matrix4.transformPoint", "3.0");
3874
4116
  return this.transformAsPoint(vector, result);
3875
4117
  }
3876
4118
  transformVector(vector, result) {
3877
- deprecated("Matrix4.transformVector", "3.0");
3878
4119
  return this.transformAsPoint(vector, result);
3879
4120
  }
3880
4121
  transformDirection(vector, result) {
3881
- deprecated("Matrix4.transformDirection", "3.0");
3882
4122
  return this.transformAsVector(vector, result);
3883
4123
  }
4124
+ makeRotationX(radians2) {
4125
+ return this.identity().rotateX(radians2);
4126
+ }
4127
+ makeTranslation(x, y, z) {
4128
+ return this.identity().translate([x, y, z]);
4129
+ }
3884
4130
  };
4131
+ var ZERO2;
4132
+ var IDENTITY;
4133
+ function getZeroMatrix() {
4134
+ if (!ZERO2) {
4135
+ ZERO2 = new Matrix4([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
4136
+ Object.freeze(ZERO2);
4137
+ }
4138
+ return ZERO2;
4139
+ }
4140
+ function getIdentityMatrix() {
4141
+ if (!IDENTITY) {
4142
+ IDENTITY = new Matrix4();
4143
+ Object.freeze(IDENTITY);
4144
+ }
4145
+ return IDENTITY;
4146
+ }
4147
+ function checkRadians(possiblyDegrees) {
4148
+ if (possiblyDegrees > Math.PI * 2) {
4149
+ throw Error("expected radians");
4150
+ }
4151
+ }
4152
+ function computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
4153
+ const column0Row0 = 2 * near / (right - left);
4154
+ const column1Row1 = 2 * near / (top - bottom);
4155
+ const column2Row0 = (right + left) / (right - left);
4156
+ const column2Row1 = (top + bottom) / (top - bottom);
4157
+ const column2Row2 = -1;
4158
+ const column2Row3 = -1;
4159
+ const column3Row2 = -2 * near;
4160
+ result[0] = column0Row0;
4161
+ result[1] = 0;
4162
+ result[2] = 0;
4163
+ result[3] = 0;
4164
+ result[4] = 0;
4165
+ result[5] = column1Row1;
4166
+ result[6] = 0;
4167
+ result[7] = 0;
4168
+ result[8] = column2Row0;
4169
+ result[9] = column2Row1;
4170
+ result[10] = column2Row2;
4171
+ result[11] = column2Row3;
4172
+ result[12] = 0;
4173
+ result[13] = 0;
4174
+ result[14] = column3Row2;
4175
+ result[15] = 0;
4176
+ return result;
4177
+ }
3885
4178
 
3886
4179
  // ../../node_modules/@math.gl/core/dist/esm/lib/math-utils.js
3887
4180
  var math_utils_default = {
@@ -3911,17 +4204,6 @@
3911
4204
  TWO_PI: Math.PI * 2
3912
4205
  };
3913
4206
 
3914
- // ../../node_modules/@math.gl/core/dist/esm/index.js
3915
- var globals4 = {
3916
- self: typeof self !== "undefined" && self,
3917
- window: typeof window !== "undefined" && window,
3918
- global: typeof global !== "undefined" && global
3919
- };
3920
- var global_4 = globals4.global || globals4.self || globals4.window;
3921
- global_4.mathgl = {
3922
- config
3923
- };
3924
-
3925
4207
  // ../../node_modules/@math.gl/geospatial/dist/esm/constants.js
3926
4208
  var WGS84_RADIUS_X = 6378137;
3927
4209
  var WGS84_RADIUS_Y = 6378137;
@@ -3936,61 +4218,63 @@
3936
4218
  };
3937
4219
 
3938
4220
  // ../../node_modules/@math.gl/geospatial/dist/esm/type-utils.js
3939
- var noop2 = (x) => x;
4221
+ function identity2(x) {
4222
+ return x;
4223
+ }
3940
4224
  var scratchVector = new Vector3();
3941
- function fromCartographic(cartographic, result, map3 = noop2) {
3942
- if (isArray(cartographic)) {
3943
- result[0] = map3(cartographic[0]);
3944
- result[1] = map3(cartographic[1]);
3945
- result[2] = cartographic[2];
3946
- } else if ("longitude" in cartographic) {
3947
- result[0] = map3(cartographic.longitude);
3948
- result[1] = map3(cartographic.latitude);
4225
+ function fromCartographic(cartographic, result = [], map2 = identity2) {
4226
+ if ("longitude" in cartographic) {
4227
+ result[0] = map2(cartographic.longitude);
4228
+ result[1] = map2(cartographic.latitude);
3949
4229
  result[2] = cartographic.height;
3950
- } else {
3951
- result[0] = map3(cartographic.x);
3952
- result[1] = map3(cartographic.y);
4230
+ } else if ("x" in cartographic) {
4231
+ result[0] = map2(cartographic.x);
4232
+ result[1] = map2(cartographic.y);
3953
4233
  result[2] = cartographic.z;
4234
+ } else {
4235
+ result[0] = map2(cartographic[0]);
4236
+ result[1] = map2(cartographic[1]);
4237
+ result[2] = cartographic[2];
3954
4238
  }
3955
4239
  return result;
3956
4240
  }
3957
- function fromCartographicToRadians(cartographic, vector = scratchVector) {
3958
- return fromCartographic(cartographic, vector, config._cartographicRadians ? noop2 : toRadians);
4241
+ function fromCartographicToRadians(cartographic, vector = []) {
4242
+ return fromCartographic(cartographic, vector, config._cartographicRadians ? identity2 : toRadians);
3959
4243
  }
3960
- function toCartographic(vector, cartographic, map3 = noop2) {
3961
- if (isArray(cartographic)) {
3962
- cartographic[0] = map3(vector[0]);
3963
- cartographic[1] = map3(vector[1]);
3964
- cartographic[2] = vector[2];
3965
- } else if ("longitude" in cartographic) {
3966
- cartographic.longitude = map3(vector[0]);
3967
- cartographic.latitude = map3(vector[1]);
4244
+ function toCartographic(vector, cartographic, map2 = identity2) {
4245
+ if ("longitude" in cartographic) {
4246
+ cartographic.longitude = map2(vector[0]);
4247
+ cartographic.latitude = map2(vector[1]);
3968
4248
  cartographic.height = vector[2];
3969
- } else {
3970
- cartographic.x = map3(vector[0]);
3971
- cartographic.y = map3(vector[1]);
4249
+ } else if ("x" in cartographic) {
4250
+ cartographic.x = map2(vector[0]);
4251
+ cartographic.y = map2(vector[1]);
3972
4252
  cartographic.z = vector[2];
4253
+ } else {
4254
+ cartographic[0] = map2(vector[0]);
4255
+ cartographic[1] = map2(vector[1]);
4256
+ cartographic[2] = vector[2];
3973
4257
  }
3974
4258
  return cartographic;
3975
4259
  }
3976
4260
  function toCartographicFromRadians(vector, cartographic) {
3977
- return toCartographic(vector, cartographic, config._cartographicRadians ? noop2 : toDegrees);
4261
+ return toCartographic(vector, cartographic, config._cartographicRadians ? identity2 : toDegrees);
3978
4262
  }
3979
4263
 
3980
4264
  // ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/scale-to-geodetic-surface.js
3981
4265
  var scratchVector2 = new Vector3();
3982
4266
  var scaleToGeodeticSurfaceIntersection = new Vector3();
3983
4267
  var scaleToGeodeticSurfaceGradient = new Vector3();
3984
- function scaleToGeodeticSurface(cartesian, ellipsoid, result = new Vector3()) {
4268
+ function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
3985
4269
  const {
3986
4270
  oneOverRadii,
3987
4271
  oneOverRadiiSquared,
3988
4272
  centerToleranceSquared
3989
4273
  } = ellipsoid;
3990
4274
  scratchVector2.from(cartesian);
3991
- const positionX = cartesian.x;
3992
- const positionY = cartesian.y;
3993
- const positionZ = cartesian.z;
4275
+ const positionX = scratchVector2.x;
4276
+ const positionY = scratchVector2.y;
4277
+ const positionZ = scratchVector2.z;
3994
4278
  const oneOverRadiiX = oneOverRadii.x;
3995
4279
  const oneOverRadiiY = oneOverRadii.y;
3996
4280
  const oneOverRadiiZ = oneOverRadii.z;
@@ -4012,7 +4296,7 @@
4012
4296
  const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
4013
4297
  const gradient = scaleToGeodeticSurfaceGradient;
4014
4298
  gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
4015
- let lambda = (1 - ratio) * cartesian.len() / (0.5 * gradient.len());
4299
+ let lambda = (1 - ratio) * scratchVector2.len() / (0.5 * gradient.len());
4016
4300
  let correction = 0;
4017
4301
  let xMultiplier;
4018
4302
  let yMultiplier;
@@ -4166,13 +4450,17 @@
4166
4450
  var scratchPosition = new Vector3();
4167
4451
  var scratchHeight = new Vector3();
4168
4452
  var scratchCartesian = new Vector3();
4169
- var wgs84;
4170
4453
  var Ellipsoid = class {
4171
- static get WGS84() {
4172
- wgs84 = wgs84 || new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
4173
- return wgs84;
4174
- }
4175
4454
  constructor(x = 0, y = 0, z = 0) {
4455
+ _defineProperty(this, "radii", void 0);
4456
+ _defineProperty(this, "radiiSquared", void 0);
4457
+ _defineProperty(this, "radiiToTheFourth", void 0);
4458
+ _defineProperty(this, "oneOverRadii", void 0);
4459
+ _defineProperty(this, "oneOverRadiiSquared", void 0);
4460
+ _defineProperty(this, "minimumRadius", void 0);
4461
+ _defineProperty(this, "maximumRadius", void 0);
4462
+ _defineProperty(this, "centerToleranceSquared", math_utils_default.EPSILON1);
4463
+ _defineProperty(this, "squaredXOverSquaredZ", void 0);
4176
4464
  assert4(x >= 0);
4177
4465
  assert4(y >= 0);
4178
4466
  assert4(z >= 0);
@@ -4183,7 +4471,6 @@
4183
4471
  this.oneOverRadiiSquared = new Vector3(x === 0 ? 0 : 1 / (x * x), y === 0 ? 0 : 1 / (y * y), z === 0 ? 0 : 1 / (z * z));
4184
4472
  this.minimumRadius = Math.min(x, y, z);
4185
4473
  this.maximumRadius = Math.max(x, y, z);
4186
- this.centerToleranceSquared = math_utils_default.EPSILON1;
4187
4474
  if (this.radiiSquared.z !== 0) {
4188
4475
  this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;
4189
4476
  }
@@ -4270,9 +4557,10 @@
4270
4557
  return scratchPosition.set(0, 0, z).to(result);
4271
4558
  }
4272
4559
  };
4560
+ _defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
4273
4561
 
4274
4562
  // ../images/src/lib/utils/version.ts
4275
- var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
4563
+ var VERSION4 = true ? "4.0.0-alpha.6" : "latest";
4276
4564
 
4277
4565
  // ../images/src/lib/category-api/image-type.ts
4278
4566
  var { _parseImageNode } = globalThis;
@@ -4396,9 +4684,9 @@
4396
4684
  await image.decode();
4397
4685
  return image;
4398
4686
  }
4399
- return await new Promise((resolve, reject) => {
4687
+ return await new Promise((resolve2, reject) => {
4400
4688
  try {
4401
- image.onload = () => resolve(image);
4689
+ image.onload = () => resolve2(image);
4402
4690
  image.onerror = (err) => reject(new Error(`Could not load image ${url}: ${err}`));
4403
4691
  } catch (error) {
4404
4692
  reject(error);
@@ -4441,12 +4729,60 @@
4441
4729
  return true;
4442
4730
  }
4443
4731
 
4732
+ // ../images/src/lib/category-api/parse-isobmff-binary.ts
4733
+ function getISOBMFFMediaType(buffer) {
4734
+ if (!checkString(buffer, "ftyp", 4)) {
4735
+ return null;
4736
+ }
4737
+ if ((buffer[8] & 96) === 0) {
4738
+ return null;
4739
+ }
4740
+ return decodeMajorBrand(buffer);
4741
+ }
4742
+ function decodeMajorBrand(buffer) {
4743
+ const brandMajor = getUTF8String(buffer, 8, 12).replace("\0", " ").trim();
4744
+ switch (brandMajor) {
4745
+ case "avif":
4746
+ case "avis":
4747
+ return { extension: "avif", mimeType: "image/avif" };
4748
+ default:
4749
+ return null;
4750
+ }
4751
+ }
4752
+ function getUTF8String(array, start, end) {
4753
+ return String.fromCharCode(...array.slice(start, end));
4754
+ }
4755
+ function stringToBytes(string) {
4756
+ return [...string].map((character) => character.charCodeAt(0));
4757
+ }
4758
+ function checkString(buffer, header, offset = 0) {
4759
+ const headerBytes = stringToBytes(header);
4760
+ for (let i2 = 0; i2 < headerBytes.length; ++i2) {
4761
+ if (headerBytes[i2] !== buffer[i2 + offset]) {
4762
+ return false;
4763
+ }
4764
+ }
4765
+ return true;
4766
+ }
4767
+
4444
4768
  // ../images/src/lib/category-api/binary-image-api.ts
4445
4769
  var BIG_ENDIAN = false;
4446
4770
  var LITTLE_ENDIAN = true;
4447
4771
  function getBinaryImageMetadata(binaryData) {
4448
4772
  const dataView = toDataView(binaryData);
4449
- return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView);
4773
+ return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView) || getISOBMFFMetadata(dataView);
4774
+ }
4775
+ function getISOBMFFMetadata(binaryData) {
4776
+ const buffer = new Uint8Array(binaryData instanceof DataView ? binaryData.buffer : binaryData);
4777
+ const mediaType = getISOBMFFMediaType(buffer);
4778
+ if (!mediaType) {
4779
+ return null;
4780
+ }
4781
+ return {
4782
+ mimeType: mediaType.mimeType,
4783
+ width: 0,
4784
+ height: 0
4785
+ };
4450
4786
  }
4451
4787
  function getPngMetadata(binaryData) {
4452
4788
  const dataView = toDataView(binaryData);
@@ -4591,12 +4927,13 @@
4591
4927
  }
4592
4928
 
4593
4929
  // ../images/src/image-loader.ts
4594
- var EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg"];
4930
+ var EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg", "avif"];
4595
4931
  var MIME_TYPES = [
4596
4932
  "image/png",
4597
4933
  "image/jpeg",
4598
4934
  "image/gif",
4599
4935
  "image/webp",
4936
+ "image/avif",
4600
4937
  "image/bmp",
4601
4938
  "image/vnd.microsoft.icon",
4602
4939
  "image/svg+xml"
@@ -4607,565 +4944,123 @@
4607
4944
  decode: true
4608
4945
  }
4609
4946
  };
4610
- var ImageLoader = {
4611
- id: "image",
4612
- module: "images",
4613
- name: "Images",
4614
- version: VERSION4,
4615
- mimeTypes: MIME_TYPES,
4616
- extensions: EXTENSIONS,
4617
- parse: parseImage,
4618
- tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
4619
- options: DEFAULT_IMAGE_LOADER_OPTIONS
4620
- };
4621
-
4622
- // ../draco/src/lib/utils/version.ts
4623
- var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
4624
-
4625
- // ../draco/src/draco-loader.ts
4626
- var DEFAULT_DRACO_OPTIONS = {
4627
- draco: {
4628
- decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
4629
- libraryPath: "libs/",
4630
- extraAttributes: {},
4631
- attributeNameEntry: void 0
4632
- }
4633
- };
4634
- var DracoLoader = {
4635
- name: "Draco",
4636
- id: "draco",
4637
- module: "draco",
4638
- shapes: ["mesh"],
4639
- version: VERSION5,
4640
- worker: true,
4641
- extensions: ["drc"],
4642
- mimeTypes: ["application/octet-stream"],
4643
- binary: true,
4644
- tests: ["DRACO"],
4645
- options: DEFAULT_DRACO_OPTIONS
4646
- };
4647
-
4648
- // ../schema/src/category/mesh/mesh-utils.ts
4649
- function getMeshBoundingBox(attributes) {
4650
- let minX = Infinity;
4651
- let minY = Infinity;
4652
- let minZ = Infinity;
4653
- let maxX = -Infinity;
4654
- let maxY = -Infinity;
4655
- let maxZ = -Infinity;
4656
- const positions = attributes.POSITION ? attributes.POSITION.value : [];
4657
- const len = positions && positions.length;
4658
- for (let i2 = 0; i2 < len; i2 += 3) {
4659
- const x = positions[i2];
4660
- const y = positions[i2 + 1];
4661
- const z = positions[i2 + 2];
4662
- minX = x < minX ? x : minX;
4663
- minY = y < minY ? y : minY;
4664
- minZ = z < minZ ? z : minZ;
4665
- maxX = x > maxX ? x : maxX;
4666
- maxY = y > maxY ? y : maxY;
4667
- maxZ = z > maxZ ? z : maxZ;
4668
- }
4669
- return [
4670
- [minX, minY, minZ],
4671
- [maxX, maxY, maxZ]
4672
- ];
4673
- }
4674
-
4675
- // ../schema/src/lib/utils/assert.ts
4676
- function assert5(condition, message) {
4677
- if (!condition) {
4678
- throw new Error(message || "loader assertion failed.");
4679
- }
4680
- }
4681
-
4682
- // ../schema/src/lib/schema/impl/schema.ts
4683
- var Schema = class {
4684
- constructor(fields, metadata) {
4685
- assert5(Array.isArray(fields));
4686
- checkNames(fields);
4687
- this.fields = fields;
4688
- this.metadata = metadata || new Map();
4689
- }
4690
- compareTo(other) {
4691
- if (this.metadata !== other.metadata) {
4692
- return false;
4693
- }
4694
- if (this.fields.length !== other.fields.length) {
4695
- return false;
4696
- }
4697
- for (let i2 = 0; i2 < this.fields.length; ++i2) {
4698
- if (!this.fields[i2].compareTo(other.fields[i2])) {
4699
- return false;
4700
- }
4701
- }
4702
- return true;
4703
- }
4704
- select(...columnNames) {
4705
- const nameMap = Object.create(null);
4706
- for (const name of columnNames) {
4707
- nameMap[name] = true;
4708
- }
4709
- const selectedFields = this.fields.filter((field) => nameMap[field.name]);
4710
- return new Schema(selectedFields, this.metadata);
4711
- }
4712
- selectAt(...columnIndices) {
4713
- const selectedFields = columnIndices.map((index) => this.fields[index]).filter(Boolean);
4714
- return new Schema(selectedFields, this.metadata);
4715
- }
4716
- assign(schemaOrFields) {
4717
- let fields;
4718
- let metadata = this.metadata;
4719
- if (schemaOrFields instanceof Schema) {
4720
- const otherSchema = schemaOrFields;
4721
- fields = otherSchema.fields;
4722
- metadata = mergeMaps(mergeMaps(new Map(), this.metadata), otherSchema.metadata);
4723
- } else {
4724
- fields = schemaOrFields;
4725
- }
4726
- const fieldMap = Object.create(null);
4727
- for (const field of this.fields) {
4728
- fieldMap[field.name] = field;
4729
- }
4730
- for (const field of fields) {
4731
- fieldMap[field.name] = field;
4732
- }
4733
- const mergedFields = Object.values(fieldMap);
4734
- return new Schema(mergedFields, metadata);
4735
- }
4736
- };
4737
- function checkNames(fields) {
4738
- const usedNames = {};
4739
- for (const field of fields) {
4740
- if (usedNames[field.name]) {
4741
- console.warn("Schema: duplicated field name", field.name, field);
4742
- }
4743
- usedNames[field.name] = true;
4744
- }
4745
- }
4746
- function mergeMaps(m1, m2) {
4747
- return new Map([...m1 || new Map(), ...m2 || new Map()]);
4748
- }
4749
-
4750
- // ../schema/src/lib/schema/impl/field.ts
4751
- var Field = class {
4752
- constructor(name, type, nullable = false, metadata = new Map()) {
4753
- this.name = name;
4754
- this.type = type;
4755
- this.nullable = nullable;
4756
- this.metadata = metadata;
4757
- }
4758
- get typeId() {
4759
- return this.type && this.type.typeId;
4760
- }
4761
- clone() {
4762
- return new Field(this.name, this.type, this.nullable, this.metadata);
4763
- }
4764
- compareTo(other) {
4765
- return this.name === other.name && this.type === other.type && this.nullable === other.nullable && this.metadata === other.metadata;
4766
- }
4767
- toString() {
4768
- return `${this.type}${this.nullable ? ", nullable" : ""}${this.metadata ? `, metadata: ${this.metadata}` : ""}`;
4769
- }
4770
- };
4771
-
4772
- // ../schema/src/lib/schema/impl/enum.ts
4773
- var Type;
4774
- (function(Type2) {
4775
- Type2[Type2["NONE"] = 0] = "NONE";
4776
- Type2[Type2["Null"] = 1] = "Null";
4777
- Type2[Type2["Int"] = 2] = "Int";
4778
- Type2[Type2["Float"] = 3] = "Float";
4779
- Type2[Type2["Binary"] = 4] = "Binary";
4780
- Type2[Type2["Utf8"] = 5] = "Utf8";
4781
- Type2[Type2["Bool"] = 6] = "Bool";
4782
- Type2[Type2["Decimal"] = 7] = "Decimal";
4783
- Type2[Type2["Date"] = 8] = "Date";
4784
- Type2[Type2["Time"] = 9] = "Time";
4785
- Type2[Type2["Timestamp"] = 10] = "Timestamp";
4786
- Type2[Type2["Interval"] = 11] = "Interval";
4787
- Type2[Type2["List"] = 12] = "List";
4788
- Type2[Type2["Struct"] = 13] = "Struct";
4789
- Type2[Type2["Union"] = 14] = "Union";
4790
- Type2[Type2["FixedSizeBinary"] = 15] = "FixedSizeBinary";
4791
- Type2[Type2["FixedSizeList"] = 16] = "FixedSizeList";
4792
- Type2[Type2["Map"] = 17] = "Map";
4793
- Type2[Type2["Dictionary"] = -1] = "Dictionary";
4794
- Type2[Type2["Int8"] = -2] = "Int8";
4795
- Type2[Type2["Int16"] = -3] = "Int16";
4796
- Type2[Type2["Int32"] = -4] = "Int32";
4797
- Type2[Type2["Int64"] = -5] = "Int64";
4798
- Type2[Type2["Uint8"] = -6] = "Uint8";
4799
- Type2[Type2["Uint16"] = -7] = "Uint16";
4800
- Type2[Type2["Uint32"] = -8] = "Uint32";
4801
- Type2[Type2["Uint64"] = -9] = "Uint64";
4802
- Type2[Type2["Float16"] = -10] = "Float16";
4803
- Type2[Type2["Float32"] = -11] = "Float32";
4804
- Type2[Type2["Float64"] = -12] = "Float64";
4805
- Type2[Type2["DateDay"] = -13] = "DateDay";
4806
- Type2[Type2["DateMillisecond"] = -14] = "DateMillisecond";
4807
- Type2[Type2["TimestampSecond"] = -15] = "TimestampSecond";
4808
- Type2[Type2["TimestampMillisecond"] = -16] = "TimestampMillisecond";
4809
- Type2[Type2["TimestampMicrosecond"] = -17] = "TimestampMicrosecond";
4810
- Type2[Type2["TimestampNanosecond"] = -18] = "TimestampNanosecond";
4811
- Type2[Type2["TimeSecond"] = -19] = "TimeSecond";
4812
- Type2[Type2["TimeMillisecond"] = -20] = "TimeMillisecond";
4813
- Type2[Type2["TimeMicrosecond"] = -21] = "TimeMicrosecond";
4814
- Type2[Type2["TimeNanosecond"] = -22] = "TimeNanosecond";
4815
- Type2[Type2["DenseUnion"] = -23] = "DenseUnion";
4816
- Type2[Type2["SparseUnion"] = -24] = "SparseUnion";
4817
- Type2[Type2["IntervalDayTime"] = -25] = "IntervalDayTime";
4818
- Type2[Type2["IntervalYearMonth"] = -26] = "IntervalYearMonth";
4819
- })(Type || (Type = {}));
4820
-
4821
- // ../schema/src/lib/schema/impl/type.ts
4822
- var DataType = class {
4823
- static isNull(x) {
4824
- return x && x.typeId === Type.Null;
4825
- }
4826
- static isInt(x) {
4827
- return x && x.typeId === Type.Int;
4828
- }
4829
- static isFloat(x) {
4830
- return x && x.typeId === Type.Float;
4831
- }
4832
- static isBinary(x) {
4833
- return x && x.typeId === Type.Binary;
4834
- }
4835
- static isUtf8(x) {
4836
- return x && x.typeId === Type.Utf8;
4837
- }
4838
- static isBool(x) {
4839
- return x && x.typeId === Type.Bool;
4840
- }
4841
- static isDecimal(x) {
4842
- return x && x.typeId === Type.Decimal;
4843
- }
4844
- static isDate(x) {
4845
- return x && x.typeId === Type.Date;
4846
- }
4847
- static isTime(x) {
4848
- return x && x.typeId === Type.Time;
4849
- }
4850
- static isTimestamp(x) {
4851
- return x && x.typeId === Type.Timestamp;
4852
- }
4853
- static isInterval(x) {
4854
- return x && x.typeId === Type.Interval;
4855
- }
4856
- static isList(x) {
4857
- return x && x.typeId === Type.List;
4858
- }
4859
- static isStruct(x) {
4860
- return x && x.typeId === Type.Struct;
4861
- }
4862
- static isUnion(x) {
4863
- return x && x.typeId === Type.Union;
4864
- }
4865
- static isFixedSizeBinary(x) {
4866
- return x && x.typeId === Type.FixedSizeBinary;
4867
- }
4868
- static isFixedSizeList(x) {
4869
- return x && x.typeId === Type.FixedSizeList;
4870
- }
4871
- static isMap(x) {
4872
- return x && x.typeId === Type.Map;
4873
- }
4874
- static isDictionary(x) {
4875
- return x && x.typeId === Type.Dictionary;
4876
- }
4877
- get typeId() {
4878
- return Type.NONE;
4879
- }
4880
- compareTo(other) {
4881
- return this === other;
4882
- }
4883
- };
4884
- var Null = class extends DataType {
4885
- get typeId() {
4886
- return Type.Null;
4887
- }
4888
- get [Symbol.toStringTag]() {
4889
- return "Null";
4890
- }
4891
- toString() {
4892
- return "Null";
4893
- }
4894
- };
4895
- var Bool = class extends DataType {
4896
- get typeId() {
4897
- return Type.Bool;
4898
- }
4899
- get [Symbol.toStringTag]() {
4900
- return "Bool";
4901
- }
4902
- toString() {
4903
- return "Bool";
4904
- }
4905
- };
4906
- var Int = class extends DataType {
4907
- constructor(isSigned, bitWidth) {
4908
- super();
4909
- this.isSigned = isSigned;
4910
- this.bitWidth = bitWidth;
4911
- }
4912
- get typeId() {
4913
- return Type.Int;
4914
- }
4915
- get [Symbol.toStringTag]() {
4916
- return "Int";
4917
- }
4918
- toString() {
4919
- return `${this.isSigned ? "I" : "Ui"}nt${this.bitWidth}`;
4920
- }
4921
- };
4922
- var Int8 = class extends Int {
4923
- constructor() {
4924
- super(true, 8);
4925
- }
4926
- };
4927
- var Int16 = class extends Int {
4928
- constructor() {
4929
- super(true, 16);
4930
- }
4931
- };
4932
- var Int32 = class extends Int {
4933
- constructor() {
4934
- super(true, 32);
4935
- }
4936
- };
4937
- var Uint8 = class extends Int {
4938
- constructor() {
4939
- super(false, 8);
4940
- }
4941
- };
4942
- var Uint16 = class extends Int {
4943
- constructor() {
4944
- super(false, 16);
4945
- }
4946
- };
4947
- var Uint32 = class extends Int {
4948
- constructor() {
4949
- super(false, 32);
4950
- }
4951
- };
4952
- var Precision = {
4953
- HALF: 16,
4954
- SINGLE: 32,
4955
- DOUBLE: 64
4956
- };
4957
- var Float = class extends DataType {
4958
- constructor(precision) {
4959
- super();
4960
- this.precision = precision;
4961
- }
4962
- get typeId() {
4963
- return Type.Float;
4964
- }
4965
- get [Symbol.toStringTag]() {
4966
- return "Float";
4967
- }
4968
- toString() {
4969
- return `Float${this.precision}`;
4970
- }
4971
- };
4972
- var Float32 = class extends Float {
4973
- constructor() {
4974
- super(Precision.SINGLE);
4975
- }
4976
- };
4977
- var Float64 = class extends Float {
4978
- constructor() {
4979
- super(Precision.DOUBLE);
4980
- }
4981
- };
4982
- var Binary = class extends DataType {
4983
- constructor() {
4984
- super();
4985
- }
4986
- get typeId() {
4987
- return Type.Binary;
4988
- }
4989
- toString() {
4990
- return "Binary";
4991
- }
4992
- get [Symbol.toStringTag]() {
4993
- return "Binary";
4994
- }
4995
- };
4996
- var Utf8 = class extends DataType {
4997
- get typeId() {
4998
- return Type.Utf8;
4999
- }
5000
- get [Symbol.toStringTag]() {
5001
- return "Utf8";
5002
- }
5003
- toString() {
5004
- return "Utf8";
5005
- }
5006
- };
5007
- var DateUnit = {
5008
- DAY: 0,
5009
- MILLISECOND: 1
5010
- };
5011
- var Date2 = class extends DataType {
5012
- constructor(unit) {
5013
- super();
5014
- this.unit = unit;
5015
- }
5016
- get typeId() {
5017
- return Type.Date;
5018
- }
5019
- get [Symbol.toStringTag]() {
5020
- return "Date";
5021
- }
5022
- toString() {
5023
- return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;
5024
- }
5025
- };
5026
- var TimeUnit = {
5027
- SECOND: 1,
5028
- MILLISECOND: 1e3,
5029
- MICROSECOND: 1e6,
5030
- NANOSECOND: 1e9
5031
- };
5032
- var Time = class extends DataType {
5033
- constructor(unit, bitWidth) {
5034
- super();
5035
- this.unit = unit;
5036
- this.bitWidth = bitWidth;
5037
- }
5038
- get typeId() {
5039
- return Type.Time;
5040
- }
5041
- toString() {
5042
- return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
5043
- }
5044
- get [Symbol.toStringTag]() {
5045
- return "Time";
5046
- }
5047
- };
5048
- var Timestamp = class extends DataType {
5049
- constructor(unit, timezone = null) {
5050
- super();
5051
- this.unit = unit;
5052
- this.timezone = timezone;
5053
- }
5054
- get typeId() {
5055
- return Type.Timestamp;
5056
- }
5057
- get [Symbol.toStringTag]() {
5058
- return "Timestamp";
5059
- }
5060
- toString() {
5061
- return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ""}>`;
5062
- }
5063
- };
5064
- var IntervalUnit = {
5065
- DAY_TIME: 0,
5066
- YEAR_MONTH: 1
5067
- };
5068
- var Interval = class extends DataType {
5069
- constructor(unit) {
5070
- super();
5071
- this.unit = unit;
5072
- }
5073
- get typeId() {
5074
- return Type.Interval;
5075
- }
5076
- get [Symbol.toStringTag]() {
5077
- return "Interval";
5078
- }
5079
- toString() {
5080
- return `Interval<${IntervalUnit[this.unit]}>`;
5081
- }
5082
- };
5083
- var FixedSizeList = class extends DataType {
5084
- constructor(listSize, child) {
5085
- super();
5086
- this.listSize = listSize;
5087
- this.children = [child];
5088
- }
5089
- get typeId() {
5090
- return Type.FixedSizeList;
5091
- }
5092
- get valueType() {
5093
- return this.children[0].type;
5094
- }
5095
- get valueField() {
5096
- return this.children[0];
5097
- }
5098
- get [Symbol.toStringTag]() {
5099
- return "FixedSizeList";
5100
- }
5101
- toString() {
5102
- return `FixedSizeList[${this.listSize}]<${this.valueType}>`;
5103
- }
4947
+ var ImageLoader = {
4948
+ id: "image",
4949
+ module: "images",
4950
+ name: "Images",
4951
+ version: VERSION4,
4952
+ mimeTypes: MIME_TYPES,
4953
+ extensions: EXTENSIONS,
4954
+ parse: parseImage,
4955
+ tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
4956
+ options: DEFAULT_IMAGE_LOADER_OPTIONS
5104
4957
  };
5105
- var Struct = class extends DataType {
5106
- constructor(children) {
5107
- super();
5108
- this.children = children;
5109
- }
5110
- get typeId() {
5111
- return Type.Struct;
5112
- }
5113
- toString() {
5114
- return `Struct<{${this.children.map((f2) => `${f2.name}:${f2.type}`).join(", ")}}>`;
5115
- }
5116
- get [Symbol.toStringTag]() {
5117
- return "Struct";
4958
+
4959
+ // ../draco/src/lib/utils/version.ts
4960
+ var VERSION5 = true ? "4.0.0-alpha.6" : "latest";
4961
+
4962
+ // ../draco/src/draco-loader.ts
4963
+ var DEFAULT_DRACO_OPTIONS = {
4964
+ draco: {
4965
+ decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
4966
+ libraryPath: "libs/",
4967
+ extraAttributes: {},
4968
+ attributeNameEntry: void 0
5118
4969
  }
5119
4970
  };
4971
+ var DracoLoader = {
4972
+ name: "Draco",
4973
+ id: isBrowser2 ? "draco" : "draco-nodejs",
4974
+ module: "draco",
4975
+ version: VERSION5,
4976
+ worker: true,
4977
+ extensions: ["drc"],
4978
+ mimeTypes: ["application/octet-stream"],
4979
+ binary: true,
4980
+ tests: ["DRACO"],
4981
+ options: DEFAULT_DRACO_OPTIONS
4982
+ };
5120
4983
 
5121
- // ../schema/src/lib/arrow/arrow-like-type-utils.ts
5122
- function getArrowTypeFromTypedArray(array) {
4984
+ // ../schema/src/lib/table/simple-table/data-type.ts
4985
+ function getDataTypeFromTypedArray(array) {
5123
4986
  switch (array.constructor) {
5124
4987
  case Int8Array:
5125
- return new Int8();
4988
+ return "int8";
5126
4989
  case Uint8Array:
5127
- return new Uint8();
4990
+ case Uint8ClampedArray:
4991
+ return "uint8";
5128
4992
  case Int16Array:
5129
- return new Int16();
4993
+ return "int16";
5130
4994
  case Uint16Array:
5131
- return new Uint16();
4995
+ return "uint16";
5132
4996
  case Int32Array:
5133
- return new Int32();
4997
+ return "int32";
5134
4998
  case Uint32Array:
5135
- return new Uint32();
4999
+ return "uint32";
5136
5000
  case Float32Array:
5137
- return new Float32();
5001
+ return "float32";
5138
5002
  case Float64Array:
5139
- return new Float64();
5003
+ return "float64";
5140
5004
  default:
5141
- throw new Error("array type not supported");
5005
+ return "null";
5006
+ }
5007
+ }
5008
+
5009
+ // ../schema/src/lib/mesh/mesh-utils.ts
5010
+ function getMeshBoundingBox(attributes) {
5011
+ let minX = Infinity;
5012
+ let minY = Infinity;
5013
+ let minZ = Infinity;
5014
+ let maxX = -Infinity;
5015
+ let maxY = -Infinity;
5016
+ let maxZ = -Infinity;
5017
+ const positions = attributes.POSITION ? attributes.POSITION.value : [];
5018
+ const len = positions && positions.length;
5019
+ for (let i2 = 0; i2 < len; i2 += 3) {
5020
+ const x = positions[i2];
5021
+ const y = positions[i2 + 1];
5022
+ const z = positions[i2 + 2];
5023
+ minX = x < minX ? x : minX;
5024
+ minY = y < minY ? y : minY;
5025
+ minZ = z < minZ ? z : minZ;
5026
+ maxX = x > maxX ? x : maxX;
5027
+ maxY = y > maxY ? y : maxY;
5028
+ maxZ = z > maxZ ? z : maxZ;
5142
5029
  }
5030
+ return [
5031
+ [minX, minY, minZ],
5032
+ [maxX, maxY, maxZ]
5033
+ ];
5143
5034
  }
5144
5035
 
5145
- // ../schema/src/category/mesh/deduce-mesh-schema.ts
5146
- function deduceMeshField(attributeName, attribute, optionalMetadata) {
5147
- const type = getArrowTypeFromTypedArray(attribute.value);
5036
+ // ../schema/src/lib/mesh/deduce-mesh-schema.ts
5037
+ function deduceMeshField(name, attribute, optionalMetadata) {
5038
+ const type = getDataTypeFromTypedArray(attribute.value);
5148
5039
  const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
5149
- const field = new Field(attributeName, new FixedSizeList(attribute.size, new Field("value", type)), false, metadata);
5150
- return field;
5040
+ return {
5041
+ name,
5042
+ type: { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "value", type }] },
5043
+ nullable: false,
5044
+ metadata
5045
+ };
5151
5046
  }
5152
5047
  function makeMeshAttributeMetadata(attribute) {
5153
- const result = new Map();
5048
+ const result = {};
5154
5049
  if ("byteOffset" in attribute) {
5155
- result.set("byteOffset", attribute.byteOffset.toString(10));
5050
+ result.byteOffset = attribute.byteOffset.toString(10);
5156
5051
  }
5157
5052
  if ("byteStride" in attribute) {
5158
- result.set("byteStride", attribute.byteStride.toString(10));
5053
+ result.byteStride = attribute.byteStride.toString(10);
5159
5054
  }
5160
5055
  if ("normalized" in attribute) {
5161
- result.set("normalized", attribute.normalized.toString());
5056
+ result.normalized = attribute.normalized.toString();
5162
5057
  }
5163
5058
  return result;
5164
5059
  }
5165
5060
 
5166
5061
  // ../draco/src/lib/utils/get-draco-schema.ts
5167
5062
  function getDracoSchema(attributes, loaderData, indices) {
5168
- const metadataMap = makeMetadata(loaderData.metadata);
5063
+ const metadata = makeMetadata(loaderData.metadata);
5169
5064
  const fields = [];
5170
5065
  const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);
5171
5066
  for (const attributeName in attributes) {
@@ -5177,7 +5072,7 @@
5177
5072
  const indicesField = getArrowFieldFromAttribute("indices", indices);
5178
5073
  fields.push(indicesField);
5179
5074
  }
5180
- return new Schema(fields, metadataMap);
5075
+ return { fields, metadata };
5181
5076
  }
5182
5077
  function transformAttributesLoaderData(loaderData) {
5183
5078
  const result = {};
@@ -5193,11 +5088,12 @@
5193
5088
  return field;
5194
5089
  }
5195
5090
  function makeMetadata(metadata) {
5196
- const metadataMap = new Map();
5091
+ Object.entries(metadata);
5092
+ const serializedMetadata = {};
5197
5093
  for (const key in metadata) {
5198
- metadataMap.set(`${key}.string`, JSON.stringify(metadata[key]));
5094
+ serializedMetadata[`${key}.string`] = JSON.stringify(metadata[key]);
5199
5095
  }
5200
- return metadataMap;
5096
+ return serializedMetadata;
5201
5097
  }
5202
5098
 
5203
5099
  // ../draco/src/lib/draco-parser.ts
@@ -5541,11 +5437,13 @@
5541
5437
  }
5542
5438
 
5543
5439
  // ../draco/src/lib/draco-module-loader.ts
5544
- var DRACO_VERSION = "1.4.1";
5545
- var DRACO_JS_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_decoder.js`;
5546
- var DRACO_WASM_WRAPPER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_wasm_wrapper.js`;
5547
- var DRACO_WASM_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_decoder.wasm`;
5548
- var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_VERSION}/javascript/draco_encoder.js`;
5440
+ var DRACO_DECODER_VERSION = "1.5.5";
5441
+ var DRACO_ENCODER_VERSION = "1.4.1";
5442
+ var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
5443
+ var DRACO_JS_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.js`;
5444
+ var DRACO_WASM_WRAPPER_URL = `${STATIC_DECODER_URL}/draco_wasm_wrapper.js`;
5445
+ var DRACO_WASM_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.wasm`;
5446
+ var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/draco_encoder.js`;
5549
5447
  var loadDecoderPromise;
5550
5448
  async function loadDracoDecoderModule(options) {
5551
5449
  const modules = options.modules || {};
@@ -5580,10 +5478,10 @@
5580
5478
  if (wasmBinary) {
5581
5479
  options.wasmBinary = wasmBinary;
5582
5480
  }
5583
- return new Promise((resolve) => {
5481
+ return new Promise((resolve2) => {
5584
5482
  DracoDecoderModule({
5585
5483
  ...options,
5586
- onModuleLoaded: (draco) => resolve({ draco })
5484
+ onModuleLoaded: (draco) => resolve2({ draco })
5587
5485
  });
5588
5486
  });
5589
5487
  }
@@ -5604,10 +5502,10 @@
5604
5502
  }
5605
5503
 
5606
5504
  // ../textures/src/lib/utils/version.ts
5607
- var VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
5505
+ var VERSION6 = true ? "4.0.0-alpha.6" : "beta";
5608
5506
 
5609
5507
  // ../textures/src/lib/parsers/basis-module-loader.ts
5610
- var VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
5508
+ var VERSION7 = true ? "4.0.0-alpha.6" : "beta";
5611
5509
  var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.wasm`;
5612
5510
  var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.js`;
5613
5511
  var loadBasisTranscoderPromise;
@@ -5634,11 +5532,11 @@
5634
5532
  if (wasmBinary) {
5635
5533
  options.wasmBinary = wasmBinary;
5636
5534
  }
5637
- return new Promise((resolve) => {
5638
- BasisModule(options).then((module2) => {
5639
- const { BasisFile, initializeBasis } = module2;
5535
+ return new Promise((resolve2) => {
5536
+ BasisModule(options).then((module) => {
5537
+ const { BasisFile, initializeBasis } = module;
5640
5538
  initializeBasis();
5641
- resolve({ BasisFile });
5539
+ resolve2({ BasisFile });
5642
5540
  });
5643
5541
  });
5644
5542
  }
@@ -5666,17 +5564,17 @@
5666
5564
  if (wasmBinary) {
5667
5565
  options.wasmBinary = wasmBinary;
5668
5566
  }
5669
- return new Promise((resolve) => {
5670
- BasisEncoderModule(options).then((module2) => {
5671
- const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module2;
5567
+ return new Promise((resolve2) => {
5568
+ BasisEncoderModule(options).then((module) => {
5569
+ const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module;
5672
5570
  initializeBasis();
5673
- resolve({ BasisFile, KTX2File, BasisEncoder });
5571
+ resolve2({ BasisFile, KTX2File, BasisEncoder });
5674
5572
  });
5675
5573
  });
5676
5574
  }
5677
5575
 
5678
- // ../textures/src/lib/gl-constants.ts
5679
- var GL = {
5576
+ // ../textures/src/lib/gl-extensions.ts
5577
+ var GL_EXTENSIONS_CONSTANTS = {
5680
5578
  COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
5681
5579
  COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
5682
5580
  COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
@@ -5737,6 +5635,43 @@
5737
5635
  COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919
5738
5636
  };
5739
5637
 
5638
+ // ../textures/src/lib/utils/texture-formats.ts
5639
+ var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
5640
+ var WEBGL_EXTENSIONS = {
5641
+ WEBGL_compressed_texture_s3tc: "dxt",
5642
+ WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb",
5643
+ WEBGL_compressed_texture_etc1: "etc1",
5644
+ WEBGL_compressed_texture_etc: "etc2",
5645
+ WEBGL_compressed_texture_pvrtc: "pvrtc",
5646
+ WEBGL_compressed_texture_atc: "atc",
5647
+ WEBGL_compressed_texture_astc: "astc",
5648
+ EXT_texture_compression_rgtc: "rgtc"
5649
+ };
5650
+ var formats = null;
5651
+ function getSupportedGPUTextureFormats(gl) {
5652
+ if (!formats) {
5653
+ gl = gl || getWebGLContext() || void 0;
5654
+ formats = new Set();
5655
+ for (const prefix of BROWSER_PREFIXES) {
5656
+ for (const extension in WEBGL_EXTENSIONS) {
5657
+ if (gl && gl.getExtension(`${prefix}${extension}`)) {
5658
+ const gpuTextureFormat = WEBGL_EXTENSIONS[extension];
5659
+ formats.add(gpuTextureFormat);
5660
+ }
5661
+ }
5662
+ }
5663
+ }
5664
+ return formats;
5665
+ }
5666
+ function getWebGLContext() {
5667
+ try {
5668
+ const canvas = document.createElement("canvas");
5669
+ return canvas.getContext("webgl");
5670
+ } catch (error) {
5671
+ return null;
5672
+ }
5673
+ }
5674
+
5740
5675
  // ../../node_modules/ktx-parse/dist/ktx-parse.modern.js
5741
5676
  var t = new Uint8Array([0]);
5742
5677
  var e = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
@@ -5871,72 +5806,72 @@
5871
5806
 
5872
5807
  // ../textures/src/lib/utils/ktx-format-helper.ts
5873
5808
  var VULKAN_TO_WEBGL_FORMAT_MAP = {
5874
- 131: GL.COMPRESSED_RGB_S3TC_DXT1_EXT,
5875
- 132: GL.COMPRESSED_SRGB_S3TC_DXT1_EXT,
5876
- 133: GL.COMPRESSED_RGBA_S3TC_DXT1_EXT,
5877
- 134: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
5878
- 135: GL.COMPRESSED_RGBA_S3TC_DXT3_EXT,
5879
- 136: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
5880
- 137: GL.COMPRESSED_RGBA_S3TC_DXT5_EXT,
5881
- 138: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
5882
- 139: GL.COMPRESSED_RED_RGTC1_EXT,
5883
- 140: GL.COMPRESSED_SIGNED_RED_RGTC1_EXT,
5884
- 141: GL.COMPRESSED_RED_GREEN_RGTC2_EXT,
5885
- 142: GL.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
5886
- 147: GL.COMPRESSED_RGB8_ETC2,
5887
- 148: GL.COMPRESSED_SRGB8_ETC2,
5888
- 149: GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
5889
- 150: GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
5890
- 151: GL.COMPRESSED_RGBA8_ETC2_EAC,
5891
- 152: GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
5892
- 153: GL.COMPRESSED_R11_EAC,
5893
- 154: GL.COMPRESSED_SIGNED_R11_EAC,
5894
- 155: GL.COMPRESSED_RG11_EAC,
5895
- 156: GL.COMPRESSED_SIGNED_RG11_EAC,
5896
- 157: GL.COMPRESSED_RGBA_ASTC_4x4_KHR,
5897
- 158: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
5898
- 159: GL.COMPRESSED_RGBA_ASTC_5x4_KHR,
5899
- 160: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,
5900
- 161: GL.COMPRESSED_RGBA_ASTC_5x5_KHR,
5901
- 162: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
5902
- 163: GL.COMPRESSED_RGBA_ASTC_6x5_KHR,
5903
- 164: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
5904
- 165: GL.COMPRESSED_RGBA_ASTC_6x6_KHR,
5905
- 166: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
5906
- 167: GL.COMPRESSED_RGBA_ASTC_8x5_KHR,
5907
- 168: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
5908
- 169: GL.COMPRESSED_RGBA_ASTC_8x6_KHR,
5909
- 170: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
5910
- 171: GL.COMPRESSED_RGBA_ASTC_8x8_KHR,
5911
- 172: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
5912
- 173: GL.COMPRESSED_RGBA_ASTC_10x5_KHR,
5913
- 174: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
5914
- 175: GL.COMPRESSED_RGBA_ASTC_10x6_KHR,
5915
- 176: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
5916
- 177: GL.COMPRESSED_RGBA_ASTC_10x8_KHR,
5917
- 178: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
5918
- 179: GL.COMPRESSED_RGBA_ASTC_10x10_KHR,
5919
- 180: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
5920
- 181: GL.COMPRESSED_RGBA_ASTC_12x10_KHR,
5921
- 182: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
5922
- 183: GL.COMPRESSED_RGBA_ASTC_12x12_KHR,
5923
- 184: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
5924
- 1000054e3: GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
5925
- 1000054001: GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
5926
- 1000066e3: GL.COMPRESSED_RGBA_ASTC_4x4_KHR,
5927
- 1000066001: GL.COMPRESSED_RGBA_ASTC_5x4_KHR,
5928
- 1000066002: GL.COMPRESSED_RGBA_ASTC_5x5_KHR,
5929
- 1000066003: GL.COMPRESSED_RGBA_ASTC_6x5_KHR,
5930
- 1000066004: GL.COMPRESSED_RGBA_ASTC_6x6_KHR,
5931
- 1000066005: GL.COMPRESSED_RGBA_ASTC_8x5_KHR,
5932
- 1000066006: GL.COMPRESSED_RGBA_ASTC_8x6_KHR,
5933
- 1000066007: GL.COMPRESSED_RGBA_ASTC_8x8_KHR,
5934
- 1000066008: GL.COMPRESSED_RGBA_ASTC_10x5_KHR,
5935
- 1000066009: GL.COMPRESSED_RGBA_ASTC_10x6_KHR,
5936
- 1000066010: GL.COMPRESSED_RGBA_ASTC_10x8_KHR,
5937
- 1000066011: GL.COMPRESSED_RGBA_ASTC_10x10_KHR,
5938
- 1000066012: GL.COMPRESSED_RGBA_ASTC_12x10_KHR,
5939
- 1000066013: GL.COMPRESSED_RGBA_ASTC_12x12_KHR
5809
+ 131: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT,
5810
+ 132: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_S3TC_DXT1_EXT,
5811
+ 133: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT1_EXT,
5812
+ 134: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
5813
+ 135: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT,
5814
+ 136: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
5815
+ 137: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
5816
+ 138: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
5817
+ 139: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RED_RGTC1_EXT,
5818
+ 140: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RED_RGTC1_EXT,
5819
+ 141: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RED_GREEN_RGTC2_EXT,
5820
+ 142: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
5821
+ 147: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_ETC2,
5822
+ 148: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ETC2,
5823
+ 149: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
5824
+ 150: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
5825
+ 151: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA8_ETC2_EAC,
5826
+ 152: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
5827
+ 153: GL_EXTENSIONS_CONSTANTS.COMPRESSED_R11_EAC,
5828
+ 154: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_R11_EAC,
5829
+ 155: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RG11_EAC,
5830
+ 156: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RG11_EAC,
5831
+ 157: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
5832
+ 158: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
5833
+ 159: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
5834
+ 160: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,
5835
+ 161: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
5836
+ 162: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
5837
+ 163: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
5838
+ 164: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
5839
+ 165: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
5840
+ 166: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
5841
+ 167: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
5842
+ 168: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
5843
+ 169: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
5844
+ 170: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
5845
+ 171: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
5846
+ 172: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
5847
+ 173: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
5848
+ 174: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
5849
+ 175: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
5850
+ 176: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
5851
+ 177: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
5852
+ 178: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
5853
+ 179: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
5854
+ 180: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
5855
+ 181: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
5856
+ 182: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
5857
+ 183: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR,
5858
+ 184: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
5859
+ 1000054e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
5860
+ 1000054001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
5861
+ 1000066e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
5862
+ 1000066001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
5863
+ 1000066002: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
5864
+ 1000066003: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
5865
+ 1000066004: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
5866
+ 1000066005: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
5867
+ 1000066006: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
5868
+ 1000066007: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
5869
+ 1000066008: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
5870
+ 1000066009: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
5871
+ 1000066010: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
5872
+ 1000066011: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
5873
+ 1000066012: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
5874
+ 1000066013: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR
5940
5875
  };
5941
5876
  function mapVkFormatToWebGL(vkFormat) {
5942
5877
  return VULKAN_TO_WEBGL_FORMAT_MAP[vkFormat];
@@ -5978,19 +5913,43 @@
5978
5913
  });
5979
5914
  }
5980
5915
 
5981
- // ../textures/src/lib/parsers/parse-basis.js
5916
+ // ../textures/src/lib/parsers/parse-basis.ts
5982
5917
  var OutputFormat = {
5983
- etc1: { basisFormat: 0, compressed: true, format: GL.COMPRESSED_RGB_ETC1_WEBGL },
5918
+ etc1: {
5919
+ basisFormat: 0,
5920
+ compressed: true,
5921
+ format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL
5922
+ },
5984
5923
  etc2: { basisFormat: 1, compressed: true },
5985
- bc1: { basisFormat: 2, compressed: true, format: GL.COMPRESSED_RGB_S3TC_DXT1_EXT },
5986
- bc3: { basisFormat: 3, compressed: true, format: GL.COMPRESSED_RGBA_S3TC_DXT5_EXT },
5924
+ bc1: {
5925
+ basisFormat: 2,
5926
+ compressed: true,
5927
+ format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT
5928
+ },
5929
+ bc3: {
5930
+ basisFormat: 3,
5931
+ compressed: true,
5932
+ format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT
5933
+ },
5987
5934
  bc4: { basisFormat: 4, compressed: true },
5988
5935
  bc5: { basisFormat: 5, compressed: true },
5989
5936
  "bc7-m6-opaque-only": { basisFormat: 6, compressed: true },
5990
5937
  "bc7-m5": { basisFormat: 7, compressed: true },
5991
- "pvrtc1-4-rgb": { basisFormat: 8, compressed: true, format: GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG },
5992
- "pvrtc1-4-rgba": { basisFormat: 9, compressed: true, format: GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG },
5993
- "astc-4x4": { basisFormat: 10, compressed: true, format: GL.COMPRESSED_RGBA_ASTC_4X4_KHR },
5938
+ "pvrtc1-4-rgb": {
5939
+ basisFormat: 8,
5940
+ compressed: true,
5941
+ format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG
5942
+ },
5943
+ "pvrtc1-4-rgba": {
5944
+ basisFormat: 9,
5945
+ compressed: true,
5946
+ format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
5947
+ },
5948
+ "astc-4x4": {
5949
+ basisFormat: 10,
5950
+ compressed: true,
5951
+ format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR
5952
+ },
5994
5953
  "atc-rgb": { basisFormat: 11, compressed: true },
5995
5954
  "atc-rgba-interpolated-alpha": { basisFormat: 12, compressed: true },
5996
5955
  rgba32: { basisFormat: 13, compressed: false },
@@ -6027,7 +5986,7 @@
6027
5986
  const basisFile = new BasisFile(new Uint8Array(data));
6028
5987
  try {
6029
5988
  if (!basisFile.startTranscoding()) {
6030
- return null;
5989
+ throw new Error("Failed to start basis transcoding");
6031
5990
  }
6032
5991
  const imageCount = basisFile.getNumImages();
6033
5992
  const images = [];
@@ -6053,22 +6012,22 @@
6053
6012
  const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
6054
6013
  const decodedData = new Uint8Array(decodedSize);
6055
6014
  if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
6056
- return null;
6015
+ throw new Error("failed to start Basis transcoding");
6057
6016
  }
6058
6017
  return {
6059
6018
  width,
6060
6019
  height,
6061
6020
  data: decodedData,
6062
6021
  compressed,
6063
- hasAlpha,
6064
- format
6022
+ format,
6023
+ hasAlpha
6065
6024
  };
6066
6025
  }
6067
6026
  function parseKTX2File(KTX2File, data, options) {
6068
6027
  const ktx2File = new KTX2File(new Uint8Array(data));
6069
6028
  try {
6070
6029
  if (!ktx2File.startTranscoding()) {
6071
- return null;
6030
+ throw new Error("failed to start KTX2 transcoding");
6072
6031
  }
6073
6032
  const levelsCount = ktx2File.getLevels();
6074
6033
  const levels = [];
@@ -6076,7 +6035,7 @@
6076
6035
  levels.push(transcodeKTX2Image(ktx2File, levelIndex, options));
6077
6036
  break;
6078
6037
  }
6079
- return levels;
6038
+ return [levels];
6080
6039
  } finally {
6081
6040
  ktx2File.close();
6082
6041
  ktx2File.delete();
@@ -6088,14 +6047,15 @@
6088
6047
  const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
6089
6048
  const decodedData = new Uint8Array(decodedSize);
6090
6049
  if (!ktx2File.transcodeImage(decodedData, levelIndex, 0, 0, basisFormat, 0, -1, -1)) {
6091
- return null;
6050
+ throw new Error("Failed to transcode KTX2 image");
6092
6051
  }
6093
6052
  return {
6094
6053
  width,
6095
6054
  height,
6096
6055
  data: decodedData,
6097
6056
  compressed,
6098
- alphaFlag,
6057
+ levelSize: decodedSize,
6058
+ hasAlpha: alphaFlag,
6099
6059
  format
6100
6060
  };
6101
6061
  }
@@ -6135,7 +6095,7 @@
6135
6095
  // ../textures/src/basis-loader.ts
6136
6096
  var BasisWorkerLoader = {
6137
6097
  name: "Basis",
6138
- id: "basis",
6098
+ id: isBrowser2 ? "basis" : "basis-nodejs",
6139
6099
  module: "textures",
6140
6100
  version: VERSION6,
6141
6101
  worker: true,
@@ -6173,12 +6133,12 @@
6173
6133
  DDPF_FOURCC: 4
6174
6134
  };
6175
6135
  var DDS_PIXEL_FORMATS = {
6176
- DXT1: GL.COMPRESSED_RGB_S3TC_DXT1_EXT,
6177
- DXT3: GL.COMPRESSED_RGBA_S3TC_DXT3_EXT,
6178
- DXT5: GL.COMPRESSED_RGBA_S3TC_DXT5_EXT,
6179
- "ATC ": GL.COMPRESSED_RGB_ATC_WEBGL,
6180
- ATCA: GL.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
6181
- ATCI: GL.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL
6136
+ DXT1: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT,
6137
+ DXT3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT,
6138
+ DXT5: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
6139
+ "ATC ": GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ATC_WEBGL,
6140
+ ATCA: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
6141
+ ATCI: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL
6182
6142
  };
6183
6143
  var getATCLevelSize = getDxt1LevelSize;
6184
6144
  var getATCALevelSize = getDxtXLevelSize;
@@ -6245,33 +6205,75 @@
6245
6205
  METADATA_SIZE_INDEX: 12
6246
6206
  };
6247
6207
  var PVR_PIXEL_FORMATS = {
6248
- 0: [GL.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],
6249
- 1: [GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],
6250
- 2: [GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],
6251
- 3: [GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],
6252
- 6: [GL.COMPRESSED_RGB_ETC1_WEBGL],
6253
- 7: [GL.COMPRESSED_RGB_S3TC_DXT1_EXT],
6254
- 9: [GL.COMPRESSED_RGBA_S3TC_DXT3_EXT],
6255
- 11: [GL.COMPRESSED_RGBA_S3TC_DXT5_EXT],
6256
- 22: [GL.COMPRESSED_RGB8_ETC2],
6257
- 23: [GL.COMPRESSED_RGBA8_ETC2_EAC],
6258
- 24: [GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],
6259
- 25: [GL.COMPRESSED_R11_EAC],
6260
- 26: [GL.COMPRESSED_RG11_EAC],
6261
- 27: [GL.COMPRESSED_RGBA_ASTC_4X4_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],
6262
- 28: [GL.COMPRESSED_RGBA_ASTC_5X4_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],
6263
- 29: [GL.COMPRESSED_RGBA_ASTC_5X5_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],
6264
- 30: [GL.COMPRESSED_RGBA_ASTC_6X5_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],
6265
- 31: [GL.COMPRESSED_RGBA_ASTC_6X6_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],
6266
- 32: [GL.COMPRESSED_RGBA_ASTC_8X5_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],
6267
- 33: [GL.COMPRESSED_RGBA_ASTC_8X6_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],
6268
- 34: [GL.COMPRESSED_RGBA_ASTC_8X8_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],
6269
- 35: [GL.COMPRESSED_RGBA_ASTC_10X5_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],
6270
- 36: [GL.COMPRESSED_RGBA_ASTC_10X6_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],
6271
- 37: [GL.COMPRESSED_RGBA_ASTC_10X8_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],
6272
- 38: [GL.COMPRESSED_RGBA_ASTC_10X10_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],
6273
- 39: [GL.COMPRESSED_RGBA_ASTC_12X10_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],
6274
- 40: [GL.COMPRESSED_RGBA_ASTC_12X12_KHR, GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]
6208
+ 0: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],
6209
+ 1: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],
6210
+ 2: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],
6211
+ 3: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],
6212
+ 6: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL],
6213
+ 7: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT],
6214
+ 9: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT],
6215
+ 11: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT],
6216
+ 22: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_ETC2],
6217
+ 23: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA8_ETC2_EAC],
6218
+ 24: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],
6219
+ 25: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_R11_EAC],
6220
+ 26: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RG11_EAC],
6221
+ 27: [
6222
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR,
6223
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR
6224
+ ],
6225
+ 28: [
6226
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5X4_KHR,
6227
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR
6228
+ ],
6229
+ 29: [
6230
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5X5_KHR,
6231
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR
6232
+ ],
6233
+ 30: [
6234
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6X5_KHR,
6235
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR
6236
+ ],
6237
+ 31: [
6238
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6X6_KHR,
6239
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR
6240
+ ],
6241
+ 32: [
6242
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X5_KHR,
6243
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR
6244
+ ],
6245
+ 33: [
6246
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X6_KHR,
6247
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR
6248
+ ],
6249
+ 34: [
6250
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X8_KHR,
6251
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR
6252
+ ],
6253
+ 35: [
6254
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X5_KHR,
6255
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR
6256
+ ],
6257
+ 36: [
6258
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X6_KHR,
6259
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR
6260
+ ],
6261
+ 37: [
6262
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X8_KHR,
6263
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR
6264
+ ],
6265
+ 38: [
6266
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X10_KHR,
6267
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR
6268
+ ],
6269
+ 39: [
6270
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12X10_KHR,
6271
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR
6272
+ ],
6273
+ 40: [
6274
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12X12_KHR,
6275
+ GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR
6276
+ ]
6275
6277
  };
6276
6278
  var PVR_SIZE_FUNCTIONS = {
6277
6279
  0: pvrtc2bppSize,
@@ -6439,48 +6441,30 @@
6439
6441
  containerFormat: "ktx2",
6440
6442
  module: "encoder"
6441
6443
  };
6442
- return await parseBasis(arrayBuffer, options);
6444
+ return (await parseBasis(arrayBuffer, options))[0];
6443
6445
  }
6444
6446
  return parseCompressedTexture(arrayBuffer);
6445
6447
  }
6446
6448
  };
6447
6449
 
6448
- // ../textures/src/lib/utils/texture-formats.ts
6449
- var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
6450
- var WEBGL_EXTENSIONS = {
6451
- WEBGL_compressed_texture_s3tc: "dxt",
6452
- WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb",
6453
- WEBGL_compressed_texture_etc1: "etc1",
6454
- WEBGL_compressed_texture_etc: "etc2",
6455
- WEBGL_compressed_texture_pvrtc: "pvrtc",
6456
- WEBGL_compressed_texture_atc: "atc",
6457
- WEBGL_compressed_texture_astc: "astc",
6458
- EXT_texture_compression_rgtc: "rgtc"
6459
- };
6460
- var formats = null;
6461
- function getSupportedGPUTextureFormats(gl) {
6462
- if (!formats) {
6463
- gl = gl || getWebGLContext() || void 0;
6464
- formats = new Set();
6465
- for (const prefix of BROWSER_PREFIXES) {
6466
- for (const extension in WEBGL_EXTENSIONS) {
6467
- if (gl && gl.getExtension(`${prefix}${extension}`)) {
6468
- const gpuTextureFormat = WEBGL_EXTENSIONS[extension];
6469
- formats.add(gpuTextureFormat);
6470
- }
6471
- }
6472
- }
6473
- }
6474
- return formats;
6475
- }
6476
- function getWebGLContext() {
6477
- try {
6478
- const canvas = document.createElement("canvas");
6479
- return canvas.getContext("webgl");
6480
- } catch (error) {
6481
- return null;
6482
- }
6483
- }
6450
+ // src/types.ts
6451
+ var DATA_TYPE;
6452
+ (function(DATA_TYPE2) {
6453
+ DATA_TYPE2["UInt8"] = "UInt8";
6454
+ DATA_TYPE2["UInt16"] = "UInt16";
6455
+ DATA_TYPE2["UInt32"] = "UInt32";
6456
+ DATA_TYPE2["UInt64"] = "UInt64";
6457
+ DATA_TYPE2["Int16"] = "Int16";
6458
+ DATA_TYPE2["Int32"] = "Int32";
6459
+ DATA_TYPE2["Int64"] = "Int64";
6460
+ DATA_TYPE2["Float32"] = "Float32";
6461
+ DATA_TYPE2["Float64"] = "Float64";
6462
+ })(DATA_TYPE || (DATA_TYPE = {}));
6463
+ var HeaderAttributeProperty;
6464
+ (function(HeaderAttributeProperty2) {
6465
+ HeaderAttributeProperty2["vertexCount"] = "vertexCount";
6466
+ HeaderAttributeProperty2["featureCount"] = "featureCount";
6467
+ })(HeaderAttributeProperty || (HeaderAttributeProperty = {}));
6484
6468
 
6485
6469
  // src/lib/utils/url-utils.ts
6486
6470
  function getUrlWithToken(url, token = null) {
@@ -6488,7 +6472,7 @@
6488
6472
  }
6489
6473
 
6490
6474
  // ../../node_modules/@luma.gl/constants/dist/esm/index.js
6491
- var esm_default2 = {
6475
+ var esm_default = {
6492
6476
  DEPTH_BUFFER_BIT: 256,
6493
6477
  STENCIL_BUFFER_BIT: 1024,
6494
6478
  COLOR_BUFFER_BIT: 16384,
@@ -7106,79 +7090,246 @@
7106
7090
  };
7107
7091
 
7108
7092
  // src/lib/parsers/constants.ts
7109
- var TYPE_ARRAY_MAP = {
7110
- UInt8: Uint8Array,
7111
- UInt16: Uint16Array,
7112
- UInt32: Uint32Array,
7113
- Float32: Float32Array,
7114
- UInt64: Float64Array
7115
- };
7093
+ function getConstructorForDataFormat(dataType) {
7094
+ switch (dataType) {
7095
+ case DATA_TYPE.UInt8:
7096
+ return Uint8Array;
7097
+ case DATA_TYPE.UInt16:
7098
+ return Uint16Array;
7099
+ case DATA_TYPE.UInt32:
7100
+ return Uint32Array;
7101
+ case DATA_TYPE.Float32:
7102
+ return Float32Array;
7103
+ case DATA_TYPE.UInt64:
7104
+ return Float64Array;
7105
+ default:
7106
+ throw new Error(`parse i3s tile content: unknown type of data: ${dataType}`);
7107
+ }
7108
+ }
7116
7109
  var GL_TYPE_MAP = {
7117
- UInt8: esm_default2.UNSIGNED_BYTE,
7118
- UInt16: esm_default2.UNSIGNED_INT,
7119
- Float32: esm_default2.FLOAT,
7120
- UInt32: esm_default2.UNSIGNED_INT,
7121
- UInt64: esm_default2.DOUBLE
7122
- };
7123
- var I3S_NAMED_VERTEX_ATTRIBUTES = {
7124
- position: "position",
7125
- normal: "normal",
7126
- uv0: "uv0",
7127
- color: "color",
7128
- region: "region"
7129
- };
7130
- var I3S_NAMED_GEOMETRY_ATTRIBUTES = {
7131
- vertexAttributes: "vertexAttributes",
7132
- featureAttributeOrder: "featureAttributeOrder",
7133
- featureAttributes: "featureAttributes"
7134
- };
7135
- var I3S_NAMED_HEADER_ATTRIBUTES = {
7136
- header: "header",
7137
- vertexCount: "vertexCount",
7138
- featureCount: "featureCount"
7110
+ UInt8: esm_default.UNSIGNED_BYTE,
7111
+ UInt16: esm_default.UNSIGNED_SHORT,
7112
+ Float32: esm_default.FLOAT,
7113
+ UInt32: esm_default.UNSIGNED_INT,
7114
+ UInt64: esm_default.DOUBLE
7139
7115
  };
7140
- var SIZEOF = {
7141
- UInt8: 1,
7142
- UInt16: 2,
7143
- UInt32: 4,
7144
- Float32: 4,
7145
- UInt64: 8
7146
- };
7147
- var COORDINATE_SYSTEM = {
7148
- DEFAULT: -1,
7149
- LNGLAT: 1,
7150
- METER_OFFSETS: 2,
7151
- LNGLAT_OFFSETS: 3,
7152
- CARTESIAN: 0
7116
+ function sizeOf(dataType) {
7117
+ switch (dataType) {
7118
+ case DATA_TYPE.UInt8:
7119
+ return 1;
7120
+ case DATA_TYPE.UInt16:
7121
+ case DATA_TYPE.Int16:
7122
+ return 2;
7123
+ case DATA_TYPE.UInt32:
7124
+ case DATA_TYPE.Int32:
7125
+ case DATA_TYPE.Float32:
7126
+ return 4;
7127
+ case DATA_TYPE.UInt64:
7128
+ case DATA_TYPE.Int64:
7129
+ case DATA_TYPE.Float64:
7130
+ return 8;
7131
+ default:
7132
+ throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);
7133
+ }
7134
+ }
7135
+ var STRING_ATTRIBUTE_TYPE = "String";
7136
+ var OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
7137
+ var FLOAT_64_TYPE = "Float64";
7138
+ var INT_16_ATTRIBUTE_TYPE = "Int16";
7139
+ var COORDINATE_SYSTEM;
7140
+ (function(COORDINATE_SYSTEM2) {
7141
+ COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["DEFAULT"] = -1] = "DEFAULT";
7142
+ COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT"] = 1] = "LNGLAT";
7143
+ COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["METER_OFFSETS"] = 2] = "METER_OFFSETS";
7144
+ COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT_OFFSETS"] = 3] = "LNGLAT_OFFSETS";
7145
+ COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["CARTESIAN"] = 0] = "CARTESIAN";
7146
+ })(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
7147
+
7148
+ // src/lib/parsers/parse-i3s-attribute.ts
7149
+ function parseI3STileAttribute(arrayBuffer, options) {
7150
+ const { attributeName, attributeType } = options;
7151
+ if (!attributeName) {
7152
+ return {};
7153
+ }
7154
+ return {
7155
+ [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null
7156
+ };
7157
+ }
7158
+ function parseAttribute(attributeType, arrayBuffer) {
7159
+ switch (attributeType) {
7160
+ case STRING_ATTRIBUTE_TYPE:
7161
+ return parseStringsAttribute(arrayBuffer);
7162
+ case OBJECT_ID_ATTRIBUTE_TYPE:
7163
+ return parseShortNumberAttribute(arrayBuffer);
7164
+ case FLOAT_64_TYPE:
7165
+ return parseFloatAttribute(arrayBuffer);
7166
+ case INT_16_ATTRIBUTE_TYPE:
7167
+ return parseInt16ShortNumberAttribute(arrayBuffer);
7168
+ default:
7169
+ return parseShortNumberAttribute(arrayBuffer);
7170
+ }
7171
+ }
7172
+ function parseShortNumberAttribute(arrayBuffer) {
7173
+ const countOffset = 4;
7174
+ return new Uint32Array(arrayBuffer, countOffset);
7175
+ }
7176
+ function parseInt16ShortNumberAttribute(arrayBuffer) {
7177
+ const countOffset = 4;
7178
+ return new Int16Array(arrayBuffer, countOffset);
7179
+ }
7180
+ function parseFloatAttribute(arrayBuffer) {
7181
+ const countOffset = 8;
7182
+ return new Float64Array(arrayBuffer, countOffset);
7183
+ }
7184
+ function parseStringsAttribute(arrayBuffer) {
7185
+ const stringsCountOffset = 0;
7186
+ const dataOffset = 8;
7187
+ const bytesPerStringSize = 4;
7188
+ const stringsArray = [];
7189
+ try {
7190
+ const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);
7191
+ const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
7192
+ let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
7193
+ for (const stringByteSize of stringSizes) {
7194
+ const textDecoder = new TextDecoder("utf-8");
7195
+ const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);
7196
+ stringsArray.push(textDecoder.decode(stringAttribute));
7197
+ stringOffset += stringByteSize;
7198
+ }
7199
+ } catch (error) {
7200
+ console.error("Parse string attribute error: ", error.message);
7201
+ }
7202
+ return stringsArray;
7203
+ }
7204
+
7205
+ // src/i3s-attribute-loader.ts
7206
+ var VERSION8 = true ? "4.0.0-alpha.6" : "latest";
7207
+ var I3SAttributeLoader = {
7208
+ name: "I3S Attribute",
7209
+ id: "i3s-attribute",
7210
+ module: "i3s",
7211
+ version: VERSION8,
7212
+ mimeTypes: ["application/binary"],
7213
+ parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
7214
+ extensions: ["bin"],
7215
+ options: {},
7216
+ binary: true
7153
7217
  };
7218
+ function getAttributeValueType(attribute) {
7219
+ if (attribute.hasOwnProperty("objectIds")) {
7220
+ return "Oid32";
7221
+ } else if (attribute.hasOwnProperty("attributeValues")) {
7222
+ return attribute.attributeValues.valueType;
7223
+ }
7224
+ return "";
7225
+ }
7226
+
7227
+ // src/lib/utils/customizeColors.ts
7228
+ async function customizeColors(colors, featureIds, tileOptions, tilesetOptions, options) {
7229
+ if (!options?.i3s?.colorsByAttribute) {
7230
+ return colors;
7231
+ }
7232
+ const colorizeAttributeField = tilesetOptions.fields.find(({ name }) => name === options?.i3s?.colorsByAttribute?.attributeName);
7233
+ if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(colorizeAttributeField.type)) {
7234
+ return colors;
7235
+ }
7236
+ const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, tileOptions, tilesetOptions, options);
7237
+ if (!colorizeAttributeData) {
7238
+ return colors;
7239
+ }
7240
+ const objectIdField = tilesetOptions.fields.find(({ type }) => type === "esriFieldTypeOID");
7241
+ if (!objectIdField) {
7242
+ return colors;
7243
+ }
7244
+ const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, tileOptions, tilesetOptions, options);
7245
+ if (!objectIdAttributeData) {
7246
+ return colors;
7247
+ }
7248
+ const attributeValuesMap = {};
7249
+ for (let i2 = 0; i2 < objectIdAttributeData[objectIdField.name].length; i2++) {
7250
+ attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i2], options);
7251
+ }
7252
+ for (let i2 = 0; i2 < featureIds.value.length; i2++) {
7253
+ const color = attributeValuesMap[featureIds.value[i2]];
7254
+ if (!color) {
7255
+ continue;
7256
+ }
7257
+ colors.value.set(color, i2 * 4);
7258
+ }
7259
+ return colors;
7260
+ }
7261
+ function calculateColorForAttribute(attributeValue, options) {
7262
+ if (!options?.i3s?.colorsByAttribute) {
7263
+ return [255, 255, 255, 255];
7264
+ }
7265
+ const { minValue, maxValue, minColor, maxColor } = options.i3s.colorsByAttribute;
7266
+ const rate = (attributeValue - minValue) / (maxValue - minValue);
7267
+ const color = [255, 255, 255, 255];
7268
+ for (let i2 = 0; i2 < minColor.length; i2++) {
7269
+ color[i2] = Math.round((maxColor[i2] - minColor[i2]) * rate + minColor[i2]);
7270
+ }
7271
+ return color;
7272
+ }
7273
+ async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attributeStorageInfo }, options) {
7274
+ const attributeIndex = attributeStorageInfo.findIndex(({ name }) => attributeName === name);
7275
+ if (attributeIndex === -1) {
7276
+ return null;
7277
+ }
7278
+ const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);
7279
+ const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);
7280
+ const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {
7281
+ attributeName,
7282
+ attributeType
7283
+ });
7284
+ return objectIdAttributeData;
7285
+ }
7154
7286
 
7155
7287
  // src/lib/parsers/parse-i3s-tile-content.ts
7156
7288
  var scratchVector5 = new Vector3([0, 0, 0]);
7157
- var FORMAT_LOADER_MAP = {
7158
- jpeg: ImageLoader,
7159
- png: ImageLoader,
7160
- "ktx-etc2": CompressedTextureLoader,
7161
- dds: CompressedTextureLoader,
7162
- ktx2: BasisLoader
7163
- };
7289
+ function getLoaderForTextureFormat(textureFormat) {
7290
+ switch (textureFormat) {
7291
+ case "ktx-etc2":
7292
+ case "dds":
7293
+ return CompressedTextureLoader;
7294
+ case "ktx2":
7295
+ return BasisLoader;
7296
+ case "jpg":
7297
+ case "png":
7298
+ default:
7299
+ return ImageLoader;
7300
+ }
7301
+ }
7164
7302
  var I3S_ATTRIBUTE_TYPE = "i3s-attribute-type";
7165
- async function parseI3STileContent(arrayBuffer, tile, tileset, options, context) {
7166
- tile.content = tile.content || {};
7167
- tile.content.featureIds = tile.content.featureIds || null;
7168
- tile.content.featureData = constructFeatureDataStruct(tile, tileset);
7169
- tile.content.attributes = {};
7170
- if (tile.textureUrl) {
7171
- const url = getUrlWithToken(tile.textureUrl, options?.i3s?.token);
7172
- const loader = FORMAT_LOADER_MAP[tile.textureFormat] || ImageLoader;
7173
- const response = await fetch(url);
7303
+ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, options, context) {
7304
+ const content = {
7305
+ attributes: {},
7306
+ indices: null,
7307
+ featureIds: [],
7308
+ vertexCount: 0,
7309
+ modelMatrix: new Matrix4(),
7310
+ coordinateSystem: 0,
7311
+ byteLength: 0,
7312
+ texture: null
7313
+ };
7314
+ if (tileOptions.textureUrl) {
7315
+ const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);
7316
+ const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
7317
+ const response = await fetch(url, options?.fetch);
7174
7318
  const arrayBuffer2 = await response.arrayBuffer();
7175
7319
  if (options?.i3s.decodeTextures) {
7176
7320
  if (loader === ImageLoader) {
7177
- const options2 = { ...tile.textureLoaderOptions, image: { type: "data" } };
7178
- tile.content.texture = await context.parse(arrayBuffer2, options2);
7321
+ const options2 = { ...tileOptions.textureLoaderOptions, image: { type: "data" } };
7322
+ try {
7323
+ content.texture = await context.parse(arrayBuffer2, options2);
7324
+ } catch (e2) {
7325
+ content.texture = await parse(arrayBuffer2, loader, options2);
7326
+ }
7179
7327
  } else if (loader === CompressedTextureLoader || loader === BasisLoader) {
7180
- const texture = await load(arrayBuffer2, loader, tile.textureLoaderOptions);
7181
- tile.content.texture = {
7328
+ let texture = await load(arrayBuffer2, loader, tileOptions.textureLoaderOptions);
7329
+ if (loader === BasisLoader) {
7330
+ texture = texture[0];
7331
+ }
7332
+ content.texture = {
7182
7333
  compressed: true,
7183
7334
  mipmaps: false,
7184
7335
  width: texture[0].width,
@@ -7187,32 +7338,30 @@
7187
7338
  };
7188
7339
  }
7189
7340
  } else {
7190
- tile.content.texture = arrayBuffer2;
7341
+ content.texture = arrayBuffer2;
7191
7342
  }
7192
7343
  }
7193
- tile.content.material = makePbrMaterial(tile.materialDefinition, tile.content.texture);
7194
- if (tile.content.material) {
7195
- tile.content.texture = null;
7344
+ content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);
7345
+ if (content.material) {
7346
+ content.texture = null;
7196
7347
  }
7197
- return await parseI3SNodeGeometry(arrayBuffer, tile, options, context);
7348
+ return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
7198
7349
  }
7199
- async function parseI3SNodeGeometry(arrayBuffer, tile = {}, options, context) {
7200
- if (!tile.content) {
7201
- return tile;
7202
- }
7203
- const content = tile.content;
7350
+ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options) {
7351
+ const contentByteLength = arrayBuffer.byteLength;
7204
7352
  let attributes;
7205
7353
  let vertexCount;
7206
7354
  let byteOffset = 0;
7207
7355
  let featureCount = 0;
7208
- if (tile.isDracoGeometry) {
7356
+ let indices;
7357
+ if (tileOptions.isDracoGeometry) {
7209
7358
  const decompressedGeometry = await parse(arrayBuffer, DracoLoader2, {
7210
7359
  draco: {
7211
7360
  attributeNameEntry: I3S_ATTRIBUTE_TYPE
7212
7361
  }
7213
7362
  });
7214
7363
  vertexCount = decompressedGeometry.header.vertexCount;
7215
- const indices = decompressedGeometry.indices.value;
7364
+ indices = decompressedGeometry.indices?.value;
7216
7365
  const {
7217
7366
  POSITION,
7218
7367
  NORMAL,
@@ -7227,8 +7376,7 @@
7227
7376
  color: COLOR_0,
7228
7377
  uv0: TEXCOORD_0,
7229
7378
  uvRegion,
7230
- id: featureIndex,
7231
- indices
7379
+ id: featureIndex
7232
7380
  };
7233
7381
  updateAttributesMetadata(attributes, decompressedGeometry);
7234
7382
  const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);
@@ -7236,8 +7384,13 @@
7236
7384
  flattenFeatureIdsByFeatureIndices(attributes, featureIds);
7237
7385
  }
7238
7386
  } else {
7239
- const { vertexAttributes, attributesOrder, featureAttributes, featureAttributeOrder } = content.featureData;
7240
- const headers = parseHeaders(content, arrayBuffer);
7387
+ const {
7388
+ vertexAttributes,
7389
+ ordering: attributesOrder,
7390
+ featureAttributes,
7391
+ featureAttributeOrder
7392
+ } = tilesetOptions.store.defaultGeometrySchema;
7393
+ const headers = parseHeaders(arrayBuffer, tilesetOptions);
7241
7394
  byteOffset = headers.byteOffset;
7242
7395
  vertexCount = headers.vertexCount;
7243
7396
  featureCount = headers.featureCount;
@@ -7247,23 +7400,24 @@
7247
7400
  attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
7248
7401
  }
7249
7402
  if (!options?.i3s?.coordinateSystem || options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS) {
7250
- const { enuMatrix } = parsePositions(attributes.position, tile);
7403
+ const enuMatrix = parsePositions(attributes.position, tileOptions);
7251
7404
  content.modelMatrix = enuMatrix.invert();
7252
7405
  content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;
7253
7406
  } else {
7254
7407
  content.modelMatrix = getModelMatrix(attributes.position);
7255
7408
  content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;
7256
7409
  }
7410
+ attributes.color = await customizeColors(attributes.color, attributes.id, tileOptions, tilesetOptions, options);
7257
7411
  content.attributes = {
7258
7412
  positions: attributes.position,
7259
7413
  normals: attributes.normal,
7260
7414
  colors: normalizeAttribute(attributes.color),
7261
7415
  texCoords: attributes.uv0,
7262
- uvRegions: normalizeAttribute(attributes.uvRegion)
7416
+ uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region)
7263
7417
  };
7264
- content.indices = attributes.indices || null;
7418
+ content.indices = indices || null;
7265
7419
  if (attributes.id && attributes.id.value) {
7266
- tile.content.featureIds = attributes.id.value;
7420
+ content.featureIds = attributes.id.value;
7267
7421
  }
7268
7422
  for (const attributeIndex in content.attributes) {
7269
7423
  if (!content.attributes[attributeIndex]) {
@@ -7271,8 +7425,8 @@
7271
7425
  }
7272
7426
  }
7273
7427
  content.vertexCount = vertexCount;
7274
- content.byteLength = arrayBuffer.byteLength;
7275
- return tile;
7428
+ content.byteLength = contentByteLength;
7429
+ return content;
7276
7430
  }
7277
7431
  function updateAttributesMetadata(attributes, decompressedGeometry) {
7278
7432
  for (const key in decompressedGeometry.loaderData.attributes) {
@@ -7299,41 +7453,23 @@
7299
7453
  attribute.normalized = true;
7300
7454
  return attribute;
7301
7455
  }
7302
- function constructFeatureDataStruct(tile, tileset) {
7303
- const defaultGeometrySchema = tileset.store.defaultGeometrySchema;
7304
- const featureData = defaultGeometrySchema;
7305
- for (const geometryAttribute in I3S_NAMED_GEOMETRY_ATTRIBUTES) {
7306
- for (const namedAttribute in I3S_NAMED_VERTEX_ATTRIBUTES) {
7307
- const attribute = defaultGeometrySchema[geometryAttribute][namedAttribute];
7308
- if (attribute) {
7309
- const { byteOffset = 0, count = 0, valueType, valuesPerElement } = attribute;
7310
- featureData[geometryAttribute][namedAttribute] = {
7311
- valueType,
7312
- valuesPerElement,
7313
- byteOffset,
7314
- count
7315
- };
7316
- }
7317
- }
7318
- }
7319
- featureData.attributesOrder = defaultGeometrySchema.ordering;
7320
- return featureData;
7321
- }
7322
- function parseHeaders(content, buffer) {
7456
+ function parseHeaders(arrayBuffer, options) {
7323
7457
  let byteOffset = 0;
7324
7458
  let vertexCount = 0;
7325
7459
  let featureCount = 0;
7326
- const headers = content.featureData[I3S_NAMED_HEADER_ATTRIBUTES.header];
7327
- for (const header in headers) {
7328
- const { property, type } = headers[header];
7329
- const TypedArrayTypeHeader = TYPE_ARRAY_MAP[type];
7330
- if (property === I3S_NAMED_HEADER_ATTRIBUTES.vertexCount) {
7331
- vertexCount = new TypedArrayTypeHeader(buffer, 0, 4)[0];
7332
- byteOffset += SIZEOF[type];
7333
- }
7334
- if (property === I3S_NAMED_HEADER_ATTRIBUTES.featureCount) {
7335
- featureCount = new TypedArrayTypeHeader(buffer, 4, 4)[0];
7336
- byteOffset += SIZEOF[type];
7460
+ for (const { property, type } of options.store.defaultGeometrySchema.header) {
7461
+ const TypedArrayTypeHeader = getConstructorForDataFormat(type);
7462
+ switch (property) {
7463
+ case HeaderAttributeProperty.vertexCount:
7464
+ vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
7465
+ byteOffset += sizeOf(type);
7466
+ break;
7467
+ case HeaderAttributeProperty.featureCount:
7468
+ featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
7469
+ byteOffset += sizeOf(type);
7470
+ break;
7471
+ default:
7472
+ break;
7337
7473
  }
7338
7474
  }
7339
7475
  return {
@@ -7342,38 +7478,38 @@
7342
7478
  byteOffset
7343
7479
  };
7344
7480
  }
7345
- function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder) {
7481
+ function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attributeCount, attributesOrder) {
7346
7482
  const attributes = {};
7347
7483
  for (const attribute of attributesOrder) {
7348
7484
  if (vertexAttributes[attribute]) {
7349
7485
  const { valueType, valuesPerElement } = vertexAttributes[attribute];
7350
- const count = vertexCount;
7351
- if (byteOffset + count * valuesPerElement > arrayBuffer.byteLength) {
7486
+ if (byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <= arrayBuffer.byteLength) {
7487
+ const buffer = arrayBuffer.slice(byteOffset);
7488
+ let value;
7489
+ if (valueType === "UInt64") {
7490
+ value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));
7491
+ } else {
7492
+ const TypedArrayType = getConstructorForDataFormat(valueType);
7493
+ value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);
7494
+ }
7495
+ attributes[attribute] = {
7496
+ value,
7497
+ type: GL_TYPE_MAP[valueType],
7498
+ size: valuesPerElement
7499
+ };
7500
+ switch (attribute) {
7501
+ case "color":
7502
+ attributes.color.normalized = true;
7503
+ break;
7504
+ case "position":
7505
+ case "region":
7506
+ case "normal":
7507
+ default:
7508
+ }
7509
+ byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);
7510
+ } else if (attribute !== "uv0") {
7352
7511
  break;
7353
7512
  }
7354
- const buffer = arrayBuffer.slice(byteOffset);
7355
- let value = [];
7356
- if (valueType === "UInt64") {
7357
- value = parseUint64Values(buffer, count * valuesPerElement, SIZEOF[valueType]);
7358
- } else {
7359
- const TypedArrayType = TYPE_ARRAY_MAP[valueType];
7360
- value = new TypedArrayType(buffer, 0, count * valuesPerElement);
7361
- }
7362
- attributes[attribute] = {
7363
- value,
7364
- type: GL_TYPE_MAP[valueType],
7365
- size: valuesPerElement
7366
- };
7367
- switch (attribute) {
7368
- case "color":
7369
- attributes.color.normalized = true;
7370
- break;
7371
- case "position":
7372
- case "region":
7373
- case "normal":
7374
- default:
7375
- }
7376
- byteOffset = byteOffset + count * valuesPerElement * SIZEOF[valueType];
7377
7513
  }
7378
7514
  }
7379
7515
  return { attributes, byteOffset };
@@ -7389,10 +7525,10 @@
7389
7525
  values.push(value);
7390
7526
  offset += attributeSize;
7391
7527
  }
7392
- return values;
7528
+ return new Uint32Array(values);
7393
7529
  }
7394
- function parsePositions(attribute, tile) {
7395
- const mbs = tile.mbs;
7530
+ function parsePositions(attribute, options) {
7531
+ const mbs = options.mbs;
7396
7532
  const value = attribute.value;
7397
7533
  const metadata = attribute.metadata;
7398
7534
  const enuMatrix = new Matrix4();
@@ -7401,9 +7537,7 @@
7401
7537
  Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
7402
7538
  Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
7403
7539
  attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
7404
- return {
7405
- enuMatrix
7406
- };
7540
+ return enuMatrix;
7407
7541
  }
7408
7542
  function offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {
7409
7543
  const positions = new Float64Array(vertices.length);
@@ -7458,7 +7592,9 @@
7458
7592
  if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {
7459
7593
  pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(pbrMaterial.pbrMetallicRoughness.baseColorFactor);
7460
7594
  }
7461
- setMaterialTexture(pbrMaterial, texture);
7595
+ if (texture) {
7596
+ setMaterialTexture(pbrMaterial, texture);
7597
+ }
7462
7598
  return pbrMaterial;
7463
7599
  }
7464
7600
  function convertColorFormat(colorFactor) {
@@ -7520,17 +7656,17 @@
7520
7656
  attributes.id.value = result;
7521
7657
  }
7522
7658
  function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
7523
- return featureIndex && featureIndex.metadata && featureIndex.metadata["i3s-feature-ids"] && featureIndex.metadata["i3s-feature-ids"].intArray;
7659
+ return featureIndex?.metadata?.["i3s-feature-ids"]?.intArray;
7524
7660
  }
7525
7661
 
7526
7662
  // src/i3s-content-loader.ts
7527
- var VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
7663
+ var VERSION9 = true ? "4.0.0-alpha.6" : "beta";
7528
7664
  var I3SContentLoader = {
7529
7665
  name: "I3S Content (Indexed Scene Layers)",
7530
- id: "i3s-content",
7666
+ id: isBrowser2 ? "i3s-content" : "i3s-content-nodejs",
7531
7667
  module: "i3s",
7532
7668
  worker: true,
7533
- version: VERSION8,
7669
+ version: VERSION9,
7534
7670
  mimeTypes: ["application/octet-stream"],
7535
7671
  parse: parse3,
7536
7672
  extensions: ["bin"],
@@ -7539,9 +7675,13 @@
7539
7675
  }
7540
7676
  };
7541
7677
  async function parse3(data, options, context) {
7542
- const { tile, tileset } = options?.i3s || {};
7543
- await parseI3STileContent(data, tile, tileset, options, context);
7544
- return tile.content;
7678
+ const { tile, _tileOptions, tileset, _tilesetOptions } = options?.i3s || {};
7679
+ const tileOptions = _tileOptions || tile;
7680
+ const tilesetOptions = _tilesetOptions || tileset;
7681
+ if (!tileOptions || !tilesetOptions) {
7682
+ return null;
7683
+ }
7684
+ return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);
7545
7685
  }
7546
7686
 
7547
7687
  // src/workers/i3s-content-worker.ts