@vitessce/image-utils 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.
@@ -79,7 +79,7 @@ var reTrimStart = /^\s+/;
79
79
  function baseTrim(string) {
80
80
  return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
81
81
  }
82
- function isObject$5(value) {
82
+ function isObject$3(value) {
83
83
  var type = typeof value;
84
84
  return value != null && (type == "object" || type == "function");
85
85
  }
@@ -95,9 +95,9 @@ function toNumber(value) {
95
95
  if (isSymbol(value)) {
96
96
  return NAN;
97
97
  }
98
- if (isObject$5(value)) {
98
+ if (isObject$3(value)) {
99
99
  var other = typeof value.valueOf == "function" ? value.valueOf() : value;
100
- value = isObject$5(other) ? other + "" : other;
100
+ value = isObject$3(other) ? other + "" : other;
101
101
  }
102
102
  if (typeof value != "string") {
103
103
  return value === 0 ? value : +value;
@@ -120,7 +120,7 @@ function toFinite$1(value) {
120
120
  }
121
121
  var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
122
122
  function isFunction$2(value) {
123
- if (!isObject$5(value)) {
123
+ if (!isObject$3(value)) {
124
124
  return false;
125
125
  }
126
126
  var tag2 = baseGetTag(value);
@@ -158,7 +158,7 @@ var reIsNative = RegExp(
158
158
  "^" + funcToString.call(hasOwnProperty$a).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
159
159
  );
160
160
  function baseIsNative(value) {
161
- if (!isObject$5(value) || isMasked(value)) {
161
+ if (!isObject$3(value) || isMasked(value)) {
162
162
  return false;
163
163
  }
164
164
  var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
@@ -190,7 +190,7 @@ function isArrayLike(value) {
190
190
  return value != null && isLength(value.length) && !isFunction$2(value);
191
191
  }
192
192
  function isIterateeCall(value, index2, object2) {
193
- if (!isObject$5(object2)) {
193
+ if (!isObject$3(object2)) {
194
194
  return false;
195
195
  }
196
196
  var type = typeof index2;
@@ -1587,10 +1587,10 @@ function normalize$4(out, a2) {
1587
1587
  out[2] = a2[2] * len2;
1588
1588
  return out;
1589
1589
  }
1590
- function dot$4(a2, b) {
1590
+ function dot$3(a2, b) {
1591
1591
  return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2];
1592
1592
  }
1593
- function cross$1(out, a2, b) {
1593
+ function cross(out, a2, b) {
1594
1594
  var ax = a2[0], ay = a2[1], az = a2[2];
1595
1595
  var bx = b[0], by = b[1], bz = b[2];
1596
1596
  out[0] = ay * bz - az * by;
@@ -1679,8 +1679,8 @@ function rotateZ$2(out, a2, b, rad) {
1679
1679
  out[2] = r2[2] + b[2];
1680
1680
  return out;
1681
1681
  }
1682
- function angle$2(a2, b) {
1683
- 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, cosine2 = mag && dot$4(a2, b) / mag;
1682
+ function angle$1(a2, b) {
1683
+ 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, cosine2 = mag && dot$3(a2, b) / mag;
1684
1684
  return Math.acos(Math.min(Math.max(cosine2, -1), 1));
1685
1685
  }
1686
1686
  var sub$1 = subtract$1;
@@ -1779,10 +1779,10 @@ class Vector3 extends Vector {
1779
1779
  this[2] = checkNumber(value);
1780
1780
  }
1781
1781
  angle(vector) {
1782
- return angle$2(this, vector);
1782
+ return angle$1(this, vector);
1783
1783
  }
1784
1784
  cross(vector) {
1785
- cross$1(this, this, vector);
1785
+ cross(this, this, vector);
1786
1786
  return this.check();
1787
1787
  }
1788
1788
  rotateX({
@@ -2899,7 +2899,7 @@ function normalize$3(out, a2) {
2899
2899
  out[3] = w2 * len2;
2900
2900
  return out;
2901
2901
  }
2902
- function dot$3(a2, b) {
2902
+ function dot$2(a2, b) {
2903
2903
  return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2] + a2[3] * b[3];
2904
2904
  }
2905
2905
  function lerp$2(out, a2, b, t) {
@@ -3515,7 +3515,7 @@ function fromMat3(out, m) {
3515
3515
  }
3516
3516
  var add$3 = add$4;
3517
3517
  var scale = scale$1;
3518
- var dot$2 = dot$3;
3518
+ var dot$1 = dot$2;
3519
3519
  var lerp$1 = lerp$2;
3520
3520
  var length$2 = length$3;
3521
3521
  var squaredLength = squaredLength$1;
@@ -3525,10 +3525,10 @@ var rotationTo = function() {
3525
3525
  var xUnitVec3 = fromValues(1, 0, 0);
3526
3526
  var yUnitVec3 = fromValues(0, 1, 0);
3527
3527
  return function(out, a2, b) {
3528
- var dot2 = dot$4(a2, b);
3528
+ var dot2 = dot$3(a2, b);
3529
3529
  if (dot2 < -0.999999) {
3530
- cross$1(tmpvec3, xUnitVec3, a2);
3531
- if (len(tmpvec3) < 1e-6) cross$1(tmpvec3, yUnitVec3, a2);
3530
+ cross(tmpvec3, xUnitVec3, a2);
3531
+ if (len(tmpvec3) < 1e-6) cross(tmpvec3, yUnitVec3, a2);
3532
3532
  normalize$4(tmpvec3, tmpvec3);
3533
3533
  setAxisAngle(out, tmpvec3, Math.PI);
3534
3534
  return out;
@@ -3539,7 +3539,7 @@ var rotationTo = function() {
3539
3539
  out[3] = 1;
3540
3540
  return out;
3541
3541
  } else {
3542
- cross$1(tmpvec3, a2, b);
3542
+ cross(tmpvec3, a2, b);
3543
3543
  out[0] = tmpvec3[0];
3544
3544
  out[1] = tmpvec3[1];
3545
3545
  out[2] = tmpvec3[2];
@@ -3653,7 +3653,7 @@ class Quaternion extends MathArray {
3653
3653
  return squaredLength(this);
3654
3654
  }
3655
3655
  dot(a2) {
3656
- return dot$2(this, a2);
3656
+ return dot$1(this, a2);
3657
3657
  }
3658
3658
  rotationTo(vectorA, vectorB) {
3659
3659
  rotationTo(this, vectorA, vectorB);
@@ -4577,7 +4577,7 @@ function isDate(x) {
4577
4577
  function isRegExp(x) {
4578
4578
  return x instanceof RegExp;
4579
4579
  }
4580
- function isObject$4(x) {
4580
+ function isObject$2(x) {
4581
4581
  return !!(x && typeof x === "object" && x.constructor === Object && !isComplex(x) && !isFraction(x));
4582
4582
  }
4583
4583
  function isNull(x) {
@@ -4684,7 +4684,7 @@ function mapObject(object2, callback) {
4684
4684
  }
4685
4685
  return clone2;
4686
4686
  }
4687
- function extend$1(a2, b) {
4687
+ function extend(a2, b) {
4688
4688
  for (var prop in b) {
4689
4689
  if (hasOwnProperty$2(b, prop)) {
4690
4690
  a2[prop] = b[prop];
@@ -6582,7 +6582,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies$P, function crea
6582
6582
  },
6583
6583
  {
6584
6584
  name: "Object",
6585
- test: isObject$4
6585
+ test: isObject$2
6586
6586
  }
6587
6587
  // order 'Object' last, it matches on other classes too
6588
6588
  ];
@@ -13657,7 +13657,7 @@ var createMultiply = /* @__PURE__ */ factory(name$u, dependencies$n, (_ref) => {
13657
13657
  cptr[bcolumns] = cindex.length;
13658
13658
  return c;
13659
13659
  }
13660
- return typed2(name$u, extend$1({
13660
+ return typed2(name$u, extend({
13661
13661
  // we extend the signatures of multiplyScalar with signatures dealing with matrices
13662
13662
  "Array, Array": function ArrayArray(x, y) {
13663
13663
  _validateMatrixDimensions(arraySize(x), arraySize(y));
@@ -18984,7 +18984,7 @@ var createDivide = /* @__PURE__ */ factory(name$7, dependencies, (_ref) => {
18984
18984
  var algorithm14 = createAlgorithm14({
18985
18985
  typed: typed2
18986
18986
  });
18987
- return typed2("divide", extend$1({
18987
+ return typed2("divide", extend({
18988
18988
  // we extend the signatures of divideScalar with signatures dealing with matrices
18989
18989
  "Array | Matrix, Array | Matrix": function ArrayMatrixArrayMatrix(x, y) {
18990
18990
  return multiply2(x, inv2(y));
@@ -19110,7 +19110,7 @@ var FibonacciHeap = /* @__PURE__ */ createFibonacciHeapClass({
19110
19110
  larger,
19111
19111
  smaller: smaller$1
19112
19112
  });
19113
- var dot$1 = /* @__PURE__ */ createDot({
19113
+ var dot = /* @__PURE__ */ createDot({
19114
19114
  addScalar,
19115
19115
  conj,
19116
19116
  multiplyScalar,
@@ -19126,7 +19126,7 @@ var floor = /* @__PURE__ */ createFloor({
19126
19126
  });
19127
19127
  var multiply = /* @__PURE__ */ createMultiply({
19128
19128
  addScalar,
19129
- dot: dot$1,
19129
+ dot,
19130
19130
  equalScalar,
19131
19131
  matrix,
19132
19132
  multiplyScalar,
@@ -19159,7 +19159,7 @@ var subtract = /* @__PURE__ */ createSubtract({
19159
19159
  typed,
19160
19160
  unaryMinus
19161
19161
  });
19162
- var equal$2 = /* @__PURE__ */ createEqual({
19162
+ var equal = /* @__PURE__ */ createEqual({
19163
19163
  DenseMatrix,
19164
19164
  equalScalar,
19165
19165
  matrix,
@@ -19238,7 +19238,7 @@ var Unit = /* @__PURE__ */ createUnitClass({
19238
19238
  addScalar,
19239
19239
  config: config$1,
19240
19240
  divideScalar,
19241
- equal: equal$2,
19241
+ equal,
19242
19242
  fix,
19243
19243
  format,
19244
19244
  isNumeric: isNumeric$1,
@@ -19903,6 +19903,19 @@ function max(values, valueof) {
19903
19903
  }
19904
19904
  return max2;
19905
19905
  }
19906
+ const UNIT_TO_METERS = {
19907
+ m: 1,
19908
+ meter: 1,
19909
+ mm: 1e-3,
19910
+ millimeter: 1e-3,
19911
+ um: 1e-6,
19912
+ µm: 1e-6,
19913
+ μm: 1e-6,
19914
+ micrometer: 1e-6,
19915
+ micron: 1e-6,
19916
+ nm: 1e-9,
19917
+ nanometer: 1e-9
19918
+ };
19906
19919
  function assert$b(condition, message) {
19907
19920
  if (!condition) {
19908
19921
  throw new Error(message || "loader assertion failed.");
@@ -20915,15 +20928,15 @@ function dirname(url) {
20915
20928
  }
20916
20929
  const isBoolean = (x) => typeof x === "boolean";
20917
20930
  const isFunction = (x) => typeof x === "function";
20918
- const isObject$3 = (x) => x !== null && typeof x === "object";
20919
- const isPureObject = (x) => isObject$3(x) && x.constructor === {}.constructor;
20931
+ const isObject$1 = (x) => x !== null && typeof x === "object";
20932
+ const isPureObject = (x) => isObject$1(x) && x.constructor === {}.constructor;
20920
20933
  const isIterable = (x) => x && typeof x[Symbol.iterator] === "function";
20921
20934
  const isAsyncIterable$1 = (x) => x && typeof x[Symbol.asyncIterator] === "function";
20922
20935
  const isResponse = (x) => typeof Response !== "undefined" && x instanceof Response || x && x.arrayBuffer && x.text && x.json;
20923
20936
  const isBlob = (x) => typeof Blob !== "undefined" && x instanceof Blob;
20924
20937
  const isBuffer = (x) => x && typeof x === "object" && x.isBuffer;
20925
- const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$3(x) && isFunction(x.tee) && isFunction(x.cancel) && isFunction(x.getReader);
20926
- const isReadableNodeStream = (x) => isObject$3(x) && isFunction(x.read) && isFunction(x.pipe) && isBoolean(x.readable);
20938
+ const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$1(x) && isFunction(x.tee) && isFunction(x.cancel) && isFunction(x.getReader);
20939
+ const isReadableNodeStream = (x) => isObject$1(x) && isFunction(x.read) && isFunction(x.pipe) && isBoolean(x.readable);
20927
20940
  const isReadableStream = (x) => isReadableDOMStream(x) || isReadableNodeStream(x);
20928
20941
  const DATA_URL_PATTERN = /^data:([-\w.]+\/[-\w.+]+)(;|,)/;
20929
20942
  const MIME_TYPE_PATTERN = /^([-\w.]+\/[-\w.+]+)/;
@@ -21722,7 +21735,7 @@ function getFetchFunction(options, context) {
21722
21735
  if (typeof fetchOptions.fetch === "function") {
21723
21736
  return fetchOptions.fetch;
21724
21737
  }
21725
- if (isObject$3(fetchOptions.fetch)) {
21738
+ if (isObject$1(fetchOptions.fetch)) {
21726
21739
  return (url) => fetchFile(url, fetchOptions);
21727
21740
  }
21728
21741
  if (context !== null && context !== void 0 && context.fetch) {
@@ -21743,7 +21756,7 @@ function validateOptionsObject(options, id, defaultOptions, deprecatedOptions, l
21743
21756
  const loaderName = id || "Top level";
21744
21757
  const prefix = id ? "".concat(id, ".") : "";
21745
21758
  for (const key in options) {
21746
- const isSubOptions = !id && isObject$3(options[key]);
21759
+ const isSubOptions = !id && isObject$1(options[key]);
21747
21760
  const isBaseUriOption = key === "baseUri" && !id;
21748
21761
  const isWorkerUrlOption = key === "workerUrl" && id;
21749
21762
  if (!(key in defaultOptions) && !isBaseUriOption && !isWorkerUrlOption) {
@@ -44923,7 +44936,7 @@ function getPropTypes(props) {
44923
44936
  const ERR_NOT_OBJECT = "count(): argument not an object";
44924
44937
  const ERR_NOT_CONTAINER = "count(): argument not a container";
44925
44938
  function count(container) {
44926
- if (!isObject$2(container)) {
44939
+ if (!isObject(container)) {
44927
44940
  throw new Error(ERR_NOT_OBJECT);
44928
44941
  }
44929
44942
  if (typeof container.count === "function") {
@@ -44943,7 +44956,7 @@ function count(container) {
44943
44956
  function isPlainObject(value) {
44944
44957
  return value !== null && typeof value === "object" && value.constructor === Object;
44945
44958
  }
44946
- function isObject$2(value) {
44959
+ function isObject(value) {
44947
44960
  return value !== null && typeof value === "object";
44948
44961
  }
44949
44962
  function mergeShaders(target, source) {
@@ -49276,35 +49289,35 @@ function getPointAtIndex(positions, index2, size2, offset, out = []) {
49276
49289
  }
49277
49290
  return out;
49278
49291
  }
49279
- function intersect(a2, b, edge, bbox2, out = []) {
49292
+ function intersect(a2, b, edge, bbox, out = []) {
49280
49293
  let t;
49281
49294
  let snap;
49282
49295
  if (edge & 8) {
49283
- t = (bbox2[3] - a2[1]) / (b[1] - a2[1]);
49296
+ t = (bbox[3] - a2[1]) / (b[1] - a2[1]);
49284
49297
  snap = 3;
49285
49298
  } else if (edge & 4) {
49286
- t = (bbox2[1] - a2[1]) / (b[1] - a2[1]);
49299
+ t = (bbox[1] - a2[1]) / (b[1] - a2[1]);
49287
49300
  snap = 1;
49288
49301
  } else if (edge & 2) {
49289
- t = (bbox2[2] - a2[0]) / (b[0] - a2[0]);
49302
+ t = (bbox[2] - a2[0]) / (b[0] - a2[0]);
49290
49303
  snap = 2;
49291
49304
  } else if (edge & 1) {
49292
- t = (bbox2[0] - a2[0]) / (b[0] - a2[0]);
49305
+ t = (bbox[0] - a2[0]) / (b[0] - a2[0]);
49293
49306
  snap = 0;
49294
49307
  } else {
49295
49308
  return null;
49296
49309
  }
49297
49310
  for (let i2 = 0; i2 < a2.length; i2++) {
49298
- out[i2] = (snap & 1) === i2 ? bbox2[snap] : t * (b[i2] - a2[i2]) + a2[i2];
49311
+ out[i2] = (snap & 1) === i2 ? bbox[snap] : t * (b[i2] - a2[i2]) + a2[i2];
49299
49312
  }
49300
49313
  return out;
49301
49314
  }
49302
- function bitCode(p, bbox2) {
49315
+ function bitCode(p, bbox) {
49303
49316
  let code = 0;
49304
- if (p[0] < bbox2[0]) code |= 1;
49305
- else if (p[0] > bbox2[2]) code |= 2;
49306
- if (p[1] < bbox2[1]) code |= 4;
49307
- else if (p[1] > bbox2[3]) code |= 8;
49317
+ if (p[0] < bbox[0]) code |= 1;
49318
+ else if (p[0] > bbox[2]) code |= 2;
49319
+ if (p[1] < bbox[1]) code |= 4;
49320
+ else if (p[1] > bbox[3]) code |= 8;
49308
49321
  return code;
49309
49322
  }
49310
49323
  function cutPolylineByGrid(positions, options) {
@@ -49374,7 +49387,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
49374
49387
  types: edgeTypes ? new Array(positions.length / size2).fill(TYPE_BORDER) : null,
49375
49388
  holes: holeIndices || []
49376
49389
  }];
49377
- const bbox2 = [[], []];
49390
+ const bbox = [[], []];
49378
49391
  let cell = [];
49379
49392
  while (queue.length) {
49380
49393
  const {
@@ -49382,9 +49395,9 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
49382
49395
  types,
49383
49396
  holes
49384
49397
  } = queue.shift();
49385
- getBoundingBox$2(pos, size2, holes[0] || pos.length, bbox2);
49386
- cell = getGridCell(bbox2[0], gridResolution, gridOffset, cell);
49387
- const code = bitCode(bbox2[1], cell);
49398
+ getBoundingBox$2(pos, size2, holes[0] || pos.length, bbox);
49399
+ cell = getGridCell(bbox[0], gridResolution, gridOffset, cell);
49400
+ const code = bitCode(bbox[1], cell);
49388
49401
  if (code) {
49389
49402
  let parts = bisectPolygon(pos, types, size2, 0, holes[0] || pos.length, cell, code);
49390
49403
  const polygonLow = {
@@ -49430,7 +49443,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
49430
49443
  }
49431
49444
  return result;
49432
49445
  }
49433
- function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox2, edge) {
49446
+ function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox, edge) {
49434
49447
  const numPoints = (endIndex - startIndex) / size2;
49435
49448
  const resultLow = [];
49436
49449
  const resultHigh = [];
@@ -49441,16 +49454,16 @@ function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox2,
49441
49454
  let side;
49442
49455
  let type;
49443
49456
  const prev = getPointAtIndex(positions, numPoints - 1, size2, startIndex);
49444
- let prevSide = Math.sign(edge & 8 ? prev[1] - bbox2[3] : prev[0] - bbox2[2]);
49457
+ let prevSide = Math.sign(edge & 8 ? prev[1] - bbox[3] : prev[0] - bbox[2]);
49445
49458
  let prevType = edgeTypes && edgeTypes[numPoints - 1];
49446
49459
  let lowPointCount = 0;
49447
49460
  let highPointCount = 0;
49448
49461
  for (let i2 = 0; i2 < numPoints; i2++) {
49449
49462
  p = getPointAtIndex(positions, i2, size2, startIndex, p);
49450
- side = Math.sign(edge & 8 ? p[1] - bbox2[3] : p[0] - bbox2[2]);
49463
+ side = Math.sign(edge & 8 ? p[1] - bbox[3] : p[0] - bbox[2]);
49451
49464
  type = edgeTypes && edgeTypes[startIndex / size2 + i2];
49452
49465
  if (side && prevSide && prevSide !== side) {
49453
- intersect(prev, p, edge, bbox2, scratchPoint);
49466
+ intersect(prev, p, edge, bbox, scratchPoint);
49454
49467
  push(resultLow, scratchPoint) && typesLow.push(prevType);
49455
49468
  push(resultHigh, scratchPoint) && typesHigh.push(prevType);
49456
49469
  }
@@ -50582,7 +50595,7 @@ function requireEarcut() {
50582
50595
  var p = start;
50583
50596
  do {
50584
50597
  var a2 = p.prev, b = p.next.next;
50585
- if (!equals2(a2, b) && intersects2(a2, p, p.next, b) && locallyInside(a2, b) && locallyInside(b, a2)) {
50598
+ if (!equals2(a2, b) && intersects(a2, p, p.next, b) && locallyInside(a2, b) && locallyInside(b, a2)) {
50586
50599
  triangles.push(a2.i / dim | 0);
50587
50600
  triangles.push(p.i / dim | 0);
50588
50601
  triangles.push(b.i / dim | 0);
@@ -50757,7 +50770,7 @@ function requireEarcut() {
50757
50770
  function equals2(p1, p2) {
50758
50771
  return p1.x === p2.x && p1.y === p2.y;
50759
50772
  }
50760
- function intersects2(p1, q1, p2, q2) {
50773
+ function intersects(p1, q1, p2, q2) {
50761
50774
  var o1 = sign2(area2(p1, q1, p2));
50762
50775
  var o2 = sign2(area2(p1, q1, q2));
50763
50776
  var o3 = sign2(area2(p2, q2, p1));
@@ -50778,7 +50791,7 @@ function requireEarcut() {
50778
50791
  function intersectsPolygon(a2, b) {
50779
50792
  var p = a2;
50780
50793
  do {
50781
- 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;
50794
+ 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;
50782
50795
  p = p.next;
50783
50796
  } while (p !== a2);
50784
50797
  return false;
@@ -56814,7 +56827,7 @@ class Tile2DHeader {
56814
56827
  const {
56815
56828
  index: index2,
56816
56829
  id,
56817
- bbox: bbox2,
56830
+ bbox,
56818
56831
  userData,
56819
56832
  zoom
56820
56833
  } = this;
@@ -56840,7 +56853,7 @@ class Tile2DHeader {
56840
56853
  tileData = await getData({
56841
56854
  index: index2,
56842
56855
  id,
56843
- bbox: bbox2,
56856
+ bbox,
56844
56857
  userData,
56845
56858
  zoom,
56846
56859
  signal
@@ -57714,8 +57727,8 @@ const urlType = {
57714
57727
  return true;
57715
57728
  }
57716
57729
  };
57717
- function transformBox(bbox2, modelMatrix2) {
57718
- 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]])];
57730
+ function transformBox(bbox, modelMatrix2) {
57731
+ 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]])];
57719
57732
  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]))];
57720
57733
  return transformedBox;
57721
57734
  }
@@ -57783,12 +57796,12 @@ function getCullBoundsInViewport(viewport, z, cullRect) {
57783
57796
  const bounds1 = getCullBoundsInViewport(viewport, z[1], cullRect);
57784
57797
  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])];
57785
57798
  }
57786
- function getIndexingCoords(bbox2, scale2, modelMatrixInverse) {
57799
+ function getIndexingCoords(bbox, scale2, modelMatrixInverse) {
57787
57800
  if (modelMatrixInverse) {
57788
- const transformedTileIndex = transformBox(bbox2, modelMatrixInverse).map((i2) => i2 * scale2 / TILE_SIZE$1);
57801
+ const transformedTileIndex = transformBox(bbox, modelMatrixInverse).map((i2) => i2 * scale2 / TILE_SIZE$1);
57789
57802
  return transformedTileIndex;
57790
57803
  }
57791
- return bbox2.map((i2) => i2 * scale2 / TILE_SIZE$1);
57804
+ return bbox.map((i2) => i2 * scale2 / TILE_SIZE$1);
57792
57805
  }
57793
57806
  function getScale(z, tileSize) {
57794
57807
  return Math.pow(2, z) * TILE_SIZE$1 / tileSize;
@@ -57825,9 +57838,9 @@ function tileToBoundingBox(viewport, x, y, z, tileSize = TILE_SIZE$1) {
57825
57838
  };
57826
57839
  }
57827
57840
  function getIdentityTileIndices(viewport, z, tileSize, extent2, modelMatrixInverse) {
57828
- const bbox2 = getBoundingBox(viewport, null, extent2);
57841
+ const bbox = getBoundingBox(viewport, null, extent2);
57829
57842
  const scale2 = getScale(z, tileSize);
57830
- const [minX, minY, maxX, maxY] = getIndexingCoords(bbox2, scale2, modelMatrixInverse);
57843
+ const [minX, minY, maxX, maxY] = getIndexingCoords(bbox, scale2, modelMatrixInverse);
57831
57844
  const indices = [];
57832
57845
  for (let x = Math.floor(minX); x < maxX; x++) {
57833
57846
  for (let y = Math.floor(minY); y < maxY; y++) {
@@ -58016,16 +58029,16 @@ class Tileset2D {
58016
58029
  cullRect
58017
58030
  });
58018
58031
  const {
58019
- bbox: bbox2
58032
+ bbox
58020
58033
  } = tile;
58021
58034
  for (const [minX, minY, maxX, maxY] of boundsArr) {
58022
58035
  let overlaps;
58023
- if ("west" in bbox2) {
58024
- overlaps = bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
58036
+ if ("west" in bbox) {
58037
+ overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
58025
58038
  } else {
58026
- const y02 = Math.min(bbox2.top, bbox2.bottom);
58027
- const y12 = Math.max(bbox2.top, bbox2.bottom);
58028
- overlaps = bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
58039
+ const y02 = Math.min(bbox.top, bbox.bottom);
58040
+ const y12 = Math.max(bbox.top, bbox.bottom);
58041
+ overlaps = bbox.left < maxX && bbox.right > minX && y02 < maxY && y12 > minY;
58029
58042
  }
58030
58043
  if (overlaps) {
58031
58044
  return true;
@@ -75315,7 +75328,7 @@ class Ellipsoid {
75315
75328
  h.copy(scratchCartesian).subtract(point2);
75316
75329
  const longitude = Math.atan2(normal.y, normal.x);
75317
75330
  const latitude = Math.asin(normal.z);
75318
- const height = Math.sign(dot$4(h, scratchCartesian)) * length$4(h);
75331
+ const height = Math.sign(dot$3(h, scratchCartesian)) * length$4(h);
75319
75332
  return toCartographicFromRadians([longitude, latitude, height], result);
75320
75333
  }
75321
75334
  eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
@@ -79719,13 +79732,13 @@ class TerrainLayer extends CompositeLayer {
79719
79732
  let bottomLeft = [0, 0];
79720
79733
  let topRight = [0, 0];
79721
79734
  if (viewport.isGeospatial) {
79722
- const bbox2 = tile.bbox;
79723
- bottomLeft = viewport.projectFlat([bbox2.west, bbox2.south]);
79724
- topRight = viewport.projectFlat([bbox2.east, bbox2.north]);
79735
+ const bbox = tile.bbox;
79736
+ bottomLeft = viewport.projectFlat([bbox.west, bbox.south]);
79737
+ topRight = viewport.projectFlat([bbox.east, bbox.north]);
79725
79738
  } else {
79726
- const bbox2 = tile.bbox;
79727
- bottomLeft = [bbox2.left, bbox2.bottom];
79728
- topRight = [bbox2.right, bbox2.top];
79739
+ const bbox = tile.bbox;
79740
+ bottomLeft = [bbox.left, bbox.bottom];
79741
+ topRight = [bbox.right, bbox.top];
79729
79742
  }
79730
79743
  const bounds2 = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
79731
79744
  const terrain = this.loadTerrain({
@@ -80096,27 +80109,27 @@ function Point([pointX, pointY], [nw, se], viewport) {
80096
80109
  const y = lerp$5(nw[1], se[1], pointY);
80097
80110
  return viewport.unprojectFlat([x, y]);
80098
80111
  }
80099
- function getPoints(geometry2, bbox2, viewport) {
80100
- return geometry2.map((g2) => Point(g2, bbox2, viewport));
80112
+ function getPoints(geometry2, bbox, viewport) {
80113
+ return geometry2.map((g2) => Point(g2, bbox, viewport));
80101
80114
  }
80102
- function MultiPoint(multiPoint, bbox2, viewport) {
80103
- return getPoints(multiPoint, bbox2, viewport);
80115
+ function MultiPoint(multiPoint, bbox, viewport) {
80116
+ return getPoints(multiPoint, bbox, viewport);
80104
80117
  }
80105
- function LineString(line, bbox2, viewport) {
80106
- return getPoints(line, bbox2, viewport);
80118
+ function LineString(line, bbox, viewport) {
80119
+ return getPoints(line, bbox, viewport);
80107
80120
  }
80108
- function MultiLineString(multiLineString, bbox2, viewport) {
80109
- return multiLineString.map((lineString2) => LineString(lineString2, bbox2, viewport));
80121
+ function MultiLineString(multiLineString, bbox, viewport) {
80122
+ return multiLineString.map((lineString) => LineString(lineString, bbox, viewport));
80110
80123
  }
80111
- function Polygon(polygon2, bbox2, viewport) {
80112
- return polygon2.map((polygonRing) => getPoints(polygonRing, bbox2, viewport));
80124
+ function Polygon(polygon2, bbox, viewport) {
80125
+ return polygon2.map((polygonRing) => getPoints(polygonRing, bbox, viewport));
80113
80126
  }
80114
- function MultiPolygon(multiPolygon2, bbox2, viewport) {
80115
- return multiPolygon2.map((polygon2) => Polygon(polygon2, bbox2, viewport));
80127
+ function MultiPolygon(multiPolygon2, bbox, viewport) {
80128
+ return multiPolygon2.map((polygon2) => Polygon(polygon2, bbox, viewport));
80116
80129
  }
80117
- function transform$1(geometry2, bbox2, viewport) {
80118
- const nw = viewport.projectFlat([bbox2.west, bbox2.north]);
80119
- const se = viewport.projectFlat([bbox2.east, bbox2.south]);
80130
+ function transform$1(geometry2, bbox, viewport) {
80131
+ const nw = viewport.projectFlat([bbox.west, bbox.north]);
80132
+ const se = viewport.projectFlat([bbox.east, bbox.south]);
80120
80133
  const projectedBbox = [nw, se];
80121
80134
  return {
80122
80135
  ...geometry2,
@@ -80506,11 +80519,11 @@ class MVTLayer extends TileLayer {
80506
80519
  return [];
80507
80520
  }
80508
80521
  const {
80509
- bbox: bbox2
80522
+ bbox
80510
80523
  } = tile;
80511
- if (tile._contentWGS84 === void 0 && isGeoBoundingBox(bbox2)) {
80524
+ if (tile._contentWGS84 === void 0 && isGeoBoundingBox(bbox)) {
80512
80525
  const content = this.state.binary ? binaryToGeojson(tile.content) : tile.content;
80513
- tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2, bbox2, this.context.viewport));
80526
+ tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2, bbox, this.context.viewport));
80514
80527
  }
80515
80528
  return tile._contentWGS84;
80516
80529
  }
@@ -80537,7 +80550,7 @@ function getFeatureLayerName(feature2) {
80537
80550
  function isFeatureIdDefined(value) {
80538
80551
  return value !== void 0 && value !== null && value !== "";
80539
80552
  }
80540
- function transformTileCoordsToWGS84(object2, bbox2, viewport) {
80553
+ function transformTileCoordsToWGS84(object2, bbox, viewport) {
80541
80554
  const feature2 = {
80542
80555
  ...object2,
80543
80556
  geometry: {
@@ -80546,7 +80559,7 @@ function transformTileCoordsToWGS84(object2, bbox2, viewport) {
80546
80559
  };
80547
80560
  Object.defineProperty(feature2.geometry, "coordinates", {
80548
80561
  get: () => {
80549
- const wgs84Geom = transform$1(object2.geometry, bbox2, viewport);
80562
+ const wgs84Geom = transform$1(object2.geometry, bbox, viewport);
80550
80563
  return wgs84Geom.coordinates;
80551
80564
  }
80552
80565
  });
@@ -80717,16 +80730,6 @@ function polygons(coordinates2, properties, options = {}) {
80717
80730
  options
80718
80731
  );
80719
80732
  }
80720
- function lineString(coordinates2, properties, options = {}) {
80721
- if (coordinates2.length < 2) {
80722
- throw new Error("coordinates must be an array of two or more positions");
80723
- }
80724
- const geom = {
80725
- type: "LineString",
80726
- coordinates: coordinates2
80727
- };
80728
- return feature$1(geom, properties, options);
80729
- }
80730
80733
  function featureCollection(features, options = {}) {
80731
80734
  const fc = { type: "FeatureCollection" };
80732
80735
  if (options.id) {
@@ -80752,10 +80755,6 @@ function radiansToLength(radians2, units = "kilometers") {
80752
80755
  }
80753
80756
  return radians2 * factor;
80754
80757
  }
80755
- function radiansToDegrees(radians2) {
80756
- const normalisedRadians = radians2 % (2 * Math.PI);
80757
- return normalisedRadians * 180 / Math.PI;
80758
- }
80759
80758
  function degreesToRadians(degrees2) {
80760
80759
  const normalisedDegrees = degrees2 % 360;
80761
80760
  return normalisedDegrees * Math.PI / 180;
@@ -80763,428 +80762,6 @@ function degreesToRadians(degrees2) {
80763
80762
  function isNumber(num) {
80764
80763
  return !isNaN(num) && num !== null && !Array.isArray(num);
80765
80764
  }
80766
- function isObject$1(input) {
80767
- return input !== null && typeof input === "object" && !Array.isArray(input);
80768
- }
80769
- function coordEach(geojson, callback, excludeWrapCoord) {
80770
- if (geojson === null) return;
80771
- 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;
80772
- for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
80773
- geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
80774
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
80775
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
80776
- for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
80777
- var multiFeatureIndex = 0;
80778
- var geometryIndex = 0;
80779
- geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
80780
- if (geometry2 === null) continue;
80781
- coords = geometry2.coordinates;
80782
- var geomType = geometry2.type;
80783
- wrapShrink = 0;
80784
- switch (geomType) {
80785
- case null:
80786
- break;
80787
- case "Point":
80788
- if (callback(
80789
- coords,
80790
- coordIndex,
80791
- featureIndex,
80792
- multiFeatureIndex,
80793
- geometryIndex
80794
- ) === false)
80795
- return false;
80796
- coordIndex++;
80797
- multiFeatureIndex++;
80798
- break;
80799
- case "LineString":
80800
- case "MultiPoint":
80801
- for (j = 0; j < coords.length; j++) {
80802
- if (callback(
80803
- coords[j],
80804
- coordIndex,
80805
- featureIndex,
80806
- multiFeatureIndex,
80807
- geometryIndex
80808
- ) === false)
80809
- return false;
80810
- coordIndex++;
80811
- if (geomType === "MultiPoint") multiFeatureIndex++;
80812
- }
80813
- if (geomType === "LineString") multiFeatureIndex++;
80814
- break;
80815
- case "Polygon":
80816
- case "MultiLineString":
80817
- for (j = 0; j < coords.length; j++) {
80818
- for (k = 0; k < coords[j].length - wrapShrink; k++) {
80819
- if (callback(
80820
- coords[j][k],
80821
- coordIndex,
80822
- featureIndex,
80823
- multiFeatureIndex,
80824
- geometryIndex
80825
- ) === false)
80826
- return false;
80827
- coordIndex++;
80828
- }
80829
- if (geomType === "MultiLineString") multiFeatureIndex++;
80830
- if (geomType === "Polygon") geometryIndex++;
80831
- }
80832
- if (geomType === "Polygon") multiFeatureIndex++;
80833
- break;
80834
- case "MultiPolygon":
80835
- for (j = 0; j < coords.length; j++) {
80836
- geometryIndex = 0;
80837
- for (k = 0; k < coords[j].length; k++) {
80838
- for (l2 = 0; l2 < coords[j][k].length - wrapShrink; l2++) {
80839
- if (callback(
80840
- coords[j][k][l2],
80841
- coordIndex,
80842
- featureIndex,
80843
- multiFeatureIndex,
80844
- geometryIndex
80845
- ) === false)
80846
- return false;
80847
- coordIndex++;
80848
- }
80849
- geometryIndex++;
80850
- }
80851
- multiFeatureIndex++;
80852
- }
80853
- break;
80854
- case "GeometryCollection":
80855
- for (j = 0; j < geometry2.geometries.length; j++)
80856
- if (coordEach(geometry2.geometries[j], callback) === false)
80857
- return false;
80858
- break;
80859
- default:
80860
- throw new Error("Unknown Geometry Type");
80861
- }
80862
- }
80863
- }
80864
- }
80865
- function featureEach(geojson, callback) {
80866
- if (geojson.type === "Feature") {
80867
- callback(geojson, 0);
80868
- } else if (geojson.type === "FeatureCollection") {
80869
- for (var i2 = 0; i2 < geojson.features.length; i2++) {
80870
- if (callback(geojson.features[i2], i2) === false) break;
80871
- }
80872
- }
80873
- }
80874
- function geomEach(geojson, callback) {
80875
- 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;
80876
- for (i2 = 0; i2 < stop; i2++) {
80877
- geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
80878
- featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
80879
- featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
80880
- featureId2 = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
80881
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
80882
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
80883
- for (g2 = 0; g2 < stopG; g2++) {
80884
- geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g2] : geometryMaybeCollection;
80885
- if (geometry2 === null) {
80886
- if (callback(
80887
- null,
80888
- featureIndex,
80889
- featureProperties,
80890
- featureBBox,
80891
- featureId2
80892
- ) === false)
80893
- return false;
80894
- continue;
80895
- }
80896
- switch (geometry2.type) {
80897
- case "Point":
80898
- case "LineString":
80899
- case "MultiPoint":
80900
- case "Polygon":
80901
- case "MultiLineString":
80902
- case "MultiPolygon": {
80903
- if (callback(
80904
- geometry2,
80905
- featureIndex,
80906
- featureProperties,
80907
- featureBBox,
80908
- featureId2
80909
- ) === false)
80910
- return false;
80911
- break;
80912
- }
80913
- case "GeometryCollection": {
80914
- for (j = 0; j < geometry2.geometries.length; j++) {
80915
- if (callback(
80916
- geometry2.geometries[j],
80917
- featureIndex,
80918
- featureProperties,
80919
- featureBBox,
80920
- featureId2
80921
- ) === false)
80922
- return false;
80923
- }
80924
- break;
80925
- }
80926
- default:
80927
- throw new Error("Unknown Geometry Type");
80928
- }
80929
- }
80930
- featureIndex++;
80931
- }
80932
- }
80933
- function geomReduce(geojson, callback, initialValue) {
80934
- var previousValue = initialValue;
80935
- geomEach(
80936
- geojson,
80937
- function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId2) {
80938
- previousValue = callback(
80939
- previousValue,
80940
- currentGeometry,
80941
- featureIndex,
80942
- featureProperties,
80943
- featureBBox,
80944
- featureId2
80945
- );
80946
- }
80947
- );
80948
- return previousValue;
80949
- }
80950
- function flattenEach(geojson, callback) {
80951
- geomEach(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
80952
- var type = geometry2 === null ? null : geometry2.type;
80953
- switch (type) {
80954
- case null:
80955
- case "Point":
80956
- case "LineString":
80957
- case "Polygon":
80958
- if (callback(
80959
- feature$1(geometry2, properties, { bbox: bbox2, id }),
80960
- featureIndex,
80961
- 0
80962
- ) === false)
80963
- return false;
80964
- return;
80965
- }
80966
- var geomType;
80967
- switch (type) {
80968
- case "MultiPoint":
80969
- geomType = "Point";
80970
- break;
80971
- case "MultiLineString":
80972
- geomType = "LineString";
80973
- break;
80974
- case "MultiPolygon":
80975
- geomType = "Polygon";
80976
- break;
80977
- }
80978
- for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
80979
- var coordinate = geometry2.coordinates[multiFeatureIndex];
80980
- var geom = {
80981
- type: geomType,
80982
- coordinates: coordinate
80983
- };
80984
- if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false)
80985
- return false;
80986
- }
80987
- });
80988
- }
80989
- function flattenReduce(geojson, callback, initialValue) {
80990
- var previousValue = initialValue;
80991
- flattenEach(
80992
- geojson,
80993
- function(currentFeature, featureIndex, multiFeatureIndex) {
80994
- if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
80995
- previousValue = currentFeature;
80996
- else
80997
- previousValue = callback(
80998
- previousValue,
80999
- currentFeature,
81000
- featureIndex,
81001
- multiFeatureIndex
81002
- );
81003
- }
81004
- );
81005
- return previousValue;
81006
- }
81007
- function segmentEach(geojson, callback) {
81008
- flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
81009
- var segmentIndex = 0;
81010
- if (!feature2.geometry) return;
81011
- var type = feature2.geometry.type;
81012
- if (type === "Point" || type === "MultiPoint") return;
81013
- var previousCoords;
81014
- var previousFeatureIndex = 0;
81015
- var previousMultiIndex = 0;
81016
- var prevGeomIndex = 0;
81017
- if (coordEach(
81018
- feature2,
81019
- function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
81020
- if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
81021
- previousCoords = currentCoord;
81022
- previousFeatureIndex = featureIndex;
81023
- previousMultiIndex = multiPartIndexCoord;
81024
- prevGeomIndex = geometryIndex;
81025
- segmentIndex = 0;
81026
- return;
81027
- }
81028
- var currentSegment = lineString(
81029
- [previousCoords, currentCoord],
81030
- feature2.properties
81031
- );
81032
- if (callback(
81033
- currentSegment,
81034
- featureIndex,
81035
- multiFeatureIndex,
81036
- geometryIndex,
81037
- segmentIndex
81038
- ) === false)
81039
- return false;
81040
- segmentIndex++;
81041
- previousCoords = currentCoord;
81042
- }
81043
- ) === false)
81044
- return false;
81045
- });
81046
- }
81047
- function bbox$1(geojson, options = {}) {
81048
- if (geojson.bbox != null && true !== options.recompute) {
81049
- return geojson.bbox;
81050
- }
81051
- const result = [Infinity, Infinity, -Infinity, -Infinity];
81052
- coordEach(geojson, (coord) => {
81053
- if (result[0] > coord[0]) {
81054
- result[0] = coord[0];
81055
- }
81056
- if (result[1] > coord[1]) {
81057
- result[1] = coord[1];
81058
- }
81059
- if (result[2] < coord[0]) {
81060
- result[2] = coord[0];
81061
- }
81062
- if (result[3] < coord[1]) {
81063
- result[3] = coord[1];
81064
- }
81065
- });
81066
- return result;
81067
- }
81068
- function getCoord(coord) {
81069
- if (!coord) {
81070
- throw new Error("coord is required");
81071
- }
81072
- if (!Array.isArray(coord)) {
81073
- if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
81074
- return [...coord.geometry.coordinates];
81075
- }
81076
- if (coord.type === "Point") {
81077
- return [...coord.coordinates];
81078
- }
81079
- }
81080
- if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
81081
- return [...coord];
81082
- }
81083
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
81084
- }
81085
- function getCoords(coords) {
81086
- if (Array.isArray(coords)) {
81087
- return coords;
81088
- }
81089
- if (coords.type === "Feature") {
81090
- if (coords.geometry !== null) {
81091
- return coords.geometry.coordinates;
81092
- }
81093
- } else {
81094
- if (coords.coordinates) {
81095
- return coords.coordinates;
81096
- }
81097
- }
81098
- throw new Error(
81099
- "coords must be GeoJSON Feature, Geometry Object or an Array"
81100
- );
81101
- }
81102
- function getGeom(geojson) {
81103
- if (geojson.type === "Feature") {
81104
- return geojson.geometry;
81105
- }
81106
- return geojson;
81107
- }
81108
- function booleanPointOnLine(pt, line, options = {}) {
81109
- const ptCoords = getCoord(pt);
81110
- const lineCoords = getCoords(line);
81111
- for (let i2 = 0; i2 < lineCoords.length - 1; i2++) {
81112
- let ignoreBoundary = false;
81113
- if (options.ignoreEndVertices) {
81114
- if (i2 === 0) {
81115
- ignoreBoundary = "start";
81116
- }
81117
- if (i2 === lineCoords.length - 2) {
81118
- ignoreBoundary = "end";
81119
- }
81120
- if (i2 === 0 && i2 + 1 === lineCoords.length - 1) {
81121
- ignoreBoundary = "both";
81122
- }
81123
- }
81124
- if (isPointOnLineSegment(
81125
- lineCoords[i2],
81126
- lineCoords[i2 + 1],
81127
- ptCoords,
81128
- ignoreBoundary,
81129
- typeof options.epsilon === "undefined" ? null : options.epsilon
81130
- )) {
81131
- return true;
81132
- }
81133
- }
81134
- return false;
81135
- }
81136
- function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary, epsilon3) {
81137
- const x = pt[0];
81138
- const y = pt[1];
81139
- const x12 = lineSegmentStart[0];
81140
- const y12 = lineSegmentStart[1];
81141
- const x2 = lineSegmentEnd[0];
81142
- const y2 = lineSegmentEnd[1];
81143
- const dxc = pt[0] - x12;
81144
- const dyc = pt[1] - y12;
81145
- const dxl = x2 - x12;
81146
- const dyl = y2 - y12;
81147
- const cross2 = dxc * dyl - dyc * dxl;
81148
- if (epsilon3 !== null) {
81149
- if (Math.abs(cross2) > epsilon3) {
81150
- return false;
81151
- }
81152
- } else if (cross2 !== 0) {
81153
- return false;
81154
- }
81155
- if (Math.abs(dxl) === Math.abs(dyl) && Math.abs(dxl) === 0) {
81156
- if (excludeBoundary) {
81157
- return false;
81158
- }
81159
- if (pt[0] === lineSegmentStart[0] && pt[1] === lineSegmentStart[1]) {
81160
- return true;
81161
- } else {
81162
- return false;
81163
- }
81164
- }
81165
- if (!excludeBoundary) {
81166
- if (Math.abs(dxl) >= Math.abs(dyl)) {
81167
- return dxl > 0 ? x12 <= x && x <= x2 : x2 <= x && x <= x12;
81168
- }
81169
- return dyl > 0 ? y12 <= y && y <= y2 : y2 <= y && y <= y12;
81170
- } else if (excludeBoundary === "start") {
81171
- if (Math.abs(dxl) >= Math.abs(dyl)) {
81172
- return dxl > 0 ? x12 < x && x <= x2 : x2 <= x && x < x12;
81173
- }
81174
- return dyl > 0 ? y12 < y && y <= y2 : y2 <= y && y < y12;
81175
- } else if (excludeBoundary === "end") {
81176
- if (Math.abs(dxl) >= Math.abs(dyl)) {
81177
- return dxl > 0 ? x12 <= x && x < x2 : x2 < x && x <= x12;
81178
- }
81179
- return dyl > 0 ? y12 <= y && y < y2 : y2 < y && y <= y12;
81180
- } else if (excludeBoundary === "both") {
81181
- if (Math.abs(dxl) >= Math.abs(dyl)) {
81182
- return dxl > 0 ? x12 < x && x < x2 : x2 < x && x < x12;
81183
- }
81184
- return dyl > 0 ? y12 < y && y < y2 : y2 < y && y < y12;
81185
- }
81186
- return false;
81187
- }
81188
80765
  const epsilon$1 = 11102230246251565e-32;
81189
80766
  const splitter = 134217729;
81190
80767
  const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1;
@@ -81481,6 +81058,29 @@ function pointInPolygon(p, polygon2) {
81481
81058
  }
81482
81059
  return true;
81483
81060
  }
81061
+ function getCoord(coord) {
81062
+ if (!coord) {
81063
+ throw new Error("coord is required");
81064
+ }
81065
+ if (!Array.isArray(coord)) {
81066
+ if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
81067
+ return [...coord.geometry.coordinates];
81068
+ }
81069
+ if (coord.type === "Point") {
81070
+ return [...coord.coordinates];
81071
+ }
81072
+ }
81073
+ if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
81074
+ return [...coord];
81075
+ }
81076
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
81077
+ }
81078
+ function getGeom(geojson) {
81079
+ if (geojson.type === "Feature") {
81080
+ return geojson.geometry;
81081
+ }
81082
+ return geojson;
81083
+ }
81484
81084
  function booleanPointInPolygon(point2, polygon2, options = {}) {
81485
81085
  if (!point2) {
81486
81086
  throw new Error("point is required");
@@ -81491,9 +81091,9 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
81491
81091
  const pt = getCoord(point2);
81492
81092
  const geom = getGeom(polygon2);
81493
81093
  const type = geom.type;
81494
- const bbox2 = polygon2.bbox;
81094
+ const bbox = polygon2.bbox;
81495
81095
  let polys = geom.coordinates;
81496
- if (bbox2 && inBBox(pt, bbox2) === false) {
81096
+ if (bbox && inBBox(pt, bbox) === false) {
81497
81097
  return false;
81498
81098
  }
81499
81099
  if (type === "Polygon") {
@@ -81507,1607 +81107,8 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
81507
81107
  }
81508
81108
  return result;
81509
81109
  }
81510
- function inBBox(pt, bbox2) {
81511
- return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
81512
- }
81513
- function booleanWithin(feature1, feature2) {
81514
- var geom1 = getGeom(feature1);
81515
- var geom2 = getGeom(feature2);
81516
- var type1 = geom1.type;
81517
- var type2 = geom2.type;
81518
- switch (type1) {
81519
- case "Point":
81520
- switch (type2) {
81521
- case "MultiPoint":
81522
- return isPointInMultiPoint$1(geom1, geom2);
81523
- case "LineString":
81524
- return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });
81525
- case "Polygon":
81526
- case "MultiPolygon":
81527
- return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });
81528
- default:
81529
- throw new Error("feature2 " + type2 + " geometry not supported");
81530
- }
81531
- case "MultiPoint":
81532
- switch (type2) {
81533
- case "MultiPoint":
81534
- return isMultiPointInMultiPoint$1(geom1, geom2);
81535
- case "LineString":
81536
- return isMultiPointOnLine$1(geom1, geom2);
81537
- case "Polygon":
81538
- case "MultiPolygon":
81539
- return isMultiPointInPoly$1(geom1, geom2);
81540
- default:
81541
- throw new Error("feature2 " + type2 + " geometry not supported");
81542
- }
81543
- case "LineString":
81544
- switch (type2) {
81545
- case "LineString":
81546
- return isLineOnLine$1(geom1, geom2);
81547
- case "Polygon":
81548
- case "MultiPolygon":
81549
- return isLineInPoly$1(geom1, geom2);
81550
- default:
81551
- throw new Error("feature2 " + type2 + " geometry not supported");
81552
- }
81553
- case "Polygon":
81554
- switch (type2) {
81555
- case "Polygon":
81556
- case "MultiPolygon":
81557
- return isPolyInPoly$1(geom1, geom2);
81558
- default:
81559
- throw new Error("feature2 " + type2 + " geometry not supported");
81560
- }
81561
- default:
81562
- throw new Error("feature1 " + type1 + " geometry not supported");
81563
- }
81564
- }
81565
- function isPointInMultiPoint$1(point2, multiPoint) {
81566
- var i2;
81567
- var output = false;
81568
- for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
81569
- if (compareCoords$1(multiPoint.coordinates[i2], point2.coordinates)) {
81570
- output = true;
81571
- break;
81572
- }
81573
- }
81574
- return output;
81575
- }
81576
- function isMultiPointInMultiPoint$1(multiPoint1, multiPoint2) {
81577
- for (var i2 = 0; i2 < multiPoint1.coordinates.length; i2++) {
81578
- var anyMatch = false;
81579
- for (var i22 = 0; i22 < multiPoint2.coordinates.length; i22++) {
81580
- if (compareCoords$1(multiPoint1.coordinates[i2], multiPoint2.coordinates[i22])) {
81581
- anyMatch = true;
81582
- }
81583
- }
81584
- if (!anyMatch) {
81585
- return false;
81586
- }
81587
- }
81588
- return true;
81589
- }
81590
- function isMultiPointOnLine$1(multiPoint, lineString2) {
81591
- var foundInsidePoint = false;
81592
- for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
81593
- if (!booleanPointOnLine(multiPoint.coordinates[i2], lineString2)) {
81594
- return false;
81595
- }
81596
- if (!foundInsidePoint) {
81597
- foundInsidePoint = booleanPointOnLine(
81598
- multiPoint.coordinates[i2],
81599
- lineString2,
81600
- { ignoreEndVertices: true }
81601
- );
81602
- }
81603
- }
81604
- return foundInsidePoint;
81605
- }
81606
- function isMultiPointInPoly$1(multiPoint, polygon2) {
81607
- var output = true;
81608
- var isInside = false;
81609
- for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
81610
- isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2);
81611
- if (!isInside) {
81612
- output = false;
81613
- break;
81614
- }
81615
- {
81616
- isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2, {
81617
- ignoreBoundary: true
81618
- });
81619
- }
81620
- }
81621
- return output && isInside;
81622
- }
81623
- function isLineOnLine$1(lineString1, lineString2) {
81624
- for (var i2 = 0; i2 < lineString1.coordinates.length; i2++) {
81625
- if (!booleanPointOnLine(lineString1.coordinates[i2], lineString2)) {
81626
- return false;
81627
- }
81628
- }
81629
- return true;
81630
- }
81631
- function isLineInPoly$1(linestring, polygon2) {
81632
- var polyBbox = bbox$1(polygon2);
81633
- var lineBbox = bbox$1(linestring);
81634
- if (!doBBoxOverlap$1(polyBbox, lineBbox)) {
81635
- return false;
81636
- }
81637
- var foundInsidePoint = false;
81638
- for (var i2 = 0; i2 < linestring.coordinates.length; i2++) {
81639
- if (!booleanPointInPolygon(linestring.coordinates[i2], polygon2)) {
81640
- return false;
81641
- }
81642
- if (!foundInsidePoint) {
81643
- foundInsidePoint = booleanPointInPolygon(
81644
- linestring.coordinates[i2],
81645
- polygon2,
81646
- { ignoreBoundary: true }
81647
- );
81648
- }
81649
- if (!foundInsidePoint && i2 < linestring.coordinates.length - 1) {
81650
- var midpoint = getMidpoint$1(
81651
- linestring.coordinates[i2],
81652
- linestring.coordinates[i2 + 1]
81653
- );
81654
- foundInsidePoint = booleanPointInPolygon(midpoint, polygon2, {
81655
- ignoreBoundary: true
81656
- });
81657
- }
81658
- }
81659
- return foundInsidePoint;
81660
- }
81661
- function isPolyInPoly$1(geometry1, geometry2) {
81662
- var poly1Bbox = bbox$1(geometry1);
81663
- var poly2Bbox = bbox$1(geometry2);
81664
- if (!doBBoxOverlap$1(poly2Bbox, poly1Bbox)) {
81665
- return false;
81666
- }
81667
- for (var i2 = 0; i2 < geometry1.coordinates[0].length; i2++) {
81668
- if (!booleanPointInPolygon(geometry1.coordinates[0][i2], geometry2)) {
81669
- return false;
81670
- }
81671
- }
81672
- return true;
81673
- }
81674
- function doBBoxOverlap$1(bbox1, bbox2) {
81675
- if (bbox1[0] > bbox2[0]) return false;
81676
- if (bbox1[2] < bbox2[2]) return false;
81677
- if (bbox1[1] > bbox2[1]) return false;
81678
- if (bbox1[3] < bbox2[3]) return false;
81679
- return true;
81680
- }
81681
- function compareCoords$1(pair1, pair2) {
81682
- return pair1[0] === pair2[0] && pair1[1] === pair2[1];
81683
- }
81684
- function getMidpoint$1(pair1, pair2) {
81685
- return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
81686
- }
81687
- function booleanContains(feature1, feature2) {
81688
- const geom1 = getGeom(feature1);
81689
- const geom2 = getGeom(feature2);
81690
- const type1 = geom1.type;
81691
- const type2 = geom2.type;
81692
- const coords1 = geom1.coordinates;
81693
- const coords2 = geom2.coordinates;
81694
- switch (type1) {
81695
- case "Point":
81696
- switch (type2) {
81697
- case "Point":
81698
- return compareCoords(coords1, coords2);
81699
- default:
81700
- throw new Error("feature2 " + type2 + " geometry not supported");
81701
- }
81702
- case "MultiPoint":
81703
- switch (type2) {
81704
- case "Point":
81705
- return isPointInMultiPoint(geom1, geom2);
81706
- case "MultiPoint":
81707
- return isMultiPointInMultiPoint(geom1, geom2);
81708
- default:
81709
- throw new Error("feature2 " + type2 + " geometry not supported");
81710
- }
81711
- case "LineString":
81712
- switch (type2) {
81713
- case "Point":
81714
- return booleanPointOnLine(geom2, geom1, { ignoreEndVertices: true });
81715
- case "LineString":
81716
- return isLineOnLine(geom1, geom2);
81717
- case "MultiPoint":
81718
- return isMultiPointOnLine(geom1, geom2);
81719
- default:
81720
- throw new Error("feature2 " + type2 + " geometry not supported");
81721
- }
81722
- case "Polygon":
81723
- switch (type2) {
81724
- case "Point":
81725
- return booleanPointInPolygon(geom2, geom1, { ignoreBoundary: true });
81726
- case "LineString":
81727
- return isLineInPoly(geom1, geom2);
81728
- case "Polygon":
81729
- return isPolyInPoly(geom1, geom2);
81730
- case "MultiPoint":
81731
- return isMultiPointInPoly(geom1, geom2);
81732
- default:
81733
- throw new Error("feature2 " + type2 + " geometry not supported");
81734
- }
81735
- case "MultiPolygon":
81736
- switch (type2) {
81737
- case "Polygon":
81738
- return isPolygonInMultiPolygon(geom1, geom2);
81739
- default:
81740
- throw new Error("feature2 " + type2 + " geometry not supported");
81741
- }
81742
- default:
81743
- throw new Error("feature1 " + type1 + " geometry not supported");
81744
- }
81745
- }
81746
- function isPolygonInMultiPolygon(multiPolygon2, polygon2) {
81747
- return multiPolygon2.coordinates.some(
81748
- (coords) => isPolyInPoly({ type: "Polygon", coordinates: coords }, polygon2)
81749
- );
81750
- }
81751
- function isPointInMultiPoint(multiPoint, pt) {
81752
- let i2;
81753
- let output = false;
81754
- for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
81755
- if (compareCoords(multiPoint.coordinates[i2], pt.coordinates)) {
81756
- output = true;
81757
- break;
81758
- }
81759
- }
81760
- return output;
81761
- }
81762
- function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
81763
- for (const coord2 of multiPoint2.coordinates) {
81764
- let matchFound = false;
81765
- for (const coord1 of multiPoint1.coordinates) {
81766
- if (compareCoords(coord2, coord1)) {
81767
- matchFound = true;
81768
- break;
81769
- }
81770
- }
81771
- if (!matchFound) {
81772
- return false;
81773
- }
81774
- }
81775
- return true;
81776
- }
81777
- function isMultiPointOnLine(lineString2, multiPoint) {
81778
- let haveFoundInteriorPoint = false;
81779
- for (const coord of multiPoint.coordinates) {
81780
- if (booleanPointOnLine(coord, lineString2, { ignoreEndVertices: true })) {
81781
- haveFoundInteriorPoint = true;
81782
- }
81783
- if (!booleanPointOnLine(coord, lineString2)) {
81784
- return false;
81785
- }
81786
- }
81787
- if (haveFoundInteriorPoint) {
81788
- return true;
81789
- }
81790
- return false;
81791
- }
81792
- function isMultiPointInPoly(polygon2, multiPoint) {
81793
- for (const coord of multiPoint.coordinates) {
81794
- if (!booleanPointInPolygon(coord, polygon2, { ignoreBoundary: true })) {
81795
- return false;
81796
- }
81797
- }
81798
- return true;
81799
- }
81800
- function isLineOnLine(lineString1, lineString2) {
81801
- let haveFoundInteriorPoint = false;
81802
- for (const coords of lineString2.coordinates) {
81803
- if (booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
81804
- ignoreEndVertices: true
81805
- })) {
81806
- haveFoundInteriorPoint = true;
81807
- }
81808
- if (!booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
81809
- ignoreEndVertices: false
81810
- })) {
81811
- return false;
81812
- }
81813
- }
81814
- return haveFoundInteriorPoint;
81815
- }
81816
- function isLineInPoly(polygon2, linestring) {
81817
- let output = false;
81818
- let i2 = 0;
81819
- const polyBbox = bbox$1(polygon2);
81820
- const lineBbox = bbox$1(linestring);
81821
- if (!doBBoxOverlap(polyBbox, lineBbox)) {
81822
- return false;
81823
- }
81824
- for (i2; i2 < linestring.coordinates.length - 1; i2++) {
81825
- const midPoint = getMidpoint(
81826
- linestring.coordinates[i2],
81827
- linestring.coordinates[i2 + 1]
81828
- );
81829
- if (booleanPointInPolygon({ type: "Point", coordinates: midPoint }, polygon2, {
81830
- ignoreBoundary: true
81831
- })) {
81832
- output = true;
81833
- break;
81834
- }
81835
- }
81836
- return output;
81837
- }
81838
- function isPolyInPoly(feature1, feature2) {
81839
- if (feature1.type === "Feature" && feature1.geometry === null) {
81840
- return false;
81841
- }
81842
- if (feature2.type === "Feature" && feature2.geometry === null) {
81843
- return false;
81844
- }
81845
- const poly1Bbox = bbox$1(feature1);
81846
- const poly2Bbox = bbox$1(feature2);
81847
- if (!doBBoxOverlap(poly1Bbox, poly2Bbox)) {
81848
- return false;
81849
- }
81850
- const coords = getGeom(feature2).coordinates;
81851
- for (const ring of coords) {
81852
- for (const coord of ring) {
81853
- if (!booleanPointInPolygon(coord, feature1)) {
81854
- return false;
81855
- }
81856
- }
81857
- }
81858
- return true;
81859
- }
81860
- function doBBoxOverlap(bbox1, bbox2) {
81861
- if (bbox1[0] > bbox2[0]) {
81862
- return false;
81863
- }
81864
- if (bbox1[2] < bbox2[2]) {
81865
- return false;
81866
- }
81867
- if (bbox1[1] > bbox2[1]) {
81868
- return false;
81869
- }
81870
- if (bbox1[3] < bbox2[3]) {
81871
- return false;
81872
- }
81873
- return true;
81874
- }
81875
- function compareCoords(pair1, pair2) {
81876
- return pair1[0] === pair2[0] && pair1[1] === pair2[1];
81877
- }
81878
- function getMidpoint(pair1, pair2) {
81879
- return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
81880
- }
81881
- function quickselect(arr, k, left, right, compare2) {
81882
- quickselectStep(arr, k, left || 0, right || arr.length - 1, compare2 || defaultCompare$1);
81883
- }
81884
- function quickselectStep(arr, k, left, right, compare2) {
81885
- while (right > left) {
81886
- if (right - left > 600) {
81887
- var n3 = right - left + 1;
81888
- var m = k - left + 1;
81889
- var z = Math.log(n3);
81890
- var s2 = 0.5 * Math.exp(2 * z / 3);
81891
- var sd = 0.5 * Math.sqrt(z * s2 * (n3 - s2) / n3) * (m - n3 / 2 < 0 ? -1 : 1);
81892
- var newLeft = Math.max(left, Math.floor(k - m * s2 / n3 + sd));
81893
- var newRight = Math.min(right, Math.floor(k + (n3 - m) * s2 / n3 + sd));
81894
- quickselectStep(arr, k, newLeft, newRight, compare2);
81895
- }
81896
- var t = arr[k];
81897
- var i2 = left;
81898
- var j = right;
81899
- swap(arr, left, k);
81900
- if (compare2(arr[right], t) > 0) swap(arr, left, right);
81901
- while (i2 < j) {
81902
- swap(arr, i2, j);
81903
- i2++;
81904
- j--;
81905
- while (compare2(arr[i2], t) < 0) i2++;
81906
- while (compare2(arr[j], t) > 0) j--;
81907
- }
81908
- if (compare2(arr[left], t) === 0) swap(arr, left, j);
81909
- else {
81910
- j++;
81911
- swap(arr, j, right);
81912
- }
81913
- if (j <= k) left = j + 1;
81914
- if (k <= j) right = j - 1;
81915
- }
81916
- }
81917
- function swap(arr, i2, j) {
81918
- var tmp = arr[i2];
81919
- arr[i2] = arr[j];
81920
- arr[j] = tmp;
81921
- }
81922
- function defaultCompare$1(a2, b) {
81923
- return a2 < b ? -1 : a2 > b ? 1 : 0;
81924
- }
81925
- class RBush {
81926
- constructor(maxEntries = 9) {
81927
- this._maxEntries = Math.max(4, maxEntries);
81928
- this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
81929
- this.clear();
81930
- }
81931
- all() {
81932
- return this._all(this.data, []);
81933
- }
81934
- search(bbox2) {
81935
- let node2 = this.data;
81936
- const result = [];
81937
- if (!intersects(bbox2, node2)) return result;
81938
- const toBBox = this.toBBox;
81939
- const nodesToSearch = [];
81940
- while (node2) {
81941
- for (let i2 = 0; i2 < node2.children.length; i2++) {
81942
- const child = node2.children[i2];
81943
- const childBBox = node2.leaf ? toBBox(child) : child;
81944
- if (intersects(bbox2, childBBox)) {
81945
- if (node2.leaf) result.push(child);
81946
- else if (contains$1(bbox2, childBBox)) this._all(child, result);
81947
- else nodesToSearch.push(child);
81948
- }
81949
- }
81950
- node2 = nodesToSearch.pop();
81951
- }
81952
- return result;
81953
- }
81954
- collides(bbox2) {
81955
- let node2 = this.data;
81956
- if (!intersects(bbox2, node2)) return false;
81957
- const nodesToSearch = [];
81958
- while (node2) {
81959
- for (let i2 = 0; i2 < node2.children.length; i2++) {
81960
- const child = node2.children[i2];
81961
- const childBBox = node2.leaf ? this.toBBox(child) : child;
81962
- if (intersects(bbox2, childBBox)) {
81963
- if (node2.leaf || contains$1(bbox2, childBBox)) return true;
81964
- nodesToSearch.push(child);
81965
- }
81966
- }
81967
- node2 = nodesToSearch.pop();
81968
- }
81969
- return false;
81970
- }
81971
- load(data) {
81972
- if (!(data && data.length)) return this;
81973
- if (data.length < this._minEntries) {
81974
- for (let i2 = 0; i2 < data.length; i2++) {
81975
- this.insert(data[i2]);
81976
- }
81977
- return this;
81978
- }
81979
- let node2 = this._build(data.slice(), 0, data.length - 1, 0);
81980
- if (!this.data.children.length) {
81981
- this.data = node2;
81982
- } else if (this.data.height === node2.height) {
81983
- this._splitRoot(this.data, node2);
81984
- } else {
81985
- if (this.data.height < node2.height) {
81986
- const tmpNode = this.data;
81987
- this.data = node2;
81988
- node2 = tmpNode;
81989
- }
81990
- this._insert(node2, this.data.height - node2.height - 1, true);
81991
- }
81992
- return this;
81993
- }
81994
- insert(item) {
81995
- if (item) this._insert(item, this.data.height - 1);
81996
- return this;
81997
- }
81998
- clear() {
81999
- this.data = createNode([]);
82000
- return this;
82001
- }
82002
- remove(item, equalsFn) {
82003
- if (!item) return this;
82004
- let node2 = this.data;
82005
- const bbox2 = this.toBBox(item);
82006
- const path = [];
82007
- const indexes = [];
82008
- let i2, parent, goingUp;
82009
- while (node2 || path.length) {
82010
- if (!node2) {
82011
- node2 = path.pop();
82012
- parent = path[path.length - 1];
82013
- i2 = indexes.pop();
82014
- goingUp = true;
82015
- }
82016
- if (node2.leaf) {
82017
- const index2 = findItem(item, node2.children, equalsFn);
82018
- if (index2 !== -1) {
82019
- node2.children.splice(index2, 1);
82020
- path.push(node2);
82021
- this._condense(path);
82022
- return this;
82023
- }
82024
- }
82025
- if (!goingUp && !node2.leaf && contains$1(node2, bbox2)) {
82026
- path.push(node2);
82027
- indexes.push(i2);
82028
- i2 = 0;
82029
- parent = node2;
82030
- node2 = node2.children[0];
82031
- } else if (parent) {
82032
- i2++;
82033
- node2 = parent.children[i2];
82034
- goingUp = false;
82035
- } else node2 = null;
82036
- }
82037
- return this;
82038
- }
82039
- toBBox(item) {
82040
- return item;
82041
- }
82042
- compareMinX(a2, b) {
82043
- return a2.minX - b.minX;
82044
- }
82045
- compareMinY(a2, b) {
82046
- return a2.minY - b.minY;
82047
- }
82048
- toJSON() {
82049
- return this.data;
82050
- }
82051
- fromJSON(data) {
82052
- this.data = data;
82053
- return this;
82054
- }
82055
- _all(node2, result) {
82056
- const nodesToSearch = [];
82057
- while (node2) {
82058
- if (node2.leaf) result.push(...node2.children);
82059
- else nodesToSearch.push(...node2.children);
82060
- node2 = nodesToSearch.pop();
82061
- }
82062
- return result;
82063
- }
82064
- _build(items, left, right, height) {
82065
- const N2 = right - left + 1;
82066
- let M = this._maxEntries;
82067
- let node2;
82068
- if (N2 <= M) {
82069
- node2 = createNode(items.slice(left, right + 1));
82070
- calcBBox(node2, this.toBBox);
82071
- return node2;
82072
- }
82073
- if (!height) {
82074
- height = Math.ceil(Math.log(N2) / Math.log(M));
82075
- M = Math.ceil(N2 / Math.pow(M, height - 1));
82076
- }
82077
- node2 = createNode([]);
82078
- node2.leaf = false;
82079
- node2.height = height;
82080
- const N22 = Math.ceil(N2 / M);
82081
- const N1 = N22 * Math.ceil(Math.sqrt(M));
82082
- multiSelect(items, left, right, N1, this.compareMinX);
82083
- for (let i2 = left; i2 <= right; i2 += N1) {
82084
- const right2 = Math.min(i2 + N1 - 1, right);
82085
- multiSelect(items, i2, right2, N22, this.compareMinY);
82086
- for (let j = i2; j <= right2; j += N22) {
82087
- const right3 = Math.min(j + N22 - 1, right2);
82088
- node2.children.push(this._build(items, j, right3, height - 1));
82089
- }
82090
- }
82091
- calcBBox(node2, this.toBBox);
82092
- return node2;
82093
- }
82094
- _chooseSubtree(bbox2, node2, level, path) {
82095
- while (true) {
82096
- path.push(node2);
82097
- if (node2.leaf || path.length - 1 === level) break;
82098
- let minArea = Infinity;
82099
- let minEnlargement = Infinity;
82100
- let targetNode;
82101
- for (let i2 = 0; i2 < node2.children.length; i2++) {
82102
- const child = node2.children[i2];
82103
- const area2 = bboxArea(child);
82104
- const enlargement = enlargedArea(bbox2, child) - area2;
82105
- if (enlargement < minEnlargement) {
82106
- minEnlargement = enlargement;
82107
- minArea = area2 < minArea ? area2 : minArea;
82108
- targetNode = child;
82109
- } else if (enlargement === minEnlargement) {
82110
- if (area2 < minArea) {
82111
- minArea = area2;
82112
- targetNode = child;
82113
- }
82114
- }
82115
- }
82116
- node2 = targetNode || node2.children[0];
82117
- }
82118
- return node2;
82119
- }
82120
- _insert(item, level, isNode2) {
82121
- const bbox2 = isNode2 ? item : this.toBBox(item);
82122
- const insertPath = [];
82123
- const node2 = this._chooseSubtree(bbox2, this.data, level, insertPath);
82124
- node2.children.push(item);
82125
- extend(node2, bbox2);
82126
- while (level >= 0) {
82127
- if (insertPath[level].children.length > this._maxEntries) {
82128
- this._split(insertPath, level);
82129
- level--;
82130
- } else break;
82131
- }
82132
- this._adjustParentBBoxes(bbox2, insertPath, level);
82133
- }
82134
- // split overflowed node into two
82135
- _split(insertPath, level) {
82136
- const node2 = insertPath[level];
82137
- const M = node2.children.length;
82138
- const m = this._minEntries;
82139
- this._chooseSplitAxis(node2, m, M);
82140
- const splitIndex = this._chooseSplitIndex(node2, m, M);
82141
- const newNode = createNode(node2.children.splice(splitIndex, node2.children.length - splitIndex));
82142
- newNode.height = node2.height;
82143
- newNode.leaf = node2.leaf;
82144
- calcBBox(node2, this.toBBox);
82145
- calcBBox(newNode, this.toBBox);
82146
- if (level) insertPath[level - 1].children.push(newNode);
82147
- else this._splitRoot(node2, newNode);
82148
- }
82149
- _splitRoot(node2, newNode) {
82150
- this.data = createNode([node2, newNode]);
82151
- this.data.height = node2.height + 1;
82152
- this.data.leaf = false;
82153
- calcBBox(this.data, this.toBBox);
82154
- }
82155
- _chooseSplitIndex(node2, m, M) {
82156
- let index2;
82157
- let minOverlap = Infinity;
82158
- let minArea = Infinity;
82159
- for (let i2 = m; i2 <= M - m; i2++) {
82160
- const bbox1 = distBBox(node2, 0, i2, this.toBBox);
82161
- const bbox2 = distBBox(node2, i2, M, this.toBBox);
82162
- const overlap = intersectionArea(bbox1, bbox2);
82163
- const area2 = bboxArea(bbox1) + bboxArea(bbox2);
82164
- if (overlap < minOverlap) {
82165
- minOverlap = overlap;
82166
- index2 = i2;
82167
- minArea = area2 < minArea ? area2 : minArea;
82168
- } else if (overlap === minOverlap) {
82169
- if (area2 < minArea) {
82170
- minArea = area2;
82171
- index2 = i2;
82172
- }
82173
- }
82174
- }
82175
- return index2 || M - m;
82176
- }
82177
- // sorts node children by the best axis for split
82178
- _chooseSplitAxis(node2, m, M) {
82179
- const compareMinX = node2.leaf ? this.compareMinX : compareNodeMinX;
82180
- const compareMinY = node2.leaf ? this.compareMinY : compareNodeMinY;
82181
- const xMargin = this._allDistMargin(node2, m, M, compareMinX);
82182
- const yMargin = this._allDistMargin(node2, m, M, compareMinY);
82183
- if (xMargin < yMargin) node2.children.sort(compareMinX);
82184
- }
82185
- // total margin of all possible split distributions where each node is at least m full
82186
- _allDistMargin(node2, m, M, compare2) {
82187
- node2.children.sort(compare2);
82188
- const toBBox = this.toBBox;
82189
- const leftBBox = distBBox(node2, 0, m, toBBox);
82190
- const rightBBox = distBBox(node2, M - m, M, toBBox);
82191
- let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
82192
- for (let i2 = m; i2 < M - m; i2++) {
82193
- const child = node2.children[i2];
82194
- extend(leftBBox, node2.leaf ? toBBox(child) : child);
82195
- margin += bboxMargin(leftBBox);
82196
- }
82197
- for (let i2 = M - m - 1; i2 >= m; i2--) {
82198
- const child = node2.children[i2];
82199
- extend(rightBBox, node2.leaf ? toBBox(child) : child);
82200
- margin += bboxMargin(rightBBox);
82201
- }
82202
- return margin;
82203
- }
82204
- _adjustParentBBoxes(bbox2, path, level) {
82205
- for (let i2 = level; i2 >= 0; i2--) {
82206
- extend(path[i2], bbox2);
82207
- }
82208
- }
82209
- _condense(path) {
82210
- for (let i2 = path.length - 1, siblings; i2 >= 0; i2--) {
82211
- if (path[i2].children.length === 0) {
82212
- if (i2 > 0) {
82213
- siblings = path[i2 - 1].children;
82214
- siblings.splice(siblings.indexOf(path[i2]), 1);
82215
- } else this.clear();
82216
- } else calcBBox(path[i2], this.toBBox);
82217
- }
82218
- }
82219
- }
82220
- function findItem(item, items, equalsFn) {
82221
- if (!equalsFn) return items.indexOf(item);
82222
- for (let i2 = 0; i2 < items.length; i2++) {
82223
- if (equalsFn(item, items[i2])) return i2;
82224
- }
82225
- return -1;
82226
- }
82227
- function calcBBox(node2, toBBox) {
82228
- distBBox(node2, 0, node2.children.length, toBBox, node2);
82229
- }
82230
- function distBBox(node2, k, p, toBBox, destNode) {
82231
- if (!destNode) destNode = createNode(null);
82232
- destNode.minX = Infinity;
82233
- destNode.minY = Infinity;
82234
- destNode.maxX = -Infinity;
82235
- destNode.maxY = -Infinity;
82236
- for (let i2 = k; i2 < p; i2++) {
82237
- const child = node2.children[i2];
82238
- extend(destNode, node2.leaf ? toBBox(child) : child);
82239
- }
82240
- return destNode;
82241
- }
82242
- function extend(a2, b) {
82243
- a2.minX = Math.min(a2.minX, b.minX);
82244
- a2.minY = Math.min(a2.minY, b.minY);
82245
- a2.maxX = Math.max(a2.maxX, b.maxX);
82246
- a2.maxY = Math.max(a2.maxY, b.maxY);
82247
- return a2;
82248
- }
82249
- function compareNodeMinX(a2, b) {
82250
- return a2.minX - b.minX;
82251
- }
82252
- function compareNodeMinY(a2, b) {
82253
- return a2.minY - b.minY;
82254
- }
82255
- function bboxArea(a2) {
82256
- return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
82257
- }
82258
- function bboxMargin(a2) {
82259
- return a2.maxX - a2.minX + (a2.maxY - a2.minY);
82260
- }
82261
- function enlargedArea(a2, b) {
82262
- 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));
82263
- }
82264
- function intersectionArea(a2, b) {
82265
- const minX = Math.max(a2.minX, b.minX);
82266
- const minY = Math.max(a2.minY, b.minY);
82267
- const maxX = Math.min(a2.maxX, b.maxX);
82268
- const maxY = Math.min(a2.maxY, b.maxY);
82269
- return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
82270
- }
82271
- function contains$1(a2, b) {
82272
- return a2.minX <= b.minX && a2.minY <= b.minY && b.maxX <= a2.maxX && b.maxY <= a2.maxY;
82273
- }
82274
- function intersects(a2, b) {
82275
- return b.minX <= a2.maxX && b.minY <= a2.maxY && b.maxX >= a2.minX && b.maxY >= a2.minY;
82276
- }
82277
- function createNode(children) {
82278
- return {
82279
- children,
82280
- height: 1,
82281
- leaf: true,
82282
- minX: Infinity,
82283
- minY: Infinity,
82284
- maxX: -Infinity,
82285
- maxY: -Infinity
82286
- };
82287
- }
82288
- function multiSelect(arr, left, right, n3, compare2) {
82289
- const stack2 = [left, right];
82290
- while (stack2.length) {
82291
- right = stack2.pop();
82292
- left = stack2.pop();
82293
- if (right - left <= n3) continue;
82294
- const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
82295
- quickselect(arr, mid, left, right, compare2);
82296
- stack2.push(left, mid, mid, right);
82297
- }
82298
- }
82299
- function geojsonRbush(maxEntries) {
82300
- var tree = new RBush(maxEntries);
82301
- tree.insert = function(feature2) {
82302
- if (feature2.type !== "Feature") throw new Error("invalid feature");
82303
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
82304
- return RBush.prototype.insert.call(this, feature2);
82305
- };
82306
- tree.load = function(features) {
82307
- var load2 = [];
82308
- if (Array.isArray(features)) {
82309
- features.forEach(function(feature2) {
82310
- if (feature2.type !== "Feature") throw new Error("invalid features");
82311
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
82312
- load2.push(feature2);
82313
- });
82314
- } else {
82315
- featureEach(features, function(feature2) {
82316
- if (feature2.type !== "Feature") throw new Error("invalid features");
82317
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
82318
- load2.push(feature2);
82319
- });
82320
- }
82321
- return RBush.prototype.load.call(this, load2);
82322
- };
82323
- tree.remove = function(feature2, equals2) {
82324
- if (feature2.type !== "Feature") throw new Error("invalid feature");
82325
- feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
82326
- return RBush.prototype.remove.call(this, feature2, equals2);
82327
- };
82328
- tree.clear = function() {
82329
- return RBush.prototype.clear.call(this);
82330
- };
82331
- tree.search = function(geojson) {
82332
- var features = RBush.prototype.search.call(this, this.toBBox(geojson));
82333
- return featureCollection(features);
82334
- };
82335
- tree.collides = function(geojson) {
82336
- return RBush.prototype.collides.call(this, this.toBBox(geojson));
82337
- };
82338
- tree.all = function() {
82339
- var features = RBush.prototype.all.call(this);
82340
- return featureCollection(features);
82341
- };
82342
- tree.toJSON = function() {
82343
- return RBush.prototype.toJSON.call(this);
82344
- };
82345
- tree.fromJSON = function(json) {
82346
- return RBush.prototype.fromJSON.call(this, json);
82347
- };
82348
- tree.toBBox = function(geojson) {
82349
- var bbox2;
82350
- if (geojson.bbox) bbox2 = geojson.bbox;
82351
- else if (Array.isArray(geojson) && geojson.length === 4) bbox2 = geojson;
82352
- else if (Array.isArray(geojson) && geojson.length === 6)
82353
- bbox2 = [geojson[0], geojson[1], geojson[3], geojson[4]];
82354
- else if (geojson.type === "Feature") bbox2 = bbox$1(geojson);
82355
- else if (geojson.type === "FeatureCollection") bbox2 = bbox$1(geojson);
82356
- else throw new Error("invalid geojson");
82357
- return {
82358
- minX: bbox2[0],
82359
- minY: bbox2[1],
82360
- maxX: bbox2[2],
82361
- maxY: bbox2[3]
82362
- };
82363
- };
82364
- return tree;
82365
- }
82366
- function lineSegment(geojson) {
82367
- if (!geojson) {
82368
- throw new Error("geojson is required");
82369
- }
82370
- const results = [];
82371
- flattenEach(geojson, (feature2) => {
82372
- lineSegmentFeature(feature2, results);
82373
- });
82374
- return featureCollection(results);
82375
- }
82376
- function lineSegmentFeature(geojson, results) {
82377
- let coords = [];
82378
- const geometry2 = geojson.geometry;
82379
- if (geometry2 !== null) {
82380
- switch (geometry2.type) {
82381
- case "Polygon":
82382
- coords = getCoords(geometry2);
82383
- break;
82384
- case "LineString":
82385
- coords = [getCoords(geometry2)];
82386
- }
82387
- coords.forEach((coord) => {
82388
- const segments = createSegments(coord, geojson.properties);
82389
- segments.forEach((segment) => {
82390
- segment.id = results.length;
82391
- results.push(segment);
82392
- });
82393
- });
82394
- }
82395
- }
82396
- function createSegments(coords, properties) {
82397
- const segments = [];
82398
- coords.reduce((previousCoords, currentCoords) => {
82399
- const segment = lineString([previousCoords, currentCoords], properties);
82400
- segment.bbox = bbox(previousCoords, currentCoords);
82401
- segments.push(segment);
82402
- return currentCoords;
82403
- });
82404
- return segments;
82405
- }
82406
- function bbox(coords1, coords2) {
82407
- const x12 = coords1[0];
82408
- const y12 = coords1[1];
82409
- const x2 = coords2[0];
82410
- const y2 = coords2[1];
82411
- const west = x12 < x2 ? x12 : x2;
82412
- const south = y12 < y2 ? y12 : y2;
82413
- const east = x12 > x2 ? x12 : x2;
82414
- const north = y12 > y2 ? y12 : y2;
82415
- return [west, south, east, north];
82416
- }
82417
- function distance$1(from, to, options = {}) {
82418
- var coordinates1 = getCoord(from);
82419
- var coordinates2 = getCoord(to);
82420
- var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
82421
- var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
82422
- var lat1 = degreesToRadians(coordinates1[1]);
82423
- var lat2 = degreesToRadians(coordinates2[1]);
82424
- var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
82425
- return radiansToLength(
82426
- 2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
82427
- options.units
82428
- );
82429
- }
82430
- var __defProp$1 = Object.defineProperty;
82431
- var __defProps = Object.defineProperties;
82432
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
82433
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
82434
- var __hasOwnProp = Object.prototype.hasOwnProperty;
82435
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
82436
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
82437
- var __spreadValues = (a2, b) => {
82438
- for (var prop in b || (b = {}))
82439
- if (__hasOwnProp.call(b, prop))
82440
- __defNormalProp(a2, prop, b[prop]);
82441
- if (__getOwnPropSymbols)
82442
- for (var prop of __getOwnPropSymbols(b)) {
82443
- if (__propIsEnum.call(b, prop))
82444
- __defNormalProp(a2, prop, b[prop]);
82445
- }
82446
- return a2;
82447
- };
82448
- var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
82449
- function nearestPointOnLine(lines, pt, options = {}) {
82450
- if (!lines || !pt) {
82451
- throw new Error("lines and pt are required arguments");
82452
- }
82453
- const ptPos = getCoord(pt);
82454
- let closestPt = point([Infinity, Infinity], {
82455
- dist: Infinity,
82456
- index: -1,
82457
- multiFeatureIndex: -1,
82458
- location: -1
82459
- });
82460
- let length2 = 0;
82461
- flattenEach(
82462
- lines,
82463
- function(line, _featureIndex, multiFeatureIndex) {
82464
- const coords = getCoords(line);
82465
- for (let i2 = 0; i2 < coords.length - 1; i2++) {
82466
- const start = point(coords[i2]);
82467
- start.properties.dist = distance$1(pt, start, options);
82468
- const startPos = getCoord(start);
82469
- const stop = point(coords[i2 + 1]);
82470
- stop.properties.dist = distance$1(pt, stop, options);
82471
- const stopPos = getCoord(stop);
82472
- const sectionLength = distance$1(start, stop, options);
82473
- let intersectPos;
82474
- let wasEnd;
82475
- if (startPos[0] === ptPos[0] && startPos[1] === ptPos[1]) {
82476
- [intersectPos, , wasEnd] = [startPos, void 0, false];
82477
- } else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
82478
- [intersectPos, , wasEnd] = [stopPos, void 0, true];
82479
- } else {
82480
- [intersectPos, , wasEnd] = nearestPointOnSegment(
82481
- start.geometry.coordinates,
82482
- stop.geometry.coordinates,
82483
- getCoord(pt)
82484
- );
82485
- }
82486
- let intersectPt;
82487
- if (intersectPos) {
82488
- intersectPt = point(intersectPos, {
82489
- dist: distance$1(pt, intersectPos, options),
82490
- multiFeatureIndex,
82491
- location: length2 + distance$1(start, intersectPos, options)
82492
- });
82493
- }
82494
- if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
82495
- closestPt = __spreadProps(__spreadValues({}, intersectPt), {
82496
- properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
82497
- // Legacy behaviour where index progresses to next segment # if we
82498
- // went with the end point this iteration.
82499
- index: wasEnd ? i2 + 1 : i2
82500
- })
82501
- });
82502
- }
82503
- length2 += sectionLength;
82504
- }
82505
- }
82506
- );
82507
- return closestPt;
82508
- }
82509
- function dot(v12, v2) {
82510
- const [v1x, v1y, v1z] = v12;
82511
- const [v2x, v2y, v2z] = v2;
82512
- return v1x * v2x + v1y * v2y + v1z * v2z;
82513
- }
82514
- function cross(v12, v2) {
82515
- const [v1x, v1y, v1z] = v12;
82516
- const [v2x, v2y, v2z] = v2;
82517
- return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
82518
- }
82519
- function magnitude(v) {
82520
- return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
82521
- }
82522
- function angle$1(v12, v2) {
82523
- const theta = dot(v12, v2) / (magnitude(v12) * magnitude(v2));
82524
- return Math.acos(Math.min(Math.max(theta, -1), 1));
82525
- }
82526
- function lngLatToVector(a2) {
82527
- const lat = degreesToRadians(a2[1]);
82528
- const lng = degreesToRadians(a2[0]);
82529
- return [
82530
- Math.cos(lat) * Math.cos(lng),
82531
- Math.cos(lat) * Math.sin(lng),
82532
- Math.sin(lat)
82533
- ];
82534
- }
82535
- function vectorToLngLat(v) {
82536
- const [x, y, z] = v;
82537
- const lat = radiansToDegrees(Math.asin(z));
82538
- const lng = radiansToDegrees(Math.atan2(y, x));
82539
- return [lng, lat];
82540
- }
82541
- function nearestPointOnSegment(posA, posB, posC) {
82542
- const A2 = lngLatToVector(posA);
82543
- const B2 = lngLatToVector(posB);
82544
- const C3 = lngLatToVector(posC);
82545
- const [Cx, Cy, Cz] = C3;
82546
- const [D2, E2, F] = cross(A2, B2);
82547
- const a2 = E2 * Cz - F * Cy;
82548
- const b = F * Cx - D2 * Cz;
82549
- const c = D2 * Cy - E2 * Cx;
82550
- const f2 = c * E2 - b * F;
82551
- const g2 = a2 * F - c * D2;
82552
- const h = b * D2 - a2 * E2;
82553
- const t = 1 / Math.sqrt(Math.pow(f2, 2) + Math.pow(g2, 2) + Math.pow(h, 2));
82554
- const I1 = [f2 * t, g2 * t, h * t];
82555
- const I2 = [-1 * f2 * t, -1 * g2 * t, -1 * h * t];
82556
- const angleAB = angle$1(A2, B2);
82557
- const angleAI1 = angle$1(A2, I1);
82558
- const angleBI1 = angle$1(B2, I1);
82559
- const angleAI2 = angle$1(A2, I2);
82560
- const angleBI2 = angle$1(B2, I2);
82561
- let I3;
82562
- if (angleAI1 < angleAI2 && angleAI1 < angleBI2 || angleBI1 < angleAI2 && angleBI1 < angleBI2) {
82563
- I3 = I1;
82564
- } else {
82565
- I3 = I2;
82566
- }
82567
- if (angle$1(A2, I3) > angleAB || angle$1(B2, I3) > angleAB) {
82568
- if (distance$1(vectorToLngLat(I3), vectorToLngLat(A2)) <= distance$1(vectorToLngLat(I3), vectorToLngLat(B2))) {
82569
- return [vectorToLngLat(A2), true, false];
82570
- } else {
82571
- return [vectorToLngLat(B2), false, true];
82572
- }
82573
- }
82574
- return [vectorToLngLat(I3), false, false];
82575
- }
82576
- var fastDeepEqual;
82577
- var hasRequiredFastDeepEqual;
82578
- function requireFastDeepEqual() {
82579
- if (hasRequiredFastDeepEqual) return fastDeepEqual;
82580
- hasRequiredFastDeepEqual = 1;
82581
- fastDeepEqual = function equal2(a2, b) {
82582
- if (a2 === b) return true;
82583
- if (a2 && b && typeof a2 == "object" && typeof b == "object") {
82584
- if (a2.constructor !== b.constructor) return false;
82585
- var length2, i2, keys2;
82586
- if (Array.isArray(a2)) {
82587
- length2 = a2.length;
82588
- if (length2 != b.length) return false;
82589
- for (i2 = length2; i2-- !== 0; )
82590
- if (!equal2(a2[i2], b[i2])) return false;
82591
- return true;
82592
- }
82593
- if (a2.constructor === RegExp) return a2.source === b.source && a2.flags === b.flags;
82594
- if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b.valueOf();
82595
- if (a2.toString !== Object.prototype.toString) return a2.toString() === b.toString();
82596
- keys2 = Object.keys(a2);
82597
- length2 = keys2.length;
82598
- if (length2 !== Object.keys(b).length) return false;
82599
- for (i2 = length2; i2-- !== 0; )
82600
- if (!Object.prototype.hasOwnProperty.call(b, keys2[i2])) return false;
82601
- for (i2 = length2; i2-- !== 0; ) {
82602
- var key = keys2[i2];
82603
- if (!equal2(a2[key], b[key])) return false;
82604
- }
82605
- return true;
82606
- }
82607
- return a2 !== a2 && b !== b;
82608
- };
82609
- return fastDeepEqual;
82610
- }
82611
- var fastDeepEqualExports = requireFastDeepEqual();
82612
- const equal$1 = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
82613
- function lineOverlap(line1, line2, options = {}) {
82614
- options = options || {};
82615
- if (!isObject$1(options)) throw new Error("options is invalid");
82616
- var tolerance = options.tolerance || 0;
82617
- var features = [];
82618
- var tree = geojsonRbush();
82619
- const line = lineSegment(line1);
82620
- tree.load(line);
82621
- var overlapSegment;
82622
- let additionalSegments = [];
82623
- segmentEach(line2, function(segment) {
82624
- var doesOverlaps = false;
82625
- if (!segment) {
82626
- return;
82627
- }
82628
- featureEach(tree.search(segment), function(match) {
82629
- if (doesOverlaps === false) {
82630
- var coordsSegment = getCoords(segment).sort();
82631
- var coordsMatch = getCoords(match).sort();
82632
- if (equal$1(coordsSegment, coordsMatch)) {
82633
- doesOverlaps = true;
82634
- if (overlapSegment) {
82635
- overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
82636
- } else overlapSegment = segment;
82637
- } 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) {
82638
- doesOverlaps = true;
82639
- if (overlapSegment) {
82640
- overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
82641
- } else overlapSegment = segment;
82642
- } 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) {
82643
- if (overlapSegment) {
82644
- const combinedSegment = concatSegment(overlapSegment, match);
82645
- if (combinedSegment) {
82646
- overlapSegment = combinedSegment;
82647
- } else {
82648
- additionalSegments.push(match);
82649
- }
82650
- } else overlapSegment = match;
82651
- }
82652
- }
82653
- });
82654
- if (doesOverlaps === false && overlapSegment) {
82655
- features.push(overlapSegment);
82656
- if (additionalSegments.length) {
82657
- features = features.concat(additionalSegments);
82658
- additionalSegments = [];
82659
- }
82660
- overlapSegment = void 0;
82661
- }
82662
- });
82663
- if (overlapSegment) features.push(overlapSegment);
82664
- return featureCollection(features);
82665
- }
82666
- function concatSegment(line, segment) {
82667
- var coords = getCoords(segment);
82668
- var lineCoords = getCoords(line);
82669
- var start = lineCoords[0];
82670
- var end = lineCoords[lineCoords.length - 1];
82671
- var geom = line.geometry.coordinates;
82672
- if (equal$1(coords[0], start)) geom.unshift(coords[1]);
82673
- else if (equal$1(coords[0], end)) geom.push(coords[1]);
82674
- else if (equal$1(coords[1], start)) geom.unshift(coords[0]);
82675
- else if (equal$1(coords[1], end)) geom.push(coords[0]);
82676
- else return;
82677
- return line;
82678
- }
82679
- class TinyQueue {
82680
- constructor(data = [], compare2 = defaultCompare) {
82681
- this.data = data;
82682
- this.length = this.data.length;
82683
- this.compare = compare2;
82684
- if (this.length > 0) {
82685
- for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
82686
- }
82687
- }
82688
- push(item) {
82689
- this.data.push(item);
82690
- this.length++;
82691
- this._up(this.length - 1);
82692
- }
82693
- pop() {
82694
- if (this.length === 0) return void 0;
82695
- const top = this.data[0];
82696
- const bottom = this.data.pop();
82697
- this.length--;
82698
- if (this.length > 0) {
82699
- this.data[0] = bottom;
82700
- this._down(0);
82701
- }
82702
- return top;
82703
- }
82704
- peek() {
82705
- return this.data[0];
82706
- }
82707
- _up(pos) {
82708
- const { data, compare: compare2 } = this;
82709
- const item = data[pos];
82710
- while (pos > 0) {
82711
- const parent = pos - 1 >> 1;
82712
- const current = data[parent];
82713
- if (compare2(item, current) >= 0) break;
82714
- data[pos] = current;
82715
- pos = parent;
82716
- }
82717
- data[pos] = item;
82718
- }
82719
- _down(pos) {
82720
- const { data, compare: compare2 } = this;
82721
- const halfLength = this.length >> 1;
82722
- const item = data[pos];
82723
- while (pos < halfLength) {
82724
- let left = (pos << 1) + 1;
82725
- let best = data[left];
82726
- const right = left + 1;
82727
- if (right < this.length && compare2(data[right], best) < 0) {
82728
- left = right;
82729
- best = data[right];
82730
- }
82731
- if (compare2(best, item) >= 0) break;
82732
- data[pos] = best;
82733
- pos = left;
82734
- }
82735
- data[pos] = item;
82736
- }
82737
- }
82738
- function defaultCompare(a2, b) {
82739
- return a2 < b ? -1 : a2 > b ? 1 : 0;
82740
- }
82741
- function checkWhichEventIsLeft(e1, e2) {
82742
- if (e1.p.x > e2.p.x) return 1;
82743
- if (e1.p.x < e2.p.x) return -1;
82744
- if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
82745
- return 1;
82746
- }
82747
- function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
82748
- if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
82749
- if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
82750
- if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
82751
- return 1;
82752
- }
82753
- class Event {
82754
- constructor(p, featureId2, ringId2, eventId2) {
82755
- this.p = {
82756
- x: p[0],
82757
- y: p[1]
82758
- };
82759
- this.featureId = featureId2;
82760
- this.ringId = ringId2;
82761
- this.eventId = eventId2;
82762
- this.otherEvent = null;
82763
- this.isLeftEndpoint = null;
82764
- }
82765
- isSamePoint(eventToCheck) {
82766
- return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
82767
- }
82768
- }
82769
- function fillEventQueue(geojson, eventQueue) {
82770
- if (geojson.type === "FeatureCollection") {
82771
- const features = geojson.features;
82772
- for (let i2 = 0; i2 < features.length; i2++) {
82773
- processFeature(features[i2], eventQueue);
82774
- }
82775
- } else {
82776
- processFeature(geojson, eventQueue);
82777
- }
82778
- }
82779
- let featureId = 0;
82780
- let ringId = 0;
82781
- let eventId = 0;
82782
- function processFeature(featureOrGeometry, eventQueue) {
82783
- const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
82784
- let coords = geom.coordinates;
82785
- if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
82786
- if (geom.type === "LineString") coords = [[coords]];
82787
- for (let i2 = 0; i2 < coords.length; i2++) {
82788
- for (let ii = 0; ii < coords[i2].length; ii++) {
82789
- let currentP = coords[i2][ii][0];
82790
- let nextP = null;
82791
- ringId = ringId + 1;
82792
- for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
82793
- nextP = coords[i2][ii][iii + 1];
82794
- const e1 = new Event(currentP, featureId, ringId, eventId);
82795
- const e2 = new Event(nextP, featureId, ringId, eventId + 1);
82796
- e1.otherEvent = e2;
82797
- e2.otherEvent = e1;
82798
- if (checkWhichEventIsLeft(e1, e2) > 0) {
82799
- e2.isLeftEndpoint = true;
82800
- e1.isLeftEndpoint = false;
82801
- } else {
82802
- e1.isLeftEndpoint = true;
82803
- e2.isLeftEndpoint = false;
82804
- }
82805
- eventQueue.push(e1);
82806
- eventQueue.push(e2);
82807
- currentP = nextP;
82808
- eventId = eventId + 1;
82809
- }
82810
- }
82811
- }
82812
- featureId = featureId + 1;
82813
- }
82814
- let Segment$1 = class Segment {
82815
- constructor(event) {
82816
- this.leftSweepEvent = event;
82817
- this.rightSweepEvent = event.otherEvent;
82818
- }
82819
- };
82820
- function testSegmentIntersect(seg1, seg2) {
82821
- if (seg1 === null || seg2 === null) return false;
82822
- 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;
82823
- const x12 = seg1.leftSweepEvent.p.x;
82824
- const y12 = seg1.leftSweepEvent.p.y;
82825
- const x2 = seg1.rightSweepEvent.p.x;
82826
- const y2 = seg1.rightSweepEvent.p.y;
82827
- const x3 = seg2.leftSweepEvent.p.x;
82828
- const y3 = seg2.leftSweepEvent.p.y;
82829
- const x4 = seg2.rightSweepEvent.p.x;
82830
- const y4 = seg2.rightSweepEvent.p.y;
82831
- const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
82832
- const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
82833
- const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
82834
- if (denom === 0) {
82835
- if (numeA === 0 && numeB === 0) return false;
82836
- return false;
82837
- }
82838
- const uA = numeA / denom;
82839
- const uB = numeB / denom;
82840
- if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
82841
- const x = x12 + uA * (x2 - x12);
82842
- const y = y12 + uA * (y2 - y12);
82843
- return [x, y];
82844
- }
82845
- return false;
82846
- }
82847
- function runCheck(eventQueue, ignoreSelfIntersections) {
82848
- ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
82849
- const intersectionPoints = [];
82850
- const outQueue = new TinyQueue([], checkWhichSegmentHasRightEndpointFirst);
82851
- while (eventQueue.length) {
82852
- const event = eventQueue.pop();
82853
- if (event.isLeftEndpoint) {
82854
- const segment = new Segment$1(event);
82855
- for (let i2 = 0; i2 < outQueue.data.length; i2++) {
82856
- const otherSeg = outQueue.data[i2];
82857
- if (ignoreSelfIntersections) {
82858
- if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
82859
- }
82860
- const intersection2 = testSegmentIntersect(segment, otherSeg);
82861
- if (intersection2 !== false) intersectionPoints.push(intersection2);
82862
- }
82863
- outQueue.push(segment);
82864
- } else if (event.isLeftEndpoint === false) {
82865
- outQueue.pop();
82866
- }
82867
- }
82868
- return intersectionPoints;
82869
- }
82870
- function sweeplineIntersections$1(geojson, ignoreSelfIntersections) {
82871
- const eventQueue = new TinyQueue([], checkWhichEventIsLeft);
82872
- fillEventQueue(geojson, eventQueue);
82873
- return runCheck(eventQueue, ignoreSelfIntersections);
82874
- }
82875
- const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
82876
- __proto__: null,
82877
- default: sweeplineIntersections$1
82878
- }, Symbol.toStringTag, { value: "Module" }));
82879
- var sweeplineIntersections = sweeplineIntersections$1;
82880
- function lineIntersect(line1, line2, options = {}) {
82881
- const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
82882
- let features = [];
82883
- if (line1.type === "FeatureCollection")
82884
- features = features.concat(line1.features);
82885
- else if (line1.type === "Feature") features.push(line1);
82886
- else if (line1.type === "LineString" || line1.type === "Polygon" || line1.type === "MultiLineString" || line1.type === "MultiPolygon") {
82887
- features.push(feature$1(line1));
82888
- }
82889
- if (line2.type === "FeatureCollection")
82890
- features = features.concat(line2.features);
82891
- else if (line2.type === "Feature") features.push(line2);
82892
- else if (line2.type === "LineString" || line2.type === "Polygon" || line2.type === "MultiLineString" || line2.type === "MultiPolygon") {
82893
- features.push(feature$1(line2));
82894
- }
82895
- const intersections = sweeplineIntersections(
82896
- featureCollection(features),
82897
- ignoreSelfIntersections
82898
- );
82899
- let results = [];
82900
- if (removeDuplicates) {
82901
- const unique2 = {};
82902
- intersections.forEach((intersection2) => {
82903
- const key = intersection2.join(",");
82904
- if (!unique2[key]) {
82905
- unique2[key] = true;
82906
- results.push(intersection2);
82907
- }
82908
- });
82909
- } else {
82910
- results = intersections;
82911
- }
82912
- return featureCollection(results.map((r2) => point(r2)));
82913
- }
82914
- var __defProp = Object.defineProperty;
82915
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
82916
- var _GeojsonEquality = class _GeojsonEquality2 {
82917
- constructor(opts) {
82918
- this.direction = false;
82919
- this.compareProperties = true;
82920
- var _a2, _b, _c;
82921
- this.precision = 10 ** -((_a2 = opts == null ? void 0 : opts.precision) != null ? _a2 : 17);
82922
- this.direction = (_b = opts == null ? void 0 : opts.direction) != null ? _b : false;
82923
- this.compareProperties = (_c = opts == null ? void 0 : opts.compareProperties) != null ? _c : true;
82924
- }
82925
- compare(g1, g2) {
82926
- if (g1.type !== g2.type) {
82927
- return false;
82928
- }
82929
- if (!sameLength(g1, g2)) {
82930
- return false;
82931
- }
82932
- switch (g1.type) {
82933
- case "Point":
82934
- return this.compareCoord(g1.coordinates, g2.coordinates);
82935
- case "LineString":
82936
- return this.compareLine(g1.coordinates, g2.coordinates);
82937
- case "Polygon":
82938
- return this.comparePolygon(g1, g2);
82939
- case "GeometryCollection":
82940
- return this.compareGeometryCollection(g1, g2);
82941
- case "Feature":
82942
- return this.compareFeature(g1, g2);
82943
- case "FeatureCollection":
82944
- return this.compareFeatureCollection(g1, g2);
82945
- default:
82946
- if (g1.type.startsWith("Multi")) {
82947
- const g1s = explode(g1);
82948
- const g2s = explode(
82949
- g2
82950
- );
82951
- return g1s.every(
82952
- (g1part) => g2s.some((g2part) => this.compare(g1part, g2part))
82953
- );
82954
- }
82955
- }
82956
- return false;
82957
- }
82958
- compareCoord(c1, c2) {
82959
- return c1.length === c2.length && c1.every((c, i2) => Math.abs(c - c2[i2]) < this.precision);
82960
- }
82961
- compareLine(path1, path2, ind = 0, isPoly = false) {
82962
- if (!sameLength(path1, path2)) {
82963
- return false;
82964
- }
82965
- const p1 = path1;
82966
- let p2 = path2;
82967
- if (isPoly && !this.compareCoord(p1[0], p2[0])) {
82968
- const startIndex = this.fixStartIndex(p2, p1);
82969
- if (!startIndex) {
82970
- return false;
82971
- } else {
82972
- p2 = startIndex;
82973
- }
82974
- }
82975
- const sameDirection = this.compareCoord(p1[ind], p2[ind]);
82976
- if (this.direction || sameDirection) {
82977
- return this.comparePath(p1, p2);
82978
- } else {
82979
- if (this.compareCoord(p1[ind], p2[p2.length - (1 + ind)])) {
82980
- return this.comparePath(p1.slice().reverse(), p2);
82981
- }
82982
- return false;
82983
- }
82984
- }
82985
- fixStartIndex(sourcePath, targetPath) {
82986
- let correctPath, ind = -1;
82987
- for (let i2 = 0; i2 < sourcePath.length; i2++) {
82988
- if (this.compareCoord(sourcePath[i2], targetPath[0])) {
82989
- ind = i2;
82990
- break;
82991
- }
82992
- }
82993
- if (ind >= 0) {
82994
- correctPath = [].concat(
82995
- sourcePath.slice(ind, sourcePath.length),
82996
- sourcePath.slice(1, ind + 1)
82997
- );
82998
- }
82999
- return correctPath;
83000
- }
83001
- comparePath(p1, p2) {
83002
- return p1.every((c, i2) => this.compareCoord(c, p2[i2]));
83003
- }
83004
- comparePolygon(g1, g2) {
83005
- if (this.compareLine(g1.coordinates[0], g2.coordinates[0], 1, true)) {
83006
- const holes1 = g1.coordinates.slice(1, g1.coordinates.length);
83007
- const holes2 = g2.coordinates.slice(1, g2.coordinates.length);
83008
- return holes1.every(
83009
- (h1) => holes2.some((h2) => this.compareLine(h1, h2, 1, true))
83010
- );
83011
- }
83012
- return false;
83013
- }
83014
- compareGeometryCollection(g1, g2) {
83015
- return sameLength(g1.geometries, g2.geometries) && this.compareBBox(g1, g2) && g1.geometries.every((g3, i2) => this.compare(g3, g2.geometries[i2]));
83016
- }
83017
- compareFeature(g1, g2) {
83018
- return g1.id === g2.id && (this.compareProperties ? equal(g1.properties, g2.properties) : true) && this.compareBBox(g1, g2) && this.compare(g1.geometry, g2.geometry);
83019
- }
83020
- compareFeatureCollection(g1, g2) {
83021
- return sameLength(g1.features, g2.features) && this.compareBBox(g1, g2) && g1.features.every((f2, i2) => this.compare(f2, g2.features[i2]));
83022
- }
83023
- compareBBox(g1, g2) {
83024
- return Boolean(!g1.bbox && !g2.bbox) || (g1.bbox && g2.bbox ? this.compareCoord(g1.bbox, g2.bbox) : false);
83025
- }
83026
- };
83027
- __name(_GeojsonEquality, "GeojsonEquality");
83028
- var GeojsonEquality = _GeojsonEquality;
83029
- function sameLength(g1, g2) {
83030
- return g1.coordinates ? g1.coordinates.length === g2.coordinates.length : g1.length === g2.length;
83031
- }
83032
- __name(sameLength, "sameLength");
83033
- function explode(g2) {
83034
- return g2.coordinates.map((part) => ({
83035
- type: g2.type.replace("Multi", ""),
83036
- coordinates: part
83037
- }));
83038
- }
83039
- __name(explode, "explode");
83040
- function geojsonEquality(g1, g2, opts) {
83041
- const eq2 = new GeojsonEquality(opts);
83042
- return eq2.compare(g1, g2);
83043
- }
83044
- __name(geojsonEquality, "geojsonEquality");
83045
- function equal(object1, object2) {
83046
- if (object1 === null && object2 === null) {
83047
- return true;
83048
- }
83049
- if (object1 === null || object2 === null) {
83050
- return false;
83051
- }
83052
- const objKeys1 = Object.keys(object1);
83053
- const objKeys2 = Object.keys(object2);
83054
- if (objKeys1.length !== objKeys2.length) return false;
83055
- for (var key of objKeys1) {
83056
- const value1 = object1[key];
83057
- const value2 = object2[key];
83058
- const isObjects = isObject(value1) && isObject(value2);
83059
- if (isObjects && !equal(value1, value2) || !isObjects && value1 !== value2) {
83060
- return false;
83061
- }
83062
- }
83063
- return true;
83064
- }
83065
- __name(equal, "equal");
83066
- var isObject = /* @__PURE__ */ __name((object2) => {
83067
- return object2 != null && typeof object2 === "object";
83068
- }, "isObject");
83069
- function booleanOverlap(feature1, feature2) {
83070
- const geom1 = getGeom(feature1);
83071
- const geom2 = getGeom(feature2);
83072
- const type1 = geom1.type;
83073
- const type2 = geom2.type;
83074
- if (type1 === "MultiPoint" && type2 !== "MultiPoint" || (type1 === "LineString" || type1 === "MultiLineString") && type2 !== "LineString" && type2 !== "MultiLineString" || (type1 === "Polygon" || type1 === "MultiPolygon") && type2 !== "Polygon" && type2 !== "MultiPolygon") {
83075
- throw new Error("features must be of the same type");
83076
- }
83077
- if (type1 === "Point") throw new Error("Point geometry not supported");
83078
- if (geojsonEquality(feature1, feature2, { precision: 6 }))
83079
- return false;
83080
- let overlap = 0;
83081
- switch (type1) {
83082
- case "MultiPoint":
83083
- for (var i2 = 0; i2 < geom1.coordinates.length; i2++) {
83084
- for (var j = 0; j < geom2.coordinates.length; j++) {
83085
- var coord1 = geom1.coordinates[i2];
83086
- var coord2 = geom2.coordinates[j];
83087
- if (coord1[0] === coord2[0] && coord1[1] === coord2[1]) {
83088
- return true;
83089
- }
83090
- }
83091
- }
83092
- return false;
83093
- case "LineString":
83094
- case "MultiLineString":
83095
- segmentEach(feature1, (segment1) => {
83096
- segmentEach(feature2, (segment2) => {
83097
- if (lineOverlap(segment1, segment2).features.length) overlap++;
83098
- });
83099
- });
83100
- break;
83101
- case "Polygon":
83102
- case "MultiPolygon":
83103
- segmentEach(feature1, (segment1) => {
83104
- segmentEach(feature2, (segment2) => {
83105
- if (lineIntersect(segment1, segment2).features.length) overlap++;
83106
- });
83107
- });
83108
- break;
83109
- }
83110
- return overlap > 0;
81110
+ function inBBox(pt, bbox) {
81111
+ return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
83111
81112
  }
83112
81113
  var distEs6$2 = {};
83113
81114
  var style$1 = {};
@@ -83204,7 +81205,7 @@ function requireCjs$f() {
83204
81205
  case "Point":
83205
81206
  return point2(coordinates2).geometry;
83206
81207
  case "LineString":
83207
- return lineString2(coordinates2).geometry;
81208
+ return lineString(coordinates2).geometry;
83208
81209
  case "Polygon":
83209
81210
  return polygon2(coordinates2).geometry;
83210
81211
  case "MultiPoint":
@@ -83274,7 +81275,7 @@ function requireCjs$f() {
83274
81275
  options
83275
81276
  );
83276
81277
  }
83277
- function lineString2(coordinates2, properties, options = {}) {
81278
+ function lineString(coordinates2, properties, options = {}) {
83278
81279
  if (coordinates2.length < 2) {
83279
81280
  throw new Error("coordinates must be an array of two or more positions");
83280
81281
  }
@@ -83287,7 +81288,7 @@ function requireCjs$f() {
83287
81288
  function lineStrings(coordinates2, properties, options = {}) {
83288
81289
  return featureCollection2(
83289
81290
  coordinates2.map((coords) => {
83290
- return lineString2(coords, properties);
81291
+ return lineString(coords, properties);
83291
81292
  }),
83292
81293
  options
83293
81294
  );
@@ -83353,7 +81354,7 @@ function requireCjs$f() {
83353
81354
  return distance2 / factor;
83354
81355
  }
83355
81356
  function lengthToDegrees(distance2, units) {
83356
- return radiansToDegrees2(lengthToRadians(distance2, units));
81357
+ return radiansToDegrees(lengthToRadians(distance2, units));
83357
81358
  }
83358
81359
  function bearingToAzimuth(bearing) {
83359
81360
  let angle2 = bearing % 360;
@@ -83371,7 +81372,7 @@ function requireCjs$f() {
83371
81372
  }
83372
81373
  return angle2;
83373
81374
  }
83374
- function radiansToDegrees2(radians2) {
81375
+ function radiansToDegrees(radians2) {
83375
81376
  const normalisedRadians = radians2 % (2 * Math.PI);
83376
81377
  return normalisedRadians * 180 / Math.PI;
83377
81378
  }
@@ -83405,17 +81406,17 @@ function requireCjs$f() {
83405
81406
  function isObject2(input) {
83406
81407
  return input !== null && typeof input === "object" && !Array.isArray(input);
83407
81408
  }
83408
- function validateBBox(bbox2) {
83409
- if (!bbox2) {
81409
+ function validateBBox(bbox) {
81410
+ if (!bbox) {
83410
81411
  throw new Error("bbox is required");
83411
81412
  }
83412
- if (!Array.isArray(bbox2)) {
81413
+ if (!Array.isArray(bbox)) {
83413
81414
  throw new Error("bbox must be an Array");
83414
81415
  }
83415
- if (bbox2.length !== 4 && bbox2.length !== 6) {
81416
+ if (bbox.length !== 4 && bbox.length !== 6) {
83416
81417
  throw new Error("bbox must be an Array of 4 or 6 numbers");
83417
81418
  }
83418
- bbox2.forEach((num) => {
81419
+ bbox.forEach((num) => {
83419
81420
  if (!isNumber2(num)) {
83420
81421
  throw new Error("bbox must only contain numbers");
83421
81422
  }
@@ -83445,7 +81446,7 @@ function requireCjs$f() {
83445
81446
  cjs$f.isObject = isObject2;
83446
81447
  cjs$f.lengthToDegrees = lengthToDegrees;
83447
81448
  cjs$f.lengthToRadians = lengthToRadians;
83448
- cjs$f.lineString = lineString2;
81449
+ cjs$f.lineString = lineString;
83449
81450
  cjs$f.lineStrings = lineStrings;
83450
81451
  cjs$f.multiLineString = multiLineString;
83451
81452
  cjs$f.multiPoint = multiPoint;
@@ -83454,7 +81455,7 @@ function requireCjs$f() {
83454
81455
  cjs$f.points = points;
83455
81456
  cjs$f.polygon = polygon2;
83456
81457
  cjs$f.polygons = polygons2;
83457
- cjs$f.radiansToDegrees = radiansToDegrees2;
81458
+ cjs$f.radiansToDegrees = radiansToDegrees;
83458
81459
  cjs$f.radiansToLength = radiansToLength2;
83459
81460
  cjs$f.round = round2;
83460
81461
  cjs$f.validateBBox = validateBBox;
@@ -83469,7 +81470,7 @@ function requireCjs$e() {
83469
81470
  hasRequiredCjs$e = 1;
83470
81471
  Object.defineProperty(cjs$d, "__esModule", { value: true });
83471
81472
  var _helpers = /* @__PURE__ */ requireCjs$f();
83472
- function coordEach2(geojson, callback, excludeWrapCoord) {
81473
+ function coordEach(geojson, callback, excludeWrapCoord) {
83473
81474
  if (geojson === null) return;
83474
81475
  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;
83475
81476
  for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
@@ -83556,7 +81557,7 @@ function requireCjs$e() {
83556
81557
  break;
83557
81558
  case "GeometryCollection":
83558
81559
  for (j = 0; j < geometry2.geometries.length; j++)
83559
- if (coordEach2(geometry2.geometries[j], callback, excludeWrapCoord) === false)
81560
+ if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
83560
81561
  return false;
83561
81562
  break;
83562
81563
  default:
@@ -83567,7 +81568,7 @@ function requireCjs$e() {
83567
81568
  }
83568
81569
  function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
83569
81570
  var previousValue = initialValue;
83570
- coordEach2(
81571
+ coordEach(
83571
81572
  geojson,
83572
81573
  function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
83573
81574
  if (coordIndex === 0 && initialValue === void 0)
@@ -83609,7 +81610,7 @@ function requireCjs$e() {
83609
81610
  });
83610
81611
  return previousValue;
83611
81612
  }
83612
- function featureEach2(geojson, callback) {
81613
+ function featureEach(geojson, callback) {
83613
81614
  if (geojson.type === "Feature") {
83614
81615
  callback(geojson, 0);
83615
81616
  } else if (geojson.type === "FeatureCollection") {
@@ -83620,7 +81621,7 @@ function requireCjs$e() {
83620
81621
  }
83621
81622
  function featureReduce(geojson, callback, initialValue) {
83622
81623
  var previousValue = initialValue;
83623
- featureEach2(geojson, function(currentFeature, featureIndex) {
81624
+ featureEach(geojson, function(currentFeature, featureIndex) {
83624
81625
  if (featureIndex === 0 && initialValue === void 0)
83625
81626
  previousValue = currentFeature;
83626
81627
  else previousValue = callback(previousValue, currentFeature, featureIndex);
@@ -83629,7 +81630,7 @@ function requireCjs$e() {
83629
81630
  }
83630
81631
  function coordAll(geojson) {
83631
81632
  var coords = [];
83632
- coordEach2(geojson, function(coord) {
81633
+ coordEach(geojson, function(coord) {
83633
81634
  coords.push(coord);
83634
81635
  });
83635
81636
  return coords;
@@ -83714,7 +81715,7 @@ function requireCjs$e() {
83714
81715
  return previousValue;
83715
81716
  }
83716
81717
  function flattenEach2(geojson, callback) {
83717
- geomEach2(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
81718
+ geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
83718
81719
  var type = geometry2 === null ? null : geometry2.type;
83719
81720
  switch (type) {
83720
81721
  case null:
@@ -83722,7 +81723,7 @@ function requireCjs$e() {
83722
81723
  case "LineString":
83723
81724
  case "Polygon":
83724
81725
  if (callback(
83725
- _helpers.feature.call(void 0, geometry2, properties, { bbox: bbox2, id }),
81726
+ _helpers.feature.call(void 0, geometry2, properties, { bbox, id }),
83726
81727
  featureIndex,
83727
81728
  0
83728
81729
  ) === false)
@@ -83770,7 +81771,7 @@ function requireCjs$e() {
83770
81771
  );
83771
81772
  return previousValue;
83772
81773
  }
83773
- function segmentEach2(geojson, callback) {
81774
+ function segmentEach(geojson, callback) {
83774
81775
  flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
83775
81776
  var segmentIndex = 0;
83776
81777
  if (!feature2.geometry) return;
@@ -83780,7 +81781,7 @@ function requireCjs$e() {
83780
81781
  var previousFeatureIndex = 0;
83781
81782
  var previousMultiIndex = 0;
83782
81783
  var prevGeomIndex = 0;
83783
- if (coordEach2(
81784
+ if (coordEach(
83784
81785
  feature2,
83785
81786
  function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
83786
81787
  if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
@@ -83814,7 +81815,7 @@ function requireCjs$e() {
83814
81815
  function segmentReduce(geojson, callback, initialValue) {
83815
81816
  var previousValue = initialValue;
83816
81817
  var started = false;
83817
- segmentEach2(
81818
+ segmentEach(
83818
81819
  geojson,
83819
81820
  function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
83820
81821
  if (started === false && initialValue === void 0)
@@ -84041,9 +82042,9 @@ function requireCjs$e() {
84041
82042
  throw new Error("geojson is invalid");
84042
82043
  }
84043
82044
  cjs$d.coordAll = coordAll;
84044
- cjs$d.coordEach = coordEach2;
82045
+ cjs$d.coordEach = coordEach;
84045
82046
  cjs$d.coordReduce = coordReduce;
84046
- cjs$d.featureEach = featureEach2;
82047
+ cjs$d.featureEach = featureEach;
84047
82048
  cjs$d.featureReduce = featureReduce;
84048
82049
  cjs$d.findPoint = findPoint;
84049
82050
  cjs$d.findSegment = findSegment;
@@ -84055,7 +82056,7 @@ function requireCjs$e() {
84055
82056
  cjs$d.lineReduce = lineReduce;
84056
82057
  cjs$d.propEach = propEach;
84057
82058
  cjs$d.propReduce = propReduce;
84058
- cjs$d.segmentEach = segmentEach2;
82059
+ cjs$d.segmentEach = segmentEach;
84059
82060
  cjs$d.segmentReduce = segmentReduce;
84060
82061
  return cjs$d;
84061
82062
  }
@@ -84065,7 +82066,7 @@ function requireCjs$d() {
84065
82066
  hasRequiredCjs$d = 1;
84066
82067
  Object.defineProperty(cjs$e, "__esModule", { value: true });
84067
82068
  var _meta = /* @__PURE__ */ requireCjs$e();
84068
- function bbox2(geojson, options = {}) {
82069
+ function bbox(geojson, options = {}) {
84069
82070
  if (geojson.bbox != null && true !== options.recompute) {
84070
82071
  return geojson.bbox;
84071
82072
  }
@@ -84086,8 +82087,8 @@ function requireCjs$d() {
84086
82087
  });
84087
82088
  return result;
84088
82089
  }
84089
- var turf_bbox_default = bbox2;
84090
- cjs$e.bbox = bbox2;
82090
+ var turf_bbox_default = bbox;
82091
+ cjs$e.bbox = bbox;
84091
82092
  cjs$e.default = turf_bbox_default;
84092
82093
  return cjs$e;
84093
82094
  }
@@ -84171,7 +82172,7 @@ function requireJs$p() {
84171
82172
  case "Point":
84172
82173
  return point2(coordinates2).geometry;
84173
82174
  case "LineString":
84174
- return lineString2(coordinates2).geometry;
82175
+ return lineString(coordinates2).geometry;
84175
82176
  case "Polygon":
84176
82177
  return polygon2(coordinates2).geometry;
84177
82178
  case "MultiPoint":
@@ -84248,7 +82249,7 @@ function requireJs$p() {
84248
82249
  }), options);
84249
82250
  }
84250
82251
  exports2.polygons = polygons2;
84251
- function lineString2(coordinates2, properties, options) {
82252
+ function lineString(coordinates2, properties, options) {
84252
82253
  if (options === void 0) {
84253
82254
  options = {};
84254
82255
  }
@@ -84261,13 +82262,13 @@ function requireJs$p() {
84261
82262
  };
84262
82263
  return feature2(geom, properties, options);
84263
82264
  }
84264
- exports2.lineString = lineString2;
82265
+ exports2.lineString = lineString;
84265
82266
  function lineStrings(coordinates2, properties, options) {
84266
82267
  if (options === void 0) {
84267
82268
  options = {};
84268
82269
  }
84269
82270
  return featureCollection2(coordinates2.map(function(coords) {
84270
- return lineString2(coords, properties);
82271
+ return lineString(coords, properties);
84271
82272
  }), options);
84272
82273
  }
84273
82274
  exports2.lineStrings = lineStrings;
@@ -84364,7 +82365,7 @@ function requireJs$p() {
84364
82365
  }
84365
82366
  exports2.lengthToRadians = lengthToRadians;
84366
82367
  function lengthToDegrees(distance2, units) {
84367
- return radiansToDegrees2(lengthToRadians(distance2, units));
82368
+ return radiansToDegrees(lengthToRadians(distance2, units));
84368
82369
  }
84369
82370
  exports2.lengthToDegrees = lengthToDegrees;
84370
82371
  function bearingToAzimuth(bearing) {
@@ -84375,11 +82376,11 @@ function requireJs$p() {
84375
82376
  return angle2;
84376
82377
  }
84377
82378
  exports2.bearingToAzimuth = bearingToAzimuth;
84378
- function radiansToDegrees2(radians2) {
82379
+ function radiansToDegrees(radians2) {
84379
82380
  var degrees2 = radians2 % (2 * Math.PI);
84380
82381
  return degrees2 * 180 / Math.PI;
84381
82382
  }
84382
- exports2.radiansToDegrees = radiansToDegrees2;
82383
+ exports2.radiansToDegrees = radiansToDegrees;
84383
82384
  function degreesToRadians2(degrees2) {
84384
82385
  var radians2 = degrees2 % 360;
84385
82386
  return radians2 * Math.PI / 180;
@@ -84427,17 +82428,17 @@ function requireJs$p() {
84427
82428
  return !!input && input.constructor === Object;
84428
82429
  }
84429
82430
  exports2.isObject = isObject2;
84430
- function validateBBox(bbox2) {
84431
- if (!bbox2) {
82431
+ function validateBBox(bbox) {
82432
+ if (!bbox) {
84432
82433
  throw new Error("bbox is required");
84433
82434
  }
84434
- if (!Array.isArray(bbox2)) {
82435
+ if (!Array.isArray(bbox)) {
84435
82436
  throw new Error("bbox must be an Array");
84436
82437
  }
84437
- if (bbox2.length !== 4 && bbox2.length !== 6) {
82438
+ if (bbox.length !== 4 && bbox.length !== 6) {
84438
82439
  throw new Error("bbox must be an Array of 4 or 6 numbers");
84439
82440
  }
84440
- bbox2.forEach(function(num) {
82441
+ bbox.forEach(function(num) {
84441
82442
  if (!isNumber2(num)) {
84442
82443
  throw new Error("bbox must only contain numbers");
84443
82444
  }
@@ -84462,22 +82463,22 @@ function requireJs$o() {
84462
82463
  hasRequiredJs$o = 1;
84463
82464
  Object.defineProperty(js$p, "__esModule", { value: true });
84464
82465
  var helpers_1 = /* @__PURE__ */ requireJs$p();
84465
- function bboxPolygon(bbox2, options) {
82466
+ function bboxPolygon(bbox, options) {
84466
82467
  if (options === void 0) {
84467
82468
  options = {};
84468
82469
  }
84469
- var west = Number(bbox2[0]);
84470
- var south = Number(bbox2[1]);
84471
- var east = Number(bbox2[2]);
84472
- var north = Number(bbox2[3]);
84473
- if (bbox2.length === 6) {
82470
+ var west = Number(bbox[0]);
82471
+ var south = Number(bbox[1]);
82472
+ var east = Number(bbox[2]);
82473
+ var north = Number(bbox[3]);
82474
+ if (bbox.length === 6) {
84474
82475
  throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");
84475
82476
  }
84476
82477
  var lowLeft = [west, south];
84477
82478
  var topLeft = [west, north];
84478
82479
  var topRight = [east, north];
84479
82480
  var lowRight = [east, south];
84480
- return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox: bbox2, id: options.id });
82481
+ return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox, id: options.id });
84481
82482
  }
84482
82483
  js$p.default = bboxPolygon;
84483
82484
  return js$p;
@@ -84492,7 +82493,7 @@ function requireJs$n() {
84492
82493
  hasRequiredJs$n = 1;
84493
82494
  Object.defineProperty(js$k, "__esModule", { value: true });
84494
82495
  var helpers = /* @__PURE__ */ requireJs$p();
84495
- function coordEach2(geojson, callback, excludeWrapCoord) {
82496
+ function coordEach(geojson, callback, excludeWrapCoord) {
84496
82497
  if (geojson === null) return;
84497
82498
  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;
84498
82499
  for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
@@ -84579,7 +82580,7 @@ function requireJs$n() {
84579
82580
  break;
84580
82581
  case "GeometryCollection":
84581
82582
  for (j = 0; j < geometry2.geometries.length; j++)
84582
- if (coordEach2(geometry2.geometries[j], callback, excludeWrapCoord) === false)
82583
+ if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
84583
82584
  return false;
84584
82585
  break;
84585
82586
  default:
@@ -84590,7 +82591,7 @@ function requireJs$n() {
84590
82591
  }
84591
82592
  function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
84592
82593
  var previousValue = initialValue;
84593
- coordEach2(
82594
+ coordEach(
84594
82595
  geojson,
84595
82596
  function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
84596
82597
  if (coordIndex === 0 && initialValue === void 0)
@@ -84632,7 +82633,7 @@ function requireJs$n() {
84632
82633
  });
84633
82634
  return previousValue;
84634
82635
  }
84635
- function featureEach2(geojson, callback) {
82636
+ function featureEach(geojson, callback) {
84636
82637
  if (geojson.type === "Feature") {
84637
82638
  callback(geojson, 0);
84638
82639
  } else if (geojson.type === "FeatureCollection") {
@@ -84643,7 +82644,7 @@ function requireJs$n() {
84643
82644
  }
84644
82645
  function featureReduce(geojson, callback, initialValue) {
84645
82646
  var previousValue = initialValue;
84646
- featureEach2(geojson, function(currentFeature, featureIndex) {
82647
+ featureEach(geojson, function(currentFeature, featureIndex) {
84647
82648
  if (featureIndex === 0 && initialValue === void 0)
84648
82649
  previousValue = currentFeature;
84649
82650
  else previousValue = callback(previousValue, currentFeature, featureIndex);
@@ -84652,7 +82653,7 @@ function requireJs$n() {
84652
82653
  }
84653
82654
  function coordAll(geojson) {
84654
82655
  var coords = [];
84655
- coordEach2(geojson, function(coord) {
82656
+ coordEach(geojson, function(coord) {
84656
82657
  coords.push(coord);
84657
82658
  });
84658
82659
  return coords;
@@ -84737,7 +82738,7 @@ function requireJs$n() {
84737
82738
  return previousValue;
84738
82739
  }
84739
82740
  function flattenEach2(geojson, callback) {
84740
- geomEach2(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
82741
+ geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
84741
82742
  var type = geometry2 === null ? null : geometry2.type;
84742
82743
  switch (type) {
84743
82744
  case null:
@@ -84745,7 +82746,7 @@ function requireJs$n() {
84745
82746
  case "LineString":
84746
82747
  case "Polygon":
84747
82748
  if (callback(
84748
- helpers.feature(geometry2, properties, { bbox: bbox2, id }),
82749
+ helpers.feature(geometry2, properties, { bbox, id }),
84749
82750
  featureIndex,
84750
82751
  0
84751
82752
  ) === false)
@@ -84793,7 +82794,7 @@ function requireJs$n() {
84793
82794
  );
84794
82795
  return previousValue;
84795
82796
  }
84796
- function segmentEach2(geojson, callback) {
82797
+ function segmentEach(geojson, callback) {
84797
82798
  flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
84798
82799
  var segmentIndex = 0;
84799
82800
  if (!feature2.geometry) return;
@@ -84803,7 +82804,7 @@ function requireJs$n() {
84803
82804
  var previousFeatureIndex = 0;
84804
82805
  var previousMultiIndex = 0;
84805
82806
  var prevGeomIndex = 0;
84806
- if (coordEach2(
82807
+ if (coordEach(
84807
82808
  feature2,
84808
82809
  function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
84809
82810
  if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
@@ -84836,7 +82837,7 @@ function requireJs$n() {
84836
82837
  function segmentReduce(geojson, callback, initialValue) {
84837
82838
  var previousValue = initialValue;
84838
82839
  var started = false;
84839
- segmentEach2(
82840
+ segmentEach(
84840
82841
  geojson,
84841
82842
  function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
84842
82843
  if (started === false && initialValue === void 0)
@@ -85058,9 +83059,9 @@ function requireJs$n() {
85058
83059
  throw new Error("geojson is invalid");
85059
83060
  }
85060
83061
  js$k.coordAll = coordAll;
85061
- js$k.coordEach = coordEach2;
83062
+ js$k.coordEach = coordEach;
85062
83063
  js$k.coordReduce = coordReduce;
85063
- js$k.featureEach = featureEach2;
83064
+ js$k.featureEach = featureEach;
85064
83065
  js$k.featureReduce = featureReduce;
85065
83066
  js$k.findPoint = findPoint;
85066
83067
  js$k.findSegment = findSegment;
@@ -85072,7 +83073,7 @@ function requireJs$n() {
85072
83073
  js$k.lineReduce = lineReduce;
85073
83074
  js$k.propEach = propEach;
85074
83075
  js$k.propReduce = propReduce;
85075
- js$k.segmentEach = segmentEach2;
83076
+ js$k.segmentEach = segmentEach;
85076
83077
  js$k.segmentReduce = segmentReduce;
85077
83078
  return js$k;
85078
83079
  }
@@ -85082,7 +83083,7 @@ function requireJs$m() {
85082
83083
  hasRequiredJs$m = 1;
85083
83084
  Object.defineProperty(js$l, "__esModule", { value: true });
85084
83085
  var meta_1 = /* @__PURE__ */ requireJs$n();
85085
- function bbox2(geojson) {
83086
+ function bbox(geojson) {
85086
83087
  var result = [Infinity, Infinity, -Infinity, -Infinity];
85087
83088
  meta_1.coordEach(geojson, function(coord) {
85088
83089
  if (result[0] > coord[0]) {
@@ -85100,8 +83101,8 @@ function requireJs$m() {
85100
83101
  });
85101
83102
  return result;
85102
83103
  }
85103
- bbox2["default"] = bbox2;
85104
- js$l.default = bbox2;
83104
+ bbox["default"] = bbox;
83105
+ js$l.default = bbox;
85105
83106
  return js$l;
85106
83107
  }
85107
83108
  var hasRequiredJs$l;
@@ -95332,7 +93333,7 @@ function length$1(object2) {
95332
93333
  return +lengthSum$1;
95333
93334
  }
95334
93335
  var coordinates = [null, null], object = { type: "LineString", coordinates };
95335
- function distance(a2, b) {
93336
+ function distance$1(a2, b) {
95336
93337
  coordinates[0] = a2;
95337
93338
  coordinates[1] = b;
95338
93339
  return length$1(object);
@@ -95385,10 +93386,10 @@ function containsGeometry(geometry2, point2) {
95385
93386
  return geometry2 && containsGeometryType.hasOwnProperty(geometry2.type) ? containsGeometryType[geometry2.type](geometry2, point2) : false;
95386
93387
  }
95387
93388
  function containsPoint(coordinates2, point2) {
95388
- return distance(coordinates2, point2) === 0;
93389
+ return distance$1(coordinates2, point2) === 0;
95389
93390
  }
95390
93391
  function containsLine(coordinates2, point2) {
95391
- var ab = distance(coordinates2[0], coordinates2[1]), ao = distance(coordinates2[0], point2), ob = distance(point2, coordinates2[1]);
93392
+ var ab = distance$1(coordinates2[0], coordinates2[1]), ao = distance$1(coordinates2[0], point2), ob = distance$1(point2, coordinates2[1]);
95392
93393
  return ao + ob <= ab + epsilon;
95393
93394
  }
95394
93395
  function containsPolygon(coordinates2, point2) {
@@ -96605,7 +94606,7 @@ const d3Geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
96605
94606
  geoConicEquidistant: conicEquidistant,
96606
94607
  geoConicEquidistantRaw: conicEquidistantRaw,
96607
94608
  geoContains: contains,
96608
- geoDistance: distance,
94609
+ geoDistance: distance$1,
96609
94610
  geoEquirectangular: equirectangular,
96610
94611
  geoEquirectangularRaw: equirectangularRaw,
96611
94612
  geoGnomonic: gnomonic,
@@ -97305,8 +95306,8 @@ function requirePolygonClipping_umd() {
97305
95306
  sort(keys2, values, left, j, compare2);
97306
95307
  sort(keys2, values, j + 1, right, compare2);
97307
95308
  }
97308
- var isInBbox2 = function isInBbox3(bbox2, point2) {
97309
- return bbox2.ll.x <= point2.x && point2.x <= bbox2.ur.x && bbox2.ll.y <= point2.y && point2.y <= bbox2.ur.y;
95309
+ var isInBbox2 = function isInBbox3(bbox, point2) {
95310
+ return bbox.ll.x <= point2.x && point2.x <= bbox.ur.x && bbox.ll.y <= point2.y && point2.y <= bbox.ur.y;
97310
95311
  };
97311
95312
  var getBboxOverlap2 = function getBboxOverlap3(b1, b2) {
97312
95313
  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;
@@ -97686,7 +95687,7 @@ function requirePolygonClipping_umd() {
97686
95687
  }
97687
95688
  }, {
97688
95689
  key: "bbox",
97689
- value: function bbox2() {
95690
+ value: function bbox() {
97690
95691
  var y12 = this.leftSE.point.y;
97691
95692
  var y2 = this.rightSE.point.y;
97692
95693
  return {
@@ -98623,7 +96624,7 @@ function requireJs$j() {
98623
96624
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
98624
96625
  }
98625
96626
  js$i.getCoord = getCoord2;
98626
- function getCoords2(coords) {
96627
+ function getCoords(coords) {
98627
96628
  if (Array.isArray(coords)) {
98628
96629
  return coords;
98629
96630
  }
@@ -98638,7 +96639,7 @@ function requireJs$j() {
98638
96639
  }
98639
96640
  throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
98640
96641
  }
98641
- js$i.getCoords = getCoords2;
96642
+ js$i.getCoords = getCoords;
98642
96643
  function containsNumber(coordinates2) {
98643
96644
  if (coordinates2.length > 1 && helpers_1.isNumber(coordinates2[0]) && helpers_1.isNumber(coordinates2[1])) {
98644
96645
  return true;
@@ -98768,7 +96769,7 @@ function requireCjs$c() {
98768
96769
  }
98769
96770
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
98770
96771
  }
98771
- function getCoords2(coords) {
96772
+ function getCoords(coords) {
98772
96773
  if (Array.isArray(coords)) {
98773
96774
  return coords;
98774
96775
  }
@@ -98870,7 +96871,7 @@ function requireCjs$c() {
98870
96871
  cjs$b.featureOf = featureOf;
98871
96872
  cjs$b.geojsonType = geojsonType;
98872
96873
  cjs$b.getCoord = getCoord2;
98873
- cjs$b.getCoords = getCoords2;
96874
+ cjs$b.getCoords = getCoords;
98874
96875
  cjs$b.getGeom = getGeom2;
98875
96876
  cjs$b.getType = getType;
98876
96877
  return cjs$b;
@@ -99343,7 +97344,7 @@ function requireFeature() {
99343
97344
  }
99344
97345
  _createClass(Feature2, [{
99345
97346
  key: "getCoords",
99346
- value: function getCoords2() {
97347
+ value: function getCoords() {
99347
97348
  return this.geoJson.geometry.coordinates;
99348
97349
  }
99349
97350
  }]);
@@ -101521,23 +99522,23 @@ var hasRequiredCjs$a;
101521
99522
  function requireCjs$a() {
101522
99523
  if (hasRequiredCjs$a) return cjs$9;
101523
99524
  hasRequiredCjs$a = 1;
101524
- var __defProp2 = Object.defineProperty;
99525
+ var __defProp = Object.defineProperty;
101525
99526
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
101526
99527
  var __getOwnPropNames = Object.getOwnPropertyNames;
101527
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
99528
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
101528
99529
  var __export = (target, all) => {
101529
99530
  for (var name2 in all)
101530
- __defProp2(target, name2, { get: all[name2], enumerable: true });
99531
+ __defProp(target, name2, { get: all[name2], enumerable: true });
101531
99532
  };
101532
99533
  var __copyProps = (to, from, except, desc) => {
101533
99534
  if (from && typeof from === "object" || typeof from === "function") {
101534
99535
  for (let key of __getOwnPropNames(from))
101535
- if (!__hasOwnProp2.call(to, key) && key !== except)
101536
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
99536
+ if (!__hasOwnProp.call(to, key) && key !== except)
99537
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
101537
99538
  }
101538
99539
  return to;
101539
99540
  };
101540
- var __toCommonJS = (mod2) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod2);
99541
+ var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
101541
99542
  var src_exports = {};
101542
99543
  __export(src_exports, {
101543
99544
  SplayTreeMap: () => SplayTreeMap,
@@ -102234,20 +100235,20 @@ function requireCjs$9() {
102234
100235
  if (hasRequiredCjs$9) return cjs$8;
102235
100236
  hasRequiredCjs$9 = 1;
102236
100237
  var __create = Object.create;
102237
- var __defProp2 = Object.defineProperty;
100238
+ var __defProp = Object.defineProperty;
102238
100239
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
102239
100240
  var __getOwnPropNames = Object.getOwnPropertyNames;
102240
100241
  var __getProtoOf = Object.getPrototypeOf;
102241
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
100242
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
102242
100243
  var __export = (target, all) => {
102243
100244
  for (var name2 in all)
102244
- __defProp2(target, name2, { get: all[name2], enumerable: true });
100245
+ __defProp(target, name2, { get: all[name2], enumerable: true });
102245
100246
  };
102246
100247
  var __copyProps = (to, from, except, desc) => {
102247
100248
  if (from && typeof from === "object" || typeof from === "function") {
102248
100249
  for (let key of __getOwnPropNames(from))
102249
- if (!__hasOwnProp2.call(to, key) && key !== except)
102250
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
100250
+ if (!__hasOwnProp.call(to, key) && key !== except)
100251
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
102251
100252
  }
102252
100253
  return to;
102253
100254
  };
@@ -102256,10 +100257,10 @@ function requireCjs$9() {
102256
100257
  // file that has been converted to a CommonJS file using a Babel-
102257
100258
  // compatible transform (i.e. "__esModule" has not been set), then set
102258
100259
  // "default" to the CommonJS "module.exports" for node compatibility.
102259
- __defProp2(target, "default", { value: mod2, enumerable: true }),
100260
+ __defProp(target, "default", { value: mod2, enumerable: true }),
102260
100261
  mod2
102261
100262
  ));
102262
- var __toCommonJS = (mod2) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod2);
100263
+ var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
102263
100264
  var src_exports = {};
102264
100265
  __export(src_exports, {
102265
100266
  difference: () => difference,
@@ -102328,8 +100329,8 @@ function requireCjs$9() {
102328
100329
  };
102329
100330
  };
102330
100331
  var precision2 = set2();
102331
- var isInBbox2 = (bbox2, point2) => {
102332
- 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);
100332
+ var isInBbox2 = (bbox, point2) => {
100333
+ 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);
102333
100334
  };
102334
100335
  var getBboxOverlap2 = (b1, b2) => {
102335
100336
  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))
@@ -103904,7 +101905,7 @@ function requireUtils$2() {
103904
101905
  utils$2.distance2d = distance2d;
103905
101906
  utils$2.mix = mix;
103906
101907
  utils$2.nearestPointOnProjectedLine = nearestPointOnProjectedLine;
103907
- utils$2.nearestPointOnLine = nearestPointOnLine2;
101908
+ utils$2.nearestPointOnLine = nearestPointOnLine;
103908
101909
  utils$2.getPickedEditHandle = getPickedEditHandle;
103909
101910
  utils$2.getPickedSnapSourceEditHandle = getPickedSnapSourceEditHandle;
103910
101911
  utils$2.getNonGuidePicks = getNonGuidePicks;
@@ -104001,12 +102002,12 @@ function requireUtils$2() {
104001
102002
  return false;
104002
102003
  }
104003
102004
  function generatePointsParallelToLinePoints(p1, p2, mapCoords) {
104004
- var lineString2 = {
102005
+ var lineString = {
104005
102006
  type: "LineString",
104006
102007
  coordinates: [p1, p2]
104007
102008
  };
104008
102009
  var pt = (0, _helpers.point)(mapCoords);
104009
- var ddistance = (0, _pointToLineDistance["default"])(pt, lineString2);
102010
+ var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
104010
102011
  var lineBearing = (0, _bearing["default"])(p1, p2);
104011
102012
  var isPointToLeftOfLine = (mapCoords[0] - p1[0]) * (p2[1] - p1[1]) - (mapCoords[1] - p1[1]) * (p2[0] - p1[0]);
104012
102013
  var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
@@ -104072,7 +102073,7 @@ function requireUtils$2() {
104072
102073
  }
104073
102074
  };
104074
102075
  }
104075
- function nearestPointOnLine2(lines, inPoint, viewport) {
102076
+ function nearestPointOnLine(lines, inPoint, viewport) {
104076
102077
  var _lines$geometry, _lines$geometry2;
104077
102078
  var mercator2;
104078
102079
  if (viewport) {
@@ -104592,8 +102593,8 @@ function requireImmutableFeatureCollection() {
104592
102593
  }
104593
102594
  function pruneMultiLineStringIfNecessary(geometry2) {
104594
102595
  for (var lineStringIndex = 0; lineStringIndex < geometry2.coordinates.length; lineStringIndex++) {
104595
- var lineString2 = geometry2.coordinates[lineStringIndex];
104596
- if (lineString2.length === 1) {
102596
+ var lineString = geometry2.coordinates[lineStringIndex];
102597
+ if (lineString.length === 1) {
104597
102598
  geometry2.coordinates.splice(lineStringIndex, 1);
104598
102599
  lineStringIndex--;
104599
102600
  }
@@ -105182,8 +103183,8 @@ function requireModifyMode() {
105182
103183
  var intermediatePoint = null;
105183
103184
  var positionIndexPrefix = [];
105184
103185
  var referencePoint = (0, _helpers.point)(mapCoords);
105185
- (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString2, prefix) {
105186
- var lineStringFeature = (0, _helpers.lineString)(lineString2);
103186
+ (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
103187
+ var lineStringFeature = (0, _helpers.lineString)(lineString);
105187
103188
  var candidateIntermediatePoint = _this.getNearestPoint(
105188
103189
  // @ts-ignore
105189
103190
  lineStringFeature,
@@ -105358,30 +103359,30 @@ function requireCjs$6() {
105358
103359
  if (hasRequiredCjs$6) return cjs$6;
105359
103360
  hasRequiredCjs$6 = 1;
105360
103361
  Object.defineProperty(cjs$6, "__esModule", { value: true });
105361
- var __defProp2 = Object.defineProperty;
105362
- var __defProps2 = Object.defineProperties;
105363
- var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
105364
- var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
105365
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
105366
- var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
105367
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
105368
- var __spreadValues2 = (a2, b) => {
103362
+ var __defProp = Object.defineProperty;
103363
+ var __defProps = Object.defineProperties;
103364
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
103365
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
103366
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
103367
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
103368
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
103369
+ var __spreadValues = (a2, b) => {
105369
103370
  for (var prop in b || (b = {}))
105370
- if (__hasOwnProp2.call(b, prop))
105371
- __defNormalProp2(a2, prop, b[prop]);
105372
- if (__getOwnPropSymbols2)
105373
- for (var prop of __getOwnPropSymbols2(b)) {
105374
- if (__propIsEnum2.call(b, prop))
105375
- __defNormalProp2(a2, prop, b[prop]);
103371
+ if (__hasOwnProp.call(b, prop))
103372
+ __defNormalProp(a2, prop, b[prop]);
103373
+ if (__getOwnPropSymbols)
103374
+ for (var prop of __getOwnPropSymbols(b)) {
103375
+ if (__propIsEnum.call(b, prop))
103376
+ __defNormalProp(a2, prop, b[prop]);
105376
103377
  }
105377
103378
  return a2;
105378
103379
  };
105379
- var __spreadProps2 = (a2, b) => __defProps2(a2, __getOwnPropDescs2(b));
103380
+ var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
105380
103381
  var _distance = /* @__PURE__ */ requireCjs$b();
105381
103382
  var _meta = /* @__PURE__ */ requireCjs$e();
105382
103383
  var _helpers = /* @__PURE__ */ requireCjs$f();
105383
103384
  var _invariant = /* @__PURE__ */ requireCjs$c();
105384
- function nearestPointOnLine2(lines, pt, options = {}) {
103385
+ function nearestPointOnLine(lines, pt, options = {}) {
105385
103386
  if (!lines || !pt) {
105386
103387
  throw new Error("lines and pt are required arguments");
105387
103388
  }
@@ -105413,7 +103414,7 @@ function requireCjs$6() {
105413
103414
  } else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
105414
103415
  [intersectPos, , wasEnd] = [stopPos, void 0, true];
105415
103416
  } else {
105416
- [intersectPos, , wasEnd] = nearestPointOnSegment2(
103417
+ [intersectPos, , wasEnd] = nearestPointOnSegment(
105417
103418
  start.geometry.coordinates,
105418
103419
  stop.geometry.coordinates,
105419
103420
  _invariant.getCoord.call(void 0, pt)
@@ -105428,8 +103429,8 @@ function requireCjs$6() {
105428
103429
  });
105429
103430
  }
105430
103431
  if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
105431
- closestPt = __spreadProps2(__spreadValues2({}, intersectPt), {
105432
- properties: __spreadProps2(__spreadValues2({}, intersectPt.properties), {
103432
+ closestPt = __spreadProps(__spreadValues({}, intersectPt), {
103433
+ properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
105433
103434
  // Legacy behaviour where index progresses to next segment # if we
105434
103435
  // went with the end point this iteration.
105435
103436
  index: wasEnd ? i2 + 1 : i2
@@ -105452,14 +103453,14 @@ function requireCjs$6() {
105452
103453
  const [v2x, v2y, v2z] = v2;
105453
103454
  return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
105454
103455
  }
105455
- function magnitude2(v) {
103456
+ function magnitude(v) {
105456
103457
  return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
105457
103458
  }
105458
103459
  function angle2(v12, v2) {
105459
- const theta = dot2(v12, v2) / (magnitude2(v12) * magnitude2(v2));
103460
+ const theta = dot2(v12, v2) / (magnitude(v12) * magnitude(v2));
105460
103461
  return Math.acos(Math.min(Math.max(theta, -1), 1));
105461
103462
  }
105462
- function lngLatToVector2(a2) {
103463
+ function lngLatToVector(a2) {
105463
103464
  const lat = _helpers.degreesToRadians.call(void 0, a2[1]);
105464
103465
  const lng = _helpers.degreesToRadians.call(void 0, a2[0]);
105465
103466
  return [
@@ -105468,16 +103469,16 @@ function requireCjs$6() {
105468
103469
  Math.sin(lat)
105469
103470
  ];
105470
103471
  }
105471
- function vectorToLngLat2(v) {
103472
+ function vectorToLngLat(v) {
105472
103473
  const [x, y, z] = v;
105473
103474
  const lat = _helpers.radiansToDegrees.call(void 0, Math.asin(z));
105474
103475
  const lng = _helpers.radiansToDegrees.call(void 0, Math.atan2(y, x));
105475
103476
  return [lng, lat];
105476
103477
  }
105477
- function nearestPointOnSegment2(posA, posB, posC) {
105478
- const A2 = lngLatToVector2(posA);
105479
- const B2 = lngLatToVector2(posB);
105480
- const C3 = lngLatToVector2(posC);
103478
+ function nearestPointOnSegment(posA, posB, posC) {
103479
+ const A2 = lngLatToVector(posA);
103480
+ const B2 = lngLatToVector(posB);
103481
+ const C3 = lngLatToVector(posC);
105481
103482
  const [Cx, Cy, Cz] = C3;
105482
103483
  const [D2, E2, F] = cross2(A2, B2);
105483
103484
  const a2 = E2 * Cz - F * Cy;
@@ -105501,17 +103502,17 @@ function requireCjs$6() {
105501
103502
  I3 = I2;
105502
103503
  }
105503
103504
  if (angle2(A2, I3) > angleAB || angle2(B2, I3) > angleAB) {
105504
- if (_distance.distance.call(void 0, vectorToLngLat2(I3), vectorToLngLat2(A2)) <= _distance.distance.call(void 0, vectorToLngLat2(I3), vectorToLngLat2(B2))) {
105505
- return [vectorToLngLat2(A2), true, false];
103505
+ if (_distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(A2)) <= _distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(B2))) {
103506
+ return [vectorToLngLat(A2), true, false];
105506
103507
  } else {
105507
- return [vectorToLngLat2(B2), false, true];
103508
+ return [vectorToLngLat(B2), false, true];
105508
103509
  }
105509
103510
  }
105510
- return [vectorToLngLat2(I3), false, false];
103511
+ return [vectorToLngLat(I3), false, false];
105511
103512
  }
105512
- var turf_nearest_point_on_line_default = nearestPointOnLine2;
103513
+ var turf_nearest_point_on_line_default = nearestPointOnLine;
105513
103514
  cjs$6.default = turf_nearest_point_on_line_default;
105514
- cjs$6.nearestPointOnLine = nearestPointOnLine2;
103515
+ cjs$6.nearestPointOnLine = nearestPointOnLine;
105515
103516
  return cjs$6;
105516
103517
  }
105517
103518
  var cjs$5 = {};
@@ -105711,8 +103712,8 @@ function requireResizeCircleMode() {
105711
103712
  var intermediatePoint = null;
105712
103713
  var positionIndexPrefix = [];
105713
103714
  var referencePoint = (0, _helpers.point)(mapCoords);
105714
- (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString2, prefix) {
105715
- var lineStringFeature = (0, _helpers.lineString)(lineString2);
103715
+ (0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
103716
+ var lineStringFeature = (0, _helpers.lineString)(lineString);
105716
103717
  var candidateIntermediatePoint = _this2.getNearestPoint(
105717
103718
  // @ts-ignore
105718
103719
  lineStringFeature,
@@ -106350,11 +104351,11 @@ function requireJs$4() {
106350
104351
  if (origin === void 0 || origin === null) origin = "centroid";
106351
104352
  if (Array.isArray(origin) || typeof origin === "object")
106352
104353
  return invariant.getCoord(origin);
106353
- var bbox2 = geojson.bbox ? geojson.bbox : turfBBox__default["default"](geojson);
106354
- var west = bbox2[0];
106355
- var south = bbox2[1];
106356
- var east = bbox2[2];
106357
- var north = bbox2[3];
104354
+ var bbox = geojson.bbox ? geojson.bbox : turfBBox__default["default"](geojson);
104355
+ var west = bbox[0];
104356
+ var south = bbox[1];
104357
+ var east = bbox[2];
104358
+ var north = bbox[3];
106358
104359
  switch (origin) {
106359
104360
  case "sw":
106360
104361
  case "southwest":
@@ -107710,9 +105711,9 @@ function requireCjs$2() {
107710
105711
  const pt = _invariant.getCoord.call(void 0, point2);
107711
105712
  const geom = _invariant.getGeom.call(void 0, polygon2);
107712
105713
  const type = geom.type;
107713
- const bbox2 = polygon2.bbox;
105714
+ const bbox = polygon2.bbox;
107714
105715
  let polys = geom.coordinates;
107715
- if (bbox2 && inBBox2(pt, bbox2) === false) {
105716
+ if (bbox && inBBox2(pt, bbox) === false) {
107716
105717
  return false;
107717
105718
  }
107718
105719
  if (type === "Polygon") {
@@ -107726,8 +105727,8 @@ function requireCjs$2() {
107726
105727
  }
107727
105728
  return result;
107728
105729
  }
107729
- function inBBox2(pt, bbox2) {
107730
- return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
105730
+ function inBBox2(pt, bbox) {
105731
+ return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
107731
105732
  }
107732
105733
  var turf_boolean_point_in_polygon_default = booleanPointInPolygon2;
107733
105734
  cjs$3.booleanPointInPolygon = booleanPointInPolygon2;
@@ -107735,6 +105736,206 @@ function requireCjs$2() {
107735
105736
  return cjs$3;
107736
105737
  }
107737
105738
  var cjs$1 = {};
105739
+ class TinyQueue {
105740
+ constructor(data = [], compare2 = defaultCompare) {
105741
+ this.data = data;
105742
+ this.length = this.data.length;
105743
+ this.compare = compare2;
105744
+ if (this.length > 0) {
105745
+ for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
105746
+ }
105747
+ }
105748
+ push(item) {
105749
+ this.data.push(item);
105750
+ this.length++;
105751
+ this._up(this.length - 1);
105752
+ }
105753
+ pop() {
105754
+ if (this.length === 0) return void 0;
105755
+ const top = this.data[0];
105756
+ const bottom = this.data.pop();
105757
+ this.length--;
105758
+ if (this.length > 0) {
105759
+ this.data[0] = bottom;
105760
+ this._down(0);
105761
+ }
105762
+ return top;
105763
+ }
105764
+ peek() {
105765
+ return this.data[0];
105766
+ }
105767
+ _up(pos) {
105768
+ const { data, compare: compare2 } = this;
105769
+ const item = data[pos];
105770
+ while (pos > 0) {
105771
+ const parent = pos - 1 >> 1;
105772
+ const current = data[parent];
105773
+ if (compare2(item, current) >= 0) break;
105774
+ data[pos] = current;
105775
+ pos = parent;
105776
+ }
105777
+ data[pos] = item;
105778
+ }
105779
+ _down(pos) {
105780
+ const { data, compare: compare2 } = this;
105781
+ const halfLength = this.length >> 1;
105782
+ const item = data[pos];
105783
+ while (pos < halfLength) {
105784
+ let left = (pos << 1) + 1;
105785
+ let best = data[left];
105786
+ const right = left + 1;
105787
+ if (right < this.length && compare2(data[right], best) < 0) {
105788
+ left = right;
105789
+ best = data[right];
105790
+ }
105791
+ if (compare2(best, item) >= 0) break;
105792
+ data[pos] = best;
105793
+ pos = left;
105794
+ }
105795
+ data[pos] = item;
105796
+ }
105797
+ }
105798
+ function defaultCompare(a2, b) {
105799
+ return a2 < b ? -1 : a2 > b ? 1 : 0;
105800
+ }
105801
+ function checkWhichEventIsLeft(e1, e2) {
105802
+ if (e1.p.x > e2.p.x) return 1;
105803
+ if (e1.p.x < e2.p.x) return -1;
105804
+ if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
105805
+ return 1;
105806
+ }
105807
+ function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
105808
+ if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
105809
+ if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
105810
+ if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
105811
+ return 1;
105812
+ }
105813
+ class Event {
105814
+ constructor(p, featureId2, ringId2, eventId2) {
105815
+ this.p = {
105816
+ x: p[0],
105817
+ y: p[1]
105818
+ };
105819
+ this.featureId = featureId2;
105820
+ this.ringId = ringId2;
105821
+ this.eventId = eventId2;
105822
+ this.otherEvent = null;
105823
+ this.isLeftEndpoint = null;
105824
+ }
105825
+ isSamePoint(eventToCheck) {
105826
+ return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
105827
+ }
105828
+ }
105829
+ function fillEventQueue(geojson, eventQueue) {
105830
+ if (geojson.type === "FeatureCollection") {
105831
+ const features = geojson.features;
105832
+ for (let i2 = 0; i2 < features.length; i2++) {
105833
+ processFeature(features[i2], eventQueue);
105834
+ }
105835
+ } else {
105836
+ processFeature(geojson, eventQueue);
105837
+ }
105838
+ }
105839
+ let featureId = 0;
105840
+ let ringId = 0;
105841
+ let eventId = 0;
105842
+ function processFeature(featureOrGeometry, eventQueue) {
105843
+ const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
105844
+ let coords = geom.coordinates;
105845
+ if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
105846
+ if (geom.type === "LineString") coords = [[coords]];
105847
+ for (let i2 = 0; i2 < coords.length; i2++) {
105848
+ for (let ii = 0; ii < coords[i2].length; ii++) {
105849
+ let currentP = coords[i2][ii][0];
105850
+ let nextP = null;
105851
+ ringId = ringId + 1;
105852
+ for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
105853
+ nextP = coords[i2][ii][iii + 1];
105854
+ const e1 = new Event(currentP, featureId, ringId, eventId);
105855
+ const e2 = new Event(nextP, featureId, ringId, eventId + 1);
105856
+ e1.otherEvent = e2;
105857
+ e2.otherEvent = e1;
105858
+ if (checkWhichEventIsLeft(e1, e2) > 0) {
105859
+ e2.isLeftEndpoint = true;
105860
+ e1.isLeftEndpoint = false;
105861
+ } else {
105862
+ e1.isLeftEndpoint = true;
105863
+ e2.isLeftEndpoint = false;
105864
+ }
105865
+ eventQueue.push(e1);
105866
+ eventQueue.push(e2);
105867
+ currentP = nextP;
105868
+ eventId = eventId + 1;
105869
+ }
105870
+ }
105871
+ }
105872
+ featureId = featureId + 1;
105873
+ }
105874
+ let Segment$1 = class Segment {
105875
+ constructor(event) {
105876
+ this.leftSweepEvent = event;
105877
+ this.rightSweepEvent = event.otherEvent;
105878
+ }
105879
+ };
105880
+ function testSegmentIntersect(seg1, seg2) {
105881
+ if (seg1 === null || seg2 === null) return false;
105882
+ 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;
105883
+ const x12 = seg1.leftSweepEvent.p.x;
105884
+ const y12 = seg1.leftSweepEvent.p.y;
105885
+ const x2 = seg1.rightSweepEvent.p.x;
105886
+ const y2 = seg1.rightSweepEvent.p.y;
105887
+ const x3 = seg2.leftSweepEvent.p.x;
105888
+ const y3 = seg2.leftSweepEvent.p.y;
105889
+ const x4 = seg2.rightSweepEvent.p.x;
105890
+ const y4 = seg2.rightSweepEvent.p.y;
105891
+ const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
105892
+ const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
105893
+ const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
105894
+ if (denom === 0) {
105895
+ if (numeA === 0 && numeB === 0) return false;
105896
+ return false;
105897
+ }
105898
+ const uA = numeA / denom;
105899
+ const uB = numeB / denom;
105900
+ if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
105901
+ const x = x12 + uA * (x2 - x12);
105902
+ const y = y12 + uA * (y2 - y12);
105903
+ return [x, y];
105904
+ }
105905
+ return false;
105906
+ }
105907
+ function runCheck(eventQueue, ignoreSelfIntersections) {
105908
+ ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
105909
+ const intersectionPoints = [];
105910
+ const outQueue = new TinyQueue([], checkWhichSegmentHasRightEndpointFirst);
105911
+ while (eventQueue.length) {
105912
+ const event = eventQueue.pop();
105913
+ if (event.isLeftEndpoint) {
105914
+ const segment = new Segment$1(event);
105915
+ for (let i2 = 0; i2 < outQueue.data.length; i2++) {
105916
+ const otherSeg = outQueue.data[i2];
105917
+ if (ignoreSelfIntersections) {
105918
+ if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
105919
+ }
105920
+ const intersection2 = testSegmentIntersect(segment, otherSeg);
105921
+ if (intersection2 !== false) intersectionPoints.push(intersection2);
105922
+ }
105923
+ outQueue.push(segment);
105924
+ } else if (event.isLeftEndpoint === false) {
105925
+ outQueue.pop();
105926
+ }
105927
+ }
105928
+ return intersectionPoints;
105929
+ }
105930
+ function sweeplineIntersections(geojson, ignoreSelfIntersections) {
105931
+ const eventQueue = new TinyQueue([], checkWhichEventIsLeft);
105932
+ fillEventQueue(geojson, eventQueue);
105933
+ return runCheck(eventQueue, ignoreSelfIntersections);
105934
+ }
105935
+ const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
105936
+ __proto__: null,
105937
+ default: sweeplineIntersections
105938
+ }, Symbol.toStringTag, { value: "Module" }));
107738
105939
  const require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(sweeplineIntersections_esm);
107739
105940
  var hasRequiredCjs$1;
107740
105941
  function requireCjs$1() {
@@ -107748,7 +105949,7 @@ function requireCjs$1() {
107748
105949
  var _sweeplineintersections = require$$1$1;
107749
105950
  var _sweeplineintersections2 = _interopRequireDefault(_sweeplineintersections);
107750
105951
  var sweeplineIntersections2 = _sweeplineintersections2.default;
107751
- function lineIntersect2(line1, line2, options = {}) {
105952
+ function lineIntersect(line1, line2, options = {}) {
107752
105953
  const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
107753
105954
  let features = [];
107754
105955
  if (line1.type === "FeatureCollection")
@@ -107782,9 +105983,9 @@ function requireCjs$1() {
107782
105983
  }
107783
105984
  return _helpers.featureCollection.call(void 0, results.map((r2) => _helpers.point.call(void 0, r2)));
107784
105985
  }
107785
- var turf_line_intersect_default = lineIntersect2;
105986
+ var turf_line_intersect_default = lineIntersect;
107786
105987
  cjs$1.default = turf_line_intersect_default;
107787
- cjs$1.lineIntersect = lineIntersect2;
105988
+ cjs$1.lineIntersect = lineIntersect;
107788
105989
  return cjs$1;
107789
105990
  }
107790
105991
  var hasRequiredSplitPolygonMode;
@@ -111648,8 +109849,8 @@ function requireDraw90degreePolygonMode() {
111648
109849
  return;
111649
109850
  }
111650
109851
  if (clickSequence.length === 3 && tentativeFeature.geometry.type === "LineString") {
111651
- var lineString2 = tentativeFeature.geometry;
111652
- clickSequence[clickSequence.length - 1] = lineString2.coordinates[lineString2.coordinates.length - 1];
109852
+ var lineString = tentativeFeature.geometry;
109853
+ clickSequence[clickSequence.length - 1] = lineString.coordinates[lineString.coordinates.length - 1];
111653
109854
  } else if (clickSequence.length > 3 && tentativeFeature.geometry.type === "Polygon") {
111654
109855
  var polygon2 = tentativeFeature.geometry;
111655
109856
  clickSequence[clickSequence.length - 1] = polygon2.coordinates[0][polygon2.coordinates[0].length - 2];
@@ -117519,12 +115720,12 @@ function requireUtils$1() {
117519
115720
  return false;
117520
115721
  }
117521
115722
  function generatePointsParallelToLinePoints(p1, p2, groundCoords) {
117522
- var lineString2 = {
115723
+ var lineString = {
117523
115724
  type: "LineString",
117524
115725
  coordinates: [p1, p2]
117525
115726
  };
117526
115727
  var pt = (0, _helpers.point)(groundCoords);
117527
- var ddistance = (0, _pointToLineDistance["default"])(pt, lineString2);
115728
+ var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
117528
115729
  var lineBearing = (0, _bearing["default"])(p1, p2);
117529
115730
  var isPointToLeftOfLine = (groundCoords[0] - p1[0]) * (p2[1] - p1[1]) - (groundCoords[1] - p1[1]) * (p2[0] - p1[0]);
117530
115731
  var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
@@ -119192,31 +117393,35 @@ class SelectionLayer extends CompositeLayer {
119192
117393
  const { flipY, obsLayers } = this.props;
119193
117394
  const flippedCoordinates = flipY ? coordinates2.map((poly) => poly.map((p) => [p[0], -p[1]])) : coordinates2;
119194
117395
  const selectedPolygon = polygon(flippedCoordinates);
117396
+ let minX = Infinity;
117397
+ let minY = Infinity;
117398
+ let maxX = -Infinity;
117399
+ let maxY = -Infinity;
117400
+ flippedCoordinates[0].forEach(([x, y]) => {
117401
+ minX = Math.min(minX, x);
117402
+ minY = Math.min(minY, y);
117403
+ maxX = Math.max(maxX, x);
117404
+ maxY = Math.max(maxY, y);
117405
+ });
119195
117406
  obsLayers.forEach((obsLayer) => {
119196
117407
  const { getObsCoords, obsQuadTree, obsIndex, onSelect: layerOnSelect } = obsLayer;
119197
- const pickingInfos = [];
117408
+ const pickingIds = [];
119198
117409
  obsQuadTree?.visit((node2, x02, y02, x12, y12) => {
119199
- const nodePoints = [[[x02, y02], [x12, y02], [x12, y12], [x02, y12], [x02, y02]]];
119200
- const nodePolygon = polygon(nodePoints);
119201
- const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
119202
- const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
119203
- const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
119204
- if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
117410
+ if (x02 > maxX || y02 > maxY || x12 < minX || y12 < minY) {
119205
117411
  return true;
119206
117412
  }
119207
- if (node2.data) {
117413
+ if (!node2.length) {
119208
117414
  let current = node2;
119209
117415
  while (current) {
119210
- const pointCoords = [].slice.call(getObsCoords(current.data));
119211
- if (booleanPointInPolygon(point(pointCoords), selectedPolygon)) {
119212
- pickingInfos.push(current.data);
117416
+ const [x, y] = getObsCoords(current.data);
117417
+ if (booleanPointInPolygon([x, y], selectedPolygon)) {
117418
+ pickingIds.push(obsIndex[current.data]);
119213
117419
  }
119214
117420
  current = current.next;
119215
117421
  }
119216
117422
  }
119217
117423
  return false;
119218
117424
  });
119219
- const pickingIds = pickingInfos.map((obsI) => obsIndex[obsI]);
119220
117425
  layerOnSelect(pickingIds);
119221
117426
  });
119222
117427
  }
@@ -120391,22 +118596,22 @@ function addDecoder(cases, importFn) {
120391
118596
  }
120392
118597
  cases.forEach((c) => registry$1.set(c, importFn));
120393
118598
  }
120394
- addDecoder([void 0, 1], () => import("./raw-DqOqmksW.js").then((m) => m.default));
120395
- addDecoder(5, () => import("./lzw-Cj3FuoEM.js").then((m) => m.default));
118599
+ addDecoder([void 0, 1], () => import("./raw-jLMRkwh1.js").then((m) => m.default));
118600
+ addDecoder(5, () => import("./lzw-DNDdQ8Rh.js").then((m) => m.default));
120396
118601
  addDecoder(6, () => {
120397
118602
  throw new Error("old style JPEG compression is not supported.");
120398
118603
  });
120399
- addDecoder(7, () => import("./jpeg-DdRwUGtb.js").then((m) => m.default));
120400
- addDecoder([8, 32946], () => import("./deflate-CYRafIfN.js").then((m) => m.default));
120401
- addDecoder(32773, () => import("./packbits-QWSBfY1A.js").then((m) => m.default));
118604
+ addDecoder(7, () => import("./jpeg-6rs53CTI.js").then((m) => m.default));
118605
+ addDecoder([8, 32946], () => import("./deflate-Vmpz3Iqe.js").then((m) => m.default));
118606
+ addDecoder(32773, () => import("./packbits-ByS3Oj9u.js").then((m) => m.default));
120402
118607
  addDecoder(
120403
118608
  34887,
120404
- () => import("./lerc-CbvtcHx_.js").then(async (m) => {
118609
+ () => import("./lerc-BhOkGPMC.js").then(async (m) => {
120405
118610
  await m.zstd.init();
120406
118611
  return m;
120407
118612
  }).then((m) => m.default)
120408
118613
  );
120409
- addDecoder(50001, () => import("./webimage-8chAb-F3.js").then((m) => m.default));
118614
+ addDecoder(50001, () => import("./webimage-CpmkqWWb.js").then((m) => m.default));
120410
118615
  function decodeRowAcc(row, stride) {
120411
118616
  let length2 = row.length - stride;
120412
118617
  let offset = 0;
@@ -131762,17 +129967,17 @@ function sizeToMeters(size2, unit2) {
131762
129967
  throw new Error("Received unknown unit");
131763
129968
  }
131764
129969
  function snapValue(value) {
131765
- let magnitude2 = 0;
129970
+ let magnitude = 0;
131766
129971
  if (value < MIN_TARGET || value > MAX_TARGET) {
131767
- magnitude2 = Math.floor(Math.log10(value));
129972
+ magnitude = Math.floor(Math.log10(value));
131768
129973
  }
131769
129974
  let snappedUnit = SI_PREFIXES.find(
131770
- (p) => p.exponent % 3 === 0 && p.exponent <= magnitude2
129975
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude
131771
129976
  );
131772
129977
  let adjustedValue = value / 10 ** snappedUnit.exponent;
131773
129978
  if (adjustedValue > 500 && adjustedValue <= 1e3) {
131774
129979
  snappedUnit = SI_PREFIXES.find(
131775
- (p) => p.exponent % 3 === 0 && p.exponent <= magnitude2 + 3
129980
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
131776
129981
  );
131777
129982
  adjustedValue = value / 10 ** snappedUnit.exponent;
131778
129983
  }
@@ -134324,6 +132529,139 @@ class BitmaskLayer2 extends XRLayer {
134324
132529
  }
134325
132530
  BitmaskLayer2.layerName = "BitmaskLayer";
134326
132531
  BitmaskLayer2.defaultProps = defaultProps$2;
132532
+ function geomEach(geojson, callback) {
132533
+ 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;
132534
+ for (i2 = 0; i2 < stop; i2++) {
132535
+ geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
132536
+ featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
132537
+ featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
132538
+ featureId2 = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
132539
+ isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
132540
+ stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
132541
+ for (g2 = 0; g2 < stopG; g2++) {
132542
+ geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g2] : geometryMaybeCollection;
132543
+ if (geometry2 === null) {
132544
+ if (callback(
132545
+ null,
132546
+ featureIndex,
132547
+ featureProperties,
132548
+ featureBBox,
132549
+ featureId2
132550
+ ) === false)
132551
+ return false;
132552
+ continue;
132553
+ }
132554
+ switch (geometry2.type) {
132555
+ case "Point":
132556
+ case "LineString":
132557
+ case "MultiPoint":
132558
+ case "Polygon":
132559
+ case "MultiLineString":
132560
+ case "MultiPolygon": {
132561
+ if (callback(
132562
+ geometry2,
132563
+ featureIndex,
132564
+ featureProperties,
132565
+ featureBBox,
132566
+ featureId2
132567
+ ) === false)
132568
+ return false;
132569
+ break;
132570
+ }
132571
+ case "GeometryCollection": {
132572
+ for (j = 0; j < geometry2.geometries.length; j++) {
132573
+ if (callback(
132574
+ geometry2.geometries[j],
132575
+ featureIndex,
132576
+ featureProperties,
132577
+ featureBBox,
132578
+ featureId2
132579
+ ) === false)
132580
+ return false;
132581
+ }
132582
+ break;
132583
+ }
132584
+ default:
132585
+ throw new Error("Unknown Geometry Type");
132586
+ }
132587
+ }
132588
+ featureIndex++;
132589
+ }
132590
+ }
132591
+ function geomReduce(geojson, callback, initialValue) {
132592
+ var previousValue = initialValue;
132593
+ geomEach(
132594
+ geojson,
132595
+ function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId2) {
132596
+ previousValue = callback(
132597
+ previousValue,
132598
+ currentGeometry,
132599
+ featureIndex,
132600
+ featureProperties,
132601
+ featureBBox,
132602
+ featureId2
132603
+ );
132604
+ }
132605
+ );
132606
+ return previousValue;
132607
+ }
132608
+ function flattenEach(geojson, callback) {
132609
+ geomEach(geojson, function(geometry2, featureIndex, properties, bbox, id) {
132610
+ var type = geometry2 === null ? null : geometry2.type;
132611
+ switch (type) {
132612
+ case null:
132613
+ case "Point":
132614
+ case "LineString":
132615
+ case "Polygon":
132616
+ if (callback(
132617
+ feature$1(geometry2, properties, { bbox, id }),
132618
+ featureIndex,
132619
+ 0
132620
+ ) === false)
132621
+ return false;
132622
+ return;
132623
+ }
132624
+ var geomType;
132625
+ switch (type) {
132626
+ case "MultiPoint":
132627
+ geomType = "Point";
132628
+ break;
132629
+ case "MultiLineString":
132630
+ geomType = "LineString";
132631
+ break;
132632
+ case "MultiPolygon":
132633
+ geomType = "Polygon";
132634
+ break;
132635
+ }
132636
+ for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
132637
+ var coordinate = geometry2.coordinates[multiFeatureIndex];
132638
+ var geom = {
132639
+ type: geomType,
132640
+ coordinates: coordinate
132641
+ };
132642
+ if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false)
132643
+ return false;
132644
+ }
132645
+ });
132646
+ }
132647
+ function flattenReduce(geojson, callback, initialValue) {
132648
+ var previousValue = initialValue;
132649
+ flattenEach(
132650
+ geojson,
132651
+ function(currentFeature, featureIndex, multiFeatureIndex) {
132652
+ if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
132653
+ previousValue = currentFeature;
132654
+ else
132655
+ previousValue = callback(
132656
+ previousValue,
132657
+ currentFeature,
132658
+ featureIndex,
132659
+ multiFeatureIndex
132660
+ );
132661
+ }
132662
+ );
132663
+ return previousValue;
132664
+ }
134327
132665
  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;
134328
132666
  function clone(configObject) {
134329
132667
  var div2, convertBase2, parseNumeric, P2 = 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 = {
@@ -136164,8 +134502,8 @@ var set = (eps) => {
136164
134502
  };
136165
134503
  };
136166
134504
  var precision = set();
136167
- var isInBbox = (bbox2, point2) => {
136168
- 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);
134505
+ var isInBbox = (bbox, point2) => {
134506
+ 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);
136169
134507
  };
136170
134508
  var getBboxOverlap = (b1, b2) => {
136171
134509
  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))
@@ -137265,6 +135603,19 @@ function ringArea(coords) {
137265
135603
  }
137266
135604
  return total * FACTOR;
137267
135605
  }
135606
+ function distance(from, to, options = {}) {
135607
+ var coordinates1 = getCoord(from);
135608
+ var coordinates2 = getCoord(to);
135609
+ var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
135610
+ var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
135611
+ var lat1 = degreesToRadians(coordinates1[1]);
135612
+ var lat2 = degreesToRadians(coordinates2[1]);
135613
+ var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
135614
+ return radiansToLength(
135615
+ 2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
135616
+ options.units
135617
+ );
135618
+ }
137268
135619
  const DEFAULT_THRESHOLD = 1;
137269
135620
  const defaultProps$1 = {
137270
135621
  // for text
@@ -137361,7 +135712,7 @@ class ContourLayerWithText extends ContourLayer {
137361
135712
  const circlePoint = point(circleCoord);
137362
135713
  polygonVertices.forEach((polyCoord) => {
137363
135714
  const polyPoint = point(polyCoord);
137364
- const dist2 = distance$1(circlePoint, polyPoint);
135715
+ const dist2 = distance(circlePoint, polyPoint);
137365
135716
  if (dist2 < minDist) {
137366
135717
  minDist = dist2;
137367
135718
  minCirclePoint = circleCoord;
@@ -137834,10 +136185,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
137834
136185
  getLineColor: strokeColor,
137835
136186
  getLineWidth: strokeWidth,
137836
136187
  lineWidthUnits: "pixels",
137837
- ...dashArray ? {
137838
- extensions: [new PathStyleExtension({ dash: true })],
137839
- getDashArray: dashArray
137840
- } : {}
136188
+ extensions: dashExt,
136189
+ getDashArray: getDash
137841
136190
  }));
137842
136191
  if (shape.text && labelOpacity > 0) {
137843
136192
  layers.push(new TextLayer({
@@ -137872,8 +136221,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
137872
136221
  layers.push(new PathLayer({
137873
136222
  ...base,
137874
136223
  id: `annotation-line-${uid2}-${i2}`,
137875
- extensions: [new PathStyleExtension({ dash: true })],
137876
- getDashArray: dashArray ?? [0, 0],
136224
+ extensions: dashExt,
136225
+ getDashArray: getDash,
137877
136226
  data: [{ path: [[srcX, srcY], [tgtX, tgtY]] }],
137878
136227
  getPath: (d) => d.path,
137879
136228
  getColor: strokeColor,
@@ -138021,10 +136370,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
138021
136370
  getLineColor: strokeColor,
138022
136371
  getLineWidth: strokeWidth,
138023
136372
  lineWidthUnits: "pixels",
138024
- ...dashArray ? {
138025
- extensions: [new PathStyleExtension({ dash: true })],
138026
- getDashArray: dashArray
138027
- } : {}
136373
+ extensions: dashExt,
136374
+ getDashArray: getDash
138028
136375
  }));
138029
136376
  if (shape.text && labelOpacity > 0) {
138030
136377
  layers.push(new TextLayer({
@@ -139232,6 +137579,16 @@ class ImageWrapper {
139232
137579
  const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
139233
137580
  return shape[labels.indexOf("z")];
139234
137581
  }
137582
+ /**
137583
+ * Clamp a z target to a valid plane index.
137584
+ * spatialTargetZ can hold a 3D camera target in scene units, which may
137585
+ * exceed the number of planes; geotiff throws on out-of-range indices.
137586
+ */
137587
+ getClampedZIndex(targetZ) {
137588
+ const numZ = this.getNumZ();
137589
+ if (!Number.isFinite(numZ) || !Number.isFinite(targetZ)) return 0;
137590
+ return Math.min(Math.max(Math.floor(targetZ), 0), numZ - 1);
137591
+ }
139235
137592
  getNumT() {
139236
137593
  const loader = this.vivLoader;
139237
137594
  const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
@@ -139347,6 +137704,26 @@ class ImageWrapper {
139347
137704
  }
139348
137705
  return "BlackIsZero";
139349
137706
  }
137707
+ /**
137708
+ * Meters per 3D scene unit, i.e. the unit of getModelMatrix().
137709
+ * OME-TIFF: physicalSizeToMatrix divides by 1 um, so the scene is in µm
137710
+ * (only when physical sizes exist; otherwise pixels, unit unknown → null).
137711
+ * OME-Zarr: the model matrix is in the units of the NGFF axes.
137712
+ */
137713
+ getSceneMetersPerUnit() {
137714
+ const { metadata } = this.vivLoader;
137715
+ if (!metadata) return null;
137716
+ if ("Pixels" in metadata) {
137717
+ return this.hasPhysicalSize() ? 1e-6 : null;
137718
+ }
137719
+ if ("multiscales" in metadata) {
137720
+ const axes = metadata.multiscales?.[0]?.axes ?? [];
137721
+ const xAxis = axes.find((a2) => (typeof a2 === "string" ? a2 : a2?.name) === "x");
137722
+ const unit2 = typeof xAxis === "object" ? xAxis?.unit : null;
137723
+ return unit2 ? UNIT_TO_METERS[unit2.normalize("NFKC")] ?? null : null;
137724
+ }
137725
+ return null;
137726
+ }
139350
137727
  }
139351
137728
  export {
139352
137729
  BaseDecoder as B,