@deck.gl/carto 8.10.0-alpha.2 → 8.10.0-alpha.4

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 (249) hide show
  1. package/LICENSE +1 -1
  2. package/dist/cartoRasterTile-worker.js +1084 -0
  3. package/dist/cartoSpatialTile-worker.js +1469 -0
  4. package/dist/cartoVectorTile-worker.js +1727 -0
  5. package/dist/dist.dev.js +1733 -881
  6. package/dist/es5/api/layer-map.js +3 -7
  7. package/dist/es5/api/layer-map.js.map +1 -1
  8. package/dist/es5/api/maps-api-common.js +0 -1
  9. package/dist/es5/api/maps-api-common.js.map +1 -1
  10. package/dist/es5/api/maps-v3-client.js +5 -20
  11. package/dist/es5/api/maps-v3-client.js.map +1 -1
  12. package/dist/es5/index.js +74 -6
  13. package/dist/es5/index.js.map +1 -1
  14. package/dist/es5/layers/h3-tile-layer.js +23 -41
  15. package/dist/es5/layers/h3-tile-layer.js.map +1 -1
  16. package/dist/es5/layers/quadbin-tile-layer.js +21 -42
  17. package/dist/es5/layers/quadbin-tile-layer.js.map +1 -1
  18. package/dist/es5/layers/raster-tile-layer.js +23 -39
  19. package/dist/es5/layers/raster-tile-layer.js.map +1 -1
  20. package/dist/es5/layers/schema/carto-raster-tile-loader.js +13 -4
  21. package/dist/es5/layers/schema/carto-raster-tile-loader.js.map +1 -1
  22. package/dist/es5/layers/schema/carto-spatial-tile-loader.js +14 -8
  23. package/dist/es5/layers/schema/carto-spatial-tile-loader.js.map +1 -1
  24. package/dist/es5/layers/schema/carto-tile.js +1 -1
  25. package/dist/es5/layers/schema/carto-tile.js.map +1 -1
  26. package/dist/es5/layers/schema/carto-vector-tile-loader.js +64 -4
  27. package/dist/es5/layers/schema/carto-vector-tile-loader.js.map +1 -1
  28. package/dist/es5/layers/utils.js +29 -0
  29. package/dist/es5/layers/utils.js.map +1 -0
  30. package/dist/es5/layers/{carto-tile-layer.js → vector-tile-layer.js} +49 -24
  31. package/dist/es5/layers/vector-tile-layer.js.map +1 -0
  32. package/dist/es5/sources/base-source.js +100 -0
  33. package/dist/es5/sources/base-source.js.map +1 -0
  34. package/dist/es5/sources/common.js +48 -0
  35. package/dist/es5/sources/common.js.map +1 -0
  36. package/dist/es5/sources/h3-query-source.js +58 -0
  37. package/dist/es5/sources/h3-query-source.js.map +1 -0
  38. package/dist/es5/sources/h3-table-source.js +58 -0
  39. package/dist/es5/sources/h3-table-source.js.map +1 -0
  40. package/dist/es5/sources/h3-tileset-source.js +43 -0
  41. package/dist/es5/sources/h3-tileset-source.js.map +1 -0
  42. package/dist/es5/sources/index.js +94 -0
  43. package/dist/es5/sources/index.js.map +1 -0
  44. package/dist/es5/sources/quadbin-query-source.js +58 -0
  45. package/dist/es5/sources/quadbin-query-source.js.map +1 -0
  46. package/dist/es5/sources/quadbin-table-source.js +58 -0
  47. package/dist/es5/sources/quadbin-table-source.js.map +1 -0
  48. package/dist/es5/sources/quadbin-tileset-source.js +43 -0
  49. package/dist/es5/sources/quadbin-tileset-source.js.map +1 -0
  50. package/dist/es5/sources/raster-source.js +43 -0
  51. package/dist/es5/sources/raster-source.js.map +1 -0
  52. package/dist/es5/sources/utils.js +136 -0
  53. package/dist/es5/sources/utils.js.map +1 -0
  54. package/dist/es5/sources/vector-query-source.js +52 -0
  55. package/dist/es5/sources/vector-query-source.js.map +1 -0
  56. package/dist/es5/sources/vector-table-source.js +52 -0
  57. package/dist/es5/sources/vector-table-source.js.map +1 -0
  58. package/dist/es5/sources/vector-tileset-source.js +43 -0
  59. package/dist/es5/sources/vector-tileset-source.js.map +1 -0
  60. package/dist/es5/utils.js +5 -0
  61. package/dist/es5/utils.js.map +1 -1
  62. package/dist/es5/workers/cartoRasterTile.js +10 -0
  63. package/dist/es5/workers/cartoRasterTile.js.map +1 -0
  64. package/dist/es5/workers/cartoSpatialTile.js +10 -0
  65. package/dist/es5/workers/cartoSpatialTile.js.map +1 -0
  66. package/dist/es5/workers/cartoVectorTile.js +10 -0
  67. package/dist/es5/workers/cartoVectorTile.js.map +1 -0
  68. package/dist/esm/api/layer-map.js +3 -7
  69. package/dist/esm/api/layer-map.js.map +1 -1
  70. package/dist/esm/api/maps-api-common.js +0 -1
  71. package/dist/esm/api/maps-api-common.js.map +1 -1
  72. package/dist/esm/api/maps-v3-client.js +2 -12
  73. package/dist/esm/api/maps-v3-client.js.map +1 -1
  74. package/dist/esm/index.js +5 -4
  75. package/dist/esm/index.js.map +1 -1
  76. package/dist/esm/layers/h3-tile-layer.js +21 -37
  77. package/dist/esm/layers/h3-tile-layer.js.map +1 -1
  78. package/dist/esm/layers/quadbin-tile-layer.js +18 -38
  79. package/dist/esm/layers/quadbin-tile-layer.js.map +1 -1
  80. package/dist/esm/layers/raster-tile-layer.js +19 -34
  81. package/dist/esm/layers/raster-tile-layer.js.map +1 -1
  82. package/dist/esm/layers/schema/carto-raster-tile-loader.js +12 -4
  83. package/dist/esm/layers/schema/carto-raster-tile-loader.js.map +1 -1
  84. package/dist/esm/layers/schema/carto-spatial-tile-loader.js +13 -8
  85. package/dist/esm/layers/schema/carto-spatial-tile-loader.js.map +1 -1
  86. package/dist/esm/layers/schema/carto-tile.js +1 -1
  87. package/dist/esm/layers/schema/carto-tile.js.map +1 -1
  88. package/dist/esm/layers/schema/carto-vector-tile-loader.js +63 -4
  89. package/dist/esm/layers/schema/carto-vector-tile-loader.js.map +1 -1
  90. package/dist/esm/layers/utils.js +14 -0
  91. package/dist/esm/layers/utils.js.map +1 -0
  92. package/dist/esm/layers/{carto-tile-layer.js → vector-tile-layer.js} +39 -15
  93. package/dist/esm/layers/vector-tile-layer.js.map +1 -0
  94. package/dist/esm/sources/base-source.js +49 -0
  95. package/dist/esm/sources/base-source.js.map +1 -0
  96. package/dist/esm/sources/common.js +26 -0
  97. package/dist/esm/sources/common.js.map +1 -0
  98. package/dist/esm/sources/h3-query-source.js +32 -0
  99. package/dist/esm/sources/h3-query-source.js.map +1 -0
  100. package/dist/esm/sources/h3-table-source.js +32 -0
  101. package/dist/esm/sources/h3-table-source.js.map +1 -0
  102. package/dist/esm/sources/h3-tileset-source.js +14 -0
  103. package/dist/esm/sources/h3-tileset-source.js.map +1 -0
  104. package/dist/esm/sources/index.js +12 -0
  105. package/dist/esm/sources/index.js.map +1 -0
  106. package/dist/esm/sources/quadbin-query-source.js +32 -0
  107. package/dist/esm/sources/quadbin-query-source.js.map +1 -0
  108. package/dist/esm/sources/quadbin-table-source.js +32 -0
  109. package/dist/esm/sources/quadbin-table-source.js.map +1 -0
  110. package/dist/esm/sources/quadbin-tileset-source.js +14 -0
  111. package/dist/esm/sources/quadbin-tileset-source.js.map +1 -0
  112. package/dist/esm/sources/raster-source.js +14 -0
  113. package/dist/esm/sources/raster-source.js.map +1 -0
  114. package/dist/esm/sources/utils.js +69 -0
  115. package/dist/esm/sources/utils.js.map +1 -0
  116. package/dist/esm/sources/vector-query-source.js +25 -0
  117. package/dist/esm/sources/vector-query-source.js.map +1 -0
  118. package/dist/esm/sources/vector-table-source.js +25 -0
  119. package/dist/esm/sources/vector-table-source.js.map +1 -0
  120. package/dist/esm/sources/vector-tileset-source.js +14 -0
  121. package/dist/esm/sources/vector-tileset-source.js.map +1 -0
  122. package/dist/esm/utils.js +3 -0
  123. package/dist/esm/utils.js.map +1 -1
  124. package/dist/esm/workers/cartoRasterTile.js +4 -0
  125. package/dist/esm/workers/cartoRasterTile.js.map +1 -0
  126. package/dist/esm/workers/cartoSpatialTile.js +4 -0
  127. package/dist/esm/workers/cartoSpatialTile.js.map +1 -0
  128. package/dist/esm/workers/cartoVectorTile.js +4 -0
  129. package/dist/esm/workers/cartoVectorTile.js.map +1 -0
  130. package/dist.min.js +25 -25
  131. package/package.json +11 -9
  132. package/src/api/layer-map.ts +4 -8
  133. package/src/api/maps-api-common.ts +0 -1
  134. package/src/api/maps-v3-client.ts +6 -5
  135. package/src/index.ts +34 -5
  136. package/src/layers/h3-tile-layer.ts +22 -35
  137. package/src/layers/quadbin-tile-layer.ts +19 -33
  138. package/src/layers/raster-tile-layer.ts +22 -26
  139. package/src/layers/schema/carto-raster-tile-loader.ts +26 -6
  140. package/src/layers/schema/carto-spatial-tile-loader.ts +25 -11
  141. package/src/layers/schema/carto-tile.ts +1 -1
  142. package/src/layers/schema/carto-vector-tile-loader.ts +79 -9
  143. package/src/layers/utils.ts +11 -0
  144. package/src/layers/{carto-tile-layer.ts → vector-tile-layer.ts} +40 -21
  145. package/src/sources/base-source.ts +55 -0
  146. package/src/sources/common.ts +132 -0
  147. package/src/sources/h3-query-source.ts +45 -0
  148. package/src/sources/h3-table-source.ts +46 -0
  149. package/src/sources/h3-tileset-source.ts +16 -0
  150. package/src/sources/index.ts +32 -0
  151. package/src/sources/quadbin-query-source.ts +46 -0
  152. package/src/sources/quadbin-table-source.ts +46 -0
  153. package/src/sources/quadbin-tileset-source.ts +16 -0
  154. package/src/sources/raster-source.ts +16 -0
  155. package/src/sources/utils.ts +63 -0
  156. package/src/sources/vector-query-source.ts +23 -0
  157. package/src/sources/vector-table-source.ts +23 -0
  158. package/src/sources/vector-tileset-source.ts +16 -0
  159. package/src/utils.ts +6 -0
  160. package/src/workers/cartoRasterTile.ts +4 -0
  161. package/src/workers/cartoSpatialTile.ts +4 -0
  162. package/src/workers/cartoVectorTile.ts +4 -0
  163. package/typed/api/layer-map.d.ts +2 -3
  164. package/typed/api/layer-map.d.ts.map +1 -1
  165. package/typed/api/maps-api-common.d.ts +0 -1
  166. package/typed/api/maps-api-common.d.ts.map +1 -1
  167. package/typed/api/maps-v3-client.d.ts +0 -3
  168. package/typed/api/maps-v3-client.d.ts.map +1 -1
  169. package/typed/index.d.ts +6 -4
  170. package/typed/index.d.ts.map +1 -1
  171. package/typed/layers/h3-tile-layer.d.ts +5 -8
  172. package/typed/layers/h3-tile-layer.d.ts.map +1 -1
  173. package/typed/layers/quadbin-tile-layer.d.ts +5 -9
  174. package/typed/layers/quadbin-tile-layer.d.ts.map +1 -1
  175. package/typed/layers/raster-tile-layer.d.ts +6 -10
  176. package/typed/layers/raster-tile-layer.d.ts.map +1 -1
  177. package/typed/layers/schema/carto-raster-tile-loader.d.ts.map +1 -1
  178. package/typed/layers/schema/carto-spatial-tile-loader.d.ts.map +1 -1
  179. package/typed/layers/schema/carto-vector-tile-loader.d.ts.map +1 -1
  180. package/typed/layers/utils.d.ts +5 -0
  181. package/typed/layers/utils.d.ts.map +1 -0
  182. package/typed/layers/{carto-tile-layer.d.ts → vector-tile-layer.d.ts} +11 -7
  183. package/typed/layers/vector-tile-layer.d.ts.map +1 -0
  184. package/typed/sources/base-source.d.ts +4 -0
  185. package/typed/sources/base-source.d.ts.map +1 -0
  186. package/typed/sources/common.d.ts +116 -0
  187. package/typed/sources/common.d.ts.map +1 -0
  188. package/typed/sources/h3-query-source.d.ts +5 -0
  189. package/typed/sources/h3-query-source.d.ts.map +1 -0
  190. package/typed/sources/h3-table-source.d.ts +5 -0
  191. package/typed/sources/h3-table-source.d.ts.map +1 -0
  192. package/typed/sources/h3-tileset-source.d.ts +5 -0
  193. package/typed/sources/h3-tileset-source.d.ts.map +1 -0
  194. package/typed/sources/index.d.ts +23 -0
  195. package/typed/sources/index.d.ts.map +1 -0
  196. package/typed/sources/quadbin-query-source.d.ts +5 -0
  197. package/typed/sources/quadbin-query-source.d.ts.map +1 -0
  198. package/typed/sources/quadbin-table-source.d.ts +5 -0
  199. package/typed/sources/quadbin-table-source.d.ts.map +1 -0
  200. package/typed/sources/quadbin-tileset-source.d.ts +5 -0
  201. package/typed/sources/quadbin-tileset-source.d.ts.map +1 -0
  202. package/typed/sources/raster-source.d.ts +5 -0
  203. package/typed/sources/raster-source.d.ts.map +1 -0
  204. package/typed/sources/utils.d.ts +15 -0
  205. package/typed/sources/utils.d.ts.map +1 -0
  206. package/typed/sources/vector-query-source.d.ts +5 -0
  207. package/typed/sources/vector-query-source.d.ts.map +1 -0
  208. package/typed/sources/vector-table-source.d.ts +5 -0
  209. package/typed/sources/vector-table-source.d.ts.map +1 -0
  210. package/typed/sources/vector-tileset-source.d.ts +5 -0
  211. package/typed/sources/vector-tileset-source.d.ts.map +1 -0
  212. package/typed/utils.d.ts +1 -0
  213. package/typed/utils.d.ts.map +1 -1
  214. package/typed/workers/cartoRasterTile.d.ts +2 -0
  215. package/typed/workers/cartoRasterTile.d.ts.map +1 -0
  216. package/typed/workers/cartoSpatialTile.d.ts +2 -0
  217. package/typed/workers/cartoSpatialTile.d.ts.map +1 -0
  218. package/typed/workers/cartoVectorTile.d.ts +2 -0
  219. package/typed/workers/cartoVectorTile.d.ts.map +1 -0
  220. package/dist/es5/layers/carto-tile-layer.js.map +0 -1
  221. package/dist/esm/layers/carto-tile-layer.js.map +0 -1
  222. package/typed/api/index.js +0 -3
  223. package/typed/api/layer-map.js +0 -264
  224. package/typed/api/maps-api-common.js +0 -50
  225. package/typed/api/maps-client.js +0 -125
  226. package/typed/api/maps-v3-client.js +0 -304
  227. package/typed/api/parseMap.js +0 -178
  228. package/typed/basemap.js +0 -9
  229. package/typed/config.js +0 -35
  230. package/typed/index.js +0 -10
  231. package/typed/layers/carto-layer.js +0 -173
  232. package/typed/layers/carto-tile-layer.d.ts.map +0 -1
  233. package/typed/layers/carto-tile-layer.js +0 -105
  234. package/typed/layers/h3-tile-layer.js +0 -47
  235. package/typed/layers/h3-tileset-2d.js +0 -85
  236. package/typed/layers/quadkey-tile-layer.d.ts +0 -21
  237. package/typed/layers/quadkey-tile-layer.d.ts.map +0 -1
  238. package/typed/layers/quadkey-tile-layer.js +0 -42
  239. package/typed/layers/quadkey-tileset-2d.d.ts +0 -15
  240. package/typed/layers/quadkey-tileset-2d.d.ts.map +0 -1
  241. package/typed/layers/quadkey-tileset-2d.js +0 -36
  242. package/typed/layers/schema/carto-tile.js +0 -161
  243. package/typed/layers/spatial-index-tile-layer.js +0 -40
  244. package/typed/style/color-bins-style.js +0 -12
  245. package/typed/style/color-categories-style.js +0 -16
  246. package/typed/style/color-continuous-style.js +0 -12
  247. package/typed/style/palette.js +0 -62
  248. package/typed/style/utils.js +0 -15
  249. package/typed/utils.js +0 -4
package/dist/dist.dev.js CHANGED
@@ -3985,7 +3985,7 @@ var __exports__ = (() => {
3985
3985
  if (moment2.version === void 0 && moment2.default) {
3986
3986
  moment2 = moment2.default;
3987
3987
  }
3988
- var VERSION = "0.5.35", zones = {}, links = {}, countries = {}, names = {}, guesses = {}, cachedGuess;
3988
+ var VERSION4 = "0.5.35", zones = {}, links = {}, countries = {}, names = {}, guesses = {}, cachedGuess;
3989
3989
  if (!moment2 || typeof moment2.version !== "string") {
3990
3990
  logError("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
3991
3991
  }
@@ -4361,7 +4361,7 @@ var __exports__ = (() => {
4361
4361
  out.tz(name);
4362
4362
  return out;
4363
4363
  }
4364
- tz.version = VERSION;
4364
+ tz.version = VERSION4;
4365
4365
  tz.dataVersion = "";
4366
4366
  tz._zones = zones;
4367
4367
  tz._links = links;
@@ -5348,6 +5348,13 @@ var __exports__ = (() => {
5348
5348
  }
5349
5349
  });
5350
5350
 
5351
+ // external-global-plugin:h3-js
5352
+ var require_h3_js = __commonJS({
5353
+ "external-global-plugin:h3-js"(exports, module) {
5354
+ module.exports = globalThis.h3 || {};
5355
+ }
5356
+ });
5357
+
5351
5358
  // external-global-plugin:@loaders.gl/core
5352
5359
  var require_core2 = __commonJS({
5353
5360
  "external-global-plugin:@loaders.gl/core"(exports, module) {
@@ -6091,20 +6098,6 @@ var __exports__ = (() => {
6091
6098
  }
6092
6099
  });
6093
6100
 
6094
- // external-global-plugin:@deck.gl/extensions
6095
- var require_extensions = __commonJS({
6096
- "external-global-plugin:@deck.gl/extensions"(exports, module) {
6097
- module.exports = globalThis.deck;
6098
- }
6099
- });
6100
-
6101
- // external-global-plugin:h3-js
6102
- var require_h3_js = __commonJS({
6103
- "external-global-plugin:h3-js"(exports, module) {
6104
- module.exports = globalThis.h3 || {};
6105
- }
6106
- });
6107
-
6108
6101
  // ../../node_modules/tilebelt/index.js
6109
6102
  var require_tilebelt = __commonJS({
6110
6103
  "../../node_modules/tilebelt/index.js"(exports, module) {
@@ -6330,11 +6323,11 @@ var __exports__ = (() => {
6330
6323
  for (var i = 0; i < tiles2.length; i++) {
6331
6324
  var t = tiles2[i];
6332
6325
  if (t[0] % 2 === 0 && t[1] % 2 === 0) {
6333
- var id2 = toID(t[0] + 1, t[1], z), id3 = toID(t[0], t[1] + 1, z), id4 = toID(t[0] + 1, t[1] + 1, z);
6334
- if (tileHash[id2] && tileHash[id3] && tileHash[id4]) {
6326
+ var id22 = toID(t[0] + 1, t[1], z), id32 = toID(t[0], t[1] + 1, z), id4 = toID(t[0] + 1, t[1] + 1, z);
6327
+ if (tileHash[id22] && tileHash[id32] && tileHash[id4]) {
6335
6328
  tileHash[toID(t[0], t[1], t[2])] = false;
6336
- tileHash[id2] = false;
6337
- tileHash[id3] = false;
6329
+ tileHash[id22] = false;
6330
+ tileHash[id32] = false;
6338
6331
  tileHash[id4] = false;
6339
6332
  var parentTile = [t[0] / 2, t[1] / 2, z - 1];
6340
6333
  if (z - 1 === limits.min_zoom)
@@ -6372,8 +6365,8 @@ var __exports__ = (() => {
6372
6365
  for (i = 0; i < intersections.length; i += 2) {
6373
6366
  y = intersections[i][1];
6374
6367
  for (var x = intersections[i][0] + 1; x < intersections[i + 1][0]; x++) {
6375
- var id = toID(x, y, zoom);
6376
- if (!tileHash[id]) {
6368
+ var id4 = toID(x, y, zoom);
6369
+ if (!tileHash[id4]) {
6377
6370
  tileArray.push([x, y, zoom]);
6378
6371
  }
6379
6372
  }
@@ -6424,13 +6417,487 @@ var __exports__ = (() => {
6424
6417
  var dim = 2 * (1 << z);
6425
6418
  return (dim * y + x) * 32 + z;
6426
6419
  }
6427
- function fromID(id) {
6428
- var z = id % 32, dim = 2 * (1 << z), xy = (id - z) / 32, x = xy % dim, y = (xy - x) / dim % dim;
6420
+ function fromID(id4) {
6421
+ var z = id4 % 32, dim = 2 * (1 << z), xy = (id4 - z) / 32, x = xy % dim, y = (xy - x) / dim % dim;
6429
6422
  return [x, y, z];
6430
6423
  }
6431
6424
  }
6432
6425
  });
6433
6426
 
6427
+ // ../../node_modules/earcut/src/earcut.js
6428
+ var require_earcut = __commonJS({
6429
+ "../../node_modules/earcut/src/earcut.js"(exports, module) {
6430
+ "use strict";
6431
+ module.exports = earcut2;
6432
+ module.exports.default = earcut2;
6433
+ function earcut2(data, holeIndices, dim) {
6434
+ dim = dim || 2;
6435
+ var hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, true), triangles = [];
6436
+ if (!outerNode || outerNode.next === outerNode.prev)
6437
+ return triangles;
6438
+ var minX, minY, maxX, maxY, x, y, invSize;
6439
+ if (hasHoles)
6440
+ outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
6441
+ if (data.length > 80 * dim) {
6442
+ minX = maxX = data[0];
6443
+ minY = maxY = data[1];
6444
+ for (var i = dim; i < outerLen; i += dim) {
6445
+ x = data[i];
6446
+ y = data[i + 1];
6447
+ if (x < minX)
6448
+ minX = x;
6449
+ if (y < minY)
6450
+ minY = y;
6451
+ if (x > maxX)
6452
+ maxX = x;
6453
+ if (y > maxY)
6454
+ maxY = y;
6455
+ }
6456
+ invSize = Math.max(maxX - minX, maxY - minY);
6457
+ invSize = invSize !== 0 ? 1 / invSize : 0;
6458
+ }
6459
+ earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
6460
+ return triangles;
6461
+ }
6462
+ function linkedList(data, start, end, dim, clockwise) {
6463
+ var i, last;
6464
+ if (clockwise === signedArea(data, start, end, dim) > 0) {
6465
+ for (i = start; i < end; i += dim)
6466
+ last = insertNode(i, data[i], data[i + 1], last);
6467
+ } else {
6468
+ for (i = end - dim; i >= start; i -= dim)
6469
+ last = insertNode(i, data[i], data[i + 1], last);
6470
+ }
6471
+ if (last && equals(last, last.next)) {
6472
+ removeNode(last);
6473
+ last = last.next;
6474
+ }
6475
+ return last;
6476
+ }
6477
+ function filterPoints(start, end) {
6478
+ if (!start)
6479
+ return start;
6480
+ if (!end)
6481
+ end = start;
6482
+ var p = start, again;
6483
+ do {
6484
+ again = false;
6485
+ if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
6486
+ removeNode(p);
6487
+ p = end = p.prev;
6488
+ if (p === p.next)
6489
+ break;
6490
+ again = true;
6491
+ } else {
6492
+ p = p.next;
6493
+ }
6494
+ } while (again || p !== end);
6495
+ return end;
6496
+ }
6497
+ function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
6498
+ if (!ear)
6499
+ return;
6500
+ if (!pass && invSize)
6501
+ indexCurve(ear, minX, minY, invSize);
6502
+ var stop = ear, prev, next;
6503
+ while (ear.prev !== ear.next) {
6504
+ prev = ear.prev;
6505
+ next = ear.next;
6506
+ if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
6507
+ triangles.push(prev.i / dim);
6508
+ triangles.push(ear.i / dim);
6509
+ triangles.push(next.i / dim);
6510
+ removeNode(ear);
6511
+ ear = next.next;
6512
+ stop = next.next;
6513
+ continue;
6514
+ }
6515
+ ear = next;
6516
+ if (ear === stop) {
6517
+ if (!pass) {
6518
+ earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
6519
+ } else if (pass === 1) {
6520
+ ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
6521
+ earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
6522
+ } else if (pass === 2) {
6523
+ splitEarcut(ear, triangles, dim, minX, minY, invSize);
6524
+ }
6525
+ break;
6526
+ }
6527
+ }
6528
+ }
6529
+ function isEar(ear) {
6530
+ var a = ear.prev, b = ear, c = ear.next;
6531
+ if (area(a, b, c) >= 0)
6532
+ return false;
6533
+ var p = ear.next.next;
6534
+ while (p !== ear.prev) {
6535
+ if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0)
6536
+ return false;
6537
+ p = p.next;
6538
+ }
6539
+ return true;
6540
+ }
6541
+ function isEarHashed(ear, minX, minY, invSize) {
6542
+ var a = ear.prev, b = ear, c = ear.next;
6543
+ if (area(a, b, c) >= 0)
6544
+ return false;
6545
+ var minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x, minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y, maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x, maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y;
6546
+ var minZ = zOrder(minTX, minTY, minX, minY, invSize), maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
6547
+ var p = ear.prevZ, n = ear.nextZ;
6548
+ while (p && p.z >= minZ && n && n.z <= maxZ) {
6549
+ if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0)
6550
+ return false;
6551
+ p = p.prevZ;
6552
+ if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0)
6553
+ return false;
6554
+ n = n.nextZ;
6555
+ }
6556
+ while (p && p.z >= minZ) {
6557
+ if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0)
6558
+ return false;
6559
+ p = p.prevZ;
6560
+ }
6561
+ while (n && n.z <= maxZ) {
6562
+ if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0)
6563
+ return false;
6564
+ n = n.nextZ;
6565
+ }
6566
+ return true;
6567
+ }
6568
+ function cureLocalIntersections(start, triangles, dim) {
6569
+ var p = start;
6570
+ do {
6571
+ var a = p.prev, b = p.next.next;
6572
+ if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
6573
+ triangles.push(a.i / dim);
6574
+ triangles.push(p.i / dim);
6575
+ triangles.push(b.i / dim);
6576
+ removeNode(p);
6577
+ removeNode(p.next);
6578
+ p = start = b;
6579
+ }
6580
+ p = p.next;
6581
+ } while (p !== start);
6582
+ return filterPoints(p);
6583
+ }
6584
+ function splitEarcut(start, triangles, dim, minX, minY, invSize) {
6585
+ var a = start;
6586
+ do {
6587
+ var b = a.next.next;
6588
+ while (b !== a.prev) {
6589
+ if (a.i !== b.i && isValidDiagonal(a, b)) {
6590
+ var c = splitPolygon(a, b);
6591
+ a = filterPoints(a, a.next);
6592
+ c = filterPoints(c, c.next);
6593
+ earcutLinked(a, triangles, dim, minX, minY, invSize);
6594
+ earcutLinked(c, triangles, dim, minX, minY, invSize);
6595
+ return;
6596
+ }
6597
+ b = b.next;
6598
+ }
6599
+ a = a.next;
6600
+ } while (a !== start);
6601
+ }
6602
+ function eliminateHoles(data, holeIndices, outerNode, dim) {
6603
+ var queue = [], i, len, start, end, list;
6604
+ for (i = 0, len = holeIndices.length; i < len; i++) {
6605
+ start = holeIndices[i] * dim;
6606
+ end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
6607
+ list = linkedList(data, start, end, dim, false);
6608
+ if (list === list.next)
6609
+ list.steiner = true;
6610
+ queue.push(getLeftmost(list));
6611
+ }
6612
+ queue.sort(compareX);
6613
+ for (i = 0; i < queue.length; i++) {
6614
+ eliminateHole(queue[i], outerNode);
6615
+ outerNode = filterPoints(outerNode, outerNode.next);
6616
+ }
6617
+ return outerNode;
6618
+ }
6619
+ function compareX(a, b) {
6620
+ return a.x - b.x;
6621
+ }
6622
+ function eliminateHole(hole, outerNode) {
6623
+ outerNode = findHoleBridge(hole, outerNode);
6624
+ if (outerNode) {
6625
+ var b = splitPolygon(outerNode, hole);
6626
+ filterPoints(b, b.next);
6627
+ }
6628
+ }
6629
+ function findHoleBridge(hole, outerNode) {
6630
+ var p = outerNode, hx = hole.x, hy = hole.y, qx = -Infinity, m;
6631
+ do {
6632
+ if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
6633
+ var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
6634
+ if (x <= hx && x > qx) {
6635
+ qx = x;
6636
+ if (x === hx) {
6637
+ if (hy === p.y)
6638
+ return p;
6639
+ if (hy === p.next.y)
6640
+ return p.next;
6641
+ }
6642
+ m = p.x < p.next.x ? p : p.next;
6643
+ }
6644
+ }
6645
+ p = p.next;
6646
+ } while (p !== outerNode);
6647
+ if (!m)
6648
+ return null;
6649
+ if (hx === qx)
6650
+ return m;
6651
+ var stop = m, mx = m.x, my = m.y, tanMin = Infinity, tan;
6652
+ p = m;
6653
+ do {
6654
+ if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
6655
+ tan = Math.abs(hy - p.y) / (hx - p.x);
6656
+ if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
6657
+ m = p;
6658
+ tanMin = tan;
6659
+ }
6660
+ }
6661
+ p = p.next;
6662
+ } while (p !== stop);
6663
+ return m;
6664
+ }
6665
+ function sectorContainsSector(m, p) {
6666
+ return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
6667
+ }
6668
+ function indexCurve(start, minX, minY, invSize) {
6669
+ var p = start;
6670
+ do {
6671
+ if (p.z === null)
6672
+ p.z = zOrder(p.x, p.y, minX, minY, invSize);
6673
+ p.prevZ = p.prev;
6674
+ p.nextZ = p.next;
6675
+ p = p.next;
6676
+ } while (p !== start);
6677
+ p.prevZ.nextZ = null;
6678
+ p.prevZ = null;
6679
+ sortLinked(p);
6680
+ }
6681
+ function sortLinked(list) {
6682
+ var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;
6683
+ do {
6684
+ p = list;
6685
+ list = null;
6686
+ tail = null;
6687
+ numMerges = 0;
6688
+ while (p) {
6689
+ numMerges++;
6690
+ q = p;
6691
+ pSize = 0;
6692
+ for (i = 0; i < inSize; i++) {
6693
+ pSize++;
6694
+ q = q.nextZ;
6695
+ if (!q)
6696
+ break;
6697
+ }
6698
+ qSize = inSize;
6699
+ while (pSize > 0 || qSize > 0 && q) {
6700
+ if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
6701
+ e = p;
6702
+ p = p.nextZ;
6703
+ pSize--;
6704
+ } else {
6705
+ e = q;
6706
+ q = q.nextZ;
6707
+ qSize--;
6708
+ }
6709
+ if (tail)
6710
+ tail.nextZ = e;
6711
+ else
6712
+ list = e;
6713
+ e.prevZ = tail;
6714
+ tail = e;
6715
+ }
6716
+ p = q;
6717
+ }
6718
+ tail.nextZ = null;
6719
+ inSize *= 2;
6720
+ } while (numMerges > 1);
6721
+ return list;
6722
+ }
6723
+ function zOrder(x, y, minX, minY, invSize) {
6724
+ x = 32767 * (x - minX) * invSize;
6725
+ y = 32767 * (y - minY) * invSize;
6726
+ x = (x | x << 8) & 16711935;
6727
+ x = (x | x << 4) & 252645135;
6728
+ x = (x | x << 2) & 858993459;
6729
+ x = (x | x << 1) & 1431655765;
6730
+ y = (y | y << 8) & 16711935;
6731
+ y = (y | y << 4) & 252645135;
6732
+ y = (y | y << 2) & 858993459;
6733
+ y = (y | y << 1) & 1431655765;
6734
+ return x | y << 1;
6735
+ }
6736
+ function getLeftmost(start) {
6737
+ var p = start, leftmost = start;
6738
+ do {
6739
+ if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y)
6740
+ leftmost = p;
6741
+ p = p.next;
6742
+ } while (p !== start);
6743
+ return leftmost;
6744
+ }
6745
+ function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
6746
+ return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
6747
+ }
6748
+ function isValidDiagonal(a, b) {
6749
+ return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (area(a.prev, a, b.prev) || area(a, b.prev, b)) || equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
6750
+ }
6751
+ function area(p, q, r) {
6752
+ return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
6753
+ }
6754
+ function equals(p1, p2) {
6755
+ return p1.x === p2.x && p1.y === p2.y;
6756
+ }
6757
+ function intersects(p1, q1, p2, q2) {
6758
+ var o1 = sign(area(p1, q1, p2));
6759
+ var o2 = sign(area(p1, q1, q2));
6760
+ var o3 = sign(area(p2, q2, p1));
6761
+ var o4 = sign(area(p2, q2, q1));
6762
+ if (o1 !== o2 && o3 !== o4)
6763
+ return true;
6764
+ if (o1 === 0 && onSegment(p1, p2, q1))
6765
+ return true;
6766
+ if (o2 === 0 && onSegment(p1, q2, q1))
6767
+ return true;
6768
+ if (o3 === 0 && onSegment(p2, p1, q2))
6769
+ return true;
6770
+ if (o4 === 0 && onSegment(p2, q1, q2))
6771
+ return true;
6772
+ return false;
6773
+ }
6774
+ function onSegment(p, q, r) {
6775
+ return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
6776
+ }
6777
+ function sign(num) {
6778
+ return num > 0 ? 1 : num < 0 ? -1 : 0;
6779
+ }
6780
+ function intersectsPolygon(a, b) {
6781
+ var p = a;
6782
+ do {
6783
+ if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b))
6784
+ return true;
6785
+ p = p.next;
6786
+ } while (p !== a);
6787
+ return false;
6788
+ }
6789
+ function locallyInside(a, b) {
6790
+ return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
6791
+ }
6792
+ function middleInside(a, b) {
6793
+ var p = a, inside = false, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;
6794
+ do {
6795
+ if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)
6796
+ inside = !inside;
6797
+ p = p.next;
6798
+ } while (p !== a);
6799
+ return inside;
6800
+ }
6801
+ function splitPolygon(a, b) {
6802
+ var a2 = new Node(a.i, a.x, a.y), b2 = new Node(b.i, b.x, b.y), an = a.next, bp = b.prev;
6803
+ a.next = b;
6804
+ b.prev = a;
6805
+ a2.next = an;
6806
+ an.prev = a2;
6807
+ b2.next = a2;
6808
+ a2.prev = b2;
6809
+ bp.next = b2;
6810
+ b2.prev = bp;
6811
+ return b2;
6812
+ }
6813
+ function insertNode(i, x, y, last) {
6814
+ var p = new Node(i, x, y);
6815
+ if (!last) {
6816
+ p.prev = p;
6817
+ p.next = p;
6818
+ } else {
6819
+ p.next = last.next;
6820
+ p.prev = last;
6821
+ last.next.prev = p;
6822
+ last.next = p;
6823
+ }
6824
+ return p;
6825
+ }
6826
+ function removeNode(p) {
6827
+ p.next.prev = p.prev;
6828
+ p.prev.next = p.next;
6829
+ if (p.prevZ)
6830
+ p.prevZ.nextZ = p.nextZ;
6831
+ if (p.nextZ)
6832
+ p.nextZ.prevZ = p.prevZ;
6833
+ }
6834
+ function Node(i, x, y) {
6835
+ this.i = i;
6836
+ this.x = x;
6837
+ this.y = y;
6838
+ this.prev = null;
6839
+ this.next = null;
6840
+ this.z = null;
6841
+ this.prevZ = null;
6842
+ this.nextZ = null;
6843
+ this.steiner = false;
6844
+ }
6845
+ earcut2.deviation = function(data, holeIndices, dim, triangles) {
6846
+ var hasHoles = holeIndices && holeIndices.length;
6847
+ var outerLen = hasHoles ? holeIndices[0] * dim : data.length;
6848
+ var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
6849
+ if (hasHoles) {
6850
+ for (var i = 0, len = holeIndices.length; i < len; i++) {
6851
+ var start = holeIndices[i] * dim;
6852
+ var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
6853
+ polygonArea -= Math.abs(signedArea(data, start, end, dim));
6854
+ }
6855
+ }
6856
+ var trianglesArea = 0;
6857
+ for (i = 0; i < triangles.length; i += 3) {
6858
+ var a = triangles[i] * dim;
6859
+ var b = triangles[i + 1] * dim;
6860
+ var c = triangles[i + 2] * dim;
6861
+ trianglesArea += Math.abs((data[a] - data[c]) * (data[b + 1] - data[a + 1]) - (data[a] - data[b]) * (data[c + 1] - data[a + 1]));
6862
+ }
6863
+ return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea);
6864
+ };
6865
+ function signedArea(data, start, end, dim) {
6866
+ var sum = 0;
6867
+ for (var i = start, j = end - dim; i < end; i += dim) {
6868
+ sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
6869
+ j = i;
6870
+ }
6871
+ return sum;
6872
+ }
6873
+ earcut2.flatten = function(data) {
6874
+ var dim = data[0][0].length, result = {
6875
+ vertices: [],
6876
+ holes: [],
6877
+ dimensions: dim
6878
+ }, holeIndex = 0;
6879
+ for (var i = 0; i < data.length; i++) {
6880
+ for (var j = 0; j < data[i].length; j++) {
6881
+ for (var d = 0; d < dim; d++)
6882
+ result.vertices.push(data[i][j][d]);
6883
+ }
6884
+ if (i > 0) {
6885
+ holeIndex += data[i - 1].length;
6886
+ result.holes.push(holeIndex);
6887
+ }
6888
+ }
6889
+ return result;
6890
+ };
6891
+ }
6892
+ });
6893
+
6894
+ // external-global-plugin:@deck.gl/extensions
6895
+ var require_extensions = __commonJS({
6896
+ "external-global-plugin:@deck.gl/extensions"(exports, module) {
6897
+ module.exports = globalThis.deck;
6898
+ }
6899
+ });
6900
+
6434
6901
  // ../../node_modules/colorbrewer/colorbrewer.js
6435
6902
  var require_colorbrewer = __commonJS({
6436
6903
  "../../node_modules/colorbrewer/colorbrewer.js"(exports, module) {
@@ -8652,15 +9119,26 @@ var __exports__ = (() => {
8652
9119
  CartoAPIError: () => CartoAPIError,
8653
9120
  CartoLayer: () => CartoLayer,
8654
9121
  FORMATS: () => FORMATS,
9122
+ H3TileLayer: () => H3TileLayer,
8655
9123
  MAP_TYPES: () => MAP_TYPES,
9124
+ QuadbinTileLayer: () => QuadbinTileLayer,
9125
+ RasterTileLayer: () => RasterTileLayer,
9126
+ SOURCE_DEFAULTS: () => SOURCE_DEFAULTS,
8656
9127
  TILE_FORMATS: () => TILE_FORMATS,
8657
- _CartoTileLayer: () => CartoTileLayer,
8658
- _H3TileLayer: () => H3TileLayer,
9128
+ VectorTileLayer: () => VectorTileLayer,
8659
9129
  _PointLabelLayer: () => PointLabelLayer,
8660
- _QuadbinTileLayer: () => QuadbinTileLayer,
8661
- _RasterTileLayer: () => RasterTileLayer,
8662
9130
  _getDataV2: () => getDataV2,
8663
9131
  _mapInstantiation: () => mapInstantiation,
9132
+ cartoH3QuerySource: () => cartoH3QuerySource,
9133
+ cartoH3TableSource: () => cartoH3TableSource,
9134
+ cartoH3TilesetSource: () => cartoH3TilesetSource,
9135
+ cartoQuadbinQuerySource: () => cartoQuadbinQuerySource,
9136
+ cartoQuadbinTableSource: () => cartoQuadbinTableSource,
9137
+ cartoQuadbinTilesetSource: () => cartoQuadbinTilesetSource,
9138
+ cartoRasterSource: () => cartoRasterSource,
9139
+ cartoVectorQuerySource: () => cartoVectorQuerySource,
9140
+ cartoVectorTableSource: () => cartoVectorTableSource,
9141
+ cartoVectorTilesetSource: () => cartoVectorTilesetSource,
8664
9142
  colorBins: () => colorBins,
8665
9143
  colorCategories: () => colorCategories,
8666
9144
  colorContinuous: () => colorContinuous,
@@ -8692,7 +9170,6 @@ var __exports__ = (() => {
8692
9170
  var GEO_COLUMN_SUPPORT = [MAP_TYPES.QUERY, MAP_TYPES.TABLE];
8693
9171
  var FORMATS = {
8694
9172
  GEOJSON: "geojson",
8695
- NDJSON: "ndjson",
8696
9173
  TILEJSON: "tilejson",
8697
9174
  JSON: "json"
8698
9175
  };
@@ -11466,8 +11943,118 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
11466
11943
  var import_layers3 = __toESM(require_layers());
11467
11944
  var import_geo_layers7 = __toESM(require_geo_layers());
11468
11945
 
11469
- // src/layers/carto-tile-layer.ts
11470
- var import_core = __toESM(require_core2());
11946
+ // src/layers/h3-tile-layer.ts
11947
+ var import_core3 = __toESM(require_core());
11948
+ var import_geo_layers3 = __toESM(require_geo_layers());
11949
+
11950
+ // src/layers/h3-tileset-2d.ts
11951
+ var import_geo_layers = __toESM(require_geo_layers());
11952
+ var import_h3_js = __toESM(require_h3_js());
11953
+ function getHexagonsInBoundingBox({
11954
+ west,
11955
+ north,
11956
+ east,
11957
+ south
11958
+ }, resolution) {
11959
+ const longitudeSpan = Math.abs(east - west);
11960
+ if (longitudeSpan > 180) {
11961
+ const nSegments = Math.ceil(longitudeSpan / 180);
11962
+ let h3Indices2 = [];
11963
+ for (let s = 0; s < nSegments; s++) {
11964
+ const segmentEast = east + s * 180;
11965
+ const segmentWest = Math.min(segmentEast + 179.9999999, west);
11966
+ h3Indices2 = h3Indices2.concat(getHexagonsInBoundingBox({
11967
+ west: segmentWest,
11968
+ north,
11969
+ east: segmentEast,
11970
+ south
11971
+ }, resolution));
11972
+ }
11973
+ return [...new Set(h3Indices2)];
11974
+ }
11975
+ const oversample = 2;
11976
+ const h3Indices = (0, import_h3_js.polygonToCells)([[[west, north], [west, south], [east, south], [east, north], [west, north]]], resolution + oversample, true);
11977
+ return oversample ? [...new Set(h3Indices.map((i) => (0, import_h3_js.cellToParent)(i, resolution)))] : h3Indices;
11978
+ }
11979
+ function tileToBoundingBox(index) {
11980
+ const coordinates = (0, import_h3_js.cellToBoundary)(index);
11981
+ const latitudes = coordinates.map((c) => c[0]);
11982
+ const longitudes = coordinates.map((c) => c[1]);
11983
+ const west = Math.min(...longitudes);
11984
+ const south = Math.min(...latitudes);
11985
+ const east = Math.max(...longitudes);
11986
+ const north = Math.max(...latitudes);
11987
+ return {
11988
+ west,
11989
+ south,
11990
+ east,
11991
+ north
11992
+ };
11993
+ }
11994
+ var BIAS = 2;
11995
+ function getHexagonResolution(viewport) {
11996
+ const hexagonScaleFactor = 2 / 3 * viewport.zoom;
11997
+ const latitudeScaleFactor = Math.log(1 / Math.cos(Math.PI * viewport.latitude / 180));
11998
+ return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
11999
+ }
12000
+ var H3Tileset2D = class extends import_geo_layers._Tileset2D {
12001
+ getTileIndices({
12002
+ viewport,
12003
+ minZoom,
12004
+ maxZoom
12005
+ }) {
12006
+ if (viewport.latitude === void 0)
12007
+ return [];
12008
+ const [east, south, west, north] = viewport.getBounds();
12009
+ let z = getHexagonResolution(viewport);
12010
+ let indices;
12011
+ if (typeof minZoom === "number" && Number.isFinite(minZoom) && z < minZoom) {
12012
+ return [];
12013
+ }
12014
+ if (typeof maxZoom === "number" && Number.isFinite(maxZoom) && z > maxZoom) {
12015
+ z = maxZoom;
12016
+ const center = (0, import_h3_js.latLngToCell)(viewport.latitude, viewport.longitude, maxZoom);
12017
+ indices = (0, import_h3_js.gridDisk)(center, 1);
12018
+ } else {
12019
+ indices = getHexagonsInBoundingBox({
12020
+ west,
12021
+ north,
12022
+ east,
12023
+ south
12024
+ }, z);
12025
+ }
12026
+ return indices.map((i) => ({
12027
+ i
12028
+ }));
12029
+ }
12030
+ getTileId({
12031
+ i
12032
+ }) {
12033
+ return i;
12034
+ }
12035
+ getTileMetadata({
12036
+ i
12037
+ }) {
12038
+ return {
12039
+ bbox: tileToBoundingBox(i)
12040
+ };
12041
+ }
12042
+ getTileZoom({
12043
+ i
12044
+ }) {
12045
+ return (0, import_h3_js.getResolution)(i);
12046
+ }
12047
+ getParentIndex(index) {
12048
+ const resolution = (0, import_h3_js.getResolution)(index.i);
12049
+ const i = (0, import_h3_js.cellToParent)(index.i, resolution - 1);
12050
+ return {
12051
+ i
12052
+ };
12053
+ }
12054
+ };
12055
+
12056
+ // src/layers/spatial-index-tile-layer.ts
12057
+ var import_core2 = __toESM(require_core2());
11471
12058
 
11472
12059
  // src/layers/schema/fast-pbf.ts
11473
12060
  function readPackedTypedArray(TypedArray, pbf, obj) {
@@ -11477,27 +12064,164 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
11477
12064
  return obj.value;
11478
12065
  }
11479
12066
 
11480
- // src/layers/schema/carto-tile.ts
11481
- var KeyValueObjectReader = class {
12067
+ // src/layers/schema/carto-raster-tile.ts
12068
+ var ARRAY_TYPES = {
12069
+ uint8: Uint8Array,
12070
+ uint16: Uint16Array,
12071
+ uint32: Uint32Array,
12072
+ uint64: BigUint64Array,
12073
+ int8: Int8Array,
12074
+ int16: Int16Array,
12075
+ int32: Int32Array,
12076
+ int64: BigInt64Array,
12077
+ float32: Float32Array,
12078
+ float64: Float64Array
12079
+ };
12080
+ var BandReader = class {
11482
12081
  static read(pbf, end) {
11483
- return pbf.readFields(KeyValueObjectReader._readField, {
11484
- key: "",
11485
- value: ""
12082
+ return pbf.readFields(BandReader._readField, {
12083
+ name: "",
12084
+ type: "",
12085
+ data: null
11486
12086
  }, end);
11487
12087
  }
11488
12088
  static _readField(tag, obj, pbf) {
11489
12089
  if (tag === 1)
11490
- obj.key = pbf.readString();
12090
+ obj.name = pbf.readString();
11491
12091
  else if (tag === 2)
11492
- obj.value = pbf.readString();
11493
- }
11494
- };
11495
- var PropertiesReader = class {
11496
- static read(pbf, end) {
11497
- return pbf.readFields(PropertiesReader._readField, {}, end);
11498
- }
11499
- static _readField(tag, obj, pbf) {
11500
- if (tag === 1) {
12092
+ obj.type = pbf.readString();
12093
+ else if (tag === 3) {
12094
+ const TypedArray = ARRAY_TYPES[obj.type];
12095
+ if (!TypedArray) {
12096
+ throw Error(`Invalid data type: ${obj.type}`);
12097
+ }
12098
+ obj.data = {};
12099
+ readPackedTypedArray(TypedArray, pbf, obj.data);
12100
+ }
12101
+ }
12102
+ };
12103
+ var TileReader = class {
12104
+ static read(pbf, end) {
12105
+ return pbf.readFields(TileReader._readField, {
12106
+ blockWidth: 0,
12107
+ blockHeight: 0,
12108
+ bands: []
12109
+ }, end);
12110
+ }
12111
+ static _readField(tag, obj, pbf) {
12112
+ if (tag === 1)
12113
+ obj.blockWidth = pbf.readVarint();
12114
+ else if (tag === 2)
12115
+ obj.blockHeight = pbf.readVarint();
12116
+ else if (tag === 3)
12117
+ obj.bands.push(BandReader.read(pbf, pbf.readVarint() + pbf.pos));
12118
+ }
12119
+ };
12120
+
12121
+ // src/layers/schema/tile-loader-utils.ts
12122
+ var import_pbf = __toESM(require_pbf());
12123
+ function parsePbf(buffer, TileReader4) {
12124
+ const pbf = new import_pbf.default(buffer);
12125
+ const tile = TileReader4.read(pbf);
12126
+ return tile;
12127
+ }
12128
+
12129
+ // src/utils.ts
12130
+ var import_core = __toESM(require_core());
12131
+ function assert(condition, message) {
12132
+ import_core.log.assert(condition, message);
12133
+ }
12134
+ function createBinaryProxy(data, index) {
12135
+ const {
12136
+ properties,
12137
+ numericProps
12138
+ } = data;
12139
+ return new Proxy(properties[index] || {}, {
12140
+ get(target, property, receiver) {
12141
+ if (property in numericProps) {
12142
+ return numericProps[property].value[index];
12143
+ }
12144
+ return target[property];
12145
+ },
12146
+ has(target, property) {
12147
+ return property in numericProps || property in target;
12148
+ }
12149
+ });
12150
+ }
12151
+ function getWorkerUrl(id4, version) {
12152
+ return `https://unpkg.com/@deck.gl/carto@${version}/dist/${id4}-worker.js`;
12153
+ }
12154
+
12155
+ // src/layers/schema/carto-raster-tile-loader.ts
12156
+ var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
12157
+ var id = "cartoRasterTile";
12158
+ var DEFAULT_OPTIONS = {
12159
+ cartoRasterTile: {
12160
+ workerUrl: getWorkerUrl(id, VERSION)
12161
+ }
12162
+ };
12163
+ var CartoRasterTileLoader = {
12164
+ name: "CARTO Raster Tile",
12165
+ version: VERSION,
12166
+ id,
12167
+ module: "carto",
12168
+ extensions: ["pbf"],
12169
+ mimeTypes: ["application/vnd.carto-raster-tile"],
12170
+ category: "geometry",
12171
+ parse: async (arrayBuffer, options) => parseCartoRasterTile(arrayBuffer, options),
12172
+ parseSync: parseCartoRasterTile,
12173
+ worker: true,
12174
+ options: DEFAULT_OPTIONS
12175
+ };
12176
+ function parseCartoRasterTile(arrayBuffer, options) {
12177
+ if (!arrayBuffer)
12178
+ return null;
12179
+ const tile = parsePbf(arrayBuffer, TileReader);
12180
+ const {
12181
+ bands,
12182
+ blockHeight,
12183
+ blockWidth
12184
+ } = tile;
12185
+ const numericProps = {};
12186
+ for (let i = 0; i < bands.length; i++) {
12187
+ const {
12188
+ name,
12189
+ data
12190
+ } = bands[i];
12191
+ numericProps[name] = data;
12192
+ }
12193
+ return {
12194
+ blockWidth,
12195
+ blockHeight,
12196
+ cells: {
12197
+ numericProps,
12198
+ properties: []
12199
+ }
12200
+ };
12201
+ }
12202
+ var carto_raster_tile_loader_default = CartoRasterTileLoader;
12203
+
12204
+ // src/layers/schema/carto-tile.ts
12205
+ var KeyValueObjectReader = class {
12206
+ static read(pbf, end) {
12207
+ return pbf.readFields(KeyValueObjectReader._readField, {
12208
+ key: "",
12209
+ value: null
12210
+ }, end);
12211
+ }
12212
+ static _readField(tag, obj, pbf) {
12213
+ if (tag === 1)
12214
+ obj.key = pbf.readString();
12215
+ else if (tag === 2)
12216
+ obj.value = pbf.readString();
12217
+ }
12218
+ };
12219
+ var PropertiesReader = class {
12220
+ static read(pbf, end) {
12221
+ return pbf.readFields(PropertiesReader._readField, {}, end);
12222
+ }
12223
+ static _readField(tag, obj, pbf) {
12224
+ if (tag === 1) {
11501
12225
  const {
11502
12226
  key,
11503
12227
  value
@@ -11677,9 +12401,9 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
11677
12401
  obj.fields.push(FieldsReader.read(pbf, pbf.readVarint() + pbf.pos));
11678
12402
  }
11679
12403
  };
11680
- var TileReader = class {
12404
+ var TileReader2 = class {
11681
12405
  static read(pbf, end) {
11682
- return pbf.readFields(TileReader._readField, {
12406
+ return pbf.readFields(TileReader2._readField, {
11683
12407
  points: null,
11684
12408
  lines: null,
11685
12409
  polygons: null
@@ -11695,606 +12419,72 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
11695
12419
  }
11696
12420
  };
11697
12421
 
11698
- // src/layers/schema/tile-loader-utils.ts
11699
- var import_pbf = __toESM(require_pbf());
11700
- function parsePbf(buffer, TileReader4) {
11701
- const pbf = new import_pbf.default(buffer);
11702
- const tile = TileReader4.read(pbf);
11703
- return tile;
11704
- }
11705
-
11706
- // src/layers/schema/carto-vector-tile-loader.ts
11707
- var CartoVectorTileLoader = {
11708
- name: "CARTO Vector Tile",
11709
- version: "1",
11710
- id: "cartoVectorTile",
11711
- module: "carto",
11712
- extensions: ["pbf"],
11713
- mimeTypes: ["application/vnd.carto-vector-tile"],
11714
- category: "geometry",
11715
- worker: false,
11716
- parse: async (arrayBuffer, options) => parseCartoVectorTile(arrayBuffer, options),
11717
- parseSync: parseCartoVectorTile,
11718
- options: {}
12422
+ // src/layers/schema/carto-spatial-tile.ts
12423
+ var IndicesReader = class {
12424
+ static read(pbf, end) {
12425
+ return pbf.readFields(IndicesReader._readField, {
12426
+ value: []
12427
+ }, end);
12428
+ }
12429
+ static _readField(tag, obj, pbf) {
12430
+ if (tag === 1)
12431
+ readPackedTypedArray(BigUint64Array, pbf, obj);
12432
+ }
11719
12433
  };
11720
- function parseCartoVectorTile(arrayBuffer, options) {
11721
- if (!arrayBuffer)
11722
- return null;
11723
- const tile = parsePbf(arrayBuffer, TileReader);
11724
- return tile;
11725
- }
11726
- var carto_vector_tile_loader_default = CartoVectorTileLoader;
11727
-
11728
- // src/layers/carto-tile-layer.ts
11729
- var import_extensions = __toESM(require_extensions());
11730
- var import_geo_layers = __toESM(require_geo_layers());
11731
- var import_layers = __toESM(require_layers());
11732
-
11733
- // ../../node_modules/@loaders.gl/gis/dist/esm/lib/binary-to-geojson.js
11734
- function binaryToGeojson(data, options) {
11735
- const globalFeatureId = options === null || options === void 0 ? void 0 : options.globalFeatureId;
11736
- if (globalFeatureId !== void 0) {
11737
- return getSingleFeature(data, globalFeatureId);
12434
+ var CellsReader = class {
12435
+ static read(pbf, end) {
12436
+ return pbf.readFields(CellsReader._readField, {
12437
+ indices: null,
12438
+ properties: [],
12439
+ numericProps: {}
12440
+ }, end);
11738
12441
  }
11739
- return parseFeatures(data, options === null || options === void 0 ? void 0 : options.type);
11740
- }
11741
- function getSingleFeature(data, globalFeatureId) {
11742
- const dataArray = normalizeInput(data);
11743
- for (const data2 of dataArray) {
11744
- let lastIndex = 0;
11745
- let lastValue = data2.featureIds.value[0];
11746
- for (let i = 0; i < data2.featureIds.value.length; i++) {
11747
- const currValue = data2.featureIds.value[i];
11748
- if (currValue === lastValue) {
11749
- continue;
11750
- }
11751
- if (globalFeatureId === data2.globalFeatureIds.value[lastIndex]) {
11752
- return parseFeature(data2, lastIndex, i);
11753
- }
11754
- lastIndex = i;
11755
- lastValue = currValue;
11756
- }
11757
- if (globalFeatureId === data2.globalFeatureIds.value[lastIndex]) {
11758
- return parseFeature(data2, lastIndex, data2.featureIds.value.length);
12442
+ static _readField(tag, obj, pbf) {
12443
+ if (tag === 1)
12444
+ obj.indices = IndicesReader.read(pbf, pbf.readVarint() + pbf.pos);
12445
+ else if (tag === 2)
12446
+ obj.properties.push(PropertiesReader.read(pbf, pbf.readVarint() + pbf.pos));
12447
+ else if (tag === 3) {
12448
+ const entry = NumericPropKeyValueReader.read(pbf, pbf.readVarint() + pbf.pos);
12449
+ obj.numericProps[entry.key] = entry.value;
11759
12450
  }
11760
12451
  }
11761
- throw new Error("featureId:".concat(globalFeatureId, " not found"));
12452
+ };
12453
+ var TileReader3 = class {
12454
+ static read(pbf, end) {
12455
+ return pbf.readFields(TileReader3._readField, {
12456
+ scheme: 0,
12457
+ cells: null
12458
+ }, end);
12459
+ }
12460
+ static _readField(tag, obj, pbf) {
12461
+ if (tag === 1)
12462
+ obj.scheme = pbf.readVarint();
12463
+ else if (tag === 2)
12464
+ obj.cells = CellsReader.read(pbf, pbf.readVarint() + pbf.pos);
12465
+ }
12466
+ };
12467
+
12468
+ // ../../node_modules/quadbin/dist/esm/index.js
12469
+ var import_tile_cover = __toESM(require_tile_cover());
12470
+ var B = [
12471
+ 0x5555555555555555n,
12472
+ 0x3333333333333333n,
12473
+ 0x0f0f0f0f0f0f0f0fn,
12474
+ 0x00ff00ff00ff00ffn,
12475
+ 0x0000ffff0000ffffn,
12476
+ 0x00000000ffffffffn
12477
+ ];
12478
+ var S = [0n, 1n, 2n, 4n, 8n, 16n];
12479
+ function hexToBigInt(hex2) {
12480
+ return BigInt(`0x${hex2}`);
11762
12481
  }
11763
- function parseFeatures(data, type) {
11764
- const dataArray = normalizeInput(data, type);
11765
- return parseFeatureCollection(dataArray);
12482
+ function bigIntToHex(index) {
12483
+ return index.toString(16);
11766
12484
  }
11767
- function binaryToGeometry(data, startIndex, endIndex) {
11768
- switch (data.type) {
11769
- case "Point":
11770
- return pointToGeoJson(data, startIndex, endIndex);
11771
- case "LineString":
11772
- return lineStringToGeoJson(data, startIndex, endIndex);
11773
- case "Polygon":
11774
- return polygonToGeoJson(data, startIndex, endIndex);
11775
- default:
11776
- const unexpectedInput = data;
11777
- throw new Error("Unsupported geometry type: ".concat(unexpectedInput === null || unexpectedInput === void 0 ? void 0 : unexpectedInput.type));
11778
- }
11779
- }
11780
- function normalizeInput(data, type) {
11781
- const isHeterogeneousType = Boolean(data.points || data.lines || data.polygons);
11782
- if (!isHeterogeneousType) {
11783
- data.type = type || parseType(data);
11784
- return [data];
11785
- }
11786
- const features = [];
11787
- if (data.points) {
11788
- data.points.type = "Point";
11789
- features.push(data.points);
11790
- }
11791
- if (data.lines) {
11792
- data.lines.type = "LineString";
11793
- features.push(data.lines);
11794
- }
11795
- if (data.polygons) {
11796
- data.polygons.type = "Polygon";
11797
- features.push(data.polygons);
11798
- }
11799
- return features;
11800
- }
11801
- function parseFeatureCollection(dataArray) {
11802
- const features = [];
11803
- for (const data of dataArray) {
11804
- if (data.featureIds.value.length === 0) {
11805
- continue;
11806
- }
11807
- let lastIndex = 0;
11808
- let lastValue = data.featureIds.value[0];
11809
- for (let i = 0; i < data.featureIds.value.length; i++) {
11810
- const currValue = data.featureIds.value[i];
11811
- if (currValue === lastValue) {
11812
- continue;
11813
- }
11814
- features.push(parseFeature(data, lastIndex, i));
11815
- lastIndex = i;
11816
- lastValue = currValue;
11817
- }
11818
- features.push(parseFeature(data, lastIndex, data.featureIds.value.length));
11819
- }
11820
- return features;
11821
- }
11822
- function parseFeature(data, startIndex, endIndex) {
11823
- const geometry = binaryToGeometry(data, startIndex, endIndex);
11824
- const properties = parseProperties(data, startIndex, endIndex);
11825
- const fields = parseFields(data, startIndex, endIndex);
11826
- return {
11827
- type: "Feature",
11828
- geometry,
11829
- properties,
11830
- ...fields
11831
- };
11832
- }
11833
- function parseFields(data) {
11834
- let startIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
11835
- let endIndex = arguments.length > 2 ? arguments[2] : void 0;
11836
- return data.fields && data.fields[data.featureIds.value[startIndex]];
11837
- }
11838
- function parseProperties(data) {
11839
- let startIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
11840
- let endIndex = arguments.length > 2 ? arguments[2] : void 0;
11841
- const properties = Object.assign({}, data.properties[data.featureIds.value[startIndex]]);
11842
- for (const key in data.numericProps) {
11843
- properties[key] = data.numericProps[key].value[startIndex];
11844
- }
11845
- return properties;
11846
- }
11847
- function polygonToGeoJson(data) {
11848
- let startIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -Infinity;
11849
- let endIndex = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Infinity;
11850
- const {
11851
- positions
11852
- } = data;
11853
- const polygonIndices = data.polygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
11854
- const primitivePolygonIndices = data.primitivePolygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
11855
- const multi = polygonIndices.length > 2;
11856
- if (!multi) {
11857
- const coordinates2 = [];
11858
- for (let i = 0; i < primitivePolygonIndices.length - 1; i++) {
11859
- const startRingIndex = primitivePolygonIndices[i];
11860
- const endRingIndex = primitivePolygonIndices[i + 1];
11861
- const ringCoordinates = ringToGeoJson(positions, startRingIndex, endRingIndex);
11862
- coordinates2.push(ringCoordinates);
11863
- }
11864
- return {
11865
- type: "Polygon",
11866
- coordinates: coordinates2
11867
- };
11868
- }
11869
- const coordinates = [];
11870
- for (let i = 0; i < polygonIndices.length - 1; i++) {
11871
- const startPolygonIndex = polygonIndices[i];
11872
- const endPolygonIndex = polygonIndices[i + 1];
11873
- const polygonCoordinates = polygonToGeoJson(data, startPolygonIndex, endPolygonIndex).coordinates;
11874
- coordinates.push(polygonCoordinates);
11875
- }
11876
- return {
11877
- type: "MultiPolygon",
11878
- coordinates
11879
- };
11880
- }
11881
- function lineStringToGeoJson(data) {
11882
- let startIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -Infinity;
11883
- let endIndex = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Infinity;
11884
- const {
11885
- positions
11886
- } = data;
11887
- const pathIndices = data.pathIndices.value.filter((x) => x >= startIndex && x <= endIndex);
11888
- const multi = pathIndices.length > 2;
11889
- if (!multi) {
11890
- const coordinates2 = ringToGeoJson(positions, pathIndices[0], pathIndices[1]);
11891
- return {
11892
- type: "LineString",
11893
- coordinates: coordinates2
11894
- };
11895
- }
11896
- const coordinates = [];
11897
- for (let i = 0; i < pathIndices.length - 1; i++) {
11898
- const ringCoordinates = ringToGeoJson(positions, pathIndices[i], pathIndices[i + 1]);
11899
- coordinates.push(ringCoordinates);
11900
- }
11901
- return {
11902
- type: "MultiLineString",
11903
- coordinates
11904
- };
11905
- }
11906
- function pointToGeoJson(data, startIndex, endIndex) {
11907
- const {
11908
- positions
11909
- } = data;
11910
- const coordinates = ringToGeoJson(positions, startIndex, endIndex);
11911
- const multi = coordinates.length > 1;
11912
- if (multi) {
11913
- return {
11914
- type: "MultiPoint",
11915
- coordinates
11916
- };
11917
- }
11918
- return {
11919
- type: "Point",
11920
- coordinates: coordinates[0]
11921
- };
11922
- }
11923
- function ringToGeoJson(positions, startIndex, endIndex) {
11924
- startIndex = startIndex || 0;
11925
- endIndex = endIndex || positions.value.length / positions.size;
11926
- const ringCoordinates = [];
11927
- for (let j = startIndex; j < endIndex; j++) {
11928
- const coord = Array();
11929
- for (let k = j * positions.size; k < (j + 1) * positions.size; k++) {
11930
- coord.push(Number(positions.value[k]));
11931
- }
11932
- ringCoordinates.push(coord);
11933
- }
11934
- return ringCoordinates;
11935
- }
11936
- function parseType(data) {
11937
- if (data.pathIndices) {
11938
- return "LineString";
11939
- }
11940
- if (data.polygonIndices) {
11941
- return "Polygon";
11942
- }
11943
- return "Point";
11944
- }
11945
-
11946
- // src/layers/carto-tile-layer.ts
11947
- (0, import_core.registerLoaders)([carto_vector_tile_loader_default]);
11948
- var defaultTileFormat = TILE_FORMATS.BINARY;
11949
- var defaultProps = {
11950
- ...import_geo_layers.MVTLayer.defaultProps,
11951
- formatTiles: defaultTileFormat
11952
- };
11953
- var CartoTileLayer = class extends import_geo_layers.MVTLayer {
11954
- initializeState() {
11955
- super.initializeState();
11956
- const binary = this.props.formatTiles === TILE_FORMATS.BINARY;
11957
- this.setState({
11958
- binary
11959
- });
11960
- }
11961
- getTileData(tile) {
11962
- const url = (0, import_geo_layers._getURLFromTemplate)(this.state.data, tile);
11963
- if (!url) {
11964
- return Promise.reject("Invalid URL");
11965
- }
11966
- let loadOptions = this.getLoadOptions();
11967
- const {
11968
- fetch: fetch2,
11969
- formatTiles
11970
- } = this.props;
11971
- const {
11972
- signal
11973
- } = tile;
11974
- if (formatTiles === TILE_FORMATS.BINARY) {
11975
- loadOptions = {
11976
- ...loadOptions,
11977
- mimeType: "application/vnd.carto-vector-tile"
11978
- };
11979
- }
11980
- return fetch2(url, {
11981
- propName: "data",
11982
- layer: this,
11983
- loadOptions,
11984
- signal
11985
- });
11986
- }
11987
- renderSubLayers(props) {
11988
- if (props.data === null) {
11989
- return null;
11990
- }
11991
- const tileBbox = props.tile.bbox;
11992
- const {
11993
- west,
11994
- south,
11995
- east,
11996
- north
11997
- } = tileBbox;
11998
- const subLayerProps = {
11999
- ...props,
12000
- autoHighlight: false,
12001
- extensions: [new import_extensions.ClipExtension(), ...props.extensions || []],
12002
- clipBounds: [west, south, east, north]
12003
- };
12004
- const subLayer = new import_layers.GeoJsonLayer(subLayerProps);
12005
- return subLayer;
12006
- }
12007
- getPickingInfo(params) {
12008
- const info = super.getPickingInfo(params);
12009
- if (this.state.binary && info.index !== -1) {
12010
- const {
12011
- data
12012
- } = params.sourceLayer.props;
12013
- info.object = binaryToGeojson(data, {
12014
- globalFeatureId: info.index
12015
- });
12016
- }
12017
- return info;
12018
- }
12019
- };
12020
- __publicField(CartoTileLayer, "layerName", "CartoTileLayer");
12021
- __publicField(CartoTileLayer, "defaultProps", defaultProps);
12022
-
12023
- // src/layers/h3-tile-layer.ts
12024
- var import_core3 = __toESM(require_core());
12025
- var import_geo_layers4 = __toESM(require_geo_layers());
12026
-
12027
- // src/layers/h3-tileset-2d.ts
12028
- var import_geo_layers2 = __toESM(require_geo_layers());
12029
- var import_h3_js = __toESM(require_h3_js());
12030
- function getHexagonsInBoundingBox({
12031
- west,
12032
- north,
12033
- east,
12034
- south
12035
- }, resolution) {
12036
- const longitudeSpan = Math.abs(east - west);
12037
- if (longitudeSpan > 180) {
12038
- const nSegments = Math.ceil(longitudeSpan / 180);
12039
- let h3Indices2 = [];
12040
- for (let s = 0; s < nSegments; s++) {
12041
- const segmentEast = east + s * 180;
12042
- const segmentWest = Math.min(segmentEast + 179.9999999, west);
12043
- h3Indices2 = h3Indices2.concat(getHexagonsInBoundingBox({
12044
- west: segmentWest,
12045
- north,
12046
- east: segmentEast,
12047
- south
12048
- }, resolution));
12049
- }
12050
- return [...new Set(h3Indices2)];
12051
- }
12052
- const oversample = 2;
12053
- const h3Indices = (0, import_h3_js.polygonToCells)([[[west, north], [west, south], [east, south], [east, north], [west, north]]], resolution + oversample, true);
12054
- return oversample ? [...new Set(h3Indices.map((i) => (0, import_h3_js.cellToParent)(i, resolution)))] : h3Indices;
12055
- }
12056
- function tileToBoundingBox(index) {
12057
- const coordinates = (0, import_h3_js.cellToBoundary)(index);
12058
- const latitudes = coordinates.map((c) => c[0]);
12059
- const longitudes = coordinates.map((c) => c[1]);
12060
- const west = Math.min(...longitudes);
12061
- const south = Math.min(...latitudes);
12062
- const east = Math.max(...longitudes);
12063
- const north = Math.max(...latitudes);
12064
- return {
12065
- west,
12066
- south,
12067
- east,
12068
- north
12069
- };
12070
- }
12071
- var BIAS = 2;
12072
- function getHexagonResolution(viewport) {
12073
- const hexagonScaleFactor = 2 / 3 * viewport.zoom;
12074
- const latitudeScaleFactor = Math.log(1 / Math.cos(Math.PI * viewport.latitude / 180));
12075
- return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
12076
- }
12077
- var H3Tileset2D = class extends import_geo_layers2._Tileset2D {
12078
- getTileIndices({
12079
- viewport,
12080
- minZoom,
12081
- maxZoom
12082
- }) {
12083
- if (viewport.latitude === void 0)
12084
- return [];
12085
- const [east, south, west, north] = viewport.getBounds();
12086
- let z = getHexagonResolution(viewport);
12087
- let indices;
12088
- if (typeof minZoom === "number" && Number.isFinite(minZoom) && z < minZoom) {
12089
- return [];
12090
- }
12091
- if (typeof maxZoom === "number" && Number.isFinite(maxZoom) && z > maxZoom) {
12092
- z = maxZoom;
12093
- const center = (0, import_h3_js.latLngToCell)(viewport.latitude, viewport.longitude, maxZoom);
12094
- indices = (0, import_h3_js.gridDisk)(center, 1);
12095
- } else {
12096
- indices = getHexagonsInBoundingBox({
12097
- west,
12098
- north,
12099
- east,
12100
- south
12101
- }, z);
12102
- }
12103
- return indices.map((i) => ({
12104
- i
12105
- }));
12106
- }
12107
- getTileId({
12108
- i
12109
- }) {
12110
- return i;
12111
- }
12112
- getTileMetadata({
12113
- i
12114
- }) {
12115
- return {
12116
- bbox: tileToBoundingBox(i)
12117
- };
12118
- }
12119
- getTileZoom({
12120
- i
12121
- }) {
12122
- return (0, import_h3_js.getResolution)(i);
12123
- }
12124
- getParentIndex(index) {
12125
- const resolution = (0, import_h3_js.getResolution)(index.i);
12126
- const i = (0, import_h3_js.cellToParent)(index.i, resolution - 1);
12127
- return {
12128
- i
12129
- };
12130
- }
12131
- };
12132
-
12133
- // src/layers/spatial-index-tile-layer.ts
12134
- var import_core2 = __toESM(require_core2());
12135
-
12136
- // src/layers/schema/carto-raster-tile.ts
12137
- var ARRAY_TYPES = {
12138
- uint8: Uint8Array,
12139
- uint16: Uint16Array,
12140
- uint32: Uint32Array,
12141
- uint64: BigUint64Array,
12142
- int8: Int8Array,
12143
- int16: Int16Array,
12144
- int32: Int32Array,
12145
- int64: BigInt64Array,
12146
- float32: Float32Array,
12147
- float64: Float64Array
12148
- };
12149
- var BandReader = class {
12150
- static read(pbf, end) {
12151
- return pbf.readFields(BandReader._readField, {
12152
- name: "",
12153
- type: "",
12154
- data: null
12155
- }, end);
12156
- }
12157
- static _readField(tag, obj, pbf) {
12158
- if (tag === 1)
12159
- obj.name = pbf.readString();
12160
- else if (tag === 2)
12161
- obj.type = pbf.readString();
12162
- else if (tag === 3) {
12163
- const TypedArray = ARRAY_TYPES[obj.type];
12164
- if (!TypedArray) {
12165
- throw Error(`Invalid data type: ${obj.type}`);
12166
- }
12167
- obj.data = {};
12168
- readPackedTypedArray(TypedArray, pbf, obj.data);
12169
- }
12170
- }
12171
- };
12172
- var TileReader2 = class {
12173
- static read(pbf, end) {
12174
- return pbf.readFields(TileReader2._readField, {
12175
- blockWidth: 0,
12176
- blockHeight: 0,
12177
- bands: []
12178
- }, end);
12179
- }
12180
- static _readField(tag, obj, pbf) {
12181
- if (tag === 1)
12182
- obj.blockWidth = pbf.readVarint();
12183
- else if (tag === 2)
12184
- obj.blockHeight = pbf.readVarint();
12185
- else if (tag === 3)
12186
- obj.bands.push(BandReader.read(pbf, pbf.readVarint() + pbf.pos));
12187
- }
12188
- };
12189
-
12190
- // src/layers/schema/carto-raster-tile-loader.ts
12191
- var CartoRasterTileLoader = {
12192
- name: "CARTO Raster Tile",
12193
- version: "1",
12194
- id: "cartoRasterTile",
12195
- module: "carto",
12196
- extensions: ["pbf"],
12197
- mimeTypes: ["application/vnd.carto-raster-tile"],
12198
- category: "geometry",
12199
- worker: false,
12200
- parse: async (arrayBuffer, options) => parseCartoRasterTile(arrayBuffer, options),
12201
- parseSync: parseCartoRasterTile,
12202
- options: {}
12203
- };
12204
- function parseCartoRasterTile(arrayBuffer, options) {
12205
- if (!arrayBuffer)
12206
- return null;
12207
- const tile = parsePbf(arrayBuffer, TileReader2);
12208
- const {
12209
- bands,
12210
- blockHeight,
12211
- blockWidth
12212
- } = tile;
12213
- const numericProps = {};
12214
- for (let i = 0; i < bands.length; i++) {
12215
- const {
12216
- name,
12217
- data
12218
- } = bands[i];
12219
- numericProps[name] = data;
12220
- }
12221
- return {
12222
- blockWidth,
12223
- blockHeight,
12224
- cells: {
12225
- numericProps,
12226
- properties: []
12227
- }
12228
- };
12229
- }
12230
- var carto_raster_tile_loader_default = CartoRasterTileLoader;
12231
-
12232
- // src/layers/schema/carto-spatial-tile.ts
12233
- var IndicesReader = class {
12234
- static read(pbf, end) {
12235
- return pbf.readFields(IndicesReader._readField, {
12236
- value: []
12237
- }, end);
12238
- }
12239
- static _readField(tag, obj, pbf) {
12240
- if (tag === 1)
12241
- readPackedTypedArray(BigUint64Array, pbf, obj);
12242
- }
12243
- };
12244
- var CellsReader = class {
12245
- static read(pbf, end) {
12246
- return pbf.readFields(CellsReader._readField, {
12247
- indices: null,
12248
- properties: [],
12249
- numericProps: {}
12250
- }, end);
12251
- }
12252
- static _readField(tag, obj, pbf) {
12253
- if (tag === 1)
12254
- obj.indices = IndicesReader.read(pbf, pbf.readVarint() + pbf.pos);
12255
- else if (tag === 2)
12256
- obj.properties.push(PropertiesReader.read(pbf, pbf.readVarint() + pbf.pos));
12257
- else if (tag === 3) {
12258
- const entry = NumericPropKeyValueReader.read(pbf, pbf.readVarint() + pbf.pos);
12259
- obj.numericProps[entry.key] = entry.value;
12260
- }
12261
- }
12262
- };
12263
- var TileReader3 = class {
12264
- static read(pbf, end) {
12265
- return pbf.readFields(TileReader3._readField, {
12266
- scheme: 0,
12267
- cells: null
12268
- }, end);
12269
- }
12270
- static _readField(tag, obj, pbf) {
12271
- if (tag === 1)
12272
- obj.scheme = pbf.readVarint();
12273
- else if (tag === 2)
12274
- obj.cells = CellsReader.read(pbf, pbf.readVarint() + pbf.pos);
12275
- }
12276
- };
12277
-
12278
- // ../../node_modules/quadbin/dist/esm/index.js
12279
- var import_tile_cover = __toESM(require_tile_cover());
12280
- var B = [
12281
- 0x5555555555555555n,
12282
- 0x3333333333333333n,
12283
- 0x0f0f0f0f0f0f0f0fn,
12284
- 0x00ff00ff00ff00ffn,
12285
- 0x0000ffff0000ffffn,
12286
- 0x00000000ffffffffn
12287
- ];
12288
- var S = [0n, 1n, 2n, 4n, 8n, 16n];
12289
- function hexToBigInt(hex2) {
12290
- return BigInt(`0x${hex2}`);
12291
- }
12292
- function bigIntToHex(index) {
12293
- return index.toString(16);
12294
- }
12295
- function tileToCell(tile) {
12296
- if (tile.z < 0 || tile.z > 26) {
12297
- throw new Error("Wrong zoom");
12485
+ function tileToCell(tile) {
12486
+ if (tile.z < 0 || tile.z > 26) {
12487
+ throw new Error("Wrong zoom");
12298
12488
  }
12299
12489
  const z = BigInt(tile.z);
12300
12490
  let x = BigInt(tile.x) << 32n - z;
@@ -12346,7 +12536,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
12346
12536
  const count = cells.indices.value.length;
12347
12537
  const spatial = [];
12348
12538
  for (let i = 0; i < count; i++) {
12349
- const id = scheme === "h3" ? bigIntToHex(cells.indices.value[i]) : cells.indices.value[i];
12539
+ const id4 = scheme === "h3" ? bigIntToHex(cells.indices.value[i]) : cells.indices.value[i];
12350
12540
  const properties = {
12351
12541
  ...cells.properties[i]
12352
12542
  };
@@ -12354,7 +12544,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
12354
12544
  properties[key] = cells.numericProps[key].value[i];
12355
12545
  }
12356
12546
  spatial.push({
12357
- id,
12547
+ id: id4,
12358
12548
  properties
12359
12549
  });
12360
12550
  }
@@ -12362,22 +12552,26 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
12362
12552
  }
12363
12553
 
12364
12554
  // src/layers/schema/carto-spatial-tile-loader.ts
12555
+ var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
12556
+ var id2 = "cartoSpatialTile";
12557
+ var DEFAULT_OPTIONS2 = {
12558
+ cartoSpatialTile: {
12559
+ scheme: "quadbin",
12560
+ workerUrl: getWorkerUrl(id2, VERSION2)
12561
+ }
12562
+ };
12365
12563
  var CartoSpatialTileLoader = {
12366
12564
  name: "CARTO Spatial Tile",
12367
- version: "1",
12368
- id: "cartoSpatialTile",
12565
+ version: VERSION2,
12566
+ id: id2,
12369
12567
  module: "carto",
12370
12568
  extensions: ["pbf"],
12371
12569
  mimeTypes: ["application/vnd.carto-spatial-tile"],
12372
12570
  category: "geometry",
12373
- worker: false,
12374
12571
  parse: async (arrayBuffer, options) => parseCartoSpatialTile(arrayBuffer, options),
12375
12572
  parseSync: parseCartoSpatialTile,
12376
- options: {
12377
- cartoSpatialTile: {
12378
- scheme: "quadbin"
12379
- }
12380
- }
12573
+ worker: true,
12574
+ options: DEFAULT_OPTIONS2
12381
12575
  };
12382
12576
  function parseCartoSpatialTile(arrayBuffer, options) {
12383
12577
  if (!arrayBuffer)
@@ -12396,15 +12590,15 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
12396
12590
  var carto_spatial_tile_loader_default = CartoSpatialTileLoader;
12397
12591
 
12398
12592
  // src/layers/spatial-index-tile-layer.ts
12399
- var import_geo_layers3 = __toESM(require_geo_layers());
12593
+ var import_geo_layers2 = __toESM(require_geo_layers());
12400
12594
  (0, import_core2.registerLoaders)([carto_raster_tile_loader_default, carto_spatial_tile_loader_default]);
12401
12595
  function isFeatureIdDefined(value) {
12402
12596
  return value !== void 0 && value !== null && value !== "";
12403
12597
  }
12404
- var defaultProps2 = {
12598
+ var defaultProps = {
12405
12599
  aggregationResLevel: 4
12406
12600
  };
12407
- var SpatialIndexTileLayer = class extends import_geo_layers3.TileLayer {
12601
+ var SpatialIndexTileLayer = class extends import_geo_layers2.TileLayer {
12408
12602
  updateState(params) {
12409
12603
  const {
12410
12604
  props,
@@ -12475,7 +12669,47 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
12475
12669
  }
12476
12670
  };
12477
12671
  __publicField(SpatialIndexTileLayer, "layerName", "SpatialIndexTileLayer");
12478
- __publicField(SpatialIndexTileLayer, "defaultProps", defaultProps2);
12672
+ __publicField(SpatialIndexTileLayer, "defaultProps", defaultProps);
12673
+
12674
+ // src/sources/common.ts
12675
+ var SOURCE_DEFAULTS = {
12676
+ apiBaseUrl: "https://gcp-us-east1.api.carto.com",
12677
+ clientId: "deck-gl-carto",
12678
+ format: "tilejson",
12679
+ formatTiles: "binary",
12680
+ headers: {}
12681
+ };
12682
+ var DEFAULT_CLIENT = "deck-gl-carto";
12683
+ var V3_MINOR_VERSION = "3.2";
12684
+ var MAX_GET_LENGTH = 8192;
12685
+ var DEFAULT_PARAMETERS = {
12686
+ client: DEFAULT_CLIENT,
12687
+ v: V3_MINOR_VERSION
12688
+ };
12689
+ var DEFAULT_HEADERS = {
12690
+ Accept: "application/json",
12691
+ "Content-Type": "application/json"
12692
+ };
12693
+ var TilejsonPropType = {
12694
+ type: "object",
12695
+ value: null,
12696
+ validate: (value, propType) => propType.optional && value === null || typeof value === "object" && Array.isArray(value.tiles) && value.tiles.every((url) => typeof url === "string"),
12697
+ compare: 2,
12698
+ async: true
12699
+ };
12700
+
12701
+ // src/layers/utils.ts
12702
+ function injectAccessToken(loadOptions, accessToken) {
12703
+ if (!loadOptions?.fetch?.headers?.Authorization) {
12704
+ loadOptions.fetch = {
12705
+ ...loadOptions.fetch,
12706
+ headers: {
12707
+ ...loadOptions.fetch?.headers,
12708
+ Authorization: `Bearer ${accessToken}`
12709
+ }
12710
+ };
12711
+ }
12712
+ }
12479
12713
 
12480
12714
  // src/layers/h3-tile-layer.ts
12481
12715
  var renderSubLayers = (props) => {
@@ -12487,45 +12721,41 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
12487
12721
  } = props.tile;
12488
12722
  if (!data || !data.length)
12489
12723
  return null;
12490
- return new import_geo_layers4.H3HexagonLayer(props, {
12724
+ return new import_geo_layers3.H3HexagonLayer(props, {
12491
12725
  getHexagon: (d) => d.id,
12492
12726
  centerHexagon: index,
12493
12727
  highPrecision: true
12494
12728
  });
12495
12729
  };
12496
- var defaultProps3 = {
12497
- aggregationResLevel: 4
12730
+ var defaultProps2 = {
12731
+ aggregationResLevel: 4,
12732
+ data: TilejsonPropType
12498
12733
  };
12499
12734
  var H3TileLayer = class extends import_core3.CompositeLayer {
12500
12735
  initializeState() {
12501
- import_geo_layers4.H3HexagonLayer._checkH3Lib();
12502
- this.setState({
12503
- data: null,
12504
- tileJSON: null
12505
- });
12506
- }
12507
- updateState({
12508
- changeFlags
12509
- }) {
12510
- if (changeFlags.dataChanged) {
12511
- let {
12512
- data
12513
- } = this.props;
12514
- const tileJSON = data;
12515
- data = tileJSON.tiles;
12516
- this.setState({
12517
- data,
12518
- tileJSON
12519
- });
12520
- }
12736
+ import_geo_layers3.H3HexagonLayer._checkH3Lib();
12737
+ }
12738
+ getLoadOptions() {
12739
+ const loadOptions = super.getLoadOptions() || {};
12740
+ const tileJSON = this.props.data;
12741
+ injectAccessToken(loadOptions, tileJSON.accessToken);
12742
+ loadOptions.cartoSpatialTile = {
12743
+ ...loadOptions.cartoSpatialTile,
12744
+ scheme: "h3"
12745
+ };
12746
+ return loadOptions;
12521
12747
  }
12522
12748
  renderLayers() {
12749
+ const tileJSON = this.props.data;
12750
+ if (!tileJSON)
12751
+ return null;
12523
12752
  const {
12524
- data,
12525
- tileJSON
12526
- } = this.state;
12527
- let minresolution = parseInt(tileJSON.minresolution);
12528
- let maxresolution = parseInt(tileJSON.maxresolution);
12753
+ tiles: data
12754
+ } = tileJSON;
12755
+ let {
12756
+ minresolution,
12757
+ maxresolution
12758
+ } = tileJSON;
12529
12759
  if (this.props.minZoom) {
12530
12760
  minresolution = Math.max(minresolution, getHexagonResolution({
12531
12761
  zoom: this.props.minZoom,
@@ -12538,31 +12768,27 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
12538
12768
  latitude: 0
12539
12769
  }));
12540
12770
  }
12541
- return [new SpatialIndexTileLayer(this.props, {
12542
- id: `h3-tile-layer-${this.props.id}`,
12543
- data,
12544
- TilesetClass: H3Tileset2D,
12545
- renderSubLayers,
12546
- minZoom: minresolution,
12547
- maxZoom: maxresolution,
12548
- loadOptions: {
12549
- ...this.getLoadOptions(),
12550
- cartoSpatialTile: {
12551
- scheme: "h3"
12552
- },
12553
- mimeType: "application/vnd.carto-spatial-tile"
12554
- }
12555
- })];
12771
+ return [
12772
+ new SpatialIndexTileLayer(this.props, {
12773
+ id: `h3-tile-layer-${this.props.id}`,
12774
+ data,
12775
+ TilesetClass: H3Tileset2D,
12776
+ renderSubLayers,
12777
+ minZoom: minresolution,
12778
+ maxZoom: maxresolution,
12779
+ loadOptions: this.getLoadOptions()
12780
+ })
12781
+ ];
12556
12782
  }
12557
12783
  };
12558
12784
  __publicField(H3TileLayer, "layerName", "H3TileLayer");
12559
- __publicField(H3TileLayer, "defaultProps", defaultProps3);
12785
+ __publicField(H3TileLayer, "defaultProps", defaultProps2);
12560
12786
 
12561
12787
  // src/layers/quadbin-tile-layer.ts
12562
12788
  var import_core4 = __toESM(require_core());
12563
12789
 
12564
12790
  // src/layers/quadbin-layer.ts
12565
- var import_geo_layers5 = __toESM(require_geo_layers());
12791
+ var import_geo_layers4 = __toESM(require_geo_layers());
12566
12792
 
12567
12793
  // ../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js
12568
12794
  var PI = Math.PI;
@@ -12603,13 +12829,13 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
12603
12829
  }
12604
12830
 
12605
12831
  // src/layers/quadbin-layer.ts
12606
- var defaultProps4 = {
12832
+ var defaultProps3 = {
12607
12833
  getQuadbin: {
12608
12834
  type: "accessor",
12609
12835
  value: (d) => d.quadbin
12610
12836
  }
12611
12837
  };
12612
- var QuadbinLayer = class extends import_geo_layers5._GeoCellLayer {
12838
+ var QuadbinLayer = class extends import_geo_layers4._GeoCellLayer {
12613
12839
  indexToBounds() {
12614
12840
  const {
12615
12841
  data,
@@ -12629,11 +12855,11 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
12629
12855
  }
12630
12856
  };
12631
12857
  __publicField(QuadbinLayer, "layerName", "QuadbinLayer");
12632
- __publicField(QuadbinLayer, "defaultProps", defaultProps4);
12858
+ __publicField(QuadbinLayer, "defaultProps", defaultProps3);
12633
12859
 
12634
12860
  // src/layers/quadbin-tileset-2d.ts
12635
- var import_geo_layers6 = __toESM(require_geo_layers());
12636
- var QuadbinTileset2D = class extends import_geo_layers6._Tileset2D {
12861
+ var import_geo_layers5 = __toESM(require_geo_layers());
12862
+ var QuadbinTileset2D = class extends import_geo_layers5._Tileset2D {
12637
12863
  getTileIndices(opts) {
12638
12864
  return super.getTileIndices(opts).map(tileToCell).map((q) => ({
12639
12865
  q,
@@ -12677,62 +12903,50 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
12677
12903
  getQuadbin: isBigInt ? (d) => d.id : (d) => hexToBigInt(d.id)
12678
12904
  });
12679
12905
  };
12680
- var defaultProps5 = {
12681
- aggregationResLevel: 6
12906
+ var defaultProps4 = {
12907
+ aggregationResLevel: 6,
12908
+ data: TilejsonPropType
12682
12909
  };
12683
12910
  var QuadbinTileLayer = class extends import_core4.CompositeLayer {
12684
- initializeState() {
12685
- this.setState({
12686
- data: null,
12687
- tileJSON: null
12688
- });
12689
- }
12690
- updateState({
12691
- changeFlags
12692
- }) {
12693
- if (changeFlags.dataChanged) {
12694
- let {
12695
- data
12696
- } = this.props;
12697
- const tileJSON = data;
12698
- data = tileJSON.tiles;
12699
- this.setState({
12700
- data,
12701
- tileJSON
12702
- });
12703
- }
12911
+ getLoadOptions() {
12912
+ const loadOptions = super.getLoadOptions() || {};
12913
+ const tileJSON = this.props.data;
12914
+ injectAccessToken(loadOptions, tileJSON.accessToken);
12915
+ loadOptions.cartoSpatialTile = {
12916
+ ...loadOptions.cartoSpatialTile,
12917
+ scheme: "quadbin"
12918
+ };
12919
+ return loadOptions;
12704
12920
  }
12705
12921
  renderLayers() {
12922
+ const tileJSON = this.props.data;
12923
+ if (!tileJSON)
12924
+ return null;
12706
12925
  const {
12707
- data,
12708
- tileJSON
12709
- } = this.state;
12710
- const maxZoom = parseInt(tileJSON?.maxresolution);
12711
- return [new SpatialIndexTileLayer(this.props, {
12712
- id: `quadbin-tile-layer-${this.props.id}`,
12713
- data,
12714
- TilesetClass: QuadbinTileset2D,
12715
- renderSubLayers: renderSubLayers2,
12716
- maxZoom,
12717
- loadOptions: {
12718
- ...this.getLoadOptions(),
12719
- cartoSpatialTile: {
12720
- scheme: "quadbin"
12721
- },
12722
- mimeType: "application/vnd.carto-spatial-tile"
12723
- }
12724
- })];
12926
+ tiles: data,
12927
+ maxresolution: maxZoom
12928
+ } = tileJSON;
12929
+ return [
12930
+ new SpatialIndexTileLayer(this.props, {
12931
+ id: `quadbin-tile-layer-${this.props.id}`,
12932
+ data,
12933
+ TilesetClass: QuadbinTileset2D,
12934
+ renderSubLayers: renderSubLayers2,
12935
+ maxZoom,
12936
+ loadOptions: this.getLoadOptions()
12937
+ })
12938
+ ];
12725
12939
  }
12726
12940
  };
12727
12941
  __publicField(QuadbinTileLayer, "layerName", "QuadbinTileLayer");
12728
- __publicField(QuadbinTileLayer, "defaultProps", defaultProps5);
12942
+ __publicField(QuadbinTileLayer, "defaultProps", defaultProps4);
12729
12943
 
12730
12944
  // src/layers/raster-tile-layer.ts
12731
- var import_core7 = __toESM(require_core());
12945
+ var import_core6 = __toESM(require_core());
12732
12946
 
12733
12947
  // src/layers/raster-layer.ts
12734
- var import_core6 = __toESM(require_core());
12735
- var import_layers2 = __toESM(require_layers());
12948
+ var import_core5 = __toESM(require_core());
12949
+ var import_layers = __toESM(require_layers());
12736
12950
 
12737
12951
  // src/layers/raster-layer-vertex.glsl.ts
12738
12952
  var raster_layer_vertex_glsl_default = `#version 300 es
@@ -12833,37 +13047,14 @@ void main(void) {
12833
13047
  }
12834
13048
  `;
12835
13049
 
12836
- // src/utils.ts
12837
- var import_core5 = __toESM(require_core());
12838
- function assert2(condition, message) {
12839
- import_core5.log.assert(condition, message);
12840
- }
12841
- function createBinaryProxy(data, index) {
12842
- const {
12843
- properties,
12844
- numericProps
12845
- } = data;
12846
- return new Proxy(properties[index] || {}, {
12847
- get(target, property, receiver) {
12848
- if (property in numericProps) {
12849
- return numericProps[property].value[index];
12850
- }
12851
- return target[property];
12852
- },
12853
- has(target, property) {
12854
- return property in numericProps || property in target;
12855
- }
12856
- });
12857
- }
12858
-
12859
13050
  // src/layers/raster-layer.ts
12860
- var defaultProps6 = {
12861
- ...import_layers2.ColumnLayer.defaultProps,
13051
+ var defaultProps5 = {
13052
+ ...import_layers.ColumnLayer.defaultProps,
12862
13053
  extruded: false,
12863
13054
  diskResolution: 4,
12864
13055
  vertices: [[-0.5, -0.5], [0.5, -0.5], [0.5, 0.5], [-0.5, 0.5]]
12865
13056
  };
12866
- var RasterColumnLayer = class extends import_layers2.ColumnLayer {
13057
+ var RasterColumnLayer = class extends import_layers.ColumnLayer {
12867
13058
  getShaders() {
12868
13059
  const shaders = super.getShaders();
12869
13060
  return {
@@ -12899,7 +13090,7 @@ void main(void) {
12899
13090
  }
12900
13091
  };
12901
13092
  __publicField(RasterColumnLayer, "layerName", "RasterColumnLayer");
12902
- var RasterLayer = class extends import_core6.CompositeLayer {
13093
+ var RasterLayer = class extends import_core5.CompositeLayer {
12903
13094
  renderLayers() {
12904
13095
  const {
12905
13096
  data,
@@ -12916,7 +13107,7 @@ void main(void) {
12916
13107
  blockWidth,
12917
13108
  blockHeight
12918
13109
  } = data;
12919
- assert2(blockWidth === blockHeight, `blockWidth (${blockWidth}) must equal blockHeight (${blockHeight})`);
13110
+ assert(blockWidth === blockHeight, `blockWidth (${blockWidth}) must equal blockHeight (${blockHeight})`);
12920
13111
  const [xOffset, yOffset, scale] = quadbinToOffset(tileIndex);
12921
13112
  const offset = [xOffset, yOffset, scale / blockWidth];
12922
13113
  const CellLayer = this.getSubLayerClass("column", RasterColumnLayer);
@@ -12951,60 +13142,443 @@ void main(void) {
12951
13142
  }, info);
12952
13143
  };
12953
13144
  }
12954
- };
12955
- __publicField(RasterLayer, "layerName", "RasterLayer");
12956
- __publicField(RasterLayer, "defaultProps", defaultProps6);
13145
+ };
13146
+ __publicField(RasterLayer, "layerName", "RasterLayer");
13147
+ __publicField(RasterLayer, "defaultProps", defaultProps5);
13148
+
13149
+ // src/layers/raster-tile-layer.ts
13150
+ var renderSubLayers3 = (props) => {
13151
+ const tileIndex = props.tile?.index?.q;
13152
+ if (!tileIndex)
13153
+ return null;
13154
+ return new RasterLayer(props, {
13155
+ tileIndex
13156
+ });
13157
+ };
13158
+ var defaultProps6 = {
13159
+ data: TilejsonPropType
13160
+ };
13161
+ var RasterTileLayer = class extends import_core6.CompositeLayer {
13162
+ getLoadOptions() {
13163
+ const loadOptions = super.getLoadOptions() || {};
13164
+ const tileJSON = this.props.data;
13165
+ injectAccessToken(loadOptions, tileJSON.accessToken);
13166
+ return loadOptions;
13167
+ }
13168
+ renderLayers() {
13169
+ const tileJSON = this.props.data;
13170
+ if (!tileJSON)
13171
+ return null;
13172
+ const {
13173
+ tiles: data,
13174
+ minzoom: minZoom,
13175
+ maxzoom: maxZoom
13176
+ } = tileJSON;
13177
+ return [
13178
+ new SpatialIndexTileLayer(this.props, {
13179
+ id: `raster-tile-layer-${this.props.id}`,
13180
+ data,
13181
+ TilesetClass: QuadbinTileset2D,
13182
+ renderSubLayers: renderSubLayers3,
13183
+ minZoom,
13184
+ maxZoom,
13185
+ loadOptions: this.getLoadOptions()
13186
+ })
13187
+ ];
13188
+ }
13189
+ };
13190
+ __publicField(RasterTileLayer, "layerName", "RasterTileLayer");
13191
+ __publicField(RasterTileLayer, "defaultProps", defaultProps6);
13192
+
13193
+ // src/layers/vector-tile-layer.ts
13194
+ var import_core7 = __toESM(require_core2());
13195
+
13196
+ // src/layers/schema/carto-vector-tile-loader.ts
13197
+ var import_earcut = __toESM(require_earcut());
13198
+ var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
13199
+ var id3 = "cartoVectorTile";
13200
+ var DEFAULT_OPTIONS3 = {
13201
+ cartoVectorTile: {
13202
+ workerUrl: getWorkerUrl(id3, VERSION3)
13203
+ }
13204
+ };
13205
+ var CartoVectorTileLoader = {
13206
+ name: "CARTO Vector Tile",
13207
+ version: VERSION3,
13208
+ id: id3,
13209
+ module: "carto",
13210
+ extensions: ["pbf"],
13211
+ mimeTypes: ["application/vnd.carto-vector-tile"],
13212
+ category: "geometry",
13213
+ parse: async (arrayBuffer, options) => parseCartoVectorTile(arrayBuffer, options),
13214
+ parseSync: parseCartoVectorTile,
13215
+ worker: true,
13216
+ options: DEFAULT_OPTIONS3
13217
+ };
13218
+ function triangulatePolygon(polygons, target, {
13219
+ startPosition,
13220
+ endPosition,
13221
+ indices
13222
+ }) {
13223
+ const coordLength = polygons.positions.size;
13224
+ const start = startPosition * coordLength;
13225
+ const end = endPosition * coordLength;
13226
+ const polygonPositions = polygons.positions.value.subarray(start, end);
13227
+ const holes = indices.slice(1).map((n) => n - startPosition);
13228
+ const triangles = (0, import_earcut.default)(polygonPositions, holes, coordLength);
13229
+ for (let t = 0, tl = triangles.length; t < tl; ++t) {
13230
+ target.push(startPosition + triangles[t]);
13231
+ }
13232
+ }
13233
+ function triangulate(polygons) {
13234
+ const {
13235
+ polygonIndices,
13236
+ positions,
13237
+ primitivePolygonIndices
13238
+ } = polygons;
13239
+ const triangles = [];
13240
+ let rangeStart = 0;
13241
+ for (let i = 0; i < polygonIndices.value.length - 1; i++) {
13242
+ const startPosition = polygonIndices.value[i];
13243
+ const endPosition = polygonIndices.value[i + 1];
13244
+ const rangeEnd = primitivePolygonIndices.value.indexOf(endPosition);
13245
+ const indices = primitivePolygonIndices.value.subarray(rangeStart, rangeEnd);
13246
+ rangeStart = rangeEnd;
13247
+ triangulatePolygon(polygons, triangles, {
13248
+ startPosition,
13249
+ endPosition,
13250
+ indices
13251
+ });
13252
+ }
13253
+ polygons.triangles = {
13254
+ value: new Uint32Array(triangles),
13255
+ size: 1
13256
+ };
13257
+ }
13258
+ function parseCartoVectorTile(arrayBuffer, options) {
13259
+ if (!arrayBuffer)
13260
+ return null;
13261
+ const tile = parsePbf(arrayBuffer, TileReader2);
13262
+ if (tile.polygons && !tile.polygons.triangles) {
13263
+ triangulate(tile.polygons);
13264
+ }
13265
+ return tile;
13266
+ }
13267
+ var carto_vector_tile_loader_default = CartoVectorTileLoader;
13268
+
13269
+ // src/layers/vector-tile-layer.ts
13270
+ var import_extensions = __toESM(require_extensions());
13271
+ var import_geo_layers6 = __toESM(require_geo_layers());
13272
+ var import_layers2 = __toESM(require_layers());
13273
+
13274
+ // ../../node_modules/@loaders.gl/gis/dist/esm/lib/binary-to-geojson.js
13275
+ function binaryToGeojson(data, options) {
13276
+ const globalFeatureId = options === null || options === void 0 ? void 0 : options.globalFeatureId;
13277
+ if (globalFeatureId !== void 0) {
13278
+ return getSingleFeature(data, globalFeatureId);
13279
+ }
13280
+ return parseFeatures(data, options === null || options === void 0 ? void 0 : options.type);
13281
+ }
13282
+ function getSingleFeature(data, globalFeatureId) {
13283
+ const dataArray = normalizeInput(data);
13284
+ for (const data2 of dataArray) {
13285
+ let lastIndex = 0;
13286
+ let lastValue = data2.featureIds.value[0];
13287
+ for (let i = 0; i < data2.featureIds.value.length; i++) {
13288
+ const currValue = data2.featureIds.value[i];
13289
+ if (currValue === lastValue) {
13290
+ continue;
13291
+ }
13292
+ if (globalFeatureId === data2.globalFeatureIds.value[lastIndex]) {
13293
+ return parseFeature(data2, lastIndex, i);
13294
+ }
13295
+ lastIndex = i;
13296
+ lastValue = currValue;
13297
+ }
13298
+ if (globalFeatureId === data2.globalFeatureIds.value[lastIndex]) {
13299
+ return parseFeature(data2, lastIndex, data2.featureIds.value.length);
13300
+ }
13301
+ }
13302
+ throw new Error("featureId:".concat(globalFeatureId, " not found"));
13303
+ }
13304
+ function parseFeatures(data, type) {
13305
+ const dataArray = normalizeInput(data, type);
13306
+ return parseFeatureCollection(dataArray);
13307
+ }
13308
+ function binaryToGeometry(data, startIndex, endIndex) {
13309
+ switch (data.type) {
13310
+ case "Point":
13311
+ return pointToGeoJson(data, startIndex, endIndex);
13312
+ case "LineString":
13313
+ return lineStringToGeoJson(data, startIndex, endIndex);
13314
+ case "Polygon":
13315
+ return polygonToGeoJson(data, startIndex, endIndex);
13316
+ default:
13317
+ const unexpectedInput = data;
13318
+ throw new Error("Unsupported geometry type: ".concat(unexpectedInput === null || unexpectedInput === void 0 ? void 0 : unexpectedInput.type));
13319
+ }
13320
+ }
13321
+ function normalizeInput(data, type) {
13322
+ const isHeterogeneousType = Boolean(data.points || data.lines || data.polygons);
13323
+ if (!isHeterogeneousType) {
13324
+ data.type = type || parseType(data);
13325
+ return [data];
13326
+ }
13327
+ const features = [];
13328
+ if (data.points) {
13329
+ data.points.type = "Point";
13330
+ features.push(data.points);
13331
+ }
13332
+ if (data.lines) {
13333
+ data.lines.type = "LineString";
13334
+ features.push(data.lines);
13335
+ }
13336
+ if (data.polygons) {
13337
+ data.polygons.type = "Polygon";
13338
+ features.push(data.polygons);
13339
+ }
13340
+ return features;
13341
+ }
13342
+ function parseFeatureCollection(dataArray) {
13343
+ const features = [];
13344
+ for (const data of dataArray) {
13345
+ if (data.featureIds.value.length === 0) {
13346
+ continue;
13347
+ }
13348
+ let lastIndex = 0;
13349
+ let lastValue = data.featureIds.value[0];
13350
+ for (let i = 0; i < data.featureIds.value.length; i++) {
13351
+ const currValue = data.featureIds.value[i];
13352
+ if (currValue === lastValue) {
13353
+ continue;
13354
+ }
13355
+ features.push(parseFeature(data, lastIndex, i));
13356
+ lastIndex = i;
13357
+ lastValue = currValue;
13358
+ }
13359
+ features.push(parseFeature(data, lastIndex, data.featureIds.value.length));
13360
+ }
13361
+ return features;
13362
+ }
13363
+ function parseFeature(data, startIndex, endIndex) {
13364
+ const geometry = binaryToGeometry(data, startIndex, endIndex);
13365
+ const properties = parseProperties(data, startIndex, endIndex);
13366
+ const fields = parseFields(data, startIndex, endIndex);
13367
+ return {
13368
+ type: "Feature",
13369
+ geometry,
13370
+ properties,
13371
+ ...fields
13372
+ };
13373
+ }
13374
+ function parseFields(data) {
13375
+ let startIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
13376
+ let endIndex = arguments.length > 2 ? arguments[2] : void 0;
13377
+ return data.fields && data.fields[data.featureIds.value[startIndex]];
13378
+ }
13379
+ function parseProperties(data) {
13380
+ let startIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
13381
+ let endIndex = arguments.length > 2 ? arguments[2] : void 0;
13382
+ const properties = Object.assign({}, data.properties[data.featureIds.value[startIndex]]);
13383
+ for (const key in data.numericProps) {
13384
+ properties[key] = data.numericProps[key].value[startIndex];
13385
+ }
13386
+ return properties;
13387
+ }
13388
+ function polygonToGeoJson(data) {
13389
+ let startIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -Infinity;
13390
+ let endIndex = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Infinity;
13391
+ const {
13392
+ positions
13393
+ } = data;
13394
+ const polygonIndices = data.polygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
13395
+ const primitivePolygonIndices = data.primitivePolygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
13396
+ const multi = polygonIndices.length > 2;
13397
+ if (!multi) {
13398
+ const coordinates2 = [];
13399
+ for (let i = 0; i < primitivePolygonIndices.length - 1; i++) {
13400
+ const startRingIndex = primitivePolygonIndices[i];
13401
+ const endRingIndex = primitivePolygonIndices[i + 1];
13402
+ const ringCoordinates = ringToGeoJson(positions, startRingIndex, endRingIndex);
13403
+ coordinates2.push(ringCoordinates);
13404
+ }
13405
+ return {
13406
+ type: "Polygon",
13407
+ coordinates: coordinates2
13408
+ };
13409
+ }
13410
+ const coordinates = [];
13411
+ for (let i = 0; i < polygonIndices.length - 1; i++) {
13412
+ const startPolygonIndex = polygonIndices[i];
13413
+ const endPolygonIndex = polygonIndices[i + 1];
13414
+ const polygonCoordinates = polygonToGeoJson(data, startPolygonIndex, endPolygonIndex).coordinates;
13415
+ coordinates.push(polygonCoordinates);
13416
+ }
13417
+ return {
13418
+ type: "MultiPolygon",
13419
+ coordinates
13420
+ };
13421
+ }
13422
+ function lineStringToGeoJson(data) {
13423
+ let startIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -Infinity;
13424
+ let endIndex = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Infinity;
13425
+ const {
13426
+ positions
13427
+ } = data;
13428
+ const pathIndices = data.pathIndices.value.filter((x) => x >= startIndex && x <= endIndex);
13429
+ const multi = pathIndices.length > 2;
13430
+ if (!multi) {
13431
+ const coordinates2 = ringToGeoJson(positions, pathIndices[0], pathIndices[1]);
13432
+ return {
13433
+ type: "LineString",
13434
+ coordinates: coordinates2
13435
+ };
13436
+ }
13437
+ const coordinates = [];
13438
+ for (let i = 0; i < pathIndices.length - 1; i++) {
13439
+ const ringCoordinates = ringToGeoJson(positions, pathIndices[i], pathIndices[i + 1]);
13440
+ coordinates.push(ringCoordinates);
13441
+ }
13442
+ return {
13443
+ type: "MultiLineString",
13444
+ coordinates
13445
+ };
13446
+ }
13447
+ function pointToGeoJson(data, startIndex, endIndex) {
13448
+ const {
13449
+ positions
13450
+ } = data;
13451
+ const coordinates = ringToGeoJson(positions, startIndex, endIndex);
13452
+ const multi = coordinates.length > 1;
13453
+ if (multi) {
13454
+ return {
13455
+ type: "MultiPoint",
13456
+ coordinates
13457
+ };
13458
+ }
13459
+ return {
13460
+ type: "Point",
13461
+ coordinates: coordinates[0]
13462
+ };
13463
+ }
13464
+ function ringToGeoJson(positions, startIndex, endIndex) {
13465
+ startIndex = startIndex || 0;
13466
+ endIndex = endIndex || positions.value.length / positions.size;
13467
+ const ringCoordinates = [];
13468
+ for (let j = startIndex; j < endIndex; j++) {
13469
+ const coord = Array();
13470
+ for (let k = j * positions.size; k < (j + 1) * positions.size; k++) {
13471
+ coord.push(Number(positions.value[k]));
13472
+ }
13473
+ ringCoordinates.push(coord);
13474
+ }
13475
+ return ringCoordinates;
13476
+ }
13477
+ function parseType(data) {
13478
+ if (data.pathIndices) {
13479
+ return "LineString";
13480
+ }
13481
+ if (data.polygonIndices) {
13482
+ return "Polygon";
13483
+ }
13484
+ return "Point";
13485
+ }
12957
13486
 
12958
- // src/layers/raster-tile-layer.ts
12959
- var renderSubLayers3 = (props) => {
12960
- const tileIndex = props.tile?.index?.q;
12961
- if (!tileIndex)
12962
- return null;
12963
- return new RasterLayer(props, {
12964
- tileIndex
12965
- });
13487
+ // src/layers/vector-tile-layer.ts
13488
+ (0, import_core7.registerLoaders)([carto_vector_tile_loader_default]);
13489
+ var defaultTileFormat = TILE_FORMATS.BINARY;
13490
+ var defaultProps7 = {
13491
+ ...import_geo_layers6.MVTLayer.defaultProps,
13492
+ data: TilejsonPropType,
13493
+ formatTiles: defaultTileFormat
12966
13494
  };
12967
- var RasterTileLayer = class extends import_core7.CompositeLayer {
13495
+ var VectorTileLayer = class extends import_geo_layers6.MVTLayer {
12968
13496
  initializeState() {
13497
+ super.initializeState();
13498
+ const binary = this.props.formatTiles === TILE_FORMATS.BINARY || TILE_FORMATS.MVT;
12969
13499
  this.setState({
12970
- data: null,
12971
- tileJSON: null
13500
+ binary
12972
13501
  });
12973
13502
  }
12974
- updateState({
12975
- changeFlags
12976
- }) {
12977
- if (changeFlags.dataChanged) {
12978
- let {
12979
- data
12980
- } = this.props;
12981
- const tileJSON = data;
12982
- data = tileJSON.tiles;
13503
+ updateState(parameters) {
13504
+ const {
13505
+ props
13506
+ } = parameters;
13507
+ if (props.data) {
13508
+ super.updateState(parameters);
13509
+ const formatTiles = new URL(props.data.tiles[0]).searchParams.get("formatTiles");
13510
+ const mvt = formatTiles === TILE_FORMATS.MVT;
12983
13511
  this.setState({
12984
- data,
12985
- tileJSON
13512
+ mvt
12986
13513
  });
12987
13514
  }
12988
13515
  }
12989
- renderLayers() {
13516
+ getLoadOptions() {
13517
+ const loadOptions = super.getLoadOptions() || {};
13518
+ const tileJSON = this.props.data;
13519
+ injectAccessToken(loadOptions, tileJSON.accessToken);
13520
+ loadOptions.gis = {
13521
+ format: "binary"
13522
+ };
13523
+ return loadOptions;
13524
+ }
13525
+ getTileData(tile) {
13526
+ const url = (0, import_geo_layers6._getURLFromTemplate)(this.state.data, tile);
13527
+ if (!url) {
13528
+ return Promise.reject("Invalid URL");
13529
+ }
13530
+ const loadOptions = this.getLoadOptions();
12990
13531
  const {
12991
- data,
12992
- tileJSON
12993
- } = this.state;
12994
- const minZoom = parseInt(tileJSON?.minzoom);
12995
- const maxZoom = parseInt(tileJSON?.maxzoom);
12996
- return [new SpatialIndexTileLayer(this.props, {
12997
- id: `raster-tile-layer-${this.props.id}`,
12998
- data,
12999
- TilesetClass: QuadbinTileset2D,
13000
- renderSubLayers: renderSubLayers3,
13001
- minZoom,
13002
- maxZoom
13003
- })];
13532
+ fetch: fetch2
13533
+ } = this.props;
13534
+ const {
13535
+ signal
13536
+ } = tile;
13537
+ return fetch2(url, {
13538
+ propName: "data",
13539
+ layer: this,
13540
+ loadOptions,
13541
+ signal
13542
+ });
13543
+ }
13544
+ renderSubLayers(props) {
13545
+ if (props.data === null) {
13546
+ return null;
13547
+ }
13548
+ if (this.state.mvt) {
13549
+ return super.renderSubLayers(props);
13550
+ }
13551
+ const tileBbox = props.tile.bbox;
13552
+ const {
13553
+ west,
13554
+ south,
13555
+ east,
13556
+ north
13557
+ } = tileBbox;
13558
+ const subLayerProps = {
13559
+ ...props,
13560
+ autoHighlight: false,
13561
+ extensions: [new import_extensions.ClipExtension(), ...props.extensions || []],
13562
+ clipBounds: [west, south, east, north]
13563
+ };
13564
+ const subLayer = new import_layers2.GeoJsonLayer(subLayerProps);
13565
+ return subLayer;
13566
+ }
13567
+ getPickingInfo(params) {
13568
+ const info = super.getPickingInfo(params);
13569
+ if (this.state.binary && info.index !== -1) {
13570
+ const {
13571
+ data
13572
+ } = params.sourceLayer.props;
13573
+ info.object = binaryToGeojson(data, {
13574
+ globalFeatureId: info.index
13575
+ });
13576
+ }
13577
+ return info;
13004
13578
  }
13005
13579
  };
13006
- __publicField(RasterTileLayer, "layerName", "RasterTileLayer");
13007
- __publicField(RasterTileLayer, "defaultProps", {});
13580
+ __publicField(VectorTileLayer, "layerName", "VectorTileLayer");
13581
+ __publicField(VectorTileLayer, "defaultProps", defaultProps7);
13008
13582
 
13009
13583
  // src/api/layer-map.ts
13010
13584
  var SCALE_FUNCS = {
@@ -13086,7 +13660,7 @@ void main(void) {
13086
13660
  elevationPercentile: ["elevationLowerPercentile", "elevationUpperPercentile"],
13087
13661
  percentile: ["lowerPercentile", "upperPercentile"]
13088
13662
  };
13089
- var defaultProps7 = {
13663
+ var defaultProps8 = {
13090
13664
  lineMiterLimit: 2,
13091
13665
  lineWidthUnits: "pixels",
13092
13666
  pointRadiusUnits: "pixels",
@@ -13187,12 +13761,12 @@ void main(void) {
13187
13761
  }
13188
13762
  };
13189
13763
  const layer = layerTypeDefs[type];
13190
- assert2(layer, `Unsupported layer type: ${type}`);
13764
+ assert(layer, `Unsupported layer type: ${type}`);
13191
13765
  return {
13192
13766
  ...layer,
13193
13767
  propMap: mergePropMaps(basePropMap, layer.propMap),
13194
13768
  defaultProps: {
13195
- ...defaultProps7,
13769
+ ...defaultProps8,
13196
13770
  ...layer.defaultProps
13197
13771
  }
13198
13772
  };
@@ -13207,10 +13781,7 @@ void main(void) {
13207
13781
  if (scheme === "quadbin") {
13208
13782
  return QuadbinTileLayer;
13209
13783
  }
13210
- if (formatTiles === "mvt") {
13211
- return import_geo_layers7.MVTLayer;
13212
- }
13213
- return CartoTileLayer;
13784
+ return VectorTileLayer;
13214
13785
  }
13215
13786
  function getTileLayer(dataset, basePropMap) {
13216
13787
  const {
@@ -13226,7 +13797,7 @@ void main(void) {
13226
13797
  Layer: layerFromTileDataset(formatTiles, scheme),
13227
13798
  propMap: basePropMap,
13228
13799
  defaultProps: {
13229
- ...defaultProps7,
13800
+ ...defaultProps8,
13230
13801
  ...aggregationExp && {
13231
13802
  aggregationExp
13232
13803
  },
@@ -13485,7 +14056,7 @@ void main(void) {
13485
14056
  }
13486
14057
  };
13487
14058
  __publicField(EnhancedTextLayer, "layerName", "EnhancedTextLayer");
13488
- var defaultProps8 = {
14059
+ var defaultProps9 = {
13489
14060
  ...import_layers4.TextLayer.defaultProps,
13490
14061
  getRadius: {
13491
14062
  type: "accessor",
@@ -13552,7 +14123,7 @@ void main(void) {
13552
14123
  }
13553
14124
  return backgroundPadding;
13554
14125
  }
13555
- renderTextLayer(id, {
14126
+ renderTextLayer(id4, {
13556
14127
  updateTriggers: updateTriggersOverride = {},
13557
14128
  ...props
13558
14129
  }) {
@@ -13573,7 +14144,7 @@ void main(void) {
13573
14144
  updateTriggers
13574
14145
  } = this.props;
13575
14146
  return new EnhancedTextLayer(this.getSubLayerProps({
13576
- id,
14147
+ id: id4,
13577
14148
  data,
13578
14149
  characterSet,
13579
14150
  fontFamily,
@@ -13637,7 +14208,7 @@ void main(void) {
13637
14208
  }
13638
14209
  };
13639
14210
  __publicField(PointLabelLayer, "layerName", "PointLabelLayer");
13640
- __publicField(PointLabelLayer, "defaultProps", defaultProps8);
14211
+ __publicField(PointLabelLayer, "defaultProps", defaultProps9);
13641
14212
 
13642
14213
  // src/api/parseMap.ts
13643
14214
  var import_core9 = __toESM(require_core());
@@ -13649,7 +14220,7 @@ void main(void) {
13649
14220
  datasets,
13650
14221
  token
13651
14222
  } = json;
13652
- assert2(keplerMapConfig.version === "v1", "Only support Kepler v1");
14223
+ assert(keplerMapConfig.version === "v1", "Only support Kepler v1");
13653
14224
  const {
13654
14225
  mapState,
13655
14226
  mapStyle
@@ -13669,7 +14240,7 @@ void main(void) {
13669
14240
  mapStyle,
13670
14241
  token,
13671
14242
  layers: layers.reverse().map(({
13672
- id,
14243
+ id: id4,
13673
14244
  type,
13674
14245
  config,
13675
14246
  visualChannels
@@ -13679,24 +14250,24 @@ void main(void) {
13679
14250
  dataId
13680
14251
  } = config;
13681
14252
  const dataset = datasets.find((d) => d.id === dataId);
13682
- assert2(dataset, `No dataset matching dataId: ${dataId}`);
14253
+ assert(dataset, `No dataset matching dataId: ${dataId}`);
13683
14254
  const {
13684
14255
  data
13685
14256
  } = dataset;
13686
- assert2(data, `No data loaded for dataId: ${dataId}`);
14257
+ assert(data, `No data loaded for dataId: ${dataId}`);
13687
14258
  const {
13688
14259
  Layer,
13689
14260
  propMap,
13690
- defaultProps: defaultProps10
14261
+ defaultProps: defaultProps11
13691
14262
  } = getLayer(type, config, dataset);
13692
14263
  const styleProps = createStyleProps(config, propMap);
13693
14264
  return new Layer({
13694
- id,
14265
+ id: id4,
13695
14266
  data,
13696
- ...defaultProps10,
14267
+ ...defaultProps11,
13697
14268
  ...createInteractionProps(interactionConfig),
13698
14269
  ...styleProps,
13699
- ...createChannelProps(id, type, config, visualChannels, data),
14270
+ ...createChannelProps(id4, type, config, visualChannels, data),
13700
14271
  ...createParametersProp(layerBlending, styleProps.parameters || {}),
13701
14272
  ...createLoadOptions(token)
13702
14273
  });
@@ -13761,7 +14332,7 @@ void main(void) {
13761
14332
  result.highlightColor = config.visConfig.enable3d ? [255, 255, 255, 60] : [252, 242, 26, 255];
13762
14333
  return result;
13763
14334
  }
13764
- function createChannelProps(id, type, config, visualChannels, data) {
14335
+ function createChannelProps(id4, type, config, visualChannels, data) {
13765
14336
  const {
13766
14337
  colorField,
13767
14338
  colorScale,
@@ -13914,7 +14485,7 @@ void main(void) {
13914
14485
  }
13915
14486
  if (textLabel && textLabel.length && textLabel[0].field) {
13916
14487
  const [mainLabel, secondaryLabel] = textLabel;
13917
- const collisionGroup = id;
14488
+ const collisionGroup = id4;
13918
14489
  ({
13919
14490
  alignment: result.getTextAlignmentBaseline,
13920
14491
  anchor: result.getTextAnchor,
@@ -13975,9 +14546,9 @@ void main(void) {
13975
14546
 
13976
14547
  // src/api/maps-v3-client.ts
13977
14548
  var import_core10 = __toESM(require_core());
13978
- var MAX_GET_LENGTH = 8192;
13979
- var DEFAULT_CLIENT = "deck-gl-carto";
13980
- var V3_MINOR_VERSION = "3.1";
14549
+ var MAX_GET_LENGTH2 = 8192;
14550
+ var DEFAULT_CLIENT2 = "deck-gl-carto";
14551
+ var V3_MINOR_VERSION2 = "3.2";
13981
14552
  async function request2({
13982
14553
  method,
13983
14554
  url,
@@ -14043,15 +14614,6 @@ void main(void) {
14043
14614
  body,
14044
14615
  errorContext
14045
14616
  }) {
14046
- if (format2 === FORMATS.NDJSON) {
14047
- return request2({
14048
- method,
14049
- url,
14050
- accessToken,
14051
- body,
14052
- errorContext
14053
- });
14054
- }
14055
14617
  const data = await requestJson({
14056
14618
  method,
14057
14619
  url,
@@ -14072,8 +14634,8 @@ void main(void) {
14072
14634
  queryParameters
14073
14635
  }) {
14074
14636
  const parameters = {
14075
- client: clientId || DEFAULT_CLIENT,
14076
- v: V3_MINOR_VERSION
14637
+ client: clientId || DEFAULT_CLIENT2,
14638
+ v: V3_MINOR_VERSION2
14077
14639
  };
14078
14640
  const sourceName = type === MAP_TYPES.QUERY ? "q" : "name";
14079
14641
  parameters[sourceName] = source;
@@ -14140,7 +14702,7 @@ void main(void) {
14140
14702
  type,
14141
14703
  source
14142
14704
  };
14143
- if (url.length > MAX_GET_LENGTH && type === MAP_TYPES.QUERY) {
14705
+ if (url.length > MAX_GET_LENGTH2 && type === MAP_TYPES.QUERY) {
14144
14706
  return await requestJson({
14145
14707
  method: "POST",
14146
14708
  url: baseUrl2,
@@ -14174,20 +14736,20 @@ void main(void) {
14174
14736
  aggregationExp,
14175
14737
  aggregationResLevel
14176
14738
  }) {
14177
- assert2(connection, "Must define connection");
14178
- assert2(type, "Must define a type");
14179
- assert2(source, "Must define a source");
14180
- assert2(credentials2.apiVersion === API_VERSIONS.V3, "Method only available for v3");
14181
- assert2(credentials2.apiBaseUrl, "Must define apiBaseUrl");
14182
- assert2(credentials2.accessToken, "Must define an accessToken");
14739
+ assert(connection, "Must define connection");
14740
+ assert(type, "Must define a type");
14741
+ assert(source, "Must define a source");
14742
+ assert(credentials2.apiVersion === API_VERSIONS.V3, "Method only available for v3");
14743
+ assert(credentials2.apiBaseUrl, "Must define apiBaseUrl");
14744
+ assert(credentials2.accessToken, "Must define an accessToken");
14183
14745
  if (columns) {
14184
- assert2(COLUMNS_SUPPORT.includes(type), `The columns parameter is not supported by type ${type}`);
14746
+ assert(COLUMNS_SUPPORT.includes(type), `The columns parameter is not supported by type ${type}`);
14185
14747
  }
14186
14748
  if (geoColumn) {
14187
- assert2(GEO_COLUMN_SUPPORT.includes(type), `The geoColumn parameter is not supported by type ${type}`);
14749
+ assert(GEO_COLUMN_SUPPORT.includes(type), `The geoColumn parameter is not supported by type ${type}`);
14188
14750
  } else {
14189
- assert2(!aggregationExp, "Have aggregationExp, but geoColumn parameter is missing");
14190
- assert2(!aggregationResLevel, "Have aggregationResLevel, but geoColumn parameter is missing");
14751
+ assert(!aggregationExp, "Have aggregationExp, but geoColumn parameter is missing");
14752
+ assert(!aggregationResLevel, "Have aggregationResLevel, but geoColumn parameter is missing");
14191
14753
  }
14192
14754
  }
14193
14755
  async function fetchLayerData({
@@ -14295,9 +14857,9 @@ void main(void) {
14295
14857
  if (format2) {
14296
14858
  mapFormat = format2;
14297
14859
  url = getUrlFromMetadata(metadata, format2);
14298
- assert2(url, `Format ${format2} not available`);
14860
+ assert(url, `Format ${format2} not available`);
14299
14861
  } else {
14300
- const prioritizedFormats = [FORMATS.GEOJSON, FORMATS.JSON, FORMATS.NDJSON, FORMATS.TILEJSON];
14862
+ const prioritizedFormats = [FORMATS.GEOJSON, FORMATS.JSON, FORMATS.TILEJSON];
14301
14863
  for (const f of prioritizedFormats) {
14302
14864
  url = getUrlFromMetadata(metadata, f);
14303
14865
  if (url) {
@@ -14305,7 +14867,7 @@ void main(void) {
14305
14867
  break;
14306
14868
  }
14307
14869
  }
14308
- assert2(url && mapFormat, "Unsupported data formats received from backend.");
14870
+ assert(url && mapFormat, "Unsupported data formats received from backend.");
14309
14871
  }
14310
14872
  if (format2 === FORMATS.TILEJSON && formatTiles) {
14311
14873
  import_core10.log.assert(Object.values(TILE_FORMATS).includes(formatTiles), `Invalid value for formatTiles: ${formatTiles}. Use value from TILE_FORMATS`);
@@ -14396,7 +14958,7 @@ void main(void) {
14396
14958
  url += `?${encodeParameter("q", source)}`;
14397
14959
  }
14398
14960
  let stats;
14399
- if (url.length > MAX_GET_LENGTH && type === MAP_TYPES.QUERY) {
14961
+ if (url.length > MAX_GET_LENGTH2 && type === MAP_TYPES.QUERY) {
14400
14962
  stats = await requestJson({
14401
14963
  method: "POST",
14402
14964
  url: baseUrl2,
@@ -14481,16 +15043,16 @@ void main(void) {
14481
15043
  const {
14482
15044
  accessToken
14483
15045
  } = localCreds;
14484
- assert2(cartoMapId, 'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})');
14485
- assert2(localCreds.apiVersion === API_VERSIONS.V3, "Method only available for v3");
14486
- assert2(localCreds.apiBaseUrl, "Must define apiBaseUrl");
15046
+ assert(cartoMapId, 'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})');
15047
+ assert(localCreds.apiVersion === API_VERSIONS.V3, "Method only available for v3");
15048
+ assert(localCreds.apiBaseUrl, "Must define apiBaseUrl");
14487
15049
  if (!localCreds.mapsUrl) {
14488
15050
  localCreds.mapsUrl = buildMapsUrlFromBase(localCreds.apiBaseUrl);
14489
15051
  }
14490
15052
  if (autoRefresh || onNewData) {
14491
- assert2(onNewData, "Must define `onNewData` when using autoRefresh");
14492
- assert2(typeof onNewData === "function", "`onNewData` must be a function");
14493
- assert2(typeof autoRefresh === "number" && autoRefresh > 0, "`autoRefresh` must be a positive number");
15053
+ assert(onNewData, "Must define `onNewData` when using autoRefresh");
15054
+ assert(typeof onNewData === "function", "`onNewData` must be a function");
15055
+ assert(typeof autoRefresh === "number" && autoRefresh > 0, "`autoRefresh` must be a positive number");
14494
15056
  }
14495
15057
  const url = `${localCreds.mapsUrl}/public/${cartoMapId}`;
14496
15058
  const errorContext = {
@@ -14554,7 +15116,7 @@ void main(void) {
14554
15116
  }
14555
15117
 
14556
15118
  // src/layers/carto-layer.ts
14557
- var defaultProps9 = {
15119
+ var defaultProps10 = {
14558
15120
  data: null,
14559
15121
  type: null,
14560
15122
  onDataLoad: {
@@ -14699,14 +15261,14 @@ void main(void) {
14699
15261
  }
14700
15262
  }
14701
15263
  _getSubLayerAndProps() {
14702
- assert2(this.state);
15264
+ assert(this.state);
14703
15265
  const {
14704
15266
  data,
14705
15267
  apiVersion
14706
15268
  } = this.state;
14707
15269
  const {
14708
15270
  uniqueIdProperty
14709
- } = defaultProps9;
15271
+ } = defaultProps10;
14710
15272
  const {
14711
15273
  data: _notUsed,
14712
15274
  ...propsNoData
@@ -14723,7 +15285,7 @@ void main(void) {
14723
15285
  return [layerFromTileDataset(props.formatTiles, data.scheme, props.type), props];
14724
15286
  }
14725
15287
  renderLayers() {
14726
- assert2(this.state);
15288
+ assert(this.state);
14727
15289
  const {
14728
15290
  apiVersion,
14729
15291
  data
@@ -14761,7 +15323,7 @@ void main(void) {
14761
15323
  }
14762
15324
  };
14763
15325
  __publicField(CartoLayer, "layerName", "CartoLayer");
14764
- __publicField(CartoLayer, "defaultProps", defaultProps9);
15326
+ __publicField(CartoLayer, "defaultProps", defaultProps10);
14765
15327
 
14766
15328
  // src/basemap.ts
14767
15329
  var baseUrl = "https://basemaps.cartocdn.com/gl/{basemap}-gl-style/style.json";
@@ -14885,6 +15447,296 @@ void main(void) {
14885
15447
  };
14886
15448
  }
14887
15449
 
15450
+ // src/sources/utils.ts
15451
+ async function requestWithParameters({
15452
+ baseUrl: baseUrl2,
15453
+ parameters,
15454
+ headers: customHeaders,
15455
+ errorContext
15456
+ }) {
15457
+ let url = baseUrl2;
15458
+ if (parameters) {
15459
+ const allParameters = {
15460
+ ...DEFAULT_PARAMETERS,
15461
+ ...parameters
15462
+ };
15463
+ const encodedParameters = Object.entries(allParameters).map(([key, value]) => {
15464
+ return encodeParameter(key, value);
15465
+ });
15466
+ url += `?${encodedParameters.join("&")}`;
15467
+ }
15468
+ const headers = {
15469
+ ...DEFAULT_HEADERS,
15470
+ ...customHeaders
15471
+ };
15472
+ try {
15473
+ let response;
15474
+ if (url.length > MAX_GET_LENGTH) {
15475
+ response = await fetch(url, {
15476
+ method: "POST",
15477
+ body: JSON.stringify(parameters),
15478
+ headers
15479
+ });
15480
+ } else {
15481
+ response = await fetch(url, {
15482
+ headers
15483
+ });
15484
+ }
15485
+ let json;
15486
+ try {
15487
+ json = await response.json();
15488
+ } catch {
15489
+ json = {
15490
+ error: ""
15491
+ };
15492
+ }
15493
+ if (!response.ok) {
15494
+ throw new CartoAPIError(json.error, errorContext, response);
15495
+ }
15496
+ return json;
15497
+ } catch (error) {
15498
+ throw new CartoAPIError(error, errorContext);
15499
+ }
15500
+ }
15501
+ function buildApiEndpoint({
15502
+ apiBaseUrl,
15503
+ connectionName,
15504
+ endpoint,
15505
+ mapsUrl: mapsUrl2
15506
+ }) {
15507
+ return `${mapsUrl2 || buildMapsUrlFromBase(apiBaseUrl)}/${connectionName}/${endpoint}`;
15508
+ }
15509
+
15510
+ // src/sources/base-source.ts
15511
+ async function cartoBaseSource(endpoint, options, urlParameters) {
15512
+ const mergedOptions = {
15513
+ ...SOURCE_DEFAULTS,
15514
+ ...options,
15515
+ endpoint
15516
+ };
15517
+ const baseUrl2 = buildApiEndpoint(mergedOptions);
15518
+ const {
15519
+ accessToken,
15520
+ format: format2
15521
+ } = mergedOptions;
15522
+ const headers = {
15523
+ Authorization: `Bearer ${options.accessToken}`,
15524
+ ...options.headers
15525
+ };
15526
+ const errorContext = {
15527
+ requestType: "Map instantiation",
15528
+ connection: options.connectionName,
15529
+ type: endpoint,
15530
+ source: JSON.stringify(urlParameters, void 0, 2)
15531
+ };
15532
+ const mapInstantiation2 = await requestWithParameters({
15533
+ baseUrl: baseUrl2,
15534
+ parameters: urlParameters,
15535
+ headers,
15536
+ errorContext
15537
+ });
15538
+ const dataUrl = mapInstantiation2[format2].url[0];
15539
+ errorContext.requestType = "Map data";
15540
+ if (format2 === "tilejson") {
15541
+ const tilejson = await requestWithParameters({
15542
+ baseUrl: dataUrl,
15543
+ headers,
15544
+ errorContext
15545
+ });
15546
+ return {
15547
+ ...tilejson,
15548
+ accessToken
15549
+ };
15550
+ }
15551
+ return await requestWithParameters({
15552
+ baseUrl: dataUrl,
15553
+ headers,
15554
+ errorContext
15555
+ });
15556
+ }
15557
+
15558
+ // src/sources/h3-query-source.ts
15559
+ var cartoH3QuerySource = async function(options) {
15560
+ const {
15561
+ aggregationExp,
15562
+ aggregationResLevel = 4,
15563
+ sqlQuery,
15564
+ spatialDataColumn = "h3:h3",
15565
+ queryParameters
15566
+ } = options;
15567
+ const urlParameters = {
15568
+ aggregationExp,
15569
+ q: sqlQuery
15570
+ };
15571
+ if (aggregationResLevel) {
15572
+ urlParameters.aggregationResLevel = String(aggregationResLevel);
15573
+ }
15574
+ if (spatialDataColumn) {
15575
+ urlParameters.geo_column = spatialDataColumn;
15576
+ }
15577
+ if (queryParameters) {
15578
+ urlParameters.queryParameters = JSON.stringify(queryParameters);
15579
+ }
15580
+ return cartoBaseSource("query", options, urlParameters);
15581
+ };
15582
+
15583
+ // src/sources/h3-table-source.ts
15584
+ var cartoH3TableSource = async function(options) {
15585
+ const {
15586
+ aggregationExp,
15587
+ aggregationResLevel = 4,
15588
+ columns,
15589
+ spatialDataColumn = "h3:h3",
15590
+ tableName
15591
+ } = options;
15592
+ const urlParameters = {
15593
+ aggregationExp,
15594
+ name: tableName
15595
+ };
15596
+ if (aggregationResLevel) {
15597
+ urlParameters.aggregationResLevel = String(aggregationResLevel);
15598
+ }
15599
+ if (columns) {
15600
+ urlParameters.columns = columns.join(",");
15601
+ }
15602
+ if (spatialDataColumn) {
15603
+ urlParameters.geo_column = spatialDataColumn;
15604
+ }
15605
+ return cartoBaseSource("table", options, urlParameters);
15606
+ };
15607
+
15608
+ // src/sources/h3-tileset-source.ts
15609
+ var cartoH3TilesetSource = async function(options) {
15610
+ const {
15611
+ tableName
15612
+ } = options;
15613
+ const urlParameters = {
15614
+ name: tableName
15615
+ };
15616
+ return cartoBaseSource("tileset", options, urlParameters);
15617
+ };
15618
+
15619
+ // src/sources/raster-source.ts
15620
+ var cartoRasterSource = async function(options) {
15621
+ const {
15622
+ tableName
15623
+ } = options;
15624
+ const urlParameters = {
15625
+ name: tableName
15626
+ };
15627
+ return cartoBaseSource("raster", options, urlParameters);
15628
+ };
15629
+
15630
+ // src/sources/quadbin-query-source.ts
15631
+ var cartoQuadbinQuerySource = async function(options) {
15632
+ const {
15633
+ aggregationExp,
15634
+ aggregationResLevel = 6,
15635
+ sqlQuery,
15636
+ spatialDataColumn = "quadbin:quadbin",
15637
+ queryParameters
15638
+ } = options;
15639
+ const urlParameters = {
15640
+ aggregationExp,
15641
+ q: sqlQuery
15642
+ };
15643
+ if (aggregationResLevel) {
15644
+ urlParameters.aggregationResLevel = String(aggregationResLevel);
15645
+ }
15646
+ if (spatialDataColumn) {
15647
+ urlParameters.geo_column = spatialDataColumn;
15648
+ }
15649
+ if (queryParameters) {
15650
+ urlParameters.queryParameters = JSON.stringify(queryParameters);
15651
+ }
15652
+ return cartoBaseSource("query", options, urlParameters);
15653
+ };
15654
+
15655
+ // src/sources/quadbin-table-source.ts
15656
+ var cartoQuadbinTableSource = async function(options) {
15657
+ const {
15658
+ aggregationExp,
15659
+ aggregationResLevel = 6,
15660
+ columns,
15661
+ spatialDataColumn = "quadbin:quadbin",
15662
+ tableName
15663
+ } = options;
15664
+ const urlParameters = {
15665
+ aggregationExp,
15666
+ name: tableName
15667
+ };
15668
+ if (aggregationResLevel) {
15669
+ urlParameters.aggregationResLevel = String(aggregationResLevel);
15670
+ }
15671
+ if (columns) {
15672
+ urlParameters.columns = columns.join(",");
15673
+ }
15674
+ if (spatialDataColumn) {
15675
+ urlParameters.geo_column = spatialDataColumn;
15676
+ }
15677
+ return cartoBaseSource("table", options, urlParameters);
15678
+ };
15679
+
15680
+ // src/sources/quadbin-tileset-source.ts
15681
+ var cartoQuadbinTilesetSource = async function(options) {
15682
+ const {
15683
+ tableName
15684
+ } = options;
15685
+ const urlParameters = {
15686
+ name: tableName
15687
+ };
15688
+ return cartoBaseSource("tileset", options, urlParameters);
15689
+ };
15690
+
15691
+ // src/sources/vector-query-source.ts
15692
+ var cartoVectorQuerySource = async function(options) {
15693
+ const {
15694
+ spatialDataColumn,
15695
+ sqlQuery,
15696
+ queryParameters
15697
+ } = options;
15698
+ const urlParameters = {
15699
+ q: sqlQuery
15700
+ };
15701
+ if (spatialDataColumn) {
15702
+ urlParameters.geo_column = spatialDataColumn;
15703
+ }
15704
+ if (queryParameters) {
15705
+ urlParameters.queryParameters = JSON.stringify(queryParameters);
15706
+ }
15707
+ return cartoBaseSource("query", options, urlParameters);
15708
+ };
15709
+
15710
+ // src/sources/vector-table-source.ts
15711
+ var cartoVectorTableSource = async function(options) {
15712
+ const {
15713
+ columns,
15714
+ spatialDataColumn,
15715
+ tableName
15716
+ } = options;
15717
+ const urlParameters = {
15718
+ name: tableName
15719
+ };
15720
+ if (columns) {
15721
+ urlParameters.columns = columns.join(",");
15722
+ }
15723
+ if (spatialDataColumn) {
15724
+ urlParameters.geo_column = spatialDataColumn;
15725
+ }
15726
+ return cartoBaseSource("table", options, urlParameters);
15727
+ };
15728
+
15729
+ // src/sources/vector-tileset-source.ts
15730
+ var cartoVectorTilesetSource = async function(options) {
15731
+ const {
15732
+ tableName
15733
+ } = options;
15734
+ const urlParameters = {
15735
+ name: tableName
15736
+ };
15737
+ return cartoBaseSource("tileset", options, urlParameters);
15738
+ };
15739
+
14888
15740
  // ../layers/bundle/peer-dependency.ts
14889
15741
  var peer_dependency_exports = {};
14890
15742
  var import_layers5 = __toESM(require_layers());