@loaders.gl/i3s 4.0.0-beta.1 → 4.0.0-beta.3

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 (207) hide show
  1. package/dist/arcgis-webscene-loader.d.ts.map +1 -0
  2. package/dist/{esm/arcgis-webscene-loader.js → arcgis-webscene-loader.js} +2 -2
  3. package/dist/arcgis-webscene-loader.js.map +1 -0
  4. package/dist/dist.dev.js +14694 -0
  5. package/dist/i3s-attribute-loader.d.ts.map +1 -0
  6. package/dist/{esm/i3s-attribute-loader.js → i3s-attribute-loader.js} +3 -3
  7. package/dist/i3s-attribute-loader.js.map +1 -0
  8. package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -0
  9. package/dist/{esm/i3s-building-scene-layer-loader.js → i3s-building-scene-layer-loader.js} +2 -2
  10. package/dist/i3s-building-scene-layer-loader.js.map +1 -0
  11. package/dist/i3s-content-loader.d.ts.map +1 -0
  12. package/dist/{esm/i3s-content-loader.js → i3s-content-loader.js} +2 -2
  13. package/dist/i3s-content-loader.js.map +1 -0
  14. package/dist/i3s-content-worker-node.js +300 -155
  15. package/dist/i3s-content-worker-node.js.map +4 -4
  16. package/dist/i3s-content-worker.js +1337 -483
  17. package/dist/i3s-loader.d.ts.map +1 -0
  18. package/dist/{esm/i3s-loader.js → i3s-loader.js} +4 -4
  19. package/dist/i3s-loader.js.map +1 -0
  20. package/dist/i3s-node-page-loader.d.ts.map +1 -0
  21. package/dist/{esm/i3s-node-page-loader.js → i3s-node-page-loader.js} +1 -1
  22. package/dist/i3s-node-page-loader.js.map +1 -0
  23. package/dist/{src/i3s-slpk-loader.d.ts → i3s-slpk-loader.d.ts} +3 -1
  24. package/dist/i3s-slpk-loader.d.ts.map +1 -0
  25. package/dist/i3s-slpk-loader.js +19 -0
  26. package/dist/i3s-slpk-loader.js.map +1 -0
  27. package/dist/index.cjs +1587 -0
  28. package/dist/{src/index.d.ts → index.d.ts} +2 -1
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +10 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -0
  33. package/dist/{esm/lib → lib}/helpers/i3s-nodepages-tiles.js +16 -17
  34. package/dist/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
  35. package/dist/lib/parsers/constants.d.ts.map +1 -0
  36. package/dist/{esm/lib → lib}/parsers/constants.js +2 -2
  37. package/dist/lib/parsers/constants.js.map +1 -0
  38. package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -0
  39. package/dist/lib/parsers/parse-arcgis-webscene.js.map +1 -0
  40. package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -0
  41. package/dist/{esm/lib → lib}/parsers/parse-i3s-attribute.js +1 -1
  42. package/dist/lib/parsers/parse-i3s-attribute.js.map +1 -0
  43. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -0
  44. package/dist/{esm/lib → lib}/parsers/parse-i3s-building-scene-layer.js +1 -1
  45. package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
  46. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -0
  47. package/dist/{esm/lib → lib}/parsers/parse-i3s-tile-content.js +6 -5
  48. package/dist/lib/parsers/parse-i3s-tile-content.js.map +1 -0
  49. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -0
  50. package/dist/{esm/lib → lib}/parsers/parse-i3s.js +6 -6
  51. package/dist/lib/parsers/parse-i3s.js.map +1 -0
  52. package/dist/{src/lib → lib}/parsers/parse-slpk/parse-slpk.d.ts +1 -1
  53. package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -0
  54. package/dist/{esm/lib → lib}/parsers/parse-slpk/parse-slpk.js +9 -11
  55. package/dist/lib/parsers/parse-slpk/parse-slpk.js.map +1 -0
  56. package/dist/{src/lib → lib}/parsers/parse-slpk/slpk-archieve.d.ts +10 -7
  57. package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts.map +1 -0
  58. package/dist/{esm/lib → lib}/parsers/parse-slpk/slpk-archieve.js +21 -21
  59. package/dist/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -0
  60. package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts.map +1 -0
  61. package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  62. package/dist/lib/utils/customize-/321/201olors.d.ts.map +1 -0
  63. package/dist/{esm/lib → lib}/utils/customize-/321/201olors.js +2 -2
  64. package/dist/lib/utils/customize-/321/201olors.js.map +1 -0
  65. package/dist/lib/utils/url-utils.d.ts.map +1 -0
  66. package/dist/{esm/lib → lib}/utils/url-utils.js +3 -3
  67. package/dist/lib/utils/url-utils.js.map +1 -0
  68. package/dist/types.d.ts.map +1 -0
  69. package/dist/types.js.map +1 -0
  70. package/dist/workers/i3s-content-worker-node.d.ts.map +1 -0
  71. package/dist/{esm/workers → workers}/i3s-content-worker-node.js +1 -1
  72. package/dist/workers/i3s-content-worker-node.js.map +1 -0
  73. package/dist/workers/i3s-content-worker.d.ts.map +1 -0
  74. package/dist/workers/i3s-content-worker.js +4 -0
  75. package/dist/workers/i3s-content-worker.js.map +1 -0
  76. package/package.json +25 -17
  77. package/src/i3s-slpk-loader.ts +9 -18
  78. package/src/index.ts +3 -1
  79. package/src/lib/parsers/parse-i3s-tile-content.ts +2 -1
  80. package/src/lib/parsers/parse-slpk/parse-slpk.ts +13 -13
  81. package/src/lib/parsers/parse-slpk/slpk-archieve.ts +27 -19
  82. package/dist/dist.min.js +0 -15742
  83. package/dist/es5/arcgis-webscene-loader.js +0 -40
  84. package/dist/es5/arcgis-webscene-loader.js.map +0 -1
  85. package/dist/es5/bundle.js +0 -6
  86. package/dist/es5/bundle.js.map +0 -1
  87. package/dist/es5/i3s-attribute-loader.js +0 -195
  88. package/dist/es5/i3s-attribute-loader.js.map +0 -1
  89. package/dist/es5/i3s-building-scene-layer-loader.js +0 -46
  90. package/dist/es5/i3s-building-scene-layer-loader.js.map +0 -1
  91. package/dist/es5/i3s-content-loader.js +0 -56
  92. package/dist/es5/i3s-content-loader.js.map +0 -1
  93. package/dist/es5/i3s-loader.js +0 -193
  94. package/dist/es5/i3s-loader.js.map +0 -1
  95. package/dist/es5/i3s-node-page-loader.js +0 -41
  96. package/dist/es5/i3s-node-page-loader.js.map +0 -1
  97. package/dist/es5/i3s-slpk-loader.js +0 -48
  98. package/dist/es5/i3s-slpk-loader.js.map +0 -1
  99. package/dist/es5/index.js +0 -75
  100. package/dist/es5/index.js.map +0 -1
  101. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +0 -316
  102. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
  103. package/dist/es5/lib/parsers/constants.js +0 -71
  104. package/dist/es5/lib/parsers/constants.js.map +0 -1
  105. package/dist/es5/lib/parsers/parse-arcgis-webscene.js +0 -158
  106. package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +0 -1
  107. package/dist/es5/lib/parsers/parse-i3s-attribute.js +0 -76
  108. package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +0 -1
  109. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +0 -65
  110. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
  111. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +0 -513
  112. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +0 -1
  113. package/dist/es5/lib/parsers/parse-i3s.js +0 -128
  114. package/dist/es5/lib/parsers/parse-i3s.js.map +0 -1
  115. package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js +0 -69
  116. package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js.map +0 -1
  117. package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js +0 -254
  118. package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js.map +0 -1
  119. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +0 -17
  120. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
  121. package/dist/es5/lib/utils/customize-/321/201olors.js +0 -184
  122. package/dist/es5/lib/utils/customize-/321/201olors.js.map +0 -1
  123. package/dist/es5/lib/utils/url-utils.js +0 -33
  124. package/dist/es5/lib/utils/url-utils.js.map +0 -1
  125. package/dist/es5/types.js +0 -13
  126. package/dist/es5/types.js.map +0 -1
  127. package/dist/es5/workers/i3s-content-worker-node.js +0 -7
  128. package/dist/es5/workers/i3s-content-worker-node.js.map +0 -1
  129. package/dist/es5/workers/i3s-content-worker.js +0 -6
  130. package/dist/es5/workers/i3s-content-worker.js.map +0 -1
  131. package/dist/esm/arcgis-webscene-loader.js.map +0 -1
  132. package/dist/esm/bundle.js +0 -4
  133. package/dist/esm/bundle.js.map +0 -1
  134. package/dist/esm/i3s-attribute-loader.js.map +0 -1
  135. package/dist/esm/i3s-building-scene-layer-loader.js.map +0 -1
  136. package/dist/esm/i3s-content-loader.js.map +0 -1
  137. package/dist/esm/i3s-loader.js.map +0 -1
  138. package/dist/esm/i3s-node-page-loader.js.map +0 -1
  139. package/dist/esm/i3s-slpk-loader.js +0 -19
  140. package/dist/esm/i3s-slpk-loader.js.map +0 -1
  141. package/dist/esm/index.js +0 -10
  142. package/dist/esm/index.js.map +0 -1
  143. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
  144. package/dist/esm/lib/parsers/constants.js.map +0 -1
  145. package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +0 -1
  146. package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +0 -1
  147. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
  148. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +0 -1
  149. package/dist/esm/lib/parsers/parse-i3s.js.map +0 -1
  150. package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js.map +0 -1
  151. package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js.map +0 -1
  152. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
  153. package/dist/esm/lib/utils/customize-/321/201olors.js.map +0 -1
  154. package/dist/esm/lib/utils/url-utils.js.map +0 -1
  155. package/dist/esm/types.js.map +0 -1
  156. package/dist/esm/workers/i3s-content-worker-node.js.map +0 -1
  157. package/dist/esm/workers/i3s-content-worker.js +0 -4
  158. package/dist/esm/workers/i3s-content-worker.js.map +0 -1
  159. package/dist/src/arcgis-webscene-loader.d.ts.map +0 -1
  160. package/dist/src/bundle.d.ts +0 -2
  161. package/dist/src/bundle.d.ts.map +0 -1
  162. package/dist/src/i3s-attribute-loader.d.ts.map +0 -1
  163. package/dist/src/i3s-building-scene-layer-loader.d.ts.map +0 -1
  164. package/dist/src/i3s-content-loader.d.ts.map +0 -1
  165. package/dist/src/i3s-loader.d.ts.map +0 -1
  166. package/dist/src/i3s-node-page-loader.d.ts.map +0 -1
  167. package/dist/src/i3s-slpk-loader.d.ts.map +0 -1
  168. package/dist/src/index.d.ts.map +0 -1
  169. package/dist/src/lib/helpers/i3s-nodepages-tiles.d.ts.map +0 -1
  170. package/dist/src/lib/parsers/constants.d.ts.map +0 -1
  171. package/dist/src/lib/parsers/parse-arcgis-webscene.d.ts.map +0 -1
  172. package/dist/src/lib/parsers/parse-i3s-attribute.d.ts.map +0 -1
  173. package/dist/src/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +0 -1
  174. package/dist/src/lib/parsers/parse-i3s-tile-content.d.ts.map +0 -1
  175. package/dist/src/lib/parsers/parse-i3s.d.ts.map +0 -1
  176. package/dist/src/lib/parsers/parse-slpk/parse-slpk.d.ts.map +0 -1
  177. package/dist/src/lib/parsers/parse-slpk/slpk-archieve.d.ts.map +0 -1
  178. package/dist/src/lib/utils/convert-i3s-obb-to-mbs.d.ts.map +0 -1
  179. package/dist/src/lib/utils/customize-/321/201olors.d.ts.map +0 -1
  180. package/dist/src/lib/utils/url-utils.d.ts.map +0 -1
  181. package/dist/src/types.d.ts.map +0 -1
  182. package/dist/src/workers/i3s-content-worker-node.d.ts.map +0 -1
  183. package/dist/src/workers/i3s-content-worker.d.ts.map +0 -1
  184. package/dist/tsconfig.tsbuildinfo +0 -1
  185. package/src/bundle.ts +0 -4
  186. /package/dist/{src/arcgis-webscene-loader.d.ts → arcgis-webscene-loader.d.ts} +0 -0
  187. /package/dist/{src/i3s-attribute-loader.d.ts → i3s-attribute-loader.d.ts} +0 -0
  188. /package/dist/{src/i3s-building-scene-layer-loader.d.ts → i3s-building-scene-layer-loader.d.ts} +0 -0
  189. /package/dist/{src/i3s-content-loader.d.ts → i3s-content-loader.d.ts} +0 -0
  190. /package/dist/{src/i3s-loader.d.ts → i3s-loader.d.ts} +0 -0
  191. /package/dist/{src/i3s-node-page-loader.d.ts → i3s-node-page-loader.d.ts} +0 -0
  192. /package/dist/{src/lib → lib}/helpers/i3s-nodepages-tiles.d.ts +0 -0
  193. /package/dist/{src/lib → lib}/parsers/constants.d.ts +0 -0
  194. /package/dist/{src/lib → lib}/parsers/parse-arcgis-webscene.d.ts +0 -0
  195. /package/dist/{esm/lib → lib}/parsers/parse-arcgis-webscene.js +0 -0
  196. /package/dist/{src/lib → lib}/parsers/parse-i3s-attribute.d.ts +0 -0
  197. /package/dist/{src/lib → lib}/parsers/parse-i3s-building-scene-layer.d.ts +0 -0
  198. /package/dist/{src/lib → lib}/parsers/parse-i3s-tile-content.d.ts +0 -0
  199. /package/dist/{src/lib → lib}/parsers/parse-i3s.d.ts +0 -0
  200. /package/dist/{src/lib → lib}/utils/convert-i3s-obb-to-mbs.d.ts +0 -0
  201. /package/dist/{esm/lib → lib}/utils/convert-i3s-obb-to-mbs.js +0 -0
  202. /package/dist/{src/lib → lib}/utils/customize-/321/201olors.d.ts" +0 -0
  203. /package/dist/{src/lib → lib}/utils/url-utils.d.ts +0 -0
  204. /package/dist/{src/types.d.ts → types.d.ts} +0 -0
  205. /package/dist/{esm/types.js → types.js} +0 -0
  206. /package/dist/{src/workers → workers}/i3s-content-worker-node.d.ts +0 -0
  207. /package/dist/{src/workers → workers}/i3s-content-worker.d.ts +0 -0
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  (() => {
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -5,36 +6,39 @@
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
10
  var __commonJS = (cb, mod) => function __require() {
10
- return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
12
  };
12
13
  var __export = (target, all) => {
13
- __markAsModule(target);
14
14
  for (var name in all)
15
15
  __defProp(target, name, { get: all[name], enumerable: true });
16
16
  };
17
- var __reExport = (target, module, desc) => {
18
- if (module && typeof module === "object" || typeof module === "function") {
19
- for (let key of __getOwnPropNames(module))
20
- if (!__hasOwnProp.call(target, key) && key !== "default")
21
- __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
22
  }
23
- return target;
23
+ return to;
24
24
  };
25
- var __toModule = (module) => {
26
- return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
+ mod
32
+ ));
33
+ var __publicField = (obj, key, value) => {
34
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
35
+ return value;
27
36
  };
28
37
 
29
38
  // (disabled):../worker-utils/src/lib/node/require-utils.node
30
39
  var require_require_utils = __commonJS({
31
40
  "(disabled):../worker-utils/src/lib/node/require-utils.node"() {
32
- }
33
- });
34
-
35
- // (disabled):../core/src/lib/fetch/fetch-file.node
36
- var require_fetch_file = __commonJS({
37
- "(disabled):../core/src/lib/fetch/fetch-file.node"() {
41
+ "use strict";
38
42
  }
39
43
  });
40
44
 
@@ -61,7 +65,10 @@
61
65
  var window_ = globals.window || globals.self || globals.global || {};
62
66
  var global_ = globals.global || globals.self || globals.window || {};
63
67
  var document_ = globals.document || {};
64
- var isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
68
+ var isBrowser = (
69
+ // @ts-ignore process does not exist on browser
70
+ Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
71
+ );
65
72
  var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
66
73
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
67
74
 
@@ -73,7 +80,10 @@
73
80
  const options = { ...baseOptions };
74
81
  for (const [key, newValue] of Object.entries(newOptions)) {
75
82
  if (newValue && typeof newValue === "object" && !Array.isArray(newValue)) {
76
- options[key] = mergeOptionsRecursively(options[key] || {}, newOptions[key]);
83
+ options[key] = mergeOptionsRecursively(
84
+ options[key] || {},
85
+ newOptions[key]
86
+ );
77
87
  } else {
78
88
  options[key] = newOptions[key];
79
89
  }
@@ -87,10 +97,12 @@
87
97
  if (!globalThis._loadersgl_?.version) {
88
98
  globalThis._loadersgl_ = globalThis._loadersgl_ || {};
89
99
  if (false) {
90
- console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
100
+ console.error(
101
+ "loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN."
102
+ );
91
103
  globalThis._loadersgl_.version = NPM_TAG;
92
104
  } else {
93
- globalThis._loadersgl_.version = "4.0.0-beta.1";
105
+ globalThis._loadersgl_.version = "4.0.0-beta.3";
94
106
  }
95
107
  }
96
108
  return globalThis._loadersgl_.version;
@@ -115,7 +127,10 @@
115
127
  var window_2 = globals2.window || globals2.self || globals2.global || {};
116
128
  var global_2 = globals2.global || globals2.self || globals2.window || {};
117
129
  var document_2 = globals2.document || {};
118
- var isBrowser2 = typeof process !== "object" || String(process) !== "[object process]" || process.browser;
130
+ var isBrowser2 = (
131
+ // @ts-ignore process.browser
132
+ typeof process !== "object" || String(process) !== "[object process]" || process.browser
133
+ );
119
134
  var isWorker = typeof importScripts === "function";
120
135
  var isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
121
136
  var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
@@ -123,12 +138,16 @@
123
138
 
124
139
  // ../worker-utils/src/lib/worker-farm/worker-job.ts
125
140
  var WorkerJob = class {
141
+ name;
142
+ workerThread;
143
+ isRunning = true;
144
+ /** Promise that resolves when Job is done */
145
+ result;
146
+ _resolve = () => {
147
+ };
148
+ _reject = () => {
149
+ };
126
150
  constructor(jobName, workerThread) {
127
- this.isRunning = true;
128
- this._resolve = () => {
129
- };
130
- this._reject = () => {
131
- };
132
151
  this.name = jobName;
133
152
  this.workerThread = workerThread;
134
153
  this.result = new Promise((resolve2, reject) => {
@@ -136,18 +155,29 @@
136
155
  this._reject = reject;
137
156
  });
138
157
  }
158
+ /**
159
+ * Send a message to the job's worker thread
160
+ * @param data any data structure, ideally consisting mostly of transferrable objects
161
+ */
139
162
  postMessage(type, payload) {
140
163
  this.workerThread.postMessage({
141
164
  source: "loaders.gl",
165
+ // Lets worker ignore unrelated messages
142
166
  type,
143
167
  payload
144
168
  });
145
169
  }
170
+ /**
171
+ * Call to resolve the `result` Promise with the supplied value
172
+ */
146
173
  done(value) {
147
174
  assert2(this.isRunning);
148
175
  this.isRunning = false;
149
176
  this._resolve(value);
150
177
  }
178
+ /**
179
+ * Call to reject the `result` Promise with the supplied error
180
+ */
151
181
  error(error) {
152
182
  assert2(this.isRunning);
153
183
  this.isRunning = false;
@@ -162,7 +192,7 @@
162
192
  };
163
193
 
164
194
  // ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
165
- var workerURLCache = new Map();
195
+ var workerURLCache = /* @__PURE__ */ new Map();
166
196
  function getLoadableWorkerURL(props) {
167
197
  assert2(props.source && !props.url || !props.source && props.url);
168
198
  let workerURL = workerURLCache.get(props.source || props.url);
@@ -201,7 +231,7 @@
201
231
 
202
232
  // ../worker-utils/src/lib/worker-utils/get-transfer-list.ts
203
233
  function getTransferList(object, recursive = true, transfers) {
204
- const transfersSet = transfers || new Set();
234
+ const transfersSet = transfers || /* @__PURE__ */ new Set();
205
235
  if (!object) {
206
236
  } else if (isTransferable(object)) {
207
237
  transfersSet.add(object);
@@ -238,9 +268,19 @@
238
268
  var NOOP = () => {
239
269
  };
240
270
  var WorkerThread = class {
271
+ name;
272
+ source;
273
+ url;
274
+ terminated = false;
275
+ worker;
276
+ onMessage;
277
+ onError;
278
+ _loadableURL = "";
279
+ /** Checks if workers are supported on this platform */
280
+ static isSupported() {
281
+ return typeof Worker !== "undefined" && isBrowser2 || typeof Worker2 !== "undefined" && !isBrowser2;
282
+ }
241
283
  constructor(props) {
242
- this.terminated = false;
243
- this._loadableURL = "";
244
284
  const { name, source, url } = props;
245
285
  assert2(source || url);
246
286
  this.name = name;
@@ -250,9 +290,10 @@
250
290
  this.onError = (error) => console.log(error);
251
291
  this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
252
292
  }
253
- static isSupported() {
254
- return typeof Worker !== "undefined" && isBrowser2 || typeof Worker2 !== "undefined" && !isBrowser2;
255
- }
293
+ /**
294
+ * Terminate this worker thread
295
+ * @note Can free up significant memory
296
+ */
256
297
  destroy() {
257
298
  this.onMessage = NOOP;
258
299
  this.onError = NOOP;
@@ -262,10 +303,20 @@
262
303
  get isRunning() {
263
304
  return Boolean(this.onMessage);
264
305
  }
306
+ /**
307
+ * Send a message to this worker thread
308
+ * @param data any data structure, ideally consisting mostly of transferrable objects
309
+ * @param transferList If not supplied, calculated automatically by traversing data
310
+ */
265
311
  postMessage(data, transferList) {
266
312
  transferList = transferList || getTransferList(data);
267
313
  this.worker.postMessage(data, transferList);
268
314
  }
315
+ // PRIVATE
316
+ /**
317
+ * Generate a standard Error from an ErrorEvent
318
+ * @param event
319
+ */
269
320
  _getErrorFromErrorEvent(event) {
270
321
  let message = "Failed to load ";
271
322
  message += `worker ${this.name} from ${this.url}. `;
@@ -277,6 +328,9 @@
277
328
  }
278
329
  return new Error(message);
279
330
  }
331
+ /**
332
+ * Creates a worker thread on the browser
333
+ */
280
334
  _createBrowserWorker() {
281
335
  this._loadableURL = getLoadableWorkerURL({ source: this.source, url: this.url });
282
336
  const worker = new Worker(this._loadableURL, { name: this.name });
@@ -294,6 +348,10 @@
294
348
  worker.onmessageerror = (event) => console.error(event);
295
349
  return worker;
296
350
  }
351
+ /**
352
+ * Creates a worker thread in node.js
353
+ * @todo https://nodejs.org/api/async_hooks.html#async-resource-worker-pool
354
+ */
297
355
  _createNodeWorker() {
298
356
  let worker;
299
357
  if (this.url) {
@@ -319,25 +377,37 @@
319
377
 
320
378
  // ../worker-utils/src/lib/worker-farm/worker-pool.ts
321
379
  var WorkerPool = class {
380
+ name = "unnamed";
381
+ source;
382
+ // | Function;
383
+ url;
384
+ maxConcurrency = 1;
385
+ maxMobileConcurrency = 1;
386
+ onDebug = () => {
387
+ };
388
+ reuseWorkers = true;
389
+ props = {};
390
+ jobQueue = [];
391
+ idleQueue = [];
392
+ count = 0;
393
+ isDestroyed = false;
394
+ /** Checks if workers are supported on this platform */
395
+ static isSupported() {
396
+ return WorkerThread.isSupported();
397
+ }
398
+ /**
399
+ * @param processor - worker function
400
+ * @param maxConcurrency - max count of workers
401
+ */
322
402
  constructor(props) {
323
- this.name = "unnamed";
324
- this.maxConcurrency = 1;
325
- this.maxMobileConcurrency = 1;
326
- this.onDebug = () => {
327
- };
328
- this.reuseWorkers = true;
329
- this.props = {};
330
- this.jobQueue = [];
331
- this.idleQueue = [];
332
- this.count = 0;
333
- this.isDestroyed = false;
334
403
  this.source = props.source;
335
404
  this.url = props.url;
336
405
  this.setProps(props);
337
406
  }
338
- static isSupported() {
339
- return WorkerThread.isSupported();
340
- }
407
+ /**
408
+ * Terminates all workers in the pool
409
+ * @note Can free up significant memory
410
+ */
341
411
  destroy() {
342
412
  this.idleQueue.forEach((worker) => worker.destroy());
343
413
  this.isDestroyed = true;
@@ -368,6 +438,11 @@
368
438
  this._startQueuedJob();
369
439
  return await startPromise;
370
440
  }
441
+ // PRIVATE
442
+ /**
443
+ * Starts first queued job if worker is available or can be created
444
+ * Called when job is started and whenever a worker returns to the idleQueue
445
+ */
371
446
  async _startQueuedJob() {
372
447
  if (!this.jobQueue.length) {
373
448
  return;
@@ -390,13 +465,30 @@
390
465
  queuedJob.onStart(job);
391
466
  try {
392
467
  await job.result;
468
+ } catch (error) {
469
+ console.error(`Worker exception: ${error}`);
393
470
  } finally {
394
471
  this.returnWorkerToQueue(workerThread);
395
472
  }
396
473
  }
397
474
  }
475
+ /**
476
+ * Returns a worker to the idle queue
477
+ * Destroys the worker if
478
+ * - pool is destroyed
479
+ * - if this pool doesn't reuse workers
480
+ * - if maxConcurrency has been lowered
481
+ * @param worker
482
+ */
398
483
  returnWorkerToQueue(worker) {
399
- const shouldDestroyWorker = !isBrowser2 || this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency();
484
+ const shouldDestroyWorker = (
485
+ // Workers on Node.js prevent the process from exiting.
486
+ // Until we figure out how to close them before exit, we always destroy them
487
+ !isBrowser2 || // If the pool is destroyed, there is no reason to keep the worker around
488
+ this.isDestroyed || // If the app has disabled worker reuse, any completed workers should be destroyed
489
+ !this.reuseWorkers || // If concurrency has been lowered, this worker might be surplus to requirements
490
+ this.count > this._getMaxConcurrency()
491
+ );
400
492
  if (shouldDestroyWorker) {
401
493
  worker.destroy();
402
494
  this.count--;
@@ -407,6 +499,9 @@
407
499
  this._startQueuedJob();
408
500
  }
409
501
  }
502
+ /**
503
+ * Returns idle worker or creates new worker if maxConcurrency has not been reached
504
+ */
410
505
  _getAvailableWorker() {
411
506
  if (this.idleQueue.length > 0) {
412
507
  return this.idleQueue.shift() || null;
@@ -431,33 +526,54 @@
431
526
  onDebug: () => {
432
527
  }
433
528
  };
434
- var WorkerFarm = class {
435
- constructor(props) {
436
- this.workerPools = new Map();
437
- this.props = { ...DEFAULT_PROPS };
438
- this.setProps(props);
439
- this.workerPools = new Map();
440
- }
529
+ var _WorkerFarm = class {
530
+ props;
531
+ workerPools = /* @__PURE__ */ new Map();
532
+ /** Checks if workers are supported on this platform */
441
533
  static isSupported() {
442
534
  return WorkerThread.isSupported();
443
535
  }
536
+ /** Get the singleton instance of the global worker farm */
444
537
  static getWorkerFarm(props = {}) {
445
- WorkerFarm._workerFarm = WorkerFarm._workerFarm || new WorkerFarm({});
446
- WorkerFarm._workerFarm.setProps(props);
447
- return WorkerFarm._workerFarm;
538
+ _WorkerFarm._workerFarm = _WorkerFarm._workerFarm || new _WorkerFarm({});
539
+ _WorkerFarm._workerFarm.setProps(props);
540
+ return _WorkerFarm._workerFarm;
541
+ }
542
+ /** get global instance with WorkerFarm.getWorkerFarm() */
543
+ constructor(props) {
544
+ this.props = { ...DEFAULT_PROPS };
545
+ this.setProps(props);
546
+ this.workerPools = /* @__PURE__ */ new Map();
448
547
  }
548
+ /**
549
+ * Terminate all workers in the farm
550
+ * @note Can free up significant memory
551
+ */
449
552
  destroy() {
450
553
  for (const workerPool of this.workerPools.values()) {
451
554
  workerPool.destroy();
452
555
  }
453
- this.workerPools = new Map();
556
+ this.workerPools = /* @__PURE__ */ new Map();
454
557
  }
558
+ /**
559
+ * Set props used when initializing worker pools
560
+ * @param props
561
+ */
455
562
  setProps(props) {
456
563
  this.props = { ...this.props, ...props };
457
564
  for (const workerPool of this.workerPools.values()) {
458
565
  workerPool.setProps(this._getWorkerPoolProps());
459
566
  }
460
567
  }
568
+ /**
569
+ * Returns a worker pool for the specified worker
570
+ * @param options - only used first time for a specific worker name
571
+ * @param options.name - the name of the worker - used to identify worker pool
572
+ * @param options.url -
573
+ * @param options.source -
574
+ * @example
575
+ * const job = WorkerFarm.getWorkerFarm().getWorkerPool({name, url}).startJob(...);
576
+ */
461
577
  getWorkerPool(options) {
462
578
  const { name, source, url } = options;
463
579
  let workerPool = this.workerPools.get(name);
@@ -481,6 +597,9 @@
481
597
  };
482
598
  }
483
599
  };
600
+ var WorkerFarm = _WorkerFarm;
601
+ // singleton
602
+ __publicField(WorkerFarm, "_workerFarm");
484
603
 
485
604
  // ../worker-utils/src/lib/worker-farm/worker-body.ts
486
605
  function getParentPort() {
@@ -492,11 +611,15 @@
492
611
  }
493
612
  return parentPort;
494
613
  }
495
- var onMessageWrapperMap = new Map();
614
+ var onMessageWrapperMap = /* @__PURE__ */ new Map();
496
615
  var WorkerBody = class {
616
+ /** Check that we are actually in a worker thread */
497
617
  static inWorkerThread() {
498
618
  return typeof self !== "undefined" || Boolean(getParentPort());
499
619
  }
620
+ /*
621
+ * (type: WorkerMessageType, payload: WorkerMessagePayload) => any
622
+ */
500
623
  static set onmessage(onMessage2) {
501
624
  function handleMessage(message) {
502
625
  const parentPort3 = getParentPort();
@@ -540,6 +663,11 @@
540
663
  globalThis.removeEventListener("message", onMessageWrapper);
541
664
  }
542
665
  }
666
+ /**
667
+ * Send a message from a worker to creating thread (main thread)
668
+ * @param type
669
+ * @param payload
670
+ */
543
671
  static postMessage(type, payload) {
544
672
  const data = { source: "loaders.gl", type, payload };
545
673
  const transferList = getTransferList(payload);
@@ -590,13 +718,14 @@
590
718
  }
591
719
 
592
720
  // ../worker-utils/src/lib/library-utils/library-utils.ts
593
- var node = __toModule(require_require_utils());
721
+ var node = __toESM(require_require_utils(), 1);
594
722
  var loadLibraryPromises = {};
595
723
  async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
596
724
  if (moduleName) {
597
725
  libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
598
726
  }
599
- loadLibraryPromises[libraryUrl] = loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
727
+ loadLibraryPromises[libraryUrl] = // eslint-disable-next-line @typescript-eslint/no-misused-promises
728
+ loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
600
729
  return await loadLibraryPromises[libraryUrl];
601
730
  }
602
731
  function getLibraryUrl(library, moduleName, options = {}, libraryName = null) {
@@ -626,8 +755,9 @@
626
755
  }
627
756
  if (!isBrowser2) {
628
757
  try {
629
- return node && node.requireFromFile && await node.requireFromFile(libraryUrl);
630
- } catch {
758
+ return node && void 0 && await (void 0)(libraryUrl);
759
+ } catch (error) {
760
+ console.error(error);
631
761
  return null;
632
762
  }
633
763
  }
@@ -639,7 +769,7 @@
639
769
  }
640
770
  function loadLibraryFromString(scriptSource, id) {
641
771
  if (!isBrowser2) {
642
- return node.requireFromString && node.requireFromString(scriptSource, id);
772
+ return void 0 && (void 0)(scriptSource, id);
643
773
  }
644
774
  if (isWorker) {
645
775
  eval.call(global_2, scriptSource);
@@ -656,18 +786,18 @@
656
786
  return null;
657
787
  }
658
788
  async function loadAsArrayBuffer(url) {
659
- if (!node.readFileAsArrayBuffer || url.startsWith("http")) {
789
+ if (!void 0 || url.startsWith("http")) {
660
790
  const response = await fetch(url);
661
791
  return await response.arrayBuffer();
662
792
  }
663
- return await node.readFileAsArrayBuffer(url);
793
+ return await (void 0)(url);
664
794
  }
665
795
  async function loadAsText(url) {
666
- if (!node.readFileAsText || url.startsWith("http")) {
796
+ if (!void 0 || url.startsWith("http")) {
667
797
  const response = await fetch(url);
668
798
  return await response.text();
669
799
  }
670
- return await node.readFileAsText(url);
800
+ return await (void 0)(url);
671
801
  }
672
802
 
673
803
  // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
@@ -685,6 +815,7 @@
685
815
  loader,
686
816
  arrayBuffer: input,
687
817
  options,
818
+ // @ts-expect-error fetch missing
688
819
  context: {
689
820
  ...context,
690
821
  _parse: parseOnMainThread
@@ -767,8 +898,14 @@
767
898
  const workerPool = workerFarm.getWorkerPool({ name, url });
768
899
  options = JSON.parse(JSON.stringify(options));
769
900
  context = JSON.parse(JSON.stringify(context || {}));
770
- const job = await workerPool.startJob("process-on-worker", onMessage.bind(null, parseOnMainThread2));
901
+ const job = await workerPool.startJob(
902
+ "process-on-worker",
903
+ // @ts-expect-error
904
+ onMessage.bind(null, parseOnMainThread2)
905
+ // eslint-disable-line @typescript-eslint/no-misused-promises
906
+ );
771
907
  job.postMessage("process", {
908
+ // @ts-ignore
772
909
  input: data,
773
910
  options,
774
911
  context
@@ -815,7 +952,9 @@
815
952
  return true;
816
953
  }
817
954
  function concatenateArrayBuffers(...sources) {
818
- const sourceArrays = sources.map((source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2);
955
+ const sourceArrays = sources.map(
956
+ (source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2
957
+ );
819
958
  const byteLength = sourceArrays.reduce((length2, typedArray) => length2 + typedArray.byteLength, 0);
820
959
  const result = new Uint8Array(byteLength);
821
960
  let offset = 0;
@@ -838,10 +977,10 @@
838
977
  // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
839
978
  function _typeof(obj) {
840
979
  "@babel/helpers - typeof";
841
- return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
980
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
842
981
  return typeof obj2;
843
982
  } : function(obj2) {
844
- return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
983
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
845
984
  }, _typeof(obj);
846
985
  }
847
986
 
@@ -1243,7 +1382,6 @@
1243
1382
  }
1244
1383
 
1245
1384
  // ../core/src/lib/fetch/fetch-file.ts
1246
- var node3 = __toModule(require_fetch_file());
1247
1385
  function isNodePath(url) {
1248
1386
  return !isRequestURL(url) && !isDataURL(url);
1249
1387
  }
@@ -1256,8 +1394,10 @@
1256
1394
  async function fetchFile(urlOrData, fetchOptions) {
1257
1395
  if (typeof urlOrData === "string") {
1258
1396
  const url = resolvePath(urlOrData);
1259
- if (isNodePath(url) && node3?.fetchFileNode) {
1260
- return node3.fetchFileNode(url, fetchOptions);
1397
+ if (isNodePath(url)) {
1398
+ if (globalThis.loaders?.fetchNode) {
1399
+ return globalThis.loaders?.fetchNode(url, fetchOptions);
1400
+ }
1261
1401
  }
1262
1402
  return await fetch(url, fetchOptions);
1263
1403
  }
@@ -1295,7 +1435,7 @@
1295
1435
  var navigator_ = globalThis.navigator || {};
1296
1436
 
1297
1437
  // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
1298
- var VERSION2 = true ? "4.0.0-beta.1" : "untranspiled source";
1438
+ var VERSION2 = true ? "4.0.0-beta.3" : "untranspiled source";
1299
1439
  var isBrowser4 = isBrowser3();
1300
1440
 
1301
1441
  // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
@@ -1361,14 +1501,14 @@
1361
1501
  const padLength = Math.max(length2 - string.length, 0);
1362
1502
  return "".concat(" ".repeat(padLength)).concat(string);
1363
1503
  }
1364
- function formatImage(image, message, scale2) {
1504
+ function formatImage(image, message, scale3) {
1365
1505
  let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
1366
1506
  const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
1367
1507
  if (image.width > maxWidth) {
1368
- scale2 = Math.min(scale2, maxWidth / image.width);
1508
+ scale3 = Math.min(scale3, maxWidth / image.width);
1369
1509
  }
1370
- const width = image.width * scale2;
1371
- const height = image.height * scale2;
1510
+ const width = image.width * scale3;
1511
+ const height = image.height * scale3;
1372
1512
  const style = ["font-size:1px;", "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), "color:transparent;"].join("");
1373
1513
  return ["".concat(message, " %c+"), style];
1374
1514
  }
@@ -1405,11 +1545,11 @@
1405
1545
  if (!isBrowser3 && typeof string === "string") {
1406
1546
  if (color) {
1407
1547
  const colorCode = getColor(color);
1408
- string = "[".concat(colorCode, "m").concat(string, "");
1548
+ string = "\x1B[".concat(colorCode, "m").concat(string, "\x1B[39m");
1409
1549
  }
1410
1550
  if (background) {
1411
1551
  const colorCode = getColor(background);
1412
- string = "[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "");
1552
+ string = "\x1B[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "\x1B[49m");
1413
1553
  }
1414
1554
  }
1415
1555
  return string;
@@ -1592,7 +1732,7 @@
1592
1732
  priority,
1593
1733
  image,
1594
1734
  message = "",
1595
- scale: scale2 = 1
1735
+ scale: scale3 = 1
1596
1736
  } = _ref;
1597
1737
  if (!this._shouldLog(logLevel || priority)) {
1598
1738
  return noop;
@@ -1600,11 +1740,11 @@
1600
1740
  return isBrowser3() ? logImageInBrowser({
1601
1741
  image,
1602
1742
  message,
1603
- scale: scale2
1743
+ scale: scale3
1604
1744
  }) : logImageInNode({
1605
1745
  image,
1606
1746
  message,
1607
- scale: scale2
1747
+ scale: scale3
1608
1748
  });
1609
1749
  }
1610
1750
  time(logLevel, message) {
@@ -1745,7 +1885,7 @@
1745
1885
  let {
1746
1886
  image,
1747
1887
  message = "",
1748
- scale: scale2 = 1
1888
+ scale: scale3 = 1
1749
1889
  } = _ref2;
1750
1890
  console.warn("removed");
1751
1891
  return noop;
@@ -1754,12 +1894,12 @@
1754
1894
  let {
1755
1895
  image,
1756
1896
  message = "",
1757
- scale: scale2 = 1
1897
+ scale: scale3 = 1
1758
1898
  } = _ref3;
1759
1899
  if (typeof image === "string") {
1760
1900
  const img = new Image();
1761
1901
  img.onload = () => {
1762
- const args = formatImage(img, message, scale2);
1902
+ const args = formatImage(img, message, scale3);
1763
1903
  console.log(...args);
1764
1904
  };
1765
1905
  img.src = image;
@@ -1767,12 +1907,12 @@
1767
1907
  }
1768
1908
  const element = image.nodeName || "";
1769
1909
  if (element.toLowerCase() === "img") {
1770
- console.log(...formatImage(image, message, scale2));
1910
+ console.log(...formatImage(image, message, scale3));
1771
1911
  return noop;
1772
1912
  }
1773
1913
  if (element.toLowerCase() === "canvas") {
1774
1914
  const img = new Image();
1775
- img.onload = () => console.log(...formatImage(img, message, scale2));
1915
+ img.onload = () => console.log(...formatImage(img, message, scale3));
1776
1916
  img.src = image.toDataURL();
1777
1917
  return noop;
1778
1918
  }
@@ -1813,6 +1953,7 @@
1813
1953
  }
1814
1954
  };
1815
1955
  var ConsoleLog = class {
1956
+ console;
1816
1957
  constructor() {
1817
1958
  this.console = console;
1818
1959
  }
@@ -1832,29 +1973,39 @@
1832
1973
 
1833
1974
  // ../core/src/lib/loader-utils/option-defaults.ts
1834
1975
  var DEFAULT_LOADER_OPTIONS = {
1976
+ // baseUri
1835
1977
  fetch: null,
1836
1978
  mimeType: void 0,
1837
1979
  nothrow: false,
1838
1980
  log: new ConsoleLog(),
1981
+ // A probe.gl compatible (`log.log()()` syntax) that just logs to console
1839
1982
  useLocalLibraries: false,
1840
1983
  CDN: "https://unpkg.com/@loaders.gl",
1841
1984
  worker: true,
1985
+ // By default, use worker if provided by loader.
1842
1986
  maxConcurrency: 3,
1987
+ // How many worker instances should be created for each loader.
1843
1988
  maxMobileConcurrency: 1,
1989
+ // How many worker instances should be created for each loader on mobile devices.
1844
1990
  reuseWorkers: isBrowser,
1991
+ // By default reuse workers in browser (Node.js refuses to terminate if browsers are running)
1845
1992
  _nodeWorkers: false,
1993
+ // By default do not support node workers
1846
1994
  _workerType: "",
1995
+ // 'test' to use locally generated workers
1847
1996
  limit: 0,
1848
1997
  _limitMB: 0,
1849
1998
  batchSize: "auto",
1850
1999
  batchDebounceMs: 0,
1851
2000
  metadata: false,
2001
+ // TODO - currently only implemented for parseInBatches, adds initial metadata batch,
1852
2002
  transforms: []
1853
2003
  };
1854
2004
  var REMOVED_LOADER_OPTIONS = {
1855
2005
  throws: "nothrow",
1856
2006
  dataType: "(no longer used)",
1857
2007
  uri: "baseUri",
2008
+ // Warn if fetch options are used on top-level
1858
2009
  method: "fetch.method",
1859
2010
  headers: "fetch.headers",
1860
2011
  body: "fetch.body",
@@ -1905,10 +2056,14 @@
1905
2056
  const isWorkerUrlOption = key === "workerUrl" && id;
1906
2057
  if (!(key in defaultOptions) && !isBaseUriOption && !isWorkerUrlOption) {
1907
2058
  if (key in deprecatedOptions) {
1908
- probeLog.warn(`${loaderName} loader option '${prefix}${key}' no longer supported, use '${deprecatedOptions[key]}'`)();
2059
+ probeLog.warn(
2060
+ `${loaderName} loader option '${prefix}${key}' no longer supported, use '${deprecatedOptions[key]}'`
2061
+ )();
1909
2062
  } else if (!isSubOptions) {
1910
2063
  const suggestion = findSimilarOption(key, loaders);
1911
- probeLog.warn(`${loaderName} loader option '${prefix}${key}' not recognized. ${suggestion}`)();
2064
+ probeLog.warn(
2065
+ `${loaderName} loader option '${prefix}${key}' not recognized. ${suggestion}`
2066
+ )();
1912
2067
  }
1913
2068
  }
1914
2069
  }
@@ -2408,7 +2563,12 @@
2408
2563
  return null;
2409
2564
  }
2410
2565
  options = normalizeOptions(options, loader, candidateLoaders, url);
2411
- context = getLoaderContext({ url, _parse: parse, loaders: candidateLoaders }, options, context || null);
2566
+ context = getLoaderContext(
2567
+ // @ts-expect-error
2568
+ { url, _parse: parse, loaders: candidateLoaders },
2569
+ options,
2570
+ context || null
2571
+ );
2412
2572
  return await parseWithLoader(loader, data, options, context);
2413
2573
  }
2414
2574
  async function parseWithLoader(loader, data, options, context) {
@@ -2461,24 +2621,24 @@
2461
2621
  return Array.isArray(resolvedLoaders) ? await parse(data, resolvedLoaders, resolvedOptions) : await parse(data, resolvedLoaders, resolvedOptions);
2462
2622
  }
2463
2623
 
2464
- // ../../node_modules/@math.gl/core/dist/esm/lib/assert.js
2465
- function assert4(condition, message) {
2466
- if (!condition) {
2467
- throw new Error("math.gl assertion ".concat(message));
2468
- }
2469
- }
2470
-
2471
- // ../../node_modules/@math.gl/core/dist/esm/lib/common.js
2624
+ // ../../node_modules/@math.gl/core/dist/lib/common.js
2472
2625
  var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
2473
2626
  var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
2474
- var config = {
2627
+ var DEFAULT_CONFIG = {
2475
2628
  EPSILON: 1e-12,
2476
2629
  debug: false,
2477
2630
  precision: 4,
2478
2631
  printTypes: false,
2479
2632
  printDegrees: false,
2480
- printRowMajor: true
2633
+ printRowMajor: true,
2634
+ _cartographicRadians: false
2481
2635
  };
2636
+ globalThis.mathgl = globalThis.mathgl || {
2637
+ config: {
2638
+ ...DEFAULT_CONFIG
2639
+ }
2640
+ };
2641
+ var config = globalThis.mathgl.config;
2482
2642
  function formatValue(value, {
2483
2643
  precision = config.precision
2484
2644
  } = {}) {
@@ -2545,14 +2705,15 @@
2545
2705
  const array = value;
2546
2706
  result = result || duplicateArray(array);
2547
2707
  for (let i2 = 0; i2 < result.length && i2 < array.length; ++i2) {
2548
- result[i2] = func(value[i2], i2, result);
2708
+ const val = typeof value === "number" ? value : value[i2];
2709
+ result[i2] = func(val, i2, result);
2549
2710
  }
2550
2711
  return result;
2551
2712
  }
2552
2713
  return func(value);
2553
2714
  }
2554
2715
 
2555
- // ../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js
2716
+ // ../../node_modules/@math.gl/core/dist/classes/base/math-array.js
2556
2717
  function _extendableBuiltin(cls) {
2557
2718
  function ExtendableBuiltin() {
2558
2719
  var instance = Reflect.construct(cls, Array.from(arguments));
@@ -2590,6 +2751,9 @@
2590
2751
  }
2591
2752
  return targetArray;
2592
2753
  }
2754
+ toObject(targetObject) {
2755
+ return targetObject;
2756
+ }
2593
2757
  from(arrayOrObject) {
2594
2758
  return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
2595
2759
  }
@@ -2649,7 +2813,8 @@
2649
2813
  }
2650
2814
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2651
2815
  const ai = a2[i2];
2652
- this[i2] = ai + t2 * (b[i2] - ai);
2816
+ const endValue = typeof b === "number" ? b : b[i2];
2817
+ this[i2] = ai + t2 * (endValue - ai);
2653
2818
  }
2654
2819
  return this.check();
2655
2820
  }
@@ -2687,14 +2852,14 @@
2687
2852
  }
2688
2853
  return this.check();
2689
2854
  }
2690
- scale(scale2) {
2691
- if (typeof scale2 === "number") {
2855
+ scale(scale3) {
2856
+ if (typeof scale3 === "number") {
2692
2857
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2693
- this[i2] *= scale2;
2858
+ this[i2] *= scale3;
2694
2859
  }
2695
2860
  } else {
2696
- for (let i2 = 0; i2 < this.ELEMENTS && i2 < scale2.length; ++i2) {
2697
- this[i2] *= scale2[i2];
2861
+ for (let i2 = 0; i2 < this.ELEMENTS && i2 < scale3.length; ++i2) {
2862
+ this[i2] *= scale3[i2];
2698
2863
  }
2699
2864
  }
2700
2865
  return this.check();
@@ -2745,9 +2910,9 @@
2745
2910
  divideScalar(a2) {
2746
2911
  return this.multiplyByScalar(1 / a2);
2747
2912
  }
2748
- clampScalar(min, max) {
2913
+ clampScalar(min2, max2) {
2749
2914
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2750
- this[i2] = Math.min(Math.max(this[i2], min), max);
2915
+ this[i2] = Math.min(Math.max(this[i2], min2), max2);
2751
2916
  }
2752
2917
  return this.check();
2753
2918
  }
@@ -2756,7 +2921,7 @@
2756
2921
  }
2757
2922
  };
2758
2923
 
2759
- // ../../node_modules/@math.gl/core/dist/esm/lib/validators.js
2924
+ // ../../node_modules/@math.gl/core/dist/lib/validators.js
2760
2925
  function validateVector(v, length2) {
2761
2926
  if (v.length !== length2) {
2762
2927
  return false;
@@ -2770,7 +2935,7 @@
2770
2935
  }
2771
2936
  function checkNumber(value) {
2772
2937
  if (!Number.isFinite(value)) {
2773
- throw new Error("Invalid number ".concat(value));
2938
+ throw new Error("Invalid number ".concat(JSON.stringify(value)));
2774
2939
  }
2775
2940
  return value;
2776
2941
  }
@@ -2781,7 +2946,14 @@
2781
2946
  return v;
2782
2947
  }
2783
2948
 
2784
- // ../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js
2949
+ // ../../node_modules/@math.gl/core/dist/lib/assert.js
2950
+ function assert4(condition, message) {
2951
+ if (!condition) {
2952
+ throw new Error("math.gl assertion ".concat(message));
2953
+ }
2954
+ }
2955
+
2956
+ // ../../node_modules/@math.gl/core/dist/classes/base/vector.js
2785
2957
  var Vector = class extends MathArray {
2786
2958
  get x() {
2787
2959
  return this[0];
@@ -2817,8 +2989,8 @@
2817
2989
  distanceSquared(mathArray) {
2818
2990
  let length2 = 0;
2819
2991
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2820
- const dist = this[i2] - mathArray[i2];
2821
- length2 += dist * dist;
2992
+ const dist2 = this[i2] - mathArray[i2];
2993
+ length2 += dist2 * dist2;
2822
2994
  }
2823
2995
  return checkNumber(length2);
2824
2996
  }
@@ -2886,22 +3058,20 @@
2886
3058
  }
2887
3059
  };
2888
3060
 
2889
- // ../../node_modules/gl-matrix/esm/common.js
3061
+ // ../../node_modules/@math.gl/core/dist/gl-matrix/common.js
2890
3062
  var EPSILON = 1e-6;
2891
3063
  var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array;
3064
+ var RANDOM = Math.random;
3065
+ function round2(a2) {
3066
+ if (a2 >= 0)
3067
+ return Math.round(a2);
3068
+ return a2 % 0.5 === 0 ? Math.floor(a2) : Math.round(a2);
3069
+ }
2892
3070
  var degree = Math.PI / 180;
2893
- if (!Math.hypot)
2894
- Math.hypot = function() {
2895
- var y = 0, i2 = arguments.length;
2896
- while (i2--) {
2897
- y += arguments[i2] * arguments[i2];
2898
- }
2899
- return Math.sqrt(y);
2900
- };
2901
3071
 
2902
- // ../../node_modules/gl-matrix/esm/vec2.js
3072
+ // ../../node_modules/@math.gl/core/dist/gl-matrix/vec2.js
2903
3073
  function create() {
2904
- var out = new ARRAY_TYPE(2);
3074
+ const out = new ARRAY_TYPE(2);
2905
3075
  if (ARRAY_TYPE != Float32Array) {
2906
3076
  out[0] = 0;
2907
3077
  out[1] = 0;
@@ -2909,16 +3079,17 @@
2909
3079
  return out;
2910
3080
  }
2911
3081
  function transformMat4(out, a2, m) {
2912
- var x = a2[0];
2913
- var y = a2[1];
3082
+ const x = a2[0];
3083
+ const y = a2[1];
2914
3084
  out[0] = m[0] * x + m[4] * y + m[12];
2915
3085
  out[1] = m[1] * x + m[5] * y + m[13];
2916
3086
  return out;
2917
3087
  }
2918
3088
  var forEach2 = function() {
2919
- var vec = create();
3089
+ const vec = create();
2920
3090
  return function(a2, stride, offset, count, fn, arg) {
2921
- var i2, l2;
3091
+ let i2;
3092
+ let l2;
2922
3093
  if (!stride) {
2923
3094
  stride = 2;
2924
3095
  }
@@ -2941,7 +3112,7 @@
2941
3112
  };
2942
3113
  }();
2943
3114
 
2944
- // ../../node_modules/@math.gl/core/dist/esm/lib/gl-matrix-extras.js
3115
+ // ../../node_modules/@math.gl/core/dist/lib/gl-matrix-extras.js
2945
3116
  function vec2_transformMat4AsVector(out, a2, m) {
2946
3117
  const x = a2[0];
2947
3118
  const y = a2[1];
@@ -2969,9 +3140,61 @@
2969
3140
  return out;
2970
3141
  }
2971
3142
 
2972
- // ../../node_modules/gl-matrix/esm/vec3.js
3143
+ // ../../node_modules/@math.gl/core/dist/gl-matrix/vec3.js
3144
+ var vec3_exports = {};
3145
+ __export(vec3_exports, {
3146
+ add: () => add,
3147
+ angle: () => angle,
3148
+ bezier: () => bezier,
3149
+ ceil: () => ceil,
3150
+ clone: () => clone,
3151
+ copy: () => copy,
3152
+ create: () => create2,
3153
+ cross: () => cross,
3154
+ dist: () => dist,
3155
+ distance: () => distance,
3156
+ div: () => div,
3157
+ divide: () => divide,
3158
+ dot: () => dot,
3159
+ equals: () => equals2,
3160
+ exactEquals: () => exactEquals,
3161
+ floor: () => floor,
3162
+ forEach: () => forEach3,
3163
+ fromValues: () => fromValues,
3164
+ hermite: () => hermite,
3165
+ inverse: () => inverse,
3166
+ len: () => len,
3167
+ length: () => length,
3168
+ lerp: () => lerp,
3169
+ max: () => max,
3170
+ min: () => min,
3171
+ mul: () => mul,
3172
+ multiply: () => multiply,
3173
+ negate: () => negate,
3174
+ normalize: () => normalize,
3175
+ random: () => random,
3176
+ rotateX: () => rotateX,
3177
+ rotateY: () => rotateY,
3178
+ rotateZ: () => rotateZ,
3179
+ round: () => round3,
3180
+ scale: () => scale,
3181
+ scaleAndAdd: () => scaleAndAdd,
3182
+ set: () => set,
3183
+ slerp: () => slerp,
3184
+ sqrDist: () => sqrDist,
3185
+ sqrLen: () => sqrLen,
3186
+ squaredDistance: () => squaredDistance,
3187
+ squaredLength: () => squaredLength,
3188
+ str: () => str,
3189
+ sub: () => sub,
3190
+ subtract: () => subtract,
3191
+ transformMat3: () => transformMat3,
3192
+ transformMat4: () => transformMat42,
3193
+ transformQuat: () => transformQuat,
3194
+ zero: () => zero
3195
+ });
2973
3196
  function create2() {
2974
- var out = new ARRAY_TYPE(3);
3197
+ const out = new ARRAY_TYPE(3);
2975
3198
  if (ARRAY_TYPE != Float32Array) {
2976
3199
  out[0] = 0;
2977
3200
  out[1] = 0;
@@ -2979,26 +3202,220 @@
2979
3202
  }
2980
3203
  return out;
2981
3204
  }
3205
+ function clone(a2) {
3206
+ const out = new ARRAY_TYPE(3);
3207
+ out[0] = a2[0];
3208
+ out[1] = a2[1];
3209
+ out[2] = a2[2];
3210
+ return out;
3211
+ }
2982
3212
  function length(a2) {
2983
- var x = a2[0];
2984
- var y = a2[1];
2985
- var z = a2[2];
2986
- return Math.hypot(x, y, z);
3213
+ const x = a2[0];
3214
+ const y = a2[1];
3215
+ const z = a2[2];
3216
+ return Math.sqrt(x * x + y * y + z * z);
3217
+ }
3218
+ function fromValues(x, y, z) {
3219
+ const out = new ARRAY_TYPE(3);
3220
+ out[0] = x;
3221
+ out[1] = y;
3222
+ out[2] = z;
3223
+ return out;
3224
+ }
3225
+ function copy(out, a2) {
3226
+ out[0] = a2[0];
3227
+ out[1] = a2[1];
3228
+ out[2] = a2[2];
3229
+ return out;
3230
+ }
3231
+ function set(out, x, y, z) {
3232
+ out[0] = x;
3233
+ out[1] = y;
3234
+ out[2] = z;
3235
+ return out;
3236
+ }
3237
+ function add(out, a2, b) {
3238
+ out[0] = a2[0] + b[0];
3239
+ out[1] = a2[1] + b[1];
3240
+ out[2] = a2[2] + b[2];
3241
+ return out;
3242
+ }
3243
+ function subtract(out, a2, b) {
3244
+ out[0] = a2[0] - b[0];
3245
+ out[1] = a2[1] - b[1];
3246
+ out[2] = a2[2] - b[2];
3247
+ return out;
3248
+ }
3249
+ function multiply(out, a2, b) {
3250
+ out[0] = a2[0] * b[0];
3251
+ out[1] = a2[1] * b[1];
3252
+ out[2] = a2[2] * b[2];
3253
+ return out;
3254
+ }
3255
+ function divide(out, a2, b) {
3256
+ out[0] = a2[0] / b[0];
3257
+ out[1] = a2[1] / b[1];
3258
+ out[2] = a2[2] / b[2];
3259
+ return out;
3260
+ }
3261
+ function ceil(out, a2) {
3262
+ out[0] = Math.ceil(a2[0]);
3263
+ out[1] = Math.ceil(a2[1]);
3264
+ out[2] = Math.ceil(a2[2]);
3265
+ return out;
3266
+ }
3267
+ function floor(out, a2) {
3268
+ out[0] = Math.floor(a2[0]);
3269
+ out[1] = Math.floor(a2[1]);
3270
+ out[2] = Math.floor(a2[2]);
3271
+ return out;
3272
+ }
3273
+ function min(out, a2, b) {
3274
+ out[0] = Math.min(a2[0], b[0]);
3275
+ out[1] = Math.min(a2[1], b[1]);
3276
+ out[2] = Math.min(a2[2], b[2]);
3277
+ return out;
3278
+ }
3279
+ function max(out, a2, b) {
3280
+ out[0] = Math.max(a2[0], b[0]);
3281
+ out[1] = Math.max(a2[1], b[1]);
3282
+ out[2] = Math.max(a2[2], b[2]);
3283
+ return out;
3284
+ }
3285
+ function round3(out, a2) {
3286
+ out[0] = round2(a2[0]);
3287
+ out[1] = round2(a2[1]);
3288
+ out[2] = round2(a2[2]);
3289
+ return out;
3290
+ }
3291
+ function scale(out, a2, b) {
3292
+ out[0] = a2[0] * b;
3293
+ out[1] = a2[1] * b;
3294
+ out[2] = a2[2] * b;
3295
+ return out;
3296
+ }
3297
+ function scaleAndAdd(out, a2, b, scale3) {
3298
+ out[0] = a2[0] + b[0] * scale3;
3299
+ out[1] = a2[1] + b[1] * scale3;
3300
+ out[2] = a2[2] + b[2] * scale3;
3301
+ return out;
3302
+ }
3303
+ function distance(a2, b) {
3304
+ const x = b[0] - a2[0];
3305
+ const y = b[1] - a2[1];
3306
+ const z = b[2] - a2[2];
3307
+ return Math.sqrt(x * x + y * y + z * z);
3308
+ }
3309
+ function squaredDistance(a2, b) {
3310
+ const x = b[0] - a2[0];
3311
+ const y = b[1] - a2[1];
3312
+ const z = b[2] - a2[2];
3313
+ return x * x + y * y + z * z;
3314
+ }
3315
+ function squaredLength(a2) {
3316
+ const x = a2[0];
3317
+ const y = a2[1];
3318
+ const z = a2[2];
3319
+ return x * x + y * y + z * z;
3320
+ }
3321
+ function negate(out, a2) {
3322
+ out[0] = -a2[0];
3323
+ out[1] = -a2[1];
3324
+ out[2] = -a2[2];
3325
+ return out;
3326
+ }
3327
+ function inverse(out, a2) {
3328
+ out[0] = 1 / a2[0];
3329
+ out[1] = 1 / a2[1];
3330
+ out[2] = 1 / a2[2];
3331
+ return out;
3332
+ }
3333
+ function normalize(out, a2) {
3334
+ const x = a2[0];
3335
+ const y = a2[1];
3336
+ const z = a2[2];
3337
+ let len2 = x * x + y * y + z * z;
3338
+ if (len2 > 0) {
3339
+ len2 = 1 / Math.sqrt(len2);
3340
+ }
3341
+ out[0] = a2[0] * len2;
3342
+ out[1] = a2[1] * len2;
3343
+ out[2] = a2[2] * len2;
3344
+ return out;
2987
3345
  }
2988
3346
  function dot(a2, b) {
2989
3347
  return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2];
2990
3348
  }
2991
3349
  function cross(out, a2, b) {
2992
- var ax = a2[0], ay = a2[1], az = a2[2];
2993
- var bx = b[0], by = b[1], bz = b[2];
3350
+ const ax = a2[0];
3351
+ const ay = a2[1];
3352
+ const az = a2[2];
3353
+ const bx = b[0];
3354
+ const by = b[1];
3355
+ const bz = b[2];
2994
3356
  out[0] = ay * bz - az * by;
2995
3357
  out[1] = az * bx - ax * bz;
2996
3358
  out[2] = ax * by - ay * bx;
2997
3359
  return out;
2998
3360
  }
3361
+ function lerp(out, a2, b, t2) {
3362
+ const ax = a2[0];
3363
+ const ay = a2[1];
3364
+ const az = a2[2];
3365
+ out[0] = ax + t2 * (b[0] - ax);
3366
+ out[1] = ay + t2 * (b[1] - ay);
3367
+ out[2] = az + t2 * (b[2] - az);
3368
+ return out;
3369
+ }
3370
+ function slerp(out, a2, b, t2) {
3371
+ const angle2 = Math.acos(Math.min(Math.max(dot(a2, b), -1), 1));
3372
+ const sinTotal = Math.sin(angle2);
3373
+ const ratioA = Math.sin((1 - t2) * angle2) / sinTotal;
3374
+ const ratioB = Math.sin(t2 * angle2) / sinTotal;
3375
+ out[0] = ratioA * a2[0] + ratioB * b[0];
3376
+ out[1] = ratioA * a2[1] + ratioB * b[1];
3377
+ out[2] = ratioA * a2[2] + ratioB * b[2];
3378
+ return out;
3379
+ }
3380
+ function hermite(out, a2, b, c2, d, t2) {
3381
+ const factorTimes2 = t2 * t2;
3382
+ const factor1 = factorTimes2 * (2 * t2 - 3) + 1;
3383
+ const factor2 = factorTimes2 * (t2 - 2) + t2;
3384
+ const factor3 = factorTimes2 * (t2 - 1);
3385
+ const factor4 = factorTimes2 * (3 - 2 * t2);
3386
+ out[0] = a2[0] * factor1 + b[0] * factor2 + c2[0] * factor3 + d[0] * factor4;
3387
+ out[1] = a2[1] * factor1 + b[1] * factor2 + c2[1] * factor3 + d[1] * factor4;
3388
+ out[2] = a2[2] * factor1 + b[2] * factor2 + c2[2] * factor3 + d[2] * factor4;
3389
+ return out;
3390
+ }
3391
+ function bezier(out, a2, b, c2, d, t2) {
3392
+ const inverseFactor = 1 - t2;
3393
+ const inverseFactorTimesTwo = inverseFactor * inverseFactor;
3394
+ const factorTimes2 = t2 * t2;
3395
+ const factor1 = inverseFactorTimesTwo * inverseFactor;
3396
+ const factor2 = 3 * t2 * inverseFactorTimesTwo;
3397
+ const factor3 = 3 * factorTimes2 * inverseFactor;
3398
+ const factor4 = factorTimes2 * t2;
3399
+ out[0] = a2[0] * factor1 + b[0] * factor2 + c2[0] * factor3 + d[0] * factor4;
3400
+ out[1] = a2[1] * factor1 + b[1] * factor2 + c2[1] * factor3 + d[1] * factor4;
3401
+ out[2] = a2[2] * factor1 + b[2] * factor2 + c2[2] * factor3 + d[2] * factor4;
3402
+ return out;
3403
+ }
3404
+ function random(out, scale3) {
3405
+ scale3 = scale3 === void 0 ? 1 : scale3;
3406
+ const r2 = RANDOM() * 2 * Math.PI;
3407
+ const z = RANDOM() * 2 - 1;
3408
+ const zScale = Math.sqrt(1 - z * z) * scale3;
3409
+ out[0] = Math.cos(r2) * zScale;
3410
+ out[1] = Math.sin(r2) * zScale;
3411
+ out[2] = z * scale3;
3412
+ return out;
3413
+ }
2999
3414
  function transformMat42(out, a2, m) {
3000
- var x = a2[0], y = a2[1], z = a2[2];
3001
- var w = m[3] * x + m[7] * y + m[11] * z + m[15];
3415
+ const x = a2[0];
3416
+ const y = a2[1];
3417
+ const z = a2[2];
3418
+ let w = m[3] * x + m[7] * y + m[11] * z + m[15];
3002
3419
  w = w || 1;
3003
3420
  out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
3004
3421
  out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
@@ -3006,18 +3423,29 @@
3006
3423
  return out;
3007
3424
  }
3008
3425
  function transformMat3(out, a2, m) {
3009
- var x = a2[0], y = a2[1], z = a2[2];
3426
+ const x = a2[0];
3427
+ const y = a2[1];
3428
+ const z = a2[2];
3010
3429
  out[0] = x * m[0] + y * m[3] + z * m[6];
3011
3430
  out[1] = x * m[1] + y * m[4] + z * m[7];
3012
3431
  out[2] = x * m[2] + y * m[5] + z * m[8];
3013
3432
  return out;
3014
3433
  }
3015
3434
  function transformQuat(out, a2, q) {
3016
- var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
3017
- var x = a2[0], y = a2[1], z = a2[2];
3018
- var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x;
3019
- var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
3020
- var w2 = qw * 2;
3435
+ const qx = q[0];
3436
+ const qy = q[1];
3437
+ const qz = q[2];
3438
+ const qw = q[3];
3439
+ const x = a2[0];
3440
+ const y = a2[1];
3441
+ const z = a2[2];
3442
+ let uvx = qy * z - qz * y;
3443
+ let uvy = qz * x - qx * z;
3444
+ let uvz = qx * y - qy * x;
3445
+ let uuvx = qy * uvz - qz * uvy;
3446
+ let uuvy = qz * uvx - qx * uvz;
3447
+ let uuvz = qx * uvy - qy * uvx;
3448
+ const w2 = qw * 2;
3021
3449
  uvx *= w2;
3022
3450
  uvy *= w2;
3023
3451
  uvz *= w2;
@@ -3030,7 +3458,8 @@
3030
3458
  return out;
3031
3459
  }
3032
3460
  function rotateX(out, a2, b, rad) {
3033
- var p2 = [], r2 = [];
3461
+ const p2 = [];
3462
+ const r2 = [];
3034
3463
  p2[0] = a2[0] - b[0];
3035
3464
  p2[1] = a2[1] - b[1];
3036
3465
  p2[2] = a2[2] - b[2];
@@ -3043,7 +3472,8 @@
3043
3472
  return out;
3044
3473
  }
3045
3474
  function rotateY(out, a2, b, rad) {
3046
- var p2 = [], r2 = [];
3475
+ const p2 = [];
3476
+ const r2 = [];
3047
3477
  p2[0] = a2[0] - b[0];
3048
3478
  p2[1] = a2[1] - b[1];
3049
3479
  p2[2] = a2[2] - b[2];
@@ -3056,7 +3486,8 @@
3056
3486
  return out;
3057
3487
  }
3058
3488
  function rotateZ(out, a2, b, rad) {
3059
- var p2 = [], r2 = [];
3489
+ const p2 = [];
3490
+ const r2 = [];
3060
3491
  p2[0] = a2[0] - b[0];
3061
3492
  p2[1] = a2[1] - b[1];
3062
3493
  p2[2] = a2[2] - b[2];
@@ -3069,13 +3500,49 @@
3069
3500
  return out;
3070
3501
  }
3071
3502
  function angle(a2, b) {
3072
- var ax = a2[0], ay = a2[1], az = a2[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a2, b) / mag;
3503
+ const ax = a2[0];
3504
+ const ay = a2[1];
3505
+ const az = a2[2];
3506
+ const bx = b[0];
3507
+ const by = b[1];
3508
+ const bz = b[2];
3509
+ const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));
3510
+ const cosine = mag && dot(a2, b) / mag;
3073
3511
  return Math.acos(Math.min(Math.max(cosine, -1), 1));
3074
3512
  }
3513
+ function zero(out) {
3514
+ out[0] = 0;
3515
+ out[1] = 0;
3516
+ out[2] = 0;
3517
+ return out;
3518
+ }
3519
+ function str(a2) {
3520
+ return "vec3(".concat(a2[0], ", ").concat(a2[1], ", ").concat(a2[2], ")");
3521
+ }
3522
+ function exactEquals(a2, b) {
3523
+ return a2[0] === b[0] && a2[1] === b[1] && a2[2] === b[2];
3524
+ }
3525
+ function equals2(a2, b) {
3526
+ const a0 = a2[0];
3527
+ const a1 = a2[1];
3528
+ const a22 = a2[2];
3529
+ const b0 = b[0];
3530
+ const b1 = b[1];
3531
+ const b2 = b[2];
3532
+ return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a22 - b2) <= EPSILON * Math.max(1, Math.abs(a22), Math.abs(b2));
3533
+ }
3534
+ var sub = subtract;
3535
+ var mul = multiply;
3536
+ var div = divide;
3537
+ var dist = distance;
3538
+ var sqrDist = squaredDistance;
3539
+ var len = length;
3540
+ var sqrLen = squaredLength;
3075
3541
  var forEach3 = function() {
3076
- var vec = create2();
3542
+ const vec = create2();
3077
3543
  return function(a2, stride, offset, count, fn, arg) {
3078
- var i2, l2;
3544
+ let i2;
3545
+ let l2;
3079
3546
  if (!stride) {
3080
3547
  stride = 3;
3081
3548
  }
@@ -3100,7 +3567,7 @@
3100
3567
  };
3101
3568
  }();
3102
3569
 
3103
- // ../../node_modules/@math.gl/core/dist/esm/classes/vector3.js
3570
+ // ../../node_modules/@math.gl/core/dist/classes/vector3.js
3104
3571
  var ORIGIN = [0, 0, 0];
3105
3572
  var ZERO;
3106
3573
  var Vector3 = class extends Vector {
@@ -3217,7 +3684,7 @@
3217
3684
  }
3218
3685
  };
3219
3686
 
3220
- // ../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js
3687
+ // ../../node_modules/@math.gl/core/dist/classes/base/matrix.js
3221
3688
  var Matrix = class extends MathArray {
3222
3689
  toString() {
3223
3690
  let string = "[";
@@ -3263,7 +3730,7 @@
3263
3730
  }
3264
3731
  };
3265
3732
 
3266
- // ../../node_modules/gl-matrix/esm/mat4.js
3733
+ // ../../node_modules/@math.gl/core/dist/gl-matrix/mat4.js
3267
3734
  function identity(out) {
3268
3735
  out[0] = 1;
3269
3736
  out[1] = 0;
@@ -3285,9 +3752,12 @@
3285
3752
  }
3286
3753
  function transpose(out, a2) {
3287
3754
  if (out === a2) {
3288
- var a01 = a2[1], a02 = a2[2], a03 = a2[3];
3289
- var a12 = a2[6], a13 = a2[7];
3290
- var a23 = a2[11];
3755
+ const a01 = a2[1];
3756
+ const a02 = a2[2];
3757
+ const a03 = a2[3];
3758
+ const a12 = a2[6];
3759
+ const a13 = a2[7];
3760
+ const a23 = a2[11];
3291
3761
  out[1] = a2[4];
3292
3762
  out[2] = a2[8];
3293
3763
  out[3] = a2[12];
@@ -3321,23 +3791,35 @@
3321
3791
  return out;
3322
3792
  }
3323
3793
  function invert(out, a2) {
3324
- var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3];
3325
- var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7];
3326
- var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11];
3327
- var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15];
3328
- var b00 = a00 * a11 - a01 * a10;
3329
- var b01 = a00 * a12 - a02 * a10;
3330
- var b02 = a00 * a13 - a03 * a10;
3331
- var b03 = a01 * a12 - a02 * a11;
3332
- var b04 = a01 * a13 - a03 * a11;
3333
- var b05 = a02 * a13 - a03 * a12;
3334
- var b06 = a20 * a31 - a21 * a30;
3335
- var b07 = a20 * a32 - a22 * a30;
3336
- var b08 = a20 * a33 - a23 * a30;
3337
- var b09 = a21 * a32 - a22 * a31;
3338
- var b10 = a21 * a33 - a23 * a31;
3339
- var b11 = a22 * a33 - a23 * a32;
3340
- var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
3794
+ const a00 = a2[0];
3795
+ const a01 = a2[1];
3796
+ const a02 = a2[2];
3797
+ const a03 = a2[3];
3798
+ const a10 = a2[4];
3799
+ const a11 = a2[5];
3800
+ const a12 = a2[6];
3801
+ const a13 = a2[7];
3802
+ const a20 = a2[8];
3803
+ const a21 = a2[9];
3804
+ const a22 = a2[10];
3805
+ const a23 = a2[11];
3806
+ const a30 = a2[12];
3807
+ const a31 = a2[13];
3808
+ const a32 = a2[14];
3809
+ const a33 = a2[15];
3810
+ const b00 = a00 * a11 - a01 * a10;
3811
+ const b01 = a00 * a12 - a02 * a10;
3812
+ const b02 = a00 * a13 - a03 * a10;
3813
+ const b03 = a01 * a12 - a02 * a11;
3814
+ const b04 = a01 * a13 - a03 * a11;
3815
+ const b05 = a02 * a13 - a03 * a12;
3816
+ const b06 = a20 * a31 - a21 * a30;
3817
+ const b07 = a20 * a32 - a22 * a30;
3818
+ const b08 = a20 * a33 - a23 * a30;
3819
+ const b09 = a21 * a32 - a22 * a31;
3820
+ const b10 = a21 * a33 - a23 * a31;
3821
+ const b11 = a22 * a33 - a23 * a32;
3822
+ let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
3341
3823
  if (!det) {
3342
3824
  return null;
3343
3825
  }
@@ -3361,30 +3843,55 @@
3361
3843
  return out;
3362
3844
  }
3363
3845
  function determinant(a2) {
3364
- var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3];
3365
- var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7];
3366
- var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11];
3367
- var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15];
3368
- var b00 = a00 * a11 - a01 * a10;
3369
- var b01 = a00 * a12 - a02 * a10;
3370
- var b02 = a00 * a13 - a03 * a10;
3371
- var b03 = a01 * a12 - a02 * a11;
3372
- var b04 = a01 * a13 - a03 * a11;
3373
- var b05 = a02 * a13 - a03 * a12;
3374
- var b06 = a20 * a31 - a21 * a30;
3375
- var b07 = a20 * a32 - a22 * a30;
3376
- var b08 = a20 * a33 - a23 * a30;
3377
- var b09 = a21 * a32 - a22 * a31;
3378
- var b10 = a21 * a33 - a23 * a31;
3379
- var b11 = a22 * a33 - a23 * a32;
3380
- return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
3381
- }
3382
- function multiply(out, a2, b) {
3383
- var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3];
3384
- var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7];
3385
- var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11];
3386
- var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15];
3387
- var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];
3846
+ const a00 = a2[0];
3847
+ const a01 = a2[1];
3848
+ const a02 = a2[2];
3849
+ const a03 = a2[3];
3850
+ const a10 = a2[4];
3851
+ const a11 = a2[5];
3852
+ const a12 = a2[6];
3853
+ const a13 = a2[7];
3854
+ const a20 = a2[8];
3855
+ const a21 = a2[9];
3856
+ const a22 = a2[10];
3857
+ const a23 = a2[11];
3858
+ const a30 = a2[12];
3859
+ const a31 = a2[13];
3860
+ const a32 = a2[14];
3861
+ const a33 = a2[15];
3862
+ const b0 = a00 * a11 - a01 * a10;
3863
+ const b1 = a00 * a12 - a02 * a10;
3864
+ const b2 = a01 * a12 - a02 * a11;
3865
+ const b3 = a20 * a31 - a21 * a30;
3866
+ const b4 = a20 * a32 - a22 * a30;
3867
+ const b5 = a21 * a32 - a22 * a31;
3868
+ const b6 = a00 * b5 - a01 * b4 + a02 * b3;
3869
+ const b7 = a10 * b5 - a11 * b4 + a12 * b3;
3870
+ const b8 = a20 * b2 - a21 * b1 + a22 * b0;
3871
+ const b9 = a30 * b2 - a31 * b1 + a32 * b0;
3872
+ return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;
3873
+ }
3874
+ function multiply2(out, a2, b) {
3875
+ const a00 = a2[0];
3876
+ const a01 = a2[1];
3877
+ const a02 = a2[2];
3878
+ const a03 = a2[3];
3879
+ const a10 = a2[4];
3880
+ const a11 = a2[5];
3881
+ const a12 = a2[6];
3882
+ const a13 = a2[7];
3883
+ const a20 = a2[8];
3884
+ const a21 = a2[9];
3885
+ const a22 = a2[10];
3886
+ const a23 = a2[11];
3887
+ const a30 = a2[12];
3888
+ const a31 = a2[13];
3889
+ const a32 = a2[14];
3890
+ const a33 = a2[15];
3891
+ let b0 = b[0];
3892
+ let b1 = b[1];
3893
+ let b2 = b[2];
3894
+ let b3 = b[3];
3388
3895
  out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
3389
3896
  out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
3390
3897
  out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
@@ -3416,10 +3923,21 @@
3416
3923
  return out;
3417
3924
  }
3418
3925
  function translate(out, a2, v) {
3419
- var x = v[0], y = v[1], z = v[2];
3420
- var a00, a01, a02, a03;
3421
- var a10, a11, a12, a13;
3422
- var a20, a21, a22, a23;
3926
+ const x = v[0];
3927
+ const y = v[1];
3928
+ const z = v[2];
3929
+ let a00;
3930
+ let a01;
3931
+ let a02;
3932
+ let a03;
3933
+ let a10;
3934
+ let a11;
3935
+ let a12;
3936
+ let a13;
3937
+ let a20;
3938
+ let a21;
3939
+ let a22;
3940
+ let a23;
3423
3941
  if (a2 === out) {
3424
3942
  out[12] = a2[0] * x + a2[4] * y + a2[8] * z + a2[12];
3425
3943
  out[13] = a2[1] * x + a2[5] * y + a2[9] * z + a2[13];
@@ -3457,8 +3975,10 @@
3457
3975
  }
3458
3976
  return out;
3459
3977
  }
3460
- function scale(out, a2, v) {
3461
- var x = v[0], y = v[1], z = v[2];
3978
+ function scale2(out, a2, v) {
3979
+ const x = v[0];
3980
+ const y = v[1];
3981
+ const z = v[2];
3462
3982
  out[0] = a2[0] * x;
3463
3983
  out[1] = a2[1] * x;
3464
3984
  out[2] = a2[2] * x;
@@ -3478,22 +3998,41 @@
3478
3998
  return out;
3479
3999
  }
3480
4000
  function rotate(out, a2, rad, axis) {
3481
- var x = axis[0], y = axis[1], z = axis[2];
3482
- var len = Math.hypot(x, y, z);
3483
- var s2, c2, t2;
3484
- var a00, a01, a02, a03;
3485
- var a10, a11, a12, a13;
3486
- var a20, a21, a22, a23;
3487
- var b00, b01, b02;
3488
- var b10, b11, b12;
3489
- var b20, b21, b22;
3490
- if (len < EPSILON) {
4001
+ let x = axis[0];
4002
+ let y = axis[1];
4003
+ let z = axis[2];
4004
+ let len2 = Math.sqrt(x * x + y * y + z * z);
4005
+ let c2;
4006
+ let s2;
4007
+ let t2;
4008
+ let a00;
4009
+ let a01;
4010
+ let a02;
4011
+ let a03;
4012
+ let a10;
4013
+ let a11;
4014
+ let a12;
4015
+ let a13;
4016
+ let a20;
4017
+ let a21;
4018
+ let a22;
4019
+ let a23;
4020
+ let b00;
4021
+ let b01;
4022
+ let b02;
4023
+ let b10;
4024
+ let b11;
4025
+ let b12;
4026
+ let b20;
4027
+ let b21;
4028
+ let b22;
4029
+ if (len2 < EPSILON) {
3491
4030
  return null;
3492
4031
  }
3493
- len = 1 / len;
3494
- x *= len;
3495
- y *= len;
3496
- z *= len;
4032
+ len2 = 1 / len2;
4033
+ x *= len2;
4034
+ y *= len2;
4035
+ z *= len2;
3497
4036
  s2 = Math.sin(rad);
3498
4037
  c2 = Math.cos(rad);
3499
4038
  t2 = 1 - c2;
@@ -3539,16 +4078,16 @@
3539
4078
  return out;
3540
4079
  }
3541
4080
  function rotateX2(out, a2, rad) {
3542
- var s2 = Math.sin(rad);
3543
- var c2 = Math.cos(rad);
3544
- var a10 = a2[4];
3545
- var a11 = a2[5];
3546
- var a12 = a2[6];
3547
- var a13 = a2[7];
3548
- var a20 = a2[8];
3549
- var a21 = a2[9];
3550
- var a22 = a2[10];
3551
- var a23 = a2[11];
4081
+ const s2 = Math.sin(rad);
4082
+ const c2 = Math.cos(rad);
4083
+ const a10 = a2[4];
4084
+ const a11 = a2[5];
4085
+ const a12 = a2[6];
4086
+ const a13 = a2[7];
4087
+ const a20 = a2[8];
4088
+ const a21 = a2[9];
4089
+ const a22 = a2[10];
4090
+ const a23 = a2[11];
3552
4091
  if (a2 !== out) {
3553
4092
  out[0] = a2[0];
3554
4093
  out[1] = a2[1];
@@ -3570,16 +4109,16 @@
3570
4109
  return out;
3571
4110
  }
3572
4111
  function rotateY2(out, a2, rad) {
3573
- var s2 = Math.sin(rad);
3574
- var c2 = Math.cos(rad);
3575
- var a00 = a2[0];
3576
- var a01 = a2[1];
3577
- var a02 = a2[2];
3578
- var a03 = a2[3];
3579
- var a20 = a2[8];
3580
- var a21 = a2[9];
3581
- var a22 = a2[10];
3582
- var a23 = a2[11];
4112
+ const s2 = Math.sin(rad);
4113
+ const c2 = Math.cos(rad);
4114
+ const a00 = a2[0];
4115
+ const a01 = a2[1];
4116
+ const a02 = a2[2];
4117
+ const a03 = a2[3];
4118
+ const a20 = a2[8];
4119
+ const a21 = a2[9];
4120
+ const a22 = a2[10];
4121
+ const a23 = a2[11];
3583
4122
  if (a2 !== out) {
3584
4123
  out[4] = a2[4];
3585
4124
  out[5] = a2[5];
@@ -3601,16 +4140,16 @@
3601
4140
  return out;
3602
4141
  }
3603
4142
  function rotateZ2(out, a2, rad) {
3604
- var s2 = Math.sin(rad);
3605
- var c2 = Math.cos(rad);
3606
- var a00 = a2[0];
3607
- var a01 = a2[1];
3608
- var a02 = a2[2];
3609
- var a03 = a2[3];
3610
- var a10 = a2[4];
3611
- var a11 = a2[5];
3612
- var a12 = a2[6];
3613
- var a13 = a2[7];
4143
+ const s2 = Math.sin(rad);
4144
+ const c2 = Math.cos(rad);
4145
+ const a00 = a2[0];
4146
+ const a01 = a2[1];
4147
+ const a02 = a2[2];
4148
+ const a03 = a2[3];
4149
+ const a10 = a2[4];
4150
+ const a11 = a2[5];
4151
+ const a12 = a2[6];
4152
+ const a13 = a2[7];
3614
4153
  if (a2 !== out) {
3615
4154
  out[8] = a2[8];
3616
4155
  out[9] = a2[9];
@@ -3632,19 +4171,22 @@
3632
4171
  return out;
3633
4172
  }
3634
4173
  function fromQuat(out, q) {
3635
- var x = q[0], y = q[1], z = q[2], w = q[3];
3636
- var x2 = x + x;
3637
- var y2 = y + y;
3638
- var z2 = z + z;
3639
- var xx = x * x2;
3640
- var yx = y * x2;
3641
- var yy = y * y2;
3642
- var zx = z * x2;
3643
- var zy = z * y2;
3644
- var zz = z * z2;
3645
- var wx = w * x2;
3646
- var wy = w * y2;
3647
- var wz = w * z2;
4174
+ const x = q[0];
4175
+ const y = q[1];
4176
+ const z = q[2];
4177
+ const w = q[3];
4178
+ const x2 = x + x;
4179
+ const y2 = y + y;
4180
+ const z2 = z + z;
4181
+ const xx = x * x2;
4182
+ const yx = y * x2;
4183
+ const yy = y * y2;
4184
+ const zx = z * x2;
4185
+ const zy = z * y2;
4186
+ const zz = z * z2;
4187
+ const wx = w * x2;
4188
+ const wy = w * y2;
4189
+ const wz = w * z2;
3648
4190
  out[0] = 1 - yy - zz;
3649
4191
  out[1] = yx + wz;
3650
4192
  out[2] = zx - wy;
@@ -3664,9 +4206,9 @@
3664
4206
  return out;
3665
4207
  }
3666
4208
  function frustum(out, left, right, bottom, top, near, far) {
3667
- var rl = 1 / (right - left);
3668
- var tb = 1 / (top - bottom);
3669
- var nf = 1 / (near - far);
4209
+ const rl = 1 / (right - left);
4210
+ const tb = 1 / (top - bottom);
4211
+ const nf = 1 / (near - far);
3670
4212
  out[0] = near * 2 * rl;
3671
4213
  out[1] = 0;
3672
4214
  out[2] = 0;
@@ -3686,7 +4228,7 @@
3686
4228
  return out;
3687
4229
  }
3688
4230
  function perspectiveNO(out, fovy, aspect, near, far) {
3689
- var f2 = 1 / Math.tan(fovy / 2), nf;
4231
+ const f2 = 1 / Math.tan(fovy / 2);
3690
4232
  out[0] = f2 / aspect;
3691
4233
  out[1] = 0;
3692
4234
  out[2] = 0;
@@ -3702,7 +4244,7 @@
3702
4244
  out[13] = 0;
3703
4245
  out[15] = 0;
3704
4246
  if (far != null && far !== Infinity) {
3705
- nf = 1 / (near - far);
4247
+ const nf = 1 / (near - far);
3706
4248
  out[10] = (far + near) * nf;
3707
4249
  out[14] = 2 * far * near * nf;
3708
4250
  } else {
@@ -3713,9 +4255,9 @@
3713
4255
  }
3714
4256
  var perspective = perspectiveNO;
3715
4257
  function orthoNO(out, left, right, bottom, top, near, far) {
3716
- var lr = 1 / (left - right);
3717
- var bt = 1 / (bottom - top);
3718
- var nf = 1 / (near - far);
4258
+ const lr = 1 / (left - right);
4259
+ const bt = 1 / (bottom - top);
4260
+ const nf = 1 / (near - far);
3719
4261
  out[0] = -2 * lr;
3720
4262
  out[1] = 0;
3721
4263
  out[2] = 0;
@@ -3736,53 +4278,62 @@
3736
4278
  }
3737
4279
  var ortho = orthoNO;
3738
4280
  function lookAt(out, eye, center, up) {
3739
- var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;
3740
- var eyex = eye[0];
3741
- var eyey = eye[1];
3742
- var eyez = eye[2];
3743
- var upx = up[0];
3744
- var upy = up[1];
3745
- var upz = up[2];
3746
- var centerx = center[0];
3747
- var centery = center[1];
3748
- var centerz = center[2];
4281
+ let len2;
4282
+ let x0;
4283
+ let x1;
4284
+ let x2;
4285
+ let y0;
4286
+ let y1;
4287
+ let y2;
4288
+ let z0;
4289
+ let z1;
4290
+ let z2;
4291
+ const eyex = eye[0];
4292
+ const eyey = eye[1];
4293
+ const eyez = eye[2];
4294
+ const upx = up[0];
4295
+ const upy = up[1];
4296
+ const upz = up[2];
4297
+ const centerx = center[0];
4298
+ const centery = center[1];
4299
+ const centerz = center[2];
3749
4300
  if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) {
3750
4301
  return identity(out);
3751
4302
  }
3752
4303
  z0 = eyex - centerx;
3753
4304
  z1 = eyey - centery;
3754
4305
  z2 = eyez - centerz;
3755
- len = 1 / Math.hypot(z0, z1, z2);
3756
- z0 *= len;
3757
- z1 *= len;
3758
- z2 *= len;
4306
+ len2 = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);
4307
+ z0 *= len2;
4308
+ z1 *= len2;
4309
+ z2 *= len2;
3759
4310
  x0 = upy * z2 - upz * z1;
3760
4311
  x1 = upz * z0 - upx * z2;
3761
4312
  x2 = upx * z1 - upy * z0;
3762
- len = Math.hypot(x0, x1, x2);
3763
- if (!len) {
4313
+ len2 = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);
4314
+ if (!len2) {
3764
4315
  x0 = 0;
3765
4316
  x1 = 0;
3766
4317
  x2 = 0;
3767
4318
  } else {
3768
- len = 1 / len;
3769
- x0 *= len;
3770
- x1 *= len;
3771
- x2 *= len;
4319
+ len2 = 1 / len2;
4320
+ x0 *= len2;
4321
+ x1 *= len2;
4322
+ x2 *= len2;
3772
4323
  }
3773
4324
  y0 = z1 * x2 - z2 * x1;
3774
4325
  y1 = z2 * x0 - z0 * x2;
3775
4326
  y2 = z0 * x1 - z1 * x0;
3776
- len = Math.hypot(y0, y1, y2);
3777
- if (!len) {
4327
+ len2 = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);
4328
+ if (!len2) {
3778
4329
  y0 = 0;
3779
4330
  y1 = 0;
3780
4331
  y2 = 0;
3781
4332
  } else {
3782
- len = 1 / len;
3783
- y0 *= len;
3784
- y1 *= len;
3785
- y2 *= len;
4333
+ len2 = 1 / len2;
4334
+ y0 *= len2;
4335
+ y1 *= len2;
4336
+ y2 *= len2;
3786
4337
  }
3787
4338
  out[0] = x0;
3788
4339
  out[1] = y0;
@@ -3803,9 +4354,9 @@
3803
4354
  return out;
3804
4355
  }
3805
4356
 
3806
- // ../../node_modules/gl-matrix/esm/vec4.js
4357
+ // ../../node_modules/@math.gl/core/dist/gl-matrix/vec4.js
3807
4358
  function create3() {
3808
- var out = new ARRAY_TYPE(4);
4359
+ const out = new ARRAY_TYPE(4);
3809
4360
  if (ARRAY_TYPE != Float32Array) {
3810
4361
  out[0] = 0;
3811
4362
  out[1] = 0;
@@ -3815,7 +4366,10 @@
3815
4366
  return out;
3816
4367
  }
3817
4368
  function transformMat43(out, a2, m) {
3818
- var x = a2[0], y = a2[1], z = a2[2], w = a2[3];
4369
+ const x = a2[0];
4370
+ const y = a2[1];
4371
+ const z = a2[2];
4372
+ const w = a2[3];
3819
4373
  out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;
3820
4374
  out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;
3821
4375
  out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;
@@ -3823,9 +4377,10 @@
3823
4377
  return out;
3824
4378
  }
3825
4379
  var forEach4 = function() {
3826
- var vec = create3();
4380
+ const vec = create3();
3827
4381
  return function(a2, stride, offset, count, fn, arg) {
3828
- var i2, l2;
4382
+ let i2;
4383
+ let l2;
3829
4384
  if (!stride) {
3830
4385
  stride = 4;
3831
4386
  }
@@ -3852,7 +4407,7 @@
3852
4407
  };
3853
4408
  }();
3854
4409
 
3855
- // ../../node_modules/@math.gl/core/dist/esm/classes/matrix4.js
4410
+ // ../../node_modules/@math.gl/core/dist/classes/matrix4.js
3856
4411
  var INDICES;
3857
4412
  (function(INDICES2) {
3858
4413
  INDICES2[INDICES2["COL0ROW0"] = 0] = "COL0ROW0";
@@ -4074,10 +4629,10 @@
4074
4629
  getRotation(result, scaleResult) {
4075
4630
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
4076
4631
  scaleResult = scaleResult || [-0, -0, -0];
4077
- const scale2 = this.getScale(scaleResult);
4078
- const inverseScale0 = 1 / scale2[0];
4079
- const inverseScale1 = 1 / scale2[1];
4080
- const inverseScale2 = 1 / scale2[2];
4632
+ const scale3 = this.getScale(scaleResult);
4633
+ const inverseScale0 = 1 / scale3[0];
4634
+ const inverseScale1 = 1 / scale3[1];
4635
+ const inverseScale2 = 1 / scale3[2];
4081
4636
  result[0] = this[0] * inverseScale0;
4082
4637
  result[1] = this[1] * inverseScale1;
4083
4638
  result[2] = this[2] * inverseScale2;
@@ -4099,10 +4654,10 @@
4099
4654
  getRotationMatrix3(result, scaleResult) {
4100
4655
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
4101
4656
  scaleResult = scaleResult || [-0, -0, -0];
4102
- const scale2 = this.getScale(scaleResult);
4103
- const inverseScale0 = 1 / scale2[0];
4104
- const inverseScale1 = 1 / scale2[1];
4105
- const inverseScale2 = 1 / scale2[2];
4657
+ const scale3 = this.getScale(scaleResult);
4658
+ const inverseScale0 = 1 / scale3[0];
4659
+ const inverseScale1 = 1 / scale3[1];
4660
+ const inverseScale2 = 1 / scale3[2];
4106
4661
  result[0] = this[0] * inverseScale0;
4107
4662
  result[1] = this[1] * inverseScale1;
4108
4663
  result[2] = this[2] * inverseScale2;
@@ -4123,11 +4678,11 @@
4123
4678
  return this.check();
4124
4679
  }
4125
4680
  multiplyLeft(a2) {
4126
- multiply(this, a2, this);
4681
+ multiply2(this, a2, this);
4127
4682
  return this.check();
4128
4683
  }
4129
4684
  multiplyRight(a2) {
4130
- multiply(this, this, a2);
4685
+ multiply2(this, this, a2);
4131
4686
  return this.check();
4132
4687
  }
4133
4688
  rotateX(radians2) {
@@ -4150,7 +4705,7 @@
4150
4705
  return this.check();
4151
4706
  }
4152
4707
  scale(factor) {
4153
- scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
4708
+ scale2(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
4154
4709
  return this.check();
4155
4710
  }
4156
4711
  translate(vector) {
@@ -4262,35 +4817,60 @@
4262
4817
  return result;
4263
4818
  }
4264
4819
 
4265
- // ../../node_modules/@math.gl/core/dist/esm/lib/math-utils.js
4266
- var math_utils_default = {
4267
- EPSILON1: 0.1,
4268
- EPSILON2: 0.01,
4269
- EPSILON3: 1e-3,
4270
- EPSILON4: 1e-4,
4271
- EPSILON5: 1e-5,
4272
- EPSILON6: 1e-6,
4273
- EPSILON7: 1e-7,
4274
- EPSILON8: 1e-8,
4275
- EPSILON9: 1e-9,
4276
- EPSILON10: 1e-10,
4277
- EPSILON11: 1e-11,
4278
- EPSILON12: 1e-12,
4279
- EPSILON13: 1e-13,
4280
- EPSILON14: 1e-14,
4281
- EPSILON15: 1e-15,
4282
- EPSILON16: 1e-16,
4283
- EPSILON17: 1e-17,
4284
- EPSILON18: 1e-18,
4285
- EPSILON19: 1e-19,
4286
- EPSILON20: 1e-20,
4287
- PI_OVER_TWO: Math.PI / 2,
4288
- PI_OVER_FOUR: Math.PI / 4,
4289
- PI_OVER_SIX: Math.PI / 6,
4290
- TWO_PI: Math.PI * 2
4291
- };
4292
-
4293
- // ../../node_modules/@math.gl/geospatial/dist/esm/constants.js
4820
+ // ../../node_modules/@math.gl/core/dist/lib/math-utils.js
4821
+ var math_utils_exports = {};
4822
+ __export(math_utils_exports, {
4823
+ EPSILON1: () => EPSILON1,
4824
+ EPSILON10: () => EPSILON10,
4825
+ EPSILON11: () => EPSILON11,
4826
+ EPSILON12: () => EPSILON12,
4827
+ EPSILON13: () => EPSILON13,
4828
+ EPSILON14: () => EPSILON14,
4829
+ EPSILON15: () => EPSILON15,
4830
+ EPSILON16: () => EPSILON16,
4831
+ EPSILON17: () => EPSILON17,
4832
+ EPSILON18: () => EPSILON18,
4833
+ EPSILON19: () => EPSILON19,
4834
+ EPSILON2: () => EPSILON2,
4835
+ EPSILON20: () => EPSILON20,
4836
+ EPSILON3: () => EPSILON3,
4837
+ EPSILON4: () => EPSILON4,
4838
+ EPSILON5: () => EPSILON5,
4839
+ EPSILON6: () => EPSILON6,
4840
+ EPSILON7: () => EPSILON7,
4841
+ EPSILON8: () => EPSILON8,
4842
+ EPSILON9: () => EPSILON9,
4843
+ PI_OVER_FOUR: () => PI_OVER_FOUR,
4844
+ PI_OVER_SIX: () => PI_OVER_SIX,
4845
+ PI_OVER_TWO: () => PI_OVER_TWO,
4846
+ TWO_PI: () => TWO_PI
4847
+ });
4848
+ var EPSILON1 = 0.1;
4849
+ var EPSILON2 = 0.01;
4850
+ var EPSILON3 = 1e-3;
4851
+ var EPSILON4 = 1e-4;
4852
+ var EPSILON5 = 1e-5;
4853
+ var EPSILON6 = 1e-6;
4854
+ var EPSILON7 = 1e-7;
4855
+ var EPSILON8 = 1e-8;
4856
+ var EPSILON9 = 1e-9;
4857
+ var EPSILON10 = 1e-10;
4858
+ var EPSILON11 = 1e-11;
4859
+ var EPSILON12 = 1e-12;
4860
+ var EPSILON13 = 1e-13;
4861
+ var EPSILON14 = 1e-14;
4862
+ var EPSILON15 = 1e-15;
4863
+ var EPSILON16 = 1e-16;
4864
+ var EPSILON17 = 1e-17;
4865
+ var EPSILON18 = 1e-18;
4866
+ var EPSILON19 = 1e-19;
4867
+ var EPSILON20 = 1e-20;
4868
+ var PI_OVER_TWO = Math.PI / 2;
4869
+ var PI_OVER_FOUR = Math.PI / 4;
4870
+ var PI_OVER_SIX = Math.PI / 6;
4871
+ var TWO_PI = Math.PI * 2;
4872
+
4873
+ // ../../node_modules/@math.gl/geospatial/dist/constants.js
4294
4874
  var WGS84_RADIUS_X = 6378137;
4295
4875
  var WGS84_RADIUS_Y = 6378137;
4296
4876
  var WGS84_RADIUS_Z = 6356752314245179e-9;
@@ -4303,7 +4883,7 @@
4303
4883
  centerToleranceSquared: 0.1
4304
4884
  };
4305
4885
 
4306
- // ../../node_modules/@math.gl/geospatial/dist/esm/type-utils.js
4886
+ // ../../node_modules/@math.gl/geospatial/dist/type-utils.js
4307
4887
  function identity2(x) {
4308
4888
  return x;
4309
4889
  }
@@ -4347,68 +4927,8 @@
4347
4927
  return toCartographic(vector, cartographic, config._cartographicRadians ? identity2 : toDegrees);
4348
4928
  }
4349
4929
 
4350
- // ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/scale-to-geodetic-surface.js
4351
- var scratchVector2 = new Vector3();
4352
- var scaleToGeodeticSurfaceIntersection = new Vector3();
4353
- var scaleToGeodeticSurfaceGradient = new Vector3();
4354
- function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
4355
- const {
4356
- oneOverRadii,
4357
- oneOverRadiiSquared,
4358
- centerToleranceSquared
4359
- } = ellipsoid;
4360
- scratchVector2.from(cartesian);
4361
- const positionX = scratchVector2.x;
4362
- const positionY = scratchVector2.y;
4363
- const positionZ = scratchVector2.z;
4364
- const oneOverRadiiX = oneOverRadii.x;
4365
- const oneOverRadiiY = oneOverRadii.y;
4366
- const oneOverRadiiZ = oneOverRadii.z;
4367
- const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
4368
- const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
4369
- const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
4370
- const squaredNorm = x2 + y2 + z2;
4371
- const ratio = Math.sqrt(1 / squaredNorm);
4372
- if (!Number.isFinite(ratio)) {
4373
- return void 0;
4374
- }
4375
- const intersection = scaleToGeodeticSurfaceIntersection;
4376
- intersection.copy(cartesian).scale(ratio);
4377
- if (squaredNorm < centerToleranceSquared) {
4378
- return intersection.to(result);
4379
- }
4380
- const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
4381
- const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
4382
- const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
4383
- const gradient = scaleToGeodeticSurfaceGradient;
4384
- gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
4385
- let lambda = (1 - ratio) * scratchVector2.len() / (0.5 * gradient.len());
4386
- let correction = 0;
4387
- let xMultiplier;
4388
- let yMultiplier;
4389
- let zMultiplier;
4390
- let func;
4391
- do {
4392
- lambda -= correction;
4393
- xMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredX);
4394
- yMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredY);
4395
- zMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredZ);
4396
- const xMultiplier2 = xMultiplier * xMultiplier;
4397
- const yMultiplier2 = yMultiplier * yMultiplier;
4398
- const zMultiplier2 = zMultiplier * zMultiplier;
4399
- const xMultiplier3 = xMultiplier2 * xMultiplier;
4400
- const yMultiplier3 = yMultiplier2 * yMultiplier;
4401
- const zMultiplier3 = zMultiplier2 * zMultiplier;
4402
- func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1;
4403
- const denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
4404
- const derivative = -2 * denominator;
4405
- correction = func / derivative;
4406
- } while (Math.abs(func) > math_utils_default.EPSILON12);
4407
- return scratchVector2.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
4408
- }
4409
-
4410
- // ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/ellipsoid-transform.js
4411
- var EPSILON14 = 1e-14;
4930
+ // ../../node_modules/@math.gl/geospatial/dist/ellipsoid/helpers/ellipsoid-transform.js
4931
+ var EPSILON142 = 1e-14;
4412
4932
  var scratchOrigin = new Vector3();
4413
4933
  var VECTOR_PRODUCT_LOCAL_FRAME = {
4414
4934
  up: {
@@ -4465,7 +4985,7 @@
4465
4985
  down: new Vector3()
4466
4986
  };
4467
4987
  var scratchVector1 = new Vector3();
4468
- var scratchVector22 = new Vector3();
4988
+ var scratchVector2 = new Vector3();
4469
4989
  var scratchVector3 = new Vector3();
4470
4990
  function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
4471
4991
  const thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
@@ -4474,14 +4994,14 @@
4474
4994
  let secondAxisVector;
4475
4995
  let thirdAxisVector;
4476
4996
  const origin = scratchOrigin.copy(cartesianOrigin);
4477
- const atPole = equals(origin.x, 0, EPSILON14) && equals(origin.y, 0, EPSILON14);
4997
+ const atPole = equals(origin.x, 0, EPSILON142) && equals(origin.y, 0, EPSILON142);
4478
4998
  if (atPole) {
4479
4999
  const sign = Math.sign(origin.z);
4480
5000
  firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);
4481
5001
  if (firstAxis !== "east" && firstAxis !== "west") {
4482
5002
  firstAxisVector.scale(sign);
4483
5003
  }
4484
- secondAxisVector = scratchVector22.fromArray(degeneratePositionLocalFrame[secondAxis]);
5004
+ secondAxisVector = scratchVector2.fromArray(degeneratePositionLocalFrame[secondAxis]);
4485
5005
  if (secondAxis !== "east" && secondAxis !== "west") {
4486
5006
  secondAxisVector.scale(sign);
4487
5007
  }
@@ -4529,8 +5049,68 @@
4529
5049
  return result;
4530
5050
  }
4531
5051
 
4532
- // ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/ellipsoid.js
5052
+ // ../../node_modules/@math.gl/geospatial/dist/ellipsoid/helpers/scale-to-geodetic-surface.js
4533
5053
  var scratchVector4 = new Vector3();
5054
+ var scaleToGeodeticSurfaceIntersection = new Vector3();
5055
+ var scaleToGeodeticSurfaceGradient = new Vector3();
5056
+ function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
5057
+ const {
5058
+ oneOverRadii,
5059
+ oneOverRadiiSquared,
5060
+ centerToleranceSquared
5061
+ } = ellipsoid;
5062
+ scratchVector4.from(cartesian);
5063
+ const positionX = scratchVector4.x;
5064
+ const positionY = scratchVector4.y;
5065
+ const positionZ = scratchVector4.z;
5066
+ const oneOverRadiiX = oneOverRadii.x;
5067
+ const oneOverRadiiY = oneOverRadii.y;
5068
+ const oneOverRadiiZ = oneOverRadii.z;
5069
+ const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
5070
+ const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
5071
+ const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
5072
+ const squaredNorm = x2 + y2 + z2;
5073
+ const ratio = Math.sqrt(1 / squaredNorm);
5074
+ if (!Number.isFinite(ratio)) {
5075
+ return void 0;
5076
+ }
5077
+ const intersection = scaleToGeodeticSurfaceIntersection;
5078
+ intersection.copy(cartesian).scale(ratio);
5079
+ if (squaredNorm < centerToleranceSquared) {
5080
+ return intersection.to(result);
5081
+ }
5082
+ const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
5083
+ const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
5084
+ const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
5085
+ const gradient = scaleToGeodeticSurfaceGradient;
5086
+ gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
5087
+ let lambda = (1 - ratio) * scratchVector4.len() / (0.5 * gradient.len());
5088
+ let correction = 0;
5089
+ let xMultiplier;
5090
+ let yMultiplier;
5091
+ let zMultiplier;
5092
+ let func;
5093
+ do {
5094
+ lambda -= correction;
5095
+ xMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredX);
5096
+ yMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredY);
5097
+ zMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredZ);
5098
+ const xMultiplier2 = xMultiplier * xMultiplier;
5099
+ const yMultiplier2 = yMultiplier * yMultiplier;
5100
+ const zMultiplier2 = zMultiplier * zMultiplier;
5101
+ const xMultiplier3 = xMultiplier2 * xMultiplier;
5102
+ const yMultiplier3 = yMultiplier2 * yMultiplier;
5103
+ const zMultiplier3 = zMultiplier2 * zMultiplier;
5104
+ func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1;
5105
+ const denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
5106
+ const derivative = -2 * denominator;
5107
+ correction = func / derivative;
5108
+ } while (Math.abs(func) > math_utils_exports.EPSILON12);
5109
+ return scratchVector4.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
5110
+ }
5111
+
5112
+ // ../../node_modules/@math.gl/geospatial/dist/ellipsoid/ellipsoid.js
5113
+ var scratchVector5 = new Vector3();
4534
5114
  var scratchNormal = new Vector3();
4535
5115
  var scratchK = new Vector3();
4536
5116
  var scratchPosition = new Vector3();
@@ -4545,7 +5125,7 @@
4545
5125
  _defineProperty(this, "oneOverRadiiSquared", void 0);
4546
5126
  _defineProperty(this, "minimumRadius", void 0);
4547
5127
  _defineProperty(this, "maximumRadius", void 0);
4548
- _defineProperty(this, "centerToleranceSquared", math_utils_default.EPSILON1);
5128
+ _defineProperty(this, "centerToleranceSquared", math_utils_exports.EPSILON1);
4549
5129
  _defineProperty(this, "squaredXOverSquaredZ", void 0);
4550
5130
  assert4(x >= 0);
4551
5131
  assert4(y >= 0);
@@ -4591,7 +5171,7 @@
4591
5171
  h.copy(scratchCartesian).subtract(point);
4592
5172
  const longitude = Math.atan2(normal.y, normal.x);
4593
5173
  const latitude = Math.asin(normal.z);
4594
- const height = Math.sign(dot(h, scratchCartesian)) * length(h);
5174
+ const height = Math.sign(vec3_exports.dot(h, scratchCartesian)) * vec3_exports.length(h);
4595
5175
  return toCartographicFromRadians([longitude, latitude, height], result);
4596
5176
  }
4597
5177
  eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
@@ -4601,18 +5181,18 @@
4601
5181
  return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);
4602
5182
  }
4603
5183
  geocentricSurfaceNormal(cartesian, result = [0, 0, 0]) {
4604
- return scratchVector4.from(cartesian).normalize().to(result);
5184
+ return scratchVector5.from(cartesian).normalize().to(result);
4605
5185
  }
4606
5186
  geodeticSurfaceNormalCartographic(cartographic, result = [0, 0, 0]) {
4607
5187
  const cartographicVectorRadians = fromCartographicToRadians(cartographic);
4608
5188
  const longitude = cartographicVectorRadians[0];
4609
5189
  const latitude = cartographicVectorRadians[1];
4610
5190
  const cosLatitude = Math.cos(latitude);
4611
- scratchVector4.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
4612
- return scratchVector4.to(result);
5191
+ scratchVector5.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
5192
+ return scratchVector5.to(result);
4613
5193
  }
4614
5194
  geodeticSurfaceNormal(cartesian, result = [0, 0, 0]) {
4615
- return scratchVector4.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
5195
+ return scratchVector5.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
4616
5196
  }
4617
5197
  scaleToGeodeticSurface(cartesian, result) {
4618
5198
  return scaleToGeodeticSurface(cartesian, this, result);
@@ -4633,7 +5213,7 @@
4633
5213
  return scratchPosition.from(position).scale(this.radii).to(result);
4634
5214
  }
4635
5215
  getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
4636
- assert4(equals(this.radii.x, this.radii.y, math_utils_default.EPSILON15));
5216
+ assert4(equals(this.radii.x, this.radii.y, math_utils_exports.EPSILON15));
4637
5217
  assert4(this.radii.z > 0);
4638
5218
  scratchPosition.from(position);
4639
5219
  const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);
@@ -4646,7 +5226,7 @@
4646
5226
  _defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
4647
5227
 
4648
5228
  // ../images/src/lib/utils/version.ts
4649
- var VERSION3 = true ? "4.0.0-beta.1" : "latest";
5229
+ var VERSION3 = true ? "4.0.0-beta.3" : "latest";
4650
5230
 
4651
5231
  // ../images/src/lib/category-api/image-type.ts
4652
5232
  var { _parseImageNode } = globalThis;
@@ -4866,6 +5446,7 @@
4866
5446
  }
4867
5447
  return {
4868
5448
  mimeType: mediaType.mimeType,
5449
+ // TODO - decode width and height
4869
5450
  width: 0,
4870
5451
  height: 0
4871
5452
  };
@@ -4920,7 +5501,9 @@
4920
5501
  return {
4921
5502
  mimeType: "image/jpeg",
4922
5503
  height: dataView.getUint16(i2 + 5, BIG_ENDIAN),
5504
+ // Number of lines
4923
5505
  width: dataView.getUint16(i2 + 7, BIG_ENDIAN)
5506
+ // Number of pixels per line
4924
5507
  };
4925
5508
  }
4926
5509
  if (!tableMarkers.has(marker)) {
@@ -4932,11 +5515,11 @@
4932
5515
  return null;
4933
5516
  }
4934
5517
  function getJpegMarkers() {
4935
- const tableMarkers = new Set([65499, 65476, 65484, 65501, 65534]);
5518
+ const tableMarkers = /* @__PURE__ */ new Set([65499, 65476, 65484, 65501, 65534]);
4936
5519
  for (let i2 = 65504; i2 < 65520; ++i2) {
4937
5520
  tableMarkers.add(i2);
4938
5521
  }
4939
- const sofMarkers = new Set([
5522
+ const sofMarkers = /* @__PURE__ */ new Set([
4940
5523
  65472,
4941
5524
  65473,
4942
5525
  65474,
@@ -5028,7 +5611,9 @@
5028
5611
  image: {
5029
5612
  type: "auto",
5030
5613
  decode: true
5614
+ // if format is HTML
5031
5615
  }
5616
+ // imagebitmap: {} - passes (platform dependent) parameters to ImageBitmap constructor
5032
5617
  };
5033
5618
  var ImageLoader = {
5034
5619
  id: "image",
@@ -5038,17 +5623,19 @@
5038
5623
  mimeTypes: MIME_TYPES,
5039
5624
  extensions: EXTENSIONS,
5040
5625
  parse: parseImage,
5626
+ // TODO: byteOffset, byteLength;
5041
5627
  tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
5042
5628
  options: DEFAULT_IMAGE_LOADER_OPTIONS
5043
5629
  };
5044
5630
 
5045
5631
  // ../draco/src/lib/utils/version.ts
5046
- var VERSION4 = true ? "4.0.0-beta.1" : "latest";
5632
+ var VERSION4 = true ? "4.0.0-beta.3" : "latest";
5047
5633
 
5048
5634
  // ../draco/src/draco-loader.ts
5049
5635
  var DEFAULT_DRACO_OPTIONS = {
5050
5636
  draco: {
5051
5637
  decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
5638
+ // 'js' for IE11
5052
5639
  libraryPath: "libs/",
5053
5640
  extraAttributes: {},
5054
5641
  attributeNameEntry: void 0
@@ -5058,6 +5645,7 @@
5058
5645
  name: "Draco",
5059
5646
  id: "draco",
5060
5647
  module: "draco",
5648
+ // shapes: ['mesh'],
5061
5649
  version: VERSION4,
5062
5650
  worker: true,
5063
5651
  extensions: ["drc"],
@@ -5101,8 +5689,8 @@
5101
5689
  let maxY = -Infinity;
5102
5690
  let maxZ = -Infinity;
5103
5691
  const positions = attributes.POSITION ? attributes.POSITION.value : [];
5104
- const len = positions && positions.length;
5105
- for (let i2 = 0; i2 < len; i2 += 3) {
5692
+ const len2 = positions && positions.length;
5693
+ for (let i2 = 0; i2 < len2; i2 += 3) {
5106
5694
  const x = positions[i2];
5107
5695
  const y = positions[i2 + 1];
5108
5696
  const z = positions[i2 + 2];
@@ -5151,7 +5739,11 @@
5151
5739
  const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);
5152
5740
  for (const attributeName in attributes) {
5153
5741
  const attribute = attributes[attributeName];
5154
- const field = getArrowFieldFromAttribute(attributeName, attribute, namedLoaderDataAttributes[attributeName]);
5742
+ const field = getArrowFieldFromAttribute(
5743
+ attributeName,
5744
+ attribute,
5745
+ namedLoaderDataAttributes[attributeName]
5746
+ );
5155
5747
  fields.push(field);
5156
5748
  }
5157
5749
  if (indices) {
@@ -5200,15 +5792,27 @@
5200
5792
  };
5201
5793
  var INDEX_ITEM_SIZE = 4;
5202
5794
  var DracoParser = class {
5795
+ draco;
5796
+ decoder;
5797
+ metadataQuerier;
5798
+ // draco - the draco decoder, either import `draco3d` or load dynamically
5203
5799
  constructor(draco) {
5204
5800
  this.draco = draco;
5205
5801
  this.decoder = new this.draco.Decoder();
5206
5802
  this.metadataQuerier = new this.draco.MetadataQuerier();
5207
5803
  }
5804
+ /**
5805
+ * Destroy draco resources
5806
+ */
5208
5807
  destroy() {
5209
5808
  this.draco.destroy(this.decoder);
5210
5809
  this.draco.destroy(this.metadataQuerier);
5211
5810
  }
5811
+ /**
5812
+ * NOTE: caller must call `destroyGeometry` on the return value after using it
5813
+ * @param arrayBuffer
5814
+ * @param options
5815
+ */
5212
5816
  parseSync(arrayBuffer, options = {}) {
5213
5817
  const buffer = new this.draco.DecoderBuffer();
5214
5818
  buffer.Init(new Int8Array(arrayBuffer), arrayBuffer.byteLength);
@@ -5253,6 +5857,14 @@
5253
5857
  }
5254
5858
  }
5255
5859
  }
5860
+ // Draco specific "loader data"
5861
+ /**
5862
+ * Extract
5863
+ * @param dracoGeometry
5864
+ * @param geometry_type
5865
+ * @param options
5866
+ * @returns
5867
+ */
5256
5868
  _getDracoLoaderData(dracoGeometry, geometry_type, options) {
5257
5869
  const metadata = this._getTopLevelMetadata(dracoGeometry);
5258
5870
  const attributes = this._getDracoAttributes(dracoGeometry, options);
@@ -5265,6 +5877,12 @@
5265
5877
  attributes
5266
5878
  };
5267
5879
  }
5880
+ /**
5881
+ * Extract all draco provided information and metadata for each attribute
5882
+ * @param dracoGeometry
5883
+ * @param options
5884
+ * @returns
5885
+ */
5268
5886
  _getDracoAttributes(dracoGeometry, options) {
5269
5887
  const dracoAttributes = {};
5270
5888
  for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {
@@ -5292,6 +5910,12 @@
5292
5910
  }
5293
5911
  return dracoAttributes;
5294
5912
  }
5913
+ /**
5914
+ * Get standard loaders.gl mesh category data
5915
+ * Extracts the geometry from draco
5916
+ * @param dracoGeometry
5917
+ * @param options
5918
+ */
5295
5919
  _getMeshData(dracoGeometry, loaderData, options) {
5296
5920
  const attributes = this._getMeshAttributes(loaderData, dracoGeometry, options);
5297
5921
  const positionAttribute = attributes.POSITION;
@@ -5304,6 +5928,7 @@
5304
5928
  return {
5305
5929
  topology: "triangle-strip",
5306
5930
  mode: 4,
5931
+ // GL.TRIANGLES
5307
5932
  attributes,
5308
5933
  indices: {
5309
5934
  value: this._getTriangleStripIndices(dracoGeometry),
@@ -5315,6 +5940,7 @@
5315
5940
  return {
5316
5941
  topology: "triangle-list",
5317
5942
  mode: 5,
5943
+ // GL.TRIANGLE_STRIP
5318
5944
  attributes,
5319
5945
  indices: {
5320
5946
  value: this._getTriangleListIndices(dracoGeometry),
@@ -5326,6 +5952,7 @@
5326
5952
  return {
5327
5953
  topology: "point-list",
5328
5954
  mode: 0,
5955
+ // GL.POINTS
5329
5956
  attributes
5330
5957
  };
5331
5958
  }
@@ -5345,6 +5972,11 @@
5345
5972
  }
5346
5973
  return attributes;
5347
5974
  }
5975
+ // MESH INDICES EXTRACTION
5976
+ /**
5977
+ * For meshes, we need indices to define the faces.
5978
+ * @param dracoGeometry
5979
+ */
5348
5980
  _getTriangleListIndices(dracoGeometry) {
5349
5981
  const numFaces = dracoGeometry.num_faces();
5350
5982
  const numIndices = numFaces * 3;
@@ -5357,6 +5989,10 @@
5357
5989
  this.draco._free(ptr);
5358
5990
  }
5359
5991
  }
5992
+ /**
5993
+ * For meshes, we need indices to define the faces.
5994
+ * @param dracoGeometry
5995
+ */
5360
5996
  _getTriangleStripIndices(dracoGeometry) {
5361
5997
  const dracoArray = new this.draco.DracoInt32Array();
5362
5998
  try {
@@ -5366,6 +6002,12 @@
5366
6002
  this.draco.destroy(dracoArray);
5367
6003
  }
5368
6004
  }
6005
+ /**
6006
+ *
6007
+ * @param dracoGeometry
6008
+ * @param dracoAttribute
6009
+ * @param attributeName
6010
+ */
5369
6011
  _getAttributeValues(dracoGeometry, attribute) {
5370
6012
  const TypedArrayCtor = DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];
5371
6013
  const numComponents = attribute.num_components;
@@ -5377,16 +6019,48 @@
5377
6019
  const ptr = this.draco._malloc(byteLength);
5378
6020
  try {
5379
6021
  const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attribute.attribute_index);
5380
- this.decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, dracoAttribute, dataType, byteLength, ptr);
6022
+ this.decoder.GetAttributeDataArrayForAllPoints(
6023
+ dracoGeometry,
6024
+ dracoAttribute,
6025
+ dataType,
6026
+ byteLength,
6027
+ ptr
6028
+ );
5381
6029
  value = new TypedArrayCtor(this.draco.HEAPF32.buffer, ptr, numValues).slice();
5382
6030
  } finally {
5383
6031
  this.draco._free(ptr);
5384
6032
  }
5385
6033
  return { value, size: numComponents };
5386
6034
  }
6035
+ // Attribute names
6036
+ /**
6037
+ * DRACO does not store attribute names - We need to deduce an attribute name
6038
+ * for each attribute
6039
+ _getAttributeNames(
6040
+ dracoGeometry: Mesh | PointCloud,
6041
+ options: DracoParseOptions
6042
+ ): {[unique_id: number]: string} {
6043
+ const attributeNames: {[unique_id: number]: string} = {};
6044
+ for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {
6045
+ const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);
6046
+ const attributeName = this._deduceAttributeName(dracoAttribute, options);
6047
+ attributeNames[attributeName] = attributeName;
6048
+ }
6049
+ return attributeNames;
6050
+ }
6051
+ */
6052
+ /**
6053
+ * Deduce an attribute name.
6054
+ * @note DRACO does not save attribute names, just general type (POSITION, COLOR)
6055
+ * to help optimize compression. We generate GLTF compatible names for the Draco-recognized
6056
+ * types
6057
+ * @param attributeData
6058
+ */
5387
6059
  _deduceAttributeName(attribute, options) {
5388
6060
  const uniqueId = attribute.unique_id;
5389
- for (const [attributeName, attributeUniqueId] of Object.entries(options.extraAttributes || {})) {
6061
+ for (const [attributeName, attributeUniqueId] of Object.entries(
6062
+ options.extraAttributes || {}
6063
+ )) {
5390
6064
  if (attributeUniqueId === uniqueId) {
5391
6065
  return attributeName;
5392
6066
  }
@@ -5404,14 +6078,22 @@
5404
6078
  }
5405
6079
  return `CUSTOM_ATTRIBUTE_${uniqueId}`;
5406
6080
  }
6081
+ // METADATA EXTRACTION
6082
+ /** Get top level metadata */
5407
6083
  _getTopLevelMetadata(dracoGeometry) {
5408
6084
  const dracoMetadata = this.decoder.GetMetadata(dracoGeometry);
5409
6085
  return this._getDracoMetadata(dracoMetadata);
5410
6086
  }
6087
+ /** Get per attribute metadata */
5411
6088
  _getAttributeMetadata(dracoGeometry, attributeId) {
5412
6089
  const dracoMetadata = this.decoder.GetAttributeMetadata(dracoGeometry, attributeId);
5413
6090
  return this._getDracoMetadata(dracoMetadata);
5414
6091
  }
6092
+ /**
6093
+ * Extract metadata field values
6094
+ * @param dracoMetadata
6095
+ * @returns
6096
+ */
5415
6097
  _getDracoMetadata(dracoMetadata) {
5416
6098
  if (!dracoMetadata || !dracoMetadata.ptr) {
5417
6099
  return {};
@@ -5424,6 +6106,11 @@
5424
6106
  }
5425
6107
  return result;
5426
6108
  }
6109
+ /**
6110
+ * Extracts possible values for one metadata entry by name
6111
+ * @param dracoMetadata
6112
+ * @param entryName
6113
+ */
5427
6114
  _getDracoMetadataField(dracoMetadata, entryName) {
5428
6115
  const dracoArray = new this.draco.DracoInt32Array();
5429
6116
  try {
@@ -5439,6 +6126,8 @@
5439
6126
  this.draco.destroy(dracoArray);
5440
6127
  }
5441
6128
  }
6129
+ // QUANTIZED ATTRIBUTE SUPPORT (NO DECOMPRESSION)
6130
+ /** Skip transforms for specific attribute types */
5442
6131
  _disableAttributeTransforms(options) {
5443
6132
  const { quantizedAttributes = [], octahedronAttributes = [] } = options;
5444
6133
  const skipAttributes = [...quantizedAttributes, ...octahedronAttributes];
@@ -5446,6 +6135,10 @@
5446
6135
  this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);
5447
6136
  }
5448
6137
  }
6138
+ /**
6139
+ * Extract (and apply?) Position Transform
6140
+ * @todo not used
6141
+ */
5449
6142
  _getQuantizationTransform(dracoAttribute, options) {
5450
6143
  const { quantizedAttributes = [] } = options;
5451
6144
  const attribute_type = dracoAttribute.attribute_type();
@@ -5484,6 +6177,7 @@
5484
6177
  }
5485
6178
  return null;
5486
6179
  }
6180
+ // HELPERS
5487
6181
  };
5488
6182
  function getDracoDataType(draco, attributeType) {
5489
6183
  switch (attributeType) {
@@ -5527,9 +6221,13 @@
5527
6221
  var DRACO_ENCODER_VERSION = "1.4.1";
5528
6222
  var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
5529
6223
  var DRACO_EXTERNAL_LIBRARIES = {
6224
+ /** The primary Draco3D encoder, javascript wrapper part */
5530
6225
  DECODER: "draco_wasm_wrapper.js",
6226
+ /** The primary draco decoder, compiled web assembly part */
5531
6227
  DECODER_WASM: "draco_decoder.wasm",
6228
+ /** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */
5532
6229
  FALLBACK_DECODER: "draco_decoder.js",
6230
+ /** Draco encoder */
5533
6231
  ENCODER: "draco_encoder.js"
5534
6232
  };
5535
6233
  var DRACO_EXTERNAL_LIBRARY_URLS = {
@@ -5555,13 +6253,28 @@
5555
6253
  let wasmBinary;
5556
6254
  switch (options.draco && options.draco.decoderType) {
5557
6255
  case "js":
5558
- DracoDecoderModule = await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER], "draco", options, DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER);
6256
+ DracoDecoderModule = await loadLibrary(
6257
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
6258
+ "draco",
6259
+ options,
6260
+ DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER
6261
+ );
5559
6262
  break;
5560
6263
  case "wasm":
5561
6264
  default:
5562
6265
  [DracoDecoderModule, wasmBinary] = await Promise.all([
5563
- await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER], "draco", options, DRACO_EXTERNAL_LIBRARIES.DECODER),
5564
- await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM], "draco", options, DRACO_EXTERNAL_LIBRARIES.DECODER_WASM)
6266
+ await loadLibrary(
6267
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],
6268
+ "draco",
6269
+ options,
6270
+ DRACO_EXTERNAL_LIBRARIES.DECODER
6271
+ ),
6272
+ await loadLibrary(
6273
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],
6274
+ "draco",
6275
+ options,
6276
+ DRACO_EXTERNAL_LIBRARIES.DECODER_WASM
6277
+ )
5565
6278
  ]);
5566
6279
  }
5567
6280
  DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;
@@ -5576,6 +6289,7 @@
5576
6289
  DracoDecoderModule({
5577
6290
  ...options,
5578
6291
  onModuleLoaded: (draco) => resolve2({ draco })
6292
+ // Module is Promise-like. Wrap in object to avoid loop.
5579
6293
  });
5580
6294
  });
5581
6295
  }
@@ -5596,13 +6310,17 @@
5596
6310
  }
5597
6311
 
5598
6312
  // ../textures/src/lib/utils/version.ts
5599
- var VERSION5 = true ? "4.0.0-beta.1" : "beta";
6313
+ var VERSION5 = true ? "4.0.0-beta.3" : "beta";
5600
6314
 
5601
6315
  // ../textures/src/lib/parsers/basis-module-loader.ts
5602
6316
  var BASIS_EXTERNAL_LIBRARIES = {
6317
+ /** Basis transcoder, javascript wrapper part */
5603
6318
  TRANSCODER: "basis_transcoder.js",
6319
+ /** Basis transcoder, compiled web assembly part */
5604
6320
  TRANSCODER_WASM: "basis_transcoder.wasm",
6321
+ /** Basis encoder, javascript wrapper part */
5605
6322
  ENCODER: "basis_encoder.js",
6323
+ /** Basis encoder, compiled web assembly part */
5606
6324
  ENCODER_WASM: "basis_encoder.wasm"
5607
6325
  };
5608
6326
  var loadBasisTranscoderPromise;
@@ -5672,10 +6390,12 @@
5672
6390
 
5673
6391
  // ../textures/src/lib/gl-extensions.ts
5674
6392
  var GL_EXTENSIONS_CONSTANTS = {
6393
+ // WEBGL_compressed_texture_s3tc
5675
6394
  COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
5676
6395
  COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
5677
6396
  COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
5678
6397
  COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,
6398
+ // WEBGL_compressed_texture_es3
5679
6399
  COMPRESSED_R11_EAC: 37488,
5680
6400
  COMPRESSED_SIGNED_R11_EAC: 37489,
5681
6401
  COMPRESSED_RG11_EAC: 37490,
@@ -5686,14 +6406,18 @@
5686
6406
  COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495,
5687
6407
  COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,
5688
6408
  COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,
6409
+ // WEBGL_compressed_texture_pvrtc
5689
6410
  COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
5690
6411
  COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
5691
6412
  COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
5692
6413
  COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
6414
+ // WEBGL_compressed_texture_etc1
5693
6415
  COMPRESSED_RGB_ETC1_WEBGL: 36196,
6416
+ // WEBGL_compressed_texture_atc
5694
6417
  COMPRESSED_RGB_ATC_WEBGL: 35986,
5695
6418
  COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,
5696
6419
  COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,
6420
+ // WEBGL_compressed_texture_astc
5697
6421
  COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,
5698
6422
  COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,
5699
6423
  COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,
@@ -5722,10 +6446,12 @@
5722
6446
  COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,
5723
6447
  COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,
5724
6448
  COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,
6449
+ // EXT_texture_compression_rgtc
5725
6450
  COMPRESSED_RED_RGTC1_EXT: 36283,
5726
6451
  COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,
5727
6452
  COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,
5728
6453
  COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,
6454
+ // WEBGL_compressed_texture_s3tc_srgb
5729
6455
  COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,
5730
6456
  COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,
5731
6457
  COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,
@@ -5735,6 +6461,7 @@
5735
6461
  // ../textures/src/lib/utils/texture-formats.ts
5736
6462
  var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
5737
6463
  var WEBGL_EXTENSIONS = {
6464
+ /* eslint-disable camelcase */
5738
6465
  WEBGL_compressed_texture_s3tc: "dxt",
5739
6466
  WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb",
5740
6467
  WEBGL_compressed_texture_etc1: "etc1",
@@ -5743,12 +6470,13 @@
5743
6470
  WEBGL_compressed_texture_atc: "atc",
5744
6471
  WEBGL_compressed_texture_astc: "astc",
5745
6472
  EXT_texture_compression_rgtc: "rgtc"
6473
+ /* eslint-enable camelcase */
5746
6474
  };
5747
6475
  var formats = null;
5748
6476
  function getSupportedGPUTextureFormats(gl) {
5749
6477
  if (!formats) {
5750
6478
  gl = gl || getWebGLContext() || void 0;
5751
- formats = new Set();
6479
+ formats = /* @__PURE__ */ new Set();
5752
6480
  for (const prefix of BROWSER_PREFIXES) {
5753
6481
  for (const extension in WEBGL_EXTENSIONS) {
5754
6482
  if (gl && gl.getExtension(`${prefix}${extension}`)) {
@@ -5834,7 +6562,7 @@
5834
6562
  }
5835
6563
  };
5836
6564
  function _(t2) {
5837
- return typeof TextDecoder != "undefined" ? new TextDecoder().decode(t2) : Buffer.from(t2).toString("utf8");
6565
+ return "undefined" != typeof TextDecoder ? new TextDecoder().decode(t2) : Buffer.from(t2).toString("utf8");
5838
6566
  }
5839
6567
  function p(t2) {
5840
6568
  const n2 = new Uint8Array(t2.buffer, t2.byteOffset, e.length);
@@ -5925,49 +6653,91 @@
5925
6653
  154: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_R11_EAC,
5926
6654
  155: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RG11_EAC,
5927
6655
  156: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RG11_EAC,
6656
+ // @ts-ignore
5928
6657
  157: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
6658
+ // @ts-ignore
5929
6659
  158: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
6660
+ // @ts-ignore
5930
6661
  159: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
6662
+ // @ts-ignore
5931
6663
  160: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,
6664
+ // @ts-ignore
5932
6665
  161: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
6666
+ // @ts-ignore
5933
6667
  162: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
6668
+ // @ts-ignore
5934
6669
  163: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
6670
+ // @ts-ignore
5935
6671
  164: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
6672
+ // @ts-ignore
5936
6673
  165: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
6674
+ // @ts-ignore
5937
6675
  166: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
6676
+ // @ts-ignore
5938
6677
  167: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
6678
+ // @ts-ignore
5939
6679
  168: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
6680
+ // @ts-ignore
5940
6681
  169: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
6682
+ // @ts-ignore
5941
6683
  170: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
6684
+ // @ts-ignore
5942
6685
  171: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
6686
+ // @ts-ignore
5943
6687
  172: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
6688
+ // @ts-ignore
5944
6689
  173: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
6690
+ // @ts-ignore
5945
6691
  174: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
6692
+ // @ts-ignore
5946
6693
  175: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
6694
+ // @ts-ignore
5947
6695
  176: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
6696
+ // @ts-ignore
5948
6697
  177: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
6698
+ // @ts-ignore
5949
6699
  178: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
6700
+ // @ts-ignore
5950
6701
  179: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
6702
+ // @ts-ignore
5951
6703
  180: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
6704
+ // @ts-ignore
5952
6705
  181: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
6706
+ // @ts-ignore
5953
6707
  182: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
6708
+ // @ts-ignore
5954
6709
  183: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR,
6710
+ // @ts-ignore
5955
6711
  184: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
5956
6712
  1000054e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
5957
6713
  1000054001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
6714
+ // @ts-ignore
5958
6715
  1000066e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
6716
+ // @ts-ignore
5959
6717
  1000066001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
6718
+ // @ts-ignore
5960
6719
  1000066002: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
6720
+ // @ts-ignore
5961
6721
  1000066003: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
6722
+ // @ts-ignore
5962
6723
  1000066004: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
6724
+ // @ts-ignore
5963
6725
  1000066005: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
6726
+ // @ts-ignore
5964
6727
  1000066006: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
6728
+ // @ts-ignore
5965
6729
  1000066007: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
6730
+ // @ts-ignore
5966
6731
  1000066008: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
6732
+ // @ts-ignore
5967
6733
  1000066009: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
6734
+ // @ts-ignore
5968
6735
  1000066010: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
6736
+ // @ts-ignore
5969
6737
  1000066011: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
6738
+ // @ts-ignore
5970
6739
  1000066012: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
6740
+ // @ts-ignore
5971
6741
  1000066013: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR
5972
6742
  };
5973
6743
  function mapVkFormatToWebGL(vkFormat) {
@@ -5976,6 +6746,7 @@
5976
6746
 
5977
6747
  // ../textures/src/lib/parsers/parse-ktx.ts
5978
6748
  var KTX2_ID = [
6749
+ // '´', 'K', 'T', 'X', '2', '0', 'ª', '\r', '\n', '\x1A', '\n'
5979
6750
  171,
5980
6751
  75,
5981
6752
  84,
@@ -5991,7 +6762,18 @@
5991
6762
  ];
5992
6763
  function isKTX(data) {
5993
6764
  const id = new Uint8Array(data);
5994
- const notKTX = id.byteLength < KTX2_ID.length || id[0] !== KTX2_ID[0] || id[1] !== KTX2_ID[1] || id[2] !== KTX2_ID[2] || id[3] !== KTX2_ID[3] || id[4] !== KTX2_ID[4] || id[5] !== KTX2_ID[5] || id[6] !== KTX2_ID[6] || id[7] !== KTX2_ID[7] || id[8] !== KTX2_ID[8] || id[9] !== KTX2_ID[9] || id[10] !== KTX2_ID[10] || id[11] !== KTX2_ID[11];
6765
+ const notKTX = id.byteLength < KTX2_ID.length || id[0] !== KTX2_ID[0] || // '´'
6766
+ id[1] !== KTX2_ID[1] || // 'K'
6767
+ id[2] !== KTX2_ID[2] || // 'T'
6768
+ id[3] !== KTX2_ID[3] || // 'X'
6769
+ id[4] !== KTX2_ID[4] || // ' '
6770
+ id[5] !== KTX2_ID[5] || // '2'
6771
+ id[6] !== KTX2_ID[6] || // '0'
6772
+ id[7] !== KTX2_ID[7] || // 'ª'
6773
+ id[8] !== KTX2_ID[8] || // '\r'
6774
+ id[9] !== KTX2_ID[9] || // '\n'
6775
+ id[10] !== KTX2_ID[10] || // '\x1A'
6776
+ id[11] !== KTX2_ID[11];
5995
6777
  return !notKTX;
5996
6778
  }
5997
6779
  function parseKTX(arrayBuffer) {
@@ -6104,7 +6886,9 @@
6104
6886
  function transcodeImage(basisFile, imageIndex, levelIndex, options) {
6105
6887
  const width = basisFile.getImageWidth(imageIndex, levelIndex);
6106
6888
  const height = basisFile.getImageHeight(imageIndex, levelIndex);
6107
- const hasAlpha = basisFile.getHasAlpha();
6889
+ const hasAlpha = basisFile.getHasAlpha(
6890
+ /* imageIndex, levelIndex */
6891
+ );
6108
6892
  const { compressed, format, basisFormat } = getBasisOptions(options, hasAlpha);
6109
6893
  const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
6110
6894
  const decodedData = new Uint8Array(decodedSize);
@@ -6112,11 +6896,14 @@
6112
6896
  throw new Error("failed to start Basis transcoding");
6113
6897
  }
6114
6898
  return {
6899
+ // standard loaders.gl image category payload
6115
6900
  width,
6116
6901
  height,
6117
6902
  data: decodedData,
6118
6903
  compressed,
6119
6904
  format,
6905
+ // Additional fields
6906
+ // Add levelSize field.
6120
6907
  hasAlpha
6121
6908
  };
6122
6909
  }
@@ -6141,16 +6928,33 @@
6141
6928
  function transcodeKTX2Image(ktx2File, levelIndex, options) {
6142
6929
  const { alphaFlag, height, width } = ktx2File.getImageLevelInfo(levelIndex, 0, 0);
6143
6930
  const { compressed, format, basisFormat } = getBasisOptions(options, alphaFlag);
6144
- const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
6931
+ const decodedSize = ktx2File.getImageTranscodedSizeInBytes(
6932
+ levelIndex,
6933
+ 0,
6934
+ 0,
6935
+ basisFormat
6936
+ );
6145
6937
  const decodedData = new Uint8Array(decodedSize);
6146
- if (!ktx2File.transcodeImage(decodedData, levelIndex, 0, 0, basisFormat, 0, -1, -1)) {
6938
+ if (!ktx2File.transcodeImage(
6939
+ decodedData,
6940
+ levelIndex,
6941
+ 0,
6942
+ 0,
6943
+ basisFormat,
6944
+ 0,
6945
+ -1,
6946
+ -1
6947
+ /* channel1 */
6948
+ )) {
6147
6949
  throw new Error("Failed to transcode KTX2 image");
6148
6950
  }
6149
6951
  return {
6952
+ // standard loaders.gl image category payload
6150
6953
  width,
6151
6954
  height,
6152
6955
  data: decodedData,
6153
6956
  compressed,
6957
+ // Additional fields
6154
6958
  levelSize: decodedSize,
6155
6959
  hasAlpha: alphaFlag,
6156
6960
  format
@@ -6203,9 +7007,12 @@
6203
7007
  options: {
6204
7008
  basis: {
6205
7009
  format: "auto",
7010
+ // gl context doesn't exist on a worker thread
6206
7011
  libraryPath: "libs/",
6207
7012
  containerFormat: "auto",
7013
+ // 'basis' || 'ktx2' || 'auto'
6208
7014
  module: "transcoder"
7015
+ // 'transcoder' || 'encoder'
6209
7016
  }
6210
7017
  }
6211
7018
  };
@@ -6256,7 +7063,10 @@
6256
7063
  function parseDDS(data) {
6257
7064
  const header = new Int32Array(data, 0, DDS_CONSTANTS.HEADER_LENGTH);
6258
7065
  const pixelFormatNumber = header[DDS_CONSTANTS.HEADER_PF_FOURCC_INDEX];
6259
- assert(Boolean(header[DDS_CONSTANTS.HEADER_PF_FLAGS_INDEX] & DDS_CONSTANTS.DDPF_FOURCC), "DDS: Unsupported format, must contain a FourCC code");
7066
+ assert(
7067
+ Boolean(header[DDS_CONSTANTS.HEADER_PF_FLAGS_INDEX] & DDS_CONSTANTS.DDPF_FOURCC),
7068
+ "DDS: Unsupported format, must contain a FourCC code"
7069
+ );
6260
7070
  const fourCC = int32ToFourCC(pixelFormatNumber);
6261
7071
  const internalFormat = DDS_PIXEL_FORMATS[fourCC];
6262
7072
  const sizeFunction = DDS_SIZE_FUNCTIONS[fourCC];
@@ -6284,7 +7094,12 @@
6284
7094
  return (width + 3 >> 2) * (height + 3 >> 2) * 16;
6285
7095
  }
6286
7096
  function int32ToFourCC(value) {
6287
- return String.fromCharCode(value & 255, value >> 8 & 255, value >> 16 & 255, value >> 24 & 255);
7097
+ return String.fromCharCode(
7098
+ value & 255,
7099
+ value >> 8 & 255,
7100
+ value >> 16 & 255,
7101
+ value >> 24 & 255
7102
+ );
6288
7103
  }
6289
7104
 
6290
7105
  // ../textures/src/lib/parsers/parse-pvr.ts
@@ -6507,7 +7322,9 @@
6507
7322
  "ktx",
6508
7323
  "ktx2",
6509
7324
  "dds",
7325
+ // WEBGL_compressed_texture_s3tc, WEBGL_compressed_texture_atc
6510
7326
  "pvr"
7327
+ // WEBGL_compressed_texture_pvrtc
6511
7328
  ],
6512
7329
  mimeTypes: [
6513
7330
  "image/ktx2",
@@ -6533,6 +7350,7 @@
6533
7350
  alpha: "BC3",
6534
7351
  noAlpha: "BC1"
6535
7352
  },
7353
+ // @ts-expect-error TODO not allowed to modify inputs
6536
7354
  ...options.basis,
6537
7355
  containerFormat: "ktx2",
6538
7356
  module: "encoder"
@@ -6544,13 +7362,6 @@
6544
7362
  }
6545
7363
  };
6546
7364
 
6547
- // src/types.ts
6548
- var HeaderAttributeProperty;
6549
- (function(HeaderAttributeProperty2) {
6550
- HeaderAttributeProperty2["vertexCount"] = "vertexCount";
6551
- HeaderAttributeProperty2["featureCount"] = "featureCount";
6552
- })(HeaderAttributeProperty || (HeaderAttributeProperty = {}));
6553
-
6554
7365
  // src/lib/utils/url-utils.ts
6555
7366
  function getUrlWithToken(url, token = null) {
6556
7367
  return token ? `${url}?token=${token}` : url;
@@ -7221,14 +8032,6 @@
7221
8032
  var OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
7222
8033
  var FLOAT_64_TYPE = "Float64";
7223
8034
  var INT_16_ATTRIBUTE_TYPE = "Int16";
7224
- var COORDINATE_SYSTEM;
7225
- (function(COORDINATE_SYSTEM2) {
7226
- COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["DEFAULT"] = -1] = "DEFAULT";
7227
- COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT"] = 1] = "LNGLAT";
7228
- COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["METER_OFFSETS"] = 2] = "METER_OFFSETS";
7229
- COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT_OFFSETS"] = 3] = "LNGLAT_OFFSETS";
7230
- COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["CARTESIAN"] = 0] = "CARTESIAN";
7231
- })(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
7232
8035
 
7233
8036
  // src/lib/parsers/parse-i3s-attribute.ts
7234
8037
  function parseI3STileAttribute(arrayBuffer, options) {
@@ -7272,7 +8075,11 @@
7272
8075
  const bytesPerStringSize = 4;
7273
8076
  const stringsArray = [];
7274
8077
  try {
7275
- const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);
8078
+ const stringsCount = new DataView(
8079
+ arrayBuffer,
8080
+ stringsCountOffset,
8081
+ bytesPerStringSize
8082
+ ).getUint32(stringsCountOffset, true);
7276
8083
  const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
7277
8084
  let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
7278
8085
  for (const stringByteSize of stringSizes) {
@@ -7288,7 +8095,7 @@
7288
8095
  }
7289
8096
 
7290
8097
  // src/i3s-attribute-loader.ts
7291
- var VERSION6 = true ? "4.0.0-beta.1" : "latest";
8098
+ var VERSION6 = true ? "4.0.0-beta.3" : "latest";
7292
8099
  var I3SAttributeLoader = {
7293
8100
  name: "I3S Attribute",
7294
8101
  id: "i3s-attribute",
@@ -7314,11 +8121,20 @@
7314
8121
  if (!options?.i3s?.colorsByAttribute) {
7315
8122
  return colors;
7316
8123
  }
7317
- const colorizeAttributeField = tilesetOptions.fields.find(({ name }) => name === options?.i3s?.colorsByAttribute?.attributeName);
7318
- if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(colorizeAttributeField.type)) {
8124
+ const colorizeAttributeField = tilesetOptions.fields.find(
8125
+ ({ name }) => name === options?.i3s?.colorsByAttribute?.attributeName
8126
+ );
8127
+ if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(
8128
+ colorizeAttributeField.type
8129
+ )) {
7319
8130
  return colors;
7320
8131
  }
7321
- const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, tileOptions, tilesetOptions, options);
8132
+ const colorizeAttributeData = await loadFeatureAttributeData(
8133
+ colorizeAttributeField.name,
8134
+ tileOptions,
8135
+ tilesetOptions,
8136
+ options
8137
+ );
7322
8138
  if (!colorizeAttributeData) {
7323
8139
  return colors;
7324
8140
  }
@@ -7326,13 +8142,22 @@
7326
8142
  if (!objectIdField) {
7327
8143
  return colors;
7328
8144
  }
7329
- const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, tileOptions, tilesetOptions, options);
8145
+ const objectIdAttributeData = await loadFeatureAttributeData(
8146
+ objectIdField.name,
8147
+ tileOptions,
8148
+ tilesetOptions,
8149
+ options
8150
+ );
7330
8151
  if (!objectIdAttributeData) {
7331
8152
  return colors;
7332
8153
  }
7333
8154
  const attributeValuesMap = {};
7334
8155
  for (let i2 = 0; i2 < objectIdAttributeData[objectIdField.name].length; i2++) {
7335
- attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i2], options);
8156
+ attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(
8157
+ // @ts-expect-error
8158
+ colorizeAttributeData[colorizeAttributeField.name][i2],
8159
+ options
8160
+ );
7336
8161
  }
7337
8162
  for (let i2 = 0; i2 < featureIds.value.length; i2++) {
7338
8163
  const color = attributeValuesMap[featureIds.value[i2]];
@@ -7376,7 +8201,7 @@
7376
8201
  }
7377
8202
 
7378
8203
  // src/lib/parsers/parse-i3s-tile-content.ts
7379
- var scratchVector5 = new Vector3([0, 0, 0]);
8204
+ var scratchVector6 = new Vector3([0, 0, 0]);
7380
8205
  function getLoaderForTextureFormat(textureFormat) {
7381
8206
  switch (textureFormat) {
7382
8207
  case "ktx-etc2":
@@ -7405,7 +8230,8 @@
7405
8230
  if (tileOptions.textureUrl) {
7406
8231
  const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);
7407
8232
  const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
7408
- const response = await fetch(url, options?.fetch);
8233
+ const fetch2 = context?.fetch;
8234
+ const response = await fetch2(url);
7409
8235
  const arrayBuffer2 = await response.arrayBuffer();
7410
8236
  if (options?.i3s.decodeTextures) {
7411
8237
  if (loader === ImageLoader) {
@@ -7487,26 +8313,46 @@
7487
8313
  byteOffset = headers.byteOffset;
7488
8314
  vertexCount = headers.vertexCount;
7489
8315
  featureCount = headers.featureCount;
7490
- const { attributes: normalizedVertexAttributes, byteOffset: offset } = normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder);
7491
- const { attributes: normalizedFeatureAttributes } = normalizeAttributes(arrayBuffer, offset, featureAttributes, featureCount, featureAttributeOrder);
8316
+ const { attributes: normalizedVertexAttributes, byteOffset: offset } = normalizeAttributes(
8317
+ arrayBuffer,
8318
+ byteOffset,
8319
+ vertexAttributes,
8320
+ vertexCount,
8321
+ attributesOrder
8322
+ );
8323
+ const { attributes: normalizedFeatureAttributes } = normalizeAttributes(
8324
+ arrayBuffer,
8325
+ offset,
8326
+ featureAttributes,
8327
+ featureCount,
8328
+ featureAttributeOrder
8329
+ );
7492
8330
  flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);
7493
8331
  attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
7494
8332
  }
7495
- if (!options?.i3s?.coordinateSystem || options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS) {
8333
+ if (!options?.i3s?.coordinateSystem || options.i3s.coordinateSystem === 2 /* METER_OFFSETS */) {
7496
8334
  const enuMatrix = parsePositions(attributes.position, tileOptions);
7497
8335
  content.modelMatrix = enuMatrix.invert();
7498
- content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;
8336
+ content.coordinateSystem = 2 /* METER_OFFSETS */;
7499
8337
  } else {
7500
8338
  content.modelMatrix = getModelMatrix(attributes.position);
7501
- content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;
7502
- }
7503
- attributes.color = await customizeColors(attributes.color, attributes.id, tileOptions, tilesetOptions, options);
8339
+ content.coordinateSystem = 3 /* LNGLAT_OFFSETS */;
8340
+ }
8341
+ attributes.color = await customizeColors(
8342
+ attributes.color,
8343
+ attributes.id,
8344
+ tileOptions,
8345
+ tilesetOptions,
8346
+ options
8347
+ );
7504
8348
  content.attributes = {
7505
8349
  positions: attributes.position,
7506
8350
  normals: attributes.normal,
7507
8351
  colors: normalizeAttribute(attributes.color),
8352
+ // Normalize from UInt8
7508
8353
  texCoords: attributes.uv0,
7509
8354
  uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region)
8355
+ // Normalize from UInt16
7510
8356
  };
7511
8357
  content.indices = indices || null;
7512
8358
  if (attributes.id && attributes.id.value) {
@@ -7553,11 +8399,11 @@
7553
8399
  for (const { property, type } of options.store.defaultGeometrySchema.header) {
7554
8400
  const TypedArrayTypeHeader = getConstructorForDataFormat(type);
7555
8401
  switch (property) {
7556
- case HeaderAttributeProperty.vertexCount:
8402
+ case "vertexCount" /* vertexCount */:
7557
8403
  vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
7558
8404
  byteOffset += sizeOf(type);
7559
8405
  break;
7560
- case HeaderAttributeProperty.featureCount:
8406
+ case "featureCount" /* featureCount */:
7561
8407
  featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
7562
8408
  byteOffset += sizeOf(type);
7563
8409
  break;
@@ -7642,10 +8488,10 @@
7642
8488
  positions[i2 + 2] = vertices[i2 + 2] + cartographicOrigin.z;
7643
8489
  }
7644
8490
  for (let i2 = 0; i2 < positions.length; i2 += 3) {
7645
- Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i2, i2 + 3), scratchVector5);
7646
- positions[i2] = scratchVector5.x;
7647
- positions[i2 + 1] = scratchVector5.y;
7648
- positions[i2 + 2] = scratchVector5.z;
8491
+ Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i2, i2 + 3), scratchVector6);
8492
+ positions[i2] = scratchVector6.x;
8493
+ positions[i2 + 1] = scratchVector6.y;
8494
+ positions[i2 + 2] = scratchVector6.z;
7649
8495
  }
7650
8496
  return positions;
7651
8497
  }
@@ -7683,7 +8529,9 @@
7683
8529
  pbrMaterial.emissiveFactor = convertColorFormat(pbrMaterial.emissiveFactor);
7684
8530
  }
7685
8531
  if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {
7686
- pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(pbrMaterial.pbrMetallicRoughness.baseColorFactor);
8532
+ pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(
8533
+ pbrMaterial.pbrMetallicRoughness.baseColorFactor
8534
+ );
7687
8535
  }
7688
8536
  if (texture) {
7689
8537
  setMaterialTexture(pbrMaterial, texture);
@@ -7753,7 +8601,7 @@
7753
8601
  }
7754
8602
 
7755
8603
  // src/i3s-content-loader.ts
7756
- var VERSION7 = true ? "4.0.0-beta.1" : "beta";
8604
+ var VERSION7 = true ? "4.0.0-beta.3" : "beta";
7757
8605
  var I3SContentLoader = {
7758
8606
  name: "I3S Content (Indexed Scene Layers)",
7759
8607
  id: "i3s-content",
@@ -7774,7 +8622,13 @@
7774
8622
  if (!tileOptions || !tilesetOptions) {
7775
8623
  return null;
7776
8624
  }
7777
- return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);
8625
+ return await parseI3STileContent(
8626
+ data,
8627
+ tileOptions,
8628
+ tilesetOptions,
8629
+ options,
8630
+ context
8631
+ );
7778
8632
  }
7779
8633
 
7780
8634
  // src/workers/i3s-content-worker.ts