@vitessce/gl 4.0.10 → 4.1.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.
@@ -1066,15 +1066,15 @@ function dirname(url) {
1066
1066
  }
1067
1067
  const isBoolean = (x) => typeof x === "boolean";
1068
1068
  const isFunction$1 = (x) => typeof x === "function";
1069
- const isObject$4 = (x) => x !== null && typeof x === "object";
1070
- const isPureObject = (x) => isObject$4(x) && x.constructor === {}.constructor;
1069
+ const isObject$2 = (x) => x !== null && typeof x === "object";
1070
+ const isPureObject = (x) => isObject$2(x) && x.constructor === {}.constructor;
1071
1071
  const isIterable = (x) => x && typeof x[Symbol.iterator] === "function";
1072
1072
  const isAsyncIterable$1 = (x) => x && typeof x[Symbol.asyncIterator] === "function";
1073
1073
  const isResponse = (x) => typeof Response !== "undefined" && x instanceof Response || x && x.arrayBuffer && x.text && x.json;
1074
1074
  const isBlob = (x) => typeof Blob !== "undefined" && x instanceof Blob;
1075
1075
  const isBuffer = (x) => x && typeof x === "object" && x.isBuffer;
1076
- const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$4(x) && isFunction$1(x.tee) && isFunction$1(x.cancel) && isFunction$1(x.getReader);
1077
- const isReadableNodeStream = (x) => isObject$4(x) && isFunction$1(x.read) && isFunction$1(x.pipe) && isBoolean(x.readable);
1076
+ const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$2(x) && isFunction$1(x.tee) && isFunction$1(x.cancel) && isFunction$1(x.getReader);
1077
+ const isReadableNodeStream = (x) => isObject$2(x) && isFunction$1(x.read) && isFunction$1(x.pipe) && isBoolean(x.readable);
1078
1078
  const isReadableStream = (x) => isReadableDOMStream(x) || isReadableNodeStream(x);
1079
1079
  const DATA_URL_PATTERN = /^data:([-\w.]+\/[-\w.+]+)(;|,)/;
1080
1080
  const MIME_TYPE_PATTERN = /^([-\w.]+\/[-\w.+]+)/;
@@ -1873,7 +1873,7 @@ function getFetchFunction(options, context) {
1873
1873
  if (typeof fetchOptions.fetch === "function") {
1874
1874
  return fetchOptions.fetch;
1875
1875
  }
1876
- if (isObject$4(fetchOptions.fetch)) {
1876
+ if (isObject$2(fetchOptions.fetch)) {
1877
1877
  return (url) => fetchFile(url, fetchOptions);
1878
1878
  }
1879
1879
  if (context !== null && context !== void 0 && context.fetch) {
@@ -1894,7 +1894,7 @@ function validateOptionsObject(options, id, defaultOptions, deprecatedOptions, l
1894
1894
  const loaderName = id || "Top level";
1895
1895
  const prefix = id ? "".concat(id, ".") : "";
1896
1896
  for (const key in options) {
1897
- const isSubOptions = !id && isObject$4(options[key]);
1897
+ const isSubOptions = !id && isObject$2(options[key]);
1898
1898
  const isBaseUriOption = key === "baseUri" && !id;
1899
1899
  const isWorkerUrlOption = key === "workerUrl" && id;
1900
1900
  if (!(key in defaultOptions) && !isBaseUriOption && !isWorkerUrlOption) {
@@ -11437,10 +11437,10 @@ function normalize$4(out, a2) {
11437
11437
  out[2] = a2[2] * len2;
11438
11438
  return out;
11439
11439
  }
11440
- function dot$3(a2, b) {
11440
+ function dot$2(a2, b) {
11441
11441
  return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2];
11442
11442
  }
11443
- function cross$1(out, a2, b) {
11443
+ function cross(out, a2, b) {
11444
11444
  var ax = a2[0], ay = a2[1], az = a2[2];
11445
11445
  var bx = b[0], by = b[1], bz = b[2];
11446
11446
  out[0] = ay * bz - az * by;
@@ -11529,8 +11529,8 @@ function rotateZ$2(out, a2, b, rad) {
11529
11529
  out[2] = r2[2] + b[2];
11530
11530
  return out;
11531
11531
  }
11532
- function angle$2(a2, b) {
11533
- var ax = a2[0], ay = a2[1], az = a2[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot$3(a2, b) / mag;
11532
+ function angle$1(a2, b) {
11533
+ var ax = a2[0], ay = a2[1], az = a2[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot$2(a2, b) / mag;
11534
11534
  return Math.acos(Math.min(Math.max(cosine, -1), 1));
11535
11535
  }
11536
11536
  var sub = subtract;
@@ -11629,10 +11629,10 @@ class Vector3 extends Vector {
11629
11629
  this[2] = checkNumber(value);
11630
11630
  }
11631
11631
  angle(vector) {
11632
- return angle$2(this, vector);
11632
+ return angle$1(this, vector);
11633
11633
  }
11634
11634
  cross(vector) {
11635
- cross$1(this, this, vector);
11635
+ cross(this, this, vector);
11636
11636
  return this.check();
11637
11637
  }
11638
11638
  rotateX({
@@ -12749,7 +12749,7 @@ function normalize$3(out, a2) {
12749
12749
  out[3] = w2 * len2;
12750
12750
  return out;
12751
12751
  }
12752
- function dot$2(a2, b) {
12752
+ function dot$1(a2, b) {
12753
12753
  return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2] + a2[3] * b[3];
12754
12754
  }
12755
12755
  function lerp$3(out, a2, b, t) {
@@ -13365,7 +13365,7 @@ function fromMat3(out, m) {
13365
13365
  }
13366
13366
  var add$2 = add$3;
13367
13367
  var scale = scale$1;
13368
- var dot$1 = dot$2;
13368
+ var dot = dot$1;
13369
13369
  var lerp$2 = lerp$3;
13370
13370
  var length$2 = length$3;
13371
13371
  var squaredLength = squaredLength$1;
@@ -13375,10 +13375,10 @@ var rotationTo = function() {
13375
13375
  var xUnitVec3 = fromValues(1, 0, 0);
13376
13376
  var yUnitVec3 = fromValues(0, 1, 0);
13377
13377
  return function(out, a2, b) {
13378
- var dot2 = dot$3(a2, b);
13378
+ var dot2 = dot$2(a2, b);
13379
13379
  if (dot2 < -0.999999) {
13380
- cross$1(tmpvec3, xUnitVec3, a2);
13381
- if (len(tmpvec3) < 1e-6) cross$1(tmpvec3, yUnitVec3, a2);
13380
+ cross(tmpvec3, xUnitVec3, a2);
13381
+ if (len(tmpvec3) < 1e-6) cross(tmpvec3, yUnitVec3, a2);
13382
13382
  normalize$4(tmpvec3, tmpvec3);
13383
13383
  setAxisAngle(out, tmpvec3, Math.PI);
13384
13384
  return out;
@@ -13389,7 +13389,7 @@ var rotationTo = function() {
13389
13389
  out[3] = 1;
13390
13390
  return out;
13391
13391
  } else {
13392
- cross$1(tmpvec3, a2, b);
13392
+ cross(tmpvec3, a2, b);
13393
13393
  out[0] = tmpvec3[0];
13394
13394
  out[1] = tmpvec3[1];
13395
13395
  out[2] = tmpvec3[2];
@@ -13503,7 +13503,7 @@ class Quaternion extends MathArray {
13503
13503
  return squaredLength(this);
13504
13504
  }
13505
13505
  dot(a2) {
13506
- return dot$1(this, a2);
13506
+ return dot(this, a2);
13507
13507
  }
13508
13508
  rotationTo(vectorA, vectorB) {
13509
13509
  rotationTo(this, vectorA, vectorB);
@@ -23480,7 +23480,7 @@ function requireHammer() {
23480
23480
  } else {
23481
23481
  assign2 = Object.assign;
23482
23482
  }
23483
- var extend2 = deprecate(function extend3(dest, src, merge3) {
23483
+ var extend = deprecate(function extend2(dest, src, merge3) {
23484
23484
  var keys = Object.keys(src);
23485
23485
  var i2 = 0;
23486
23486
  while (i2 < keys.length) {
@@ -23492,7 +23492,7 @@ function requireHammer() {
23492
23492
  return dest;
23493
23493
  }, "extend", "Use `assign`.");
23494
23494
  var merge2 = deprecate(function merge3(dest, src) {
23495
- return extend2(dest, src, true);
23495
+ return extend(dest, src, true);
23496
23496
  }, "merge", "Use `assign`.");
23497
23497
  function inherit(child, base, properties) {
23498
23498
  var baseP = base.prototype, childP;
@@ -25179,7 +25179,7 @@ function requireHammer() {
25179
25179
  off: removeEventListeners,
25180
25180
  each,
25181
25181
  merge: merge2,
25182
- extend: extend2,
25182
+ extend,
25183
25183
  assign: assign2,
25184
25184
  inherit,
25185
25185
  bindFn,
@@ -28604,17 +28604,17 @@ function compareProps({
28604
28604
  return false;
28605
28605
  }
28606
28606
  function comparePropValues(newProp, oldProp, propType) {
28607
- let equal2 = propType && propType.equal;
28608
- if (equal2 && !equal2(newProp, oldProp, propType)) {
28607
+ let equal = propType && propType.equal;
28608
+ if (equal && !equal(newProp, oldProp, propType)) {
28609
28609
  return "changed deeply";
28610
28610
  }
28611
- if (!equal2) {
28612
- equal2 = newProp && oldProp && newProp.equals;
28613
- if (equal2 && !equal2.call(newProp, oldProp)) {
28611
+ if (!equal) {
28612
+ equal = newProp && oldProp && newProp.equals;
28613
+ if (equal && !equal.call(newProp, oldProp)) {
28614
28614
  return "changed deeply";
28615
28615
  }
28616
28616
  }
28617
- if (!equal2 && oldProp !== newProp) {
28617
+ if (!equal && oldProp !== newProp) {
28618
28618
  return "changed shallowly";
28619
28619
  }
28620
28620
  return null;
@@ -28711,7 +28711,7 @@ function getPropTypes(props) {
28711
28711
  const ERR_NOT_OBJECT = "count(): argument not an object";
28712
28712
  const ERR_NOT_CONTAINER = "count(): argument not a container";
28713
28713
  function count(container) {
28714
- if (!isObject$3(container)) {
28714
+ if (!isObject$1(container)) {
28715
28715
  throw new Error(ERR_NOT_OBJECT);
28716
28716
  }
28717
28717
  if (typeof container.count === "function") {
@@ -28731,7 +28731,7 @@ function count(container) {
28731
28731
  function isPlainObject(value) {
28732
28732
  return value !== null && typeof value === "object" && value.constructor === Object;
28733
28733
  }
28734
- function isObject$3(value) {
28734
+ function isObject$1(value) {
28735
28735
  return value !== null && typeof value === "object";
28736
28736
  }
28737
28737
  function mergeShaders(target, source) {
@@ -33365,35 +33365,35 @@ function getPointAtIndex(positions, index2, size, offset, out = []) {
33365
33365
  }
33366
33366
  return out;
33367
33367
  }
33368
- function intersect(a2, b, edge, bbox2, out = []) {
33368
+ function intersect(a2, b, edge, bbox, out = []) {
33369
33369
  let t;
33370
33370
  let snap;
33371
33371
  if (edge & 8) {
33372
- t = (bbox2[3] - a2[1]) / (b[1] - a2[1]);
33372
+ t = (bbox[3] - a2[1]) / (b[1] - a2[1]);
33373
33373
  snap = 3;
33374
33374
  } else if (edge & 4) {
33375
- t = (bbox2[1] - a2[1]) / (b[1] - a2[1]);
33375
+ t = (bbox[1] - a2[1]) / (b[1] - a2[1]);
33376
33376
  snap = 1;
33377
33377
  } else if (edge & 2) {
33378
- t = (bbox2[2] - a2[0]) / (b[0] - a2[0]);
33378
+ t = (bbox[2] - a2[0]) / (b[0] - a2[0]);
33379
33379
  snap = 2;
33380
33380
  } else if (edge & 1) {
33381
- t = (bbox2[0] - a2[0]) / (b[0] - a2[0]);
33381
+ t = (bbox[0] - a2[0]) / (b[0] - a2[0]);
33382
33382
  snap = 0;
33383
33383
  } else {
33384
33384
  return null;
33385
33385
  }
33386
33386
  for (let i2 = 0; i2 < a2.length; i2++) {
33387
- out[i2] = (snap & 1) === i2 ? bbox2[snap] : t * (b[i2] - a2[i2]) + a2[i2];
33387
+ out[i2] = (snap & 1) === i2 ? bbox[snap] : t * (b[i2] - a2[i2]) + a2[i2];
33388
33388
  }
33389
33389
  return out;
33390
33390
  }
33391
- function bitCode(p, bbox2) {
33391
+ function bitCode(p, bbox) {
33392
33392
  let code = 0;
33393
- if (p[0] < bbox2[0]) code |= 1;
33394
- else if (p[0] > bbox2[2]) code |= 2;
33395
- if (p[1] < bbox2[1]) code |= 4;
33396
- else if (p[1] > bbox2[3]) code |= 8;
33393
+ if (p[0] < bbox[0]) code |= 1;
33394
+ else if (p[0] > bbox[2]) code |= 2;
33395
+ if (p[1] < bbox[1]) code |= 4;
33396
+ else if (p[1] > bbox[3]) code |= 8;
33397
33397
  return code;
33398
33398
  }
33399
33399
  function cutPolylineByGrid(positions, options) {
@@ -33463,7 +33463,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
33463
33463
  types: edgeTypes ? new Array(positions.length / size).fill(TYPE_BORDER) : null,
33464
33464
  holes: holeIndices || []
33465
33465
  }];
33466
- const bbox2 = [[], []];
33466
+ const bbox = [[], []];
33467
33467
  let cell = [];
33468
33468
  while (queue.length) {
33469
33469
  const {
@@ -33471,9 +33471,9 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
33471
33471
  types,
33472
33472
  holes
33473
33473
  } = queue.shift();
33474
- getBoundingBox$2(pos, size, holes[0] || pos.length, bbox2);
33475
- cell = getGridCell(bbox2[0], gridResolution, gridOffset, cell);
33476
- const code = bitCode(bbox2[1], cell);
33474
+ getBoundingBox$2(pos, size, holes[0] || pos.length, bbox);
33475
+ cell = getGridCell(bbox[0], gridResolution, gridOffset, cell);
33476
+ const code = bitCode(bbox[1], cell);
33477
33477
  if (code) {
33478
33478
  let parts = bisectPolygon(pos, types, size, 0, holes[0] || pos.length, cell, code);
33479
33479
  const polygonLow = {
@@ -33519,7 +33519,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
33519
33519
  }
33520
33520
  return result;
33521
33521
  }
33522
- function bisectPolygon(positions, edgeTypes, size, startIndex, endIndex, bbox2, edge) {
33522
+ function bisectPolygon(positions, edgeTypes, size, startIndex, endIndex, bbox, edge) {
33523
33523
  const numPoints = (endIndex - startIndex) / size;
33524
33524
  const resultLow = [];
33525
33525
  const resultHigh = [];
@@ -33530,16 +33530,16 @@ function bisectPolygon(positions, edgeTypes, size, startIndex, endIndex, bbox2,
33530
33530
  let side;
33531
33531
  let type;
33532
33532
  const prev = getPointAtIndex(positions, numPoints - 1, size, startIndex);
33533
- let prevSide = Math.sign(edge & 8 ? prev[1] - bbox2[3] : prev[0] - bbox2[2]);
33533
+ let prevSide = Math.sign(edge & 8 ? prev[1] - bbox[3] : prev[0] - bbox[2]);
33534
33534
  let prevType = edgeTypes && edgeTypes[numPoints - 1];
33535
33535
  let lowPointCount = 0;
33536
33536
  let highPointCount = 0;
33537
33537
  for (let i2 = 0; i2 < numPoints; i2++) {
33538
33538
  p = getPointAtIndex(positions, i2, size, startIndex, p);
33539
- side = Math.sign(edge & 8 ? p[1] - bbox2[3] : p[0] - bbox2[2]);
33539
+ side = Math.sign(edge & 8 ? p[1] - bbox[3] : p[0] - bbox[2]);
33540
33540
  type = edgeTypes && edgeTypes[startIndex / size + i2];
33541
33541
  if (side && prevSide && prevSide !== side) {
33542
- intersect(prev, p, edge, bbox2, scratchPoint);
33542
+ intersect(prev, p, edge, bbox, scratchPoint);
33543
33543
  push(resultLow, scratchPoint) && typesLow.push(prevType);
33544
33544
  push(resultHigh, scratchPoint) && typesHigh.push(prevType);
33545
33545
  }
@@ -34671,7 +34671,7 @@ function requireEarcut() {
34671
34671
  var p = start;
34672
34672
  do {
34673
34673
  var a2 = p.prev, b = p.next.next;
34674
- if (!equals2(a2, b) && intersects2(a2, p, p.next, b) && locallyInside(a2, b) && locallyInside(b, a2)) {
34674
+ if (!equals2(a2, b) && intersects(a2, p, p.next, b) && locallyInside(a2, b) && locallyInside(b, a2)) {
34675
34675
  triangles.push(a2.i / dim | 0);
34676
34676
  triangles.push(p.i / dim | 0);
34677
34677
  triangles.push(b.i / dim | 0);
@@ -34846,7 +34846,7 @@ function requireEarcut() {
34846
34846
  function equals2(p1, p2) {
34847
34847
  return p1.x === p2.x && p1.y === p2.y;
34848
34848
  }
34849
- function intersects2(p1, q1, p2, q2) {
34849
+ function intersects(p1, q1, p2, q2) {
34850
34850
  var o1 = sign2(area2(p1, q1, p2));
34851
34851
  var o2 = sign2(area2(p1, q1, q2));
34852
34852
  var o3 = sign2(area2(p2, q2, p1));
@@ -34867,7 +34867,7 @@ function requireEarcut() {
34867
34867
  function intersectsPolygon(a2, b) {
34868
34868
  var p = a2;
34869
34869
  do {
34870
- if (p.i !== a2.i && p.next.i !== a2.i && p.i !== b.i && p.next.i !== b.i && intersects2(p, p.next, a2, b)) return true;
34870
+ if (p.i !== a2.i && p.next.i !== a2.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a2, b)) return true;
34871
34871
  p = p.next;
34872
34872
  } while (p !== a2);
34873
34873
  return false;
@@ -40906,7 +40906,7 @@ class Tile2DHeader {
40906
40906
  const {
40907
40907
  index: index2,
40908
40908
  id,
40909
- bbox: bbox2,
40909
+ bbox,
40910
40910
  userData,
40911
40911
  zoom
40912
40912
  } = this;
@@ -40932,7 +40932,7 @@ class Tile2DHeader {
40932
40932
  tileData = await getData({
40933
40933
  index: index2,
40934
40934
  id,
40935
- bbox: bbox2,
40935
+ bbox,
40936
40936
  userData,
40937
40937
  zoom,
40938
40938
  signal
@@ -41806,8 +41806,8 @@ const urlType = {
41806
41806
  return true;
41807
41807
  }
41808
41808
  };
41809
- function transformBox(bbox2, modelMatrix2) {
41810
- const transformedCoords = [modelMatrix2.transformAsPoint([bbox2[0], bbox2[1]]), modelMatrix2.transformAsPoint([bbox2[2], bbox2[1]]), modelMatrix2.transformAsPoint([bbox2[0], bbox2[3]]), modelMatrix2.transformAsPoint([bbox2[2], bbox2[3]])];
41809
+ function transformBox(bbox, modelMatrix2) {
41810
+ const transformedCoords = [modelMatrix2.transformAsPoint([bbox[0], bbox[1]]), modelMatrix2.transformAsPoint([bbox[2], bbox[1]]), modelMatrix2.transformAsPoint([bbox[0], bbox[3]]), modelMatrix2.transformAsPoint([bbox[2], bbox[3]])];
41811
41811
  const transformedBox = [Math.min(...transformedCoords.map((i2) => i2[0])), Math.min(...transformedCoords.map((i2) => i2[1])), Math.max(...transformedCoords.map((i2) => i2[0])), Math.max(...transformedCoords.map((i2) => i2[1]))];
41812
41812
  return transformedBox;
41813
41813
  }
@@ -41875,12 +41875,12 @@ function getCullBoundsInViewport(viewport, z, cullRect) {
41875
41875
  const bounds1 = getCullBoundsInViewport(viewport, z[1], cullRect);
41876
41876
  return [Math.min(bounds0[0], bounds1[0]), Math.min(bounds0[1], bounds1[1]), Math.max(bounds0[2], bounds1[2]), Math.max(bounds0[3], bounds1[3])];
41877
41877
  }
41878
- function getIndexingCoords(bbox2, scale2, modelMatrixInverse) {
41878
+ function getIndexingCoords(bbox, scale2, modelMatrixInverse) {
41879
41879
  if (modelMatrixInverse) {
41880
- const transformedTileIndex = transformBox(bbox2, modelMatrixInverse).map((i2) => i2 * scale2 / TILE_SIZE$1);
41880
+ const transformedTileIndex = transformBox(bbox, modelMatrixInverse).map((i2) => i2 * scale2 / TILE_SIZE$1);
41881
41881
  return transformedTileIndex;
41882
41882
  }
41883
- return bbox2.map((i2) => i2 * scale2 / TILE_SIZE$1);
41883
+ return bbox.map((i2) => i2 * scale2 / TILE_SIZE$1);
41884
41884
  }
41885
41885
  function getScale(z, tileSize) {
41886
41886
  return Math.pow(2, z) * TILE_SIZE$1 / tileSize;
@@ -41917,9 +41917,9 @@ function tileToBoundingBox(viewport, x, y, z, tileSize = TILE_SIZE$1) {
41917
41917
  };
41918
41918
  }
41919
41919
  function getIdentityTileIndices(viewport, z, tileSize, extent2, modelMatrixInverse) {
41920
- const bbox2 = getBoundingBox(viewport, null, extent2);
41920
+ const bbox = getBoundingBox(viewport, null, extent2);
41921
41921
  const scale2 = getScale(z, tileSize);
41922
- const [minX, minY, maxX, maxY] = getIndexingCoords(bbox2, scale2, modelMatrixInverse);
41922
+ const [minX, minY, maxX, maxY] = getIndexingCoords(bbox, scale2, modelMatrixInverse);
41923
41923
  const indices = [];
41924
41924
  for (let x = Math.floor(minX); x < maxX; x++) {
41925
41925
  for (let y = Math.floor(minY); y < maxY; y++) {
@@ -42108,16 +42108,16 @@ class Tileset2D {
42108
42108
  cullRect
42109
42109
  });
42110
42110
  const {
42111
- bbox: bbox2
42111
+ bbox
42112
42112
  } = tile;
42113
42113
  for (const [minX, minY, maxX, maxY] of boundsArr) {
42114
42114
  let overlaps;
42115
- if ("west" in bbox2) {
42116
- overlaps = bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
42115
+ if ("west" in bbox) {
42116
+ overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
42117
42117
  } else {
42118
- const y02 = Math.min(bbox2.top, bbox2.bottom);
42119
- const y12 = Math.max(bbox2.top, bbox2.bottom);
42120
- overlaps = bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
42118
+ const y02 = Math.min(bbox.top, bbox.bottom);
42119
+ const y12 = Math.max(bbox.top, bbox.bottom);
42120
+ overlaps = bbox.left < maxX && bbox.right > minX && y02 < maxY && y12 > minY;
42121
42121
  }
42122
42122
  if (overlaps) {
42123
42123
  return true;
@@ -59407,7 +59407,7 @@ class Ellipsoid {
59407
59407
  h.copy(scratchCartesian).subtract(point2);
59408
59408
  const longitude = Math.atan2(normal.y, normal.x);
59409
59409
  const latitude = Math.asin(normal.z);
59410
- const height = Math.sign(dot$3(h, scratchCartesian)) * length$4(h);
59410
+ const height = Math.sign(dot$2(h, scratchCartesian)) * length$4(h);
59411
59411
  return toCartographicFromRadians([longitude, latitude, height], result);
59412
59412
  }
59413
59413
  eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
@@ -63811,13 +63811,13 @@ class TerrainLayer extends CompositeLayer {
63811
63811
  let bottomLeft = [0, 0];
63812
63812
  let topRight = [0, 0];
63813
63813
  if (viewport.isGeospatial) {
63814
- const bbox2 = tile.bbox;
63815
- bottomLeft = viewport.projectFlat([bbox2.west, bbox2.south]);
63816
- topRight = viewport.projectFlat([bbox2.east, bbox2.north]);
63814
+ const bbox = tile.bbox;
63815
+ bottomLeft = viewport.projectFlat([bbox.west, bbox.south]);
63816
+ topRight = viewport.projectFlat([bbox.east, bbox.north]);
63817
63817
  } else {
63818
- const bbox2 = tile.bbox;
63819
- bottomLeft = [bbox2.left, bbox2.bottom];
63820
- topRight = [bbox2.right, bbox2.top];
63818
+ const bbox = tile.bbox;
63819
+ bottomLeft = [bbox.left, bbox.bottom];
63820
+ topRight = [bbox.right, bbox.top];
63821
63821
  }
63822
63822
  const bounds2 = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
63823
63823
  const terrain = this.loadTerrain({
@@ -64188,27 +64188,27 @@ function Point([pointX, pointY], [nw, se], viewport) {
64188
64188
  const y = lerp$6(nw[1], se[1], pointY);
64189
64189
  return viewport.unprojectFlat([x, y]);
64190
64190
  }
64191
- function getPoints(geometry2, bbox2, viewport) {
64192
- return geometry2.map((g2) => Point(g2, bbox2, viewport));
64191
+ function getPoints(geometry2, bbox, viewport) {
64192
+ return geometry2.map((g2) => Point(g2, bbox, viewport));
64193
64193
  }
64194
- function MultiPoint(multiPoint, bbox2, viewport) {
64195
- return getPoints(multiPoint, bbox2, viewport);
64194
+ function MultiPoint(multiPoint, bbox, viewport) {
64195
+ return getPoints(multiPoint, bbox, viewport);
64196
64196
  }
64197
- function LineString(line, bbox2, viewport) {
64198
- return getPoints(line, bbox2, viewport);
64197
+ function LineString(line, bbox, viewport) {
64198
+ return getPoints(line, bbox, viewport);
64199
64199
  }
64200
- function MultiLineString(multiLineString, bbox2, viewport) {
64201
- return multiLineString.map((lineString2) => LineString(lineString2, bbox2, viewport));
64200
+ function MultiLineString(multiLineString, bbox, viewport) {
64201
+ return multiLineString.map((lineString) => LineString(lineString, bbox, viewport));
64202
64202
  }
64203
- function Polygon(polygon2, bbox2, viewport) {
64204
- return polygon2.map((polygonRing) => getPoints(polygonRing, bbox2, viewport));
64203
+ function Polygon(polygon2, bbox, viewport) {
64204
+ return polygon2.map((polygonRing) => getPoints(polygonRing, bbox, viewport));
64205
64205
  }
64206
- function MultiPolygon(multiPolygon2, bbox2, viewport) {
64207
- return multiPolygon2.map((polygon2) => Polygon(polygon2, bbox2, viewport));
64206
+ function MultiPolygon(multiPolygon2, bbox, viewport) {
64207
+ return multiPolygon2.map((polygon2) => Polygon(polygon2, bbox, viewport));
64208
64208
  }
64209
- function transform$1(geometry2, bbox2, viewport) {
64210
- const nw = viewport.projectFlat([bbox2.west, bbox2.north]);
64211
- const se = viewport.projectFlat([bbox2.east, bbox2.south]);
64209
+ function transform$1(geometry2, bbox, viewport) {
64210
+ const nw = viewport.projectFlat([bbox.west, bbox.north]);
64211
+ const se = viewport.projectFlat([bbox.east, bbox.south]);
64212
64212
  const projectedBbox = [nw, se];
64213
64213
  return {
64214
64214
  ...geometry2,
@@ -64598,11 +64598,11 @@ class MVTLayer extends TileLayer {
64598
64598
  return [];
64599
64599
  }
64600
64600
  const {
64601
- bbox: bbox2
64601
+ bbox
64602
64602
  } = tile;
64603
- if (tile._contentWGS84 === void 0 && isGeoBoundingBox(bbox2)) {
64603
+ if (tile._contentWGS84 === void 0 && isGeoBoundingBox(bbox)) {
64604
64604
  const content = this.state.binary ? binaryToGeojson(tile.content) : tile.content;
64605
- tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2, bbox2, this.context.viewport));
64605
+ tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2, bbox, this.context.viewport));
64606
64606
  }
64607
64607
  return tile._contentWGS84;
64608
64608
  }
@@ -64629,7 +64629,7 @@ function getFeatureLayerName(feature2) {
64629
64629
  function isFeatureIdDefined(value) {
64630
64630
  return value !== void 0 && value !== null && value !== "";
64631
64631
  }
64632
- function transformTileCoordsToWGS84(object2, bbox2, viewport) {
64632
+ function transformTileCoordsToWGS84(object2, bbox, viewport) {
64633
64633
  const feature2 = {
64634
64634
  ...object2,
64635
64635
  geometry: {
@@ -64638,7 +64638,7 @@ function transformTileCoordsToWGS84(object2, bbox2, viewport) {
64638
64638
  };
64639
64639
  Object.defineProperty(feature2.geometry, "coordinates", {
64640
64640
  get: () => {
64641
- const wgs84Geom = transform$1(object2.geometry, bbox2, viewport);
64641
+ const wgs84Geom = transform$1(object2.geometry, bbox, viewport);
64642
64642
  return wgs84Geom.coordinates;
64643
64643
  }
64644
64644
  });
@@ -65191,16 +65191,6 @@ function polygons(coordinates2, properties, options = {}) {
65191
65191
  options
65192
65192
  );
65193
65193
  }
65194
- function lineString(coordinates2, properties, options = {}) {
65195
- if (coordinates2.length < 2) {
65196
- throw new Error("coordinates must be an array of two or more positions");
65197
- }
65198
- const geom = {
65199
- type: "LineString",
65200
- coordinates: coordinates2
65201
- };
65202
- return feature$1(geom, properties, options);
65203
- }
65204
65194
  function featureCollection(features, options = {}) {
65205
65195
  const fc = { type: "FeatureCollection" };
65206
65196
  if (options.id) {
@@ -65226,10 +65216,6 @@ function radiansToLength(radians2, units = "kilometers") {
65226
65216
  }
65227
65217
  return radians2 * factor;
65228
65218
  }
65229
- function radiansToDegrees(radians2) {
65230
- const normalisedRadians = radians2 % (2 * Math.PI);
65231
- return normalisedRadians * 180 / Math.PI;
65232
- }
65233
65219
  function degreesToRadians(degrees2) {
65234
65220
  const normalisedDegrees = degrees2 % 360;
65235
65221
  return normalisedDegrees * Math.PI / 180;
@@ -65237,428 +65223,6 @@ function degreesToRadians(degrees2) {
65237
65223
  function isNumber(num) {
65238
65224
  return !isNaN(num) && num !== null && !Array.isArray(num);
65239
65225
  }
65240
- function isObject$2(input) {
65241
- return input !== null && typeof input === "object" && !Array.isArray(input);
65242
- }
65243
- function coordEach(geojson, callback, excludeWrapCoord) {
65244
- if (geojson === null) return;
65245
- var j, k, l2, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
65246
- for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
65247
- geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
65248
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
65249
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
65250
- for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
65251
- var multiFeatureIndex = 0;
65252
- var geometryIndex = 0;
65253
- geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
65254
- if (geometry2 === null) continue;
65255
- coords = geometry2.coordinates;
65256
- var geomType = geometry2.type;
65257
- wrapShrink = 0;
65258
- switch (geomType) {
65259
- case null:
65260
- break;
65261
- case "Point":
65262
- if (callback(
65263
- coords,
65264
- coordIndex,
65265
- featureIndex,
65266
- multiFeatureIndex,
65267
- geometryIndex
65268
- ) === false)
65269
- return false;
65270
- coordIndex++;
65271
- multiFeatureIndex++;
65272
- break;
65273
- case "LineString":
65274
- case "MultiPoint":
65275
- for (j = 0; j < coords.length; j++) {
65276
- if (callback(
65277
- coords[j],
65278
- coordIndex,
65279
- featureIndex,
65280
- multiFeatureIndex,
65281
- geometryIndex
65282
- ) === false)
65283
- return false;
65284
- coordIndex++;
65285
- if (geomType === "MultiPoint") multiFeatureIndex++;
65286
- }
65287
- if (geomType === "LineString") multiFeatureIndex++;
65288
- break;
65289
- case "Polygon":
65290
- case "MultiLineString":
65291
- for (j = 0; j < coords.length; j++) {
65292
- for (k = 0; k < coords[j].length - wrapShrink; k++) {
65293
- if (callback(
65294
- coords[j][k],
65295
- coordIndex,
65296
- featureIndex,
65297
- multiFeatureIndex,
65298
- geometryIndex
65299
- ) === false)
65300
- return false;
65301
- coordIndex++;
65302
- }
65303
- if (geomType === "MultiLineString") multiFeatureIndex++;
65304
- if (geomType === "Polygon") geometryIndex++;
65305
- }
65306
- if (geomType === "Polygon") multiFeatureIndex++;
65307
- break;
65308
- case "MultiPolygon":
65309
- for (j = 0; j < coords.length; j++) {
65310
- geometryIndex = 0;
65311
- for (k = 0; k < coords[j].length; k++) {
65312
- for (l2 = 0; l2 < coords[j][k].length - wrapShrink; l2++) {
65313
- if (callback(
65314
- coords[j][k][l2],
65315
- coordIndex,
65316
- featureIndex,
65317
- multiFeatureIndex,
65318
- geometryIndex
65319
- ) === false)
65320
- return false;
65321
- coordIndex++;
65322
- }
65323
- geometryIndex++;
65324
- }
65325
- multiFeatureIndex++;
65326
- }
65327
- break;
65328
- case "GeometryCollection":
65329
- for (j = 0; j < geometry2.geometries.length; j++)
65330
- if (coordEach(geometry2.geometries[j], callback) === false)
65331
- return false;
65332
- break;
65333
- default:
65334
- throw new Error("Unknown Geometry Type");
65335
- }
65336
- }
65337
- }
65338
- }
65339
- function featureEach(geojson, callback) {
65340
- if (geojson.type === "Feature") {
65341
- callback(geojson, 0);
65342
- } else if (geojson.type === "FeatureCollection") {
65343
- for (var i2 = 0; i2 < geojson.features.length; i2++) {
65344
- if (callback(geojson.features[i2], i2) === false) break;
65345
- }
65346
- }
65347
- }
65348
- function geomEach(geojson, callback) {
65349
- var i2, j, g2, geometry2, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId2, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
65350
- for (i2 = 0; i2 < stop; i2++) {
65351
- geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
65352
- featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
65353
- featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
65354
- featureId2 = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
65355
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
65356
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
65357
- for (g2 = 0; g2 < stopG; g2++) {
65358
- geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g2] : geometryMaybeCollection;
65359
- if (geometry2 === null) {
65360
- if (callback(
65361
- null,
65362
- featureIndex,
65363
- featureProperties,
65364
- featureBBox,
65365
- featureId2
65366
- ) === false)
65367
- return false;
65368
- continue;
65369
- }
65370
- switch (geometry2.type) {
65371
- case "Point":
65372
- case "LineString":
65373
- case "MultiPoint":
65374
- case "Polygon":
65375
- case "MultiLineString":
65376
- case "MultiPolygon": {
65377
- if (callback(
65378
- geometry2,
65379
- featureIndex,
65380
- featureProperties,
65381
- featureBBox,
65382
- featureId2
65383
- ) === false)
65384
- return false;
65385
- break;
65386
- }
65387
- case "GeometryCollection": {
65388
- for (j = 0; j < geometry2.geometries.length; j++) {
65389
- if (callback(
65390
- geometry2.geometries[j],
65391
- featureIndex,
65392
- featureProperties,
65393
- featureBBox,
65394
- featureId2
65395
- ) === false)
65396
- return false;
65397
- }
65398
- break;
65399
- }
65400
- default:
65401
- throw new Error("Unknown Geometry Type");
65402
- }
65403
- }
65404
- featureIndex++;
65405
- }
65406
- }
65407
- function geomReduce(geojson, callback, initialValue) {
65408
- var previousValue = initialValue;
65409
- geomEach(
65410
- geojson,
65411
- function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId2) {
65412
- previousValue = callback(
65413
- previousValue,
65414
- currentGeometry,
65415
- featureIndex,
65416
- featureProperties,
65417
- featureBBox,
65418
- featureId2
65419
- );
65420
- }
65421
- );
65422
- return previousValue;
65423
- }
65424
- function flattenEach(geojson, callback) {
65425
- geomEach(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
65426
- var type = geometry2 === null ? null : geometry2.type;
65427
- switch (type) {
65428
- case null:
65429
- case "Point":
65430
- case "LineString":
65431
- case "Polygon":
65432
- if (callback(
65433
- feature$1(geometry2, properties, { bbox: bbox2, id }),
65434
- featureIndex,
65435
- 0
65436
- ) === false)
65437
- return false;
65438
- return;
65439
- }
65440
- var geomType;
65441
- switch (type) {
65442
- case "MultiPoint":
65443
- geomType = "Point";
65444
- break;
65445
- case "MultiLineString":
65446
- geomType = "LineString";
65447
- break;
65448
- case "MultiPolygon":
65449
- geomType = "Polygon";
65450
- break;
65451
- }
65452
- for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
65453
- var coordinate = geometry2.coordinates[multiFeatureIndex];
65454
- var geom = {
65455
- type: geomType,
65456
- coordinates: coordinate
65457
- };
65458
- if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false)
65459
- return false;
65460
- }
65461
- });
65462
- }
65463
- function flattenReduce(geojson, callback, initialValue) {
65464
- var previousValue = initialValue;
65465
- flattenEach(
65466
- geojson,
65467
- function(currentFeature, featureIndex, multiFeatureIndex) {
65468
- if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
65469
- previousValue = currentFeature;
65470
- else
65471
- previousValue = callback(
65472
- previousValue,
65473
- currentFeature,
65474
- featureIndex,
65475
- multiFeatureIndex
65476
- );
65477
- }
65478
- );
65479
- return previousValue;
65480
- }
65481
- function segmentEach(geojson, callback) {
65482
- flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
65483
- var segmentIndex = 0;
65484
- if (!feature2.geometry) return;
65485
- var type = feature2.geometry.type;
65486
- if (type === "Point" || type === "MultiPoint") return;
65487
- var previousCoords;
65488
- var previousFeatureIndex = 0;
65489
- var previousMultiIndex = 0;
65490
- var prevGeomIndex = 0;
65491
- if (coordEach(
65492
- feature2,
65493
- function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
65494
- if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
65495
- previousCoords = currentCoord;
65496
- previousFeatureIndex = featureIndex;
65497
- previousMultiIndex = multiPartIndexCoord;
65498
- prevGeomIndex = geometryIndex;
65499
- segmentIndex = 0;
65500
- return;
65501
- }
65502
- var currentSegment = lineString(
65503
- [previousCoords, currentCoord],
65504
- feature2.properties
65505
- );
65506
- if (callback(
65507
- currentSegment,
65508
- featureIndex,
65509
- multiFeatureIndex,
65510
- geometryIndex,
65511
- segmentIndex
65512
- ) === false)
65513
- return false;
65514
- segmentIndex++;
65515
- previousCoords = currentCoord;
65516
- }
65517
- ) === false)
65518
- return false;
65519
- });
65520
- }
65521
- function bbox$1(geojson, options = {}) {
65522
- if (geojson.bbox != null && true !== options.recompute) {
65523
- return geojson.bbox;
65524
- }
65525
- const result = [Infinity, Infinity, -Infinity, -Infinity];
65526
- coordEach(geojson, (coord) => {
65527
- if (result[0] > coord[0]) {
65528
- result[0] = coord[0];
65529
- }
65530
- if (result[1] > coord[1]) {
65531
- result[1] = coord[1];
65532
- }
65533
- if (result[2] < coord[0]) {
65534
- result[2] = coord[0];
65535
- }
65536
- if (result[3] < coord[1]) {
65537
- result[3] = coord[1];
65538
- }
65539
- });
65540
- return result;
65541
- }
65542
- function getCoord(coord) {
65543
- if (!coord) {
65544
- throw new Error("coord is required");
65545
- }
65546
- if (!Array.isArray(coord)) {
65547
- if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
65548
- return [...coord.geometry.coordinates];
65549
- }
65550
- if (coord.type === "Point") {
65551
- return [...coord.coordinates];
65552
- }
65553
- }
65554
- if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
65555
- return [...coord];
65556
- }
65557
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
65558
- }
65559
- function getCoords(coords) {
65560
- if (Array.isArray(coords)) {
65561
- return coords;
65562
- }
65563
- if (coords.type === "Feature") {
65564
- if (coords.geometry !== null) {
65565
- return coords.geometry.coordinates;
65566
- }
65567
- } else {
65568
- if (coords.coordinates) {
65569
- return coords.coordinates;
65570
- }
65571
- }
65572
- throw new Error(
65573
- "coords must be GeoJSON Feature, Geometry Object or an Array"
65574
- );
65575
- }
65576
- function getGeom(geojson) {
65577
- if (geojson.type === "Feature") {
65578
- return geojson.geometry;
65579
- }
65580
- return geojson;
65581
- }
65582
- function booleanPointOnLine(pt, line, options = {}) {
65583
- const ptCoords = getCoord(pt);
65584
- const lineCoords = getCoords(line);
65585
- for (let i2 = 0; i2 < lineCoords.length - 1; i2++) {
65586
- let ignoreBoundary = false;
65587
- if (options.ignoreEndVertices) {
65588
- if (i2 === 0) {
65589
- ignoreBoundary = "start";
65590
- }
65591
- if (i2 === lineCoords.length - 2) {
65592
- ignoreBoundary = "end";
65593
- }
65594
- if (i2 === 0 && i2 + 1 === lineCoords.length - 1) {
65595
- ignoreBoundary = "both";
65596
- }
65597
- }
65598
- if (isPointOnLineSegment(
65599
- lineCoords[i2],
65600
- lineCoords[i2 + 1],
65601
- ptCoords,
65602
- ignoreBoundary,
65603
- typeof options.epsilon === "undefined" ? null : options.epsilon
65604
- )) {
65605
- return true;
65606
- }
65607
- }
65608
- return false;
65609
- }
65610
- function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary, epsilon3) {
65611
- const x = pt[0];
65612
- const y = pt[1];
65613
- const x12 = lineSegmentStart[0];
65614
- const y12 = lineSegmentStart[1];
65615
- const x2 = lineSegmentEnd[0];
65616
- const y2 = lineSegmentEnd[1];
65617
- const dxc = pt[0] - x12;
65618
- const dyc = pt[1] - y12;
65619
- const dxl = x2 - x12;
65620
- const dyl = y2 - y12;
65621
- const cross2 = dxc * dyl - dyc * dxl;
65622
- if (epsilon3 !== null) {
65623
- if (Math.abs(cross2) > epsilon3) {
65624
- return false;
65625
- }
65626
- } else if (cross2 !== 0) {
65627
- return false;
65628
- }
65629
- if (Math.abs(dxl) === Math.abs(dyl) && Math.abs(dxl) === 0) {
65630
- if (excludeBoundary) {
65631
- return false;
65632
- }
65633
- if (pt[0] === lineSegmentStart[0] && pt[1] === lineSegmentStart[1]) {
65634
- return true;
65635
- } else {
65636
- return false;
65637
- }
65638
- }
65639
- if (!excludeBoundary) {
65640
- if (Math.abs(dxl) >= Math.abs(dyl)) {
65641
- return dxl > 0 ? x12 <= x && x <= x2 : x2 <= x && x <= x12;
65642
- }
65643
- return dyl > 0 ? y12 <= y && y <= y2 : y2 <= y && y <= y12;
65644
- } else if (excludeBoundary === "start") {
65645
- if (Math.abs(dxl) >= Math.abs(dyl)) {
65646
- return dxl > 0 ? x12 < x && x <= x2 : x2 <= x && x < x12;
65647
- }
65648
- return dyl > 0 ? y12 < y && y <= y2 : y2 <= y && y < y12;
65649
- } else if (excludeBoundary === "end") {
65650
- if (Math.abs(dxl) >= Math.abs(dyl)) {
65651
- return dxl > 0 ? x12 <= x && x < x2 : x2 < x && x <= x12;
65652
- }
65653
- return dyl > 0 ? y12 <= y && y < y2 : y2 < y && y <= y12;
65654
- } else if (excludeBoundary === "both") {
65655
- if (Math.abs(dxl) >= Math.abs(dyl)) {
65656
- return dxl > 0 ? x12 < x && x < x2 : x2 < x && x < x12;
65657
- }
65658
- return dyl > 0 ? y12 < y && y < y2 : y2 < y && y < y12;
65659
- }
65660
- return false;
65661
- }
65662
65226
  const epsilon$1 = 11102230246251565e-32;
65663
65227
  const splitter = 134217729;
65664
65228
  const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1;
@@ -65955,6 +65519,29 @@ function pointInPolygon(p, polygon2) {
65955
65519
  }
65956
65520
  return true;
65957
65521
  }
65522
+ function getCoord(coord) {
65523
+ if (!coord) {
65524
+ throw new Error("coord is required");
65525
+ }
65526
+ if (!Array.isArray(coord)) {
65527
+ if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
65528
+ return [...coord.geometry.coordinates];
65529
+ }
65530
+ if (coord.type === "Point") {
65531
+ return [...coord.coordinates];
65532
+ }
65533
+ }
65534
+ if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
65535
+ return [...coord];
65536
+ }
65537
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
65538
+ }
65539
+ function getGeom(geojson) {
65540
+ if (geojson.type === "Feature") {
65541
+ return geojson.geometry;
65542
+ }
65543
+ return geojson;
65544
+ }
65958
65545
  function booleanPointInPolygon(point2, polygon2, options = {}) {
65959
65546
  if (!point2) {
65960
65547
  throw new Error("point is required");
@@ -65965,9 +65552,9 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
65965
65552
  const pt = getCoord(point2);
65966
65553
  const geom = getGeom(polygon2);
65967
65554
  const type = geom.type;
65968
- const bbox2 = polygon2.bbox;
65555
+ const bbox = polygon2.bbox;
65969
65556
  let polys = geom.coordinates;
65970
- if (bbox2 && inBBox(pt, bbox2) === false) {
65557
+ if (bbox && inBBox(pt, bbox) === false) {
65971
65558
  return false;
65972
65559
  }
65973
65560
  if (type === "Polygon") {
@@ -65981,1607 +65568,8 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
65981
65568
  }
65982
65569
  return result;
65983
65570
  }
65984
- function inBBox(pt, bbox2) {
65985
- return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
65986
- }
65987
- function booleanWithin(feature1, feature2) {
65988
- var geom1 = getGeom(feature1);
65989
- var geom2 = getGeom(feature2);
65990
- var type1 = geom1.type;
65991
- var type2 = geom2.type;
65992
- switch (type1) {
65993
- case "Point":
65994
- switch (type2) {
65995
- case "MultiPoint":
65996
- return isPointInMultiPoint$1(geom1, geom2);
65997
- case "LineString":
65998
- return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });
65999
- case "Polygon":
66000
- case "MultiPolygon":
66001
- return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });
66002
- default:
66003
- throw new Error("feature2 " + type2 + " geometry not supported");
66004
- }
66005
- case "MultiPoint":
66006
- switch (type2) {
66007
- case "MultiPoint":
66008
- return isMultiPointInMultiPoint$1(geom1, geom2);
66009
- case "LineString":
66010
- return isMultiPointOnLine$1(geom1, geom2);
66011
- case "Polygon":
66012
- case "MultiPolygon":
66013
- return isMultiPointInPoly$1(geom1, geom2);
66014
- default:
66015
- throw new Error("feature2 " + type2 + " geometry not supported");
66016
- }
66017
- case "LineString":
66018
- switch (type2) {
66019
- case "LineString":
66020
- return isLineOnLine$1(geom1, geom2);
66021
- case "Polygon":
66022
- case "MultiPolygon":
66023
- return isLineInPoly$1(geom1, geom2);
66024
- default:
66025
- throw new Error("feature2 " + type2 + " geometry not supported");
66026
- }
66027
- case "Polygon":
66028
- switch (type2) {
66029
- case "Polygon":
66030
- case "MultiPolygon":
66031
- return isPolyInPoly$1(geom1, geom2);
66032
- default:
66033
- throw new Error("feature2 " + type2 + " geometry not supported");
66034
- }
66035
- default:
66036
- throw new Error("feature1 " + type1 + " geometry not supported");
66037
- }
66038
- }
66039
- function isPointInMultiPoint$1(point2, multiPoint) {
66040
- var i2;
66041
- var output = false;
66042
- for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
66043
- if (compareCoords$1(multiPoint.coordinates[i2], point2.coordinates)) {
66044
- output = true;
66045
- break;
66046
- }
66047
- }
66048
- return output;
66049
- }
66050
- function isMultiPointInMultiPoint$1(multiPoint1, multiPoint2) {
66051
- for (var i2 = 0; i2 < multiPoint1.coordinates.length; i2++) {
66052
- var anyMatch = false;
66053
- for (var i22 = 0; i22 < multiPoint2.coordinates.length; i22++) {
66054
- if (compareCoords$1(multiPoint1.coordinates[i2], multiPoint2.coordinates[i22])) {
66055
- anyMatch = true;
66056
- }
66057
- }
66058
- if (!anyMatch) {
66059
- return false;
66060
- }
66061
- }
66062
- return true;
66063
- }
66064
- function isMultiPointOnLine$1(multiPoint, lineString2) {
66065
- var foundInsidePoint = false;
66066
- for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
66067
- if (!booleanPointOnLine(multiPoint.coordinates[i2], lineString2)) {
66068
- return false;
66069
- }
66070
- if (!foundInsidePoint) {
66071
- foundInsidePoint = booleanPointOnLine(
66072
- multiPoint.coordinates[i2],
66073
- lineString2,
66074
- { ignoreEndVertices: true }
66075
- );
66076
- }
66077
- }
66078
- return foundInsidePoint;
66079
- }
66080
- function isMultiPointInPoly$1(multiPoint, polygon2) {
66081
- var output = true;
66082
- var isInside = false;
66083
- for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
66084
- isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2);
66085
- if (!isInside) {
66086
- output = false;
66087
- break;
66088
- }
66089
- {
66090
- isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2, {
66091
- ignoreBoundary: true
66092
- });
66093
- }
66094
- }
66095
- return output && isInside;
66096
- }
66097
- function isLineOnLine$1(lineString1, lineString2) {
66098
- for (var i2 = 0; i2 < lineString1.coordinates.length; i2++) {
66099
- if (!booleanPointOnLine(lineString1.coordinates[i2], lineString2)) {
66100
- return false;
66101
- }
66102
- }
66103
- return true;
66104
- }
66105
- function isLineInPoly$1(linestring, polygon2) {
66106
- var polyBbox = bbox$1(polygon2);
66107
- var lineBbox = bbox$1(linestring);
66108
- if (!doBBoxOverlap$1(polyBbox, lineBbox)) {
66109
- return false;
66110
- }
66111
- var foundInsidePoint = false;
66112
- for (var i2 = 0; i2 < linestring.coordinates.length; i2++) {
66113
- if (!booleanPointInPolygon(linestring.coordinates[i2], polygon2)) {
66114
- return false;
66115
- }
66116
- if (!foundInsidePoint) {
66117
- foundInsidePoint = booleanPointInPolygon(
66118
- linestring.coordinates[i2],
66119
- polygon2,
66120
- { ignoreBoundary: true }
66121
- );
66122
- }
66123
- if (!foundInsidePoint && i2 < linestring.coordinates.length - 1) {
66124
- var midpoint = getMidpoint$1(
66125
- linestring.coordinates[i2],
66126
- linestring.coordinates[i2 + 1]
66127
- );
66128
- foundInsidePoint = booleanPointInPolygon(midpoint, polygon2, {
66129
- ignoreBoundary: true
66130
- });
66131
- }
66132
- }
66133
- return foundInsidePoint;
66134
- }
66135
- function isPolyInPoly$1(geometry1, geometry2) {
66136
- var poly1Bbox = bbox$1(geometry1);
66137
- var poly2Bbox = bbox$1(geometry2);
66138
- if (!doBBoxOverlap$1(poly2Bbox, poly1Bbox)) {
66139
- return false;
66140
- }
66141
- for (var i2 = 0; i2 < geometry1.coordinates[0].length; i2++) {
66142
- if (!booleanPointInPolygon(geometry1.coordinates[0][i2], geometry2)) {
66143
- return false;
66144
- }
66145
- }
66146
- return true;
66147
- }
66148
- function doBBoxOverlap$1(bbox1, bbox2) {
66149
- if (bbox1[0] > bbox2[0]) return false;
66150
- if (bbox1[2] < bbox2[2]) return false;
66151
- if (bbox1[1] > bbox2[1]) return false;
66152
- if (bbox1[3] < bbox2[3]) return false;
66153
- return true;
66154
- }
66155
- function compareCoords$1(pair1, pair2) {
66156
- return pair1[0] === pair2[0] && pair1[1] === pair2[1];
66157
- }
66158
- function getMidpoint$1(pair1, pair2) {
66159
- return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
66160
- }
66161
- function booleanContains(feature1, feature2) {
66162
- const geom1 = getGeom(feature1);
66163
- const geom2 = getGeom(feature2);
66164
- const type1 = geom1.type;
66165
- const type2 = geom2.type;
66166
- const coords1 = geom1.coordinates;
66167
- const coords2 = geom2.coordinates;
66168
- switch (type1) {
66169
- case "Point":
66170
- switch (type2) {
66171
- case "Point":
66172
- return compareCoords(coords1, coords2);
66173
- default:
66174
- throw new Error("feature2 " + type2 + " geometry not supported");
66175
- }
66176
- case "MultiPoint":
66177
- switch (type2) {
66178
- case "Point":
66179
- return isPointInMultiPoint(geom1, geom2);
66180
- case "MultiPoint":
66181
- return isMultiPointInMultiPoint(geom1, geom2);
66182
- default:
66183
- throw new Error("feature2 " + type2 + " geometry not supported");
66184
- }
66185
- case "LineString":
66186
- switch (type2) {
66187
- case "Point":
66188
- return booleanPointOnLine(geom2, geom1, { ignoreEndVertices: true });
66189
- case "LineString":
66190
- return isLineOnLine(geom1, geom2);
66191
- case "MultiPoint":
66192
- return isMultiPointOnLine(geom1, geom2);
66193
- default:
66194
- throw new Error("feature2 " + type2 + " geometry not supported");
66195
- }
66196
- case "Polygon":
66197
- switch (type2) {
66198
- case "Point":
66199
- return booleanPointInPolygon(geom2, geom1, { ignoreBoundary: true });
66200
- case "LineString":
66201
- return isLineInPoly(geom1, geom2);
66202
- case "Polygon":
66203
- return isPolyInPoly(geom1, geom2);
66204
- case "MultiPoint":
66205
- return isMultiPointInPoly(geom1, geom2);
66206
- default:
66207
- throw new Error("feature2 " + type2 + " geometry not supported");
66208
- }
66209
- case "MultiPolygon":
66210
- switch (type2) {
66211
- case "Polygon":
66212
- return isPolygonInMultiPolygon(geom1, geom2);
66213
- default:
66214
- throw new Error("feature2 " + type2 + " geometry not supported");
66215
- }
66216
- default:
66217
- throw new Error("feature1 " + type1 + " geometry not supported");
66218
- }
66219
- }
66220
- function isPolygonInMultiPolygon(multiPolygon2, polygon2) {
66221
- return multiPolygon2.coordinates.some(
66222
- (coords) => isPolyInPoly({ type: "Polygon", coordinates: coords }, polygon2)
66223
- );
66224
- }
66225
- function isPointInMultiPoint(multiPoint, pt) {
66226
- let i2;
66227
- let output = false;
66228
- for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
66229
- if (compareCoords(multiPoint.coordinates[i2], pt.coordinates)) {
66230
- output = true;
66231
- break;
66232
- }
66233
- }
66234
- return output;
66235
- }
66236
- function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
66237
- for (const coord2 of multiPoint2.coordinates) {
66238
- let matchFound = false;
66239
- for (const coord1 of multiPoint1.coordinates) {
66240
- if (compareCoords(coord2, coord1)) {
66241
- matchFound = true;
66242
- break;
66243
- }
66244
- }
66245
- if (!matchFound) {
66246
- return false;
66247
- }
66248
- }
66249
- return true;
66250
- }
66251
- function isMultiPointOnLine(lineString2, multiPoint) {
66252
- let haveFoundInteriorPoint = false;
66253
- for (const coord of multiPoint.coordinates) {
66254
- if (booleanPointOnLine(coord, lineString2, { ignoreEndVertices: true })) {
66255
- haveFoundInteriorPoint = true;
66256
- }
66257
- if (!booleanPointOnLine(coord, lineString2)) {
66258
- return false;
66259
- }
66260
- }
66261
- if (haveFoundInteriorPoint) {
66262
- return true;
66263
- }
66264
- return false;
66265
- }
66266
- function isMultiPointInPoly(polygon2, multiPoint) {
66267
- for (const coord of multiPoint.coordinates) {
66268
- if (!booleanPointInPolygon(coord, polygon2, { ignoreBoundary: true })) {
66269
- return false;
66270
- }
66271
- }
66272
- return true;
66273
- }
66274
- function isLineOnLine(lineString1, lineString2) {
66275
- let haveFoundInteriorPoint = false;
66276
- for (const coords of lineString2.coordinates) {
66277
- if (booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
66278
- ignoreEndVertices: true
66279
- })) {
66280
- haveFoundInteriorPoint = true;
66281
- }
66282
- if (!booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
66283
- ignoreEndVertices: false
66284
- })) {
66285
- return false;
66286
- }
66287
- }
66288
- return haveFoundInteriorPoint;
66289
- }
66290
- function isLineInPoly(polygon2, linestring) {
66291
- let output = false;
66292
- let i2 = 0;
66293
- const polyBbox = bbox$1(polygon2);
66294
- const lineBbox = bbox$1(linestring);
66295
- if (!doBBoxOverlap(polyBbox, lineBbox)) {
66296
- return false;
66297
- }
66298
- for (i2; i2 < linestring.coordinates.length - 1; i2++) {
66299
- const midPoint = getMidpoint(
66300
- linestring.coordinates[i2],
66301
- linestring.coordinates[i2 + 1]
66302
- );
66303
- if (booleanPointInPolygon({ type: "Point", coordinates: midPoint }, polygon2, {
66304
- ignoreBoundary: true
66305
- })) {
66306
- output = true;
66307
- break;
66308
- }
66309
- }
66310
- return output;
66311
- }
66312
- function isPolyInPoly(feature1, feature2) {
66313
- if (feature1.type === "Feature" && feature1.geometry === null) {
66314
- return false;
66315
- }
66316
- if (feature2.type === "Feature" && feature2.geometry === null) {
66317
- return false;
66318
- }
66319
- const poly1Bbox = bbox$1(feature1);
66320
- const poly2Bbox = bbox$1(feature2);
66321
- if (!doBBoxOverlap(poly1Bbox, poly2Bbox)) {
66322
- return false;
66323
- }
66324
- const coords = getGeom(feature2).coordinates;
66325
- for (const ring of coords) {
66326
- for (const coord of ring) {
66327
- if (!booleanPointInPolygon(coord, feature1)) {
66328
- return false;
66329
- }
66330
- }
66331
- }
66332
- return true;
66333
- }
66334
- function doBBoxOverlap(bbox1, bbox2) {
66335
- if (bbox1[0] > bbox2[0]) {
66336
- return false;
66337
- }
66338
- if (bbox1[2] < bbox2[2]) {
66339
- return false;
66340
- }
66341
- if (bbox1[1] > bbox2[1]) {
66342
- return false;
66343
- }
66344
- if (bbox1[3] < bbox2[3]) {
66345
- return false;
66346
- }
66347
- return true;
66348
- }
66349
- function compareCoords(pair1, pair2) {
66350
- return pair1[0] === pair2[0] && pair1[1] === pair2[1];
66351
- }
66352
- function getMidpoint(pair1, pair2) {
66353
- return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
66354
- }
66355
- function quickselect(arr, k, left, right, compare2) {
66356
- quickselectStep(arr, k, left || 0, right || arr.length - 1, compare2 || defaultCompare$1);
66357
- }
66358
- function quickselectStep(arr, k, left, right, compare2) {
66359
- while (right > left) {
66360
- if (right - left > 600) {
66361
- var n2 = right - left + 1;
66362
- var m = k - left + 1;
66363
- var z = Math.log(n2);
66364
- var s2 = 0.5 * Math.exp(2 * z / 3);
66365
- var sd = 0.5 * Math.sqrt(z * s2 * (n2 - s2) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
66366
- var newLeft = Math.max(left, Math.floor(k - m * s2 / n2 + sd));
66367
- var newRight = Math.min(right, Math.floor(k + (n2 - m) * s2 / n2 + sd));
66368
- quickselectStep(arr, k, newLeft, newRight, compare2);
66369
- }
66370
- var t = arr[k];
66371
- var i2 = left;
66372
- var j = right;
66373
- swap(arr, left, k);
66374
- if (compare2(arr[right], t) > 0) swap(arr, left, right);
66375
- while (i2 < j) {
66376
- swap(arr, i2, j);
66377
- i2++;
66378
- j--;
66379
- while (compare2(arr[i2], t) < 0) i2++;
66380
- while (compare2(arr[j], t) > 0) j--;
66381
- }
66382
- if (compare2(arr[left], t) === 0) swap(arr, left, j);
66383
- else {
66384
- j++;
66385
- swap(arr, j, right);
66386
- }
66387
- if (j <= k) left = j + 1;
66388
- if (k <= j) right = j - 1;
66389
- }
66390
- }
66391
- function swap(arr, i2, j) {
66392
- var tmp = arr[i2];
66393
- arr[i2] = arr[j];
66394
- arr[j] = tmp;
66395
- }
66396
- function defaultCompare$1(a2, b) {
66397
- return a2 < b ? -1 : a2 > b ? 1 : 0;
66398
- }
66399
- class RBush {
66400
- constructor(maxEntries = 9) {
66401
- this._maxEntries = Math.max(4, maxEntries);
66402
- this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
66403
- this.clear();
66404
- }
66405
- all() {
66406
- return this._all(this.data, []);
66407
- }
66408
- search(bbox2) {
66409
- let node = this.data;
66410
- const result = [];
66411
- if (!intersects(bbox2, node)) return result;
66412
- const toBBox = this.toBBox;
66413
- const nodesToSearch = [];
66414
- while (node) {
66415
- for (let i2 = 0; i2 < node.children.length; i2++) {
66416
- const child = node.children[i2];
66417
- const childBBox = node.leaf ? toBBox(child) : child;
66418
- if (intersects(bbox2, childBBox)) {
66419
- if (node.leaf) result.push(child);
66420
- else if (contains$1(bbox2, childBBox)) this._all(child, result);
66421
- else nodesToSearch.push(child);
66422
- }
66423
- }
66424
- node = nodesToSearch.pop();
66425
- }
66426
- return result;
66427
- }
66428
- collides(bbox2) {
66429
- let node = this.data;
66430
- if (!intersects(bbox2, node)) return false;
66431
- const nodesToSearch = [];
66432
- while (node) {
66433
- for (let i2 = 0; i2 < node.children.length; i2++) {
66434
- const child = node.children[i2];
66435
- const childBBox = node.leaf ? this.toBBox(child) : child;
66436
- if (intersects(bbox2, childBBox)) {
66437
- if (node.leaf || contains$1(bbox2, childBBox)) return true;
66438
- nodesToSearch.push(child);
66439
- }
66440
- }
66441
- node = nodesToSearch.pop();
66442
- }
66443
- return false;
66444
- }
66445
- load(data) {
66446
- if (!(data && data.length)) return this;
66447
- if (data.length < this._minEntries) {
66448
- for (let i2 = 0; i2 < data.length; i2++) {
66449
- this.insert(data[i2]);
66450
- }
66451
- return this;
66452
- }
66453
- let node = this._build(data.slice(), 0, data.length - 1, 0);
66454
- if (!this.data.children.length) {
66455
- this.data = node;
66456
- } else if (this.data.height === node.height) {
66457
- this._splitRoot(this.data, node);
66458
- } else {
66459
- if (this.data.height < node.height) {
66460
- const tmpNode = this.data;
66461
- this.data = node;
66462
- node = tmpNode;
66463
- }
66464
- this._insert(node, this.data.height - node.height - 1, true);
66465
- }
66466
- return this;
66467
- }
66468
- insert(item) {
66469
- if (item) this._insert(item, this.data.height - 1);
66470
- return this;
66471
- }
66472
- clear() {
66473
- this.data = createNode([]);
66474
- return this;
66475
- }
66476
- remove(item, equalsFn) {
66477
- if (!item) return this;
66478
- let node = this.data;
66479
- const bbox2 = this.toBBox(item);
66480
- const path = [];
66481
- const indexes = [];
66482
- let i2, parent, goingUp;
66483
- while (node || path.length) {
66484
- if (!node) {
66485
- node = path.pop();
66486
- parent = path[path.length - 1];
66487
- i2 = indexes.pop();
66488
- goingUp = true;
66489
- }
66490
- if (node.leaf) {
66491
- const index2 = findItem(item, node.children, equalsFn);
66492
- if (index2 !== -1) {
66493
- node.children.splice(index2, 1);
66494
- path.push(node);
66495
- this._condense(path);
66496
- return this;
66497
- }
66498
- }
66499
- if (!goingUp && !node.leaf && contains$1(node, bbox2)) {
66500
- path.push(node);
66501
- indexes.push(i2);
66502
- i2 = 0;
66503
- parent = node;
66504
- node = node.children[0];
66505
- } else if (parent) {
66506
- i2++;
66507
- node = parent.children[i2];
66508
- goingUp = false;
66509
- } else node = null;
66510
- }
66511
- return this;
66512
- }
66513
- toBBox(item) {
66514
- return item;
66515
- }
66516
- compareMinX(a2, b) {
66517
- return a2.minX - b.minX;
66518
- }
66519
- compareMinY(a2, b) {
66520
- return a2.minY - b.minY;
66521
- }
66522
- toJSON() {
66523
- return this.data;
66524
- }
66525
- fromJSON(data) {
66526
- this.data = data;
66527
- return this;
66528
- }
66529
- _all(node, result) {
66530
- const nodesToSearch = [];
66531
- while (node) {
66532
- if (node.leaf) result.push(...node.children);
66533
- else nodesToSearch.push(...node.children);
66534
- node = nodesToSearch.pop();
66535
- }
66536
- return result;
66537
- }
66538
- _build(items, left, right, height) {
66539
- const N2 = right - left + 1;
66540
- let M = this._maxEntries;
66541
- let node;
66542
- if (N2 <= M) {
66543
- node = createNode(items.slice(left, right + 1));
66544
- calcBBox(node, this.toBBox);
66545
- return node;
66546
- }
66547
- if (!height) {
66548
- height = Math.ceil(Math.log(N2) / Math.log(M));
66549
- M = Math.ceil(N2 / Math.pow(M, height - 1));
66550
- }
66551
- node = createNode([]);
66552
- node.leaf = false;
66553
- node.height = height;
66554
- const N22 = Math.ceil(N2 / M);
66555
- const N1 = N22 * Math.ceil(Math.sqrt(M));
66556
- multiSelect(items, left, right, N1, this.compareMinX);
66557
- for (let i2 = left; i2 <= right; i2 += N1) {
66558
- const right2 = Math.min(i2 + N1 - 1, right);
66559
- multiSelect(items, i2, right2, N22, this.compareMinY);
66560
- for (let j = i2; j <= right2; j += N22) {
66561
- const right3 = Math.min(j + N22 - 1, right2);
66562
- node.children.push(this._build(items, j, right3, height - 1));
66563
- }
66564
- }
66565
- calcBBox(node, this.toBBox);
66566
- return node;
66567
- }
66568
- _chooseSubtree(bbox2, node, level, path) {
66569
- while (true) {
66570
- path.push(node);
66571
- if (node.leaf || path.length - 1 === level) break;
66572
- let minArea = Infinity;
66573
- let minEnlargement = Infinity;
66574
- let targetNode;
66575
- for (let i2 = 0; i2 < node.children.length; i2++) {
66576
- const child = node.children[i2];
66577
- const area2 = bboxArea(child);
66578
- const enlargement = enlargedArea(bbox2, child) - area2;
66579
- if (enlargement < minEnlargement) {
66580
- minEnlargement = enlargement;
66581
- minArea = area2 < minArea ? area2 : minArea;
66582
- targetNode = child;
66583
- } else if (enlargement === minEnlargement) {
66584
- if (area2 < minArea) {
66585
- minArea = area2;
66586
- targetNode = child;
66587
- }
66588
- }
66589
- }
66590
- node = targetNode || node.children[0];
66591
- }
66592
- return node;
66593
- }
66594
- _insert(item, level, isNode) {
66595
- const bbox2 = isNode ? item : this.toBBox(item);
66596
- const insertPath = [];
66597
- const node = this._chooseSubtree(bbox2, this.data, level, insertPath);
66598
- node.children.push(item);
66599
- extend(node, bbox2);
66600
- while (level >= 0) {
66601
- if (insertPath[level].children.length > this._maxEntries) {
66602
- this._split(insertPath, level);
66603
- level--;
66604
- } else break;
66605
- }
66606
- this._adjustParentBBoxes(bbox2, insertPath, level);
66607
- }
66608
- // split overflowed node into two
66609
- _split(insertPath, level) {
66610
- const node = insertPath[level];
66611
- const M = node.children.length;
66612
- const m = this._minEntries;
66613
- this._chooseSplitAxis(node, m, M);
66614
- const splitIndex = this._chooseSplitIndex(node, m, M);
66615
- const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
66616
- newNode.height = node.height;
66617
- newNode.leaf = node.leaf;
66618
- calcBBox(node, this.toBBox);
66619
- calcBBox(newNode, this.toBBox);
66620
- if (level) insertPath[level - 1].children.push(newNode);
66621
- else this._splitRoot(node, newNode);
66622
- }
66623
- _splitRoot(node, newNode) {
66624
- this.data = createNode([node, newNode]);
66625
- this.data.height = node.height + 1;
66626
- this.data.leaf = false;
66627
- calcBBox(this.data, this.toBBox);
66628
- }
66629
- _chooseSplitIndex(node, m, M) {
66630
- let index2;
66631
- let minOverlap = Infinity;
66632
- let minArea = Infinity;
66633
- for (let i2 = m; i2 <= M - m; i2++) {
66634
- const bbox1 = distBBox(node, 0, i2, this.toBBox);
66635
- const bbox2 = distBBox(node, i2, M, this.toBBox);
66636
- const overlap = intersectionArea(bbox1, bbox2);
66637
- const area2 = bboxArea(bbox1) + bboxArea(bbox2);
66638
- if (overlap < minOverlap) {
66639
- minOverlap = overlap;
66640
- index2 = i2;
66641
- minArea = area2 < minArea ? area2 : minArea;
66642
- } else if (overlap === minOverlap) {
66643
- if (area2 < minArea) {
66644
- minArea = area2;
66645
- index2 = i2;
66646
- }
66647
- }
66648
- }
66649
- return index2 || M - m;
66650
- }
66651
- // sorts node children by the best axis for split
66652
- _chooseSplitAxis(node, m, M) {
66653
- const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
66654
- const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
66655
- const xMargin = this._allDistMargin(node, m, M, compareMinX);
66656
- const yMargin = this._allDistMargin(node, m, M, compareMinY);
66657
- if (xMargin < yMargin) node.children.sort(compareMinX);
66658
- }
66659
- // total margin of all possible split distributions where each node is at least m full
66660
- _allDistMargin(node, m, M, compare2) {
66661
- node.children.sort(compare2);
66662
- const toBBox = this.toBBox;
66663
- const leftBBox = distBBox(node, 0, m, toBBox);
66664
- const rightBBox = distBBox(node, M - m, M, toBBox);
66665
- let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
66666
- for (let i2 = m; i2 < M - m; i2++) {
66667
- const child = node.children[i2];
66668
- extend(leftBBox, node.leaf ? toBBox(child) : child);
66669
- margin += bboxMargin(leftBBox);
66670
- }
66671
- for (let i2 = M - m - 1; i2 >= m; i2--) {
66672
- const child = node.children[i2];
66673
- extend(rightBBox, node.leaf ? toBBox(child) : child);
66674
- margin += bboxMargin(rightBBox);
66675
- }
66676
- return margin;
66677
- }
66678
- _adjustParentBBoxes(bbox2, path, level) {
66679
- for (let i2 = level; i2 >= 0; i2--) {
66680
- extend(path[i2], bbox2);
66681
- }
66682
- }
66683
- _condense(path) {
66684
- for (let i2 = path.length - 1, siblings; i2 >= 0; i2--) {
66685
- if (path[i2].children.length === 0) {
66686
- if (i2 > 0) {
66687
- siblings = path[i2 - 1].children;
66688
- siblings.splice(siblings.indexOf(path[i2]), 1);
66689
- } else this.clear();
66690
- } else calcBBox(path[i2], this.toBBox);
66691
- }
66692
- }
66693
- }
66694
- function findItem(item, items, equalsFn) {
66695
- if (!equalsFn) return items.indexOf(item);
66696
- for (let i2 = 0; i2 < items.length; i2++) {
66697
- if (equalsFn(item, items[i2])) return i2;
66698
- }
66699
- return -1;
66700
- }
66701
- function calcBBox(node, toBBox) {
66702
- distBBox(node, 0, node.children.length, toBBox, node);
66703
- }
66704
- function distBBox(node, k, p, toBBox, destNode) {
66705
- if (!destNode) destNode = createNode(null);
66706
- destNode.minX = Infinity;
66707
- destNode.minY = Infinity;
66708
- destNode.maxX = -Infinity;
66709
- destNode.maxY = -Infinity;
66710
- for (let i2 = k; i2 < p; i2++) {
66711
- const child = node.children[i2];
66712
- extend(destNode, node.leaf ? toBBox(child) : child);
66713
- }
66714
- return destNode;
66715
- }
66716
- function extend(a2, b) {
66717
- a2.minX = Math.min(a2.minX, b.minX);
66718
- a2.minY = Math.min(a2.minY, b.minY);
66719
- a2.maxX = Math.max(a2.maxX, b.maxX);
66720
- a2.maxY = Math.max(a2.maxY, b.maxY);
66721
- return a2;
66722
- }
66723
- function compareNodeMinX(a2, b) {
66724
- return a2.minX - b.minX;
66725
- }
66726
- function compareNodeMinY(a2, b) {
66727
- return a2.minY - b.minY;
66728
- }
66729
- function bboxArea(a2) {
66730
- return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
66731
- }
66732
- function bboxMargin(a2) {
66733
- return a2.maxX - a2.minX + (a2.maxY - a2.minY);
66734
- }
66735
- function enlargedArea(a2, b) {
66736
- return (Math.max(b.maxX, a2.maxX) - Math.min(b.minX, a2.minX)) * (Math.max(b.maxY, a2.maxY) - Math.min(b.minY, a2.minY));
66737
- }
66738
- function intersectionArea(a2, b) {
66739
- const minX = Math.max(a2.minX, b.minX);
66740
- const minY = Math.max(a2.minY, b.minY);
66741
- const maxX = Math.min(a2.maxX, b.maxX);
66742
- const maxY = Math.min(a2.maxY, b.maxY);
66743
- return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
66744
- }
66745
- function contains$1(a2, b) {
66746
- return a2.minX <= b.minX && a2.minY <= b.minY && b.maxX <= a2.maxX && b.maxY <= a2.maxY;
66747
- }
66748
- function intersects(a2, b) {
66749
- return b.minX <= a2.maxX && b.minY <= a2.maxY && b.maxX >= a2.minX && b.maxY >= a2.minY;
66750
- }
66751
- function createNode(children) {
66752
- return {
66753
- children,
66754
- height: 1,
66755
- leaf: true,
66756
- minX: Infinity,
66757
- minY: Infinity,
66758
- maxX: -Infinity,
66759
- maxY: -Infinity
66760
- };
66761
- }
66762
- function multiSelect(arr, left, right, n2, compare2) {
66763
- const stack2 = [left, right];
66764
- while (stack2.length) {
66765
- right = stack2.pop();
66766
- left = stack2.pop();
66767
- if (right - left <= n2) continue;
66768
- const mid = left + Math.ceil((right - left) / n2 / 2) * n2;
66769
- quickselect(arr, mid, left, right, compare2);
66770
- stack2.push(left, mid, mid, right);
66771
- }
66772
- }
66773
- function geojsonRbush(maxEntries) {
66774
- var tree = new RBush(maxEntries);
66775
- tree.insert = function(feature2) {
66776
- if (feature2.type !== "Feature") throw new Error("invalid feature");
66777
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
66778
- return RBush.prototype.insert.call(this, feature2);
66779
- };
66780
- tree.load = function(features) {
66781
- var load2 = [];
66782
- if (Array.isArray(features)) {
66783
- features.forEach(function(feature2) {
66784
- if (feature2.type !== "Feature") throw new Error("invalid features");
66785
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
66786
- load2.push(feature2);
66787
- });
66788
- } else {
66789
- featureEach(features, function(feature2) {
66790
- if (feature2.type !== "Feature") throw new Error("invalid features");
66791
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
66792
- load2.push(feature2);
66793
- });
66794
- }
66795
- return RBush.prototype.load.call(this, load2);
66796
- };
66797
- tree.remove = function(feature2, equals2) {
66798
- if (feature2.type !== "Feature") throw new Error("invalid feature");
66799
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
66800
- return RBush.prototype.remove.call(this, feature2, equals2);
66801
- };
66802
- tree.clear = function() {
66803
- return RBush.prototype.clear.call(this);
66804
- };
66805
- tree.search = function(geojson) {
66806
- var features = RBush.prototype.search.call(this, this.toBBox(geojson));
66807
- return featureCollection(features);
66808
- };
66809
- tree.collides = function(geojson) {
66810
- return RBush.prototype.collides.call(this, this.toBBox(geojson));
66811
- };
66812
- tree.all = function() {
66813
- var features = RBush.prototype.all.call(this);
66814
- return featureCollection(features);
66815
- };
66816
- tree.toJSON = function() {
66817
- return RBush.prototype.toJSON.call(this);
66818
- };
66819
- tree.fromJSON = function(json) {
66820
- return RBush.prototype.fromJSON.call(this, json);
66821
- };
66822
- tree.toBBox = function(geojson) {
66823
- var bbox2;
66824
- if (geojson.bbox) bbox2 = geojson.bbox;
66825
- else if (Array.isArray(geojson) && geojson.length === 4) bbox2 = geojson;
66826
- else if (Array.isArray(geojson) && geojson.length === 6)
66827
- bbox2 = [geojson[0], geojson[1], geojson[3], geojson[4]];
66828
- else if (geojson.type === "Feature") bbox2 = bbox$1(geojson);
66829
- else if (geojson.type === "FeatureCollection") bbox2 = bbox$1(geojson);
66830
- else throw new Error("invalid geojson");
66831
- return {
66832
- minX: bbox2[0],
66833
- minY: bbox2[1],
66834
- maxX: bbox2[2],
66835
- maxY: bbox2[3]
66836
- };
66837
- };
66838
- return tree;
66839
- }
66840
- function lineSegment(geojson) {
66841
- if (!geojson) {
66842
- throw new Error("geojson is required");
66843
- }
66844
- const results = [];
66845
- flattenEach(geojson, (feature2) => {
66846
- lineSegmentFeature(feature2, results);
66847
- });
66848
- return featureCollection(results);
66849
- }
66850
- function lineSegmentFeature(geojson, results) {
66851
- let coords = [];
66852
- const geometry2 = geojson.geometry;
66853
- if (geometry2 !== null) {
66854
- switch (geometry2.type) {
66855
- case "Polygon":
66856
- coords = getCoords(geometry2);
66857
- break;
66858
- case "LineString":
66859
- coords = [getCoords(geometry2)];
66860
- }
66861
- coords.forEach((coord) => {
66862
- const segments = createSegments(coord, geojson.properties);
66863
- segments.forEach((segment) => {
66864
- segment.id = results.length;
66865
- results.push(segment);
66866
- });
66867
- });
66868
- }
66869
- }
66870
- function createSegments(coords, properties) {
66871
- const segments = [];
66872
- coords.reduce((previousCoords, currentCoords) => {
66873
- const segment = lineString([previousCoords, currentCoords], properties);
66874
- segment.bbox = bbox(previousCoords, currentCoords);
66875
- segments.push(segment);
66876
- return currentCoords;
66877
- });
66878
- return segments;
66879
- }
66880
- function bbox(coords1, coords2) {
66881
- const x12 = coords1[0];
66882
- const y12 = coords1[1];
66883
- const x2 = coords2[0];
66884
- const y2 = coords2[1];
66885
- const west = x12 < x2 ? x12 : x2;
66886
- const south = y12 < y2 ? y12 : y2;
66887
- const east = x12 > x2 ? x12 : x2;
66888
- const north = y12 > y2 ? y12 : y2;
66889
- return [west, south, east, north];
66890
- }
66891
- function distance$1(from, to, options = {}) {
66892
- var coordinates1 = getCoord(from);
66893
- var coordinates2 = getCoord(to);
66894
- var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
66895
- var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
66896
- var lat1 = degreesToRadians(coordinates1[1]);
66897
- var lat2 = degreesToRadians(coordinates2[1]);
66898
- var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
66899
- return radiansToLength(
66900
- 2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
66901
- options.units
66902
- );
66903
- }
66904
- var __defProp$4 = Object.defineProperty;
66905
- var __defProps = Object.defineProperties;
66906
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
66907
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
66908
- var __hasOwnProp = Object.prototype.hasOwnProperty;
66909
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
66910
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
66911
- var __spreadValues = (a2, b) => {
66912
- for (var prop in b || (b = {}))
66913
- if (__hasOwnProp.call(b, prop))
66914
- __defNormalProp$1(a2, prop, b[prop]);
66915
- if (__getOwnPropSymbols)
66916
- for (var prop of __getOwnPropSymbols(b)) {
66917
- if (__propIsEnum.call(b, prop))
66918
- __defNormalProp$1(a2, prop, b[prop]);
66919
- }
66920
- return a2;
66921
- };
66922
- var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
66923
- function nearestPointOnLine(lines, pt, options = {}) {
66924
- if (!lines || !pt) {
66925
- throw new Error("lines and pt are required arguments");
66926
- }
66927
- const ptPos = getCoord(pt);
66928
- let closestPt = point([Infinity, Infinity], {
66929
- dist: Infinity,
66930
- index: -1,
66931
- multiFeatureIndex: -1,
66932
- location: -1
66933
- });
66934
- let length2 = 0;
66935
- flattenEach(
66936
- lines,
66937
- function(line, _featureIndex, multiFeatureIndex) {
66938
- const coords = getCoords(line);
66939
- for (let i2 = 0; i2 < coords.length - 1; i2++) {
66940
- const start = point(coords[i2]);
66941
- start.properties.dist = distance$1(pt, start, options);
66942
- const startPos = getCoord(start);
66943
- const stop = point(coords[i2 + 1]);
66944
- stop.properties.dist = distance$1(pt, stop, options);
66945
- const stopPos = getCoord(stop);
66946
- const sectionLength = distance$1(start, stop, options);
66947
- let intersectPos;
66948
- let wasEnd;
66949
- if (startPos[0] === ptPos[0] && startPos[1] === ptPos[1]) {
66950
- [intersectPos, , wasEnd] = [startPos, void 0, false];
66951
- } else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
66952
- [intersectPos, , wasEnd] = [stopPos, void 0, true];
66953
- } else {
66954
- [intersectPos, , wasEnd] = nearestPointOnSegment(
66955
- start.geometry.coordinates,
66956
- stop.geometry.coordinates,
66957
- getCoord(pt)
66958
- );
66959
- }
66960
- let intersectPt;
66961
- if (intersectPos) {
66962
- intersectPt = point(intersectPos, {
66963
- dist: distance$1(pt, intersectPos, options),
66964
- multiFeatureIndex,
66965
- location: length2 + distance$1(start, intersectPos, options)
66966
- });
66967
- }
66968
- if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
66969
- closestPt = __spreadProps(__spreadValues({}, intersectPt), {
66970
- properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
66971
- // Legacy behaviour where index progresses to next segment # if we
66972
- // went with the end point this iteration.
66973
- index: wasEnd ? i2 + 1 : i2
66974
- })
66975
- });
66976
- }
66977
- length2 += sectionLength;
66978
- }
66979
- }
66980
- );
66981
- return closestPt;
66982
- }
66983
- function dot(v12, v2) {
66984
- const [v1x, v1y, v1z] = v12;
66985
- const [v2x, v2y, v2z] = v2;
66986
- return v1x * v2x + v1y * v2y + v1z * v2z;
66987
- }
66988
- function cross(v12, v2) {
66989
- const [v1x, v1y, v1z] = v12;
66990
- const [v2x, v2y, v2z] = v2;
66991
- return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
66992
- }
66993
- function magnitude(v) {
66994
- return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
66995
- }
66996
- function angle$1(v12, v2) {
66997
- const theta = dot(v12, v2) / (magnitude(v12) * magnitude(v2));
66998
- return Math.acos(Math.min(Math.max(theta, -1), 1));
66999
- }
67000
- function lngLatToVector(a2) {
67001
- const lat = degreesToRadians(a2[1]);
67002
- const lng = degreesToRadians(a2[0]);
67003
- return [
67004
- Math.cos(lat) * Math.cos(lng),
67005
- Math.cos(lat) * Math.sin(lng),
67006
- Math.sin(lat)
67007
- ];
67008
- }
67009
- function vectorToLngLat(v) {
67010
- const [x, y, z] = v;
67011
- const lat = radiansToDegrees(Math.asin(z));
67012
- const lng = radiansToDegrees(Math.atan2(y, x));
67013
- return [lng, lat];
67014
- }
67015
- function nearestPointOnSegment(posA, posB, posC) {
67016
- const A2 = lngLatToVector(posA);
67017
- const B2 = lngLatToVector(posB);
67018
- const C3 = lngLatToVector(posC);
67019
- const [Cx, Cy, Cz] = C3;
67020
- const [D2, E2, F] = cross(A2, B2);
67021
- const a2 = E2 * Cz - F * Cy;
67022
- const b = F * Cx - D2 * Cz;
67023
- const c = D2 * Cy - E2 * Cx;
67024
- const f2 = c * E2 - b * F;
67025
- const g2 = a2 * F - c * D2;
67026
- const h = b * D2 - a2 * E2;
67027
- const t = 1 / Math.sqrt(Math.pow(f2, 2) + Math.pow(g2, 2) + Math.pow(h, 2));
67028
- const I1 = [f2 * t, g2 * t, h * t];
67029
- const I2 = [-1 * f2 * t, -1 * g2 * t, -1 * h * t];
67030
- const angleAB = angle$1(A2, B2);
67031
- const angleAI1 = angle$1(A2, I1);
67032
- const angleBI1 = angle$1(B2, I1);
67033
- const angleAI2 = angle$1(A2, I2);
67034
- const angleBI2 = angle$1(B2, I2);
67035
- let I3;
67036
- if (angleAI1 < angleAI2 && angleAI1 < angleBI2 || angleBI1 < angleAI2 && angleBI1 < angleBI2) {
67037
- I3 = I1;
67038
- } else {
67039
- I3 = I2;
67040
- }
67041
- if (angle$1(A2, I3) > angleAB || angle$1(B2, I3) > angleAB) {
67042
- if (distance$1(vectorToLngLat(I3), vectorToLngLat(A2)) <= distance$1(vectorToLngLat(I3), vectorToLngLat(B2))) {
67043
- return [vectorToLngLat(A2), true, false];
67044
- } else {
67045
- return [vectorToLngLat(B2), false, true];
67046
- }
67047
- }
67048
- return [vectorToLngLat(I3), false, false];
67049
- }
67050
- var fastDeepEqual;
67051
- var hasRequiredFastDeepEqual;
67052
- function requireFastDeepEqual() {
67053
- if (hasRequiredFastDeepEqual) return fastDeepEqual;
67054
- hasRequiredFastDeepEqual = 1;
67055
- fastDeepEqual = function equal2(a2, b) {
67056
- if (a2 === b) return true;
67057
- if (a2 && b && typeof a2 == "object" && typeof b == "object") {
67058
- if (a2.constructor !== b.constructor) return false;
67059
- var length2, i2, keys;
67060
- if (Array.isArray(a2)) {
67061
- length2 = a2.length;
67062
- if (length2 != b.length) return false;
67063
- for (i2 = length2; i2-- !== 0; )
67064
- if (!equal2(a2[i2], b[i2])) return false;
67065
- return true;
67066
- }
67067
- if (a2.constructor === RegExp) return a2.source === b.source && a2.flags === b.flags;
67068
- if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b.valueOf();
67069
- if (a2.toString !== Object.prototype.toString) return a2.toString() === b.toString();
67070
- keys = Object.keys(a2);
67071
- length2 = keys.length;
67072
- if (length2 !== Object.keys(b).length) return false;
67073
- for (i2 = length2; i2-- !== 0; )
67074
- if (!Object.prototype.hasOwnProperty.call(b, keys[i2])) return false;
67075
- for (i2 = length2; i2-- !== 0; ) {
67076
- var key = keys[i2];
67077
- if (!equal2(a2[key], b[key])) return false;
67078
- }
67079
- return true;
67080
- }
67081
- return a2 !== a2 && b !== b;
67082
- };
67083
- return fastDeepEqual;
67084
- }
67085
- var fastDeepEqualExports = requireFastDeepEqual();
67086
- const equal$1 = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
67087
- function lineOverlap(line1, line2, options = {}) {
67088
- options = options || {};
67089
- if (!isObject$2(options)) throw new Error("options is invalid");
67090
- var tolerance = options.tolerance || 0;
67091
- var features = [];
67092
- var tree = geojsonRbush();
67093
- const line = lineSegment(line1);
67094
- tree.load(line);
67095
- var overlapSegment;
67096
- let additionalSegments = [];
67097
- segmentEach(line2, function(segment) {
67098
- var doesOverlaps = false;
67099
- if (!segment) {
67100
- return;
67101
- }
67102
- featureEach(tree.search(segment), function(match) {
67103
- if (doesOverlaps === false) {
67104
- var coordsSegment = getCoords(segment).sort();
67105
- var coordsMatch = getCoords(match).sort();
67106
- if (equal$1(coordsSegment, coordsMatch)) {
67107
- doesOverlaps = true;
67108
- if (overlapSegment) {
67109
- overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
67110
- } else overlapSegment = segment;
67111
- } else if (tolerance === 0 ? booleanPointOnLine(coordsSegment[0], match) && booleanPointOnLine(coordsSegment[1], match) : nearestPointOnLine(match, coordsSegment[0]).properties.dist <= tolerance && nearestPointOnLine(match, coordsSegment[1]).properties.dist <= tolerance) {
67112
- doesOverlaps = true;
67113
- if (overlapSegment) {
67114
- overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
67115
- } else overlapSegment = segment;
67116
- } else if (tolerance === 0 ? booleanPointOnLine(coordsMatch[0], segment) && booleanPointOnLine(coordsMatch[1], segment) : nearestPointOnLine(segment, coordsMatch[0]).properties.dist <= tolerance && nearestPointOnLine(segment, coordsMatch[1]).properties.dist <= tolerance) {
67117
- if (overlapSegment) {
67118
- const combinedSegment = concatSegment(overlapSegment, match);
67119
- if (combinedSegment) {
67120
- overlapSegment = combinedSegment;
67121
- } else {
67122
- additionalSegments.push(match);
67123
- }
67124
- } else overlapSegment = match;
67125
- }
67126
- }
67127
- });
67128
- if (doesOverlaps === false && overlapSegment) {
67129
- features.push(overlapSegment);
67130
- if (additionalSegments.length) {
67131
- features = features.concat(additionalSegments);
67132
- additionalSegments = [];
67133
- }
67134
- overlapSegment = void 0;
67135
- }
67136
- });
67137
- if (overlapSegment) features.push(overlapSegment);
67138
- return featureCollection(features);
67139
- }
67140
- function concatSegment(line, segment) {
67141
- var coords = getCoords(segment);
67142
- var lineCoords = getCoords(line);
67143
- var start = lineCoords[0];
67144
- var end = lineCoords[lineCoords.length - 1];
67145
- var geom = line.geometry.coordinates;
67146
- if (equal$1(coords[0], start)) geom.unshift(coords[1]);
67147
- else if (equal$1(coords[0], end)) geom.push(coords[1]);
67148
- else if (equal$1(coords[1], start)) geom.unshift(coords[0]);
67149
- else if (equal$1(coords[1], end)) geom.push(coords[0]);
67150
- else return;
67151
- return line;
67152
- }
67153
- class TinyQueue {
67154
- constructor(data = [], compare2 = defaultCompare) {
67155
- this.data = data;
67156
- this.length = this.data.length;
67157
- this.compare = compare2;
67158
- if (this.length > 0) {
67159
- for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
67160
- }
67161
- }
67162
- push(item) {
67163
- this.data.push(item);
67164
- this.length++;
67165
- this._up(this.length - 1);
67166
- }
67167
- pop() {
67168
- if (this.length === 0) return void 0;
67169
- const top = this.data[0];
67170
- const bottom = this.data.pop();
67171
- this.length--;
67172
- if (this.length > 0) {
67173
- this.data[0] = bottom;
67174
- this._down(0);
67175
- }
67176
- return top;
67177
- }
67178
- peek() {
67179
- return this.data[0];
67180
- }
67181
- _up(pos) {
67182
- const { data, compare: compare2 } = this;
67183
- const item = data[pos];
67184
- while (pos > 0) {
67185
- const parent = pos - 1 >> 1;
67186
- const current = data[parent];
67187
- if (compare2(item, current) >= 0) break;
67188
- data[pos] = current;
67189
- pos = parent;
67190
- }
67191
- data[pos] = item;
67192
- }
67193
- _down(pos) {
67194
- const { data, compare: compare2 } = this;
67195
- const halfLength = this.length >> 1;
67196
- const item = data[pos];
67197
- while (pos < halfLength) {
67198
- let left = (pos << 1) + 1;
67199
- let best = data[left];
67200
- const right = left + 1;
67201
- if (right < this.length && compare2(data[right], best) < 0) {
67202
- left = right;
67203
- best = data[right];
67204
- }
67205
- if (compare2(best, item) >= 0) break;
67206
- data[pos] = best;
67207
- pos = left;
67208
- }
67209
- data[pos] = item;
67210
- }
67211
- }
67212
- function defaultCompare(a2, b) {
67213
- return a2 < b ? -1 : a2 > b ? 1 : 0;
67214
- }
67215
- function checkWhichEventIsLeft(e1, e2) {
67216
- if (e1.p.x > e2.p.x) return 1;
67217
- if (e1.p.x < e2.p.x) return -1;
67218
- if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
67219
- return 1;
67220
- }
67221
- function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
67222
- if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
67223
- if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
67224
- if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
67225
- return 1;
67226
- }
67227
- class Event {
67228
- constructor(p, featureId2, ringId2, eventId2) {
67229
- this.p = {
67230
- x: p[0],
67231
- y: p[1]
67232
- };
67233
- this.featureId = featureId2;
67234
- this.ringId = ringId2;
67235
- this.eventId = eventId2;
67236
- this.otherEvent = null;
67237
- this.isLeftEndpoint = null;
67238
- }
67239
- isSamePoint(eventToCheck) {
67240
- return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
67241
- }
67242
- }
67243
- function fillEventQueue(geojson, eventQueue) {
67244
- if (geojson.type === "FeatureCollection") {
67245
- const features = geojson.features;
67246
- for (let i2 = 0; i2 < features.length; i2++) {
67247
- processFeature(features[i2], eventQueue);
67248
- }
67249
- } else {
67250
- processFeature(geojson, eventQueue);
67251
- }
67252
- }
67253
- let featureId = 0;
67254
- let ringId = 0;
67255
- let eventId = 0;
67256
- function processFeature(featureOrGeometry, eventQueue) {
67257
- const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
67258
- let coords = geom.coordinates;
67259
- if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
67260
- if (geom.type === "LineString") coords = [[coords]];
67261
- for (let i2 = 0; i2 < coords.length; i2++) {
67262
- for (let ii = 0; ii < coords[i2].length; ii++) {
67263
- let currentP = coords[i2][ii][0];
67264
- let nextP = null;
67265
- ringId = ringId + 1;
67266
- for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
67267
- nextP = coords[i2][ii][iii + 1];
67268
- const e1 = new Event(currentP, featureId, ringId, eventId);
67269
- const e2 = new Event(nextP, featureId, ringId, eventId + 1);
67270
- e1.otherEvent = e2;
67271
- e2.otherEvent = e1;
67272
- if (checkWhichEventIsLeft(e1, e2) > 0) {
67273
- e2.isLeftEndpoint = true;
67274
- e1.isLeftEndpoint = false;
67275
- } else {
67276
- e1.isLeftEndpoint = true;
67277
- e2.isLeftEndpoint = false;
67278
- }
67279
- eventQueue.push(e1);
67280
- eventQueue.push(e2);
67281
- currentP = nextP;
67282
- eventId = eventId + 1;
67283
- }
67284
- }
67285
- }
67286
- featureId = featureId + 1;
67287
- }
67288
- let Segment$1 = class Segment {
67289
- constructor(event) {
67290
- this.leftSweepEvent = event;
67291
- this.rightSweepEvent = event.otherEvent;
67292
- }
67293
- };
67294
- function testSegmentIntersect(seg1, seg2) {
67295
- if (seg1 === null || seg2 === null) return false;
67296
- if (seg1.leftSweepEvent.ringId === seg2.leftSweepEvent.ringId && (seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.rightSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.rightSweepEvent))) return false;
67297
- const x12 = seg1.leftSweepEvent.p.x;
67298
- const y12 = seg1.leftSweepEvent.p.y;
67299
- const x2 = seg1.rightSweepEvent.p.x;
67300
- const y2 = seg1.rightSweepEvent.p.y;
67301
- const x3 = seg2.leftSweepEvent.p.x;
67302
- const y3 = seg2.leftSweepEvent.p.y;
67303
- const x4 = seg2.rightSweepEvent.p.x;
67304
- const y4 = seg2.rightSweepEvent.p.y;
67305
- const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
67306
- const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
67307
- const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
67308
- if (denom === 0) {
67309
- if (numeA === 0 && numeB === 0) return false;
67310
- return false;
67311
- }
67312
- const uA = numeA / denom;
67313
- const uB = numeB / denom;
67314
- if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
67315
- const x = x12 + uA * (x2 - x12);
67316
- const y = y12 + uA * (y2 - y12);
67317
- return [x, y];
67318
- }
67319
- return false;
67320
- }
67321
- function runCheck(eventQueue, ignoreSelfIntersections) {
67322
- ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
67323
- const intersectionPoints = [];
67324
- const outQueue = new TinyQueue([], checkWhichSegmentHasRightEndpointFirst);
67325
- while (eventQueue.length) {
67326
- const event = eventQueue.pop();
67327
- if (event.isLeftEndpoint) {
67328
- const segment = new Segment$1(event);
67329
- for (let i2 = 0; i2 < outQueue.data.length; i2++) {
67330
- const otherSeg = outQueue.data[i2];
67331
- if (ignoreSelfIntersections) {
67332
- if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
67333
- }
67334
- const intersection2 = testSegmentIntersect(segment, otherSeg);
67335
- if (intersection2 !== false) intersectionPoints.push(intersection2);
67336
- }
67337
- outQueue.push(segment);
67338
- } else if (event.isLeftEndpoint === false) {
67339
- outQueue.pop();
67340
- }
67341
- }
67342
- return intersectionPoints;
67343
- }
67344
- function sweeplineIntersections$1(geojson, ignoreSelfIntersections) {
67345
- const eventQueue = new TinyQueue([], checkWhichEventIsLeft);
67346
- fillEventQueue(geojson, eventQueue);
67347
- return runCheck(eventQueue, ignoreSelfIntersections);
67348
- }
67349
- const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
67350
- __proto__: null,
67351
- default: sweeplineIntersections$1
67352
- }, Symbol.toStringTag, { value: "Module" }));
67353
- var sweeplineIntersections = sweeplineIntersections$1;
67354
- function lineIntersect(line1, line2, options = {}) {
67355
- const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
67356
- let features = [];
67357
- if (line1.type === "FeatureCollection")
67358
- features = features.concat(line1.features);
67359
- else if (line1.type === "Feature") features.push(line1);
67360
- else if (line1.type === "LineString" || line1.type === "Polygon" || line1.type === "MultiLineString" || line1.type === "MultiPolygon") {
67361
- features.push(feature$1(line1));
67362
- }
67363
- if (line2.type === "FeatureCollection")
67364
- features = features.concat(line2.features);
67365
- else if (line2.type === "Feature") features.push(line2);
67366
- else if (line2.type === "LineString" || line2.type === "Polygon" || line2.type === "MultiLineString" || line2.type === "MultiPolygon") {
67367
- features.push(feature$1(line2));
67368
- }
67369
- const intersections = sweeplineIntersections(
67370
- featureCollection(features),
67371
- ignoreSelfIntersections
67372
- );
67373
- let results = [];
67374
- if (removeDuplicates) {
67375
- const unique2 = {};
67376
- intersections.forEach((intersection2) => {
67377
- const key = intersection2.join(",");
67378
- if (!unique2[key]) {
67379
- unique2[key] = true;
67380
- results.push(intersection2);
67381
- }
67382
- });
67383
- } else {
67384
- results = intersections;
67385
- }
67386
- return featureCollection(results.map((r2) => point(r2)));
67387
- }
67388
- var __defProp$1 = Object.defineProperty;
67389
- var __name = (target, value) => __defProp$1(target, "name", { value, configurable: true });
67390
- var _GeojsonEquality = class _GeojsonEquality2 {
67391
- constructor(opts) {
67392
- this.direction = false;
67393
- this.compareProperties = true;
67394
- var _a2, _b, _c;
67395
- this.precision = 10 ** -((_a2 = opts == null ? void 0 : opts.precision) != null ? _a2 : 17);
67396
- this.direction = (_b = opts == null ? void 0 : opts.direction) != null ? _b : false;
67397
- this.compareProperties = (_c = opts == null ? void 0 : opts.compareProperties) != null ? _c : true;
67398
- }
67399
- compare(g1, g2) {
67400
- if (g1.type !== g2.type) {
67401
- return false;
67402
- }
67403
- if (!sameLength(g1, g2)) {
67404
- return false;
67405
- }
67406
- switch (g1.type) {
67407
- case "Point":
67408
- return this.compareCoord(g1.coordinates, g2.coordinates);
67409
- case "LineString":
67410
- return this.compareLine(g1.coordinates, g2.coordinates);
67411
- case "Polygon":
67412
- return this.comparePolygon(g1, g2);
67413
- case "GeometryCollection":
67414
- return this.compareGeometryCollection(g1, g2);
67415
- case "Feature":
67416
- return this.compareFeature(g1, g2);
67417
- case "FeatureCollection":
67418
- return this.compareFeatureCollection(g1, g2);
67419
- default:
67420
- if (g1.type.startsWith("Multi")) {
67421
- const g1s = explode(g1);
67422
- const g2s = explode(
67423
- g2
67424
- );
67425
- return g1s.every(
67426
- (g1part) => g2s.some((g2part) => this.compare(g1part, g2part))
67427
- );
67428
- }
67429
- }
67430
- return false;
67431
- }
67432
- compareCoord(c1, c2) {
67433
- return c1.length === c2.length && c1.every((c, i2) => Math.abs(c - c2[i2]) < this.precision);
67434
- }
67435
- compareLine(path1, path2, ind = 0, isPoly = false) {
67436
- if (!sameLength(path1, path2)) {
67437
- return false;
67438
- }
67439
- const p1 = path1;
67440
- let p2 = path2;
67441
- if (isPoly && !this.compareCoord(p1[0], p2[0])) {
67442
- const startIndex = this.fixStartIndex(p2, p1);
67443
- if (!startIndex) {
67444
- return false;
67445
- } else {
67446
- p2 = startIndex;
67447
- }
67448
- }
67449
- const sameDirection = this.compareCoord(p1[ind], p2[ind]);
67450
- if (this.direction || sameDirection) {
67451
- return this.comparePath(p1, p2);
67452
- } else {
67453
- if (this.compareCoord(p1[ind], p2[p2.length - (1 + ind)])) {
67454
- return this.comparePath(p1.slice().reverse(), p2);
67455
- }
67456
- return false;
67457
- }
67458
- }
67459
- fixStartIndex(sourcePath, targetPath) {
67460
- let correctPath, ind = -1;
67461
- for (let i2 = 0; i2 < sourcePath.length; i2++) {
67462
- if (this.compareCoord(sourcePath[i2], targetPath[0])) {
67463
- ind = i2;
67464
- break;
67465
- }
67466
- }
67467
- if (ind >= 0) {
67468
- correctPath = [].concat(
67469
- sourcePath.slice(ind, sourcePath.length),
67470
- sourcePath.slice(1, ind + 1)
67471
- );
67472
- }
67473
- return correctPath;
67474
- }
67475
- comparePath(p1, p2) {
67476
- return p1.every((c, i2) => this.compareCoord(c, p2[i2]));
67477
- }
67478
- comparePolygon(g1, g2) {
67479
- if (this.compareLine(g1.coordinates[0], g2.coordinates[0], 1, true)) {
67480
- const holes1 = g1.coordinates.slice(1, g1.coordinates.length);
67481
- const holes2 = g2.coordinates.slice(1, g2.coordinates.length);
67482
- return holes1.every(
67483
- (h1) => holes2.some((h2) => this.compareLine(h1, h2, 1, true))
67484
- );
67485
- }
67486
- return false;
67487
- }
67488
- compareGeometryCollection(g1, g2) {
67489
- return sameLength(g1.geometries, g2.geometries) && this.compareBBox(g1, g2) && g1.geometries.every((g3, i2) => this.compare(g3, g2.geometries[i2]));
67490
- }
67491
- compareFeature(g1, g2) {
67492
- return g1.id === g2.id && (this.compareProperties ? equal(g1.properties, g2.properties) : true) && this.compareBBox(g1, g2) && this.compare(g1.geometry, g2.geometry);
67493
- }
67494
- compareFeatureCollection(g1, g2) {
67495
- return sameLength(g1.features, g2.features) && this.compareBBox(g1, g2) && g1.features.every((f2, i2) => this.compare(f2, g2.features[i2]));
67496
- }
67497
- compareBBox(g1, g2) {
67498
- return Boolean(!g1.bbox && !g2.bbox) || (g1.bbox && g2.bbox ? this.compareCoord(g1.bbox, g2.bbox) : false);
67499
- }
67500
- };
67501
- __name(_GeojsonEquality, "GeojsonEquality");
67502
- var GeojsonEquality = _GeojsonEquality;
67503
- function sameLength(g1, g2) {
67504
- return g1.coordinates ? g1.coordinates.length === g2.coordinates.length : g1.length === g2.length;
67505
- }
67506
- __name(sameLength, "sameLength");
67507
- function explode(g2) {
67508
- return g2.coordinates.map((part) => ({
67509
- type: g2.type.replace("Multi", ""),
67510
- coordinates: part
67511
- }));
67512
- }
67513
- __name(explode, "explode");
67514
- function geojsonEquality(g1, g2, opts) {
67515
- const eq2 = new GeojsonEquality(opts);
67516
- return eq2.compare(g1, g2);
67517
- }
67518
- __name(geojsonEquality, "geojsonEquality");
67519
- function equal(object1, object2) {
67520
- if (object1 === null && object2 === null) {
67521
- return true;
67522
- }
67523
- if (object1 === null || object2 === null) {
67524
- return false;
67525
- }
67526
- const objKeys1 = Object.keys(object1);
67527
- const objKeys2 = Object.keys(object2);
67528
- if (objKeys1.length !== objKeys2.length) return false;
67529
- for (var key of objKeys1) {
67530
- const value1 = object1[key];
67531
- const value2 = object2[key];
67532
- const isObjects = isObject$1(value1) && isObject$1(value2);
67533
- if (isObjects && !equal(value1, value2) || !isObjects && value1 !== value2) {
67534
- return false;
67535
- }
67536
- }
67537
- return true;
67538
- }
67539
- __name(equal, "equal");
67540
- var isObject$1 = /* @__PURE__ */ __name((object2) => {
67541
- return object2 != null && typeof object2 === "object";
67542
- }, "isObject");
67543
- function booleanOverlap(feature1, feature2) {
67544
- const geom1 = getGeom(feature1);
67545
- const geom2 = getGeom(feature2);
67546
- const type1 = geom1.type;
67547
- const type2 = geom2.type;
67548
- if (type1 === "MultiPoint" && type2 !== "MultiPoint" || (type1 === "LineString" || type1 === "MultiLineString") && type2 !== "LineString" && type2 !== "MultiLineString" || (type1 === "Polygon" || type1 === "MultiPolygon") && type2 !== "Polygon" && type2 !== "MultiPolygon") {
67549
- throw new Error("features must be of the same type");
67550
- }
67551
- if (type1 === "Point") throw new Error("Point geometry not supported");
67552
- if (geojsonEquality(feature1, feature2, { precision: 6 }))
67553
- return false;
67554
- let overlap = 0;
67555
- switch (type1) {
67556
- case "MultiPoint":
67557
- for (var i2 = 0; i2 < geom1.coordinates.length; i2++) {
67558
- for (var j = 0; j < geom2.coordinates.length; j++) {
67559
- var coord1 = geom1.coordinates[i2];
67560
- var coord2 = geom2.coordinates[j];
67561
- if (coord1[0] === coord2[0] && coord1[1] === coord2[1]) {
67562
- return true;
67563
- }
67564
- }
67565
- }
67566
- return false;
67567
- case "LineString":
67568
- case "MultiLineString":
67569
- segmentEach(feature1, (segment1) => {
67570
- segmentEach(feature2, (segment2) => {
67571
- if (lineOverlap(segment1, segment2).features.length) overlap++;
67572
- });
67573
- });
67574
- break;
67575
- case "Polygon":
67576
- case "MultiPolygon":
67577
- segmentEach(feature1, (segment1) => {
67578
- segmentEach(feature2, (segment2) => {
67579
- if (lineIntersect(segment1, segment2).features.length) overlap++;
67580
- });
67581
- });
67582
- break;
67583
- }
67584
- return overlap > 0;
65571
+ function inBBox(pt, bbox) {
65572
+ return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
67585
65573
  }
67586
65574
  var distEs6$2 = {};
67587
65575
  var style$1 = {};
@@ -67678,7 +65666,7 @@ function requireCjs$f() {
67678
65666
  case "Point":
67679
65667
  return point2(coordinates2).geometry;
67680
65668
  case "LineString":
67681
- return lineString2(coordinates2).geometry;
65669
+ return lineString(coordinates2).geometry;
67682
65670
  case "Polygon":
67683
65671
  return polygon2(coordinates2).geometry;
67684
65672
  case "MultiPoint":
@@ -67748,7 +65736,7 @@ function requireCjs$f() {
67748
65736
  options
67749
65737
  );
67750
65738
  }
67751
- function lineString2(coordinates2, properties, options = {}) {
65739
+ function lineString(coordinates2, properties, options = {}) {
67752
65740
  if (coordinates2.length < 2) {
67753
65741
  throw new Error("coordinates must be an array of two or more positions");
67754
65742
  }
@@ -67761,7 +65749,7 @@ function requireCjs$f() {
67761
65749
  function lineStrings(coordinates2, properties, options = {}) {
67762
65750
  return featureCollection2(
67763
65751
  coordinates2.map((coords) => {
67764
- return lineString2(coords, properties);
65752
+ return lineString(coords, properties);
67765
65753
  }),
67766
65754
  options
67767
65755
  );
@@ -67827,7 +65815,7 @@ function requireCjs$f() {
67827
65815
  return distance2 / factor;
67828
65816
  }
67829
65817
  function lengthToDegrees(distance2, units) {
67830
- return radiansToDegrees2(lengthToRadians(distance2, units));
65818
+ return radiansToDegrees(lengthToRadians(distance2, units));
67831
65819
  }
67832
65820
  function bearingToAzimuth(bearing) {
67833
65821
  let angle2 = bearing % 360;
@@ -67845,7 +65833,7 @@ function requireCjs$f() {
67845
65833
  }
67846
65834
  return angle2;
67847
65835
  }
67848
- function radiansToDegrees2(radians2) {
65836
+ function radiansToDegrees(radians2) {
67849
65837
  const normalisedRadians = radians2 % (2 * Math.PI);
67850
65838
  return normalisedRadians * 180 / Math.PI;
67851
65839
  }
@@ -67879,17 +65867,17 @@ function requireCjs$f() {
67879
65867
  function isObject2(input) {
67880
65868
  return input !== null && typeof input === "object" && !Array.isArray(input);
67881
65869
  }
67882
- function validateBBox(bbox2) {
67883
- if (!bbox2) {
65870
+ function validateBBox(bbox) {
65871
+ if (!bbox) {
67884
65872
  throw new Error("bbox is required");
67885
65873
  }
67886
- if (!Array.isArray(bbox2)) {
65874
+ if (!Array.isArray(bbox)) {
67887
65875
  throw new Error("bbox must be an Array");
67888
65876
  }
67889
- if (bbox2.length !== 4 && bbox2.length !== 6) {
65877
+ if (bbox.length !== 4 && bbox.length !== 6) {
67890
65878
  throw new Error("bbox must be an Array of 4 or 6 numbers");
67891
65879
  }
67892
- bbox2.forEach((num) => {
65880
+ bbox.forEach((num) => {
67893
65881
  if (!isNumber2(num)) {
67894
65882
  throw new Error("bbox must only contain numbers");
67895
65883
  }
@@ -67919,7 +65907,7 @@ function requireCjs$f() {
67919
65907
  cjs$f.isObject = isObject2;
67920
65908
  cjs$f.lengthToDegrees = lengthToDegrees;
67921
65909
  cjs$f.lengthToRadians = lengthToRadians;
67922
- cjs$f.lineString = lineString2;
65910
+ cjs$f.lineString = lineString;
67923
65911
  cjs$f.lineStrings = lineStrings;
67924
65912
  cjs$f.multiLineString = multiLineString;
67925
65913
  cjs$f.multiPoint = multiPoint;
@@ -67928,7 +65916,7 @@ function requireCjs$f() {
67928
65916
  cjs$f.points = points;
67929
65917
  cjs$f.polygon = polygon2;
67930
65918
  cjs$f.polygons = polygons2;
67931
- cjs$f.radiansToDegrees = radiansToDegrees2;
65919
+ cjs$f.radiansToDegrees = radiansToDegrees;
67932
65920
  cjs$f.radiansToLength = radiansToLength2;
67933
65921
  cjs$f.round = round2;
67934
65922
  cjs$f.validateBBox = validateBBox;
@@ -67943,7 +65931,7 @@ function requireCjs$e() {
67943
65931
  hasRequiredCjs$e = 1;
67944
65932
  Object.defineProperty(cjs$d, "__esModule", { value: true });
67945
65933
  var _helpers = /* @__PURE__ */ requireCjs$f();
67946
- function coordEach2(geojson, callback, excludeWrapCoord) {
65934
+ function coordEach(geojson, callback, excludeWrapCoord) {
67947
65935
  if (geojson === null) return;
67948
65936
  var j, k, l2, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
67949
65937
  for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
@@ -68030,7 +66018,7 @@ function requireCjs$e() {
68030
66018
  break;
68031
66019
  case "GeometryCollection":
68032
66020
  for (j = 0; j < geometry2.geometries.length; j++)
68033
- if (coordEach2(geometry2.geometries[j], callback, excludeWrapCoord) === false)
66021
+ if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
68034
66022
  return false;
68035
66023
  break;
68036
66024
  default:
@@ -68041,7 +66029,7 @@ function requireCjs$e() {
68041
66029
  }
68042
66030
  function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
68043
66031
  var previousValue = initialValue;
68044
- coordEach2(
66032
+ coordEach(
68045
66033
  geojson,
68046
66034
  function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
68047
66035
  if (coordIndex === 0 && initialValue === void 0)
@@ -68083,7 +66071,7 @@ function requireCjs$e() {
68083
66071
  });
68084
66072
  return previousValue;
68085
66073
  }
68086
- function featureEach2(geojson, callback) {
66074
+ function featureEach(geojson, callback) {
68087
66075
  if (geojson.type === "Feature") {
68088
66076
  callback(geojson, 0);
68089
66077
  } else if (geojson.type === "FeatureCollection") {
@@ -68094,7 +66082,7 @@ function requireCjs$e() {
68094
66082
  }
68095
66083
  function featureReduce(geojson, callback, initialValue) {
68096
66084
  var previousValue = initialValue;
68097
- featureEach2(geojson, function(currentFeature, featureIndex) {
66085
+ featureEach(geojson, function(currentFeature, featureIndex) {
68098
66086
  if (featureIndex === 0 && initialValue === void 0)
68099
66087
  previousValue = currentFeature;
68100
66088
  else previousValue = callback(previousValue, currentFeature, featureIndex);
@@ -68103,7 +66091,7 @@ function requireCjs$e() {
68103
66091
  }
68104
66092
  function coordAll(geojson) {
68105
66093
  var coords = [];
68106
- coordEach2(geojson, function(coord) {
66094
+ coordEach(geojson, function(coord) {
68107
66095
  coords.push(coord);
68108
66096
  });
68109
66097
  return coords;
@@ -68188,7 +66176,7 @@ function requireCjs$e() {
68188
66176
  return previousValue;
68189
66177
  }
68190
66178
  function flattenEach2(geojson, callback) {
68191
- geomEach2(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
66179
+ geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
68192
66180
  var type = geometry2 === null ? null : geometry2.type;
68193
66181
  switch (type) {
68194
66182
  case null:
@@ -68196,7 +66184,7 @@ function requireCjs$e() {
68196
66184
  case "LineString":
68197
66185
  case "Polygon":
68198
66186
  if (callback(
68199
- _helpers.feature.call(void 0, geometry2, properties, { bbox: bbox2, id }),
66187
+ _helpers.feature.call(void 0, geometry2, properties, { bbox, id }),
68200
66188
  featureIndex,
68201
66189
  0
68202
66190
  ) === false)
@@ -68244,7 +66232,7 @@ function requireCjs$e() {
68244
66232
  );
68245
66233
  return previousValue;
68246
66234
  }
68247
- function segmentEach2(geojson, callback) {
66235
+ function segmentEach(geojson, callback) {
68248
66236
  flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
68249
66237
  var segmentIndex = 0;
68250
66238
  if (!feature2.geometry) return;
@@ -68254,7 +66242,7 @@ function requireCjs$e() {
68254
66242
  var previousFeatureIndex = 0;
68255
66243
  var previousMultiIndex = 0;
68256
66244
  var prevGeomIndex = 0;
68257
- if (coordEach2(
66245
+ if (coordEach(
68258
66246
  feature2,
68259
66247
  function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
68260
66248
  if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
@@ -68288,7 +66276,7 @@ function requireCjs$e() {
68288
66276
  function segmentReduce(geojson, callback, initialValue) {
68289
66277
  var previousValue = initialValue;
68290
66278
  var started = false;
68291
- segmentEach2(
66279
+ segmentEach(
68292
66280
  geojson,
68293
66281
  function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
68294
66282
  if (started === false && initialValue === void 0)
@@ -68515,9 +66503,9 @@ function requireCjs$e() {
68515
66503
  throw new Error("geojson is invalid");
68516
66504
  }
68517
66505
  cjs$d.coordAll = coordAll;
68518
- cjs$d.coordEach = coordEach2;
66506
+ cjs$d.coordEach = coordEach;
68519
66507
  cjs$d.coordReduce = coordReduce;
68520
- cjs$d.featureEach = featureEach2;
66508
+ cjs$d.featureEach = featureEach;
68521
66509
  cjs$d.featureReduce = featureReduce;
68522
66510
  cjs$d.findPoint = findPoint;
68523
66511
  cjs$d.findSegment = findSegment;
@@ -68529,7 +66517,7 @@ function requireCjs$e() {
68529
66517
  cjs$d.lineReduce = lineReduce;
68530
66518
  cjs$d.propEach = propEach;
68531
66519
  cjs$d.propReduce = propReduce;
68532
- cjs$d.segmentEach = segmentEach2;
66520
+ cjs$d.segmentEach = segmentEach;
68533
66521
  cjs$d.segmentReduce = segmentReduce;
68534
66522
  return cjs$d;
68535
66523
  }
@@ -68539,7 +66527,7 @@ function requireCjs$d() {
68539
66527
  hasRequiredCjs$d = 1;
68540
66528
  Object.defineProperty(cjs$e, "__esModule", { value: true });
68541
66529
  var _meta = /* @__PURE__ */ requireCjs$e();
68542
- function bbox2(geojson, options = {}) {
66530
+ function bbox(geojson, options = {}) {
68543
66531
  if (geojson.bbox != null && true !== options.recompute) {
68544
66532
  return geojson.bbox;
68545
66533
  }
@@ -68560,8 +66548,8 @@ function requireCjs$d() {
68560
66548
  });
68561
66549
  return result;
68562
66550
  }
68563
- var turf_bbox_default = bbox2;
68564
- cjs$e.bbox = bbox2;
66551
+ var turf_bbox_default = bbox;
66552
+ cjs$e.bbox = bbox;
68565
66553
  cjs$e.default = turf_bbox_default;
68566
66554
  return cjs$e;
68567
66555
  }
@@ -68645,7 +66633,7 @@ function requireJs$p() {
68645
66633
  case "Point":
68646
66634
  return point2(coordinates2).geometry;
68647
66635
  case "LineString":
68648
- return lineString2(coordinates2).geometry;
66636
+ return lineString(coordinates2).geometry;
68649
66637
  case "Polygon":
68650
66638
  return polygon2(coordinates2).geometry;
68651
66639
  case "MultiPoint":
@@ -68722,7 +66710,7 @@ function requireJs$p() {
68722
66710
  }), options);
68723
66711
  }
68724
66712
  exports.polygons = polygons2;
68725
- function lineString2(coordinates2, properties, options) {
66713
+ function lineString(coordinates2, properties, options) {
68726
66714
  if (options === void 0) {
68727
66715
  options = {};
68728
66716
  }
@@ -68735,13 +66723,13 @@ function requireJs$p() {
68735
66723
  };
68736
66724
  return feature2(geom, properties, options);
68737
66725
  }
68738
- exports.lineString = lineString2;
66726
+ exports.lineString = lineString;
68739
66727
  function lineStrings(coordinates2, properties, options) {
68740
66728
  if (options === void 0) {
68741
66729
  options = {};
68742
66730
  }
68743
66731
  return featureCollection2(coordinates2.map(function(coords) {
68744
- return lineString2(coords, properties);
66732
+ return lineString(coords, properties);
68745
66733
  }), options);
68746
66734
  }
68747
66735
  exports.lineStrings = lineStrings;
@@ -68838,7 +66826,7 @@ function requireJs$p() {
68838
66826
  }
68839
66827
  exports.lengthToRadians = lengthToRadians;
68840
66828
  function lengthToDegrees(distance2, units) {
68841
- return radiansToDegrees2(lengthToRadians(distance2, units));
66829
+ return radiansToDegrees(lengthToRadians(distance2, units));
68842
66830
  }
68843
66831
  exports.lengthToDegrees = lengthToDegrees;
68844
66832
  function bearingToAzimuth(bearing) {
@@ -68849,11 +66837,11 @@ function requireJs$p() {
68849
66837
  return angle2;
68850
66838
  }
68851
66839
  exports.bearingToAzimuth = bearingToAzimuth;
68852
- function radiansToDegrees2(radians2) {
66840
+ function radiansToDegrees(radians2) {
68853
66841
  var degrees2 = radians2 % (2 * Math.PI);
68854
66842
  return degrees2 * 180 / Math.PI;
68855
66843
  }
68856
- exports.radiansToDegrees = radiansToDegrees2;
66844
+ exports.radiansToDegrees = radiansToDegrees;
68857
66845
  function degreesToRadians2(degrees2) {
68858
66846
  var radians2 = degrees2 % 360;
68859
66847
  return radians2 * Math.PI / 180;
@@ -68901,17 +66889,17 @@ function requireJs$p() {
68901
66889
  return !!input && input.constructor === Object;
68902
66890
  }
68903
66891
  exports.isObject = isObject2;
68904
- function validateBBox(bbox2) {
68905
- if (!bbox2) {
66892
+ function validateBBox(bbox) {
66893
+ if (!bbox) {
68906
66894
  throw new Error("bbox is required");
68907
66895
  }
68908
- if (!Array.isArray(bbox2)) {
66896
+ if (!Array.isArray(bbox)) {
68909
66897
  throw new Error("bbox must be an Array");
68910
66898
  }
68911
- if (bbox2.length !== 4 && bbox2.length !== 6) {
66899
+ if (bbox.length !== 4 && bbox.length !== 6) {
68912
66900
  throw new Error("bbox must be an Array of 4 or 6 numbers");
68913
66901
  }
68914
- bbox2.forEach(function(num) {
66902
+ bbox.forEach(function(num) {
68915
66903
  if (!isNumber2(num)) {
68916
66904
  throw new Error("bbox must only contain numbers");
68917
66905
  }
@@ -68936,22 +66924,22 @@ function requireJs$o() {
68936
66924
  hasRequiredJs$o = 1;
68937
66925
  Object.defineProperty(js$p, "__esModule", { value: true });
68938
66926
  var helpers_1 = /* @__PURE__ */ requireJs$p();
68939
- function bboxPolygon(bbox2, options) {
66927
+ function bboxPolygon(bbox, options) {
68940
66928
  if (options === void 0) {
68941
66929
  options = {};
68942
66930
  }
68943
- var west = Number(bbox2[0]);
68944
- var south = Number(bbox2[1]);
68945
- var east = Number(bbox2[2]);
68946
- var north = Number(bbox2[3]);
68947
- if (bbox2.length === 6) {
66931
+ var west = Number(bbox[0]);
66932
+ var south = Number(bbox[1]);
66933
+ var east = Number(bbox[2]);
66934
+ var north = Number(bbox[3]);
66935
+ if (bbox.length === 6) {
68948
66936
  throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");
68949
66937
  }
68950
66938
  var lowLeft = [west, south];
68951
66939
  var topLeft = [west, north];
68952
66940
  var topRight = [east, north];
68953
66941
  var lowRight = [east, south];
68954
- return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox: bbox2, id: options.id });
66942
+ return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox, id: options.id });
68955
66943
  }
68956
66944
  js$p.default = bboxPolygon;
68957
66945
  return js$p;
@@ -68966,7 +66954,7 @@ function requireJs$n() {
68966
66954
  hasRequiredJs$n = 1;
68967
66955
  Object.defineProperty(js$k, "__esModule", { value: true });
68968
66956
  var helpers = /* @__PURE__ */ requireJs$p();
68969
- function coordEach2(geojson, callback, excludeWrapCoord) {
66957
+ function coordEach(geojson, callback, excludeWrapCoord) {
68970
66958
  if (geojson === null) return;
68971
66959
  var j, k, l2, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
68972
66960
  for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
@@ -69053,7 +67041,7 @@ function requireJs$n() {
69053
67041
  break;
69054
67042
  case "GeometryCollection":
69055
67043
  for (j = 0; j < geometry2.geometries.length; j++)
69056
- if (coordEach2(geometry2.geometries[j], callback, excludeWrapCoord) === false)
67044
+ if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
69057
67045
  return false;
69058
67046
  break;
69059
67047
  default:
@@ -69064,7 +67052,7 @@ function requireJs$n() {
69064
67052
  }
69065
67053
  function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
69066
67054
  var previousValue = initialValue;
69067
- coordEach2(
67055
+ coordEach(
69068
67056
  geojson,
69069
67057
  function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
69070
67058
  if (coordIndex === 0 && initialValue === void 0)
@@ -69106,7 +67094,7 @@ function requireJs$n() {
69106
67094
  });
69107
67095
  return previousValue;
69108
67096
  }
69109
- function featureEach2(geojson, callback) {
67097
+ function featureEach(geojson, callback) {
69110
67098
  if (geojson.type === "Feature") {
69111
67099
  callback(geojson, 0);
69112
67100
  } else if (geojson.type === "FeatureCollection") {
@@ -69117,7 +67105,7 @@ function requireJs$n() {
69117
67105
  }
69118
67106
  function featureReduce(geojson, callback, initialValue) {
69119
67107
  var previousValue = initialValue;
69120
- featureEach2(geojson, function(currentFeature, featureIndex) {
67108
+ featureEach(geojson, function(currentFeature, featureIndex) {
69121
67109
  if (featureIndex === 0 && initialValue === void 0)
69122
67110
  previousValue = currentFeature;
69123
67111
  else previousValue = callback(previousValue, currentFeature, featureIndex);
@@ -69126,7 +67114,7 @@ function requireJs$n() {
69126
67114
  }
69127
67115
  function coordAll(geojson) {
69128
67116
  var coords = [];
69129
- coordEach2(geojson, function(coord) {
67117
+ coordEach(geojson, function(coord) {
69130
67118
  coords.push(coord);
69131
67119
  });
69132
67120
  return coords;
@@ -69211,7 +67199,7 @@ function requireJs$n() {
69211
67199
  return previousValue;
69212
67200
  }
69213
67201
  function flattenEach2(geojson, callback) {
69214
- geomEach2(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
67202
+ geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
69215
67203
  var type = geometry2 === null ? null : geometry2.type;
69216
67204
  switch (type) {
69217
67205
  case null:
@@ -69219,7 +67207,7 @@ function requireJs$n() {
69219
67207
  case "LineString":
69220
67208
  case "Polygon":
69221
67209
  if (callback(
69222
- helpers.feature(geometry2, properties, { bbox: bbox2, id }),
67210
+ helpers.feature(geometry2, properties, { bbox, id }),
69223
67211
  featureIndex,
69224
67212
  0
69225
67213
  ) === false)
@@ -69267,7 +67255,7 @@ function requireJs$n() {
69267
67255
  );
69268
67256
  return previousValue;
69269
67257
  }
69270
- function segmentEach2(geojson, callback) {
67258
+ function segmentEach(geojson, callback) {
69271
67259
  flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
69272
67260
  var segmentIndex = 0;
69273
67261
  if (!feature2.geometry) return;
@@ -69277,7 +67265,7 @@ function requireJs$n() {
69277
67265
  var previousFeatureIndex = 0;
69278
67266
  var previousMultiIndex = 0;
69279
67267
  var prevGeomIndex = 0;
69280
- if (coordEach2(
67268
+ if (coordEach(
69281
67269
  feature2,
69282
67270
  function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
69283
67271
  if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
@@ -69310,7 +67298,7 @@ function requireJs$n() {
69310
67298
  function segmentReduce(geojson, callback, initialValue) {
69311
67299
  var previousValue = initialValue;
69312
67300
  var started = false;
69313
- segmentEach2(
67301
+ segmentEach(
69314
67302
  geojson,
69315
67303
  function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
69316
67304
  if (started === false && initialValue === void 0)
@@ -69532,9 +67520,9 @@ function requireJs$n() {
69532
67520
  throw new Error("geojson is invalid");
69533
67521
  }
69534
67522
  js$k.coordAll = coordAll;
69535
- js$k.coordEach = coordEach2;
67523
+ js$k.coordEach = coordEach;
69536
67524
  js$k.coordReduce = coordReduce;
69537
- js$k.featureEach = featureEach2;
67525
+ js$k.featureEach = featureEach;
69538
67526
  js$k.featureReduce = featureReduce;
69539
67527
  js$k.findPoint = findPoint;
69540
67528
  js$k.findSegment = findSegment;
@@ -69546,7 +67534,7 @@ function requireJs$n() {
69546
67534
  js$k.lineReduce = lineReduce;
69547
67535
  js$k.propEach = propEach;
69548
67536
  js$k.propReduce = propReduce;
69549
- js$k.segmentEach = segmentEach2;
67537
+ js$k.segmentEach = segmentEach;
69550
67538
  js$k.segmentReduce = segmentReduce;
69551
67539
  return js$k;
69552
67540
  }
@@ -69556,7 +67544,7 @@ function requireJs$m() {
69556
67544
  hasRequiredJs$m = 1;
69557
67545
  Object.defineProperty(js$l, "__esModule", { value: true });
69558
67546
  var meta_1 = /* @__PURE__ */ requireJs$n();
69559
- function bbox2(geojson) {
67547
+ function bbox(geojson) {
69560
67548
  var result = [Infinity, Infinity, -Infinity, -Infinity];
69561
67549
  meta_1.coordEach(geojson, function(coord) {
69562
67550
  if (result[0] > coord[0]) {
@@ -69574,8 +67562,8 @@ function requireJs$m() {
69574
67562
  });
69575
67563
  return result;
69576
67564
  }
69577
- bbox2["default"] = bbox2;
69578
- js$l.default = bbox2;
67565
+ bbox["default"] = bbox;
67566
+ js$l.default = bbox;
69579
67567
  return js$l;
69580
67568
  }
69581
67569
  var hasRequiredJs$l;
@@ -79806,7 +77794,7 @@ function length$1(object2) {
79806
77794
  return +lengthSum$1;
79807
77795
  }
79808
77796
  var coordinates = [null, null], object = { type: "LineString", coordinates };
79809
- function distance(a2, b) {
77797
+ function distance$1(a2, b) {
79810
77798
  coordinates[0] = a2;
79811
77799
  coordinates[1] = b;
79812
77800
  return length$1(object);
@@ -79859,10 +77847,10 @@ function containsGeometry(geometry2, point2) {
79859
77847
  return geometry2 && containsGeometryType.hasOwnProperty(geometry2.type) ? containsGeometryType[geometry2.type](geometry2, point2) : false;
79860
77848
  }
79861
77849
  function containsPoint(coordinates2, point2) {
79862
- return distance(coordinates2, point2) === 0;
77850
+ return distance$1(coordinates2, point2) === 0;
79863
77851
  }
79864
77852
  function containsLine(coordinates2, point2) {
79865
- var ab = distance(coordinates2[0], coordinates2[1]), ao = distance(coordinates2[0], point2), ob = distance(point2, coordinates2[1]);
77853
+ var ab = distance$1(coordinates2[0], coordinates2[1]), ao = distance$1(coordinates2[0], point2), ob = distance$1(point2, coordinates2[1]);
79866
77854
  return ao + ob <= ab + epsilon;
79867
77855
  }
79868
77856
  function containsPolygon(coordinates2, point2) {
@@ -81079,7 +79067,7 @@ const d3Geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
81079
79067
  geoConicEquidistant: conicEquidistant,
81080
79068
  geoConicEquidistantRaw: conicEquidistantRaw,
81081
79069
  geoContains: contains,
81082
- geoDistance: distance,
79070
+ geoDistance: distance$1,
81083
79071
  geoEquirectangular: equirectangular,
81084
79072
  geoEquirectangularRaw: equirectangularRaw,
81085
79073
  geoGnomonic: gnomonic,
@@ -81779,8 +79767,8 @@ function requirePolygonClipping_umd() {
81779
79767
  sort(keys, values2, left, j, compare2);
81780
79768
  sort(keys, values2, j + 1, right, compare2);
81781
79769
  }
81782
- var isInBbox2 = function isInBbox3(bbox2, point2) {
81783
- return bbox2.ll.x <= point2.x && point2.x <= bbox2.ur.x && bbox2.ll.y <= point2.y && point2.y <= bbox2.ur.y;
79770
+ var isInBbox2 = function isInBbox3(bbox, point2) {
79771
+ return bbox.ll.x <= point2.x && point2.x <= bbox.ur.x && bbox.ll.y <= point2.y && point2.y <= bbox.ur.y;
81784
79772
  };
81785
79773
  var getBboxOverlap2 = function getBboxOverlap3(b1, b2) {
81786
79774
  if (b2.ur.x < b1.ll.x || b1.ur.x < b2.ll.x || b2.ur.y < b1.ll.y || b1.ur.y < b2.ll.y) return null;
@@ -82160,7 +80148,7 @@ function requirePolygonClipping_umd() {
82160
80148
  }
82161
80149
  }, {
82162
80150
  key: "bbox",
82163
- value: function bbox2() {
80151
+ value: function bbox() {
82164
80152
  var y12 = this.leftSE.point.y;
82165
80153
  var y2 = this.rightSE.point.y;
82166
80154
  return {
@@ -83097,7 +81085,7 @@ function requireJs$j() {
83097
81085
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
83098
81086
  }
83099
81087
  js$i.getCoord = getCoord2;
83100
- function getCoords2(coords) {
81088
+ function getCoords(coords) {
83101
81089
  if (Array.isArray(coords)) {
83102
81090
  return coords;
83103
81091
  }
@@ -83112,7 +81100,7 @@ function requireJs$j() {
83112
81100
  }
83113
81101
  throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
83114
81102
  }
83115
- js$i.getCoords = getCoords2;
81103
+ js$i.getCoords = getCoords;
83116
81104
  function containsNumber(coordinates2) {
83117
81105
  if (coordinates2.length > 1 && helpers_1.isNumber(coordinates2[0]) && helpers_1.isNumber(coordinates2[1])) {
83118
81106
  return true;
@@ -83242,7 +81230,7 @@ function requireCjs$c() {
83242
81230
  }
83243
81231
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
83244
81232
  }
83245
- function getCoords2(coords) {
81233
+ function getCoords(coords) {
83246
81234
  if (Array.isArray(coords)) {
83247
81235
  return coords;
83248
81236
  }
@@ -83344,7 +81332,7 @@ function requireCjs$c() {
83344
81332
  cjs$b.featureOf = featureOf;
83345
81333
  cjs$b.geojsonType = geojsonType;
83346
81334
  cjs$b.getCoord = getCoord2;
83347
- cjs$b.getCoords = getCoords2;
81335
+ cjs$b.getCoords = getCoords;
83348
81336
  cjs$b.getGeom = getGeom2;
83349
81337
  cjs$b.getType = getType;
83350
81338
  return cjs$b;
@@ -83817,7 +81805,7 @@ function requireFeature() {
83817
81805
  }
83818
81806
  _createClass(Feature2, [{
83819
81807
  key: "getCoords",
83820
- value: function getCoords2() {
81808
+ value: function getCoords() {
83821
81809
  return this.geoJson.geometry.coordinates;
83822
81810
  }
83823
81811
  }]);
@@ -85998,7 +83986,7 @@ function requireCjs$a() {
85998
83986
  var __defProp2 = Object.defineProperty;
85999
83987
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
86000
83988
  var __getOwnPropNames = Object.getOwnPropertyNames;
86001
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
83989
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
86002
83990
  var __export = (target, all) => {
86003
83991
  for (var name2 in all)
86004
83992
  __defProp2(target, name2, { get: all[name2], enumerable: true });
@@ -86006,7 +83994,7 @@ function requireCjs$a() {
86006
83994
  var __copyProps = (to, from, except, desc) => {
86007
83995
  if (from && typeof from === "object" || typeof from === "function") {
86008
83996
  for (let key of __getOwnPropNames(from))
86009
- if (!__hasOwnProp2.call(to, key) && key !== except)
83997
+ if (!__hasOwnProp.call(to, key) && key !== except)
86010
83998
  __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
86011
83999
  }
86012
84000
  return to;
@@ -86712,7 +84700,7 @@ function requireCjs$9() {
86712
84700
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
86713
84701
  var __getOwnPropNames = Object.getOwnPropertyNames;
86714
84702
  var __getProtoOf = Object.getPrototypeOf;
86715
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
84703
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
86716
84704
  var __export = (target, all) => {
86717
84705
  for (var name2 in all)
86718
84706
  __defProp2(target, name2, { get: all[name2], enumerable: true });
@@ -86720,7 +84708,7 @@ function requireCjs$9() {
86720
84708
  var __copyProps = (to, from, except, desc) => {
86721
84709
  if (from && typeof from === "object" || typeof from === "function") {
86722
84710
  for (let key of __getOwnPropNames(from))
86723
- if (!__hasOwnProp2.call(to, key) && key !== except)
84711
+ if (!__hasOwnProp.call(to, key) && key !== except)
86724
84712
  __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
86725
84713
  }
86726
84714
  return to;
@@ -86802,8 +84790,8 @@ function requireCjs$9() {
86802
84790
  };
86803
84791
  };
86804
84792
  var precision2 = set2();
86805
- var isInBbox2 = (bbox2, point2) => {
86806
- return bbox2.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox2.ur.x) && bbox2.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox2.ur.y);
84793
+ var isInBbox2 = (bbox, point2) => {
84794
+ return bbox.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox.ur.x) && bbox.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox.ur.y);
86807
84795
  };
86808
84796
  var getBboxOverlap2 = (b1, b2) => {
86809
84797
  if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))
@@ -88378,7 +86366,7 @@ function requireUtils$2() {
88378
86366
  utils$2.distance2d = distance2d;
88379
86367
  utils$2.mix = mix;
88380
86368
  utils$2.nearestPointOnProjectedLine = nearestPointOnProjectedLine;
88381
- utils$2.nearestPointOnLine = nearestPointOnLine2;
86369
+ utils$2.nearestPointOnLine = nearestPointOnLine;
88382
86370
  utils$2.getPickedEditHandle = getPickedEditHandle;
88383
86371
  utils$2.getPickedSnapSourceEditHandle = getPickedSnapSourceEditHandle;
88384
86372
  utils$2.getNonGuidePicks = getNonGuidePicks;
@@ -88475,12 +86463,12 @@ function requireUtils$2() {
88475
86463
  return false;
88476
86464
  }
88477
86465
  function generatePointsParallelToLinePoints(p1, p2, mapCoords) {
88478
- var lineString2 = {
86466
+ var lineString = {
88479
86467
  type: "LineString",
88480
86468
  coordinates: [p1, p2]
88481
86469
  };
88482
86470
  var pt = (0, _helpers.point)(mapCoords);
88483
- var ddistance = (0, _pointToLineDistance["default"])(pt, lineString2);
86471
+ var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
88484
86472
  var lineBearing = (0, _bearing["default"])(p1, p2);
88485
86473
  var isPointToLeftOfLine = (mapCoords[0] - p1[0]) * (p2[1] - p1[1]) - (mapCoords[1] - p1[1]) * (p2[0] - p1[0]);
88486
86474
  var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
@@ -88546,7 +86534,7 @@ function requireUtils$2() {
88546
86534
  }
88547
86535
  };
88548
86536
  }
88549
- function nearestPointOnLine2(lines, inPoint, viewport) {
86537
+ function nearestPointOnLine(lines, inPoint, viewport) {
88550
86538
  var _lines$geometry, _lines$geometry2;
88551
86539
  var mercator2;
88552
86540
  if (viewport) {
@@ -89066,8 +87054,8 @@ function requireImmutableFeatureCollection() {
89066
87054
  }
89067
87055
  function pruneMultiLineStringIfNecessary(geometry2) {
89068
87056
  for (var lineStringIndex = 0; lineStringIndex < geometry2.coordinates.length; lineStringIndex++) {
89069
- var lineString2 = geometry2.coordinates[lineStringIndex];
89070
- if (lineString2.length === 1) {
87057
+ var lineString = geometry2.coordinates[lineStringIndex];
87058
+ if (lineString.length === 1) {
89071
87059
  geometry2.coordinates.splice(lineStringIndex, 1);
89072
87060
  lineStringIndex--;
89073
87061
  }
@@ -89656,8 +87644,8 @@ function requireModifyMode() {
89656
87644
  var intermediatePoint = null;
89657
87645
  var positionIndexPrefix = [];
89658
87646
  var referencePoint = (0, _helpers.point)(mapCoords);
89659
- (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString2, prefix) {
89660
- var lineStringFeature = (0, _helpers.lineString)(lineString2);
87647
+ (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
87648
+ var lineStringFeature = (0, _helpers.lineString)(lineString);
89661
87649
  var candidateIntermediatePoint = _this.getNearestPoint(
89662
87650
  // @ts-ignore
89663
87651
  lineStringFeature,
@@ -89833,29 +87821,29 @@ function requireCjs$6() {
89833
87821
  hasRequiredCjs$6 = 1;
89834
87822
  Object.defineProperty(cjs$6, "__esModule", { value: true });
89835
87823
  var __defProp2 = Object.defineProperty;
89836
- var __defProps2 = Object.defineProperties;
89837
- var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
89838
- var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
89839
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
89840
- var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
87824
+ var __defProps = Object.defineProperties;
87825
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
87826
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
87827
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
87828
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
89841
87829
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
89842
- var __spreadValues2 = (a2, b) => {
87830
+ var __spreadValues = (a2, b) => {
89843
87831
  for (var prop in b || (b = {}))
89844
- if (__hasOwnProp2.call(b, prop))
87832
+ if (__hasOwnProp.call(b, prop))
89845
87833
  __defNormalProp2(a2, prop, b[prop]);
89846
- if (__getOwnPropSymbols2)
89847
- for (var prop of __getOwnPropSymbols2(b)) {
89848
- if (__propIsEnum2.call(b, prop))
87834
+ if (__getOwnPropSymbols)
87835
+ for (var prop of __getOwnPropSymbols(b)) {
87836
+ if (__propIsEnum.call(b, prop))
89849
87837
  __defNormalProp2(a2, prop, b[prop]);
89850
87838
  }
89851
87839
  return a2;
89852
87840
  };
89853
- var __spreadProps2 = (a2, b) => __defProps2(a2, __getOwnPropDescs2(b));
87841
+ var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
89854
87842
  var _distance = /* @__PURE__ */ requireCjs$b();
89855
87843
  var _meta = /* @__PURE__ */ requireCjs$e();
89856
87844
  var _helpers = /* @__PURE__ */ requireCjs$f();
89857
87845
  var _invariant = /* @__PURE__ */ requireCjs$c();
89858
- function nearestPointOnLine2(lines, pt, options = {}) {
87846
+ function nearestPointOnLine(lines, pt, options = {}) {
89859
87847
  if (!lines || !pt) {
89860
87848
  throw new Error("lines and pt are required arguments");
89861
87849
  }
@@ -89887,7 +87875,7 @@ function requireCjs$6() {
89887
87875
  } else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
89888
87876
  [intersectPos, , wasEnd] = [stopPos, void 0, true];
89889
87877
  } else {
89890
- [intersectPos, , wasEnd] = nearestPointOnSegment2(
87878
+ [intersectPos, , wasEnd] = nearestPointOnSegment(
89891
87879
  start.geometry.coordinates,
89892
87880
  stop.geometry.coordinates,
89893
87881
  _invariant.getCoord.call(void 0, pt)
@@ -89902,8 +87890,8 @@ function requireCjs$6() {
89902
87890
  });
89903
87891
  }
89904
87892
  if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
89905
- closestPt = __spreadProps2(__spreadValues2({}, intersectPt), {
89906
- properties: __spreadProps2(__spreadValues2({}, intersectPt.properties), {
87893
+ closestPt = __spreadProps(__spreadValues({}, intersectPt), {
87894
+ properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
89907
87895
  // Legacy behaviour where index progresses to next segment # if we
89908
87896
  // went with the end point this iteration.
89909
87897
  index: wasEnd ? i2 + 1 : i2
@@ -89926,14 +87914,14 @@ function requireCjs$6() {
89926
87914
  const [v2x, v2y, v2z] = v2;
89927
87915
  return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
89928
87916
  }
89929
- function magnitude2(v) {
87917
+ function magnitude(v) {
89930
87918
  return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
89931
87919
  }
89932
87920
  function angle2(v12, v2) {
89933
- const theta = dot2(v12, v2) / (magnitude2(v12) * magnitude2(v2));
87921
+ const theta = dot2(v12, v2) / (magnitude(v12) * magnitude(v2));
89934
87922
  return Math.acos(Math.min(Math.max(theta, -1), 1));
89935
87923
  }
89936
- function lngLatToVector2(a2) {
87924
+ function lngLatToVector(a2) {
89937
87925
  const lat = _helpers.degreesToRadians.call(void 0, a2[1]);
89938
87926
  const lng = _helpers.degreesToRadians.call(void 0, a2[0]);
89939
87927
  return [
@@ -89942,16 +87930,16 @@ function requireCjs$6() {
89942
87930
  Math.sin(lat)
89943
87931
  ];
89944
87932
  }
89945
- function vectorToLngLat2(v) {
87933
+ function vectorToLngLat(v) {
89946
87934
  const [x, y, z] = v;
89947
87935
  const lat = _helpers.radiansToDegrees.call(void 0, Math.asin(z));
89948
87936
  const lng = _helpers.radiansToDegrees.call(void 0, Math.atan2(y, x));
89949
87937
  return [lng, lat];
89950
87938
  }
89951
- function nearestPointOnSegment2(posA, posB, posC) {
89952
- const A2 = lngLatToVector2(posA);
89953
- const B2 = lngLatToVector2(posB);
89954
- const C3 = lngLatToVector2(posC);
87939
+ function nearestPointOnSegment(posA, posB, posC) {
87940
+ const A2 = lngLatToVector(posA);
87941
+ const B2 = lngLatToVector(posB);
87942
+ const C3 = lngLatToVector(posC);
89955
87943
  const [Cx, Cy, Cz] = C3;
89956
87944
  const [D2, E2, F] = cross2(A2, B2);
89957
87945
  const a2 = E2 * Cz - F * Cy;
@@ -89975,17 +87963,17 @@ function requireCjs$6() {
89975
87963
  I3 = I2;
89976
87964
  }
89977
87965
  if (angle2(A2, I3) > angleAB || angle2(B2, I3) > angleAB) {
89978
- if (_distance.distance.call(void 0, vectorToLngLat2(I3), vectorToLngLat2(A2)) <= _distance.distance.call(void 0, vectorToLngLat2(I3), vectorToLngLat2(B2))) {
89979
- return [vectorToLngLat2(A2), true, false];
87966
+ if (_distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(A2)) <= _distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(B2))) {
87967
+ return [vectorToLngLat(A2), true, false];
89980
87968
  } else {
89981
- return [vectorToLngLat2(B2), false, true];
87969
+ return [vectorToLngLat(B2), false, true];
89982
87970
  }
89983
87971
  }
89984
- return [vectorToLngLat2(I3), false, false];
87972
+ return [vectorToLngLat(I3), false, false];
89985
87973
  }
89986
- var turf_nearest_point_on_line_default = nearestPointOnLine2;
87974
+ var turf_nearest_point_on_line_default = nearestPointOnLine;
89987
87975
  cjs$6.default = turf_nearest_point_on_line_default;
89988
- cjs$6.nearestPointOnLine = nearestPointOnLine2;
87976
+ cjs$6.nearestPointOnLine = nearestPointOnLine;
89989
87977
  return cjs$6;
89990
87978
  }
89991
87979
  var cjs$5 = {};
@@ -90185,8 +88173,8 @@ function requireResizeCircleMode() {
90185
88173
  var intermediatePoint = null;
90186
88174
  var positionIndexPrefix = [];
90187
88175
  var referencePoint = (0, _helpers.point)(mapCoords);
90188
- (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString2, prefix) {
90189
- var lineStringFeature = (0, _helpers.lineString)(lineString2);
88176
+ (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
88177
+ var lineStringFeature = (0, _helpers.lineString)(lineString);
90190
88178
  var candidateIntermediatePoint = _this2.getNearestPoint(
90191
88179
  // @ts-ignore
90192
88180
  lineStringFeature,
@@ -90824,11 +88812,11 @@ function requireJs$4() {
90824
88812
  if (origin === void 0 || origin === null) origin = "centroid";
90825
88813
  if (Array.isArray(origin) || typeof origin === "object")
90826
88814
  return invariant.getCoord(origin);
90827
- var bbox2 = geojson.bbox ? geojson.bbox : turfBBox__default["default"](geojson);
90828
- var west = bbox2[0];
90829
- var south = bbox2[1];
90830
- var east = bbox2[2];
90831
- var north = bbox2[3];
88815
+ var bbox = geojson.bbox ? geojson.bbox : turfBBox__default["default"](geojson);
88816
+ var west = bbox[0];
88817
+ var south = bbox[1];
88818
+ var east = bbox[2];
88819
+ var north = bbox[3];
90832
88820
  switch (origin) {
90833
88821
  case "sw":
90834
88822
  case "southwest":
@@ -92184,9 +90172,9 @@ function requireCjs$2() {
92184
90172
  const pt = _invariant.getCoord.call(void 0, point2);
92185
90173
  const geom = _invariant.getGeom.call(void 0, polygon2);
92186
90174
  const type = geom.type;
92187
- const bbox2 = polygon2.bbox;
90175
+ const bbox = polygon2.bbox;
92188
90176
  let polys = geom.coordinates;
92189
- if (bbox2 && inBBox2(pt, bbox2) === false) {
90177
+ if (bbox && inBBox2(pt, bbox) === false) {
92190
90178
  return false;
92191
90179
  }
92192
90180
  if (type === "Polygon") {
@@ -92200,8 +90188,8 @@ function requireCjs$2() {
92200
90188
  }
92201
90189
  return result;
92202
90190
  }
92203
- function inBBox2(pt, bbox2) {
92204
- return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
90191
+ function inBBox2(pt, bbox) {
90192
+ return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
92205
90193
  }
92206
90194
  var turf_boolean_point_in_polygon_default = booleanPointInPolygon2;
92207
90195
  cjs$3.booleanPointInPolygon = booleanPointInPolygon2;
@@ -92209,6 +90197,206 @@ function requireCjs$2() {
92209
90197
  return cjs$3;
92210
90198
  }
92211
90199
  var cjs$1 = {};
90200
+ class TinyQueue {
90201
+ constructor(data = [], compare2 = defaultCompare$1) {
90202
+ this.data = data;
90203
+ this.length = this.data.length;
90204
+ this.compare = compare2;
90205
+ if (this.length > 0) {
90206
+ for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
90207
+ }
90208
+ }
90209
+ push(item) {
90210
+ this.data.push(item);
90211
+ this.length++;
90212
+ this._up(this.length - 1);
90213
+ }
90214
+ pop() {
90215
+ if (this.length === 0) return void 0;
90216
+ const top = this.data[0];
90217
+ const bottom = this.data.pop();
90218
+ this.length--;
90219
+ if (this.length > 0) {
90220
+ this.data[0] = bottom;
90221
+ this._down(0);
90222
+ }
90223
+ return top;
90224
+ }
90225
+ peek() {
90226
+ return this.data[0];
90227
+ }
90228
+ _up(pos) {
90229
+ const { data, compare: compare2 } = this;
90230
+ const item = data[pos];
90231
+ while (pos > 0) {
90232
+ const parent = pos - 1 >> 1;
90233
+ const current = data[parent];
90234
+ if (compare2(item, current) >= 0) break;
90235
+ data[pos] = current;
90236
+ pos = parent;
90237
+ }
90238
+ data[pos] = item;
90239
+ }
90240
+ _down(pos) {
90241
+ const { data, compare: compare2 } = this;
90242
+ const halfLength = this.length >> 1;
90243
+ const item = data[pos];
90244
+ while (pos < halfLength) {
90245
+ let left = (pos << 1) + 1;
90246
+ let best = data[left];
90247
+ const right = left + 1;
90248
+ if (right < this.length && compare2(data[right], best) < 0) {
90249
+ left = right;
90250
+ best = data[right];
90251
+ }
90252
+ if (compare2(best, item) >= 0) break;
90253
+ data[pos] = best;
90254
+ pos = left;
90255
+ }
90256
+ data[pos] = item;
90257
+ }
90258
+ }
90259
+ function defaultCompare$1(a2, b) {
90260
+ return a2 < b ? -1 : a2 > b ? 1 : 0;
90261
+ }
90262
+ function checkWhichEventIsLeft(e1, e2) {
90263
+ if (e1.p.x > e2.p.x) return 1;
90264
+ if (e1.p.x < e2.p.x) return -1;
90265
+ if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
90266
+ return 1;
90267
+ }
90268
+ function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
90269
+ if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
90270
+ if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
90271
+ if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
90272
+ return 1;
90273
+ }
90274
+ class Event {
90275
+ constructor(p, featureId2, ringId2, eventId2) {
90276
+ this.p = {
90277
+ x: p[0],
90278
+ y: p[1]
90279
+ };
90280
+ this.featureId = featureId2;
90281
+ this.ringId = ringId2;
90282
+ this.eventId = eventId2;
90283
+ this.otherEvent = null;
90284
+ this.isLeftEndpoint = null;
90285
+ }
90286
+ isSamePoint(eventToCheck) {
90287
+ return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
90288
+ }
90289
+ }
90290
+ function fillEventQueue(geojson, eventQueue) {
90291
+ if (geojson.type === "FeatureCollection") {
90292
+ const features = geojson.features;
90293
+ for (let i2 = 0; i2 < features.length; i2++) {
90294
+ processFeature(features[i2], eventQueue);
90295
+ }
90296
+ } else {
90297
+ processFeature(geojson, eventQueue);
90298
+ }
90299
+ }
90300
+ let featureId = 0;
90301
+ let ringId = 0;
90302
+ let eventId = 0;
90303
+ function processFeature(featureOrGeometry, eventQueue) {
90304
+ const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
90305
+ let coords = geom.coordinates;
90306
+ if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
90307
+ if (geom.type === "LineString") coords = [[coords]];
90308
+ for (let i2 = 0; i2 < coords.length; i2++) {
90309
+ for (let ii = 0; ii < coords[i2].length; ii++) {
90310
+ let currentP = coords[i2][ii][0];
90311
+ let nextP = null;
90312
+ ringId = ringId + 1;
90313
+ for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
90314
+ nextP = coords[i2][ii][iii + 1];
90315
+ const e1 = new Event(currentP, featureId, ringId, eventId);
90316
+ const e2 = new Event(nextP, featureId, ringId, eventId + 1);
90317
+ e1.otherEvent = e2;
90318
+ e2.otherEvent = e1;
90319
+ if (checkWhichEventIsLeft(e1, e2) > 0) {
90320
+ e2.isLeftEndpoint = true;
90321
+ e1.isLeftEndpoint = false;
90322
+ } else {
90323
+ e1.isLeftEndpoint = true;
90324
+ e2.isLeftEndpoint = false;
90325
+ }
90326
+ eventQueue.push(e1);
90327
+ eventQueue.push(e2);
90328
+ currentP = nextP;
90329
+ eventId = eventId + 1;
90330
+ }
90331
+ }
90332
+ }
90333
+ featureId = featureId + 1;
90334
+ }
90335
+ let Segment$1 = class Segment {
90336
+ constructor(event) {
90337
+ this.leftSweepEvent = event;
90338
+ this.rightSweepEvent = event.otherEvent;
90339
+ }
90340
+ };
90341
+ function testSegmentIntersect(seg1, seg2) {
90342
+ if (seg1 === null || seg2 === null) return false;
90343
+ if (seg1.leftSweepEvent.ringId === seg2.leftSweepEvent.ringId && (seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.rightSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.rightSweepEvent))) return false;
90344
+ const x12 = seg1.leftSweepEvent.p.x;
90345
+ const y12 = seg1.leftSweepEvent.p.y;
90346
+ const x2 = seg1.rightSweepEvent.p.x;
90347
+ const y2 = seg1.rightSweepEvent.p.y;
90348
+ const x3 = seg2.leftSweepEvent.p.x;
90349
+ const y3 = seg2.leftSweepEvent.p.y;
90350
+ const x4 = seg2.rightSweepEvent.p.x;
90351
+ const y4 = seg2.rightSweepEvent.p.y;
90352
+ const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
90353
+ const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
90354
+ const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
90355
+ if (denom === 0) {
90356
+ if (numeA === 0 && numeB === 0) return false;
90357
+ return false;
90358
+ }
90359
+ const uA = numeA / denom;
90360
+ const uB = numeB / denom;
90361
+ if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
90362
+ const x = x12 + uA * (x2 - x12);
90363
+ const y = y12 + uA * (y2 - y12);
90364
+ return [x, y];
90365
+ }
90366
+ return false;
90367
+ }
90368
+ function runCheck(eventQueue, ignoreSelfIntersections) {
90369
+ ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
90370
+ const intersectionPoints = [];
90371
+ const outQueue = new TinyQueue([], checkWhichSegmentHasRightEndpointFirst);
90372
+ while (eventQueue.length) {
90373
+ const event = eventQueue.pop();
90374
+ if (event.isLeftEndpoint) {
90375
+ const segment = new Segment$1(event);
90376
+ for (let i2 = 0; i2 < outQueue.data.length; i2++) {
90377
+ const otherSeg = outQueue.data[i2];
90378
+ if (ignoreSelfIntersections) {
90379
+ if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
90380
+ }
90381
+ const intersection2 = testSegmentIntersect(segment, otherSeg);
90382
+ if (intersection2 !== false) intersectionPoints.push(intersection2);
90383
+ }
90384
+ outQueue.push(segment);
90385
+ } else if (event.isLeftEndpoint === false) {
90386
+ outQueue.pop();
90387
+ }
90388
+ }
90389
+ return intersectionPoints;
90390
+ }
90391
+ function sweeplineIntersections(geojson, ignoreSelfIntersections) {
90392
+ const eventQueue = new TinyQueue([], checkWhichEventIsLeft);
90393
+ fillEventQueue(geojson, eventQueue);
90394
+ return runCheck(eventQueue, ignoreSelfIntersections);
90395
+ }
90396
+ const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
90397
+ __proto__: null,
90398
+ default: sweeplineIntersections
90399
+ }, Symbol.toStringTag, { value: "Module" }));
92212
90400
  const require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(sweeplineIntersections_esm);
92213
90401
  var hasRequiredCjs$1;
92214
90402
  function requireCjs$1() {
@@ -92222,7 +90410,7 @@ function requireCjs$1() {
92222
90410
  var _sweeplineintersections = require$$1$1;
92223
90411
  var _sweeplineintersections2 = _interopRequireDefault(_sweeplineintersections);
92224
90412
  var sweeplineIntersections2 = _sweeplineintersections2.default;
92225
- function lineIntersect2(line1, line2, options = {}) {
90413
+ function lineIntersect(line1, line2, options = {}) {
92226
90414
  const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
92227
90415
  let features = [];
92228
90416
  if (line1.type === "FeatureCollection")
@@ -92256,9 +90444,9 @@ function requireCjs$1() {
92256
90444
  }
92257
90445
  return _helpers.featureCollection.call(void 0, results.map((r2) => _helpers.point.call(void 0, r2)));
92258
90446
  }
92259
- var turf_line_intersect_default = lineIntersect2;
90447
+ var turf_line_intersect_default = lineIntersect;
92260
90448
  cjs$1.default = turf_line_intersect_default;
92261
- cjs$1.lineIntersect = lineIntersect2;
90449
+ cjs$1.lineIntersect = lineIntersect;
92262
90450
  return cjs$1;
92263
90451
  }
92264
90452
  var hasRequiredSplitPolygonMode;
@@ -96122,8 +94310,8 @@ function requireDraw90degreePolygonMode() {
96122
94310
  return;
96123
94311
  }
96124
94312
  if (clickSequence.length === 3 && tentativeFeature.geometry.type === "LineString") {
96125
- var lineString2 = tentativeFeature.geometry;
96126
- clickSequence[clickSequence.length - 1] = lineString2.coordinates[lineString2.coordinates.length - 1];
94313
+ var lineString = tentativeFeature.geometry;
94314
+ clickSequence[clickSequence.length - 1] = lineString.coordinates[lineString.coordinates.length - 1];
96127
94315
  } else if (clickSequence.length > 3 && tentativeFeature.geometry.type === "Polygon") {
96128
94316
  var polygon2 = tentativeFeature.geometry;
96129
94317
  clickSequence[clickSequence.length - 1] = polygon2.coordinates[0][polygon2.coordinates[0].length - 2];
@@ -102030,12 +100218,12 @@ function requireUtils$1() {
102030
100218
  return false;
102031
100219
  }
102032
100220
  function generatePointsParallelToLinePoints(p1, p2, groundCoords) {
102033
- var lineString2 = {
100221
+ var lineString = {
102034
100222
  type: "LineString",
102035
100223
  coordinates: [p1, p2]
102036
100224
  };
102037
100225
  var pt = (0, _helpers.point)(groundCoords);
102038
- var ddistance = (0, _pointToLineDistance["default"])(pt, lineString2);
100226
+ var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
102039
100227
  var lineBearing = (0, _bearing["default"])(p1, p2);
102040
100228
  var isPointToLeftOfLine = (groundCoords[0] - p1[0]) * (p2[1] - p1[1]) - (groundCoords[1] - p1[1]) * (p2[0] - p1[0]);
102041
100229
  var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
@@ -103707,6 +101895,16 @@ class SelectionLayer extends CompositeLayer {
103707
101895
  } = this.props;
103708
101896
  const flippedCoordinates = flipY ? coordinates2.map((poly) => poly.map((p) => [p[0], -p[1]])) : coordinates2;
103709
101897
  const selectedPolygon = polygon(flippedCoordinates);
101898
+ let minX = Infinity;
101899
+ let minY = Infinity;
101900
+ let maxX = -Infinity;
101901
+ let maxY = -Infinity;
101902
+ flippedCoordinates[0].forEach(([x, y]) => {
101903
+ minX = Math.min(minX, x);
101904
+ minY = Math.min(minY, y);
101905
+ maxX = Math.max(maxX, x);
101906
+ maxY = Math.max(maxY, y);
101907
+ });
103710
101908
  obsLayers.forEach((obsLayer) => {
103711
101909
  const {
103712
101910
  getObsCoords,
@@ -103714,29 +101912,23 @@ class SelectionLayer extends CompositeLayer {
103714
101912
  obsIndex,
103715
101913
  onSelect: layerOnSelect
103716
101914
  } = obsLayer;
103717
- const pickingInfos = [];
101915
+ const pickingIds = [];
103718
101916
  obsQuadTree?.visit((node, x02, y02, x12, y12) => {
103719
- const nodePoints = [[[x02, y02], [x12, y02], [x12, y12], [x02, y12], [x02, y02]]];
103720
- const nodePolygon = polygon(nodePoints);
103721
- const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
103722
- const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
103723
- const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
103724
- if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
101917
+ if (x02 > maxX || y02 > maxY || x12 < minX || y12 < minY) {
103725
101918
  return true;
103726
101919
  }
103727
- if (node.data) {
101920
+ if (!node.length) {
103728
101921
  let current = node;
103729
101922
  while (current) {
103730
- const pointCoords = [].slice.call(getObsCoords(current.data));
103731
- if (booleanPointInPolygon(point(pointCoords), selectedPolygon)) {
103732
- pickingInfos.push(current.data);
101923
+ const [x, y] = getObsCoords(current.data);
101924
+ if (booleanPointInPolygon([x, y], selectedPolygon)) {
101925
+ pickingIds.push(obsIndex[current.data]);
103733
101926
  }
103734
101927
  current = current.next;
103735
101928
  }
103736
101929
  }
103737
101930
  return false;
103738
101931
  });
103739
- const pickingIds = pickingInfos.map((obsI) => obsIndex[obsI]);
103740
101932
  layerOnSelect(pickingIds);
103741
101933
  });
103742
101934
  }
@@ -105713,22 +103905,22 @@ async function getDecoder(fileDirectory) {
105713
103905
  const Decoder = await importFn();
105714
103906
  return new Decoder(fileDirectory);
105715
103907
  }
105716
- addDecoder([void 0, 1], () => import("./raw-B5_2TWMK.js").then((m) => m.default));
105717
- addDecoder(5, () => import("./lzw-BgdxJ7Qg.js").then((m) => m.default));
103908
+ addDecoder([void 0, 1], () => import("./raw-BB1j1uSY.js").then((m) => m.default));
103909
+ addDecoder(5, () => import("./lzw-B-CckV67.js").then((m) => m.default));
105718
103910
  addDecoder(6, () => {
105719
103911
  throw new Error("old style JPEG compression is not supported.");
105720
103912
  });
105721
- addDecoder(7, () => import("./jpeg-CZeZBc_8.js").then((m) => m.default));
105722
- addDecoder([8, 32946], () => import("./deflate-DD4d--xe.js").then((m) => m.default));
105723
- addDecoder(32773, () => import("./packbits-BhOBFsGy.js").then((m) => m.default));
103913
+ addDecoder(7, () => import("./jpeg-ZULLlTJ2.js").then((m) => m.default));
103914
+ addDecoder([8, 32946], () => import("./deflate-D49aNhVq.js").then((m) => m.default));
103915
+ addDecoder(32773, () => import("./packbits-Cm-5L1px.js").then((m) => m.default));
105724
103916
  addDecoder(
105725
103917
  34887,
105726
- () => import("./lerc-Ct7C32yr.js").then(async (m) => {
103918
+ () => import("./lerc-DWKslO-B.js").then(async (m) => {
105727
103919
  await m.zstd.init();
105728
103920
  return m;
105729
103921
  }).then((m) => m.default)
105730
103922
  );
105731
- addDecoder(50001, () => import("./webimage-DcEapRkY.js").then((m) => m.default));
103923
+ addDecoder(50001, () => import("./webimage-DDA2KrlJ.js").then((m) => m.default));
105732
103924
  function copyNewSize(array, width, height, samplesPerPixel = 1) {
105733
103925
  return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
105734
103926
  }
@@ -108163,26 +106355,26 @@ class GeoTIFFBase {
108163
106355
  */
108164
106356
  async readRasters(options = {}) {
108165
106357
  const { window: imageWindow, width, height } = options;
108166
- let { resX, resY, bbox: bbox2 } = options;
106358
+ let { resX, resY, bbox } = options;
108167
106359
  const firstImage = await this.getImage();
108168
106360
  let usedImage = firstImage;
108169
106361
  const imageCount = await this.getImageCount();
108170
106362
  const imgBBox = firstImage.getBoundingBox();
108171
- if (imageWindow && bbox2) {
106363
+ if (imageWindow && bbox) {
108172
106364
  throw new Error('Both "bbox" and "window" passed.');
108173
106365
  }
108174
106366
  if (width || height) {
108175
106367
  if (imageWindow) {
108176
106368
  const [oX, oY] = firstImage.getOrigin();
108177
106369
  const [rX, rY] = firstImage.getResolution();
108178
- bbox2 = [
106370
+ bbox = [
108179
106371
  oX + imageWindow[0] * rX,
108180
106372
  oY + imageWindow[1] * rY,
108181
106373
  oX + imageWindow[2] * rX,
108182
106374
  oY + imageWindow[3] * rY
108183
106375
  ];
108184
106376
  }
108185
- const usedBBox = bbox2 || imgBBox;
106377
+ const usedBBox = bbox || imgBBox;
108186
106378
  if (width) {
108187
106379
  if (resX) {
108188
106380
  throw new Error("Both width and resX passed");
@@ -108217,14 +106409,14 @@ class GeoTIFFBase {
108217
106409
  }
108218
106410
  }
108219
106411
  let wnd = imageWindow;
108220
- if (bbox2) {
106412
+ if (bbox) {
108221
106413
  const [oX, oY] = firstImage.getOrigin();
108222
106414
  const [imageResX, imageResY] = usedImage.getResolution(firstImage);
108223
106415
  wnd = [
108224
- Math.round((bbox2[0] - oX) / imageResX),
108225
- Math.round((bbox2[1] - oY) / imageResY),
108226
- Math.round((bbox2[2] - oX) / imageResX),
108227
- Math.round((bbox2[3] - oY) / imageResY)
106416
+ Math.round((bbox[0] - oX) / imageResX),
106417
+ Math.round((bbox[1] - oY) / imageResY),
106418
+ Math.round((bbox[2] - oX) / imageResX),
106419
+ Math.round((bbox[3] - oY) / imageResY)
108228
106420
  ];
108229
106421
  wnd = [
108230
106422
  Math.min(wnd[0], wnd[2]),
@@ -108534,6 +106726,50 @@ async function N(A2, I2) {
108534
106726
  if (0 === g2.length) throw Error("Failed to decode with LZW decoder.");
108535
106727
  return g2;
108536
106728
  }
106729
+ function quickselect(arr, k, left, right, compare2) {
106730
+ quickselectStep(arr, k, left || 0, right || arr.length - 1, defaultCompare);
106731
+ }
106732
+ function quickselectStep(arr, k, left, right, compare2) {
106733
+ while (right > left) {
106734
+ if (right - left > 600) {
106735
+ var n2 = right - left + 1;
106736
+ var m = k - left + 1;
106737
+ var z = Math.log(n2);
106738
+ var s2 = 0.5 * Math.exp(2 * z / 3);
106739
+ var sd = 0.5 * Math.sqrt(z * s2 * (n2 - s2) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
106740
+ var newLeft = Math.max(left, Math.floor(k - m * s2 / n2 + sd));
106741
+ var newRight = Math.min(right, Math.floor(k + (n2 - m) * s2 / n2 + sd));
106742
+ quickselectStep(arr, k, newLeft, newRight, compare2);
106743
+ }
106744
+ var t = arr[k];
106745
+ var i2 = left;
106746
+ var j = right;
106747
+ swap(arr, left, k);
106748
+ if (compare2(arr[right], t) > 0) swap(arr, left, right);
106749
+ while (i2 < j) {
106750
+ swap(arr, i2, j);
106751
+ i2++;
106752
+ j--;
106753
+ while (compare2(arr[i2], t) < 0) i2++;
106754
+ while (compare2(arr[j], t) > 0) j--;
106755
+ }
106756
+ if (compare2(arr[left], t) === 0) swap(arr, left, j);
106757
+ else {
106758
+ j++;
106759
+ swap(arr, j, right);
106760
+ }
106761
+ if (j <= k) left = j + 1;
106762
+ if (k <= j) right = j - 1;
106763
+ }
106764
+ }
106765
+ function swap(arr, i2, j) {
106766
+ var tmp = arr[i2];
106767
+ arr[i2] = arr[j];
106768
+ arr[j] = tmp;
106769
+ }
106770
+ function defaultCompare(a2, b) {
106771
+ return a2 < b ? -1 : a2 > b ? 1 : 0;
106772
+ }
108537
106773
  var util;
108538
106774
  (function(util2) {
108539
106775
  util2.assertEqual = (val) => val;
@@ -120386,17 +118622,17 @@ function sizeToMeters(size, unit) {
120386
118622
  throw new Error("Received unknown unit");
120387
118623
  }
120388
118624
  function snapValue(value) {
120389
- let magnitude2 = 0;
118625
+ let magnitude = 0;
120390
118626
  if (value < MIN_TARGET || value > MAX_TARGET) {
120391
- magnitude2 = Math.floor(Math.log10(value));
118627
+ magnitude = Math.floor(Math.log10(value));
120392
118628
  }
120393
118629
  let snappedUnit = SI_PREFIXES.find(
120394
- (p) => p.exponent % 3 === 0 && p.exponent <= magnitude2
118630
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude
120395
118631
  );
120396
118632
  let adjustedValue = value / 10 ** snappedUnit.exponent;
120397
118633
  if (adjustedValue > 500 && adjustedValue <= 1e3) {
120398
118634
  snappedUnit = SI_PREFIXES.find(
120399
- (p) => p.exponent % 3 === 0 && p.exponent <= magnitude2 + 3
118635
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
120400
118636
  );
120401
118637
  adjustedValue = value / 10 ** snappedUnit.exponent;
120402
118638
  }
@@ -123479,6 +121715,139 @@ class BitmaskLayer2 extends XRLayer {
123479
121715
  }
123480
121716
  BitmaskLayer2.layerName = "BitmaskLayer";
123481
121717
  BitmaskLayer2.defaultProps = defaultProps$2;
121718
+ function geomEach(geojson, callback) {
121719
+ var i2, j, g2, geometry2, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId2, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
121720
+ for (i2 = 0; i2 < stop; i2++) {
121721
+ geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
121722
+ featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
121723
+ featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
121724
+ featureId2 = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
121725
+ isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
121726
+ stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
121727
+ for (g2 = 0; g2 < stopG; g2++) {
121728
+ geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g2] : geometryMaybeCollection;
121729
+ if (geometry2 === null) {
121730
+ if (callback(
121731
+ null,
121732
+ featureIndex,
121733
+ featureProperties,
121734
+ featureBBox,
121735
+ featureId2
121736
+ ) === false)
121737
+ return false;
121738
+ continue;
121739
+ }
121740
+ switch (geometry2.type) {
121741
+ case "Point":
121742
+ case "LineString":
121743
+ case "MultiPoint":
121744
+ case "Polygon":
121745
+ case "MultiLineString":
121746
+ case "MultiPolygon": {
121747
+ if (callback(
121748
+ geometry2,
121749
+ featureIndex,
121750
+ featureProperties,
121751
+ featureBBox,
121752
+ featureId2
121753
+ ) === false)
121754
+ return false;
121755
+ break;
121756
+ }
121757
+ case "GeometryCollection": {
121758
+ for (j = 0; j < geometry2.geometries.length; j++) {
121759
+ if (callback(
121760
+ geometry2.geometries[j],
121761
+ featureIndex,
121762
+ featureProperties,
121763
+ featureBBox,
121764
+ featureId2
121765
+ ) === false)
121766
+ return false;
121767
+ }
121768
+ break;
121769
+ }
121770
+ default:
121771
+ throw new Error("Unknown Geometry Type");
121772
+ }
121773
+ }
121774
+ featureIndex++;
121775
+ }
121776
+ }
121777
+ function geomReduce(geojson, callback, initialValue) {
121778
+ var previousValue = initialValue;
121779
+ geomEach(
121780
+ geojson,
121781
+ function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId2) {
121782
+ previousValue = callback(
121783
+ previousValue,
121784
+ currentGeometry,
121785
+ featureIndex,
121786
+ featureProperties,
121787
+ featureBBox,
121788
+ featureId2
121789
+ );
121790
+ }
121791
+ );
121792
+ return previousValue;
121793
+ }
121794
+ function flattenEach(geojson, callback) {
121795
+ geomEach(geojson, function(geometry2, featureIndex, properties, bbox, id) {
121796
+ var type = geometry2 === null ? null : geometry2.type;
121797
+ switch (type) {
121798
+ case null:
121799
+ case "Point":
121800
+ case "LineString":
121801
+ case "Polygon":
121802
+ if (callback(
121803
+ feature$1(geometry2, properties, { bbox, id }),
121804
+ featureIndex,
121805
+ 0
121806
+ ) === false)
121807
+ return false;
121808
+ return;
121809
+ }
121810
+ var geomType;
121811
+ switch (type) {
121812
+ case "MultiPoint":
121813
+ geomType = "Point";
121814
+ break;
121815
+ case "MultiLineString":
121816
+ geomType = "LineString";
121817
+ break;
121818
+ case "MultiPolygon":
121819
+ geomType = "Polygon";
121820
+ break;
121821
+ }
121822
+ for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
121823
+ var coordinate = geometry2.coordinates[multiFeatureIndex];
121824
+ var geom = {
121825
+ type: geomType,
121826
+ coordinates: coordinate
121827
+ };
121828
+ if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false)
121829
+ return false;
121830
+ }
121831
+ });
121832
+ }
121833
+ function flattenReduce(geojson, callback, initialValue) {
121834
+ var previousValue = initialValue;
121835
+ flattenEach(
121836
+ geojson,
121837
+ function(currentFeature, featureIndex, multiFeatureIndex) {
121838
+ if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
121839
+ previousValue = currentFeature;
121840
+ else
121841
+ previousValue = callback(
121842
+ previousValue,
121843
+ currentFeature,
121844
+ featureIndex,
121845
+ multiFeatureIndex
121846
+ );
121847
+ }
121848
+ );
121849
+ return previousValue;
121850
+ }
123482
121851
  var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 1e14, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX = 1e9;
123483
121852
  function clone(configObject) {
123484
121853
  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 = {
@@ -125319,8 +123688,8 @@ var set = (eps) => {
125319
123688
  };
125320
123689
  };
125321
123690
  var precision = set();
125322
- var isInBbox = (bbox2, point2) => {
125323
- return bbox2.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox2.ur.x) && bbox2.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox2.ur.y);
123691
+ var isInBbox = (bbox, point2) => {
123692
+ return bbox.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox.ur.x) && bbox.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox.ur.y);
125324
123693
  };
125325
123694
  var getBboxOverlap = (b1, b2) => {
125326
123695
  if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))
@@ -126420,6 +124789,19 @@ function ringArea(coords) {
126420
124789
  }
126421
124790
  return total * FACTOR;
126422
124791
  }
124792
+ function distance(from, to, options = {}) {
124793
+ var coordinates1 = getCoord(from);
124794
+ var coordinates2 = getCoord(to);
124795
+ var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
124796
+ var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
124797
+ var lat1 = degreesToRadians(coordinates1[1]);
124798
+ var lat2 = degreesToRadians(coordinates2[1]);
124799
+ var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
124800
+ return radiansToLength(
124801
+ 2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
124802
+ options.units
124803
+ );
124804
+ }
126423
124805
  const DEFAULT_THRESHOLD = 1;
126424
124806
  const defaultProps$1 = {
126425
124807
  // for text
@@ -126518,7 +124900,7 @@ class ContourLayerWithText extends ContourLayer {
126518
124900
  const circlePoint = point(circleCoord);
126519
124901
  polygonVertices.forEach((polyCoord) => {
126520
124902
  const polyPoint = point(polyCoord);
126521
- const dist2 = distance$1(circlePoint, polyPoint);
124903
+ const dist2 = distance(circlePoint, polyPoint);
126522
124904
  if (dist2 < minDist) {
126523
124905
  minDist = dist2;
126524
124906
  minCirclePoint = circleCoord;
@@ -126612,6 +124994,8 @@ const deck = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
126612
124994
  DataFilterExtension,
126613
124995
  DeckGL,
126614
124996
  LineLayer,
124997
+ LinearInterpolator,
124998
+ OrbitController,
126615
124999
  OrbitView,
126616
125000
  OrthographicView,
126617
125001
  PathLayer,
@@ -126619,7 +125003,9 @@ const deck = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
126619
125003
  PolygonLayer,
126620
125004
  ScatterplotLayer,
126621
125005
  TextLayer,
126622
- TileLayer
125006
+ TileLayer,
125007
+ View,
125008
+ Viewport
126623
125009
  }, Symbol.toStringTag, { value: "Module" }));
126624
125010
  const ARROW_SCREEN_PX = 14;
126625
125011
  const LABEL_FONT_FAMILY = '"Roboto", "Helvetica", "Arial", sans-serif';
@@ -127011,10 +125397,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
127011
125397
  getLineColor: strokeColor,
127012
125398
  getLineWidth: strokeWidth,
127013
125399
  lineWidthUnits: "pixels",
127014
- ...dashArray ? {
127015
- extensions: [new PathStyleExtension({ dash: true })],
127016
- getDashArray: dashArray
127017
- } : {}
125400
+ extensions: dashExt,
125401
+ getDashArray: getDash
127018
125402
  }));
127019
125403
  if (shape.text && labelOpacity > 0) {
127020
125404
  layers.push(new TextLayer({
@@ -127049,8 +125433,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
127049
125433
  layers.push(new PathLayer({
127050
125434
  ...base,
127051
125435
  id: `annotation-line-${uid2}-${i2}`,
127052
- extensions: [new PathStyleExtension({ dash: true })],
127053
- getDashArray: dashArray ?? [0, 0],
125436
+ extensions: dashExt,
125437
+ getDashArray: getDash,
127054
125438
  data: [{ path: [[srcX, srcY], [tgtX, tgtY]] }],
127055
125439
  getPath: (d) => d.path,
127056
125440
  getColor: strokeColor,
@@ -127197,10 +125581,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
127197
125581
  getLineColor: strokeColor,
127198
125582
  getLineWidth: strokeWidth,
127199
125583
  lineWidthUnits: "pixels",
127200
- ...dashArray ? {
127201
- extensions: [new PathStyleExtension({ dash: true })],
127202
- getDashArray: dashArray
127203
- } : {}
125584
+ extensions: dashExt,
125585
+ getDashArray: getDash
127204
125586
  }));
127205
125587
  if (shape.text && labelOpacity > 0) {
127206
125588
  layers.push(new TextLayer({