@carto/api-client 0.5.7-alpha.5 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1558,6 +1558,110 @@ function geojsonFeatures({
1558
1558
  return Array.from(map.values());
1559
1559
  }
1560
1560
 
1561
+ // node_modules/@math.gl/core/dist/lib/common.js
1562
+ var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
1563
+ var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
1564
+ var DEFAULT_CONFIG = {
1565
+ EPSILON: 1e-12,
1566
+ debug: false,
1567
+ precision: 4,
1568
+ printTypes: false,
1569
+ printDegrees: false,
1570
+ printRowMajor: true,
1571
+ _cartographicRadians: false
1572
+ };
1573
+ globalThis.mathgl = globalThis.mathgl || { config: { ...DEFAULT_CONFIG } };
1574
+ var config = globalThis.mathgl.config;
1575
+ function isArray(value) {
1576
+ return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
1577
+ }
1578
+ function lerp(a, b, t) {
1579
+ if (isArray(a)) {
1580
+ return a.map((ai, i) => lerp(ai, b[i], t));
1581
+ }
1582
+ return t * b + (1 - t) * a;
1583
+ }
1584
+
1585
+ // node_modules/@math.gl/web-mercator/dist/assert.js
1586
+ function assert(condition, message) {
1587
+ if (!condition) {
1588
+ throw new Error(message || "@math.gl/web-mercator: assertion failed.");
1589
+ }
1590
+ }
1591
+
1592
+ // node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js
1593
+ var PI = Math.PI;
1594
+ var PI_4 = PI / 4;
1595
+ var DEGREES_TO_RADIANS2 = PI / 180;
1596
+ var RADIANS_TO_DEGREES2 = 180 / PI;
1597
+ var TILE_SIZE = 512;
1598
+ function lngLatToWorld(lngLat) {
1599
+ const [lng, lat] = lngLat;
1600
+ assert(Number.isFinite(lng));
1601
+ assert(Number.isFinite(lat) && lat >= -90 && lat <= 90, "invalid latitude");
1602
+ const lambda2 = lng * DEGREES_TO_RADIANS2;
1603
+ const phi2 = lat * DEGREES_TO_RADIANS2;
1604
+ const x = TILE_SIZE * (lambda2 + PI) / (2 * PI);
1605
+ const y = TILE_SIZE * (PI + Math.log(Math.tan(PI_4 + phi2 * 0.5))) / (2 * PI);
1606
+ return [x, y];
1607
+ }
1608
+ function worldToLngLat(xy) {
1609
+ const [x, y] = xy;
1610
+ const lambda2 = x / TILE_SIZE * (2 * PI) - PI;
1611
+ const phi2 = 2 * (Math.atan(Math.exp(y / TILE_SIZE * (2 * PI) - PI)) - PI_4);
1612
+ return [lambda2 * RADIANS_TO_DEGREES2, phi2 * RADIANS_TO_DEGREES2];
1613
+ }
1614
+
1615
+ // node_modules/@math.gl/web-mercator/dist/get-bounds.js
1616
+ var DEGREES_TO_RADIANS3 = Math.PI / 180;
1617
+
1618
+ // src/utils/transformTileCoordsToWGS84.ts
1619
+ var TRANSFORM_FN = {
1620
+ Point: transformPoint,
1621
+ MultiPoint: transformMultiPoint,
1622
+ LineString: transformLineString,
1623
+ MultiLineString: transformMultiLineString,
1624
+ Polygon: transformPolygon,
1625
+ MultiPolygon: transformMultiPolygon
1626
+ };
1627
+ function transformTileCoordsToWGS84(geometry, bbox2) {
1628
+ const [west, south, east, north] = bbox2;
1629
+ const nw = lngLatToWorld([west, north]);
1630
+ const se = lngLatToWorld([east, south]);
1631
+ const projectedBbox = [nw, se];
1632
+ if (geometry.type === "GeometryCollection") {
1633
+ throw new Error("Unsupported geometry type GeometryCollection");
1634
+ }
1635
+ const transformFn = TRANSFORM_FN[geometry.type];
1636
+ const coordinates = transformFn(geometry.coordinates, projectedBbox);
1637
+ return { ...geometry, coordinates };
1638
+ }
1639
+ function transformPoint([pointX, pointY], [nw, se]) {
1640
+ const x = lerp(nw[0], se[0], pointX);
1641
+ const y = lerp(nw[1], se[1], pointY);
1642
+ return worldToLngLat([x, y]);
1643
+ }
1644
+ function getPoints(geometry, bbox2) {
1645
+ return geometry.map((g) => transformPoint(g, bbox2));
1646
+ }
1647
+ function transformMultiPoint(multiPoint, bbox2) {
1648
+ return getPoints(multiPoint, bbox2);
1649
+ }
1650
+ function transformLineString(line, bbox2) {
1651
+ return getPoints(line, bbox2);
1652
+ }
1653
+ function transformMultiLineString(multiLineString2, bbox2) {
1654
+ return multiLineString2.map(
1655
+ (lineString2) => transformLineString(lineString2, bbox2)
1656
+ );
1657
+ }
1658
+ function transformPolygon(polygon2, bbox2) {
1659
+ return polygon2.map((polygonRing) => getPoints(polygonRing, bbox2));
1660
+ }
1661
+ function transformMultiPolygon(multiPolygon2, bbox2) {
1662
+ return multiPolygon2.map((polygon2) => transformPolygon(polygon2, bbox2));
1663
+ }
1664
+
1561
1665
  // node_modules/@turf/bbox-polygon/dist/esm/index.js
1562
1666
  function bboxPolygon(bbox2, options = {}) {
1563
1667
  const west = Number(bbox2[0]);
@@ -1876,7 +1980,7 @@ var MAX_SAFE_INTEGER = 9007199254740991;
1876
1980
  var POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13];
1877
1981
  var SQRT_BASE = 1e7;
1878
1982
  var MAX = 1e9;
1879
- function clone(configObject) {
1983
+ function clone2(configObject) {
1880
1984
  var div, convertBase, parseNumeric, P = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
1881
1985
  prefix: "",
1882
1986
  groupSize: 3,
@@ -2002,7 +2106,7 @@ function clone(configObject) {
2002
2106
  x.c = [x.e = 0];
2003
2107
  }
2004
2108
  }
2005
- BigNumber2.clone = clone;
2109
+ BigNumber2.clone = clone2;
2006
2110
  BigNumber2.ROUND_UP = 0;
2007
2111
  BigNumber2.ROUND_DOWN = 1;
2008
2112
  BigNumber2.ROUND_CEIL = 2;
@@ -3205,7 +3309,7 @@ function toFixedPoint(str, e, z) {
3205
3309
  }
3206
3310
  return str;
3207
3311
  }
3208
- var BigNumber = clone();
3312
+ var BigNumber = clone2();
3209
3313
  var bignumber_default = BigNumber;
3210
3314
 
3211
3315
  // node_modules/splaytree-ts/dist/esm/index.js
@@ -4775,71 +4879,14 @@ function intersect(features, options = {}) {
4775
4879
  }
4776
4880
  var turf_intersect_default = intersect;
4777
4881
 
4778
- // node_modules/@math.gl/core/dist/lib/common.js
4779
- var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
4780
- var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
4781
- var DEFAULT_CONFIG = {
4782
- EPSILON: 1e-12,
4783
- debug: false,
4784
- precision: 4,
4785
- printTypes: false,
4786
- printDegrees: false,
4787
- printRowMajor: true,
4788
- _cartographicRadians: false
4789
- };
4790
- globalThis.mathgl = globalThis.mathgl || { config: { ...DEFAULT_CONFIG } };
4791
- var config = globalThis.mathgl.config;
4792
- function isArray(value) {
4793
- return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
4794
- }
4795
- function lerp(a, b, t) {
4796
- if (isArray(a)) {
4797
- return a.map((ai, i) => lerp(ai, b[i], t));
4798
- }
4799
- return t * b + (1 - t) * a;
4800
- }
4801
-
4802
- // node_modules/@math.gl/web-mercator/dist/assert.js
4803
- function assert(condition, message) {
4804
- if (!condition) {
4805
- throw new Error(message || "@math.gl/web-mercator: assertion failed.");
4806
- }
4807
- }
4808
-
4809
- // node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js
4810
- var PI = Math.PI;
4811
- var PI_4 = PI / 4;
4812
- var DEGREES_TO_RADIANS2 = PI / 180;
4813
- var RADIANS_TO_DEGREES2 = 180 / PI;
4814
- var TILE_SIZE = 512;
4815
- function lngLatToWorld(lngLat) {
4816
- const [lng, lat] = lngLat;
4817
- assert(Number.isFinite(lng));
4818
- assert(Number.isFinite(lat) && lat >= -90 && lat <= 90, "invalid latitude");
4819
- const lambda2 = lng * DEGREES_TO_RADIANS2;
4820
- const phi2 = lat * DEGREES_TO_RADIANS2;
4821
- const x = TILE_SIZE * (lambda2 + PI) / (2 * PI);
4822
- const y = TILE_SIZE * (PI + Math.log(Math.tan(PI_4 + phi2 * 0.5))) / (2 * PI);
4823
- return [x, y];
4824
- }
4825
- function worldToLngLat(xy) {
4826
- const [x, y] = xy;
4827
- const lambda2 = x / TILE_SIZE * (2 * PI) - PI;
4828
- const phi2 = 2 * (Math.atan(Math.exp(y / TILE_SIZE * (2 * PI) - PI)) - PI_4);
4829
- return [lambda2 * RADIANS_TO_DEGREES2, phi2 * RADIANS_TO_DEGREES2];
4830
- }
4831
-
4832
- // node_modules/@math.gl/web-mercator/dist/get-bounds.js
4833
- var DEGREES_TO_RADIANS3 = Math.PI / 180;
4834
-
4835
4882
  // src/utils/transformToTileCoords.ts
4836
- var TRANSFORM_FN = {
4837
- Point: transformPoint,
4838
- MultiPoint: transformMultiPoint,
4839
- LineString: transformLineString,
4840
- MultiLineString: transformMultiLineString,
4841
- Polygon: transformPolygon,
4842
- MultiPolygon: transformMultiPolygon
4883
+ var TRANSFORM_FN2 = {
4884
+ Point: transformPoint2,
4885
+ MultiPoint: transformMultiPoint2,
4886
+ LineString: transformLineString2,
4887
+ MultiLineString: transformMultiLineString2,
4888
+ Polygon: transformPolygon2,
4889
+ MultiPolygon: transformMultiPolygon2
4843
4890
  };
4844
4891
  function transformToTileCoords(geometry, bbox2) {
4845
4892
  const [west, south, east, north] = bbox2;
@@ -4849,34 +4896,34 @@ function transformToTileCoords(geometry, bbox2) {
4849
4896
  if (geometry.type === "GeometryCollection") {
4850
4897
  throw new Error("Unsupported geometry type GeometryCollection");
4851
4898
  }
4852
- const transformFn = TRANSFORM_FN[geometry.type];
4899
+ const transformFn = TRANSFORM_FN2[geometry.type];
4853
4900
  const coordinates = transformFn(geometry.coordinates, projectedBbox);
4854
4901
  return { ...geometry, coordinates };
4855
4902
  }
4856
- function transformPoint([pointX, pointY], [nw, se]) {
4903
+ function transformPoint2([pointX, pointY], [nw, se]) {
4857
4904
  const x = inverseLerp(nw[0], se[0], pointX);
4858
4905
  const y = inverseLerp(nw[1], se[1], pointY);
4859
4906
  return [x, y];
4860
4907
  }
4861
- function getPoints(geometry, bbox2) {
4862
- return geometry.map((g) => transformPoint(projectFlat(g), bbox2));
4908
+ function getPoints2(geometry, bbox2) {
4909
+ return geometry.map((g) => transformPoint2(projectFlat(g), bbox2));
4863
4910
  }
4864
- function transformMultiPoint(multiPoint, bbox2) {
4865
- return getPoints(multiPoint, bbox2);
4911
+ function transformMultiPoint2(multiPoint, bbox2) {
4912
+ return getPoints2(multiPoint, bbox2);
4866
4913
  }
4867
- function transformLineString(line, bbox2) {
4868
- return getPoints(line, bbox2);
4914
+ function transformLineString2(line, bbox2) {
4915
+ return getPoints2(line, bbox2);
4869
4916
  }
4870
- function transformMultiLineString(multiLineString2, bbox2) {
4917
+ function transformMultiLineString2(multiLineString2, bbox2) {
4871
4918
  return multiLineString2.map(
4872
- (lineString2) => transformLineString(lineString2, bbox2)
4919
+ (lineString2) => transformLineString2(lineString2, bbox2)
4873
4920
  );
4874
4921
  }
4875
- function transformPolygon(polygon2, bbox2) {
4876
- return polygon2.map((polygonRing) => getPoints(polygonRing, bbox2));
4922
+ function transformPolygon2(polygon2, bbox2) {
4923
+ return polygon2.map((polygonRing) => getPoints2(polygonRing, bbox2));
4877
4924
  }
4878
- function transformMultiPolygon(multiPolygon2, bbox2) {
4879
- return multiPolygon2.map((polygon2) => transformPolygon(polygon2, bbox2));
4925
+ function transformMultiPolygon2(multiPolygon2, bbox2) {
4926
+ return multiPolygon2.map((polygon2) => transformPolygon2(polygon2, bbox2));
4880
4927
  }
4881
4928
  function projectFlat(xyz) {
4882
4929
  return lngLatToWorld(xyz);
@@ -4885,51 +4932,183 @@ function inverseLerp(a, b, x) {
4885
4932
  return (x - a) / (b - a);
4886
4933
  }
4887
4934
 
4888
- // src/utils/transformTileCoordsToWGS84.ts
4889
- var TRANSFORM_FN2 = {
4890
- Point: transformPoint2,
4891
- MultiPoint: transformMultiPoint2,
4892
- LineString: transformLineString2,
4893
- MultiLineString: transformMultiLineString2,
4894
- Polygon: transformPolygon2,
4895
- MultiPolygon: transformMultiPolygon2
4896
- };
4897
- function transformTileCoordsToWGS84(geometry, bbox2) {
4898
- const [west, south, east, north] = bbox2;
4899
- const nw = lngLatToWorld([west, north]);
4900
- const se = lngLatToWorld([east, south]);
4901
- const projectedBbox = [nw, se];
4902
- if (geometry.type === "GeometryCollection") {
4903
- throw new Error("Unsupported geometry type GeometryCollection");
4935
+ // src/filters/tileIntersection.ts
4936
+ import {
4937
+ cellToBoundary as quadbinCellToBoundary,
4938
+ geometryToCells as quadbinGeometryToCells
4939
+ } from "quadbin";
4940
+ import { polygonToCells as h3PolygonToCells } from "h3-js";
4941
+
4942
+ // node_modules/@turf/bbox-clip/dist/esm/index.js
4943
+ function lineclip(points, bbox2, result) {
4944
+ var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i, codeB, lastCode;
4945
+ let a;
4946
+ let b;
4947
+ if (!result) result = [];
4948
+ for (i = 1; i < len; i++) {
4949
+ a = points[i - 1];
4950
+ b = points[i];
4951
+ codeB = lastCode = bitCode(b, bbox2);
4952
+ while (true) {
4953
+ if (!(codeA | codeB)) {
4954
+ part.push(a);
4955
+ if (codeB !== lastCode) {
4956
+ part.push(b);
4957
+ if (i < len - 1) {
4958
+ result.push(part);
4959
+ part = [];
4960
+ }
4961
+ } else if (i === len - 1) {
4962
+ part.push(b);
4963
+ }
4964
+ break;
4965
+ } else if (codeA & codeB) {
4966
+ break;
4967
+ } else if (codeA) {
4968
+ a = intersect2(a, b, codeA, bbox2);
4969
+ codeA = bitCode(a, bbox2);
4970
+ } else {
4971
+ b = intersect2(a, b, codeB, bbox2);
4972
+ codeB = bitCode(b, bbox2);
4973
+ }
4974
+ }
4975
+ codeA = lastCode;
4904
4976
  }
4905
- const transformFn = TRANSFORM_FN2[geometry.type];
4906
- const coordinates = transformFn(geometry.coordinates, projectedBbox);
4907
- return { ...geometry, coordinates };
4977
+ if (part.length) result.push(part);
4978
+ return result;
4908
4979
  }
4909
- function transformPoint2([pointX, pointY], [nw, se]) {
4910
- const x = lerp(nw[0], se[0], pointX);
4911
- const y = lerp(nw[1], se[1], pointY);
4912
- return worldToLngLat([x, y]);
4980
+ function polygonclip(points, bbox2) {
4981
+ var result, edge, prev, prevInside, i, p, inside;
4982
+ for (edge = 1; edge <= 8; edge *= 2) {
4983
+ result = [];
4984
+ prev = points[points.length - 1];
4985
+ prevInside = !(bitCode(prev, bbox2) & edge);
4986
+ for (i = 0; i < points.length; i++) {
4987
+ p = points[i];
4988
+ inside = !(bitCode(p, bbox2) & edge);
4989
+ if (inside !== prevInside) result.push(intersect2(prev, p, edge, bbox2));
4990
+ if (inside) result.push(p);
4991
+ prev = p;
4992
+ prevInside = inside;
4993
+ }
4994
+ points = result;
4995
+ if (!points.length) break;
4996
+ }
4997
+ return result;
4913
4998
  }
4914
- function getPoints2(geometry, bbox2) {
4915
- return geometry.map((g) => transformPoint2(g, bbox2));
4999
+ function intersect2(a, b, edge, bbox2) {
5000
+ return edge & 8 ? [a[0] + (b[0] - a[0]) * (bbox2[3] - a[1]) / (b[1] - a[1]), bbox2[3]] : edge & 4 ? [a[0] + (b[0] - a[0]) * (bbox2[1] - a[1]) / (b[1] - a[1]), bbox2[1]] : edge & 2 ? [bbox2[2], a[1] + (b[1] - a[1]) * (bbox2[2] - a[0]) / (b[0] - a[0])] : edge & 1 ? [bbox2[0], a[1] + (b[1] - a[1]) * (bbox2[0] - a[0]) / (b[0] - a[0])] : null;
4916
5001
  }
4917
- function transformMultiPoint2(multiPoint, bbox2) {
4918
- return getPoints2(multiPoint, bbox2);
5002
+ function bitCode(p, bbox2) {
5003
+ var code = 0;
5004
+ if (p[0] < bbox2[0]) code |= 1;
5005
+ else if (p[0] > bbox2[2]) code |= 2;
5006
+ if (p[1] < bbox2[1]) code |= 4;
5007
+ else if (p[1] > bbox2[3]) code |= 8;
5008
+ return code;
4919
5009
  }
4920
- function transformLineString2(line, bbox2) {
4921
- return getPoints2(line, bbox2);
5010
+ function bboxClip(feature2, bbox2) {
5011
+ const geom = getGeom(feature2);
5012
+ const type = geom.type;
5013
+ const properties = feature2.type === "Feature" ? feature2.properties : {};
5014
+ let coords = geom.coordinates;
5015
+ switch (type) {
5016
+ case "LineString":
5017
+ case "MultiLineString": {
5018
+ const lines = [];
5019
+ if (type === "LineString") {
5020
+ coords = [coords];
5021
+ }
5022
+ coords.forEach((line) => {
5023
+ lineclip(line, bbox2, lines);
5024
+ });
5025
+ if (lines.length === 1) {
5026
+ return lineString(lines[0], properties);
5027
+ }
5028
+ return multiLineString(lines, properties);
5029
+ }
5030
+ case "Polygon":
5031
+ return polygon(clipPolygon(coords, bbox2), properties);
5032
+ case "MultiPolygon":
5033
+ return multiPolygon(
5034
+ coords.map((poly) => {
5035
+ return clipPolygon(poly, bbox2);
5036
+ }),
5037
+ properties
5038
+ );
5039
+ default:
5040
+ throw new Error("geometry " + type + " not supported");
5041
+ }
4922
5042
  }
4923
- function transformMultiLineString2(multiLineString2, bbox2) {
4924
- return multiLineString2.map(
4925
- (lineString2) => transformLineString2(lineString2, bbox2)
5043
+ function clipPolygon(rings, bbox2) {
5044
+ const outRings = [];
5045
+ for (const ring of rings) {
5046
+ const clipped = polygonclip(ring, bbox2);
5047
+ if (clipped.length > 0) {
5048
+ if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
5049
+ clipped.push(clipped[0]);
5050
+ }
5051
+ if (clipped.length >= 4) {
5052
+ outRings.push(clipped);
5053
+ }
5054
+ }
5055
+ }
5056
+ return outRings;
5057
+ }
5058
+ var turf_bbox_clip_default = bboxClip;
5059
+
5060
+ // src/filters/tileIntersection.ts
5061
+ function intersectTileGeometry(tileBbox, tileFormat, spatialFilter) {
5062
+ const tilePolygon = turf_bbox_polygon_default(tileBbox);
5063
+ if (!spatialFilter || turf_boolean_within_default(tilePolygon, spatialFilter)) {
5064
+ return true;
5065
+ }
5066
+ const clippedSpatialFilter = turf_intersect_default(
5067
+ featureCollection([tilePolygon, feature(spatialFilter)])
4926
5068
  );
5069
+ if (!clippedSpatialFilter) {
5070
+ return false;
5071
+ }
5072
+ return tileFormat === "mvt" /* MVT */ ? transformToTileCoords(clippedSpatialFilter.geometry, tileBbox) : clippedSpatialFilter.geometry;
4927
5073
  }
4928
- function transformPolygon2(polygon2, bbox2) {
4929
- return polygon2.map((polygonRing) => getPoints2(polygonRing, bbox2));
5074
+ function intersectTileRaster(parent, cellResolution, spatialFilter) {
5075
+ return intersectTileQuadbin(parent, cellResolution, spatialFilter);
4930
5076
  }
4931
- function transformMultiPolygon2(multiPolygon2, bbox2) {
4932
- return multiPolygon2.map((polygon2) => transformPolygon2(polygon2, bbox2));
5077
+ function intersectTileQuadbin(parent, cellResolution, spatialFilter) {
5078
+ const tilePolygon = quadbinCellToBoundary(parent);
5079
+ if (!spatialFilter || turf_boolean_within_default(tilePolygon, spatialFilter)) {
5080
+ return true;
5081
+ }
5082
+ const clippedSpatialFilter = turf_intersect_default(
5083
+ featureCollection([feature(tilePolygon), feature(spatialFilter)])
5084
+ );
5085
+ if (!clippedSpatialFilter) {
5086
+ return false;
5087
+ }
5088
+ const cells = quadbinGeometryToCells(
5089
+ clippedSpatialFilter.geometry,
5090
+ cellResolution
5091
+ );
5092
+ return new Set(cells);
5093
+ }
5094
+ var BBOX_WEST = [-180, -90, 0, 90];
5095
+ var BBOX_EAST = [0, -90, 180, 90];
5096
+ function intersectTileH3(cellResolution, spatialFilter) {
5097
+ if (!spatialFilter) {
5098
+ return true;
5099
+ }
5100
+ const spatialFilterFeature = feature(spatialFilter);
5101
+ const cellsWest = h3PolygonToCells(
5102
+ turf_bbox_clip_default(spatialFilterFeature, BBOX_WEST).geometry.coordinates,
5103
+ cellResolution,
5104
+ true
5105
+ );
5106
+ const cellsEast = h3PolygonToCells(
5107
+ turf_bbox_clip_default(spatialFilterFeature, BBOX_EAST).geometry.coordinates,
5108
+ cellResolution,
5109
+ true
5110
+ );
5111
+ return new Set(cellsWest.concat(cellsEast));
4933
5112
  }
4934
5113
 
4935
5114
  // src/filters/tileFeaturesGeometries.ts
@@ -4946,55 +5125,45 @@ function tileFeaturesGeometries({
4946
5125
  if (tile.isVisible === false || !tile.data) {
4947
5126
  continue;
4948
5127
  }
4949
- const bbox2 = [
5128
+ const tileBbox = [
4950
5129
  tile.bbox.west,
4951
5130
  tile.bbox.south,
4952
5131
  tile.bbox.east,
4953
5132
  tile.bbox.north
4954
5133
  ];
4955
- const bboxToGeom = turf_bbox_polygon_default(bbox2);
4956
- const tileIsFullyVisible = turf_boolean_within_default(bboxToGeom, spatialFilter);
4957
- const spatialFilterFeature = {
4958
- type: "Feature",
4959
- geometry: spatialFilter,
4960
- properties: {}
4961
- };
4962
- const clippedGeometryToIntersect = turf_intersect_default(
4963
- featureCollection([bboxToGeom, spatialFilterFeature])
5134
+ const intersection3 = intersectTileGeometry(
5135
+ tileBbox,
5136
+ tileFormat,
5137
+ spatialFilter
4964
5138
  );
4965
- if (!clippedGeometryToIntersect) {
4966
- continue;
4967
- }
4968
- const transformedGeometryToIntersect = tileFormat === "mvt" /* MVT */ ? transformToTileCoords(clippedGeometryToIntersect.geometry, bbox2) : clippedGeometryToIntersect.geometry;
5139
+ if (intersection3 === false) continue;
5140
+ const transformedSpatialFilter = intersection3 === true ? void 0 : intersection3;
4969
5141
  calculateFeatures({
4970
5142
  map,
4971
- tileIsFullyVisible,
4972
- geometryIntersection: transformedGeometryToIntersect,
5143
+ spatialFilter: transformedSpatialFilter,
4973
5144
  data: tile.data.points,
4974
5145
  type: "Point",
4975
- bbox: bbox2,
5146
+ bbox: tileBbox,
4976
5147
  tileFormat,
4977
5148
  uniqueIdProperty,
4978
5149
  options
4979
5150
  });
4980
5151
  calculateFeatures({
4981
5152
  map,
4982
- tileIsFullyVisible,
4983
- geometryIntersection: transformedGeometryToIntersect,
5153
+ spatialFilter: transformedSpatialFilter,
4984
5154
  data: tile.data.lines,
4985
5155
  type: "LineString",
4986
- bbox: bbox2,
5156
+ bbox: tileBbox,
4987
5157
  tileFormat,
4988
5158
  uniqueIdProperty,
4989
5159
  options
4990
5160
  });
4991
5161
  calculateFeatures({
4992
5162
  map,
4993
- tileIsFullyVisible,
4994
- geometryIntersection: transformedGeometryToIntersect,
5163
+ spatialFilter: transformedSpatialFilter,
4995
5164
  data: tile.data.polygons,
4996
5165
  type: "Polygon",
4997
- bbox: bbox2,
5166
+ bbox: tileBbox,
4998
5167
  tileFormat,
4999
5168
  uniqueIdProperty,
5000
5169
  options
@@ -5012,7 +5181,7 @@ function processTileFeatureProperties({
5012
5181
  tileFormat,
5013
5182
  uniqueIdProperty,
5014
5183
  storeGeometry,
5015
- geometryIntersection
5184
+ spatialFilter
5016
5185
  }) {
5017
5186
  const tileProps = getPropertiesFromTile(data, startIndex);
5018
5187
  const uniquePropertyValue = getUniquePropertyValue(
@@ -5024,7 +5193,7 @@ function processTileFeatureProperties({
5024
5193
  return;
5025
5194
  }
5026
5195
  let geometry = null;
5027
- if (storeGeometry || geometryIntersection) {
5196
+ if (storeGeometry || spatialFilter) {
5028
5197
  const { positions } = data;
5029
5198
  const ringCoordinates = getRingCoordinatesFor(
5030
5199
  startIndex,
@@ -5033,7 +5202,7 @@ function processTileFeatureProperties({
5033
5202
  );
5034
5203
  geometry = getFeatureByType(ringCoordinates, type);
5035
5204
  }
5036
- if (geometry && geometryIntersection && !turf_boolean_intersects_default(geometry, geometryIntersection)) {
5205
+ if (geometry && spatialFilter && !turf_boolean_intersects_default(geometry, spatialFilter)) {
5037
5206
  return;
5038
5207
  }
5039
5208
  const properties = parseProperties(tileProps);
@@ -5045,7 +5214,7 @@ function processTileFeatureProperties({
5045
5214
  function addIntersectedFeaturesInTile({
5046
5215
  map,
5047
5216
  data,
5048
- geometryIntersection,
5217
+ spatialFilter,
5049
5218
  type,
5050
5219
  bbox: bbox2,
5051
5220
  tileFormat,
@@ -5067,7 +5236,7 @@ function addIntersectedFeaturesInTile({
5067
5236
  tileFormat,
5068
5237
  uniqueIdProperty,
5069
5238
  storeGeometry,
5070
- geometryIntersection
5239
+ spatialFilter
5071
5240
  });
5072
5241
  }
5073
5242
  }
@@ -5149,8 +5318,7 @@ function getRingCoordinatesFor(startIndex, endIndex, positions) {
5149
5318
  }
5150
5319
  function calculateFeatures({
5151
5320
  map,
5152
- tileIsFullyVisible,
5153
- geometryIntersection,
5321
+ spatialFilter,
5154
5322
  data,
5155
5323
  type,
5156
5324
  bbox: bbox2,
@@ -5161,7 +5329,7 @@ function calculateFeatures({
5161
5329
  if (!data?.properties.length) {
5162
5330
  return;
5163
5331
  }
5164
- if (tileIsFullyVisible) {
5332
+ if (!spatialFilter) {
5165
5333
  addAllFeaturesInTile({
5166
5334
  map,
5167
5335
  data,
@@ -5175,7 +5343,7 @@ function calculateFeatures({
5175
5343
  addIntersectedFeaturesInTile({
5176
5344
  map,
5177
5345
  data,
5178
- geometryIntersection,
5346
+ spatialFilter,
5179
5347
  type,
5180
5348
  bbox: bbox2,
5181
5349
  tileFormat,
@@ -5225,128 +5393,8 @@ function createIndicesForPoints(data) {
5225
5393
  }
5226
5394
 
5227
5395
  // src/filters/tileFeaturesSpatialIndex.ts
5228
- import { getResolution as quadbinGetResolution, geometryToCells } from "quadbin";
5229
-
5230
- // node_modules/@turf/bbox-clip/dist/esm/index.js
5231
- function lineclip(points, bbox2, result) {
5232
- var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i, codeB, lastCode;
5233
- let a;
5234
- let b;
5235
- if (!result) result = [];
5236
- for (i = 1; i < len; i++) {
5237
- a = points[i - 1];
5238
- b = points[i];
5239
- codeB = lastCode = bitCode(b, bbox2);
5240
- while (true) {
5241
- if (!(codeA | codeB)) {
5242
- part.push(a);
5243
- if (codeB !== lastCode) {
5244
- part.push(b);
5245
- if (i < len - 1) {
5246
- result.push(part);
5247
- part = [];
5248
- }
5249
- } else if (i === len - 1) {
5250
- part.push(b);
5251
- }
5252
- break;
5253
- } else if (codeA & codeB) {
5254
- break;
5255
- } else if (codeA) {
5256
- a = intersect2(a, b, codeA, bbox2);
5257
- codeA = bitCode(a, bbox2);
5258
- } else {
5259
- b = intersect2(a, b, codeB, bbox2);
5260
- codeB = bitCode(b, bbox2);
5261
- }
5262
- }
5263
- codeA = lastCode;
5264
- }
5265
- if (part.length) result.push(part);
5266
- return result;
5267
- }
5268
- function polygonclip(points, bbox2) {
5269
- var result, edge, prev, prevInside, i, p, inside;
5270
- for (edge = 1; edge <= 8; edge *= 2) {
5271
- result = [];
5272
- prev = points[points.length - 1];
5273
- prevInside = !(bitCode(prev, bbox2) & edge);
5274
- for (i = 0; i < points.length; i++) {
5275
- p = points[i];
5276
- inside = !(bitCode(p, bbox2) & edge);
5277
- if (inside !== prevInside) result.push(intersect2(prev, p, edge, bbox2));
5278
- if (inside) result.push(p);
5279
- prev = p;
5280
- prevInside = inside;
5281
- }
5282
- points = result;
5283
- if (!points.length) break;
5284
- }
5285
- return result;
5286
- }
5287
- function intersect2(a, b, edge, bbox2) {
5288
- return edge & 8 ? [a[0] + (b[0] - a[0]) * (bbox2[3] - a[1]) / (b[1] - a[1]), bbox2[3]] : edge & 4 ? [a[0] + (b[0] - a[0]) * (bbox2[1] - a[1]) / (b[1] - a[1]), bbox2[1]] : edge & 2 ? [bbox2[2], a[1] + (b[1] - a[1]) * (bbox2[2] - a[0]) / (b[0] - a[0])] : edge & 1 ? [bbox2[0], a[1] + (b[1] - a[1]) * (bbox2[0] - a[0]) / (b[0] - a[0])] : null;
5289
- }
5290
- function bitCode(p, bbox2) {
5291
- var code = 0;
5292
- if (p[0] < bbox2[0]) code |= 1;
5293
- else if (p[0] > bbox2[2]) code |= 2;
5294
- if (p[1] < bbox2[1]) code |= 4;
5295
- else if (p[1] > bbox2[3]) code |= 8;
5296
- return code;
5297
- }
5298
- function bboxClip(feature2, bbox2) {
5299
- const geom = getGeom(feature2);
5300
- const type = geom.type;
5301
- const properties = feature2.type === "Feature" ? feature2.properties : {};
5302
- let coords = geom.coordinates;
5303
- switch (type) {
5304
- case "LineString":
5305
- case "MultiLineString": {
5306
- const lines = [];
5307
- if (type === "LineString") {
5308
- coords = [coords];
5309
- }
5310
- coords.forEach((line) => {
5311
- lineclip(line, bbox2, lines);
5312
- });
5313
- if (lines.length === 1) {
5314
- return lineString(lines[0], properties);
5315
- }
5316
- return multiLineString(lines, properties);
5317
- }
5318
- case "Polygon":
5319
- return polygon(clipPolygon(coords, bbox2), properties);
5320
- case "MultiPolygon":
5321
- return multiPolygon(
5322
- coords.map((poly) => {
5323
- return clipPolygon(poly, bbox2);
5324
- }),
5325
- properties
5326
- );
5327
- default:
5328
- throw new Error("geometry " + type + " not supported");
5329
- }
5330
- }
5331
- function clipPolygon(rings, bbox2) {
5332
- const outRings = [];
5333
- for (const ring of rings) {
5334
- const clipped = polygonclip(ring, bbox2);
5335
- if (clipped.length > 0) {
5336
- if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
5337
- clipped.push(clipped[0]);
5338
- }
5339
- if (clipped.length >= 4) {
5340
- outRings.push(clipped);
5341
- }
5342
- }
5343
- }
5344
- return outRings;
5345
- }
5346
- var turf_bbox_clip_default = bboxClip;
5347
-
5348
- // src/filters/tileFeaturesSpatialIndex.ts
5349
- import { getResolution as h3GetResolution, polygonToCells } from "h3-js";
5396
+ import { getResolution as quadbinGetResolution } from "quadbin";
5397
+ import { getResolution as h3GetResolution } from "h3-js";
5350
5398
  function tileFeaturesSpatialIndex({
5351
5399
  tiles,
5352
5400
  spatialFilter,
@@ -5355,28 +5403,42 @@ function tileFeaturesSpatialIndex({
5355
5403
  }) {
5356
5404
  const map = /* @__PURE__ */ new Map();
5357
5405
  const spatialIndex = getSpatialIndex(spatialDataType);
5358
- const resolution = getResolution(tiles, spatialIndex);
5406
+ const cellResolution = getResolution(tiles, spatialIndex);
5359
5407
  const spatialIndexIDName = spatialDataColumn ? spatialDataColumn : spatialIndex;
5360
- if (!resolution) {
5408
+ if (!cellResolution) {
5361
5409
  return [];
5362
5410
  }
5363
- const cells = getCellsCoverGeometry(spatialFilter, spatialIndex, resolution);
5364
- if (!cells?.length) {
5365
- return [];
5411
+ let intersection3;
5412
+ if (spatialIndex === "h3" /* H3 */) {
5413
+ intersection3 = intersectTileH3(cellResolution, spatialFilter);
5366
5414
  }
5367
- const cellsSet = new Set(cells);
5368
5415
  for (const tile of tiles) {
5369
5416
  if (tile.isVisible === false || !tile.data) {
5370
5417
  continue;
5371
5418
  }
5419
+ if (spatialIndex === "quadbin" /* QUADBIN */) {
5420
+ const parent = getTileIndex(tile, spatialIndex);
5421
+ intersection3 = intersectTileQuadbin(
5422
+ parent,
5423
+ cellResolution,
5424
+ spatialFilter
5425
+ );
5426
+ }
5427
+ if (!intersection3) continue;
5372
5428
  tile.data.forEach((d) => {
5373
- if (cellsSet.has(d.id)) {
5429
+ if (intersection3 === true || intersection3.has(d.id)) {
5374
5430
  map.set(d.id, { ...d.properties, [spatialIndexIDName]: d.id });
5375
5431
  }
5376
5432
  });
5377
5433
  }
5378
5434
  return Array.from(map.values());
5379
5435
  }
5436
+ function getTileIndex(tile, spatialIndex) {
5437
+ if (spatialIndex === "quadbin" /* QUADBIN */) {
5438
+ return tile.index.q;
5439
+ }
5440
+ return tile.id;
5441
+ }
5380
5442
  function getResolution(tiles, spatialIndex) {
5381
5443
  const data = tiles.find((tile) => tile.data?.length)?.data;
5382
5444
  if (!data) {
@@ -5389,26 +5451,6 @@ function getResolution(tiles, spatialIndex) {
5389
5451
  return h3GetResolution(data[0].id);
5390
5452
  }
5391
5453
  }
5392
- var bboxWest = [-180, -90, 0, 90];
5393
- var bboxEast = [0, -90, 180, 90];
5394
- function getCellsCoverGeometry(geometry, spatialIndex, resolution) {
5395
- if (spatialIndex === "quadbin" /* QUADBIN */) {
5396
- return geometryToCells(geometry, resolution);
5397
- }
5398
- if (spatialIndex === "h3" /* H3 */) {
5399
- return polygonToCells(
5400
- turf_bbox_clip_default(geometry, bboxWest).geometry.coordinates,
5401
- resolution,
5402
- true
5403
- ).concat(
5404
- polygonToCells(
5405
- turf_bbox_clip_default(geometry, bboxEast).geometry.coordinates,
5406
- resolution,
5407
- true
5408
- )
5409
- );
5410
- }
5411
- }
5412
5454
  function getSpatialIndex(spatialDataType) {
5413
5455
  switch (spatialDataType) {
5414
5456
  case "h3":
@@ -5435,67 +5477,8 @@ var DEFAULT_AGGREGATION_EXP = `1 AS ${DEFAULT_AGGREGATION_EXP_ALIAS}`;
5435
5477
  import {
5436
5478
  cellToChildren as _cellToChildren,
5437
5479
  cellToTile,
5438
- geometryToCells as geometryToCells2,
5439
5480
  getResolution as getResolution2
5440
5481
  } from "quadbin";
5441
-
5442
- // src/utils/CellSet.ts
5443
- var EMPTY_U32 = 2 ** 32 - 1;
5444
- var CellSet = class {
5445
- constructor(cells) {
5446
- /** List of cells stored by the set. Stored by reference, without copying. */
5447
- __publicField(this, "cells");
5448
- /** DataView representing a single cell ID. Pre-allocated to reduce memory during queries. */
5449
- __publicField(this, "cellView", new DataView(new ArrayBuffer(8)));
5450
- /** Hash table, mapping a hash index (computed) to an index in the 'cells' array. */
5451
- __publicField(this, "hashTable");
5452
- this.cells = cells;
5453
- this.hashTable = new Uint32Array(hashBuckets(cells.length)).fill(EMPTY_U32);
5454
- for (let cellIndex = 0; cellIndex < cells.length; cellIndex++) {
5455
- this.hashTable[this.hashLookup(cells[cellIndex])] = cellIndex;
5456
- }
5457
- }
5458
- has(cell) {
5459
- const hashIndex = this.hashLookup(cell);
5460
- return this.hashTable[hashIndex] !== EMPTY_U32;
5461
- }
5462
- hashLookup(cell) {
5463
- this.cellView.setBigUint64(0, cell);
5464
- const hashval = hash(this.cellView);
5465
- const hashmod = this.hashTable.length - 1;
5466
- let bucket = hashval & hashmod;
5467
- for (let probe = 0; probe <= hashmod; probe++) {
5468
- const cellIndex = this.hashTable[bucket];
5469
- if (cellIndex === EMPTY_U32 || cell === this.cells[cellIndex]) {
5470
- return bucket;
5471
- }
5472
- bucket = bucket + probe + 1 & hashmod;
5473
- }
5474
- throw new Error("Hash table full.");
5475
- }
5476
- };
5477
- function hash(view, h = 0) {
5478
- const m = 1540483477;
5479
- const r = 24;
5480
- for (let i = 0, il = view.byteLength / 4; i < il; i++) {
5481
- let k = view.getUint32(i * 4);
5482
- k = Math.imul(k, m) >>> 0;
5483
- k = (k ^ k >> r) >>> 0;
5484
- k = Math.imul(k, m) >>> 0;
5485
- h = Math.imul(h, m) >>> 0;
5486
- h = (h ^ k) >>> 0;
5487
- }
5488
- return h;
5489
- }
5490
- function hashBuckets(initialCount) {
5491
- let buckets = 1;
5492
- while (buckets < initialCount + initialCount / 4) {
5493
- buckets *= 2;
5494
- }
5495
- return buckets;
5496
- }
5497
-
5498
- // src/filters/tileFeaturesRaster.ts
5499
5482
  function tileFeaturesRaster({
5500
5483
  tiles,
5501
5484
  ...options
@@ -5509,15 +5492,20 @@ function tileFeaturesRaster({
5509
5492
  const tileResolution = getResolution2(tiles[0].index.q);
5510
5493
  const tileBlockSize = tiles[0].data.blockSize;
5511
5494
  const cellResolution = tileResolution + BigInt(Math.log2(tileBlockSize));
5512
- const spatialFilterCells = new CellSet(
5513
- geometryToCells2(options.spatialFilter, cellResolution)
5514
- );
5515
5495
  const data = /* @__PURE__ */ new Map();
5516
5496
  for (const tile of tiles) {
5517
5497
  const parent = tile.index.q;
5518
- const children = cellToChildrenSorted(parent, cellResolution);
5519
- for (let i = 0; i < children.length; i++) {
5520
- if (!spatialFilterCells.has(children[i])) continue;
5498
+ const intersection3 = intersectTileRaster(
5499
+ parent,
5500
+ cellResolution,
5501
+ options.spatialFilter
5502
+ );
5503
+ if (intersection3 === false) continue;
5504
+ const tileSortedCells = cellToChildrenSorted(parent, cellResolution);
5505
+ for (let i = 0; i < tileSortedCells.length; i++) {
5506
+ if (intersection3 !== true && !intersection3.has(tileSortedCells[i])) {
5507
+ continue;
5508
+ }
5521
5509
  const cellData = {};
5522
5510
  let cellDataExists = false;
5523
5511
  for (const band in tile.data.cells.numericProps) {
@@ -5529,7 +5517,7 @@ function tileFeaturesRaster({
5529
5517
  }
5530
5518
  }
5531
5519
  if (cellDataExists) {
5532
- data.set(children[i], cellData);
5520
+ data.set(tileSortedCells[i], cellData);
5533
5521
  }
5534
5522
  }
5535
5523
  }
@@ -7238,7 +7226,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
7238
7226
  }
7239
7227
  _extractTileFeatures(spatialFilter) {
7240
7228
  const prevInputs = this._tileFeatureExtractPreviousInputs;
7241
- if (this._features.length && prevInputs.spatialFilter && booleanEqual(prevInputs.spatialFilter, spatialFilter)) {
7229
+ if (this._features.length && spatialFilterEquals(prevInputs.spatialFilter, spatialFilter)) {
7242
7230
  return;
7243
7231
  }
7244
7232
  this._features = tileFeatures({
@@ -7478,7 +7466,6 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
7478
7466
  * INTERNAL
7479
7467
  */
7480
7468
  _getFilteredFeatures(spatialFilter, filters, filterOwner) {
7481
- assert2(spatialFilter, "spatialFilter required for tilesets");
7482
7469
  this._extractTileFeatures(spatialFilter);
7483
7470
  return applyFilters(
7484
7471
  this._features,
@@ -7502,6 +7489,11 @@ function assertColumn(features, ...columnArgs) {
7502
7489
  function normalizeColumns(columns) {
7503
7490
  return Array.isArray(columns) ? columns : typeof columns === "string" ? [columns] : [];
7504
7491
  }
7492
+ function spatialFilterEquals(a, b) {
7493
+ if (a === b) return true;
7494
+ if (!a || !b) return false;
7495
+ return booleanEqual(a, b);
7496
+ }
7505
7497
 
7506
7498
  // src/widget-sources/widget-tileset-source.ts
7507
7499
  var WidgetTilesetSource = class extends WidgetSource {
@@ -10021,6 +10013,62 @@ function _getHexagonResolution(viewport, tileSize) {
10021
10013
  Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS)
10022
10014
  );
10023
10015
  }
10016
+
10017
+ // src/utils/CellSet.ts
10018
+ var EMPTY_U32 = 2 ** 32 - 1;
10019
+ var CellSet = class {
10020
+ constructor(cells) {
10021
+ /** List of cells stored by the set. Stored by reference, without copying. */
10022
+ __publicField(this, "cells");
10023
+ /** DataView representing a single cell ID. Pre-allocated to reduce memory during queries. */
10024
+ __publicField(this, "cellView", new DataView(new ArrayBuffer(8)));
10025
+ /** Hash table, mapping a hash index (computed) to an index in the 'cells' array. */
10026
+ __publicField(this, "hashTable");
10027
+ this.cells = cells;
10028
+ this.hashTable = new Uint32Array(hashBuckets(cells.length)).fill(EMPTY_U32);
10029
+ for (let cellIndex = 0; cellIndex < cells.length; cellIndex++) {
10030
+ this.hashTable[this.hashLookup(cells[cellIndex])] = cellIndex;
10031
+ }
10032
+ }
10033
+ has(cell) {
10034
+ const hashIndex = this.hashLookup(cell);
10035
+ return this.hashTable[hashIndex] !== EMPTY_U32;
10036
+ }
10037
+ hashLookup(cell) {
10038
+ this.cellView.setBigUint64(0, cell);
10039
+ const hashval = hash(this.cellView);
10040
+ const hashmod = this.hashTable.length - 1;
10041
+ let bucket = hashval & hashmod;
10042
+ for (let probe = 0; probe <= hashmod; probe++) {
10043
+ const cellIndex = this.hashTable[bucket];
10044
+ if (cellIndex === EMPTY_U32 || cell === this.cells[cellIndex]) {
10045
+ return bucket;
10046
+ }
10047
+ bucket = bucket + probe + 1 & hashmod;
10048
+ }
10049
+ throw new Error("Hash table full.");
10050
+ }
10051
+ };
10052
+ function hash(view, h = 0) {
10053
+ const m = 1540483477;
10054
+ const r = 24;
10055
+ for (let i = 0, il = view.byteLength / 4; i < il; i++) {
10056
+ let k = view.getUint32(i * 4);
10057
+ k = Math.imul(k, m) >>> 0;
10058
+ k = (k ^ k >> r) >>> 0;
10059
+ k = Math.imul(k, m) >>> 0;
10060
+ h = Math.imul(h, m) >>> 0;
10061
+ h = (h ^ k) >>> 0;
10062
+ }
10063
+ return h;
10064
+ }
10065
+ function hashBuckets(initialCount) {
10066
+ let buckets = 1;
10067
+ while (buckets < initialCount + initialCount / 4) {
10068
+ buckets *= 2;
10069
+ }
10070
+ return buckets;
10071
+ }
10024
10072
  export {
10025
10073
  AggregationTypes,
10026
10074
  ApiVersion,