@deck.gl/carto 9.0.35 → 9.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/dist/api/basemap.d.ts +2 -1
  2. package/dist/api/basemap.d.ts.map +1 -1
  3. package/dist/api/basemap.js +3 -0
  4. package/dist/api/fetch-map.d.ts.map +1 -1
  5. package/dist/api/fetch-map.js +9 -11
  6. package/dist/api/index.d.ts +1 -4
  7. package/dist/api/index.d.ts.map +1 -1
  8. package/dist/api/index.js +3 -2
  9. package/dist/api/layer-map.d.ts.map +1 -1
  10. package/dist/api/layer-map.js +5 -2
  11. package/dist/api/parse-map.d.ts.map +1 -1
  12. package/dist/api/parse-map.js +3 -0
  13. package/dist/api/types.d.ts +0 -56
  14. package/dist/api/types.d.ts.map +1 -1
  15. package/dist/api/types.js +4 -20
  16. package/dist/basemap.d.ts +2 -1
  17. package/dist/basemap.d.ts.map +1 -1
  18. package/dist/basemap.js +4 -1
  19. package/dist/cartoRasterTile-worker.js +25 -2
  20. package/dist/cartoSpatialTile-worker.js +28 -3
  21. package/dist/cartoVectorTile-worker.js +29 -3
  22. package/dist/constants.d.ts +0 -3
  23. package/dist/constants.d.ts.map +1 -1
  24. package/dist/constants.js +3 -3
  25. package/dist/dist.dev.js +4391 -3737
  26. package/dist/index.cjs +224 -531
  27. package/dist/index.cjs.map +4 -4
  28. package/dist/index.d.ts +16 -16
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +5 -2
  31. package/dist/layers/cluster-tile-layer.d.ts +1 -1
  32. package/dist/layers/cluster-tile-layer.d.ts.map +1 -1
  33. package/dist/layers/cluster-tile-layer.js +4 -0
  34. package/dist/layers/cluster-utils.d.ts.map +1 -1
  35. package/dist/layers/cluster-utils.js +3 -0
  36. package/dist/layers/h3-tile-layer.d.ts +1 -1
  37. package/dist/layers/h3-tile-layer.d.ts.map +1 -1
  38. package/dist/layers/h3-tile-layer.js +3 -0
  39. package/dist/layers/h3-tileset-2d.d.ts.map +1 -1
  40. package/dist/layers/h3-tileset-2d.js +3 -0
  41. package/dist/layers/heatmap-tile-layer.d.ts +1 -1
  42. package/dist/layers/heatmap-tile-layer.d.ts.map +1 -1
  43. package/dist/layers/heatmap-tile-layer.js +23 -7
  44. package/dist/layers/heatmap.d.ts +3 -3
  45. package/dist/layers/heatmap.d.ts.map +1 -1
  46. package/dist/layers/heatmap.js +69 -36
  47. package/dist/layers/point-label-layer.d.ts.map +1 -1
  48. package/dist/layers/point-label-layer.js +5 -2
  49. package/dist/layers/post-process-utils.d.ts.map +1 -1
  50. package/dist/layers/post-process-utils.js +9 -5
  51. package/dist/layers/quadbin-layer.d.ts.map +1 -1
  52. package/dist/layers/quadbin-layer.js +3 -0
  53. package/dist/layers/quadbin-tile-layer.d.ts +1 -1
  54. package/dist/layers/quadbin-tile-layer.d.ts.map +1 -1
  55. package/dist/layers/quadbin-tile-layer.js +3 -0
  56. package/dist/layers/quadbin-tileset-2d.d.ts.map +1 -1
  57. package/dist/layers/quadbin-tileset-2d.js +3 -0
  58. package/dist/layers/quadbin-utils.d.ts.map +1 -1
  59. package/dist/layers/quadbin-utils.js +3 -0
  60. package/dist/layers/raster-layer-vertex.glsl.d.ts +1 -1
  61. package/dist/layers/raster-layer-vertex.glsl.d.ts.map +1 -1
  62. package/dist/layers/raster-layer-vertex.glsl.js +19 -24
  63. package/dist/layers/raster-layer.d.ts +6 -6
  64. package/dist/layers/raster-layer.d.ts.map +1 -1
  65. package/dist/layers/raster-layer.js +6 -1
  66. package/dist/layers/raster-tile-layer.d.ts +1 -1
  67. package/dist/layers/raster-tile-layer.d.ts.map +1 -1
  68. package/dist/layers/raster-tile-layer.js +3 -0
  69. package/dist/layers/schema/carto-properties-tile-loader.d.ts.map +1 -1
  70. package/dist/layers/schema/carto-properties-tile-loader.js +3 -0
  71. package/dist/layers/schema/carto-properties-tile.d.ts.map +1 -1
  72. package/dist/layers/schema/carto-properties-tile.js +3 -0
  73. package/dist/layers/schema/carto-raster-tile-loader.d.ts.map +1 -1
  74. package/dist/layers/schema/carto-raster-tile-loader.js +4 -1
  75. package/dist/layers/schema/carto-raster-tile.d.ts.map +1 -1
  76. package/dist/layers/schema/carto-raster-tile.js +3 -0
  77. package/dist/layers/schema/carto-spatial-tile-loader.d.ts.map +1 -1
  78. package/dist/layers/schema/carto-spatial-tile-loader.js +4 -1
  79. package/dist/layers/schema/carto-spatial-tile.d.ts.map +1 -1
  80. package/dist/layers/schema/carto-spatial-tile.js +3 -0
  81. package/dist/layers/schema/carto-tile.d.ts.map +1 -1
  82. package/dist/layers/schema/carto-tile.js +3 -0
  83. package/dist/layers/schema/carto-vector-tile-loader.d.ts.map +1 -1
  84. package/dist/layers/schema/carto-vector-tile-loader.js +4 -1
  85. package/dist/layers/schema/fast-pbf.d.ts.map +1 -1
  86. package/dist/layers/schema/fast-pbf.js +3 -0
  87. package/dist/layers/schema/spatialjson-utils.d.ts.map +1 -1
  88. package/dist/layers/schema/spatialjson-utils.js +3 -0
  89. package/dist/layers/schema/tile-loader-utils.d.ts.map +1 -1
  90. package/dist/layers/schema/tile-loader-utils.js +3 -0
  91. package/dist/layers/spatial-index-tile-layer.d.ts.map +1 -1
  92. package/dist/layers/spatial-index-tile-layer.js +3 -0
  93. package/dist/layers/utils.d.ts +2 -2
  94. package/dist/layers/utils.d.ts.map +1 -1
  95. package/dist/layers/utils.js +3 -0
  96. package/dist/layers/vector-tile-layer.d.ts +1 -1
  97. package/dist/layers/vector-tile-layer.d.ts.map +1 -1
  98. package/dist/layers/vector-tile-layer.js +3 -0
  99. package/dist/style/color-bins-style.d.ts.map +1 -1
  100. package/dist/style/color-bins-style.js +3 -0
  101. package/dist/style/color-categories-style.d.ts.map +1 -1
  102. package/dist/style/color-categories-style.js +3 -0
  103. package/dist/style/color-continuous-style.d.ts.map +1 -1
  104. package/dist/style/color-continuous-style.js +3 -0
  105. package/dist/style/palette.d.ts.map +1 -1
  106. package/dist/style/palette.js +3 -0
  107. package/dist/style/utils.d.ts.map +1 -1
  108. package/dist/style/utils.js +3 -0
  109. package/dist/utils.d.ts.map +1 -1
  110. package/dist/utils.js +3 -0
  111. package/dist/workers/cartoRasterTile.js +3 -0
  112. package/dist/workers/cartoSpatialTile.js +3 -0
  113. package/dist/workers/cartoVectorTile.js +3 -0
  114. package/dist.min.js +113 -73
  115. package/package.json +13 -11
  116. package/src/api/basemap.ts +6 -1
  117. package/src/api/fetch-map.ts +23 -15
  118. package/src/api/index.ts +5 -13
  119. package/src/api/layer-map.ts +6 -2
  120. package/src/api/parse-map.ts +4 -0
  121. package/src/api/types.ts +4 -75
  122. package/src/basemap.ts +6 -2
  123. package/src/constants.ts +4 -4
  124. package/src/index.ts +7 -9
  125. package/src/layers/cluster-tile-layer.ts +6 -1
  126. package/src/layers/cluster-utils.ts +4 -0
  127. package/src/layers/h3-tile-layer.ts +5 -1
  128. package/src/layers/h3-tileset-2d.ts +4 -0
  129. package/src/layers/heatmap-tile-layer.ts +29 -8
  130. package/src/layers/heatmap.ts +8 -2
  131. package/src/layers/point-label-layer.ts +6 -2
  132. package/src/layers/post-process-utils.ts +10 -5
  133. package/src/layers/quadbin-layer.ts +4 -0
  134. package/src/layers/quadbin-tile-layer.ts +5 -1
  135. package/src/layers/quadbin-tileset-2d.ts +4 -0
  136. package/src/layers/quadbin-utils.ts +4 -0
  137. package/src/layers/raster-layer-vertex.glsl.ts +20 -26
  138. package/src/layers/raster-layer.ts +7 -1
  139. package/src/layers/raster-tile-layer.ts +5 -1
  140. package/src/layers/schema/carto-properties-tile-loader.ts +4 -0
  141. package/src/layers/schema/carto-properties-tile.ts +4 -0
  142. package/src/layers/schema/carto-raster-tile-loader.ts +4 -0
  143. package/src/layers/schema/carto-raster-tile.ts +4 -0
  144. package/src/layers/schema/carto-spatial-tile-loader.ts +4 -0
  145. package/src/layers/schema/carto-spatial-tile.ts +4 -0
  146. package/src/layers/schema/carto-tile.ts +4 -0
  147. package/src/layers/schema/carto-vector-tile-loader.ts +4 -0
  148. package/src/layers/schema/fast-pbf.ts +4 -0
  149. package/src/layers/schema/spatialjson-utils.ts +4 -0
  150. package/src/layers/schema/tile-loader-utils.ts +4 -0
  151. package/src/layers/spatial-index-tile-layer.ts +4 -0
  152. package/src/layers/utils.ts +5 -1
  153. package/src/layers/vector-tile-layer.ts +5 -1
  154. package/src/style/color-bins-style.ts +4 -0
  155. package/src/style/color-categories-style.ts +4 -0
  156. package/src/style/color-continuous-style.ts +4 -0
  157. package/src/style/palette.ts +4 -0
  158. package/src/style/utils.ts +4 -0
  159. package/src/utils.ts +4 -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/dist/api/carto-api-error.d.ts +0 -19
  164. package/dist/api/carto-api-error.d.ts.map +0 -1
  165. package/dist/api/carto-api-error.js +0 -48
  166. package/dist/api/common.d.ts +0 -5
  167. package/dist/api/common.d.ts.map +0 -1
  168. package/dist/api/common.js +0 -5
  169. package/dist/api/endpoints.d.ts +0 -23
  170. package/dist/api/endpoints.d.ts.map +0 -1
  171. package/dist/api/endpoints.js +0 -22
  172. package/dist/api/query.d.ts +0 -4
  173. package/dist/api/query.d.ts.map +0 -1
  174. package/dist/api/query.js +0 -26
  175. package/dist/api/request-with-parameters.d.ts +0 -9
  176. package/dist/api/request-with-parameters.d.ts.map +0 -1
  177. package/dist/api/request-with-parameters.js +0 -86
  178. package/dist/sources/base-source.d.ts +0 -5
  179. package/dist/sources/base-source.d.ts.map +0 -1
  180. package/dist/sources/base-source.js +0 -60
  181. package/dist/sources/boundary-query-source.d.ts +0 -10
  182. package/dist/sources/boundary-query-source.d.ts.map +0 -1
  183. package/dist/sources/boundary-query-source.js +0 -18
  184. package/dist/sources/boundary-table-source.d.ts +0 -8
  185. package/dist/sources/boundary-table-source.d.ts.map +0 -1
  186. package/dist/sources/boundary-table-source.js +0 -15
  187. package/dist/sources/h3-query-source.d.ts +0 -4
  188. package/dist/sources/h3-query-source.d.ts.map +0 -1
  189. package/dist/sources/h3-query-source.js +0 -22
  190. package/dist/sources/h3-table-source.d.ts +0 -4
  191. package/dist/sources/h3-table-source.d.ts.map +0 -1
  192. package/dist/sources/h3-table-source.js +0 -19
  193. package/dist/sources/h3-tileset-source.d.ts +0 -4
  194. package/dist/sources/h3-tileset-source.d.ts.map +0 -1
  195. package/dist/sources/h3-tileset-source.js +0 -6
  196. package/dist/sources/index.d.ts +0 -28
  197. package/dist/sources/index.d.ts.map +0 -1
  198. package/dist/sources/index.js +0 -13
  199. package/dist/sources/quadbin-query-source.d.ts +0 -4
  200. package/dist/sources/quadbin-query-source.d.ts.map +0 -1
  201. package/dist/sources/quadbin-query-source.js +0 -22
  202. package/dist/sources/quadbin-table-source.d.ts +0 -4
  203. package/dist/sources/quadbin-table-source.d.ts.map +0 -1
  204. package/dist/sources/quadbin-table-source.js +0 -19
  205. package/dist/sources/quadbin-tileset-source.d.ts +0 -4
  206. package/dist/sources/quadbin-tileset-source.d.ts.map +0 -1
  207. package/dist/sources/quadbin-tileset-source.js +0 -6
  208. package/dist/sources/raster-source.d.ts +0 -4
  209. package/dist/sources/raster-source.d.ts.map +0 -1
  210. package/dist/sources/raster-source.js +0 -9
  211. package/dist/sources/types.d.ts +0 -219
  212. package/dist/sources/types.d.ts.map +0 -1
  213. package/dist/sources/types.js +0 -1
  214. package/dist/sources/vector-query-source.d.ts +0 -4
  215. package/dist/sources/vector-query-source.d.ts.map +0 -1
  216. package/dist/sources/vector-query-source.js +0 -22
  217. package/dist/sources/vector-table-source.d.ts +0 -4
  218. package/dist/sources/vector-table-source.d.ts.map +0 -1
  219. package/dist/sources/vector-table-source.js +0 -19
  220. package/dist/sources/vector-tileset-source.d.ts +0 -4
  221. package/dist/sources/vector-tileset-source.d.ts.map +0 -1
  222. package/dist/sources/vector-tileset-source.js +0 -6
  223. package/src/api/carto-api-error.ts +0 -68
  224. package/src/api/common.ts +0 -6
  225. package/src/api/endpoints.ts +0 -69
  226. package/src/api/query.ts +0 -42
  227. package/src/api/request-with-parameters.ts +0 -117
  228. package/src/sources/base-source.ts +0 -79
  229. package/src/sources/boundary-query-source.ts +0 -39
  230. package/src/sources/boundary-table-source.ts +0 -33
  231. package/src/sources/h3-query-source.ts +0 -55
  232. package/src/sources/h3-table-source.ts +0 -51
  233. package/src/sources/h3-tileset-source.ts +0 -14
  234. package/src/sources/index.ts +0 -45
  235. package/src/sources/quadbin-query-source.ts +0 -56
  236. package/src/sources/quadbin-table-source.ts +0 -52
  237. package/src/sources/quadbin-tileset-source.ts +0 -14
  238. package/src/sources/raster-source.ts +0 -17
  239. package/src/sources/types.ts +0 -231
  240. package/src/sources/vector-query-source.ts +0 -57
  241. package/src/sources/vector-table-source.ts +0 -51
  242. package/src/sources/vector-tileset-source.ts +0 -14
package/dist/index.cjs CHANGED
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -29,13 +33,12 @@ __export(dist_exports, {
29
33
  BASEMAP: () => basemap_default,
30
34
  CARTO_LAYERS: () => CARTO_LAYERS,
31
35
  CARTO_SOURCES: () => CARTO_SOURCES,
32
- CartoAPIError: () => CartoAPIError,
33
36
  ClusterTileLayer: () => cluster_tile_layer_default,
34
37
  H3TileLayer: () => h3_tile_layer_default,
35
38
  HeatmapTileLayer: () => heatmap_tile_layer_default,
36
39
  QuadbinTileLayer: () => quadbin_tile_layer_default,
37
40
  RasterTileLayer: () => raster_tile_layer_default,
38
- SOURCE_DEFAULTS: () => SOURCE_DEFAULTS,
41
+ SOURCE_DEFAULTS: () => import_api_client3.SOURCE_DEFAULTS,
39
42
  VectorTileLayer: () => vector_tile_layer_default,
40
43
  _GOOGLE_BASEMAPS: () => GOOGLE_BASEMAPS,
41
44
  _PointLabelLayer: () => point_label_layer_default,
@@ -46,24 +49,23 @@ __export(dist_exports, {
46
49
  _applyLayerGroupFilters: () => applyLayerGroupFilters,
47
50
  _fetchStyle: () => fetchStyle,
48
51
  _getStyleUrl: () => getStyleUrl,
49
- boundaryQuerySource: () => boundaryQuerySource,
50
- boundaryTableSource: () => boundaryTableSource,
52
+ boundaryQuerySource: () => import_api_client3.boundaryQuerySource,
53
+ boundaryTableSource: () => import_api_client3.boundaryTableSource,
51
54
  colorBins: () => colorBins,
52
55
  colorCategories: () => colorCategories,
53
56
  colorContinuous: () => colorContinuous,
54
57
  fetchBasemapProps: () => fetchBasemapProps,
55
58
  fetchMap: () => fetchMap,
56
- h3QuerySource: () => h3QuerySource,
57
- h3TableSource: () => h3TableSource,
58
- h3TilesetSource: () => h3TilesetSource,
59
- quadbinQuerySource: () => quadbinQuerySource,
60
- quadbinTableSource: () => quadbinTableSource,
61
- quadbinTilesetSource: () => quadbinTilesetSource,
62
- query: () => query,
63
- rasterSource: () => rasterSource,
64
- vectorQuerySource: () => vectorQuerySource,
65
- vectorTableSource: () => vectorTableSource,
66
- vectorTilesetSource: () => vectorTilesetSource
59
+ h3QuerySource: () => import_api_client3.h3QuerySource,
60
+ h3TableSource: () => import_api_client3.h3TableSource,
61
+ h3TilesetSource: () => import_api_client3.h3TilesetSource,
62
+ quadbinQuerySource: () => import_api_client3.quadbinQuerySource,
63
+ quadbinTableSource: () => import_api_client3.quadbinTableSource,
64
+ quadbinTilesetSource: () => import_api_client3.quadbinTilesetSource,
65
+ rasterSource: () => import_api_client3.rasterSource,
66
+ vectorQuerySource: () => import_api_client3.vectorQuerySource,
67
+ vectorTableSource: () => import_api_client3.vectorTableSource,
68
+ vectorTilesetSource: () => import_api_client3.vectorTilesetSource
67
69
  });
68
70
  module.exports = __toCommonJS(dist_exports);
69
71
 
@@ -198,26 +200,28 @@ function clustersToBinary(data) {
198
200
 
199
201
  // dist/constants.js
200
202
  var DEFAULT_TILE_SIZE = 512;
201
- var DEFAULT_TILE_RESOLUTION = 0.5;
202
- var DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
203
- var DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
204
203
 
205
204
  // dist/layers/quadbin-tileset-2d.js
206
205
  var import_geo_layers = require("@deck.gl/geo-layers");
207
206
  var import_quadbin2 = require("quadbin");
208
207
  var QuadbinTileset2D = class extends import_geo_layers._Tileset2D {
208
+ // @ts-expect-error for spatial indices, TileSet2d should be parametrized by TileIndexT
209
209
  getTileIndices(opts) {
210
210
  return super.getTileIndices(opts).map(import_quadbin2.tileToCell).map((q) => ({ q, i: (0, import_quadbin2.bigIntToHex)(q) }));
211
211
  }
212
+ // @ts-expect-error TileIndex must be generic
212
213
  getTileId({ q, i }) {
213
214
  return i || (0, import_quadbin2.bigIntToHex)(q);
214
215
  }
216
+ // @ts-expect-error TileIndex must be generic
215
217
  getTileMetadata({ q }) {
216
218
  return super.getTileMetadata((0, import_quadbin2.cellToTile)(q));
217
219
  }
220
+ // @ts-expect-error TileIndex must be generic
218
221
  getTileZoom({ q }) {
219
222
  return Number((0, import_quadbin2.getResolution)(q));
220
223
  }
224
+ // @ts-expect-error TileIndex must be generic
221
225
  getParentIndex({ q }) {
222
226
  return { q: (0, import_quadbin2.cellToParent)(q) };
223
227
  }
@@ -530,8 +534,6 @@ function scaleIdentity() {
530
534
  };
531
535
  return scale;
532
536
  }
533
- var isObject = (x) => x !== null && typeof x === "object";
534
- var isPureObject = (x) => isObject(x) && x.constructor === {}.constructor;
535
537
 
536
538
  // dist/layers/schema/spatialjson-utils.js
537
539
  var import_quadbin4 = require("quadbin");
@@ -551,7 +553,7 @@ function binaryToSpatialjson(binary) {
551
553
  }
552
554
 
553
555
  // dist/layers/schema/carto-spatial-tile-loader.js
554
- var VERSION = true ? "9.0.35" : "latest";
556
+ var VERSION = true ? "9.1.0-beta.1" : "latest";
555
557
  var id = "cartoSpatialTile";
556
558
  var DEFAULT_OPTIONS = {
557
559
  cartoSpatialTile: {
@@ -668,6 +670,7 @@ var ClusterGeoJsonLayer = class extends import_geo_layers2.TileLayer {
668
670
  super.initializeState();
669
671
  this.state.aggregationCache = /* @__PURE__ */ new WeakMap();
670
672
  }
673
+ // eslint-disable-next-line max-statements
671
674
  renderLayers() {
672
675
  var _a;
673
676
  const visibleTiles = (_a = this.state.tileset) == null ? void 0 : _a.tiles.filter((tile) => {
@@ -753,9 +756,11 @@ var ClusterTileLayer = class extends import_core6.CompositeLayer {
753
756
  return null;
754
757
  const { tiles: data, maxresolution: maxZoom } = tileJSON;
755
758
  return [
759
+ // @ts-ignore
756
760
  new ClusterGeoJsonLayer(this.props, {
757
761
  id: `cluster-geojson-layer-${this.props.id}`,
758
762
  data,
763
+ // TODO: Tileset2D should be generic over TileIndex type
759
764
  TilesetClass: QuadbinTileset2D,
760
765
  maxZoom,
761
766
  loadOptions: this.getLoadOptions()
@@ -832,6 +837,12 @@ function getHexagonResolution(viewport, tileSize) {
832
837
  return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
833
838
  }
834
839
  var H3Tileset2D = class extends import_geo_layers3._Tileset2D {
840
+ /**
841
+ * Returns all tile indices in the current viewport. If the current zoom level is smaller
842
+ * than minZoom, return an empty array. If the current zoom level is greater than maxZoom,
843
+ * return tiles that are on maxZoom.
844
+ */
845
+ // @ts-expect-error Tileset2D should be generic over TileIndex
835
846
  getTileIndices({ viewport, minZoom, maxZoom }) {
836
847
  if (viewport.latitude === void 0)
837
848
  return [];
@@ -852,15 +863,19 @@ var H3Tileset2D = class extends import_geo_layers3._Tileset2D {
852
863
  }
853
864
  return indices.map((i) => ({ i }));
854
865
  }
866
+ // @ts-expect-error Tileset2D should be generic over TileIndex
855
867
  getTileId({ i }) {
856
868
  return i;
857
869
  }
870
+ // @ts-expect-error Tileset2D should be generic over TileIndex
858
871
  getTileMetadata({ i }) {
859
872
  return { bbox: tileToBoundingBox(i) };
860
873
  }
874
+ // @ts-expect-error Tileset2D should be generic over TileIndex
861
875
  getTileZoom({ i }) {
862
876
  return (0, import_h3_js.getResolution)(i);
863
877
  }
878
+ // @ts-expect-error Tileset2D should be generic over TileIndex
864
879
  getParentIndex(index) {
865
880
  const resolution = (0, import_h3_js.getResolution)(index.i);
866
881
  const i = (0, import_h3_js.cellToParent)(index.i, resolution - 1);
@@ -916,7 +931,7 @@ var TileReader3 = class {
916
931
  };
917
932
 
918
933
  // dist/layers/schema/carto-raster-tile-loader.js
919
- var VERSION2 = true ? "9.0.35" : "latest";
934
+ var VERSION2 = true ? "9.1.0-beta.1" : "latest";
920
935
  var id2 = "cartoRasterTile";
921
936
  var DEFAULT_OPTIONS2 = {
922
937
  cartoRasterTile: {
@@ -987,7 +1002,8 @@ var SpatialIndexTileLayer = class extends import_geo_layers4.TileLayer {
987
1002
  const { hoveredFeatureId } = this.state;
988
1003
  const data = tile.content;
989
1004
  const isFeatureIdPresent = isFeatureIdDefined(hoveredFeatureId);
990
- if (!isFeatureIdPresent || !Array.isArray(data) || !this._featureInTile(tile, hoveredFeatureId)) {
1005
+ if (!isFeatureIdPresent || !Array.isArray(data) || // Quick check for whether id is within tile. data.findIndex is expensive
1006
+ !this._featureInTile(tile, hoveredFeatureId)) {
991
1007
  return -1;
992
1008
  }
993
1009
  return data.findIndex((feature) => feature.id === hoveredFeatureId);
@@ -1052,8 +1068,10 @@ var H3TileLayer = class extends import_core8.CompositeLayer {
1052
1068
  return new SubLayerClass(this.props, {
1053
1069
  id: `h3-tile-layer-${this.props.id}`,
1054
1070
  data,
1071
+ // TODO: Tileset2D should be generic over TileIndex type
1055
1072
  TilesetClass: H3Tileset2D,
1056
1073
  renderSubLayers,
1074
+ // minZoom and maxZoom are H3 resolutions, however we must use this naming as that is what the Tileset2D class expects
1057
1075
  minZoom: minresolution,
1058
1076
  maxZoom: maxresolution,
1059
1077
  loadOptions: this.getLoadOptions()
@@ -1070,55 +1088,86 @@ var import_core11 = require("@deck.gl/core");
1070
1088
  var import_layers2 = require("@deck.gl/layers");
1071
1089
 
1072
1090
  // dist/layers/heatmap.js
1073
- var fs = `uniform heatmapUniforms {
1074
- vec2 colorDomain;
1075
- vec2 delta;
1076
- float intensity;
1077
- float opacity;
1078
- float radiusPixels;
1091
+ var fs = (
1092
+ /* glsl */
1093
+ `uniform heatmapUniforms {
1094
+ vec2 colorDomain;
1095
+ vec2 delta;
1096
+ float intensity;
1097
+ float opacity;
1098
+ float radiusPixels;
1079
1099
  } heatmap;
1100
+
1080
1101
  uniform sampler2D colorTexture;
1102
+
1081
1103
  vec3 colorGradient(float value) {
1082
- return texture(colorTexture, vec2(value, 0.5)).rgb;
1104
+ return texture(colorTexture, vec2(value, 0.5)).rgb;
1083
1105
  }
1106
+
1084
1107
  const vec3 SHIFT = vec3(1.0, 256.0, 256.0 * 256.0);
1085
1108
  const float MAX_VAL = SHIFT.z * 255.0;
1086
1109
  const float SCALE = MAX_VAL / 8.0;
1087
1110
  vec4 pack(float value) {
1088
- return vec4(mod(vec3(value, floor(value / SHIFT.yz)), 256.0), 255.0) / 255.0;
1111
+ return vec4(mod(vec3(value, floor(value / SHIFT.yz)), 256.0), 255.0) / 255.0;
1089
1112
  }
1090
1113
  float unpack(vec3 color) {
1091
- return 255.0 * dot(color, SHIFT);
1114
+ return 255.0 * dot(color, SHIFT);
1092
1115
  }
1116
+
1093
1117
  vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
1094
- bool firstPass = (heatmap.delta.y < 0.5);
1095
- float accumulator = 0.0;
1096
- float SUPPORT = clamp(heatmap.radiusPixels / 2.0, 8.0, 32.0);
1097
- float sigma = SUPPORT / 3.0;
1098
- float a = -0.5 / (sigma * sigma);
1099
- float w0 = 0.3989422804014327 / sigma;
1100
- for (float t = -SUPPORT; t <= SUPPORT; t++) {
1101
- vec2 percent = (t * heatmap.delta - 0.5) / SUPPORT;
1102
- vec2 delta = percent * heatmap.radiusPixels / texSize;
1103
- vec4 offsetColor = texture(source, texCoord + delta);
1104
- float value = unpack(offsetColor.rgb);
1105
- float weight = w0 * exp(a * t * t);
1106
- accumulator += value * weight;
1107
- }
1108
- if (firstPass) {
1109
- return pack(accumulator);
1110
- }
1111
- float density = 10.0 * heatmap.intensity * accumulator / SCALE;
1112
- vec2 domain = heatmap.colorDomain;
1113
- float f = (density - domain[0]) / (domain[1] - domain[0]);
1114
- vec4 color = vec4(0.0);
1115
- color.rgb = colorGradient(f);
1116
- color.a = smoothstep(0.0, 0.1, f);
1117
- color.a = pow(color.a, 1.0 / 2.2);
1118
- color.a *= heatmap.opacity;
1119
- return color;
1118
+ bool firstPass = (heatmap.delta.y < 0.5);
1119
+ float accumulator = 0.0;
1120
+
1121
+ // Controls quality of heatmap, larger values increase quality at expense of performance
1122
+ float SUPPORT = clamp(heatmap.radiusPixels / 2.0, 8.0, 32.0);
1123
+
1124
+ // Gaussian normalization parameters
1125
+ float sigma = SUPPORT / 3.0;
1126
+ float a = -0.5 / (sigma * sigma);
1127
+ float w0 = 0.3989422804014327 / sigma; // 1D normalization
1128
+ for (float t = -SUPPORT; t <= SUPPORT; t++) {
1129
+ vec2 percent = (t * heatmap.delta - 0.5) / SUPPORT;
1130
+ vec2 delta = percent * heatmap.radiusPixels / texSize;
1131
+ vec4 offsetColor = texture(source, texCoord + delta);
1132
+
1133
+ // Unpack float
1134
+ float value = unpack(offsetColor.rgb);
1135
+
1136
+ // Gaussian
1137
+ float weight = w0 * exp(a * t * t);
1138
+
1139
+ accumulator += value * weight;
1140
+ }
1141
+
1142
+ if (firstPass) {
1143
+ return pack(accumulator);
1144
+ }
1145
+
1146
+ // Undo scaling to obtain normalized density
1147
+ float density = 10.0 * heatmap.intensity * accumulator / SCALE;
1148
+
1149
+ // Domain also in normalized density units
1150
+ vec2 domain = heatmap.colorDomain;
1151
+
1152
+ // Apply domain
1153
+ float f = (density - domain[0]) / (domain[1] - domain[0]);
1154
+
1155
+ // sqrt/log scaling??
1156
+ // float f = (log(density) - log(domain[0] + 1.0)) / (log(domain[1] + 1.0) - log(domain[0] + 1.0));
1157
+ // f = sqrt(f);
1158
+
1159
+ // Color map
1160
+ vec4 color = vec4(0.0);
1161
+ color.rgb = colorGradient(f);
1162
+
1163
+ color.a = smoothstep(0.0, 0.1, f);
1164
+ color.a = pow(color.a, 1.0 / 2.2);
1165
+ color.a *= heatmap.opacity;
1166
+
1167
+ return color;
1120
1168
  }
1121
- `;
1169
+ `
1170
+ );
1122
1171
  var heatmap = {
1123
1172
  name: "heatmap",
1124
1173
  uniformPropTypes: {
@@ -1135,6 +1184,7 @@ var heatmap = {
1135
1184
  opacity: "f32",
1136
1185
  radiusPixels: "f32"
1137
1186
  },
1187
+ // @ts-ignore TODO v9.1
1138
1188
  getUniforms: (opts) => {
1139
1189
  if (!opts)
1140
1190
  return {};
@@ -1150,7 +1200,9 @@ var heatmap = {
1150
1200
  },
1151
1201
  fs,
1152
1202
  passes: [
1203
+ // @ts-expect-error Seems typing in luma.gl should be Partial<>
1153
1204
  { sampler: true, uniforms: { delta: [1, 0] } },
1205
+ // @ts-expect-error Seems typing in luma.gl should be Partial<>
1154
1206
  { sampler: true, uniforms: { delta: [0, 1] } }
1155
1207
  ]
1156
1208
  };
@@ -1186,8 +1238,8 @@ function RTTModifier(BaseLayer) {
1186
1238
  var _a;
1187
1239
  return _a = class RTTLayer extends BaseLayer {
1188
1240
  draw(opts) {
1189
- const { moduleParameters } = opts;
1190
- const { picking } = moduleParameters;
1241
+ const { shaderModuleProps } = opts;
1242
+ const { picking } = shaderModuleProps;
1191
1243
  const postProcessLayer = getPostProcessLayer(this);
1192
1244
  if (!picking.isActive) {
1193
1245
  postProcessLayer.enableRTT(opts);
@@ -1231,10 +1283,11 @@ function PostProcessModifier(BaseLayer, effect) {
1231
1283
  });
1232
1284
  }
1233
1285
  _resizeBuffers(opts) {
1234
- const { moduleParameters } = opts;
1286
+ const { shaderModuleProps } = opts;
1235
1287
  const { viewport } = this.context;
1236
- const width = moduleParameters.devicePixelRatio * viewport.width;
1237
- const height = moduleParameters.devicePixelRatio * viewport.height;
1288
+ const { devicePixelRatio } = shaderModuleProps.project;
1289
+ const width = devicePixelRatio * viewport.width;
1290
+ const height = devicePixelRatio * viewport.height;
1238
1291
  this.internalState.renderBuffers.forEach((fbo) => fbo.resize({ width, height }));
1239
1292
  }
1240
1293
  enableRTT(opts) {
@@ -1244,6 +1297,7 @@ function PostProcessModifier(BaseLayer, effect) {
1244
1297
  this.internalState.internalRenderPass = this.context.device.beginRenderPass({
1245
1298
  framebuffer,
1246
1299
  parameters: { viewport: [0, 0, framebuffer.width, framebuffer.height] },
1300
+ // Only clear on first render
1247
1301
  clearColor: this.internalState.renderInProgress ? false : [0, 0, 0, 0]
1248
1302
  });
1249
1303
  this.internalState.renderInProgress = true;
@@ -1326,6 +1380,7 @@ var QuadbinTileLayer = class extends import_core10.CompositeLayer {
1326
1380
  return new SubLayerClass(this.props, {
1327
1381
  id: `quadbin-tile-layer-${this.props.id}`,
1328
1382
  data,
1383
+ // TODO: Tileset2D should be generic over TileIndex type
1329
1384
  TilesetClass: QuadbinTileset2D,
1330
1385
  renderSubLayers: renderSubLayers2,
1331
1386
  maxZoom,
@@ -1372,20 +1427,28 @@ function colorRangeToFlatArray(colorRange) {
1372
1427
  }
1373
1428
  return flatArray;
1374
1429
  }
1430
+ var uniformBlock = `uniform densityUniforms {
1431
+ float factor;
1432
+ } density;
1433
+ `;
1434
+ var densityUniforms = {
1435
+ name: "density",
1436
+ vs: uniformBlock,
1437
+ uniformTypes: {
1438
+ factor: "f32"
1439
+ }
1440
+ };
1375
1441
  var RTTSolidPolygonLayer = class extends RTTModifier(import_layers2.SolidPolygonLayer) {
1376
1442
  getShaders(type) {
1377
1443
  const shaders = super.getShaders(type);
1378
1444
  shaders.inject = {
1379
- "vs:#decl": `
1380
- uniform float densityFactor;
1381
- `,
1382
1445
  "vs:#main-end": `
1383
1446
  // Value from getWeight accessor
1384
1447
  float weight = elevations;
1385
1448
 
1386
1449
  // Keep "power" delivered to screen constant when tiles update
1387
- // by outputting normalized density
1388
- weight *= densityFactor;
1450
+ // by outputting normalized density
1451
+ weight *= density.factor;
1389
1452
 
1390
1453
  // Pack float into 3 channels to pass to heatmap shader
1391
1454
  // SCALE value important, as we don't want to saturate
@@ -1398,14 +1461,17 @@ uniform float densityFactor;
1398
1461
  vColor = vec4(mod(vec3(weight, floor(weight / SHIFT.yz)), 256.0), 255.0) / 255.0;
1399
1462
  `
1400
1463
  };
1464
+ shaders.modules = [...shaders.modules, densityUniforms];
1401
1465
  return shaders;
1402
1466
  }
1403
1467
  draw(opts) {
1404
1468
  const cell = this.props.data[0];
1405
1469
  const maxDensity = this.props.elevationScale;
1406
- const densityFactor = unitDensityForCell(cell.id) / maxDensity;
1470
+ const densityProps = {
1471
+ factor: unitDensityForCell(cell.id) / maxDensity
1472
+ };
1407
1473
  for (const model of this.state.models) {
1408
- model.setUniforms({ densityFactor });
1474
+ model.shaderInputs.setProps({ density: densityProps });
1409
1475
  }
1410
1476
  super.draw(opts);
1411
1477
  }
@@ -1475,6 +1541,8 @@ var HeatmapTileLayer = class extends import_core11.CompositeLayer {
1475
1541
  return new PostProcessQuadbinTileLayer(tileLayerProps, this.getSubLayerProps({
1476
1542
  id: "heatmap",
1477
1543
  data,
1544
+ // Re-use existing props to pass down values to sublayer
1545
+ // TODO replace with custom layer
1478
1546
  getFillColor: 0,
1479
1547
  getElevation: getWeight,
1480
1548
  elevationScale: maxDensity,
@@ -1484,11 +1552,13 @@ var HeatmapTileLayer = class extends import_core11.CompositeLayer {
1484
1552
  _subLayerProps: subLayerProps,
1485
1553
  refinementStrategy: "no-overlap",
1486
1554
  colorTexture: this.state.colorTexture,
1555
+ // Disable line rendering
1487
1556
  extruded: false,
1488
1557
  stroked: false,
1489
1558
  updateTriggers: {
1490
1559
  getElevation: updateTriggers.getWeight
1491
1560
  },
1561
+ // Tile stats
1492
1562
  onViewportLoad: (tiles2) => {
1493
1563
  this.setState({ isLoaded: true });
1494
1564
  if (typeof onViewportLoad === "function") {
@@ -1549,8 +1619,8 @@ var EnhancedTextBackgroundLayer = class extends import_layers3._TextBackgroundLa
1549
1619
  getShaders() {
1550
1620
  const shaders = super.getShaders();
1551
1621
  let vs = shaders.vs;
1552
- vs = vs.replaceAll("padding.", "_padding.");
1553
- vs = vs.replace("void main(void) {", "void main(void) {\n vec4 _padding = padding + instancePixelOffsets.xyxy * vec4(1.0, 1.0, -1.0, -1.0);");
1622
+ vs = vs.replaceAll("textBackground.padding.", "_padding.");
1623
+ vs = vs.replace("void main(void) {", "void main(void) {\n vec4 _padding = textBackground.padding + instancePixelOffsets.xyxy * vec4(1.0, 1.0, -1.0, -1.0);");
1554
1624
  return { ...shaders, vs };
1555
1625
  }
1556
1626
  };
@@ -1653,16 +1723,20 @@ var PointLabelLayer = class extends import_core12.CompositeLayer {
1653
1723
  const getPixelOffset = this.calculatePixelOffset(false);
1654
1724
  const backgroundPadding = this.calculateBackgroundPadding();
1655
1725
  const out = [
1726
+ // Text doesn't update via updateTrigger for some reason
1656
1727
  this.renderTextLayer(`${updateTriggers.getText}-primary`, {
1657
1728
  backgroundPadding,
1658
1729
  getText,
1659
1730
  getPixelOffset,
1660
1731
  background: true
1732
+ // Only use background for primary label for faster collisions
1661
1733
  }),
1662
1734
  Boolean(getSecondaryText) && this.renderTextLayer(`${updateTriggers.getSecondaryText}-secondary`, {
1663
1735
  getText: getSecondaryText,
1664
1736
  getPixelOffset: this.calculatePixelOffset(true),
1665
1737
  getAlignmentBaseline: "top",
1738
+ // updateTriggers: {getText: updateTriggers.getSecondaryText},
1739
+ // Optional overrides
1666
1740
  ...getSecondaryColor && { getColor: getSecondaryColor },
1667
1741
  ...secondarySizeScale && { sizeScale: secondarySizeScale },
1668
1742
  ...secondaryOutlineColor && { outlineColor: secondaryOutlineColor }
@@ -1691,38 +1765,30 @@ in float instanceElevations;
1691
1765
  in vec4 instanceFillColors;
1692
1766
  in vec4 instanceLineColors;
1693
1767
  in vec3 instancePickingColors;
1694
- uniform float opacity;
1695
- uniform bool extruded;
1696
- uniform bool stroked;
1697
- uniform bool isStroke;
1698
- uniform float coverage;
1699
- uniform float elevationScale;
1700
- uniform float widthScale;
1701
- uniform vec3 offset;
1702
1768
  out vec4 vColor;
1703
1769
  #ifdef FLAT_SHADING
1704
1770
  out vec4 position_commonspace;
1705
1771
  #endif
1706
1772
  void main(void) {
1707
- vec2 common_position = offset.xy;
1708
- float scale = offset.z;
1773
+ vec2 common_position = column.offset.xy;
1774
+ float scale = column.widthScale;
1709
1775
  int yIndex = - (gl_InstanceID / BLOCK_WIDTH);
1710
1776
  int xIndex = gl_InstanceID + (yIndex * BLOCK_WIDTH);
1711
1777
  common_position += scale * vec2(float(xIndex), float(yIndex - 1));
1712
- vec4 color = isStroke ? instanceLineColors : instanceFillColors;
1778
+ vec4 color = column.isStroke ? instanceLineColors : instanceFillColors;
1713
1779
  float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
1714
- float cellWidth = coverage * scale;
1780
+ float cellWidth = column.coverage * scale;
1715
1781
  geometry.position = vec4(common_position, 0.0, 1.0);
1716
- if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
1717
- geometry.position.xyz -= project_uCommonOrigin;
1782
+ if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
1783
+ geometry.position.xyz -= project.commonOrigin;
1718
1784
  }
1719
1785
  float elevation = 0.0;
1720
1786
  float strokeOffsetRatio = 1.0;
1721
- if (extruded) {
1722
- elevation = instanceElevations * (positions.z + 1.0) / 2.0 * elevationScale;
1723
- } else if (stroked) {
1724
- float halfOffset = project_pixel_size(widthScale) / cellWidth;
1725
- if (isStroke) {
1787
+ if (column.extruded) {
1788
+ elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale;
1789
+ } else if (column.stroked) {
1790
+ float halfOffset = project_pixel_size(column.widthScale) / cellWidth;
1791
+ if (column.isStroke) {
1726
1792
  strokeOffsetRatio -= sign(positions.z) * halfOffset;
1727
1793
  } else {
1728
1794
  strokeOffsetRatio -= halfOffset;
@@ -1736,16 +1802,16 @@ geometry.position.xyz += pos;
1736
1802
  gl_Position = project_common_position_to_clipspace(geometry.position);
1737
1803
  geometry.normal = project_normal(normals);
1738
1804
  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
1739
- if (extruded && !isStroke) {
1805
+ if (column.extruded && !column.isStroke) {
1740
1806
  #ifdef FLAT_SHADING
1741
1807
  position_commonspace = geometry.position;
1742
- vColor = vec4(color.rgb, color.a * opacity);
1808
+ vColor = vec4(color.rgb, color.a * layer.opacity);
1743
1809
  #else
1744
- vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);
1745
- vColor = vec4(lightColor, color.a * opacity);
1810
+ vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
1811
+ vColor = vec4(lightColor, color.a * layer.opacity);
1746
1812
  #endif
1747
1813
  } else {
1748
- vColor = vec4(color.rgb, color.a * opacity);
1814
+ vColor = vec4(color.rgb, color.a * layer.opacity);
1749
1815
  }
1750
1816
  DECKGL_FILTER_COLOR(vColor, geometry);
1751
1817
  }
@@ -1806,7 +1872,8 @@ var RasterLayer = class extends import_core13.CompositeLayer {
1806
1872
  return null;
1807
1873
  const blockSize = data.blockSize ?? 0;
1808
1874
  const [xOffset, yOffset, scale] = quadbinToOffset(tileIndex);
1809
- const offset = [xOffset, yOffset, scale / blockSize];
1875
+ const offset = [xOffset, yOffset];
1876
+ const lineWidthScale = scale / blockSize;
1810
1877
  const CellLayer = this.getSubLayerClass("column", RasterColumnLayer);
1811
1878
  const { highlightedObjectIndex, highlightColor } = this.state;
1812
1879
  return new CellLayer(this.props, this.getSubLayerProps({
@@ -1819,10 +1886,13 @@ var RasterLayer = class extends import_core13.CompositeLayer {
1819
1886
  }), {
1820
1887
  data: {
1821
1888
  data,
1889
+ // Pass through data for getSubLayerAccessor()
1822
1890
  length: blockSize * blockSize
1823
1891
  },
1824
1892
  dataComparator: wrappedDataComparator,
1825
1893
  offset,
1894
+ lineWidthScale,
1895
+ // Re-use widthScale prop to pass cell scale,
1826
1896
  highlightedObjectIndex,
1827
1897
  highlightColor
1828
1898
  });
@@ -1899,6 +1969,7 @@ var RasterTileLayer = class extends import_core14.CompositeLayer {
1899
1969
  return new SubLayerClass(this.props, {
1900
1970
  id: `raster-tile-layer-${this.props.id}`,
1901
1971
  data,
1972
+ // TODO: Tileset2D should be generic over TileIndex type
1902
1973
  TilesetClass: QuadbinTileset2D,
1903
1974
  renderSubLayers: renderSubLayers3,
1904
1975
  minZoom,
@@ -1952,7 +2023,7 @@ var carto_properties_tile_loader_default = CartoPropertiesTileLoader;
1952
2023
 
1953
2024
  // dist/layers/schema/carto-vector-tile-loader.js
1954
2025
  var import_earcut = __toESM(require("earcut"), 1);
1955
- var VERSION3 = true ? "9.0.35" : "latest";
2026
+ var VERSION3 = true ? "9.1.0-beta.1" : "latest";
1956
2027
  var id3 = "cartoVectorTile";
1957
2028
  var DEFAULT_OPTIONS3 = {
1958
2029
  cartoVectorTile: {
@@ -2043,6 +2114,7 @@ var VectorTileLayer = class extends import_geo_layers8.MVTLayer {
2043
2114
  loadOptions.gis = { format: "binary" };
2044
2115
  return loadOptions;
2045
2116
  }
2117
+ /* eslint-disable camelcase */
2046
2118
  async getTileData(tile) {
2047
2119
  const tileJSON = this.props.data;
2048
2120
  const { tiles, properties_tiles } = tileJSON;
@@ -2072,6 +2144,7 @@ var VectorTileLayer = class extends import_geo_layers8.MVTLayer {
2072
2144
  return null;
2073
2145
  return attributes ? mergeBoundaryData(geometry, attributes) : geometry;
2074
2146
  }
2147
+ /* eslint-enable camelcase */
2075
2148
  renderSubLayers(props) {
2076
2149
  if (props.data === null) {
2077
2150
  return null;
@@ -2098,6 +2171,7 @@ var VectorTileLayer = class extends import_geo_layers8.MVTLayer {
2098
2171
  const subLayerProps = {
2099
2172
  ...props,
2100
2173
  autoHighlight: false,
2174
+ // Do not perform clipping on points (#9059)
2101
2175
  _subLayerProps: {
2102
2176
  ...props._subLayerProps,
2103
2177
  ...applyClipExtensionToSublayerProps("polygons-fill"),
@@ -2118,47 +2192,8 @@ VectorTileLayer.layerName = "VectorTileLayer";
2118
2192
  VectorTileLayer.defaultProps = defaultProps10;
2119
2193
  var vector_tile_layer_default = VectorTileLayer;
2120
2194
 
2121
- // dist/api/carto-api-error.js
2122
- var CartoAPIError = class extends Error {
2123
- constructor(error, errorContext, response, responseJson) {
2124
- let responseString = "Failed to connect";
2125
- if (response) {
2126
- responseString = "Server returned: ";
2127
- if (response.status === 400) {
2128
- responseString += "Bad request";
2129
- } else if (response.status === 401 || response.status === 403) {
2130
- responseString += "Unauthorized access";
2131
- } else if (response.status === 404) {
2132
- responseString += "Not found";
2133
- } else {
2134
- responseString += "Error";
2135
- }
2136
- responseString += ` (${response.status}):`;
2137
- }
2138
- responseString += ` ${error.message || error}`;
2139
- let message = `${errorContext.requestType} API request failed`;
2140
- message += `
2141
- ${responseString}`;
2142
- for (const key of Object.keys(errorContext)) {
2143
- if (key === "requestType")
2144
- continue;
2145
- message += `
2146
- ${formatErrorKey(key)}: ${errorContext[key]}`;
2147
- }
2148
- message += "\n";
2149
- super(message);
2150
- this.name = "CartoAPIError";
2151
- this.response = response;
2152
- this.responseJson = responseJson;
2153
- this.error = error;
2154
- this.errorContext = errorContext;
2155
- }
2156
- };
2157
- function formatErrorKey(key) {
2158
- return key.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
2159
- }
2160
-
2161
2195
  // dist/basemap.js
2196
+ var import_api_client = require("@carto/api-client");
2162
2197
  var cartoStyleUrlTemplate = "https://basemaps.cartocdn.com/gl/{basemap}-gl-style/style.json";
2163
2198
  var CARTO_MAP_STYLES = ["positron", "dark-matter", "voyager"];
2164
2199
  var GOOGLE_BASEMAPS = {
@@ -2243,7 +2278,7 @@ async function fetchStyle({ styleUrl, errorContext }) {
2243
2278
  response = res;
2244
2279
  return res.json();
2245
2280
  }).catch((error) => {
2246
- throw new CartoAPIError(error, { ...errorContext, requestType: "Basemap style" }, response);
2281
+ throw new import_api_client.CartoAPIError(error, { ...errorContext, requestType: "Basemap style" }, response);
2247
2282
  });
2248
2283
  }
2249
2284
  var basemap_default = {
@@ -2363,343 +2398,11 @@ function colorContinuous({ attr, domain, colors = DEFAULT_PALETTE, nullColor = N
2363
2398
  };
2364
2399
  }
2365
2400
 
2366
- // dist/api/common.js
2367
- var DEFAULT_API_BASE_URL = "https://gcp-us-east1.api.carto.com";
2368
- var DEFAULT_CLIENT = "deck-gl-carto";
2369
- var V3_MINOR_VERSION = "3.4";
2370
- var DEFAULT_MAX_LENGTH_URL = 7e3;
2371
-
2372
- // dist/api/endpoints.js
2373
- function joinPath(...args) {
2374
- return args.map((part) => part.endsWith("/") ? part.slice(0, -1) : part).join("/");
2375
- }
2376
- function buildV3Path(apiBaseUrl, version, endpoint, ...rest) {
2377
- return joinPath(apiBaseUrl, version, endpoint, ...rest);
2378
- }
2379
- function buildPublicMapUrl({ apiBaseUrl, cartoMapId }) {
2380
- return buildV3Path(apiBaseUrl, "v3", "maps", "public", cartoMapId);
2381
- }
2382
- function buildStatsUrl({ attribute, apiBaseUrl, connectionName, source, type }) {
2383
- if (type === "query") {
2384
- return buildV3Path(apiBaseUrl, "v3", "stats", connectionName, attribute);
2385
- }
2386
- return buildV3Path(apiBaseUrl, "v3", "stats", connectionName, source, attribute);
2387
- }
2388
- function buildSourceUrl({ apiBaseUrl, connectionName, endpoint }) {
2389
- return buildV3Path(apiBaseUrl, "v3", "maps", connectionName, endpoint);
2390
- }
2391
- function buildQueryUrl({ apiBaseUrl, connectionName }) {
2392
- return buildV3Path(apiBaseUrl, "v3", "sql", connectionName, "query");
2393
- }
2394
-
2395
- // dist/api/request-with-parameters.js
2396
- var import_core16 = require("@deck.gl/core");
2397
- var DEFAULT_PARAMETERS = {
2398
- v: V3_MINOR_VERSION,
2399
- deckglVersion: import_core16.VERSION
2400
- };
2401
- var DEFAULT_HEADERS = {
2402
- Accept: "application/json",
2403
- "Content-Type": "application/json"
2404
- };
2405
- var REQUEST_CACHE = /* @__PURE__ */ new Map();
2406
- async function requestWithParameters({ baseUrl, parameters = {}, headers: customHeaders = {}, errorContext, maxLengthURL = DEFAULT_MAX_LENGTH_URL }) {
2407
- parameters = { ...DEFAULT_PARAMETERS, ...parameters };
2408
- baseUrl = excludeURLParameters(baseUrl, Object.keys(parameters));
2409
- const key = createCacheKey(baseUrl, parameters, customHeaders);
2410
- if (REQUEST_CACHE.has(key)) {
2411
- return REQUEST_CACHE.get(key);
2412
- }
2413
- const url = createURLWithParameters(baseUrl, parameters);
2414
- const headers = { ...DEFAULT_HEADERS, ...customHeaders };
2415
- const fetchPromise = url.length > maxLengthURL ? fetch(baseUrl, { method: "POST", body: JSON.stringify(parameters), headers }) : fetch(url, { headers });
2416
- let response;
2417
- let responseJson;
2418
- const jsonPromise = fetchPromise.then((_response) => {
2419
- response = _response;
2420
- return response.json();
2421
- }).then((json) => {
2422
- responseJson = json;
2423
- if (!response || !response.ok) {
2424
- throw new Error(json.error);
2425
- }
2426
- return json;
2427
- }).catch((error) => {
2428
- REQUEST_CACHE.delete(key);
2429
- throw new CartoAPIError(error, errorContext, response, responseJson);
2430
- });
2431
- REQUEST_CACHE.set(key, jsonPromise);
2432
- return jsonPromise;
2433
- }
2434
- function createCacheKey(baseUrl, parameters, headers) {
2435
- const parameterEntries = Object.entries(parameters).sort(([a], [b]) => a > b ? 1 : -1);
2436
- const headerEntries = Object.entries(headers).sort(([a], [b]) => a > b ? 1 : -1);
2437
- return JSON.stringify({ baseUrl, parameters: parameterEntries, headers: headerEntries });
2438
- }
2439
- function createURLWithParameters(baseUrlString, parameters) {
2440
- const baseUrl = new URL(baseUrlString);
2441
- for (const [key, value] of Object.entries(parameters)) {
2442
- if (isPureObject(value) || Array.isArray(value)) {
2443
- baseUrl.searchParams.set(key, JSON.stringify(value));
2444
- } else {
2445
- baseUrl.searchParams.set(key, value.toString());
2446
- }
2447
- }
2448
- return baseUrl.toString();
2449
- }
2450
- function excludeURLParameters(baseUrlString, parameters) {
2451
- const baseUrl = new URL(baseUrlString);
2452
- for (const param of parameters) {
2453
- if (baseUrl.searchParams.has(param)) {
2454
- baseUrl.searchParams.delete(param);
2455
- }
2456
- }
2457
- return baseUrl.toString();
2458
- }
2459
-
2460
- // dist/sources/base-source.js
2461
- var SOURCE_DEFAULTS = {
2462
- apiBaseUrl: DEFAULT_API_BASE_URL,
2463
- clientId: DEFAULT_CLIENT,
2464
- format: "tilejson",
2465
- headers: {},
2466
- maxLengthURL: DEFAULT_MAX_LENGTH_URL
2467
- };
2468
- async function baseSource(endpoint, options, urlParameters) {
2469
- const { accessToken, connectionName, cache, ...optionalOptions } = options;
2470
- const mergedOptions = { ...SOURCE_DEFAULTS, accessToken, connectionName, endpoint };
2471
- for (const key in optionalOptions) {
2472
- if (optionalOptions[key]) {
2473
- mergedOptions[key] = optionalOptions[key];
2474
- }
2475
- }
2476
- const baseUrl = buildSourceUrl(mergedOptions);
2477
- const { clientId, maxLengthURL, format } = mergedOptions;
2478
- const headers = { Authorization: `Bearer ${options.accessToken}`, ...options.headers };
2479
- const parameters = { client: clientId, ...urlParameters };
2480
- const errorContext = {
2481
- requestType: "Map instantiation",
2482
- connection: options.connectionName,
2483
- type: endpoint,
2484
- source: JSON.stringify(parameters, void 0, 2)
2485
- };
2486
- const mapInstantiation = await requestWithParameters({
2487
- baseUrl,
2488
- parameters,
2489
- headers,
2490
- errorContext,
2491
- maxLengthURL
2492
- });
2493
- const dataUrl = mapInstantiation[format].url[0];
2494
- if (cache) {
2495
- cache.value = parseInt(new URL(dataUrl).searchParams.get("cache") || "", 10);
2496
- }
2497
- errorContext.requestType = "Map data";
2498
- if (format === "tilejson") {
2499
- const json = await requestWithParameters({
2500
- baseUrl: dataUrl,
2501
- headers,
2502
- errorContext,
2503
- maxLengthURL
2504
- });
2505
- if (accessToken) {
2506
- json.accessToken = accessToken;
2507
- }
2508
- return json;
2509
- }
2510
- return await requestWithParameters({
2511
- baseUrl: dataUrl,
2512
- headers,
2513
- errorContext,
2514
- maxLengthURL
2515
- });
2516
- }
2517
-
2518
- // dist/sources/boundary-query-source.js
2519
- var boundaryQuerySource = async function(options) {
2520
- const { columns, filters, tilesetTableName, propertiesSqlQuery, queryParameters } = options;
2521
- const urlParameters = {
2522
- tilesetTableName,
2523
- propertiesSqlQuery
2524
- };
2525
- if (columns) {
2526
- urlParameters.columns = columns.join(",");
2527
- }
2528
- if (filters) {
2529
- urlParameters.filters = filters;
2530
- }
2531
- if (queryParameters) {
2532
- urlParameters.queryParameters = queryParameters;
2533
- }
2534
- return baseSource("boundary", options, urlParameters);
2535
- };
2536
-
2537
- // dist/sources/boundary-table-source.js
2538
- var boundaryTableSource = async function(options) {
2539
- const { filters, tilesetTableName, columns, propertiesTableName } = options;
2540
- const urlParameters = {
2541
- tilesetTableName,
2542
- propertiesTableName
2543
- };
2544
- if (columns) {
2545
- urlParameters.columns = columns.join(",");
2546
- }
2547
- if (filters) {
2548
- urlParameters.filters = filters;
2549
- }
2550
- return baseSource("boundary", options, urlParameters);
2551
- };
2552
-
2553
- // dist/sources/h3-query-source.js
2554
- var h3QuerySource = async function(options) {
2555
- const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3, sqlQuery, spatialDataColumn = "h3", queryParameters, filters } = options;
2556
- const urlParameters = {
2557
- aggregationExp,
2558
- spatialDataColumn,
2559
- spatialDataType: "h3",
2560
- q: sqlQuery
2561
- };
2562
- if (aggregationResLevel) {
2563
- urlParameters.aggregationResLevel = String(aggregationResLevel);
2564
- }
2565
- if (queryParameters) {
2566
- urlParameters.queryParameters = queryParameters;
2567
- }
2568
- if (filters) {
2569
- urlParameters.filters = filters;
2570
- }
2571
- return baseSource("query", options, urlParameters);
2572
- };
2573
-
2574
- // dist/sources/h3-table-source.js
2575
- var h3TableSource = async function(options) {
2576
- const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3, spatialDataColumn = "h3", tableName, filters } = options;
2577
- const urlParameters = {
2578
- aggregationExp,
2579
- name: tableName,
2580
- spatialDataColumn,
2581
- spatialDataType: "h3"
2582
- };
2583
- if (aggregationResLevel) {
2584
- urlParameters.aggregationResLevel = String(aggregationResLevel);
2585
- }
2586
- if (filters) {
2587
- urlParameters.filters = filters;
2588
- }
2589
- return baseSource("table", options, urlParameters);
2590
- };
2591
-
2592
- // dist/sources/h3-tileset-source.js
2593
- var h3TilesetSource = async function(options) {
2594
- const { tableName } = options;
2595
- const urlParameters = { name: tableName };
2596
- return baseSource("tileset", options, urlParameters);
2597
- };
2598
-
2599
- // dist/sources/raster-source.js
2600
- var rasterSource = async function(options) {
2601
- const { tableName, filters } = options;
2602
- const urlParameters = { name: tableName };
2603
- if (filters) {
2604
- urlParameters.filters = filters;
2605
- }
2606
- return baseSource("raster", options, urlParameters);
2607
- };
2608
-
2609
- // dist/sources/quadbin-query-source.js
2610
- var quadbinQuerySource = async function(options) {
2611
- const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN, sqlQuery, spatialDataColumn = "quadbin", queryParameters, filters } = options;
2612
- const urlParameters = {
2613
- aggregationExp,
2614
- q: sqlQuery,
2615
- spatialDataColumn,
2616
- spatialDataType: "quadbin"
2617
- };
2618
- if (aggregationResLevel) {
2619
- urlParameters.aggregationResLevel = String(aggregationResLevel);
2620
- }
2621
- if (queryParameters) {
2622
- urlParameters.queryParameters = queryParameters;
2623
- }
2624
- if (filters) {
2625
- urlParameters.filters = filters;
2626
- }
2627
- return baseSource("query", options, urlParameters);
2628
- };
2629
-
2630
- // dist/sources/quadbin-table-source.js
2631
- var quadbinTableSource = async function(options) {
2632
- const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN, spatialDataColumn = "quadbin", tableName, filters } = options;
2633
- const urlParameters = {
2634
- aggregationExp,
2635
- name: tableName,
2636
- spatialDataColumn,
2637
- spatialDataType: "quadbin"
2638
- };
2639
- if (aggregationResLevel) {
2640
- urlParameters.aggregationResLevel = String(aggregationResLevel);
2641
- }
2642
- if (filters) {
2643
- urlParameters.filters = filters;
2644
- }
2645
- return baseSource("table", options, urlParameters);
2646
- };
2647
-
2648
- // dist/sources/quadbin-tileset-source.js
2649
- var quadbinTilesetSource = async function(options) {
2650
- const { tableName } = options;
2651
- const urlParameters = { name: tableName };
2652
- return baseSource("tileset", options, urlParameters);
2653
- };
2654
-
2655
- // dist/sources/vector-query-source.js
2656
- var vectorQuerySource = async function(options) {
2657
- const { columns, filters, spatialDataColumn = "geom", sqlQuery, tileResolution = DEFAULT_TILE_RESOLUTION, queryParameters } = options;
2658
- const urlParameters = {
2659
- spatialDataColumn,
2660
- spatialDataType: "geo",
2661
- tileResolution: tileResolution.toString(),
2662
- q: sqlQuery
2663
- };
2664
- if (columns) {
2665
- urlParameters.columns = columns.join(",");
2666
- }
2667
- if (filters) {
2668
- urlParameters.filters = filters;
2669
- }
2670
- if (queryParameters) {
2671
- urlParameters.queryParameters = queryParameters;
2672
- }
2673
- return baseSource("query", options, urlParameters);
2674
- };
2675
-
2676
- // dist/sources/vector-table-source.js
2677
- var vectorTableSource = async function(options) {
2678
- const { columns, filters, spatialDataColumn = "geom", tableName, tileResolution = DEFAULT_TILE_RESOLUTION } = options;
2679
- const urlParameters = {
2680
- name: tableName,
2681
- spatialDataColumn,
2682
- spatialDataType: "geo",
2683
- tileResolution: tileResolution.toString()
2684
- };
2685
- if (columns) {
2686
- urlParameters.columns = columns.join(",");
2687
- }
2688
- if (filters) {
2689
- urlParameters.filters = filters;
2690
- }
2691
- return baseSource("table", options, urlParameters);
2692
- };
2693
-
2694
- // dist/sources/vector-tileset-source.js
2695
- var vectorTilesetSource = async function(options) {
2696
- const { tableName } = options;
2697
- const urlParameters = { name: tableName };
2698
- return baseSource("tileset", options, urlParameters);
2699
- };
2401
+ // dist/api/fetch-map.js
2402
+ var import_api_client2 = require("@carto/api-client");
2700
2403
 
2701
2404
  // dist/api/parse-map.js
2702
- var import_core17 = require("@deck.gl/core");
2405
+ var import_core16 = require("@deck.gl/core");
2703
2406
 
2704
2407
  // dist/api/layer-map.js
2705
2408
  var import_d3_array = require("d3-array");
@@ -2739,6 +2442,7 @@ var OPACITY_MAP = {
2739
2442
  var AGGREGATION_FUNC = {
2740
2443
  "count unique": (values, accessor) => (0, import_d3_array.groupSort)(values, (v) => v.length, accessor).length,
2741
2444
  median: import_d3_array.median,
2445
+ // Unfortunately mode() is only available in d3-array@3+ which is ESM only
2742
2446
  mode: (values, accessor) => (0, import_d3_array.groupSort)(values, (v) => v.length, accessor).pop(),
2743
2447
  stddev: import_d3_array.deviation,
2744
2448
  variance: import_d3_array.variance
@@ -2757,12 +2461,14 @@ var hexToRGBA = (c) => {
2757
2461
  return [r, g, b, 255 * opacity];
2758
2462
  };
2759
2463
  var sharedPropMap = {
2464
+ // Apply the value of Kepler `color` prop to the deck `getFillColor` prop
2760
2465
  color: "getFillColor",
2761
2466
  isVisible: "visible",
2762
2467
  label: "cartoLabel",
2763
2468
  textLabel: {
2764
2469
  alignment: "getTextAlignmentBaseline",
2765
2470
  anchor: "getTextAnchor",
2471
+ // Apply the value of Kepler `textLabel.color` prop to the deck `getTextColor` prop
2766
2472
  color: "getTextColor",
2767
2473
  size: "getTextSize"
2768
2474
  },
@@ -2835,7 +2541,7 @@ function getLayer(type, config, dataset) {
2835
2541
  Layer: import_layers6.GeoJsonLayer
2836
2542
  },
2837
2543
  grid: {
2838
- Layer: import_aggregation_layers.CPUGridLayer,
2544
+ Layer: import_aggregation_layers.GridLayer,
2839
2545
  propMap: { visConfig: { ...aggregationVisConfig, worldUnitSize: (x) => ({ cellSize: 1e3 * x }) } },
2840
2546
  defaultProps: { getPosition }
2841
2547
  },
@@ -3074,6 +2780,7 @@ function parseMap(json) {
3074
2780
  createdAt: json.createdAt,
3075
2781
  updatedAt: json.updatedAt,
3076
2782
  initialViewState: mapState,
2783
+ /** @deprecated Use `basemap`. */
3077
2784
  mapStyle,
3078
2785
  token,
3079
2786
  layers: layers.reverse().map(({ id: id4, type, config, visualChannels }) => {
@@ -3092,11 +2799,13 @@ function parseMap(json) {
3092
2799
  ...createInteractionProps(interactionConfig),
3093
2800
  ...styleProps,
3094
2801
  ...createChannelProps(id4, type, config, visualChannels, data),
2802
+ // Must come after style
3095
2803
  ...createParametersProp(layerBlending, styleProps.parameters || {}),
2804
+ // Must come after style
3096
2805
  ...createLoadOptions(token)
3097
2806
  });
3098
2807
  } catch (e) {
3099
- import_core17.log.error(e.message)();
2808
+ import_core16.log.error(e.message)();
3100
2809
  return void 0;
3101
2810
  }
3102
2811
  })
@@ -3183,6 +2892,7 @@ function createChannelProps(id4, type, config, visualChannels, data) {
3183
2892
  const { colorAggregation: aggregation, colorRange: range } = visConfig;
3184
2893
  result.getFillColor = getColorAccessor(
3185
2894
  colorField,
2895
+ // @ts-ignore
3186
2896
  colorScale,
3187
2897
  { aggregation, range },
3188
2898
  visConfig.opacity,
@@ -3205,7 +2915,9 @@ function createChannelProps(id4, type, config, visualChannels, data) {
3205
2915
  }
3206
2916
  if (radiusField || sizeField) {
3207
2917
  result.getPointRadius = getSizeAccessor(
2918
+ // @ts-ignore
3208
2919
  radiusField || sizeField,
2920
+ // @ts-ignore
3209
2921
  radiusScale || sizeScale,
3210
2922
  visConfig.sizeAggregation,
3211
2923
  visConfig.radiusRange || visConfig.sizeRange,
@@ -3218,7 +2930,9 @@ function createChannelProps(id4, type, config, visualChannels, data) {
3218
2930
  const { strokeColorAggregation: aggregation, strokeColorRange: range } = visConfig;
3219
2931
  result.getLineColor = getColorAccessor(
3220
2932
  strokeColorField,
2933
+ // @ts-ignore
3221
2934
  strokeColorScale,
2935
+ // @ts-ignore
3222
2936
  { aggregation, range },
3223
2937
  opacity,
3224
2938
  data
@@ -3227,6 +2941,7 @@ function createChannelProps(id4, type, config, visualChannels, data) {
3227
2941
  if (heightField && visConfig.enable3d) {
3228
2942
  result.getElevation = getSizeAccessor(
3229
2943
  heightField,
2944
+ // @ts-ignore
3230
2945
  heightScale,
3231
2946
  visConfig.heightAggregation,
3232
2947
  visConfig.heightRange || visConfig.sizeRange,
@@ -3294,6 +3009,7 @@ function createChannelProps(id4, type, config, visualChannels, data) {
3294
3009
  extensions: [collisionFilterExtension],
3295
3010
  collisionEnabled: true,
3296
3011
  collisionGroup,
3012
+ // getPointRadius already has radiusScale baked in, so only pass one or the other
3297
3013
  ...result.getPointRadius ? { getRadius: result.getPointRadius } : { radiusScale: visConfig.radius },
3298
3014
  ...secondaryField && {
3299
3015
  getSecondaryText,
@@ -3382,7 +3098,7 @@ async function fetchBasemapProps({ config, errorContext, applyLayerFilters = tru
3382
3098
  }
3383
3099
 
3384
3100
  // dist/api/fetch-map.js
3385
- async function _fetchMapDataset(dataset, accessToken, apiBaseUrl, clientId, headers, maxLengthURL = DEFAULT_MAX_LENGTH_URL) {
3101
+ async function _fetchMapDataset(dataset, accessToken, apiBaseUrl, clientId, headers, maxLengthURL = import_api_client2.SOURCE_DEFAULTS.maxLengthURL) {
3386
3102
  const { aggregationExp, aggregationResLevel, connectionName, columns, format, geoColumn, source, type, queryParameters } = dataset;
3387
3103
  const cache = {};
3388
3104
  const globalOptions = {
@@ -3396,15 +3112,15 @@ async function _fetchMapDataset(dataset, accessToken, apiBaseUrl, clientId, head
3396
3112
  maxLengthURL
3397
3113
  };
3398
3114
  if (type === "tileset") {
3399
- dataset.data = await vectorTilesetSource({ ...globalOptions, tableName: source });
3115
+ dataset.data = await (0, import_api_client2.vectorTilesetSource)({ ...globalOptions, tableName: source });
3400
3116
  } else {
3401
3117
  const [spatialDataType, spatialDataColumn] = geoColumn ? geoColumn.split(":") : ["geom"];
3402
3118
  if (spatialDataType === "geom") {
3403
3119
  const options = { ...globalOptions, spatialDataColumn };
3404
3120
  if (type === "table") {
3405
- dataset.data = await vectorTableSource({ ...options, columns, tableName: source });
3121
+ dataset.data = await (0, import_api_client2.vectorTableSource)({ ...options, columns, tableName: source });
3406
3122
  } else if (type === "query") {
3407
- dataset.data = await vectorQuerySource({
3123
+ dataset.data = await (0, import_api_client2.vectorQuerySource)({
3408
3124
  ...options,
3409
3125
  columns,
3410
3126
  sqlQuery: source,
@@ -3414,16 +3130,16 @@ async function _fetchMapDataset(dataset, accessToken, apiBaseUrl, clientId, head
3414
3130
  } else if (spatialDataType === "h3") {
3415
3131
  const options = { ...globalOptions, aggregationExp, aggregationResLevel, spatialDataColumn };
3416
3132
  if (type === "table") {
3417
- dataset.data = await h3TableSource({ ...options, tableName: source });
3133
+ dataset.data = await (0, import_api_client2.h3TableSource)({ ...options, tableName: source });
3418
3134
  } else if (type === "query") {
3419
- dataset.data = await h3QuerySource({ ...options, sqlQuery: source, queryParameters });
3135
+ dataset.data = await (0, import_api_client2.h3QuerySource)({ ...options, sqlQuery: source, queryParameters });
3420
3136
  }
3421
3137
  } else if (spatialDataType === "quadbin") {
3422
3138
  const options = { ...globalOptions, aggregationExp, aggregationResLevel, spatialDataColumn };
3423
3139
  if (type === "table") {
3424
- dataset.data = await quadbinTableSource({ ...options, tableName: source });
3140
+ dataset.data = await (0, import_api_client2.quadbinTableSource)({ ...options, tableName: source });
3425
3141
  } else if (type === "query") {
3426
- dataset.data = await quadbinQuerySource({ ...options, sqlQuery: source, queryParameters });
3142
+ dataset.data = await (0, import_api_client2.quadbinQuerySource)({ ...options, sqlQuery: source, queryParameters });
3427
3143
  }
3428
3144
  }
3429
3145
  }
@@ -3434,7 +3150,7 @@ async function _fetchMapDataset(dataset, accessToken, apiBaseUrl, clientId, head
3434
3150
  }
3435
3151
  return cacheChanged;
3436
3152
  }
3437
- async function _fetchTilestats(attribute, dataset, accessToken, apiBaseUrl, maxLengthURL = DEFAULT_MAX_LENGTH_URL) {
3153
+ async function _fetchTilestats(attribute, dataset, accessToken, apiBaseUrl, maxLengthURL = import_api_client2.SOURCE_DEFAULTS.maxLengthURL) {
3438
3154
  const { connectionName, data, id: id4, source, type, queryParameters } = dataset;
3439
3155
  const errorContext = {
3440
3156
  requestType: "Tile stats",
@@ -3443,9 +3159,9 @@ async function _fetchTilestats(attribute, dataset, accessToken, apiBaseUrl, maxL
3443
3159
  source
3444
3160
  };
3445
3161
  if (!("tilestats" in data)) {
3446
- throw new CartoAPIError(new Error(`Invalid dataset for tilestats: ${id4}`), errorContext);
3162
+ throw new import_api_client2.CartoAPIError(new Error(`Invalid dataset for tilestats: ${id4}`), errorContext);
3447
3163
  }
3448
- const baseUrl = buildStatsUrl({ attribute, apiBaseUrl, ...dataset });
3164
+ const baseUrl = (0, import_api_client2.buildStatsUrl)({ attribute, apiBaseUrl, ...dataset });
3449
3165
  const client = new URLSearchParams(data.tiles[0]).get("client");
3450
3166
  const headers = { Authorization: `Bearer ${accessToken}` };
3451
3167
  const parameters = {};
@@ -3458,7 +3174,7 @@ async function _fetchTilestats(attribute, dataset, accessToken, apiBaseUrl, maxL
3458
3174
  parameters.queryParameters = JSON.stringify(queryParameters);
3459
3175
  }
3460
3176
  }
3461
- const stats = await requestWithParameters({
3177
+ const stats = await (0, import_api_client2.requestWithParameters)({
3462
3178
  baseUrl,
3463
3179
  headers,
3464
3180
  parameters,
@@ -3470,11 +3186,11 @@ async function _fetchTilestats(attribute, dataset, accessToken, apiBaseUrl, maxL
3470
3186
  attributes[index] = stats;
3471
3187
  return true;
3472
3188
  }
3473
- async function fillInMapDatasets({ datasets, token }, clientId, apiBaseUrl, headers, maxLengthURL = DEFAULT_MAX_LENGTH_URL) {
3189
+ async function fillInMapDatasets({ datasets, token }, clientId, apiBaseUrl, headers, maxLengthURL = import_api_client2.SOURCE_DEFAULTS.maxLengthURL) {
3474
3190
  const promises = datasets.map((dataset) => _fetchMapDataset(dataset, token, apiBaseUrl, clientId, headers, maxLengthURL));
3475
3191
  return await Promise.all(promises);
3476
3192
  }
3477
- async function fillInTileStats({ datasets, keplerMapConfig, token }, apiBaseUrl, maxLengthURL = DEFAULT_MAX_LENGTH_URL) {
3193
+ async function fillInTileStats({ datasets, keplerMapConfig, token }, apiBaseUrl, maxLengthURL = import_api_client2.SOURCE_DEFAULTS.maxLengthURL) {
3478
3194
  var _a;
3479
3195
  const attributes = [];
3480
3196
  const { layers } = keplerMapConfig.config.visState;
@@ -3498,7 +3214,7 @@ async function fillInTileStats({ datasets, keplerMapConfig, token }, apiBaseUrl,
3498
3214
  const promises = filteredAttributes.map(({ attribute, dataset }) => _fetchTilestats(attribute, dataset, token, apiBaseUrl, maxLengthURL));
3499
3215
  return await Promise.all(promises);
3500
3216
  }
3501
- async function fetchMap({ accessToken, apiBaseUrl = DEFAULT_API_BASE_URL, cartoMapId, clientId = DEFAULT_CLIENT, headers = {}, autoRefresh, onNewData, maxLengthURL = DEFAULT_MAX_LENGTH_URL }) {
3217
+ async function fetchMap({ accessToken, apiBaseUrl = import_api_client2.SOURCE_DEFAULTS.apiBaseUrl, cartoMapId, clientId = import_api_client2.SOURCE_DEFAULTS.clientId, headers = {}, autoRefresh, onNewData, maxLengthURL = import_api_client2.SOURCE_DEFAULTS.maxLengthURL }) {
3502
3218
  assert(cartoMapId, 'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})');
3503
3219
  assert(apiBaseUrl, "Must define apiBaseUrl");
3504
3220
  if (accessToken) {
@@ -3509,9 +3225,9 @@ async function fetchMap({ accessToken, apiBaseUrl = DEFAULT_API_BASE_URL, cartoM
3509
3225
  assert(typeof onNewData === "function", "`onNewData` must be a function");
3510
3226
  assert(typeof autoRefresh === "number" && autoRefresh > 0, "`autoRefresh` must be a positive number");
3511
3227
  }
3512
- const baseUrl = buildPublicMapUrl({ apiBaseUrl, cartoMapId });
3228
+ const baseUrl = (0, import_api_client2.buildPublicMapUrl)({ apiBaseUrl, cartoMapId });
3513
3229
  const errorContext = { requestType: "Public map", mapId: cartoMapId };
3514
- const map = await requestWithParameters({ baseUrl, headers, errorContext, maxLengthURL });
3230
+ const map = await (0, import_api_client2.requestWithParameters)({ baseUrl, headers, errorContext, maxLengthURL });
3515
3231
  let stopAutoRefresh;
3516
3232
  if (autoRefresh) {
3517
3233
  const intervalId = setInterval(async () => {
@@ -3540,6 +3256,7 @@ async function fetchMap({ accessToken, apiBaseUrl = DEFAULT_API_BASE_URL, cartoM
3540
3256
  });
3541
3257
  const [basemap] = await Promise.all([
3542
3258
  fetchBasemapProps({ config: map.keplerMapConfig.config, errorContext }),
3259
+ // Mutates map.datasets so that dataset.data contains data
3543
3260
  fillInMapDatasets(map, clientId, apiBaseUrl, headers, maxLengthURL)
3544
3261
  ]);
3545
3262
  await fillInTileStats(map, apiBaseUrl, maxLengthURL);
@@ -3555,32 +3272,8 @@ async function fetchMap({ accessToken, apiBaseUrl = DEFAULT_API_BASE_URL, cartoM
3555
3272
  return out;
3556
3273
  }
3557
3274
 
3558
- // dist/api/query.js
3559
- var query = async function(options) {
3560
- const { apiBaseUrl = SOURCE_DEFAULTS.apiBaseUrl, clientId = SOURCE_DEFAULTS.clientId, maxLengthURL = SOURCE_DEFAULTS.maxLengthURL, connectionName, sqlQuery, queryParameters } = options;
3561
- const urlParameters = { q: sqlQuery };
3562
- if (queryParameters) {
3563
- urlParameters.queryParameters = JSON.stringify(queryParameters);
3564
- }
3565
- const baseUrl = buildQueryUrl({ apiBaseUrl, connectionName });
3566
- const headers = { Authorization: `Bearer ${options.accessToken}`, ...options.headers };
3567
- const parameters = { client: clientId, ...urlParameters };
3568
- const errorContext = {
3569
- requestType: "SQL",
3570
- connection: options.connectionName,
3571
- type: "query",
3572
- source: JSON.stringify(parameters, void 0, 2)
3573
- };
3574
- return await requestWithParameters({
3575
- baseUrl,
3576
- parameters,
3577
- headers,
3578
- errorContext,
3579
- maxLengthURL
3580
- });
3581
- };
3582
-
3583
3275
  // dist/index.js
3276
+ var import_api_client3 = require("@carto/api-client");
3584
3277
  var CARTO_LAYERS = {
3585
3278
  ClusterTileLayer: cluster_tile_layer_default,
3586
3279
  H3TileLayer: h3_tile_layer_default,
@@ -3591,17 +3284,17 @@ var CARTO_LAYERS = {
3591
3284
  VectorTileLayer: vector_tile_layer_default
3592
3285
  };
3593
3286
  var CARTO_SOURCES = {
3594
- boundaryQuerySource,
3595
- boundaryTableSource,
3596
- h3QuerySource,
3597
- h3TableSource,
3598
- h3TilesetSource,
3599
- rasterSource,
3600
- quadbinQuerySource,
3601
- quadbinTableSource,
3602
- quadbinTilesetSource,
3603
- vectorQuerySource,
3604
- vectorTableSource,
3605
- vectorTilesetSource
3287
+ boundaryQuerySource: import_api_client3.boundaryQuerySource,
3288
+ boundaryTableSource: import_api_client3.boundaryTableSource,
3289
+ h3QuerySource: import_api_client3.h3QuerySource,
3290
+ h3TableSource: import_api_client3.h3TableSource,
3291
+ h3TilesetSource: import_api_client3.h3TilesetSource,
3292
+ rasterSource: import_api_client3.rasterSource,
3293
+ quadbinQuerySource: import_api_client3.quadbinQuerySource,
3294
+ quadbinTableSource: import_api_client3.quadbinTableSource,
3295
+ quadbinTilesetSource: import_api_client3.quadbinTilesetSource,
3296
+ vectorQuerySource: import_api_client3.vectorQuerySource,
3297
+ vectorTableSource: import_api_client3.vectorTableSource,
3298
+ vectorTilesetSource: import_api_client3.vectorTilesetSource
3606
3299
  };
3607
3300
  //# sourceMappingURL=index.cjs.map