@loaders.gl/i3s 4.0.0-alpha.5 → 4.0.0-alpha.7

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 (209) 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.js +2 -2
  5. package/dist/dist.min.js +9390 -8570
  6. package/dist/es5/arcgis-webscene-loader.js +40 -0
  7. package/dist/es5/arcgis-webscene-loader.js.map +1 -0
  8. package/dist/es5/bundle.js +6 -0
  9. package/dist/es5/bundle.js.map +1 -0
  10. package/dist/es5/i3s-attribute-loader.js +195 -0
  11. package/dist/es5/i3s-attribute-loader.js.map +1 -0
  12. package/dist/es5/i3s-building-scene-layer-loader.js +46 -0
  13. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -0
  14. package/dist/es5/i3s-content-loader.js +56 -0
  15. package/dist/es5/i3s-content-loader.js.map +1 -0
  16. package/dist/es5/i3s-loader.js +193 -0
  17. package/dist/es5/i3s-loader.js.map +1 -0
  18. package/dist/es5/i3s-node-page-loader.js +39 -0
  19. package/dist/es5/i3s-node-page-loader.js.map +1 -0
  20. package/dist/es5/i3s-slpk-loader.js +20 -0
  21. package/dist/es5/i3s-slpk-loader.js.map +1 -0
  22. package/dist/es5/index.js +68 -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/parsers/parse-slpk/parse-slpk.js +94 -0
  39. package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js.map +1 -0
  40. package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js +112 -0
  41. package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -0
  42. package/dist/es5/lib/parsers/parse-zip/cd-file-header.js +44 -0
  43. package/dist/es5/lib/parsers/parse-zip/cd-file-header.js.map +1 -0
  44. package/dist/es5/lib/parsers/parse-zip/local-file-header.js +26 -0
  45. package/dist/es5/lib/parsers/parse-zip/local-file-header.js.map +1 -0
  46. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +17 -0
  47. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  48. package/dist/es5/lib/utils/customizeColors.js +159 -0
  49. package/dist/es5/lib/utils/customizeColors.js.map +1 -0
  50. package/dist/es5/lib/utils/url-utils.js +33 -0
  51. package/dist/es5/lib/utils/url-utils.js.map +1 -0
  52. package/dist/es5/types.js +26 -0
  53. package/dist/es5/types.js.map +1 -0
  54. package/dist/es5/workers/i3s-content-worker-node.js +7 -0
  55. package/dist/es5/workers/i3s-content-worker-node.js.map +1 -0
  56. package/dist/es5/workers/i3s-content-worker.js +6 -0
  57. package/dist/es5/workers/i3s-content-worker.js.map +1 -0
  58. package/dist/esm/arcgis-webscene-loader.js +16 -0
  59. package/dist/esm/arcgis-webscene-loader.js.map +1 -0
  60. package/dist/esm/bundle.js +4 -0
  61. package/dist/esm/bundle.js.map +1 -0
  62. package/dist/esm/i3s-attribute-loader.js +119 -0
  63. package/dist/esm/i3s-attribute-loader.js.map +1 -0
  64. package/dist/esm/i3s-building-scene-layer-loader.js +19 -0
  65. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -0
  66. package/dist/esm/i3s-content-loader.js +30 -0
  67. package/dist/esm/i3s-content-loader.js.map +1 -0
  68. package/dist/esm/i3s-loader.js +87 -0
  69. package/dist/esm/i3s-loader.js.map +1 -0
  70. package/dist/esm/i3s-node-page-loader.js +15 -0
  71. package/dist/esm/i3s-node-page-loader.js.map +1 -0
  72. package/dist/esm/i3s-slpk-loader.js +13 -0
  73. package/dist/esm/i3s-slpk-loader.js.map +1 -0
  74. package/dist/esm/index.js +9 -0
  75. package/dist/esm/index.js.map +1 -0
  76. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +198 -0
  77. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
  78. package/dist/esm/lib/parsers/constants.js +57 -0
  79. package/dist/esm/lib/parsers/constants.js.map +1 -0
  80. package/dist/esm/lib/parsers/parse-arcgis-webscene.js +70 -0
  81. package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -0
  82. package/dist/esm/lib/parsers/parse-i3s-attribute.js +60 -0
  83. package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -0
  84. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +39 -0
  85. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
  86. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +435 -0
  87. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -0
  88. package/dist/esm/lib/parsers/parse-i3s.js +83 -0
  89. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -0
  90. package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js +37 -0
  91. package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js.map +1 -0
  92. package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js +58 -0
  93. package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -0
  94. package/dist/esm/lib/parsers/parse-zip/cd-file-header.js +37 -0
  95. package/dist/esm/lib/parsers/parse-zip/cd-file-header.js.map +1 -0
  96. package/dist/esm/lib/parsers/parse-zip/local-file-header.js +19 -0
  97. package/dist/esm/lib/parsers/parse-zip/local-file-header.js.map +1 -0
  98. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js +9 -0
  99. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  100. package/dist/esm/lib/utils/customizeColors.js +92 -0
  101. package/dist/esm/lib/utils/customizeColors.js.map +1 -0
  102. package/dist/esm/lib/utils/url-utils.js +28 -0
  103. package/dist/esm/lib/utils/url-utils.js.map +1 -0
  104. package/dist/esm/types.js +18 -0
  105. package/dist/esm/types.js.map +1 -0
  106. package/dist/esm/workers/i3s-content-worker-node.js +5 -0
  107. package/dist/esm/workers/i3s-content-worker-node.js.map +1 -0
  108. package/dist/esm/workers/i3s-content-worker.js +4 -0
  109. package/dist/esm/workers/i3s-content-worker.js.map +1 -0
  110. package/dist/i3s-attribute-loader.d.ts +9 -2
  111. package/dist/i3s-attribute-loader.d.ts.map +1 -1
  112. package/dist/i3s-attribute-loader.js +155 -132
  113. package/dist/i3s-building-scene-layer-loader.js +23 -18
  114. package/dist/i3s-content-loader.d.ts.map +1 -1
  115. package/dist/i3s-content-loader.js +29 -22
  116. package/dist/i3s-content-worker-node.js +197 -0
  117. package/dist/i3s-content-worker-node.js.map +7 -0
  118. package/dist/i3s-content-worker.js +1178 -1137
  119. package/dist/i3s-loader.d.ts +5 -0
  120. package/dist/i3s-loader.d.ts.map +1 -1
  121. package/dist/i3s-loader.js +88 -83
  122. package/dist/i3s-node-page-loader.d.ts +3 -2
  123. package/dist/i3s-node-page-loader.d.ts.map +1 -1
  124. package/dist/i3s-node-page-loader.js +20 -20
  125. package/dist/i3s-slpk-loader.d.ts +10 -0
  126. package/dist/i3s-slpk-loader.d.ts.map +1 -0
  127. package/dist/i3s-slpk-loader.js +20 -0
  128. package/dist/index.d.ts +5 -2
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +21 -6
  131. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +1 -0
  132. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
  133. package/dist/lib/helpers/i3s-nodepages-tiles.js +231 -228
  134. package/dist/lib/parsers/constants.js +85 -63
  135. package/dist/lib/parsers/parse-arcgis-webscene.d.ts +7 -0
  136. package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -0
  137. package/dist/lib/parsers/parse-arcgis-webscene.js +88 -0
  138. package/dist/lib/parsers/parse-i3s-attribute.d.ts +6 -4
  139. package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -1
  140. package/dist/lib/parsers/parse-i3s-attribute.js +87 -62
  141. package/dist/lib/parsers/parse-i3s-building-scene-layer.js +41 -40
  142. package/dist/lib/parsers/parse-i3s-tile-content.d.ts +2 -2
  143. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  144. package/dist/lib/parsers/parse-i3s-tile-content.js +454 -454
  145. package/dist/lib/parsers/parse-i3s.d.ts +1 -1
  146. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
  147. package/dist/lib/parsers/parse-i3s.js +92 -88
  148. package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts +4 -0
  149. package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -0
  150. package/dist/lib/parsers/parse-slpk/parse-slpk.js +50 -0
  151. package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts +32 -0
  152. package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts.map +1 -0
  153. package/dist/lib/parsers/parse-slpk/slpk-archieve.js +79 -0
  154. package/dist/lib/parsers/parse-zip/cd-file-header.d.ts +38 -0
  155. package/dist/lib/parsers/parse-zip/cd-file-header.d.ts.map +1 -0
  156. package/dist/lib/parsers/parse-zip/cd-file-header.js +48 -0
  157. package/dist/lib/parsers/parse-zip/local-file-header.d.ts +30 -0
  158. package/dist/lib/parsers/parse-zip/local-file-header.d.ts.map +1 -0
  159. package/dist/lib/parsers/parse-zip/local-file-header.js +28 -0
  160. package/dist/lib/utils/convert-i3s-obb-to-mbs.js +19 -8
  161. package/dist/lib/utils/customizeColors.d.ts +14 -0
  162. package/dist/lib/utils/customizeColors.d.ts.map +1 -0
  163. package/dist/lib/utils/customizeColors.js +94 -0
  164. package/dist/lib/utils/url-utils.js +41 -28
  165. package/dist/types.d.ts +518 -97
  166. package/dist/types.d.ts.map +1 -1
  167. package/dist/types.js +18 -19
  168. package/dist/workers/i3s-content-worker-node.d.ts +2 -0
  169. package/dist/workers/i3s-content-worker-node.d.ts.map +1 -0
  170. package/dist/workers/i3s-content-worker-node.js +7 -0
  171. package/dist/workers/i3s-content-worker.js +5 -4
  172. package/package.json +16 -14
  173. package/src/arcgis-webscene-loader.ts +31 -0
  174. package/src/i3s-attribute-loader.ts +9 -9
  175. package/src/i3s-content-loader.ts +17 -5
  176. package/src/i3s-loader.ts +22 -13
  177. package/src/i3s-node-page-loader.ts +6 -10
  178. package/src/i3s-slpk-loader.ts +25 -0
  179. package/src/index.ts +22 -5
  180. package/src/lib/helpers/i3s-nodepages-tiles.ts +14 -3
  181. package/src/lib/parsers/constants.ts +1 -1
  182. package/src/lib/parsers/parse-arcgis-webscene.ts +102 -0
  183. package/src/lib/parsers/parse-i3s-attribute.ts +21 -14
  184. package/src/lib/parsers/parse-i3s-tile-content.ts +99 -76
  185. package/src/lib/parsers/parse-i3s.ts +8 -3
  186. package/src/lib/parsers/parse-slpk/parse-slpk.ts +61 -0
  187. package/src/lib/parsers/parse-slpk/slpk-archieve.ts +108 -0
  188. package/src/lib/parsers/parse-zip/cd-file-header.ts +93 -0
  189. package/src/lib/parsers/parse-zip/local-file-header.ts +56 -0
  190. package/src/lib/utils/customizeColors.ts +134 -0
  191. package/src/types.ts +482 -33
  192. package/src/workers/i3s-content-worker-node.ts +6 -0
  193. package/dist/bundle.js.map +0 -1
  194. package/dist/i3s-attribute-loader.js.map +0 -1
  195. package/dist/i3s-building-scene-layer-loader.js.map +0 -1
  196. package/dist/i3s-content-loader.js.map +0 -1
  197. package/dist/i3s-loader.js.map +0 -1
  198. package/dist/i3s-node-page-loader.js.map +0 -1
  199. package/dist/index.js.map +0 -1
  200. package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
  201. package/dist/lib/parsers/constants.js.map +0 -1
  202. package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
  203. package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
  204. package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
  205. package/dist/lib/parsers/parse-i3s.js.map +0 -1
  206. package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
  207. package/dist/lib/utils/url-utils.js.map +0 -1
  208. package/dist/types.js.map +0 -1
  209. package/dist/workers/i3s-content-worker.js.map +0 -1
@@ -14,16 +14,16 @@
14
14
  for (var name in all)
15
15
  __defProp(target, name, { get: all[name], enumerable: true });
16
16
  };
17
- var __reExport = (target, module2, desc) => {
18
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
19
- for (let key of __getOwnPropNames(module2))
17
+ var __reExport = (target, module, desc) => {
18
+ if (module && typeof module === "object" || typeof module === "function") {
19
+ for (let key of __getOwnPropNames(module))
20
20
  if (!__hasOwnProp.call(target, key) && key !== "default")
21
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
21
+ __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
22
22
  }
23
23
  return target;
24
24
  };
25
- var __toModule = (module2) => {
26
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
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
27
  };
28
28
 
29
29
  // (disabled):../worker-utils/src/lib/node/require-utils.node
@@ -55,7 +55,7 @@
55
55
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
56
56
 
57
57
  // ../worker-utils/src/lib/env-utils/version.ts
58
- var VERSION = true ? "4.0.0-alpha.5" : DEFAULT_VERSION;
58
+ var VERSION = true ? "4.0.0-alpha.7" : DEFAULT_VERSION;
59
59
  if (false) {
60
60
  console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
61
61
  }
@@ -87,15 +87,15 @@
87
87
  // ../worker-utils/src/lib/worker-farm/worker-job.ts
88
88
  var WorkerJob = class {
89
89
  constructor(jobName, workerThread) {
90
- this.name = jobName;
91
- this.workerThread = workerThread;
92
90
  this.isRunning = true;
93
91
  this._resolve = () => {
94
92
  };
95
93
  this._reject = () => {
96
94
  };
97
- this.result = new Promise((resolve, reject) => {
98
- this._resolve = resolve;
95
+ this.name = jobName;
96
+ this.workerThread = workerThread;
97
+ this.result = new Promise((resolve2, reject) => {
98
+ this._resolve = resolve2;
99
99
  this._reject = reject;
100
100
  });
101
101
  }
@@ -118,6 +118,12 @@
118
118
  }
119
119
  };
120
120
 
121
+ // ../worker-utils/src/lib/node/worker_threads-browser.ts
122
+ var Worker2 = class {
123
+ terminate() {
124
+ }
125
+ };
126
+
121
127
  // ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
122
128
  var workerURLCache = new Map();
123
129
  function getLoadableWorkerURL(props) {
@@ -205,10 +211,10 @@
205
211
  this.url = url;
206
212
  this.onMessage = NOOP;
207
213
  this.onError = (error) => console.log(error);
208
- this.worker = this._createBrowserWorker();
214
+ this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
209
215
  }
210
216
  static isSupported() {
211
- return typeof Worker !== "undefined";
217
+ return typeof Worker !== "undefined" && isBrowser2 || typeof Worker2 !== "undefined" && !isBrowser2;
212
218
  }
213
219
  destroy() {
214
220
  this.onMessage = NOOP;
@@ -251,6 +257,27 @@
251
257
  worker.onmessageerror = (event) => console.error(event);
252
258
  return worker;
253
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
+ }
254
281
  };
255
282
 
256
283
  // ../worker-utils/src/lib/worker-farm/worker-pool.ts
@@ -271,6 +298,9 @@
271
298
  this.url = props.url;
272
299
  this.setProps(props);
273
300
  }
301
+ static isSupported() {
302
+ return WorkerThread.isSupported();
303
+ }
274
304
  destroy() {
275
305
  this.idleQueue.forEach((worker) => worker.destroy());
276
306
  this.isDestroyed = true;
@@ -329,7 +359,7 @@
329
359
  }
330
360
  }
331
361
  returnWorkerToQueue(worker) {
332
- const shouldDestroyWorker = this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency();
362
+ const shouldDestroyWorker = !isBrowser2 || this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency();
333
363
  if (shouldDestroyWorker) {
334
364
  worker.destroy();
335
365
  this.count--;
@@ -360,9 +390,9 @@
360
390
  var DEFAULT_PROPS = {
361
391
  maxConcurrency: 3,
362
392
  maxMobileConcurrency: 1,
393
+ reuseWorkers: true,
363
394
  onDebug: () => {
364
- },
365
- reuseWorkers: true
395
+ }
366
396
  };
367
397
  var WorkerFarm = class {
368
398
  constructor(props) {
@@ -383,6 +413,7 @@
383
413
  for (const workerPool of this.workerPools.values()) {
384
414
  workerPool.destroy();
385
415
  }
416
+ this.workerPools = new Map();
386
417
  }
387
418
  setProps(props) {
388
419
  this.props = { ...this.props, ...props };
@@ -415,16 +446,33 @@
415
446
  };
416
447
 
417
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
+ }
418
458
  var onMessageWrapperMap = new Map();
419
459
  var WorkerBody = class {
460
+ static inWorkerThread() {
461
+ return typeof self !== "undefined" || Boolean(getParentPort());
462
+ }
420
463
  static set onmessage(onMessage2) {
421
- self.onmessage = (message) => {
422
- if (!isKnownMessage(message)) {
423
- return;
424
- }
425
- const { type, payload } = message.data;
464
+ function handleMessage(message) {
465
+ const parentPort3 = getParentPort();
466
+ const { type, payload } = parentPort3 ? message : message.data;
426
467
  onMessage2(type, payload);
427
- };
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
+ }
428
476
  }
429
477
  static addEventListener(onMessage2) {
430
478
  let onMessageWrapper = onMessageWrapperMap.get(onMessage2);
@@ -433,22 +481,36 @@
433
481
  if (!isKnownMessage(message)) {
434
482
  return;
435
483
  }
436
- const { type, payload } = message.data;
484
+ const parentPort3 = getParentPort();
485
+ const { type, payload } = parentPort3 ? message : message.data;
437
486
  onMessage2(type, payload);
438
487
  };
439
488
  }
440
- self.addEventListener("message", onMessageWrapper);
489
+ const parentPort2 = getParentPort();
490
+ if (parentPort2) {
491
+ console.error("not implemented");
492
+ } else {
493
+ globalThis.addEventListener("message", onMessageWrapper);
494
+ }
441
495
  }
442
496
  static removeEventListener(onMessage2) {
443
497
  const onMessageWrapper = onMessageWrapperMap.get(onMessage2);
444
498
  onMessageWrapperMap.delete(onMessage2);
445
- self.removeEventListener("message", onMessageWrapper);
499
+ const parentPort2 = getParentPort();
500
+ if (parentPort2) {
501
+ console.error("not implemented");
502
+ } else {
503
+ globalThis.removeEventListener("message", onMessageWrapper);
504
+ }
446
505
  }
447
506
  static postMessage(type, payload) {
448
- if (self) {
449
- const data = { source: "loaders.gl", type, payload };
450
- const transferList = getTransferList(payload);
451
- self.postMessage(data, transferList);
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);
452
514
  }
453
515
  }
454
516
  };
@@ -461,7 +523,7 @@
461
523
  var NPM_TAG = "beta";
462
524
  function getWorkerURL(worker, options = {}) {
463
525
  const workerOptions = options[worker.id] || {};
464
- const workerFile = `${worker.id}-worker.js`;
526
+ const workerFile = isBrowser2 ? `${worker.id}-worker.js` : `${worker.id}-worker-node.js`;
465
527
  let url = workerOptions.workerUrl;
466
528
  if (!url && worker.id === "compression") {
467
529
  url = options.workerUrl;
@@ -564,19 +626,20 @@
564
626
  // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
565
627
  var requestId = 0;
566
628
  function createLoaderWorker(loader) {
567
- if (typeof self === "undefined") {
629
+ if (!WorkerBody.inWorkerThread()) {
568
630
  return;
569
631
  }
570
632
  WorkerBody.onmessage = async (type, payload) => {
571
633
  switch (type) {
572
634
  case "process":
573
635
  try {
574
- const { input, options = {} } = payload;
636
+ const { input, options = {}, context = {} } = payload;
575
637
  const result = await parseData({
576
638
  loader,
577
639
  arrayBuffer: input,
578
640
  options,
579
641
  context: {
642
+ ...context,
580
643
  parse: parseOnMainThread
581
644
  }
582
645
  });
@@ -591,7 +654,7 @@
591
654
  };
592
655
  }
593
656
  function parseOnMainThread(arrayBuffer, options) {
594
- return new Promise((resolve, reject) => {
657
+ return new Promise((resolve2, reject) => {
595
658
  const id = requestId++;
596
659
  const onMessage2 = (type, payload2) => {
597
660
  if (payload2.id !== id) {
@@ -600,7 +663,7 @@
600
663
  switch (type) {
601
664
  case "done":
602
665
  WorkerBody.removeEventListener(onMessage2);
603
- resolve(payload2.result);
666
+ resolve2(payload2.result);
604
667
  break;
605
668
  case "error":
606
669
  WorkerBody.removeEventListener(onMessage2);
@@ -640,6 +703,9 @@
640
703
  if (!WorkerFarm.isSupported()) {
641
704
  return false;
642
705
  }
706
+ if (!isBrowser2 && !options?._nodeWorkers) {
707
+ return false;
708
+ }
643
709
  return loader.worker && options?.worker;
644
710
  }
645
711
  async function parseWithWorker(loader, data, options, context, parseOnMainThread2) {
@@ -648,10 +714,12 @@
648
714
  const workerFarm = WorkerFarm.getWorkerFarm(options);
649
715
  const workerPool = workerFarm.getWorkerPool({ name, url });
650
716
  options = JSON.parse(JSON.stringify(options));
717
+ context = JSON.parse(JSON.stringify(context || {}));
651
718
  const job = await workerPool.startJob("process-on-worker", onMessage.bind(null, parseOnMainThread2));
652
719
  job.postMessage("process", {
653
720
  input: data,
654
- options
721
+ options,
722
+ context
655
723
  });
656
724
  const result = await job.result;
657
725
  return await result.result;
@@ -679,42 +747,7 @@
679
747
  }
680
748
  }
681
749
 
682
- // ../loader-utils/src/lib/binary-utils/buffer-utils.ts
683
- function isBuffer(value) {
684
- return value && typeof value === "object" && value.isBuffer;
685
- }
686
- function bufferToArrayBuffer(buffer) {
687
- if (isBuffer(buffer)) {
688
- const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
689
- return typedArray.slice().buffer;
690
- }
691
- return buffer;
692
- }
693
-
694
750
  // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
695
- function toArrayBuffer(data) {
696
- if (isBuffer(data)) {
697
- return bufferToArrayBuffer(data);
698
- }
699
- if (data instanceof ArrayBuffer) {
700
- return data;
701
- }
702
- if (ArrayBuffer.isView(data)) {
703
- if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
704
- return data.buffer;
705
- }
706
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
707
- }
708
- if (typeof data === "string") {
709
- const text = data;
710
- const uint8Array = new TextEncoder().encode(text);
711
- return uint8Array.buffer;
712
- }
713
- if (data && typeof data === "object" && data._toArrayBuffer) {
714
- return data._toArrayBuffer();
715
- }
716
- throw new Error("toArrayBuffer");
717
- }
718
751
  function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
719
752
  byteLength = byteLength || arrayBuffer1.byteLength;
720
753
  if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
@@ -750,6 +783,52 @@
750
783
  return concatenateArrayBuffers(...arrayBuffers);
751
784
  }
752
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
+
753
832
  // ../loader-utils/src/lib/path-utils/file-aliases.ts
754
833
  var pathPrefix = "";
755
834
  var fileAliases = {};
@@ -766,19 +845,64 @@
766
845
  return filename2;
767
846
  }
768
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
+
769
881
  // ../loader-utils/src/lib/path-utils/path.ts
770
882
  var path_exports = {};
771
883
  __export(path_exports, {
772
884
  dirname: () => dirname,
773
885
  filename: () => filename,
774
- join: () => join
886
+ join: () => join,
887
+ resolve: () => resolve
775
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
776
900
  function filename(url) {
777
- const slashIndex = url && url.lastIndexOf("/");
901
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
778
902
  return slashIndex >= 0 ? url.substr(slashIndex + 1) : "";
779
903
  }
780
904
  function dirname(url) {
781
- const slashIndex = url && url.lastIndexOf("/");
905
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
782
906
  return slashIndex >= 0 ? url.substr(0, slashIndex) : "";
783
907
  }
784
908
  function join(...parts) {
@@ -794,6 +918,108 @@
794
918
  });
795
919
  return parts.join(separator);
796
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
+ }
797
1023
 
798
1024
  // ../core/src/javascript-utils/is-type.ts
799
1025
  var isBoolean = (x) => typeof x === "boolean";
@@ -827,40 +1053,55 @@
827
1053
  return "";
828
1054
  }
829
1055
 
830
- // ../core/src/lib/utils/resource-utils.ts
1056
+ // ../core/src/lib/utils/url-utils.ts
831
1057
  var QUERY_STRING_PATTERN = /\?.*/;
832
- function getResourceUrlAndType(resource) {
1058
+ function extractQueryString(url) {
1059
+ const matches3 = url.match(QUERY_STRING_PATTERN);
1060
+ return matches3 && matches3[0];
1061
+ }
1062
+ function stripQueryString(url) {
1063
+ return url.replace(QUERY_STRING_PATTERN, "");
1064
+ }
1065
+
1066
+ // ../core/src/lib/utils/resource-utils.ts
1067
+ function getResourceUrl(resource) {
833
1068
  if (isResponse(resource)) {
834
- const url = stripQueryString(resource.url || "");
835
- const contentTypeHeader = resource.headers.get("content-type") || "";
836
- return {
837
- url,
838
- type: parseMIMEType(contentTypeHeader) || parseMIMETypeFromURL(url)
839
- };
1069
+ const response = resource;
1070
+ return response.url;
840
1071
  }
841
1072
  if (isBlob(resource)) {
842
- return {
843
- url: stripQueryString(resource.name || ""),
844
- type: resource.type || ""
845
- };
1073
+ const blob = resource;
1074
+ return blob.name || "";
846
1075
  }
847
1076
  if (typeof resource === "string") {
848
- return {
849
- url: stripQueryString(resource),
850
- type: parseMIMETypeFromURL(resource)
851
- };
1077
+ return resource;
852
1078
  }
853
- return {
854
- url: "",
855
- type: ""
856
- };
1079
+ return "";
1080
+ }
1081
+ function getResourceMIMEType(resource) {
1082
+ if (isResponse(resource)) {
1083
+ const response = resource;
1084
+ const contentTypeHeader = response.headers.get("content-type") || "";
1085
+ const noQueryUrl = stripQueryString(response.url);
1086
+ return parseMIMEType(contentTypeHeader) || parseMIMETypeFromURL(noQueryUrl);
1087
+ }
1088
+ if (isBlob(resource)) {
1089
+ const blob = resource;
1090
+ return blob.type || "";
1091
+ }
1092
+ if (typeof resource === "string") {
1093
+ return parseMIMETypeFromURL(resource);
1094
+ }
1095
+ return "";
857
1096
  }
858
1097
  function getResourceContentLength(resource) {
859
1098
  if (isResponse(resource)) {
860
- return resource.headers["content-length"] || -1;
1099
+ const response = resource;
1100
+ return response.headers["content-length"] || -1;
861
1101
  }
862
1102
  if (isBlob(resource)) {
863
- return resource.size;
1103
+ const blob = resource;
1104
+ return blob.size;
864
1105
  }
865
1106
  if (typeof resource === "string") {
866
1107
  return resource.length;
@@ -873,9 +1114,6 @@
873
1114
  }
874
1115
  return -1;
875
1116
  }
876
- function stripQueryString(url) {
877
- return url.replace(QUERY_STRING_PATTERN, "");
878
- }
879
1117
 
880
1118
  // ../core/src/lib/utils/response-utils.ts
881
1119
  async function makeResponse(resource) {
@@ -887,7 +1125,8 @@
887
1125
  if (contentLength >= 0) {
888
1126
  headers["content-length"] = String(contentLength);
889
1127
  }
890
- const { url, type } = getResourceUrlAndType(resource);
1128
+ const url = getResourceUrl(resource);
1129
+ const type = getResourceMIMEType(resource);
891
1130
  if (type) {
892
1131
  headers["content-type"] = type;
893
1132
  }
@@ -917,7 +1156,7 @@
917
1156
  text += ` ${await response.text()}`;
918
1157
  }
919
1158
  message += text;
920
- message = message.length > 60 ? `${message.slice(60)}...` : message;
1159
+ message = message.length > 60 ? `${message.slice(0, 60)}...` : message;
921
1160
  } catch (error) {
922
1161
  }
923
1162
  return message;
@@ -929,9 +1168,9 @@
929
1168
  }
930
1169
  if (resource instanceof Blob) {
931
1170
  const blobSlice = resource.slice(0, 5);
932
- return await new Promise((resolve) => {
1171
+ return await new Promise((resolve2) => {
933
1172
  const reader = new FileReader();
934
- reader.onload = (event) => resolve(event?.target?.result);
1173
+ reader.onload = (event) => resolve2(event?.target?.result);
935
1174
  reader.readAsDataURL(blobSlice);
936
1175
  });
937
1176
  }
@@ -964,12 +1203,12 @@
964
1203
  return await makeResponse(url);
965
1204
  }
966
1205
 
967
- // ../../node_modules/probe.gl/dist/esm/env/is-electron.js
1206
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
968
1207
  function isElectron(mockUserAgent) {
969
1208
  if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
970
1209
  return true;
971
1210
  }
972
- if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions.electron)) {
1211
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
973
1212
  return true;
974
1213
  }
975
1214
  const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
@@ -980,31 +1219,25 @@
980
1219
  return false;
981
1220
  }
982
1221
 
983
- // ../../node_modules/probe.gl/dist/esm/env/is-browser.js
1222
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
984
1223
  function isBrowser3() {
985
1224
  const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
986
1225
  return !isNode || isElectron();
987
1226
  }
988
1227
 
989
- // ../../node_modules/probe.gl/dist/esm/env/globals.js
990
- var globals3 = {
991
- self: typeof self !== "undefined" && self,
992
- window: typeof window !== "undefined" && window,
993
- global: typeof global !== "undefined" && global,
994
- document: typeof document !== "undefined" && document,
995
- process: typeof process === "object" && process
996
- };
997
- var self_3 = globals3.self || globals3.window || globals3.global;
998
- var window_3 = globals3.window || globals3.self || globals3.global;
999
- var global_3 = globals3.global || globals3.self || globals3.window;
1000
- var document_3 = globals3.document || {};
1001
- var process_ = globals3.process || {};
1002
-
1003
- // ../../node_modules/probe.gl/dist/esm/utils/globals.js
1004
- var VERSION3 = true ? "4.0.0-alpha.5" : "untranspiled source";
1228
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
1229
+ var self_3 = globalThis.self || globalThis.window || globalThis.global;
1230
+ var window_3 = globalThis.window || globalThis.self || globalThis.global;
1231
+ var document_3 = globalThis.document || {};
1232
+ var process_ = globalThis.process || {};
1233
+ var console_ = globalThis.console;
1234
+ var navigator_ = globalThis.navigator || {};
1235
+
1236
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
1237
+ var VERSION3 = true ? "4.0.0-alpha.7" : "untranspiled source";
1005
1238
  var isBrowser4 = isBrowser3();
1006
1239
 
1007
- // ../../node_modules/probe.gl/dist/esm/utils/local-storage.js
1240
+ // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
1008
1241
  function getStorage(type) {
1009
1242
  try {
1010
1243
  const storage = window[type];
@@ -1017,27 +1250,25 @@
1017
1250
  }
1018
1251
  }
1019
1252
  var LocalStorage = class {
1020
- constructor(id, defaultSettings, type = "sessionStorage") {
1253
+ constructor(id, defaultConfig) {
1254
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
1255
+ _defineProperty(this, "storage", void 0);
1256
+ _defineProperty(this, "id", void 0);
1257
+ _defineProperty(this, "config", void 0);
1021
1258
  this.storage = getStorage(type);
1022
1259
  this.id = id;
1023
- this.config = {};
1024
- Object.assign(this.config, defaultSettings);
1260
+ this.config = defaultConfig;
1025
1261
  this._loadConfiguration();
1026
1262
  }
1027
1263
  getConfiguration() {
1028
1264
  return this.config;
1029
1265
  }
1030
1266
  setConfiguration(configuration) {
1031
- this.config = {};
1032
- return this.updateConfiguration(configuration);
1033
- }
1034
- updateConfiguration(configuration) {
1035
1267
  Object.assign(this.config, configuration);
1036
1268
  if (this.storage) {
1037
1269
  const serialized = JSON.stringify(this.config);
1038
1270
  this.storage.setItem(this.id, serialized);
1039
1271
  }
1040
- return this;
1041
1272
  }
1042
1273
  _loadConfiguration() {
1043
1274
  let configuration = {};
@@ -1050,7 +1281,7 @@
1050
1281
  }
1051
1282
  };
1052
1283
 
1053
- // ../../node_modules/probe.gl/dist/esm/utils/formatters.js
1284
+ // ../../node_modules/@probe.gl/log/dist/utils/formatters.js
1054
1285
  function formatTime(ms) {
1055
1286
  let formatted;
1056
1287
  if (ms < 10) {
@@ -1064,11 +1295,13 @@
1064
1295
  }
1065
1296
  return formatted;
1066
1297
  }
1067
- function leftPad(string, length2 = 8) {
1298
+ function leftPad(string) {
1299
+ let length2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
1068
1300
  const padLength = Math.max(length2 - string.length, 0);
1069
1301
  return "".concat(" ".repeat(padLength)).concat(string);
1070
1302
  }
1071
- function formatImage(image, message, scale2, maxWidth = 600) {
1303
+ function formatImage(image, message, scale2) {
1304
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
1072
1305
  const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
1073
1306
  if (image.width > maxWidth) {
1074
1307
  scale2 = Math.min(scale2, maxWidth / image.width);
@@ -1079,69 +1312,80 @@
1079
1312
  return ["".concat(message, " %c+"), style];
1080
1313
  }
1081
1314
 
1082
- // ../../node_modules/probe.gl/dist/esm/utils/color.js
1083
- var COLOR = {
1084
- BLACK: 30,
1085
- RED: 31,
1086
- GREEN: 32,
1087
- YELLOW: 33,
1088
- BLUE: 34,
1089
- MAGENTA: 35,
1090
- CYAN: 36,
1091
- WHITE: 37,
1092
- BRIGHT_BLACK: 90,
1093
- BRIGHT_RED: 91,
1094
- BRIGHT_GREEN: 92,
1095
- BRIGHT_YELLOW: 93,
1096
- BRIGHT_BLUE: 94,
1097
- BRIGHT_MAGENTA: 95,
1098
- BRIGHT_CYAN: 96,
1099
- BRIGHT_WHITE: 97
1100
- };
1315
+ // ../../node_modules/@probe.gl/log/dist/utils/color.js
1316
+ var COLOR;
1317
+ (function(COLOR2) {
1318
+ COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
1319
+ COLOR2[COLOR2["RED"] = 31] = "RED";
1320
+ COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
1321
+ COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
1322
+ COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
1323
+ COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
1324
+ COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
1325
+ COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
1326
+ COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
1327
+ COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
1328
+ COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
1329
+ COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
1330
+ COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
1331
+ COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
1332
+ COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
1333
+ COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
1334
+ })(COLOR || (COLOR = {}));
1335
+ var BACKGROUND_INCREMENT = 10;
1101
1336
  function getColor(color) {
1102
- return typeof color === "string" ? COLOR[color.toUpperCase()] || COLOR.WHITE : color;
1337
+ if (typeof color !== "string") {
1338
+ return color;
1339
+ }
1340
+ color = color.toUpperCase();
1341
+ return COLOR[color] || COLOR.WHITE;
1103
1342
  }
1104
1343
  function addColor(string, color, background) {
1105
- if (!isBrowser4 && typeof string === "string") {
1344
+ if (!isBrowser3 && typeof string === "string") {
1106
1345
  if (color) {
1107
- color = getColor(color);
1108
- string = "[".concat(color, "m").concat(string, "");
1346
+ const colorCode = getColor(color);
1347
+ string = "[".concat(colorCode, "m").concat(string, "");
1109
1348
  }
1110
1349
  if (background) {
1111
- color = getColor(background);
1112
- string = "[".concat(background + 10, "m").concat(string, "");
1350
+ const colorCode = getColor(background);
1351
+ string = "[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "");
1113
1352
  }
1114
1353
  }
1115
1354
  return string;
1116
1355
  }
1117
1356
 
1118
- // ../../node_modules/probe.gl/dist/esm/utils/autobind.js
1119
- function autobind(obj, predefined = ["constructor"]) {
1357
+ // ../../node_modules/@probe.gl/log/dist/utils/autobind.js
1358
+ function autobind(obj) {
1359
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
1120
1360
  const proto = Object.getPrototypeOf(obj);
1121
1361
  const propNames = Object.getOwnPropertyNames(proto);
1362
+ const object = obj;
1122
1363
  for (const key of propNames) {
1123
- if (typeof obj[key] === "function") {
1364
+ const value = object[key];
1365
+ if (typeof value === "function") {
1124
1366
  if (!predefined.find((name) => key === name)) {
1125
- obj[key] = obj[key].bind(obj);
1367
+ object[key] = value.bind(obj);
1126
1368
  }
1127
1369
  }
1128
1370
  }
1129
1371
  }
1130
1372
 
1131
- // ../../node_modules/probe.gl/dist/esm/utils/assert.js
1373
+ // ../../node_modules/@probe.gl/log/dist/utils/assert.js
1132
1374
  function assert3(condition, message) {
1133
1375
  if (!condition) {
1134
1376
  throw new Error(message || "Assertion failed");
1135
1377
  }
1136
1378
  }
1137
1379
 
1138
- // ../../node_modules/probe.gl/dist/esm/utils/hi-res-timestamp.js
1380
+ // ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
1139
1381
  function getHiResTimestamp() {
1140
1382
  let timestamp;
1141
- if (isBrowser4 && window_3.performance) {
1142
- timestamp = window_3.performance.now();
1143
- } else if (process_.hrtime) {
1144
- const timeParts = process_.hrtime();
1383
+ if (isBrowser3() && window_3.performance) {
1384
+ var _window$performance, _window$performance$n;
1385
+ 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);
1386
+ } else if ("hrtime" in process_) {
1387
+ var _process$hrtime;
1388
+ const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
1145
1389
  timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
1146
1390
  } else {
1147
1391
  timestamp = Date.now();
@@ -1149,15 +1393,15 @@
1149
1393
  return timestamp;
1150
1394
  }
1151
1395
 
1152
- // ../../node_modules/probe.gl/dist/esm/lib/log.js
1396
+ // ../../node_modules/@probe.gl/log/dist/log.js
1153
1397
  var originalConsole = {
1154
- debug: isBrowser4 ? console.debug || console.log : console.log,
1398
+ debug: isBrowser3() ? console.debug || console.log : console.log,
1155
1399
  log: console.log,
1156
1400
  info: console.info,
1157
1401
  warn: console.warn,
1158
1402
  error: console.error
1159
1403
  };
1160
- var DEFAULT_SETTINGS = {
1404
+ var DEFAULT_LOG_CONFIGURATION = {
1161
1405
  enabled: true,
1162
1406
  level: 0
1163
1407
  };
@@ -1167,27 +1411,23 @@
1167
1411
  var ONCE = {
1168
1412
  once: true
1169
1413
  };
1170
- function getTableHeader(table) {
1171
- for (const key in table) {
1172
- for (const title in table[key]) {
1173
- return title || "untitled";
1174
- }
1175
- }
1176
- return "empty";
1177
- }
1178
1414
  var Log = class {
1179
- constructor({
1180
- id
1181
- } = {
1182
- id: ""
1183
- }) {
1415
+ constructor() {
1416
+ let {
1417
+ id
1418
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
1419
+ id: ""
1420
+ };
1421
+ _defineProperty(this, "id", void 0);
1422
+ _defineProperty(this, "VERSION", VERSION3);
1423
+ _defineProperty(this, "_startTs", getHiResTimestamp());
1424
+ _defineProperty(this, "_deltaTs", getHiResTimestamp());
1425
+ _defineProperty(this, "_storage", void 0);
1426
+ _defineProperty(this, "userData", {});
1427
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
1184
1428
  this.id = id;
1185
- this.VERSION = VERSION3;
1186
- this._startTs = getHiResTimestamp();
1187
- this._deltaTs = getHiResTimestamp();
1188
- this.LOG_THROTTLE_TIMEOUT = 0;
1189
- this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS);
1190
1429
  this.userData = {};
1430
+ this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
1191
1431
  this.timeStamp("".concat(this.id, " started"));
1192
1432
  autobind(this);
1193
1433
  Object.seal(this);
@@ -1219,18 +1459,34 @@
1219
1459
  getPriority() {
1220
1460
  return this.level;
1221
1461
  }
1222
- enable(enabled = true) {
1223
- this._storage.updateConfiguration({
1462
+ enable() {
1463
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
1464
+ this._storage.setConfiguration({
1224
1465
  enabled
1225
1466
  });
1226
1467
  return this;
1227
1468
  }
1228
1469
  setLevel(level) {
1229
- this._storage.updateConfiguration({
1470
+ this._storage.setConfiguration({
1230
1471
  level
1231
1472
  });
1232
1473
  return this;
1233
1474
  }
1475
+ get(setting) {
1476
+ return this._storage.config[setting];
1477
+ }
1478
+ set(setting, value) {
1479
+ this._storage.setConfiguration({
1480
+ [setting]: value
1481
+ });
1482
+ }
1483
+ settings() {
1484
+ if (console.table) {
1485
+ console.table(this._storage.config);
1486
+ } else {
1487
+ console.log(this._storage.config);
1488
+ }
1489
+ }
1234
1490
  assert(condition, message) {
1235
1491
  assert3(condition, message);
1236
1492
  }
@@ -1269,17 +1525,18 @@
1269
1525
  }
1270
1526
  return noop;
1271
1527
  }
1272
- image({
1273
- logLevel,
1274
- priority,
1275
- image,
1276
- message = "",
1277
- scale: scale2 = 1
1278
- }) {
1528
+ image(_ref) {
1529
+ let {
1530
+ logLevel,
1531
+ priority,
1532
+ image,
1533
+ message = "",
1534
+ scale: scale2 = 1
1535
+ } = _ref;
1279
1536
  if (!this._shouldLog(logLevel || priority)) {
1280
1537
  return noop;
1281
1538
  }
1282
- return isBrowser4 ? logImageInBrowser({
1539
+ return isBrowser3() ? logImageInBrowser({
1283
1540
  image,
1284
1541
  message,
1285
1542
  scale: scale2
@@ -1289,21 +1546,6 @@
1289
1546
  scale: scale2
1290
1547
  });
1291
1548
  }
1292
- settings() {
1293
- if (console.table) {
1294
- console.table(this._storage.config);
1295
- } else {
1296
- console.log(this._storage.config);
1297
- }
1298
- }
1299
- get(setting) {
1300
- return this._storage.config[setting];
1301
- }
1302
- set(setting, value) {
1303
- this._storage.updateConfiguration({
1304
- [setting]: value
1305
- });
1306
- }
1307
1549
  time(logLevel, message) {
1308
1550
  return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
1309
1551
  }
@@ -1313,10 +1555,11 @@
1313
1555
  timeStamp(logLevel, message) {
1314
1556
  return this._getLogFunction(logLevel, message, console.timeStamp || noop);
1315
1557
  }
1316
- group(logLevel, message, opts = {
1317
- collapsed: false
1318
- }) {
1319
- opts = normalizeArguments({
1558
+ group(logLevel, message) {
1559
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
1560
+ collapsed: false
1561
+ };
1562
+ const options = normalizeArguments({
1320
1563
  logLevel,
1321
1564
  message,
1322
1565
  opts
@@ -1324,10 +1567,11 @@
1324
1567
  const {
1325
1568
  collapsed
1326
1569
  } = opts;
1327
- opts.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
1328
- return this._getLogFunction(opts);
1570
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
1571
+ return this._getLogFunction(options);
1329
1572
  }
1330
- groupCollapsed(logLevel, message, opts = {}) {
1573
+ groupCollapsed(logLevel, message) {
1574
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1331
1575
  return this.group(logLevel, message, Object.assign({}, opts, {
1332
1576
  collapsed: true
1333
1577
  }));
@@ -1351,7 +1595,7 @@
1351
1595
  _shouldLog(logLevel) {
1352
1596
  return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
1353
1597
  }
1354
- _getLogFunction(logLevel, message, method, args = [], opts) {
1598
+ _getLogFunction(logLevel, message, method, args, opts) {
1355
1599
  if (this._shouldLog(logLevel)) {
1356
1600
  opts = normalizeArguments({
1357
1601
  logLevel,
@@ -1365,7 +1609,7 @@
1365
1609
  opts.delta = this.getDelta();
1366
1610
  this._deltaTs = getHiResTimestamp();
1367
1611
  const tag = opts.tag || opts.message;
1368
- if (opts.once) {
1612
+ if (opts.once && tag) {
1369
1613
  if (!cache[tag]) {
1370
1614
  cache[tag] = getHiResTimestamp();
1371
1615
  } else {
@@ -1378,7 +1622,7 @@
1378
1622
  return noop;
1379
1623
  }
1380
1624
  };
1381
- Log.VERSION = VERSION3;
1625
+ _defineProperty(Log, "VERSION", VERSION3);
1382
1626
  function normalizeLogLevel(logLevel) {
1383
1627
  if (!logLevel) {
1384
1628
  return 0;
@@ -1406,7 +1650,6 @@
1406
1650
  const args = opts.args ? Array.from(opts.args) : [];
1407
1651
  while (args.length && args.shift() !== message) {
1408
1652
  }
1409
- opts.args = args;
1410
1653
  switch (typeof logLevel) {
1411
1654
  case "string":
1412
1655
  case "function":
@@ -1425,7 +1668,9 @@
1425
1668
  }
1426
1669
  const messageType = typeof opts.message;
1427
1670
  assert3(messageType === "string" || messageType === "object");
1428
- return Object.assign(opts, opts.opts);
1671
+ return Object.assign(opts, {
1672
+ args
1673
+ }, opts.opts);
1429
1674
  }
1430
1675
  function decorateMessage(id, message, opts) {
1431
1676
  if (typeof message === "string") {
@@ -1435,29 +1680,21 @@
1435
1680
  }
1436
1681
  return message;
1437
1682
  }
1438
- function logImageInNode({
1439
- image,
1440
- message = "",
1441
- scale: scale2 = 1
1442
- }) {
1443
- let asciify = null;
1444
- try {
1445
- asciify = module.require("asciify-image");
1446
- } catch (error) {
1447
- }
1448
- if (asciify) {
1449
- return () => asciify(image, {
1450
- fit: "box",
1451
- width: "".concat(Math.round(80 * scale2), "%")
1452
- }).then((data) => console.log(data));
1453
- }
1683
+ function logImageInNode(_ref2) {
1684
+ let {
1685
+ image,
1686
+ message = "",
1687
+ scale: scale2 = 1
1688
+ } = _ref2;
1689
+ console.warn("removed");
1454
1690
  return noop;
1455
1691
  }
1456
- function logImageInBrowser({
1457
- image,
1458
- message = "",
1459
- scale: scale2 = 1
1460
- }) {
1692
+ function logImageInBrowser(_ref3) {
1693
+ let {
1694
+ image,
1695
+ message = "",
1696
+ scale: scale2 = 1
1697
+ } = _ref3;
1461
1698
  if (typeof image === "string") {
1462
1699
  const img = new Image();
1463
1700
  img.onload = () => {
@@ -1480,10 +1717,18 @@
1480
1717
  }
1481
1718
  return noop;
1482
1719
  }
1720
+ function getTableHeader(table) {
1721
+ for (const key in table) {
1722
+ for (const title in table[key]) {
1723
+ return title || "untitled";
1724
+ }
1725
+ }
1726
+ return "empty";
1727
+ }
1483
1728
 
1484
- // ../../node_modules/probe.gl/dist/esm/index.js
1485
- var esm_default = new Log({
1486
- id: "probe.gl"
1729
+ // ../../node_modules/@probe.gl/log/dist/index.js
1730
+ var dist_default = new Log({
1731
+ id: "@probe.gl/log"
1487
1732
  });
1488
1733
 
1489
1734
  // ../core/src/lib/loader-utils/loggers.ts
@@ -1534,7 +1779,8 @@
1534
1779
  worker: true,
1535
1780
  maxConcurrency: 3,
1536
1781
  maxMobileConcurrency: 1,
1537
- reuseWorkers: true,
1782
+ reuseWorkers: isBrowser,
1783
+ _nodeWorkers: false,
1538
1784
  _workerType: "",
1539
1785
  limit: 0,
1540
1786
  _limitMB: 0,
@@ -1579,20 +1825,6 @@
1579
1825
  validateOptions(options, loaders);
1580
1826
  return normalizeOptionsInternal(loader, options, url);
1581
1827
  }
1582
- function getFetchFunction(options, context) {
1583
- const globalOptions = getGlobalLoaderOptions();
1584
- const fetchOptions = options || globalOptions;
1585
- if (typeof fetchOptions.fetch === "function") {
1586
- return fetchOptions.fetch;
1587
- }
1588
- if (isObject(fetchOptions.fetch)) {
1589
- return (url) => fetchFile(url, fetchOptions);
1590
- }
1591
- if (context?.fetch) {
1592
- return context?.fetch;
1593
- }
1594
- return fetchFile;
1595
- }
1596
1828
  function validateOptions(options, loaders) {
1597
1829
  validateOptionsObject(options, null, DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS, loaders);
1598
1830
  for (const loader of loaders) {
@@ -1710,6 +1942,9 @@
1710
1942
  return getGlobalLoaderRegistry();
1711
1943
  }
1712
1944
 
1945
+ // ../core/src/lib/utils/log.ts
1946
+ var log = new Log({ id: "loaders.gl" });
1947
+
1713
1948
  // ../core/src/lib/api/select-loader.ts
1714
1949
  var EXT_PATTERN = /\.([^.]+)$/;
1715
1950
  async function selectLoader(data, loaders = [], options, context) {
@@ -1751,16 +1986,26 @@
1751
1986
  return loader;
1752
1987
  }
1753
1988
  function selectLoaderInternal(data, loaders, options, context) {
1754
- const { url, type } = getResourceUrlAndType(data);
1755
- const testUrl = url || context?.url;
1989
+ const url = getResourceUrl(data);
1990
+ const type = getResourceMIMEType(data);
1991
+ const testUrl = stripQueryString(url) || context?.url;
1756
1992
  let loader = null;
1993
+ let reason = "";
1757
1994
  if (options?.mimeType) {
1758
1995
  loader = findLoaderByMIMEType(loaders, options?.mimeType);
1996
+ reason = `match forced by supplied MIME type ${options?.mimeType}`;
1759
1997
  }
1760
1998
  loader = loader || findLoaderByUrl(loaders, testUrl);
1999
+ reason = reason || (loader ? `matched url ${testUrl}` : "");
1761
2000
  loader = loader || findLoaderByMIMEType(loaders, type);
2001
+ reason = reason || (loader ? `matched MIME type ${type}` : "");
1762
2002
  loader = loader || findLoaderByInitialBytes(loaders, data);
2003
+ reason = reason || (loader ? `matched initial data ${getFirstCharacters(data)}` : "");
1763
2004
  loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
2005
+ reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
2006
+ if (reason) {
2007
+ log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
2008
+ }
1764
2009
  return loader;
1765
2010
  }
1766
2011
  function validHTTPResponse(data) {
@@ -1772,7 +2017,8 @@
1772
2017
  return true;
1773
2018
  }
1774
2019
  function getNoValidLoaderMessage(data) {
1775
- const { url, type } = getResourceUrlAndType(data);
2020
+ const url = getResourceUrl(data);
2021
+ const type = getResourceMIMEType(data);
1776
2022
  let message = "No valid loader found (";
1777
2023
  message += url ? `${path_exports.filename(url)}, ` : "no url provided, ";
1778
2024
  message += `MIME type: ${type ? `"${type}"` : "not provided"}, `;
@@ -1943,7 +2189,7 @@
1943
2189
  if (done) {
1944
2190
  return;
1945
2191
  }
1946
- yield toArrayBuffer(value);
2192
+ yield toArrayBuffer2(value);
1947
2193
  }
1948
2194
  } catch (error) {
1949
2195
  reader.releaseLock();
@@ -1951,7 +2197,7 @@
1951
2197
  }
1952
2198
  async function* makeNodeStreamIterator(stream, options) {
1953
2199
  for await (const chunk of stream) {
1954
- yield toArrayBuffer(chunk);
2200
+ yield toArrayBuffer2(chunk);
1955
2201
  }
1956
2202
  }
1957
2203
 
@@ -2029,19 +2275,42 @@
2029
2275
  throw new Error(ERR_DATA);
2030
2276
  }
2031
2277
 
2278
+ // ../core/src/lib/loader-utils/get-fetch-function.ts
2279
+ function getFetchFunction(options, context) {
2280
+ const globalOptions = getGlobalLoaderOptions();
2281
+ const fetchOptions = options || globalOptions;
2282
+ if (typeof fetchOptions.fetch === "function") {
2283
+ return fetchOptions.fetch;
2284
+ }
2285
+ if (isObject(fetchOptions.fetch)) {
2286
+ return (url) => fetchFile(url, fetchOptions);
2287
+ }
2288
+ if (context?.fetch) {
2289
+ return context?.fetch;
2290
+ }
2291
+ return fetchFile;
2292
+ }
2293
+
2032
2294
  // ../core/src/lib/loader-utils/loader-context.ts
2033
- function getLoaderContext(context, options, previousContext = null) {
2034
- if (previousContext) {
2035
- return previousContext;
2295
+ function getLoaderContext(context, options, parentContext) {
2296
+ if (parentContext) {
2297
+ return parentContext;
2036
2298
  }
2037
- const resolvedContext = {
2299
+ const newContext = {
2038
2300
  fetch: getFetchFunction(options, context),
2039
2301
  ...context
2040
2302
  };
2041
- if (!Array.isArray(resolvedContext.loaders)) {
2042
- resolvedContext.loaders = null;
2303
+ if (newContext.url) {
2304
+ const baseUrl = stripQueryString(newContext.url);
2305
+ newContext.baseUrl = baseUrl;
2306
+ newContext.queryString = extractQueryString(newContext.url);
2307
+ newContext.filename = path_exports.filename(baseUrl);
2308
+ newContext.baseUrl = path_exports.dirname(baseUrl);
2043
2309
  }
2044
- return resolvedContext;
2310
+ if (!Array.isArray(newContext.loaders)) {
2311
+ newContext.loaders = null;
2312
+ }
2313
+ return newContext;
2045
2314
  }
2046
2315
  function getLoadersFromContext(loaders, context) {
2047
2316
  if (!context && loaders && !Array.isArray(loaders)) {
@@ -2068,7 +2337,7 @@
2068
2337
  }
2069
2338
  data = await data;
2070
2339
  options = options || {};
2071
- const { url } = getResourceUrlAndType(data);
2340
+ const url = getResourceUrl(data);
2072
2341
  const typedLoaders = loaders;
2073
2342
  const candidateLoaders = getLoadersFromContext(typedLoaders, context);
2074
2343
  const loader = await selectLoader(data, candidateLoaders, options);
@@ -2076,11 +2345,17 @@
2076
2345
  return null;
2077
2346
  }
2078
2347
  options = normalizeOptions(options, loader, candidateLoaders, url);
2079
- context = getLoaderContext({ url, parse, loaders: candidateLoaders }, options, context);
2348
+ context = getLoaderContext({ url, parse, loaders: candidateLoaders }, options, context || null);
2080
2349
  return await parseWithLoader(loader, data, options, context);
2081
2350
  }
2082
2351
  async function parseWithLoader(loader, data, options, context) {
2083
2352
  validateWorkerVersion(loader);
2353
+ if (isResponse(data)) {
2354
+ const response = data;
2355
+ const { ok, redirected, status, statusText, type, url } = response;
2356
+ const headers = Object.fromEntries(response.headers.entries());
2357
+ context.response = { headers, ok, redirected, status, statusText, type, url };
2358
+ }
2084
2359
  data = await getArrayBufferOrStringFromData(data, loader, options);
2085
2360
  if (loader.parseTextSync && typeof data === "string") {
2086
2361
  options.dataType = "text";
@@ -2101,12 +2376,17 @@
2101
2376
 
2102
2377
  // ../core/src/lib/api/load.ts
2103
2378
  async function load(url, loaders, options, context) {
2379
+ let resolvedLoaders;
2380
+ let resolvedOptions;
2104
2381
  if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
2382
+ resolvedLoaders = [];
2383
+ resolvedOptions = loaders;
2105
2384
  context = void 0;
2106
- options = loaders;
2107
- loaders = void 0;
2385
+ } else {
2386
+ resolvedLoaders = loaders;
2387
+ resolvedOptions = options;
2108
2388
  }
2109
- const fetch2 = getFetchFunction(options);
2389
+ const fetch2 = getFetchFunction(resolvedOptions);
2110
2390
  let data = url;
2111
2391
  if (typeof url === "string") {
2112
2392
  data = await fetch2(url);
@@ -2114,7 +2394,7 @@
2114
2394
  if (isBlob(url)) {
2115
2395
  data = await fetch2(url);
2116
2396
  }
2117
- return await parse(data, loaders, options);
2397
+ return Array.isArray(resolvedLoaders) ? await parse(data, resolvedLoaders, resolvedOptions) : await parse(data, resolvedLoaders, resolvedOptions);
2118
2398
  }
2119
2399
 
2120
2400
  // ../../node_modules/@math.gl/core/dist/esm/lib/assert.js
@@ -2127,18 +2407,16 @@
2127
2407
  // ../../node_modules/@math.gl/core/dist/esm/lib/common.js
2128
2408
  var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
2129
2409
  var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
2130
- var config = {};
2131
- config.EPSILON = 1e-12;
2132
- config.debug = false;
2133
- config.precision = 4;
2134
- config.printTypes = false;
2135
- config.printDegrees = false;
2136
- config.printRowMajor = true;
2137
- function round(value) {
2138
- return Math.round(value / config.EPSILON) * config.EPSILON;
2139
- }
2410
+ var config = {
2411
+ EPSILON: 1e-12,
2412
+ debug: false,
2413
+ precision: 4,
2414
+ printTypes: false,
2415
+ printDegrees: false,
2416
+ printRowMajor: true
2417
+ };
2140
2418
  function formatValue(value, {
2141
- precision = config.precision || 4
2419
+ precision = config.precision
2142
2420
  } = {}) {
2143
2421
  value = round(value);
2144
2422
  return "".concat(parseFloat(value.toPrecision(precision)));
@@ -2146,19 +2424,6 @@
2146
2424
  function isArray(value) {
2147
2425
  return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
2148
2426
  }
2149
- function duplicateArray(array) {
2150
- return array.clone ? array.clone() : new Array(array.length);
2151
- }
2152
- function map(value, func, result) {
2153
- if (isArray(value)) {
2154
- result = result || duplicateArray(value);
2155
- for (let i2 = 0; i2 < result.length && i2 < value.length; ++i2) {
2156
- result[i2] = func(value[i2], i2, result);
2157
- }
2158
- return result;
2159
- }
2160
- return func(value);
2161
- }
2162
2427
  function toRadians(degrees2) {
2163
2428
  return radians(degrees2);
2164
2429
  }
@@ -2197,7 +2462,7 @@
2197
2462
  if (b && b.equals) {
2198
2463
  return b.equals(a2);
2199
2464
  }
2200
- if (Number.isFinite(a2) && Number.isFinite(b)) {
2465
+ if (typeof a2 === "number" && typeof b === "number") {
2201
2466
  return Math.abs(a2 - b) <= config.EPSILON * Math.max(1, Math.abs(a2), Math.abs(b));
2202
2467
  }
2203
2468
  return false;
@@ -2205,6 +2470,23 @@
2205
2470
  config.EPSILON = oldEpsilon;
2206
2471
  }
2207
2472
  }
2473
+ function round(value) {
2474
+ return Math.round(value / config.EPSILON) * config.EPSILON;
2475
+ }
2476
+ function duplicateArray(array) {
2477
+ return array.clone ? array.clone() : new Array(array.length);
2478
+ }
2479
+ function map(value, func, result) {
2480
+ if (isArray(value)) {
2481
+ const array = value;
2482
+ result = result || duplicateArray(array);
2483
+ for (let i2 = 0; i2 < result.length && i2 < array.length; ++i2) {
2484
+ result[i2] = func(value[i2], i2, result);
2485
+ }
2486
+ return result;
2487
+ }
2488
+ return func(value);
2489
+ }
2208
2490
 
2209
2491
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js
2210
2492
  function _extendableBuiltin(cls) {
@@ -2229,22 +2511,24 @@
2229
2511
  return ExtendableBuiltin;
2230
2512
  }
2231
2513
  var MathArray = class extends _extendableBuiltin(Array) {
2232
- get ELEMENTS() {
2233
- assert4(false);
2234
- return 0;
2235
- }
2236
2514
  clone() {
2237
2515
  return new this.constructor().copy(this);
2238
2516
  }
2239
- from(arrayOrObject) {
2240
- return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
2241
- }
2242
2517
  fromArray(array, offset = 0) {
2243
2518
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2244
2519
  this[i2] = array[i2 + offset];
2245
2520
  }
2246
2521
  return this.check();
2247
2522
  }
2523
+ toArray(targetArray = [], offset = 0) {
2524
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2525
+ targetArray[offset + i2] = this[i2];
2526
+ }
2527
+ return targetArray;
2528
+ }
2529
+ from(arrayOrObject) {
2530
+ return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
2531
+ }
2248
2532
  to(arrayOrObject) {
2249
2533
  if (arrayOrObject === this) {
2250
2534
  return this;
@@ -2254,12 +2538,6 @@
2254
2538
  toTarget(target) {
2255
2539
  return target ? this.to(target) : this;
2256
2540
  }
2257
- toArray(array = [], offset = 0) {
2258
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2259
- array[offset + i2] = this[i2];
2260
- }
2261
- return array;
2262
- }
2263
2541
  toFloat32Array() {
2264
2542
  return new Float32Array(this);
2265
2543
  }
@@ -2303,9 +2581,7 @@
2303
2581
  }
2304
2582
  lerp(a2, b, t2) {
2305
2583
  if (t2 === void 0) {
2306
- t2 = b;
2307
- b = a2;
2308
- a2 = this;
2584
+ return this.lerp(this, a2, b);
2309
2585
  }
2310
2586
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2311
2587
  const ai = a2[i2];
@@ -2348,14 +2624,36 @@
2348
2624
  return this.check();
2349
2625
  }
2350
2626
  scale(scale2) {
2351
- if (Array.isArray(scale2)) {
2352
- return this.multiply(scale2);
2627
+ if (typeof scale2 === "number") {
2628
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2629
+ this[i2] *= scale2;
2630
+ }
2631
+ } else {
2632
+ for (let i2 = 0; i2 < this.ELEMENTS && i2 < scale2.length; ++i2) {
2633
+ this[i2] *= scale2[i2];
2634
+ }
2353
2635
  }
2636
+ return this.check();
2637
+ }
2638
+ multiplyByScalar(scalar) {
2354
2639
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2355
- this[i2] *= scale2;
2640
+ this[i2] *= scalar;
2356
2641
  }
2357
2642
  return this.check();
2358
2643
  }
2644
+ check() {
2645
+ if (config.debug && !this.validate()) {
2646
+ throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
2647
+ }
2648
+ return this;
2649
+ }
2650
+ validate() {
2651
+ let valid = this.length === this.ELEMENTS;
2652
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2653
+ valid = valid && Number.isFinite(this[i2]);
2654
+ }
2655
+ return valid;
2656
+ }
2359
2657
  sub(a2) {
2360
2658
  return this.subtract(a2);
2361
2659
  }
@@ -2381,7 +2679,7 @@
2381
2679
  return this.check();
2382
2680
  }
2383
2681
  divideScalar(a2) {
2384
- return this.scale(1 / a2);
2682
+ return this.multiplyByScalar(1 / a2);
2385
2683
  }
2386
2684
  clampScalar(min, max) {
2387
2685
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
@@ -2389,25 +2687,9 @@
2389
2687
  }
2390
2688
  return this.check();
2391
2689
  }
2392
- multiplyByScalar(scalar) {
2393
- return this.scale(scalar);
2394
- }
2395
2690
  get elements() {
2396
2691
  return this;
2397
2692
  }
2398
- check() {
2399
- if (config.debug && !this.validate()) {
2400
- throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
2401
- }
2402
- return this;
2403
- }
2404
- validate() {
2405
- let valid = this.length === this.ELEMENTS;
2406
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2407
- valid = valid && Number.isFinite(this[i2]);
2408
- }
2409
- return valid;
2410
- }
2411
2693
  };
2412
2694
 
2413
2695
  // ../../node_modules/@math.gl/core/dist/esm/lib/validators.js
@@ -2434,24 +2716,9 @@
2434
2716
  }
2435
2717
  return v;
2436
2718
  }
2437
- var map2 = {};
2438
- function deprecated(method, version) {
2439
- if (!map2[method]) {
2440
- map2[method] = true;
2441
- console.warn("".concat(method, " has been removed in version ").concat(version, ", see upgrade guide for more information"));
2442
- }
2443
- }
2444
2719
 
2445
2720
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js
2446
2721
  var Vector = class extends MathArray {
2447
- get ELEMENTS() {
2448
- assert4(false);
2449
- return 0;
2450
- }
2451
- copy(vector) {
2452
- assert4(false);
2453
- return this;
2454
- }
2455
2722
  get x() {
2456
2723
  return this[0];
2457
2724
  }
@@ -2771,10 +3038,14 @@
2771
3038
 
2772
3039
  // ../../node_modules/@math.gl/core/dist/esm/classes/vector3.js
2773
3040
  var ORIGIN = [0, 0, 0];
2774
- var constants = {};
3041
+ var ZERO;
2775
3042
  var Vector3 = class extends Vector {
2776
3043
  static get ZERO() {
2777
- return constants.ZERO = constants.ZERO || Object.freeze(new Vector3(0, 0, 0, 0));
3044
+ if (!ZERO) {
3045
+ ZERO = new Vector3(0, 0, 0);
3046
+ Object.freeze(ZERO);
3047
+ }
3048
+ return ZERO;
2778
3049
  }
2779
3050
  constructor(x = 0, y = 0, z = 0) {
2780
3051
  super(-0, -0, -0);
@@ -2884,14 +3155,6 @@
2884
3155
 
2885
3156
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js
2886
3157
  var Matrix = class extends MathArray {
2887
- get ELEMENTS() {
2888
- assert4(false);
2889
- return 0;
2890
- }
2891
- get RANK() {
2892
- assert4(false);
2893
- return 0;
2894
- }
2895
3158
  toString() {
2896
3159
  let string = "[";
2897
3160
  if (config.printRowMajor) {
@@ -3358,7 +3621,7 @@
3358
3621
  out[15] = 0;
3359
3622
  return out;
3360
3623
  }
3361
- function perspective(out, fovy, aspect, near, far) {
3624
+ function perspectiveNO(out, fovy, aspect, near, far) {
3362
3625
  var f2 = 1 / Math.tan(fovy / 2), nf;
3363
3626
  out[0] = f2 / aspect;
3364
3627
  out[1] = 0;
@@ -3384,7 +3647,8 @@
3384
3647
  }
3385
3648
  return out;
3386
3649
  }
3387
- function ortho(out, left, right, bottom, top, near, far) {
3650
+ var perspective = perspectiveNO;
3651
+ function orthoNO(out, left, right, bottom, top, near, far) {
3388
3652
  var lr = 1 / (left - right);
3389
3653
  var bt = 1 / (bottom - top);
3390
3654
  var nf = 1 / (near - far);
@@ -3406,6 +3670,7 @@
3406
3670
  out[15] = 1;
3407
3671
  return out;
3408
3672
  }
3673
+ var ortho = orthoNO;
3409
3674
  function lookAt(out, eye, center, up) {
3410
3675
  var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;
3411
3676
  var eyex = eye[0];
@@ -3524,38 +3789,36 @@
3524
3789
  }();
3525
3790
 
3526
3791
  // ../../node_modules/@math.gl/core/dist/esm/classes/matrix4.js
3527
- var IDENTITY = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3528
- var ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
3529
- var INDICES = Object.freeze({
3530
- COL0ROW0: 0,
3531
- COL0ROW1: 1,
3532
- COL0ROW2: 2,
3533
- COL0ROW3: 3,
3534
- COL1ROW0: 4,
3535
- COL1ROW1: 5,
3536
- COL1ROW2: 6,
3537
- COL1ROW3: 7,
3538
- COL2ROW0: 8,
3539
- COL2ROW1: 9,
3540
- COL2ROW2: 10,
3541
- COL2ROW3: 11,
3542
- COL3ROW0: 12,
3543
- COL3ROW1: 13,
3544
- COL3ROW2: 14,
3545
- COL3ROW3: 15
3546
- });
3547
- var constants2 = {};
3792
+ var INDICES;
3793
+ (function(INDICES2) {
3794
+ INDICES2[INDICES2["COL0ROW0"] = 0] = "COL0ROW0";
3795
+ INDICES2[INDICES2["COL0ROW1"] = 1] = "COL0ROW1";
3796
+ INDICES2[INDICES2["COL0ROW2"] = 2] = "COL0ROW2";
3797
+ INDICES2[INDICES2["COL0ROW3"] = 3] = "COL0ROW3";
3798
+ INDICES2[INDICES2["COL1ROW0"] = 4] = "COL1ROW0";
3799
+ INDICES2[INDICES2["COL1ROW1"] = 5] = "COL1ROW1";
3800
+ INDICES2[INDICES2["COL1ROW2"] = 6] = "COL1ROW2";
3801
+ INDICES2[INDICES2["COL1ROW3"] = 7] = "COL1ROW3";
3802
+ INDICES2[INDICES2["COL2ROW0"] = 8] = "COL2ROW0";
3803
+ INDICES2[INDICES2["COL2ROW1"] = 9] = "COL2ROW1";
3804
+ INDICES2[INDICES2["COL2ROW2"] = 10] = "COL2ROW2";
3805
+ INDICES2[INDICES2["COL2ROW3"] = 11] = "COL2ROW3";
3806
+ INDICES2[INDICES2["COL3ROW0"] = 12] = "COL3ROW0";
3807
+ INDICES2[INDICES2["COL3ROW1"] = 13] = "COL3ROW1";
3808
+ INDICES2[INDICES2["COL3ROW2"] = 14] = "COL3ROW2";
3809
+ INDICES2[INDICES2["COL3ROW3"] = 15] = "COL3ROW3";
3810
+ })(INDICES || (INDICES = {}));
3811
+ var DEFAULT_FOVY = 45 * Math.PI / 180;
3812
+ var DEFAULT_ASPECT = 1;
3813
+ var DEFAULT_NEAR = 0.1;
3814
+ var DEFAULT_FAR = 500;
3815
+ var IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3548
3816
  var Matrix4 = class extends Matrix {
3549
3817
  static get IDENTITY() {
3550
- constants2.IDENTITY = constants2.IDENTITY || Object.freeze(new Matrix4(IDENTITY));
3551
- return constants2.IDENTITY;
3818
+ return getIdentityMatrix();
3552
3819
  }
3553
3820
  static get ZERO() {
3554
- constants2.ZERO = constants2.ZERO || Object.freeze(new Matrix4(ZERO));
3555
- return constants2.ZERO;
3556
- }
3557
- get INDICES() {
3558
- return INDICES;
3821
+ return getZeroMatrix();
3559
3822
  }
3560
3823
  get ELEMENTS() {
3561
3824
  return 16;
@@ -3563,6 +3826,9 @@
3563
3826
  get RANK() {
3564
3827
  return 4;
3565
3828
  }
3829
+ get INDICES() {
3830
+ return INDICES;
3831
+ }
3566
3832
  constructor(array) {
3567
3833
  super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
3568
3834
  if (arguments.length === 1 && Array.isArray(array)) {
@@ -3648,91 +3914,65 @@
3648
3914
  return result;
3649
3915
  }
3650
3916
  identity() {
3651
- return this.copy(IDENTITY);
3917
+ return this.copy(IDENTITY_MATRIX);
3652
3918
  }
3653
- fromQuaternion(q) {
3654
- fromQuat(this, q);
3919
+ fromObject(object) {
3655
3920
  return this.check();
3656
3921
  }
3657
- frustum({
3658
- left,
3659
- right,
3660
- bottom,
3661
- top,
3662
- near,
3663
- far
3664
- }) {
3922
+ fromQuaternion(quaternion) {
3923
+ fromQuat(this, quaternion);
3924
+ return this.check();
3925
+ }
3926
+ frustum(view) {
3927
+ const {
3928
+ left,
3929
+ right,
3930
+ bottom,
3931
+ top,
3932
+ near = DEFAULT_NEAR,
3933
+ far = DEFAULT_FAR
3934
+ } = view;
3665
3935
  if (far === Infinity) {
3666
- Matrix4._computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
3936
+ computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
3667
3937
  } else {
3668
3938
  frustum(this, left, right, bottom, top, near, far);
3669
3939
  }
3670
3940
  return this.check();
3671
3941
  }
3672
- static _computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
3673
- const column0Row0 = 2 * near / (right - left);
3674
- const column1Row1 = 2 * near / (top - bottom);
3675
- const column2Row0 = (right + left) / (right - left);
3676
- const column2Row1 = (top + bottom) / (top - bottom);
3677
- const column2Row2 = -1;
3678
- const column2Row3 = -1;
3679
- const column3Row2 = -2 * near;
3680
- result[0] = column0Row0;
3681
- result[1] = 0;
3682
- result[2] = 0;
3683
- result[3] = 0;
3684
- result[4] = 0;
3685
- result[5] = column1Row1;
3686
- result[6] = 0;
3687
- result[7] = 0;
3688
- result[8] = column2Row0;
3689
- result[9] = column2Row1;
3690
- result[10] = column2Row2;
3691
- result[11] = column2Row3;
3692
- result[12] = 0;
3693
- result[13] = 0;
3694
- result[14] = column3Row2;
3695
- result[15] = 0;
3696
- return result;
3697
- }
3698
- lookAt(eye, center, up) {
3699
- if (arguments.length === 1) {
3700
- ({
3701
- eye,
3702
- center,
3703
- up
3704
- } = eye);
3705
- }
3706
- center = center || [0, 0, 0];
3707
- up = up || [0, 1, 0];
3942
+ lookAt(view) {
3943
+ const {
3944
+ eye,
3945
+ center = [0, 0, 0],
3946
+ up = [0, 1, 0]
3947
+ } = view;
3708
3948
  lookAt(this, eye, center, up);
3709
3949
  return this.check();
3710
3950
  }
3711
- ortho({
3712
- left,
3713
- right,
3714
- bottom,
3715
- top,
3716
- near = 0.1,
3717
- far = 500
3718
- }) {
3951
+ ortho(view) {
3952
+ const {
3953
+ left,
3954
+ right,
3955
+ bottom,
3956
+ top,
3957
+ near = DEFAULT_NEAR,
3958
+ far = DEFAULT_FAR
3959
+ } = view;
3719
3960
  ortho(this, left, right, bottom, top, near, far);
3720
3961
  return this.check();
3721
3962
  }
3722
- orthographic({
3723
- fovy = 45 * Math.PI / 180,
3724
- aspect = 1,
3725
- focalDistance = 1,
3726
- near = 0.1,
3727
- far = 500
3728
- }) {
3729
- if (fovy > Math.PI * 2) {
3730
- throw Error("radians");
3731
- }
3963
+ orthographic(view) {
3964
+ const {
3965
+ fovy = DEFAULT_FOVY,
3966
+ aspect = DEFAULT_ASPECT,
3967
+ focalDistance = 1,
3968
+ near = DEFAULT_NEAR,
3969
+ far = DEFAULT_FAR
3970
+ } = view;
3971
+ checkRadians(fovy);
3732
3972
  const halfY = fovy / 2;
3733
3973
  const top = focalDistance * Math.tan(halfY);
3734
3974
  const right = top * aspect;
3735
- return new Matrix4().ortho({
3975
+ return this.ortho({
3736
3976
  left: -right,
3737
3977
  right,
3738
3978
  bottom: -top,
@@ -3741,17 +3981,14 @@
3741
3981
  far
3742
3982
  });
3743
3983
  }
3744
- perspective({
3745
- fovy = void 0,
3746
- fov = 45 * Math.PI / 180,
3747
- aspect = 1,
3748
- near = 0.1,
3749
- far = 500
3750
- } = {}) {
3751
- fovy = fovy || fov;
3752
- if (fovy > Math.PI * 2) {
3753
- throw Error("radians");
3754
- }
3984
+ perspective(view) {
3985
+ const {
3986
+ fovy = 45 * Math.PI / 180,
3987
+ aspect = 1,
3988
+ near = 0.1,
3989
+ far = 500
3990
+ } = view;
3991
+ checkRadians(fovy);
3755
3992
  perspective(this, fovy, aspect, near, far);
3756
3993
  return this.check();
3757
3994
  }
@@ -3770,8 +4007,10 @@
3770
4007
  result[2] = this[14];
3771
4008
  return result;
3772
4009
  }
3773
- getRotation(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
3774
- const scale2 = this.getScale(scaleResult || [-0, -0, -0]);
4010
+ getRotation(result, scaleResult) {
4011
+ result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
4012
+ scaleResult = scaleResult || [-0, -0, -0];
4013
+ const scale2 = this.getScale(scaleResult);
3775
4014
  const inverseScale0 = 1 / scale2[0];
3776
4015
  const inverseScale1 = 1 / scale2[1];
3777
4016
  const inverseScale2 = 1 / scale2[2];
@@ -3793,8 +4032,10 @@
3793
4032
  result[15] = 1;
3794
4033
  return result;
3795
4034
  }
3796
- getRotationMatrix3(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
3797
- const scale2 = this.getScale(scaleResult || [-0, -0, -0]);
4035
+ getRotationMatrix3(result, scaleResult) {
4036
+ result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
4037
+ scaleResult = scaleResult || [-0, -0, -0];
4038
+ const scale2 = this.getScale(scaleResult);
3798
4039
  const inverseScale0 = 1 / scale2[0];
3799
4040
  const inverseScale1 = 1 / scale2[1];
3800
4041
  const inverseScale2 = 1 / scale2[2];
@@ -3837,23 +4078,19 @@
3837
4078
  rotateZ2(this, this, radians2);
3838
4079
  return this.check();
3839
4080
  }
3840
- rotateXYZ([rx, ry, rz]) {
3841
- return this.rotateX(rx).rotateY(ry).rotateZ(rz);
4081
+ rotateXYZ(angleXYZ) {
4082
+ return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
3842
4083
  }
3843
4084
  rotateAxis(radians2, axis) {
3844
4085
  rotate(this, this, radians2, axis);
3845
4086
  return this.check();
3846
4087
  }
3847
4088
  scale(factor) {
3848
- if (Array.isArray(factor)) {
3849
- scale(this, this, factor);
3850
- } else {
3851
- scale(this, this, [factor, factor, factor]);
3852
- }
4089
+ scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
3853
4090
  return this.check();
3854
4091
  }
3855
- translate(vec) {
3856
- translate(this, this, vec);
4092
+ translate(vector) {
4093
+ translate(this, this, vector);
3857
4094
  return this.check();
3858
4095
  }
3859
4096
  transform(vector, result) {
@@ -3868,52 +4105,98 @@
3868
4105
  const {
3869
4106
  length: length2
3870
4107
  } = vector;
4108
+ let out;
3871
4109
  switch (length2) {
3872
4110
  case 2:
3873
- result = transformMat4(result || [-0, -0], vector, this);
4111
+ out = transformMat4(result || [-0, -0], vector, this);
3874
4112
  break;
3875
4113
  case 3:
3876
- result = transformMat42(result || [-0, -0, -0], vector, this);
4114
+ out = transformMat42(result || [-0, -0, -0], vector, this);
3877
4115
  break;
3878
4116
  default:
3879
4117
  throw new Error("Illegal vector");
3880
4118
  }
3881
- checkVector(result, vector.length);
3882
- return result;
4119
+ checkVector(out, vector.length);
4120
+ return out;
3883
4121
  }
3884
4122
  transformAsVector(vector, result) {
4123
+ let out;
3885
4124
  switch (vector.length) {
3886
4125
  case 2:
3887
- result = vec2_transformMat4AsVector(result || [-0, -0], vector, this);
4126
+ out = vec2_transformMat4AsVector(result || [-0, -0], vector, this);
3888
4127
  break;
3889
4128
  case 3:
3890
- result = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);
4129
+ out = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);
3891
4130
  break;
3892
4131
  default:
3893
4132
  throw new Error("Illegal vector");
3894
4133
  }
3895
- checkVector(result, vector.length);
3896
- return result;
3897
- }
3898
- makeRotationX(radians2) {
3899
- return this.identity().rotateX(radians2);
3900
- }
3901
- makeTranslation(x, y, z) {
3902
- return this.identity().translate([x, y, z]);
4134
+ checkVector(out, vector.length);
4135
+ return out;
3903
4136
  }
3904
4137
  transformPoint(vector, result) {
3905
- deprecated("Matrix4.transformPoint", "3.0");
3906
4138
  return this.transformAsPoint(vector, result);
3907
4139
  }
3908
4140
  transformVector(vector, result) {
3909
- deprecated("Matrix4.transformVector", "3.0");
3910
4141
  return this.transformAsPoint(vector, result);
3911
4142
  }
3912
4143
  transformDirection(vector, result) {
3913
- deprecated("Matrix4.transformDirection", "3.0");
3914
4144
  return this.transformAsVector(vector, result);
3915
4145
  }
4146
+ makeRotationX(radians2) {
4147
+ return this.identity().rotateX(radians2);
4148
+ }
4149
+ makeTranslation(x, y, z) {
4150
+ return this.identity().translate([x, y, z]);
4151
+ }
3916
4152
  };
4153
+ var ZERO2;
4154
+ var IDENTITY;
4155
+ function getZeroMatrix() {
4156
+ if (!ZERO2) {
4157
+ ZERO2 = new Matrix4([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
4158
+ Object.freeze(ZERO2);
4159
+ }
4160
+ return ZERO2;
4161
+ }
4162
+ function getIdentityMatrix() {
4163
+ if (!IDENTITY) {
4164
+ IDENTITY = new Matrix4();
4165
+ Object.freeze(IDENTITY);
4166
+ }
4167
+ return IDENTITY;
4168
+ }
4169
+ function checkRadians(possiblyDegrees) {
4170
+ if (possiblyDegrees > Math.PI * 2) {
4171
+ throw Error("expected radians");
4172
+ }
4173
+ }
4174
+ function computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
4175
+ const column0Row0 = 2 * near / (right - left);
4176
+ const column1Row1 = 2 * near / (top - bottom);
4177
+ const column2Row0 = (right + left) / (right - left);
4178
+ const column2Row1 = (top + bottom) / (top - bottom);
4179
+ const column2Row2 = -1;
4180
+ const column2Row3 = -1;
4181
+ const column3Row2 = -2 * near;
4182
+ result[0] = column0Row0;
4183
+ result[1] = 0;
4184
+ result[2] = 0;
4185
+ result[3] = 0;
4186
+ result[4] = 0;
4187
+ result[5] = column1Row1;
4188
+ result[6] = 0;
4189
+ result[7] = 0;
4190
+ result[8] = column2Row0;
4191
+ result[9] = column2Row1;
4192
+ result[10] = column2Row2;
4193
+ result[11] = column2Row3;
4194
+ result[12] = 0;
4195
+ result[13] = 0;
4196
+ result[14] = column3Row2;
4197
+ result[15] = 0;
4198
+ return result;
4199
+ }
3917
4200
 
3918
4201
  // ../../node_modules/@math.gl/core/dist/esm/lib/math-utils.js
3919
4202
  var math_utils_default = {
@@ -3943,17 +4226,6 @@
3943
4226
  TWO_PI: Math.PI * 2
3944
4227
  };
3945
4228
 
3946
- // ../../node_modules/@math.gl/core/dist/esm/index.js
3947
- var globals4 = {
3948
- self: typeof self !== "undefined" && self,
3949
- window: typeof window !== "undefined" && window,
3950
- global: typeof global !== "undefined" && global
3951
- };
3952
- var global_4 = globals4.global || globals4.self || globals4.window;
3953
- global_4.mathgl = {
3954
- config
3955
- };
3956
-
3957
4229
  // ../../node_modules/@math.gl/geospatial/dist/esm/constants.js
3958
4230
  var WGS84_RADIUS_X = 6378137;
3959
4231
  var WGS84_RADIUS_Y = 6378137;
@@ -3968,61 +4240,63 @@
3968
4240
  };
3969
4241
 
3970
4242
  // ../../node_modules/@math.gl/geospatial/dist/esm/type-utils.js
3971
- var noop2 = (x) => x;
4243
+ function identity2(x) {
4244
+ return x;
4245
+ }
3972
4246
  var scratchVector = new Vector3();
3973
- function fromCartographic(cartographic, result, map3 = noop2) {
3974
- if (isArray(cartographic)) {
3975
- result[0] = map3(cartographic[0]);
3976
- result[1] = map3(cartographic[1]);
3977
- result[2] = cartographic[2];
3978
- } else if ("longitude" in cartographic) {
3979
- result[0] = map3(cartographic.longitude);
3980
- result[1] = map3(cartographic.latitude);
4247
+ function fromCartographic(cartographic, result = [], map2 = identity2) {
4248
+ if ("longitude" in cartographic) {
4249
+ result[0] = map2(cartographic.longitude);
4250
+ result[1] = map2(cartographic.latitude);
3981
4251
  result[2] = cartographic.height;
3982
- } else {
3983
- result[0] = map3(cartographic.x);
3984
- result[1] = map3(cartographic.y);
4252
+ } else if ("x" in cartographic) {
4253
+ result[0] = map2(cartographic.x);
4254
+ result[1] = map2(cartographic.y);
3985
4255
  result[2] = cartographic.z;
4256
+ } else {
4257
+ result[0] = map2(cartographic[0]);
4258
+ result[1] = map2(cartographic[1]);
4259
+ result[2] = cartographic[2];
3986
4260
  }
3987
4261
  return result;
3988
4262
  }
3989
- function fromCartographicToRadians(cartographic, vector = scratchVector) {
3990
- return fromCartographic(cartographic, vector, config._cartographicRadians ? noop2 : toRadians);
4263
+ function fromCartographicToRadians(cartographic, vector = []) {
4264
+ return fromCartographic(cartographic, vector, config._cartographicRadians ? identity2 : toRadians);
3991
4265
  }
3992
- function toCartographic(vector, cartographic, map3 = noop2) {
3993
- if (isArray(cartographic)) {
3994
- cartographic[0] = map3(vector[0]);
3995
- cartographic[1] = map3(vector[1]);
3996
- cartographic[2] = vector[2];
3997
- } else if ("longitude" in cartographic) {
3998
- cartographic.longitude = map3(vector[0]);
3999
- cartographic.latitude = map3(vector[1]);
4266
+ function toCartographic(vector, cartographic, map2 = identity2) {
4267
+ if ("longitude" in cartographic) {
4268
+ cartographic.longitude = map2(vector[0]);
4269
+ cartographic.latitude = map2(vector[1]);
4000
4270
  cartographic.height = vector[2];
4001
- } else {
4002
- cartographic.x = map3(vector[0]);
4003
- cartographic.y = map3(vector[1]);
4271
+ } else if ("x" in cartographic) {
4272
+ cartographic.x = map2(vector[0]);
4273
+ cartographic.y = map2(vector[1]);
4004
4274
  cartographic.z = vector[2];
4275
+ } else {
4276
+ cartographic[0] = map2(vector[0]);
4277
+ cartographic[1] = map2(vector[1]);
4278
+ cartographic[2] = vector[2];
4005
4279
  }
4006
4280
  return cartographic;
4007
4281
  }
4008
4282
  function toCartographicFromRadians(vector, cartographic) {
4009
- return toCartographic(vector, cartographic, config._cartographicRadians ? noop2 : toDegrees);
4283
+ return toCartographic(vector, cartographic, config._cartographicRadians ? identity2 : toDegrees);
4010
4284
  }
4011
4285
 
4012
4286
  // ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/scale-to-geodetic-surface.js
4013
4287
  var scratchVector2 = new Vector3();
4014
4288
  var scaleToGeodeticSurfaceIntersection = new Vector3();
4015
4289
  var scaleToGeodeticSurfaceGradient = new Vector3();
4016
- function scaleToGeodeticSurface(cartesian, ellipsoid, result = new Vector3()) {
4290
+ function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
4017
4291
  const {
4018
4292
  oneOverRadii,
4019
4293
  oneOverRadiiSquared,
4020
4294
  centerToleranceSquared
4021
4295
  } = ellipsoid;
4022
4296
  scratchVector2.from(cartesian);
4023
- const positionX = cartesian.x;
4024
- const positionY = cartesian.y;
4025
- const positionZ = cartesian.z;
4297
+ const positionX = scratchVector2.x;
4298
+ const positionY = scratchVector2.y;
4299
+ const positionZ = scratchVector2.z;
4026
4300
  const oneOverRadiiX = oneOverRadii.x;
4027
4301
  const oneOverRadiiY = oneOverRadii.y;
4028
4302
  const oneOverRadiiZ = oneOverRadii.z;
@@ -4044,7 +4318,7 @@
4044
4318
  const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
4045
4319
  const gradient = scaleToGeodeticSurfaceGradient;
4046
4320
  gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
4047
- let lambda = (1 - ratio) * cartesian.len() / (0.5 * gradient.len());
4321
+ let lambda = (1 - ratio) * scratchVector2.len() / (0.5 * gradient.len());
4048
4322
  let correction = 0;
4049
4323
  let xMultiplier;
4050
4324
  let yMultiplier;
@@ -4198,13 +4472,17 @@
4198
4472
  var scratchPosition = new Vector3();
4199
4473
  var scratchHeight = new Vector3();
4200
4474
  var scratchCartesian = new Vector3();
4201
- var wgs84;
4202
4475
  var Ellipsoid = class {
4203
- static get WGS84() {
4204
- wgs84 = wgs84 || new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
4205
- return wgs84;
4206
- }
4207
4476
  constructor(x = 0, y = 0, z = 0) {
4477
+ _defineProperty(this, "radii", void 0);
4478
+ _defineProperty(this, "radiiSquared", void 0);
4479
+ _defineProperty(this, "radiiToTheFourth", void 0);
4480
+ _defineProperty(this, "oneOverRadii", void 0);
4481
+ _defineProperty(this, "oneOverRadiiSquared", void 0);
4482
+ _defineProperty(this, "minimumRadius", void 0);
4483
+ _defineProperty(this, "maximumRadius", void 0);
4484
+ _defineProperty(this, "centerToleranceSquared", math_utils_default.EPSILON1);
4485
+ _defineProperty(this, "squaredXOverSquaredZ", void 0);
4208
4486
  assert4(x >= 0);
4209
4487
  assert4(y >= 0);
4210
4488
  assert4(z >= 0);
@@ -4215,7 +4493,6 @@
4215
4493
  this.oneOverRadiiSquared = new Vector3(x === 0 ? 0 : 1 / (x * x), y === 0 ? 0 : 1 / (y * y), z === 0 ? 0 : 1 / (z * z));
4216
4494
  this.minimumRadius = Math.min(x, y, z);
4217
4495
  this.maximumRadius = Math.max(x, y, z);
4218
- this.centerToleranceSquared = math_utils_default.EPSILON1;
4219
4496
  if (this.radiiSquared.z !== 0) {
4220
4497
  this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;
4221
4498
  }
@@ -4302,9 +4579,10 @@
4302
4579
  return scratchPosition.set(0, 0, z).to(result);
4303
4580
  }
4304
4581
  };
4582
+ _defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
4305
4583
 
4306
4584
  // ../images/src/lib/utils/version.ts
4307
- var VERSION4 = true ? "4.0.0-alpha.5" : "latest";
4585
+ var VERSION4 = true ? "4.0.0-alpha.7" : "latest";
4308
4586
 
4309
4587
  // ../images/src/lib/category-api/image-type.ts
4310
4588
  var { _parseImageNode } = globalThis;
@@ -4428,9 +4706,9 @@
4428
4706
  await image.decode();
4429
4707
  return image;
4430
4708
  }
4431
- return await new Promise((resolve, reject) => {
4709
+ return await new Promise((resolve2, reject) => {
4432
4710
  try {
4433
- image.onload = () => resolve(image);
4711
+ image.onload = () => resolve2(image);
4434
4712
  image.onerror = (err) => reject(new Error(`Could not load image ${url}: ${err}`));
4435
4713
  } catch (error) {
4436
4714
  reject(error);
@@ -4473,12 +4751,60 @@
4473
4751
  return true;
4474
4752
  }
4475
4753
 
4754
+ // ../images/src/lib/category-api/parse-isobmff-binary.ts
4755
+ function getISOBMFFMediaType(buffer) {
4756
+ if (!checkString(buffer, "ftyp", 4)) {
4757
+ return null;
4758
+ }
4759
+ if ((buffer[8] & 96) === 0) {
4760
+ return null;
4761
+ }
4762
+ return decodeMajorBrand(buffer);
4763
+ }
4764
+ function decodeMajorBrand(buffer) {
4765
+ const brandMajor = getUTF8String(buffer, 8, 12).replace("\0", " ").trim();
4766
+ switch (brandMajor) {
4767
+ case "avif":
4768
+ case "avis":
4769
+ return { extension: "avif", mimeType: "image/avif" };
4770
+ default:
4771
+ return null;
4772
+ }
4773
+ }
4774
+ function getUTF8String(array, start, end) {
4775
+ return String.fromCharCode(...array.slice(start, end));
4776
+ }
4777
+ function stringToBytes(string) {
4778
+ return [...string].map((character) => character.charCodeAt(0));
4779
+ }
4780
+ function checkString(buffer, header, offset = 0) {
4781
+ const headerBytes = stringToBytes(header);
4782
+ for (let i2 = 0; i2 < headerBytes.length; ++i2) {
4783
+ if (headerBytes[i2] !== buffer[i2 + offset]) {
4784
+ return false;
4785
+ }
4786
+ }
4787
+ return true;
4788
+ }
4789
+
4476
4790
  // ../images/src/lib/category-api/binary-image-api.ts
4477
4791
  var BIG_ENDIAN = false;
4478
4792
  var LITTLE_ENDIAN = true;
4479
4793
  function getBinaryImageMetadata(binaryData) {
4480
4794
  const dataView = toDataView(binaryData);
4481
- return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView);
4795
+ return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView) || getISOBMFFMetadata(dataView);
4796
+ }
4797
+ function getISOBMFFMetadata(binaryData) {
4798
+ const buffer = new Uint8Array(binaryData instanceof DataView ? binaryData.buffer : binaryData);
4799
+ const mediaType = getISOBMFFMediaType(buffer);
4800
+ if (!mediaType) {
4801
+ return null;
4802
+ }
4803
+ return {
4804
+ mimeType: mediaType.mimeType,
4805
+ width: 0,
4806
+ height: 0
4807
+ };
4482
4808
  }
4483
4809
  function getPngMetadata(binaryData) {
4484
4810
  const dataView = toDataView(binaryData);
@@ -4623,12 +4949,13 @@
4623
4949
  }
4624
4950
 
4625
4951
  // ../images/src/image-loader.ts
4626
- var EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg"];
4952
+ var EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg", "avif"];
4627
4953
  var MIME_TYPES = [
4628
4954
  "image/png",
4629
4955
  "image/jpeg",
4630
4956
  "image/gif",
4631
4957
  "image/webp",
4958
+ "image/avif",
4632
4959
  "image/bmp",
4633
4960
  "image/vnd.microsoft.icon",
4634
4961
  "image/svg+xml"
@@ -4652,7 +4979,7 @@
4652
4979
  };
4653
4980
 
4654
4981
  // ../draco/src/lib/utils/version.ts
4655
- var VERSION5 = true ? "4.0.0-alpha.5" : "latest";
4982
+ var VERSION5 = true ? "4.0.0-alpha.7" : "latest";
4656
4983
 
4657
4984
  // ../draco/src/draco-loader.ts
4658
4985
  var DEFAULT_DRACO_OPTIONS = {
@@ -4667,7 +4994,6 @@
4667
4994
  name: "Draco",
4668
4995
  id: "draco",
4669
4996
  module: "draco",
4670
- shapes: ["mesh"],
4671
4997
  version: VERSION5,
4672
4998
  worker: true,
4673
4999
  extensions: ["drc"],
@@ -4677,7 +5003,32 @@
4677
5003
  options: DEFAULT_DRACO_OPTIONS
4678
5004
  };
4679
5005
 
4680
- // ../schema/src/category/mesh/mesh-utils.ts
5006
+ // ../schema/src/lib/table/simple-table/data-type.ts
5007
+ function getDataTypeFromTypedArray(array) {
5008
+ switch (array.constructor) {
5009
+ case Int8Array:
5010
+ return "int8";
5011
+ case Uint8Array:
5012
+ case Uint8ClampedArray:
5013
+ return "uint8";
5014
+ case Int16Array:
5015
+ return "int16";
5016
+ case Uint16Array:
5017
+ return "uint16";
5018
+ case Int32Array:
5019
+ return "int32";
5020
+ case Uint32Array:
5021
+ return "uint32";
5022
+ case Float32Array:
5023
+ return "float32";
5024
+ case Float64Array:
5025
+ return "float64";
5026
+ default:
5027
+ return "null";
5028
+ }
5029
+ }
5030
+
5031
+ // ../schema/src/lib/mesh/mesh-utils.ts
4681
5032
  function getMeshBoundingBox(attributes) {
4682
5033
  let minX = Infinity;
4683
5034
  let minY = Infinity;
@@ -4704,500 +5055,34 @@
4704
5055
  ];
4705
5056
  }
4706
5057
 
4707
- // ../schema/src/lib/utils/assert.ts
4708
- function assert5(condition, message) {
4709
- if (!condition) {
4710
- throw new Error(message || "loader assertion failed.");
4711
- }
4712
- }
4713
-
4714
- // ../schema/src/lib/schema/impl/schema.ts
4715
- var Schema = class {
4716
- constructor(fields, metadata) {
4717
- assert5(Array.isArray(fields));
4718
- checkNames(fields);
4719
- this.fields = fields;
4720
- this.metadata = metadata || new Map();
4721
- }
4722
- compareTo(other) {
4723
- if (this.metadata !== other.metadata) {
4724
- return false;
4725
- }
4726
- if (this.fields.length !== other.fields.length) {
4727
- return false;
4728
- }
4729
- for (let i2 = 0; i2 < this.fields.length; ++i2) {
4730
- if (!this.fields[i2].compareTo(other.fields[i2])) {
4731
- return false;
4732
- }
4733
- }
4734
- return true;
4735
- }
4736
- select(...columnNames) {
4737
- const nameMap = Object.create(null);
4738
- for (const name of columnNames) {
4739
- nameMap[name] = true;
4740
- }
4741
- const selectedFields = this.fields.filter((field) => nameMap[field.name]);
4742
- return new Schema(selectedFields, this.metadata);
4743
- }
4744
- selectAt(...columnIndices) {
4745
- const selectedFields = columnIndices.map((index) => this.fields[index]).filter(Boolean);
4746
- return new Schema(selectedFields, this.metadata);
4747
- }
4748
- assign(schemaOrFields) {
4749
- let fields;
4750
- let metadata = this.metadata;
4751
- if (schemaOrFields instanceof Schema) {
4752
- const otherSchema = schemaOrFields;
4753
- fields = otherSchema.fields;
4754
- metadata = mergeMaps(mergeMaps(new Map(), this.metadata), otherSchema.metadata);
4755
- } else {
4756
- fields = schemaOrFields;
4757
- }
4758
- const fieldMap = Object.create(null);
4759
- for (const field of this.fields) {
4760
- fieldMap[field.name] = field;
4761
- }
4762
- for (const field of fields) {
4763
- fieldMap[field.name] = field;
4764
- }
4765
- const mergedFields = Object.values(fieldMap);
4766
- return new Schema(mergedFields, metadata);
4767
- }
4768
- };
4769
- function checkNames(fields) {
4770
- const usedNames = {};
4771
- for (const field of fields) {
4772
- if (usedNames[field.name]) {
4773
- console.warn("Schema: duplicated field name", field.name, field);
4774
- }
4775
- usedNames[field.name] = true;
4776
- }
4777
- }
4778
- function mergeMaps(m1, m2) {
4779
- return new Map([...m1 || new Map(), ...m2 || new Map()]);
4780
- }
4781
-
4782
- // ../schema/src/lib/schema/impl/field.ts
4783
- var Field = class {
4784
- constructor(name, type, nullable = false, metadata = new Map()) {
4785
- this.name = name;
4786
- this.type = type;
4787
- this.nullable = nullable;
4788
- this.metadata = metadata;
4789
- }
4790
- get typeId() {
4791
- return this.type && this.type.typeId;
4792
- }
4793
- clone() {
4794
- return new Field(this.name, this.type, this.nullable, this.metadata);
4795
- }
4796
- compareTo(other) {
4797
- return this.name === other.name && this.type === other.type && this.nullable === other.nullable && this.metadata === other.metadata;
4798
- }
4799
- toString() {
4800
- return `${this.type}${this.nullable ? ", nullable" : ""}${this.metadata ? `, metadata: ${this.metadata}` : ""}`;
4801
- }
4802
- };
4803
-
4804
- // ../schema/src/lib/schema/impl/enum.ts
4805
- var Type;
4806
- (function(Type2) {
4807
- Type2[Type2["NONE"] = 0] = "NONE";
4808
- Type2[Type2["Null"] = 1] = "Null";
4809
- Type2[Type2["Int"] = 2] = "Int";
4810
- Type2[Type2["Float"] = 3] = "Float";
4811
- Type2[Type2["Binary"] = 4] = "Binary";
4812
- Type2[Type2["Utf8"] = 5] = "Utf8";
4813
- Type2[Type2["Bool"] = 6] = "Bool";
4814
- Type2[Type2["Decimal"] = 7] = "Decimal";
4815
- Type2[Type2["Date"] = 8] = "Date";
4816
- Type2[Type2["Time"] = 9] = "Time";
4817
- Type2[Type2["Timestamp"] = 10] = "Timestamp";
4818
- Type2[Type2["Interval"] = 11] = "Interval";
4819
- Type2[Type2["List"] = 12] = "List";
4820
- Type2[Type2["Struct"] = 13] = "Struct";
4821
- Type2[Type2["Union"] = 14] = "Union";
4822
- Type2[Type2["FixedSizeBinary"] = 15] = "FixedSizeBinary";
4823
- Type2[Type2["FixedSizeList"] = 16] = "FixedSizeList";
4824
- Type2[Type2["Map"] = 17] = "Map";
4825
- Type2[Type2["Dictionary"] = -1] = "Dictionary";
4826
- Type2[Type2["Int8"] = -2] = "Int8";
4827
- Type2[Type2["Int16"] = -3] = "Int16";
4828
- Type2[Type2["Int32"] = -4] = "Int32";
4829
- Type2[Type2["Int64"] = -5] = "Int64";
4830
- Type2[Type2["Uint8"] = -6] = "Uint8";
4831
- Type2[Type2["Uint16"] = -7] = "Uint16";
4832
- Type2[Type2["Uint32"] = -8] = "Uint32";
4833
- Type2[Type2["Uint64"] = -9] = "Uint64";
4834
- Type2[Type2["Float16"] = -10] = "Float16";
4835
- Type2[Type2["Float32"] = -11] = "Float32";
4836
- Type2[Type2["Float64"] = -12] = "Float64";
4837
- Type2[Type2["DateDay"] = -13] = "DateDay";
4838
- Type2[Type2["DateMillisecond"] = -14] = "DateMillisecond";
4839
- Type2[Type2["TimestampSecond"] = -15] = "TimestampSecond";
4840
- Type2[Type2["TimestampMillisecond"] = -16] = "TimestampMillisecond";
4841
- Type2[Type2["TimestampMicrosecond"] = -17] = "TimestampMicrosecond";
4842
- Type2[Type2["TimestampNanosecond"] = -18] = "TimestampNanosecond";
4843
- Type2[Type2["TimeSecond"] = -19] = "TimeSecond";
4844
- Type2[Type2["TimeMillisecond"] = -20] = "TimeMillisecond";
4845
- Type2[Type2["TimeMicrosecond"] = -21] = "TimeMicrosecond";
4846
- Type2[Type2["TimeNanosecond"] = -22] = "TimeNanosecond";
4847
- Type2[Type2["DenseUnion"] = -23] = "DenseUnion";
4848
- Type2[Type2["SparseUnion"] = -24] = "SparseUnion";
4849
- Type2[Type2["IntervalDayTime"] = -25] = "IntervalDayTime";
4850
- Type2[Type2["IntervalYearMonth"] = -26] = "IntervalYearMonth";
4851
- })(Type || (Type = {}));
4852
-
4853
- // ../schema/src/lib/schema/impl/type.ts
4854
- var DataType = class {
4855
- static isNull(x) {
4856
- return x && x.typeId === Type.Null;
4857
- }
4858
- static isInt(x) {
4859
- return x && x.typeId === Type.Int;
4860
- }
4861
- static isFloat(x) {
4862
- return x && x.typeId === Type.Float;
4863
- }
4864
- static isBinary(x) {
4865
- return x && x.typeId === Type.Binary;
4866
- }
4867
- static isUtf8(x) {
4868
- return x && x.typeId === Type.Utf8;
4869
- }
4870
- static isBool(x) {
4871
- return x && x.typeId === Type.Bool;
4872
- }
4873
- static isDecimal(x) {
4874
- return x && x.typeId === Type.Decimal;
4875
- }
4876
- static isDate(x) {
4877
- return x && x.typeId === Type.Date;
4878
- }
4879
- static isTime(x) {
4880
- return x && x.typeId === Type.Time;
4881
- }
4882
- static isTimestamp(x) {
4883
- return x && x.typeId === Type.Timestamp;
4884
- }
4885
- static isInterval(x) {
4886
- return x && x.typeId === Type.Interval;
4887
- }
4888
- static isList(x) {
4889
- return x && x.typeId === Type.List;
4890
- }
4891
- static isStruct(x) {
4892
- return x && x.typeId === Type.Struct;
4893
- }
4894
- static isUnion(x) {
4895
- return x && x.typeId === Type.Union;
4896
- }
4897
- static isFixedSizeBinary(x) {
4898
- return x && x.typeId === Type.FixedSizeBinary;
4899
- }
4900
- static isFixedSizeList(x) {
4901
- return x && x.typeId === Type.FixedSizeList;
4902
- }
4903
- static isMap(x) {
4904
- return x && x.typeId === Type.Map;
4905
- }
4906
- static isDictionary(x) {
4907
- return x && x.typeId === Type.Dictionary;
4908
- }
4909
- get typeId() {
4910
- return Type.NONE;
4911
- }
4912
- compareTo(other) {
4913
- return this === other;
4914
- }
4915
- };
4916
- var Null = class extends DataType {
4917
- get typeId() {
4918
- return Type.Null;
4919
- }
4920
- get [Symbol.toStringTag]() {
4921
- return "Null";
4922
- }
4923
- toString() {
4924
- return "Null";
4925
- }
4926
- };
4927
- var Bool = class extends DataType {
4928
- get typeId() {
4929
- return Type.Bool;
4930
- }
4931
- get [Symbol.toStringTag]() {
4932
- return "Bool";
4933
- }
4934
- toString() {
4935
- return "Bool";
4936
- }
4937
- };
4938
- var Int = class extends DataType {
4939
- constructor(isSigned, bitWidth) {
4940
- super();
4941
- this.isSigned = isSigned;
4942
- this.bitWidth = bitWidth;
4943
- }
4944
- get typeId() {
4945
- return Type.Int;
4946
- }
4947
- get [Symbol.toStringTag]() {
4948
- return "Int";
4949
- }
4950
- toString() {
4951
- return `${this.isSigned ? "I" : "Ui"}nt${this.bitWidth}`;
4952
- }
4953
- };
4954
- var Int8 = class extends Int {
4955
- constructor() {
4956
- super(true, 8);
4957
- }
4958
- };
4959
- var Int16 = class extends Int {
4960
- constructor() {
4961
- super(true, 16);
4962
- }
4963
- };
4964
- var Int32 = class extends Int {
4965
- constructor() {
4966
- super(true, 32);
4967
- }
4968
- };
4969
- var Uint8 = class extends Int {
4970
- constructor() {
4971
- super(false, 8);
4972
- }
4973
- };
4974
- var Uint16 = class extends Int {
4975
- constructor() {
4976
- super(false, 16);
4977
- }
4978
- };
4979
- var Uint32 = class extends Int {
4980
- constructor() {
4981
- super(false, 32);
4982
- }
4983
- };
4984
- var Precision = {
4985
- HALF: 16,
4986
- SINGLE: 32,
4987
- DOUBLE: 64
4988
- };
4989
- var Float = class extends DataType {
4990
- constructor(precision) {
4991
- super();
4992
- this.precision = precision;
4993
- }
4994
- get typeId() {
4995
- return Type.Float;
4996
- }
4997
- get [Symbol.toStringTag]() {
4998
- return "Float";
4999
- }
5000
- toString() {
5001
- return `Float${this.precision}`;
5002
- }
5003
- };
5004
- var Float32 = class extends Float {
5005
- constructor() {
5006
- super(Precision.SINGLE);
5007
- }
5008
- };
5009
- var Float64 = class extends Float {
5010
- constructor() {
5011
- super(Precision.DOUBLE);
5012
- }
5013
- };
5014
- var Binary = class extends DataType {
5015
- constructor() {
5016
- super();
5017
- }
5018
- get typeId() {
5019
- return Type.Binary;
5020
- }
5021
- toString() {
5022
- return "Binary";
5023
- }
5024
- get [Symbol.toStringTag]() {
5025
- return "Binary";
5026
- }
5027
- };
5028
- var Utf8 = class extends DataType {
5029
- get typeId() {
5030
- return Type.Utf8;
5031
- }
5032
- get [Symbol.toStringTag]() {
5033
- return "Utf8";
5034
- }
5035
- toString() {
5036
- return "Utf8";
5037
- }
5038
- };
5039
- var DateUnit = {
5040
- DAY: 0,
5041
- MILLISECOND: 1
5042
- };
5043
- var Date2 = class extends DataType {
5044
- constructor(unit) {
5045
- super();
5046
- this.unit = unit;
5047
- }
5048
- get typeId() {
5049
- return Type.Date;
5050
- }
5051
- get [Symbol.toStringTag]() {
5052
- return "Date";
5053
- }
5054
- toString() {
5055
- return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;
5056
- }
5057
- };
5058
- var TimeUnit = {
5059
- SECOND: 1,
5060
- MILLISECOND: 1e3,
5061
- MICROSECOND: 1e6,
5062
- NANOSECOND: 1e9
5063
- };
5064
- var Time = class extends DataType {
5065
- constructor(unit, bitWidth) {
5066
- super();
5067
- this.unit = unit;
5068
- this.bitWidth = bitWidth;
5069
- }
5070
- get typeId() {
5071
- return Type.Time;
5072
- }
5073
- toString() {
5074
- return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
5075
- }
5076
- get [Symbol.toStringTag]() {
5077
- return "Time";
5078
- }
5079
- };
5080
- var Timestamp = class extends DataType {
5081
- constructor(unit, timezone = null) {
5082
- super();
5083
- this.unit = unit;
5084
- this.timezone = timezone;
5085
- }
5086
- get typeId() {
5087
- return Type.Timestamp;
5088
- }
5089
- get [Symbol.toStringTag]() {
5090
- return "Timestamp";
5091
- }
5092
- toString() {
5093
- return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ""}>`;
5094
- }
5095
- };
5096
- var IntervalUnit = {
5097
- DAY_TIME: 0,
5098
- YEAR_MONTH: 1
5099
- };
5100
- var Interval = class extends DataType {
5101
- constructor(unit) {
5102
- super();
5103
- this.unit = unit;
5104
- }
5105
- get typeId() {
5106
- return Type.Interval;
5107
- }
5108
- get [Symbol.toStringTag]() {
5109
- return "Interval";
5110
- }
5111
- toString() {
5112
- return `Interval<${IntervalUnit[this.unit]}>`;
5113
- }
5114
- };
5115
- var FixedSizeList = class extends DataType {
5116
- constructor(listSize, child) {
5117
- super();
5118
- this.listSize = listSize;
5119
- this.children = [child];
5120
- }
5121
- get typeId() {
5122
- return Type.FixedSizeList;
5123
- }
5124
- get valueType() {
5125
- return this.children[0].type;
5126
- }
5127
- get valueField() {
5128
- return this.children[0];
5129
- }
5130
- get [Symbol.toStringTag]() {
5131
- return "FixedSizeList";
5132
- }
5133
- toString() {
5134
- return `FixedSizeList[${this.listSize}]<${this.valueType}>`;
5135
- }
5136
- };
5137
- var Struct = class extends DataType {
5138
- constructor(children) {
5139
- super();
5140
- this.children = children;
5141
- }
5142
- get typeId() {
5143
- return Type.Struct;
5144
- }
5145
- toString() {
5146
- return `Struct<{${this.children.map((f2) => `${f2.name}:${f2.type}`).join(", ")}}>`;
5147
- }
5148
- get [Symbol.toStringTag]() {
5149
- return "Struct";
5150
- }
5151
- };
5152
-
5153
- // ../schema/src/lib/arrow/arrow-like-type-utils.ts
5154
- function getArrowTypeFromTypedArray(array) {
5155
- switch (array.constructor) {
5156
- case Int8Array:
5157
- return new Int8();
5158
- case Uint8Array:
5159
- return new Uint8();
5160
- case Int16Array:
5161
- return new Int16();
5162
- case Uint16Array:
5163
- return new Uint16();
5164
- case Int32Array:
5165
- return new Int32();
5166
- case Uint32Array:
5167
- return new Uint32();
5168
- case Float32Array:
5169
- return new Float32();
5170
- case Float64Array:
5171
- return new Float64();
5172
- default:
5173
- throw new Error("array type not supported");
5174
- }
5175
- }
5176
-
5177
- // ../schema/src/category/mesh/deduce-mesh-schema.ts
5178
- function deduceMeshField(attributeName, attribute, optionalMetadata) {
5179
- const type = getArrowTypeFromTypedArray(attribute.value);
5058
+ // ../schema/src/lib/mesh/deduce-mesh-schema.ts
5059
+ function deduceMeshField(name, attribute, optionalMetadata) {
5060
+ const type = getDataTypeFromTypedArray(attribute.value);
5180
5061
  const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
5181
- const field = new Field(attributeName, new FixedSizeList(attribute.size, new Field("value", type)), false, metadata);
5182
- return field;
5062
+ return {
5063
+ name,
5064
+ type: { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "value", type }] },
5065
+ nullable: false,
5066
+ metadata
5067
+ };
5183
5068
  }
5184
5069
  function makeMeshAttributeMetadata(attribute) {
5185
- const result = new Map();
5070
+ const result = {};
5186
5071
  if ("byteOffset" in attribute) {
5187
- result.set("byteOffset", attribute.byteOffset.toString(10));
5072
+ result.byteOffset = attribute.byteOffset.toString(10);
5188
5073
  }
5189
5074
  if ("byteStride" in attribute) {
5190
- result.set("byteStride", attribute.byteStride.toString(10));
5075
+ result.byteStride = attribute.byteStride.toString(10);
5191
5076
  }
5192
5077
  if ("normalized" in attribute) {
5193
- result.set("normalized", attribute.normalized.toString());
5078
+ result.normalized = attribute.normalized.toString();
5194
5079
  }
5195
5080
  return result;
5196
5081
  }
5197
5082
 
5198
5083
  // ../draco/src/lib/utils/get-draco-schema.ts
5199
5084
  function getDracoSchema(attributes, loaderData, indices) {
5200
- const metadataMap = makeMetadata(loaderData.metadata);
5085
+ const metadata = makeMetadata(loaderData.metadata);
5201
5086
  const fields = [];
5202
5087
  const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);
5203
5088
  for (const attributeName in attributes) {
@@ -5209,7 +5094,7 @@
5209
5094
  const indicesField = getArrowFieldFromAttribute("indices", indices);
5210
5095
  fields.push(indicesField);
5211
5096
  }
5212
- return new Schema(fields, metadataMap);
5097
+ return { fields, metadata };
5213
5098
  }
5214
5099
  function transformAttributesLoaderData(loaderData) {
5215
5100
  const result = {};
@@ -5225,11 +5110,12 @@
5225
5110
  return field;
5226
5111
  }
5227
5112
  function makeMetadata(metadata) {
5228
- const metadataMap = new Map();
5113
+ Object.entries(metadata);
5114
+ const serializedMetadata = {};
5229
5115
  for (const key in metadata) {
5230
- metadataMap.set(`${key}.string`, JSON.stringify(metadata[key]));
5116
+ serializedMetadata[`${key}.string`] = JSON.stringify(metadata[key]);
5231
5117
  }
5232
- return metadataMap;
5118
+ return serializedMetadata;
5233
5119
  }
5234
5120
 
5235
5121
  // ../draco/src/lib/draco-parser.ts
@@ -5573,11 +5459,13 @@
5573
5459
  }
5574
5460
 
5575
5461
  // ../draco/src/lib/draco-module-loader.ts
5576
- var DRACO_VERSION = "1.4.1";
5577
- var DRACO_JS_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_decoder.js`;
5578
- var DRACO_WASM_WRAPPER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_wasm_wrapper.js`;
5579
- var DRACO_WASM_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_decoder.wasm`;
5580
- var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_VERSION}/javascript/draco_encoder.js`;
5462
+ var DRACO_DECODER_VERSION = "1.5.5";
5463
+ var DRACO_ENCODER_VERSION = "1.4.1";
5464
+ var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
5465
+ var DRACO_JS_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.js`;
5466
+ var DRACO_WASM_WRAPPER_URL = `${STATIC_DECODER_URL}/draco_wasm_wrapper.js`;
5467
+ var DRACO_WASM_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.wasm`;
5468
+ var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/draco_encoder.js`;
5581
5469
  var loadDecoderPromise;
5582
5470
  async function loadDracoDecoderModule(options) {
5583
5471
  const modules = options.modules || {};
@@ -5612,10 +5500,10 @@
5612
5500
  if (wasmBinary) {
5613
5501
  options.wasmBinary = wasmBinary;
5614
5502
  }
5615
- return new Promise((resolve) => {
5503
+ return new Promise((resolve2) => {
5616
5504
  DracoDecoderModule({
5617
5505
  ...options,
5618
- onModuleLoaded: (draco) => resolve({ draco })
5506
+ onModuleLoaded: (draco) => resolve2({ draco })
5619
5507
  });
5620
5508
  });
5621
5509
  }
@@ -5636,10 +5524,10 @@
5636
5524
  }
5637
5525
 
5638
5526
  // ../textures/src/lib/utils/version.ts
5639
- var VERSION6 = true ? "4.0.0-alpha.5" : "beta";
5527
+ var VERSION6 = true ? "4.0.0-alpha.7" : "beta";
5640
5528
 
5641
5529
  // ../textures/src/lib/parsers/basis-module-loader.ts
5642
- var VERSION7 = true ? "4.0.0-alpha.5" : "beta";
5530
+ var VERSION7 = true ? "4.0.0-alpha.7" : "beta";
5643
5531
  var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.wasm`;
5644
5532
  var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.js`;
5645
5533
  var loadBasisTranscoderPromise;
@@ -5666,11 +5554,11 @@
5666
5554
  if (wasmBinary) {
5667
5555
  options.wasmBinary = wasmBinary;
5668
5556
  }
5669
- return new Promise((resolve) => {
5670
- BasisModule(options).then((module2) => {
5671
- const { BasisFile, initializeBasis } = module2;
5557
+ return new Promise((resolve2) => {
5558
+ BasisModule(options).then((module) => {
5559
+ const { BasisFile, initializeBasis } = module;
5672
5560
  initializeBasis();
5673
- resolve({ BasisFile });
5561
+ resolve2({ BasisFile });
5674
5562
  });
5675
5563
  });
5676
5564
  }
@@ -5698,11 +5586,11 @@
5698
5586
  if (wasmBinary) {
5699
5587
  options.wasmBinary = wasmBinary;
5700
5588
  }
5701
- return new Promise((resolve) => {
5702
- BasisEncoderModule(options).then((module2) => {
5703
- const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module2;
5589
+ return new Promise((resolve2) => {
5590
+ BasisEncoderModule(options).then((module) => {
5591
+ const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module;
5704
5592
  initializeBasis();
5705
- resolve({ BasisFile, KTX2File, BasisEncoder });
5593
+ resolve2({ BasisFile, KTX2File, BasisEncoder });
5706
5594
  });
5707
5595
  });
5708
5596
  }
@@ -6188,6 +6076,7 @@
6188
6076
  height,
6189
6077
  data: decodedData,
6190
6078
  compressed,
6079
+ levelSize: decodedSize,
6191
6080
  hasAlpha: alphaFlag,
6192
6081
  format
6193
6082
  };
@@ -6605,7 +6494,7 @@
6605
6494
  }
6606
6495
 
6607
6496
  // ../../node_modules/@luma.gl/constants/dist/esm/index.js
6608
- var esm_default2 = {
6497
+ var esm_default = {
6609
6498
  DEPTH_BUFFER_BIT: 256,
6610
6499
  STENCIL_BUFFER_BIT: 1024,
6611
6500
  COLOR_BUFFER_BIT: 16384,
@@ -7240,11 +7129,11 @@
7240
7129
  }
7241
7130
  }
7242
7131
  var GL_TYPE_MAP = {
7243
- UInt8: esm_default2.UNSIGNED_BYTE,
7244
- UInt16: esm_default2.UNSIGNED_INT,
7245
- Float32: esm_default2.FLOAT,
7246
- UInt32: esm_default2.UNSIGNED_INT,
7247
- UInt64: esm_default2.DOUBLE
7132
+ UInt8: esm_default.UNSIGNED_BYTE,
7133
+ UInt16: esm_default.UNSIGNED_SHORT,
7134
+ Float32: esm_default.FLOAT,
7135
+ UInt32: esm_default.UNSIGNED_INT,
7136
+ UInt64: esm_default.DOUBLE
7248
7137
  };
7249
7138
  function sizeOf(dataType) {
7250
7139
  switch (dataType) {
@@ -7265,6 +7154,10 @@
7265
7154
  throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);
7266
7155
  }
7267
7156
  }
7157
+ var STRING_ATTRIBUTE_TYPE = "String";
7158
+ var OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
7159
+ var FLOAT_64_TYPE = "Float64";
7160
+ var INT_16_ATTRIBUTE_TYPE = "Int16";
7268
7161
  var COORDINATE_SYSTEM;
7269
7162
  (function(COORDINATE_SYSTEM2) {
7270
7163
  COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["DEFAULT"] = -1] = "DEFAULT";
@@ -7274,6 +7167,145 @@
7274
7167
  COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["CARTESIAN"] = 0] = "CARTESIAN";
7275
7168
  })(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
7276
7169
 
7170
+ // src/lib/parsers/parse-i3s-attribute.ts
7171
+ function parseI3STileAttribute(arrayBuffer, options) {
7172
+ const { attributeName, attributeType } = options;
7173
+ if (!attributeName) {
7174
+ return {};
7175
+ }
7176
+ return {
7177
+ [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null
7178
+ };
7179
+ }
7180
+ function parseAttribute(attributeType, arrayBuffer) {
7181
+ switch (attributeType) {
7182
+ case STRING_ATTRIBUTE_TYPE:
7183
+ return parseStringsAttribute(arrayBuffer);
7184
+ case OBJECT_ID_ATTRIBUTE_TYPE:
7185
+ return parseShortNumberAttribute(arrayBuffer);
7186
+ case FLOAT_64_TYPE:
7187
+ return parseFloatAttribute(arrayBuffer);
7188
+ case INT_16_ATTRIBUTE_TYPE:
7189
+ return parseInt16ShortNumberAttribute(arrayBuffer);
7190
+ default:
7191
+ return parseShortNumberAttribute(arrayBuffer);
7192
+ }
7193
+ }
7194
+ function parseShortNumberAttribute(arrayBuffer) {
7195
+ const countOffset = 4;
7196
+ return new Uint32Array(arrayBuffer, countOffset);
7197
+ }
7198
+ function parseInt16ShortNumberAttribute(arrayBuffer) {
7199
+ const countOffset = 4;
7200
+ return new Int16Array(arrayBuffer, countOffset);
7201
+ }
7202
+ function parseFloatAttribute(arrayBuffer) {
7203
+ const countOffset = 8;
7204
+ return new Float64Array(arrayBuffer, countOffset);
7205
+ }
7206
+ function parseStringsAttribute(arrayBuffer) {
7207
+ const stringsCountOffset = 0;
7208
+ const dataOffset = 8;
7209
+ const bytesPerStringSize = 4;
7210
+ const stringsArray = [];
7211
+ try {
7212
+ const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);
7213
+ const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
7214
+ let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
7215
+ for (const stringByteSize of stringSizes) {
7216
+ const textDecoder = new TextDecoder("utf-8");
7217
+ const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);
7218
+ stringsArray.push(textDecoder.decode(stringAttribute));
7219
+ stringOffset += stringByteSize;
7220
+ }
7221
+ } catch (error) {
7222
+ console.error("Parse string attribute error: ", error.message);
7223
+ }
7224
+ return stringsArray;
7225
+ }
7226
+
7227
+ // src/i3s-attribute-loader.ts
7228
+ var VERSION8 = true ? "4.0.0-alpha.7" : "latest";
7229
+ var I3SAttributeLoader = {
7230
+ name: "I3S Attribute",
7231
+ id: "i3s-attribute",
7232
+ module: "i3s",
7233
+ version: VERSION8,
7234
+ mimeTypes: ["application/binary"],
7235
+ parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
7236
+ extensions: ["bin"],
7237
+ options: {},
7238
+ binary: true
7239
+ };
7240
+ function getAttributeValueType(attribute) {
7241
+ if (attribute.hasOwnProperty("objectIds")) {
7242
+ return "Oid32";
7243
+ } else if (attribute.hasOwnProperty("attributeValues")) {
7244
+ return attribute.attributeValues.valueType;
7245
+ }
7246
+ return "";
7247
+ }
7248
+
7249
+ // src/lib/utils/customizeColors.ts
7250
+ async function customizeColors(colors, featureIds, tileOptions, tilesetOptions, options) {
7251
+ if (!options?.i3s?.colorsByAttribute) {
7252
+ return colors;
7253
+ }
7254
+ const colorizeAttributeField = tilesetOptions.fields.find(({ name }) => name === options?.i3s?.colorsByAttribute?.attributeName);
7255
+ if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(colorizeAttributeField.type)) {
7256
+ return colors;
7257
+ }
7258
+ const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, tileOptions, tilesetOptions, options);
7259
+ if (!colorizeAttributeData) {
7260
+ return colors;
7261
+ }
7262
+ const objectIdField = tilesetOptions.fields.find(({ type }) => type === "esriFieldTypeOID");
7263
+ if (!objectIdField) {
7264
+ return colors;
7265
+ }
7266
+ const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, tileOptions, tilesetOptions, options);
7267
+ if (!objectIdAttributeData) {
7268
+ return colors;
7269
+ }
7270
+ const attributeValuesMap = {};
7271
+ for (let i2 = 0; i2 < objectIdAttributeData[objectIdField.name].length; i2++) {
7272
+ attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i2], options);
7273
+ }
7274
+ for (let i2 = 0; i2 < featureIds.value.length; i2++) {
7275
+ const color = attributeValuesMap[featureIds.value[i2]];
7276
+ if (!color) {
7277
+ continue;
7278
+ }
7279
+ colors.value.set(color, i2 * 4);
7280
+ }
7281
+ return colors;
7282
+ }
7283
+ function calculateColorForAttribute(attributeValue, options) {
7284
+ if (!options?.i3s?.colorsByAttribute) {
7285
+ return [255, 255, 255, 255];
7286
+ }
7287
+ const { minValue, maxValue, minColor, maxColor } = options.i3s.colorsByAttribute;
7288
+ const rate = (attributeValue - minValue) / (maxValue - minValue);
7289
+ const color = [255, 255, 255, 255];
7290
+ for (let i2 = 0; i2 < minColor.length; i2++) {
7291
+ color[i2] = Math.round((maxColor[i2] - minColor[i2]) * rate + minColor[i2]);
7292
+ }
7293
+ return color;
7294
+ }
7295
+ async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attributeStorageInfo }, options) {
7296
+ const attributeIndex = attributeStorageInfo.findIndex(({ name }) => attributeName === name);
7297
+ if (attributeIndex === -1) {
7298
+ return null;
7299
+ }
7300
+ const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);
7301
+ const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);
7302
+ const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {
7303
+ attributeName,
7304
+ attributeType
7305
+ });
7306
+ return objectIdAttributeData;
7307
+ }
7308
+
7277
7309
  // src/lib/parsers/parse-i3s-tile-content.ts
7278
7310
  var scratchVector5 = new Vector3([0, 0, 0]);
7279
7311
  function getLoaderForTextureFormat(textureFormat) {
@@ -7290,29 +7322,36 @@
7290
7322
  }
7291
7323
  }
7292
7324
  var I3S_ATTRIBUTE_TYPE = "i3s-attribute-type";
7293
- async function parseI3STileContent(arrayBuffer, tile, tileset, options, context) {
7294
- tile.content = tile.content || {};
7295
- tile.content.featureIds = tile.content.featureIds || null;
7296
- tile.content.attributes = {};
7297
- if (tile.textureUrl) {
7298
- const url = getUrlWithToken(tile.textureUrl, options?.i3s?.token);
7299
- const loader = getLoaderForTextureFormat(tile.textureFormat);
7300
- const response = await fetch(url);
7325
+ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, options, context) {
7326
+ const content = {
7327
+ attributes: {},
7328
+ indices: null,
7329
+ featureIds: [],
7330
+ vertexCount: 0,
7331
+ modelMatrix: new Matrix4(),
7332
+ coordinateSystem: 0,
7333
+ byteLength: 0,
7334
+ texture: null
7335
+ };
7336
+ if (tileOptions.textureUrl) {
7337
+ const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);
7338
+ const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
7339
+ const response = await fetch(url, options?.fetch);
7301
7340
  const arrayBuffer2 = await response.arrayBuffer();
7302
7341
  if (options?.i3s.decodeTextures) {
7303
7342
  if (loader === ImageLoader) {
7304
- const options2 = { ...tile.textureLoaderOptions, image: { type: "data" } };
7343
+ const options2 = { ...tileOptions.textureLoaderOptions, image: { type: "data" } };
7305
7344
  try {
7306
- tile.content.texture = await context.parse(arrayBuffer2, options2);
7345
+ content.texture = await context.parse(arrayBuffer2, options2);
7307
7346
  } catch (e2) {
7308
- tile.content.texture = await parse(arrayBuffer2, loader, options2);
7347
+ content.texture = await parse(arrayBuffer2, loader, options2);
7309
7348
  }
7310
7349
  } else if (loader === CompressedTextureLoader || loader === BasisLoader) {
7311
- let texture = await load(arrayBuffer2, loader, tile.textureLoaderOptions);
7350
+ let texture = await load(arrayBuffer2, loader, tileOptions.textureLoaderOptions);
7312
7351
  if (loader === BasisLoader) {
7313
7352
  texture = texture[0];
7314
7353
  }
7315
- tile.content.texture = {
7354
+ content.texture = {
7316
7355
  compressed: true,
7317
7356
  mipmaps: false,
7318
7357
  width: texture[0].width,
@@ -7321,26 +7360,23 @@
7321
7360
  };
7322
7361
  }
7323
7362
  } else {
7324
- tile.content.texture = arrayBuffer2;
7363
+ content.texture = arrayBuffer2;
7325
7364
  }
7326
7365
  }
7327
- tile.content.material = makePbrMaterial(tile.materialDefinition, tile.content.texture);
7328
- if (tile.content.material) {
7329
- tile.content.texture = null;
7366
+ content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);
7367
+ if (content.material) {
7368
+ content.texture = null;
7330
7369
  }
7331
- return await parseI3SNodeGeometry(arrayBuffer, tile, tileset, options);
7370
+ return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
7332
7371
  }
7333
- async function parseI3SNodeGeometry(arrayBuffer, tile, tileset, options) {
7334
- if (!tile.content) {
7335
- return tile;
7336
- }
7337
- const content = tile.content;
7372
+ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options) {
7373
+ const contentByteLength = arrayBuffer.byteLength;
7338
7374
  let attributes;
7339
7375
  let vertexCount;
7340
7376
  let byteOffset = 0;
7341
7377
  let featureCount = 0;
7342
7378
  let indices;
7343
- if (tile.isDracoGeometry) {
7379
+ if (tileOptions.isDracoGeometry) {
7344
7380
  const decompressedGeometry = await parse(arrayBuffer, DracoLoader2, {
7345
7381
  draco: {
7346
7382
  attributeNameEntry: I3S_ATTRIBUTE_TYPE
@@ -7375,8 +7411,8 @@
7375
7411
  ordering: attributesOrder,
7376
7412
  featureAttributes,
7377
7413
  featureAttributeOrder
7378
- } = tileset.store.defaultGeometrySchema;
7379
- const headers = parseHeaders(tileset, arrayBuffer);
7414
+ } = tilesetOptions.store.defaultGeometrySchema;
7415
+ const headers = parseHeaders(arrayBuffer, tilesetOptions);
7380
7416
  byteOffset = headers.byteOffset;
7381
7417
  vertexCount = headers.vertexCount;
7382
7418
  featureCount = headers.featureCount;
@@ -7386,23 +7422,24 @@
7386
7422
  attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
7387
7423
  }
7388
7424
  if (!options?.i3s?.coordinateSystem || options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS) {
7389
- const enuMatrix = parsePositions(attributes.position, tile);
7425
+ const enuMatrix = parsePositions(attributes.position, tileOptions);
7390
7426
  content.modelMatrix = enuMatrix.invert();
7391
7427
  content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;
7392
7428
  } else {
7393
7429
  content.modelMatrix = getModelMatrix(attributes.position);
7394
7430
  content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;
7395
7431
  }
7432
+ attributes.color = await customizeColors(attributes.color, attributes.id, tileOptions, tilesetOptions, options);
7396
7433
  content.attributes = {
7397
7434
  positions: attributes.position,
7398
7435
  normals: attributes.normal,
7399
7436
  colors: normalizeAttribute(attributes.color),
7400
7437
  texCoords: attributes.uv0,
7401
- uvRegions: normalizeAttribute(attributes.uvRegion)
7438
+ uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region)
7402
7439
  };
7403
7440
  content.indices = indices || null;
7404
7441
  if (attributes.id && attributes.id.value) {
7405
- tile.content.featureIds = attributes.id.value;
7442
+ content.featureIds = attributes.id.value;
7406
7443
  }
7407
7444
  for (const attributeIndex in content.attributes) {
7408
7445
  if (!content.attributes[attributeIndex]) {
@@ -7410,8 +7447,8 @@
7410
7447
  }
7411
7448
  }
7412
7449
  content.vertexCount = vertexCount;
7413
- content.byteLength = arrayBuffer.byteLength;
7414
- return tile;
7450
+ content.byteLength = contentByteLength;
7451
+ return content;
7415
7452
  }
7416
7453
  function updateAttributesMetadata(attributes, decompressedGeometry) {
7417
7454
  for (const key in decompressedGeometry.loaderData.attributes) {
@@ -7438,11 +7475,11 @@
7438
7475
  attribute.normalized = true;
7439
7476
  return attribute;
7440
7477
  }
7441
- function parseHeaders(tileset, arrayBuffer) {
7478
+ function parseHeaders(arrayBuffer, options) {
7442
7479
  let byteOffset = 0;
7443
7480
  let vertexCount = 0;
7444
7481
  let featureCount = 0;
7445
- for (const { property, type } of tileset.store.defaultGeometrySchema.header) {
7482
+ for (const { property, type } of options.store.defaultGeometrySchema.header) {
7446
7483
  const TypedArrayTypeHeader = getConstructorForDataFormat(type);
7447
7484
  switch (property) {
7448
7485
  case HeaderAttributeProperty.vertexCount:
@@ -7463,38 +7500,38 @@
7463
7500
  byteOffset
7464
7501
  };
7465
7502
  }
7466
- function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder) {
7503
+ function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attributeCount, attributesOrder) {
7467
7504
  const attributes = {};
7468
7505
  for (const attribute of attributesOrder) {
7469
7506
  if (vertexAttributes[attribute]) {
7470
7507
  const { valueType, valuesPerElement } = vertexAttributes[attribute];
7471
- const count = vertexCount;
7472
- if (byteOffset + count * valuesPerElement > arrayBuffer.byteLength) {
7508
+ if (byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <= arrayBuffer.byteLength) {
7509
+ const buffer = arrayBuffer.slice(byteOffset);
7510
+ let value;
7511
+ if (valueType === "UInt64") {
7512
+ value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));
7513
+ } else {
7514
+ const TypedArrayType = getConstructorForDataFormat(valueType);
7515
+ value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);
7516
+ }
7517
+ attributes[attribute] = {
7518
+ value,
7519
+ type: GL_TYPE_MAP[valueType],
7520
+ size: valuesPerElement
7521
+ };
7522
+ switch (attribute) {
7523
+ case "color":
7524
+ attributes.color.normalized = true;
7525
+ break;
7526
+ case "position":
7527
+ case "region":
7528
+ case "normal":
7529
+ default:
7530
+ }
7531
+ byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);
7532
+ } else if (attribute !== "uv0") {
7473
7533
  break;
7474
7534
  }
7475
- const buffer = arrayBuffer.slice(byteOffset);
7476
- let value;
7477
- if (valueType === "UInt64") {
7478
- value = parseUint64Values(buffer, count * valuesPerElement, sizeOf(valueType));
7479
- } else {
7480
- const TypedArrayType = getConstructorForDataFormat(valueType);
7481
- value = new TypedArrayType(buffer, 0, count * valuesPerElement);
7482
- }
7483
- attributes[attribute] = {
7484
- value,
7485
- type: GL_TYPE_MAP[valueType],
7486
- size: valuesPerElement
7487
- };
7488
- switch (attribute) {
7489
- case "color":
7490
- attributes.color.normalized = true;
7491
- break;
7492
- case "position":
7493
- case "region":
7494
- case "normal":
7495
- default:
7496
- }
7497
- byteOffset = byteOffset + count * valuesPerElement * sizeOf(valueType);
7498
7535
  }
7499
7536
  }
7500
7537
  return { attributes, byteOffset };
@@ -7512,8 +7549,8 @@
7512
7549
  }
7513
7550
  return new Uint32Array(values);
7514
7551
  }
7515
- function parsePositions(attribute, tile) {
7516
- const mbs = tile.mbs;
7552
+ function parsePositions(attribute, options) {
7553
+ const mbs = options.mbs;
7517
7554
  const value = attribute.value;
7518
7555
  const metadata = attribute.metadata;
7519
7556
  const enuMatrix = new Matrix4();
@@ -7645,13 +7682,13 @@
7645
7682
  }
7646
7683
 
7647
7684
  // src/i3s-content-loader.ts
7648
- var VERSION8 = true ? "4.0.0-alpha.5" : "beta";
7685
+ var VERSION9 = true ? "4.0.0-alpha.7" : "beta";
7649
7686
  var I3SContentLoader = {
7650
7687
  name: "I3S Content (Indexed Scene Layers)",
7651
7688
  id: "i3s-content",
7652
7689
  module: "i3s",
7653
7690
  worker: true,
7654
- version: VERSION8,
7691
+ version: VERSION9,
7655
7692
  mimeTypes: ["application/octet-stream"],
7656
7693
  parse: parse3,
7657
7694
  extensions: ["bin"],
@@ -7660,9 +7697,13 @@
7660
7697
  }
7661
7698
  };
7662
7699
  async function parse3(data, options, context) {
7663
- const { tile, tileset } = options?.i3s || {};
7664
- await parseI3STileContent(data, tile, tileset, options, context);
7665
- return tile.content;
7700
+ const { tile, _tileOptions, tileset, _tilesetOptions } = options?.i3s || {};
7701
+ const tileOptions = _tileOptions || tile;
7702
+ const tilesetOptions = _tilesetOptions || tileset;
7703
+ if (!tileOptions || !tilesetOptions) {
7704
+ return null;
7705
+ }
7706
+ return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);
7666
7707
  }
7667
7708
 
7668
7709
  // src/workers/i3s-content-worker.ts