@watergis/maplibre-gl-terradraw 1.7.3 → 1.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@ var b;
12
12
  (function(r) {
13
13
  r.Commit = "commit", r.Provisional = "provisional", r.Finish = "finish";
14
14
  })(b || (b = {}));
15
- const k = { SELECTED: "selected", MID_POINT: "midPoint", SELECTION_POINT_FEATURE_ID: "selectionPointFeatureId", SELECTION_POINT: "selectionPoint" }, P = { MODE: "mode", CURRENTLY_DRAWING: "currentlyDrawing", EDITED: "edited", CLOSING_POINT: "closingPoint", SNAPPING_POINT: "snappingPoint", COORDINATE_POINT: "coordinatePoint", COORDINATE_POINT_FEATURE_ID: "coordinatePointFeatureId", COORDINATE_POINT_IDS: "coordinatePointIds", PROVISIONAL_COORDINATE_COUNT: "provisionalCoordinateCount", COMMITTED_COORDINATE_COUNT: "committedCoordinateCount" }, j = 10;
15
+ const k = { SELECTED: "selected", MID_POINT: "midPoint", SELECTION_POINT_FEATURE_ID: "selectionPointFeatureId", SELECTION_POINT: "selectionPoint" }, S = { MODE: "mode", CURRENTLY_DRAWING: "currentlyDrawing", EDITED: "edited", CLOSING_POINT: "closingPoint", SNAPPING_POINT: "snappingPoint", COORDINATE_POINT: "coordinatePoint", COORDINATE_POINT_FEATURE_ID: "coordinatePointFeatureId", COORDINATE_POINT_IDS: "coordinatePointIds", PROVISIONAL_COORDINATE_COUNT: "provisionalCoordinateCount", COMMITTED_COORDINATE_COUNT: "committedCoordinateCount" }, j = 10;
16
16
  function Ot(r) {
17
17
  return !!(r && typeof r == "object" && r !== null && !Array.isArray(r));
18
18
  }
@@ -184,14 +184,14 @@ function Tt(r) {
184
184
  return s < 0 || s > 1;
185
185
  }
186
186
  function o(s, n, a, l) {
187
- const d = t[s][n], c = t[s][n + 1], h = t[a][l], u = t[a][l + 1], p = (function(m, v, C, f) {
187
+ const d = t[s][n], c = t[s][n + 1], h = t[a][l], p = t[a][l + 1], u = (function(m, v, C, f) {
188
188
  if (gt(m, C) || gt(m, f) || gt(v, C) || gt(f, C)) return null;
189
- const S = m[0], I = m[1], E = v[0], L = v[1], M = C[0], N = C[1], _ = f[0], T = f[1], $ = (S - E) * (N - T) - (I - L) * (M - _);
190
- return $ === 0 ? null : [((S * L - I * E) * (M - _) - (S - E) * (M * T - N * _)) / $, ((S * L - I * E) * (N - T) - (I - L) * (M * T - N * _)) / $];
191
- })(d, c, h, u);
192
- if (p === null) return;
189
+ const P = m[0], I = m[1], E = v[0], L = v[1], M = C[0], N = C[1], _ = f[0], T = f[1], $ = (P - E) * (N - T) - (I - L) * (M - _);
190
+ return $ === 0 ? null : [((P * L - I * E) * (M - _) - (P - E) * (M * T - N * _)) / $, ((P * L - I * E) * (N - T) - (I - L) * (M * T - N * _)) / $];
191
+ })(d, c, h, p);
192
+ if (u === null) return;
193
193
  let g, y;
194
- g = c[0] !== d[0] ? (p[0] - d[0]) / (c[0] - d[0]) : (p[1] - d[1]) / (c[1] - d[1]), y = u[0] !== h[0] ? (p[0] - h[0]) / (u[0] - h[0]) : (p[1] - h[1]) / (u[1] - h[1]), i(g) || i(y) || (p.toString(), e.push(p));
194
+ g = c[0] !== d[0] ? (u[0] - d[0]) / (c[0] - d[0]) : (u[1] - d[1]) / (c[1] - d[1]), y = p[0] !== h[0] ? (u[0] - h[0]) / (p[0] - h[0]) : (u[1] - h[1]) / (p[1] - h[1]), i(g) || i(y) || (u.toString(), e.push(u));
195
195
  }
196
196
  }
197
197
  function gt(r, t) {
@@ -235,7 +235,7 @@ let xe = class extends A {
235
235
  }
236
236
  close() {
237
237
  if (this.currentCircleId === void 0) return;
238
- this.store.updateProperty([{ id: this.currentCircleId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
238
+ this.store.updateProperty([{ id: this.currentCircleId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
239
239
  const t = this.currentCircleId;
240
240
  if (this.validate && t) {
241
241
  const e = this.store.getGeometryCopy(t);
@@ -252,7 +252,7 @@ let xe = class extends A {
252
252
  onClick(t) {
253
253
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) if (this.clickCount === 0) {
254
254
  this.center = [t.lng, t.lat];
255
- const e = te({ center: this.center, radiusKilometers: this.startingRadiusKilometers, coordinatePrecision: this.coordinatePrecision }), [i] = this.store.create([{ geometry: e.geometry, properties: { mode: this.mode, radiusKilometers: this.startingRadiusKilometers, [P.CURRENTLY_DRAWING]: !0 } }]);
255
+ const e = te({ center: this.center, radiusKilometers: this.startingRadiusKilometers, coordinatePrecision: this.coordinatePrecision }), [i] = this.store.create([{ geometry: e.geometry, properties: { mode: this.mode, radiusKilometers: this.startingRadiusKilometers, [S.CURRENTLY_DRAWING]: !0 } }]);
256
256
  this.currentCircleId = i, this.clickCount++, this.cursorMovedAfterInitialCursorDown = !1, this.setDrawing();
257
257
  } else this.clickCount === 1 && this.center && this.currentCircleId !== void 0 && this.cursorMovedAfterInitialCursorDown && this.updateCircle(t), this.close();
258
258
  }
@@ -297,9 +297,9 @@ let xe = class extends A {
297
297
  return Math.sqrt(Math.pow(c - l, 2) + Math.pow(h - d, 2)) / a;
298
298
  })(this.center, [t.lng, t.lat]);
299
299
  i = (function(s) {
300
- const { center: n, radiusKilometers: a, coordinatePrecision: l } = s, d = s.steps ? s.steps : 64, c = 1e3 * a, [h, u] = n, { x: p, y: g } = O(h, u), y = [];
300
+ const { center: n, radiusKilometers: a, coordinatePrecision: l } = s, d = s.steps ? s.steps : 64, c = 1e3 * a, [h, p] = n, { x: u, y: g } = O(h, p), y = [];
301
301
  for (let m = 0; m < d; m++) {
302
- const v = 360 * m / d * Math.PI / 180, C = c * Math.cos(v), f = c * Math.sin(v), [S, I] = [p + C, g + f], { lng: E, lat: L } = R(S, I);
302
+ const v = 360 * m / d * Math.PI / 180, C = c * Math.cos(v), f = c * Math.sin(v), [P, I] = [u + C, g + f], { lng: E, lat: L } = R(P, I);
303
303
  y.push([w(E, l), w(L, l)]);
304
304
  }
305
305
  return y.push(y[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [y] }, properties: {} };
@@ -343,7 +343,7 @@ class Oe extends A {
343
343
  if (this.currentId === void 0) return;
344
344
  if (this.currentId) {
345
345
  const e = pt(this.store.getGeometryCopy(this.currentId));
346
- e && this.store.updateGeometry([{ id: this.currentId, geometry: e }]), this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
346
+ e && this.store.updateGeometry([{ id: this.currentId, geometry: e }]), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
347
347
  }
348
348
  const t = this.currentId;
349
349
  if (this.validate && t) {
@@ -360,22 +360,22 @@ class Oe extends A {
360
360
  }
361
361
  onMouseMove(t) {
362
362
  if (this.currentId === void 0 || this.startingClick === !1) return void this.setCursor(this.cursors.start);
363
- const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates[0].length - 2, [o, s] = e.coordinates[0][i], { x: n, y: a } = this.project(o, s), l = F({ x: n, y: a }, { x: t.containerX, y: t.containerY }), [d, c] = e.coordinates[0][0], { x: h, y: u } = this.project(d, c);
364
- if (F({ x: h, y: u }, { x: t.containerX, y: t.containerY }) < this.pointerDistance) {
363
+ const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates[0].length - 2, [o, s] = e.coordinates[0][i], { x: n, y: a } = this.project(o, s), l = F({ x: n, y: a }, { x: t.containerX, y: t.containerY }), [d, c] = e.coordinates[0][0], { x: h, y: p } = this.project(d, c);
364
+ if (F({ x: h, y: p }, { x: t.containerX, y: t.containerY }) < this.pointerDistance) {
365
365
  if (this.autoClose && this.hasLeftStartingPoint && (this.preventNewFeature = !0, setTimeout(() => {
366
366
  this.preventNewFeature = !1;
367
367
  }, this.autoCloseTimeout), this.close()), this.setCursor(this.cursors.close), this.preventPointsNearClose) return;
368
368
  } else this.hasLeftStartingPoint = !0, this.setCursor(this.cursors.start);
369
369
  if (l < this.minDistance) return;
370
370
  e.coordinates[0].pop();
371
- const p = { type: "Polygon", coordinates: [[...e.coordinates[0], [t.lng, t.lat], e.coordinates[0][0]]] };
372
- this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: p, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || this.store.updateGeometry([{ id: this.currentId, geometry: p }]);
371
+ const u = { type: "Polygon", coordinates: [[...e.coordinates[0], [t.lng, t.lat], e.coordinates[0][0]]] };
372
+ this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: u, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || this.store.updateGeometry([{ id: this.currentId, geometry: u }]);
373
373
  }
374
374
  onClick(t) {
375
375
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) {
376
376
  if (this.preventNewFeature) return;
377
377
  if (this.startingClick === !1) {
378
- const [e, i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }, { geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: { mode: this.mode, [P.CLOSING_POINT]: !0 } }]);
378
+ const [e, i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }, { geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
379
379
  return this.currentId = e, this.closingPointId = i, this.startingClick = !0, void (this.state !== "drawing" && this.setDrawing());
380
380
  }
381
381
  this.close();
@@ -523,14 +523,14 @@ class li extends B {
523
523
  }
524
524
  generateInsertionGeodesicCoordinates(t, e, i) {
525
525
  const o = U(t, e), s = (function(n, a, l) {
526
- const d = [], c = yt(n[1]), h = yt(n[0]), u = yt(a[1]), p = yt(a[0]);
526
+ const d = [], c = yt(n[1]), h = yt(n[0]), p = yt(a[1]), u = yt(a[0]);
527
527
  l += 1;
528
- const g = 2 * Math.asin(Math.sqrt(Math.sin((u - c) / 2) ** 2 + Math.cos(c) * Math.cos(u) * Math.sin((p - h) / 2) ** 2));
528
+ const g = 2 * Math.asin(Math.sqrt(Math.sin((p - c) / 2) ** 2 + Math.cos(c) * Math.cos(p) * Math.sin((u - h) / 2) ** 2));
529
529
  if (g === 0 || isNaN(g)) return d;
530
530
  for (let y = 0; y <= l; y++) {
531
- const m = y / l, v = Math.sin((1 - m) * g) / Math.sin(g), C = Math.sin(m * g) / Math.sin(g), f = v * Math.cos(c) * Math.cos(h) + C * Math.cos(u) * Math.cos(p), S = v * Math.cos(c) * Math.sin(h) + C * Math.cos(u) * Math.sin(p), I = v * Math.sin(c) + C * Math.sin(u);
532
- if (isNaN(f) || isNaN(S) || isNaN(I)) continue;
533
- const E = Math.atan2(I, Math.sqrt(f ** 2 + S ** 2)), L = Math.atan2(S, f);
531
+ const m = y / l, v = Math.sin((1 - m) * g) / Math.sin(g), C = Math.sin(m * g) / Math.sin(g), f = v * Math.cos(c) * Math.cos(h) + C * Math.cos(p) * Math.cos(u), P = v * Math.cos(c) * Math.sin(h) + C * Math.cos(p) * Math.sin(u), I = v * Math.sin(c) + C * Math.sin(p);
532
+ if (isNaN(f) || isNaN(P) || isNaN(I)) continue;
533
+ const E = Math.atan2(I, Math.sqrt(f ** 2 + P ** 2)), L = Math.atan2(P, f);
534
534
  isNaN(E) || isNaN(L) || d.push([se(L), se(E)]);
535
535
  }
536
536
  return d.slice(1, -1);
@@ -575,9 +575,9 @@ function di(r, t, e) {
575
575
  const i = bt(r), o = bt(t), s = bt(e), [n, a, l] = s, [d, c, h] = (function(T, $) {
576
576
  const [Vt, $t, Yt] = T, [Kt, Xt, Ht] = $;
577
577
  return [$t * Ht - Yt * Xt, Yt * Kt - Vt * Ht, Vt * Xt - $t * Kt];
578
- })(i, o), u = c * l - h * a, p = h * n - d * l, g = d * a - c * n, y = g * c - p * h, m = u * h - g * d, v = p * d - u * c, C = 1 / Math.sqrt(Math.pow(y, 2) + Math.pow(m, 2) + Math.pow(v, 2)), f = [y * C, m * C, v * C], S = [-1 * y * C, -1 * m * C, -1 * v * C], I = Y(i, o), E = Y(i, f), L = Y(o, f), M = Y(i, S), N = Y(o, S);
578
+ })(i, o), p = c * l - h * a, u = h * n - d * l, g = d * a - c * n, y = g * c - u * h, m = p * h - g * d, v = u * d - p * c, C = 1 / Math.sqrt(Math.pow(y, 2) + Math.pow(m, 2) + Math.pow(v, 2)), f = [y * C, m * C, v * C], P = [-1 * y * C, -1 * m * C, -1 * v * C], I = Y(i, o), E = Y(i, f), L = Y(o, f), M = Y(i, P), N = Y(o, P);
579
579
  let _;
580
- return _ = E < M && E < N || L < M && L < N ? f : S, Y(i, _) > I || Y(o, _) > I ? U(K(_), K(i)) <= U(K(_), K(o)) ? [K(i), !0, !1] : [K(o), !1, !0] : [K(_), !1, !1];
580
+ return _ = E < M && E < N || L < M && L < N ? f : P, Y(i, _) > I || Y(o, _) > I ? U(K(_), K(i)) <= U(K(_), K(o)) ? [K(i), !0, !1] : [K(o), !1, !0] : [K(_), !1, !1];
581
581
  }
582
582
  function ci(r, t, e) {
583
583
  const i = t.x - r.x, o = t.y - r.y, s = Math.max(0, Math.min(1, ((e.x - r.x) * i + (e.y - r.y) * o) / (i * i + o * o)));
@@ -603,30 +603,30 @@ class jt extends B {
603
603
  a = n.geometry.coordinates;
604
604
  }
605
605
  const l = [];
606
- for (let u = 0; u < a.length - 1; u++) l.push([a[u], a[u + 1]]);
606
+ for (let p = 0; p < a.length - 1; p++) l.push([a[p], a[p + 1]]);
607
607
  let d;
608
608
  const c = [t.lng, t.lat];
609
- if (this.config.projection === "web-mercator" ? d = (function(u, p) {
609
+ if (this.config.projection === "web-mercator" ? d = (function(p, u) {
610
610
  let g = [1 / 0, 1 / 0], y = 1 / 0, m = 0;
611
- for (let v of p) {
611
+ for (let v of u) {
612
612
  const C = v[0], f = v[1];
613
- let S, I = 1 / 0;
614
- const E = O(C[0], C[1]), L = O(f[0], f[1]), M = O(u[0], u[1]);
615
- if (C[0] === u[0] && C[1] === u[1]) S = C;
616
- else if (f[0] === u[0] && f[1] === u[1]) S = f;
613
+ let P, I = 1 / 0;
614
+ const E = O(C[0], C[1]), L = O(f[0], f[1]), M = O(p[0], p[1]);
615
+ if (C[0] === p[0] && C[1] === p[1]) P = C;
616
+ else if (f[0] === p[0] && f[1] === p[1]) P = f;
617
617
  else {
618
618
  const { x: N, y: _ } = ci(E, L, M), { lng: T, lat: $ } = R(N, _);
619
- S = [T, $];
619
+ P = [T, $];
620
620
  }
621
- S && (I = F(M, O(S[0], S[1])), I < y && (g = S, y = I, m = p.indexOf(v)));
621
+ P && (I = F(M, O(P[0], P[1])), I < y && (g = P, y = I, m = u.indexOf(v)));
622
622
  }
623
623
  return y === 1 / 0 ? void 0 : { coordinate: g, lineIndex: m, distance: y };
624
- })(c, l) : this.config.projection === "globe" && (d = (function(u, p) {
624
+ })(c, l) : this.config.projection === "globe" && (d = (function(p, u) {
625
625
  let g = [1 / 0, 1 / 0], y = 1 / 0, m = 0;
626
- for (let v of p) {
626
+ for (let v of u) {
627
627
  const C = v[0], f = v[1];
628
- let S, I = 1 / 0;
629
- C[0] === u[0] && C[1] === u[1] ? S = C : f[0] === u[0] && f[1] === u[1] ? S = f : [S] = di(C, f, u), S && (I = U(u, S), I < y && (g = S, y = I, m = p.indexOf(v)));
628
+ let P, I = 1 / 0;
629
+ C[0] === p[0] && C[1] === p[1] ? P = C : f[0] === p[0] && f[1] === p[1] ? P = f : [P] = di(C, f, p), P && (I = U(p, P), I < y && (g = P, y = I, m = u.indexOf(v)));
630
630
  }
631
631
  return y === 1 / 0 ? void 0 : { coordinate: g, distance: y, lineIndex: m };
632
632
  })(c, l)), !d) return;
@@ -648,7 +648,7 @@ class At extends A {
648
648
  if (e) {
649
649
  if (this.snappedPointId) this.store.updateGeometry([{ id: this.snappedPointId, geometry: { type: "Point", coordinates: e } }]);
650
650
  else {
651
- const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [P.SNAPPING_POINT]: !0 } }]);
651
+ const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [S.SNAPPING_POINT]: !0 } }]);
652
652
  this.snappedPointId = i;
653
653
  }
654
654
  t.lng = e[0], t.lat = e[1];
@@ -658,7 +658,7 @@ class At extends A {
658
658
  close() {
659
659
  if (this.currentId === void 0) return;
660
660
  const t = this.store.getGeometryCopy(this.currentId);
661
- t.coordinates.pop(), this.updateGeometries([...t.coordinates], void 0, b.Commit), this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
661
+ t.coordinates.pop(), this.updateGeometries([...t.coordinates], void 0, b.Commit), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
662
662
  const e = this.currentId;
663
663
  this.closingPointId && this.store.delete([this.closingPointId]), this.snappedPointId && this.store.delete([this.snappedPointId]), this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.snappedPointId = void 0, this.lastCommittedCoordinates = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
664
664
  }
@@ -677,12 +677,12 @@ class At extends A {
677
677
  return this.projection === "globe" ? o = this.insertPoint.generateInsertionGeodesicCoordinates(t, e, i) : this.projection === "web-mercator" && (o = this.insertPoint.generateInsertionCoordinates(t, e, i)), o;
678
678
  }
679
679
  createLine(t) {
680
- const [e] = this.store.create([{ geometry: { type: "LineString", coordinates: [t, t] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }]);
680
+ const [e] = this.store.create([{ geometry: { type: "LineString", coordinates: [t, t] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
681
681
  this.lastCommittedCoordinates = [t, t], this.currentId = e, this.currentCoordinate++, this.setDrawing();
682
682
  }
683
683
  firstUpdateToLine(t) {
684
684
  if (!this.currentId) return;
685
- const e = this.store.getGeometryCopy(this.currentId).coordinates, [i] = this.store.create([{ geometry: { type: "Point", coordinates: [...t] }, properties: { mode: this.mode, [P.CLOSING_POINT]: !0 } }]);
685
+ const e = this.store.getGeometryCopy(this.currentId).coordinates, [i] = this.store.create([{ geometry: { type: "Point", coordinates: [...t] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
686
686
  this.closingPointId = i, this.setCursor(this.cursors.close);
687
687
  const o = [...e, t];
688
688
  this.updateGeometries(o, void 0, b.Commit), this.currentCoordinate++;
@@ -758,7 +758,7 @@ class At extends A {
758
758
  }
759
759
  if (this.editedFeatureId && i) {
760
760
  if (!this.editedPointId) {
761
- const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [P.EDITED]: !0 } }]);
761
+ const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [S.EDITED]: !0 } }]);
762
762
  this.editedPointId = o;
763
763
  }
764
764
  this.setCursor(this.cursors.dragStart), e(!1);
@@ -769,10 +769,10 @@ class At extends A {
769
769
  const i = this.store.getGeometryCopy(this.editedFeatureId);
770
770
  this.editedSnapType === "coordinate" || this.editedSnapType === "line" && this.editedInsertIndex !== void 0 ? i.coordinates[this.editedFeatureCoordinateIndex] = [t.lng, t.lat] : this.editedSnapType === "line" && this.editedInsertIndex === void 0 && (this.editedInsertIndex = this.editedFeatureCoordinateIndex + 1, i.coordinates.splice(this.editedInsertIndex, 0, [t.lng, t.lat]), this.editedFeatureCoordinateIndex++);
771
771
  const o = { type: "LineString", coordinates: i.coordinates };
772
- this.validate && !this.validate({ type: "Feature", geometry: o, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: o }]), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !0 }]));
772
+ this.validate && !this.validate({ type: "Feature", geometry: o, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: o }]), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
773
773
  }
774
774
  onDragEnd(t, e) {
775
- this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, e(!0));
775
+ this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, e(!0));
776
776
  }
777
777
  cleanUp() {
778
778
  const t = this.currentId, e = this.closingPointId, i = this.snappedPointId;
@@ -786,7 +786,7 @@ class At extends A {
786
786
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
787
787
  if (t.type === "Feature" && t.geometry.type === "LineString" && t.properties.mode === this.mode) return e.lineStringColor = this.getHexColorStylingValue(this.styles.lineStringColor, e.lineStringColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.lineStringWidth, e.lineStringWidth, t), e.zIndex = j, e;
788
788
  if (t.type === "Feature" && t.geometry.type === "Point" && t.properties.mode === this.mode) {
789
- const i = t.properties[P.CLOSING_POINT];
789
+ const i = t.properties[S.CLOSING_POINT];
790
790
  return e.pointColor = this.getHexColorStylingValue(i ? this.styles.closingPointColor : this.styles.snappingPointColor, e.pointColor, t), e.pointWidth = this.getNumericStylingValue(i ? this.styles.closingPointWidth : this.styles.snappingPointWidth, e.pointWidth, t), e.pointOutlineColor = this.getHexColorStylingValue(i ? this.styles.closingPointOutlineColor : this.styles.snappingPointOutlineColor, "#ffffff", t), e.pointOutlineWidth = this.getNumericStylingValue(i ? this.styles.closingPointOutlineWidth : this.styles.snappingPointOutlineWidth, 2, t), e.zIndex = 50, e;
791
791
  }
792
792
  return e;
@@ -850,10 +850,10 @@ class Rt extends A {
850
850
  }
851
851
  }
852
852
  onDrag(t, e) {
853
- this.allowPointerEvent(this.pointerEvents.onDrag, t) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !0 }])));
853
+ this.allowPointerEvent(this.pointerEvents.onDrag, t) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }])));
854
854
  }
855
855
  onDragEnd(t, e) {
856
- this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.setCursor(this.cursors.dragEnd), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !1 }]), this.editedFeatureId = void 0, e(!0));
856
+ this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.setCursor(this.cursors.dragEnd), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.editedFeatureId = void 0, e(!0));
857
857
  }
858
858
  registerBehaviors(t) {
859
859
  this.pixelDistance = new ct(t), this.clickBoundingBox = new dt(t);
@@ -907,7 +907,7 @@ class mi extends B {
907
907
  create(t, e) {
908
908
  if (this.ids.length) throw new Error("Opening and closing points already created");
909
909
  if (t.length <= 3) throw new Error("Requires at least 4 coordinates");
910
- this._startEndPoints = this.store.create([{ geometry: { type: "Point", coordinates: t[0] }, properties: { mode: e, [P.CLOSING_POINT]: !0 } }, { geometry: { type: "Point", coordinates: t[t.length - 2] }, properties: { mode: e, [P.CLOSING_POINT]: !0 } }]);
910
+ this._startEndPoints = this.store.create([{ geometry: { type: "Point", coordinates: t[0] }, properties: { mode: e, [S.CLOSING_POINT]: !0 } }, { geometry: { type: "Point", coordinates: t[t.length - 2] }, properties: { mode: e, [S.CLOSING_POINT]: !0 } }]);
911
911
  }
912
912
  delete() {
913
913
  this.ids.length && (this.store.delete(this.ids), this._startEndPoints = []);
@@ -962,10 +962,10 @@ class we extends B {
962
962
  if (i.coordinatePointIds) return i.coordinatePointIds.map((o, s) => ({ id: o, geometry: x({}, this.store.getGeometryCopy(o), { coordinates: e[s] }) }));
963
963
  }
964
964
  createPoints(t, e, i) {
965
- return this.store.create(t.map((o, s) => ({ geometry: { type: "Point", coordinates: o }, properties: { mode: e, [P.COORDINATE_POINT]: !0, [P.COORDINATE_POINT_FEATURE_ID]: i, index: s } })));
965
+ return this.store.create(t.map((o, s) => ({ geometry: { type: "Point", coordinates: o }, properties: { mode: e, [S.COORDINATE_POINT]: !0, [S.COORDINATE_POINT_FEATURE_ID]: i, index: s } })));
966
966
  }
967
967
  setFeatureCoordinatePoints(t, e) {
968
- this.store.updateProperty([{ id: t, property: P.COORDINATE_POINT_IDS, value: e }]);
968
+ this.store.updateProperty([{ id: t, property: S.COORDINATE_POINT_IDS, value: e }]);
969
969
  }
970
970
  deleteCoordinatePoints(t) {
971
971
  const e = t.filter((i) => this.store.has(i));
@@ -987,7 +987,7 @@ class Le extends A {
987
987
  this.coordinatePoints.createOrUpdate(e);
988
988
  });
989
989
  else if (this.coordinatePoints && this.showCoordinatePoints === !1) {
990
- const e = this.store.copyAllWhere((i) => i.mode === this.mode && !!i[P.COORDINATE_POINT_IDS]);
990
+ const e = this.store.copyAllWhere((i) => i.mode === this.mode && !!i[S.COORDINATE_POINT_IDS]);
991
991
  this.coordinatePoints.deletePointsByFeatureIds(e.map((i) => i.id));
992
992
  }
993
993
  }
@@ -999,7 +999,7 @@ class Le extends A {
999
999
  const e = this.currentId;
1000
1000
  if (this.currentId) {
1001
1001
  const i = pt(this.store.getGeometryCopy(this.currentId));
1002
- i && (this.store.updateGeometry([{ id: this.currentId, geometry: i }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.currentId)), this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }, { id: this.currentId, property: P.COMMITTED_COORDINATE_COUNT, value: void 0 }, { id: this.currentId, property: P.PROVISIONAL_COORDINATE_COUNT, value: void 0 }]);
1002
+ i && (this.store.updateGeometry([{ id: this.currentId, geometry: i }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.currentId)), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }, { id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: void 0 }, { id: this.currentId, property: S.PROVISIONAL_COORDINATE_COUNT, value: void 0 }]);
1003
1003
  }
1004
1004
  this.snappedPointId && this.store.delete([this.snappedPointId]), this.currentCoordinate = 0, this.currentId = void 0, this.snappedPointId = void 0, this.closingPoints.delete(), this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
1005
1005
  }
@@ -1017,7 +1017,7 @@ class Le extends A {
1017
1017
  if (e) {
1018
1018
  if (this.snappedPointId) this.store.updateGeometry([{ id: this.snappedPointId, geometry: { type: "Point", coordinates: e } }]);
1019
1019
  else {
1020
- const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [P.SNAPPING_POINT]: !0 } }]);
1020
+ const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [S.SNAPPING_POINT]: !0 } }]);
1021
1021
  this.snappedPointId = i;
1022
1022
  }
1023
1023
  t.lng = e[0], t.lat = e[1];
@@ -1035,7 +1035,7 @@ class Le extends A {
1035
1035
  const { isClosing: o, isPreviousClosing: s } = this.closingPoints.isClosingPoint(t);
1036
1036
  s || o ? (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.setCursor(this.cursors.close), i = [...e.slice(0, -2), e[0], e[0]]) : i = [...e.slice(0, -2), [t.lng, t.lat], e[0]];
1037
1037
  }
1038
- this.store.updateProperty([{ id: this.currentId, property: P.PROVISIONAL_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.updatePolygonGeometry(i, b.Provisional);
1038
+ this.store.updateProperty([{ id: this.currentId, property: S.PROVISIONAL_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.updatePolygonGeometry(i, b.Provisional);
1039
1039
  }
1040
1040
  updatePolygonGeometry(t, e) {
1041
1041
  if (!this.currentId) return !1;
@@ -1070,20 +1070,20 @@ class Le extends A {
1070
1070
  if (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.currentCoordinate === 0) {
1071
1071
  const e = this.snapCoordinate(t);
1072
1072
  e && (t.lng = e[0], t.lat = e[1]);
1073
- const [i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0, [P.COMMITTED_COORDINATE_COUNT]: this.currentCoordinate + 1, [P.PROVISIONAL_COORDINATE_COUNT]: this.currentCoordinate + 1 } }]);
1073
+ const [i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0, [S.COMMITTED_COORDINATE_COUNT]: this.currentCoordinate + 1, [S.PROVISIONAL_COORDINATE_COUNT]: this.currentCoordinate + 1 } }]);
1074
1074
  this.currentId = i, this.currentCoordinate++, this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(i), this.setDrawing();
1075
1075
  } else if (this.currentCoordinate === 1 && this.currentId) {
1076
1076
  const e = this.snapCoordinate(t);
1077
1077
  e && (t.lng = e[0], t.lat = e[1]);
1078
1078
  const i = this.store.getGeometryCopy(this.currentId);
1079
1079
  if (tt([t.lng, t.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], i.coordinates[0][0]], b.Commit)) return;
1080
- this.store.updateProperty([{ id: this.currentId, property: P.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1080
+ this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1081
1081
  } else if (this.currentCoordinate === 2 && this.currentId) {
1082
1082
  const e = this.snapCoordinate(t);
1083
1083
  e && (t.lng = e[0], t.lat = e[1]);
1084
1084
  const i = this.store.getGeometryCopy(this.currentId).coordinates[0];
1085
1085
  if (tt([t.lng, t.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [t.lng, t.lat], [t.lng, t.lat], i[0]], b.Commit)) return;
1086
- this.currentCoordinate === 2 && this.closingPoints.create(i, "polygon"), this.store.updateProperty([{ id: this.currentId, property: P.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1086
+ this.currentCoordinate === 2 && this.closingPoints.create(i, "polygon"), this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1087
1087
  } else if (this.currentId) {
1088
1088
  const e = this.store.getGeometryCopy(this.currentId).coordinates[0], { isClosing: i, isPreviousClosing: o } = this.closingPoints.isClosingPoint(t);
1089
1089
  if (o || i) this.close();
@@ -1094,7 +1094,7 @@ class Le extends A {
1094
1094
  return { type: "Feature", geometry: { type: "Polygon", coordinates: a }, properties: {} };
1095
1095
  })([[...e.slice(0, -1), [t.lng, t.lat], e[0]]]);
1096
1096
  if (!this.updatePolygonGeometry(n.geometry.coordinates[0], b.Commit)) return;
1097
- this.store.updateProperty([{ id: this.currentId, property: P.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++, this.closingPoints.ids.length && this.closingPoints.update(n.geometry.coordinates[0]);
1097
+ this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++, this.closingPoints.ids.length && this.closingPoints.update(n.geometry.coordinates[0]);
1098
1098
  }
1099
1099
  }
1100
1100
  }
@@ -1117,7 +1117,7 @@ class Le extends A {
1117
1117
  }
1118
1118
  if (this.editedFeatureId && i) {
1119
1119
  if (!this.editedPointId) {
1120
- const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [P.EDITED]: !0 } }]);
1120
+ const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [S.EDITED]: !0 } }]);
1121
1121
  this.editedPointId = o;
1122
1122
  }
1123
1123
  this.setCursor(this.cursors.dragStart), e(!1);
@@ -1128,10 +1128,10 @@ class Le extends A {
1128
1128
  const i = this.store.getGeometryCopy(this.editedFeatureId), o = i.coordinates[0];
1129
1129
  this.editedSnapType === "coordinate" || this.editedSnapType === "line" && this.editedInsertIndex !== void 0 ? this.editedFeatureCoordinateIndex === 0 || this.editedFeatureCoordinateIndex === i.coordinates[0].length - 1 ? (o[0] = [t.lng, t.lat], o[o.length - 1] = [t.lng, t.lat]) : o[this.editedFeatureCoordinateIndex] = [t.lng, t.lat] : this.editedSnapType === "line" && this.editedInsertIndex === void 0 && (this.editedInsertIndex = this.editedFeatureCoordinateIndex + 1, i.coordinates[0].splice(this.editedInsertIndex, 0, [t.lng, t.lat]), this.editedFeatureCoordinateIndex++);
1130
1130
  const s = { type: "Polygon", coordinates: i.coordinates };
1131
- this.validate && !this.validate({ type: "Feature", geometry: s, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: s }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.editedFeatureId), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !0 }]));
1131
+ this.validate && !this.validate({ type: "Feature", geometry: s, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: s }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.editedFeatureId), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
1132
1132
  }
1133
1133
  onDragEnd(t, e) {
1134
- this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: P.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, e(!0));
1134
+ this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, e(!0));
1135
1135
  }
1136
1136
  cleanUp() {
1137
1137
  const t = this.currentId, e = this.snappedPointId, i = this.editedPointId;
@@ -1146,7 +1146,7 @@ class Le extends A {
1146
1146
  if (t.properties.mode === this.mode) {
1147
1147
  if (t.geometry.type === "Polygon") return e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = j, e;
1148
1148
  if (t.geometry.type === "Point") {
1149
- const i = t.properties[P.EDITED], o = t.properties[P.COORDINATE_POINT], s = i ? "editedPoint" : t.properties[P.CLOSING_POINT] ? "closingPoint" : t.properties[P.SNAPPING_POINT] ? "snappingPoint" : o ? "coordinatePoint" : void 0;
1149
+ const i = t.properties[S.EDITED], o = t.properties[S.COORDINATE_POINT], s = i ? "editedPoint" : t.properties[S.CLOSING_POINT] ? "closingPoint" : t.properties[S.SNAPPING_POINT] ? "snappingPoint" : o ? "coordinatePoint" : void 0;
1150
1150
  if (!s) return e;
1151
1151
  const n = { editedPoint: { width: this.styles.editedPointOutlineWidth, color: this.styles.editedPointColor, outlineColor: this.styles.editedPointOutlineColor, outlineWidth: this.styles.editedPointOutlineWidth }, closingPoint: { width: this.styles.closingPointWidth, color: this.styles.closingPointColor, outlineColor: this.styles.closingPointOutlineColor, outlineWidth: this.styles.closingPointOutlineWidth }, snappingPoint: { width: this.styles.snappingPointWidth, color: this.styles.snappingPointColor, outlineColor: this.styles.snappingPointOutlineColor, outlineWidth: this.styles.snappingPointOutlineWidth }, coordinatePoint: { width: this.styles.coordinatePointWidth, color: this.styles.coordinatePointColor, outlineColor: this.styles.coordinatePointOutlineColor, outlineWidth: this.styles.coordinatePointOutlineWidth } };
1152
1152
  return e.pointWidth = this.getNumericStylingValue(n[s].width, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(n[s].color, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(n[s].outlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(n[s].outlineWidth, 2, t), e.zIndex = i ? 40 : o ? 20 : 30, e;
@@ -1183,7 +1183,7 @@ class Fe extends A {
1183
1183
  const t = this.currentRectangleId;
1184
1184
  if (t) {
1185
1185
  const e = pt(this.store.getGeometryCopy(t));
1186
- e && this.store.updateGeometry([{ id: t, geometry: e }]), this.store.updateProperty([{ id: t, property: P.CURRENTLY_DRAWING, value: void 0 }]);
1186
+ e && this.store.updateGeometry([{ id: t, geometry: e }]), this.store.updateProperty([{ id: t, property: S.CURRENTLY_DRAWING, value: void 0 }]);
1187
1187
  }
1188
1188
  this.center = void 0, this.currentRectangleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted(), t !== void 0 && this.onFinish(t, { mode: this.mode, action: "draw" });
1189
1189
  }
@@ -1196,7 +1196,7 @@ class Fe extends A {
1196
1196
  onClick(t) {
1197
1197
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) if (this.clickCount === 0) {
1198
1198
  this.center = [t.lng, t.lat];
1199
- const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }]);
1199
+ const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
1200
1200
  this.currentRectangleId = e, this.clickCount++, this.setDrawing();
1201
1201
  } else this.updateRectangle(t, b.Finish), this.close();
1202
1202
  }
@@ -1287,8 +1287,8 @@ function Me(r, t, e) {
1287
1287
  const o = i / Se, s = r[0] * Math.PI / 180, n = D(r[1]), a = D(e), l = o * Math.cos(a);
1288
1288
  let d = n + l;
1289
1289
  Math.abs(d) > Math.PI / 2 && (d = d > 0 ? Math.PI - d : -Math.PI - d);
1290
- const c = Math.log(Math.tan(d / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4)), h = Math.abs(c) > 1e-11 ? l / c : Math.cos(n), u = [(180 * (s + o * Math.sin(a) / h) / Math.PI + 540) % 360 - 180, 180 * d / Math.PI];
1291
- return u[0] += u[0] - r[0] > 180 ? -360 : r[0] - u[0] > 180 ? 360 : 0, u;
1290
+ const c = Math.log(Math.tan(d / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4)), h = Math.abs(c) > 1e-11 ? l / c : Math.cos(n), p = [(180 * (s + o * Math.sin(a) / h) / Math.PI + 540) % 360 - 180, 180 * d / Math.PI];
1291
+ return p[0] += p[0] - r[0] > 180 ? -360 : r[0] - p[0] > 180 ? 360 : 0, p;
1292
1292
  }
1293
1293
  function De(r, t, e, i, o) {
1294
1294
  const s = i(r[0], r[1]), n = i(t[0], t[1]), { lng: a, lat: l } = o((s.x + n.x) / 2, (s.y + n.y) / 2);
@@ -1322,7 +1322,7 @@ class xi extends B {
1322
1322
  }
1323
1323
  insert(t, e, i) {
1324
1324
  const o = this.store.getGeometryCopy(e), { midPointFeatureId: s, midPointSegment: n } = this.store.getPropertiesCopy(e), a = this.store.getGeometryCopy(s), l = a.type === "Polygon" ? a.coordinates[0] : a.coordinates;
1325
- l.splice(n + 1, 0, o.coordinates), a.coordinates = a.type === "Polygon" ? [l] : l, this.store.updateGeometry([{ id: s, geometry: a }]), this.store.getPropertiesCopy(t)[P.COORDINATE_POINT_IDS] && this.coordinatePointBehavior.createOrUpdate(t), this.store.delete([...this._midPoints, ...this.selectionPointBehavior.ids]), this.create(l, s, i), this.selectionPointBehavior.create(l, a.type, s);
1325
+ l.splice(n + 1, 0, o.coordinates), a.coordinates = a.type === "Polygon" ? [l] : l, this.store.updateGeometry([{ id: s, geometry: a }]), this.store.getPropertiesCopy(t)[S.COORDINATE_POINT_IDS] && this.coordinatePointBehavior.createOrUpdate(t), this.store.delete([...this._midPoints, ...this.selectionPointBehavior.ids]), this.create(l, s, i), this.selectionPointBehavior.create(l, a.type, s);
1326
1326
  }
1327
1327
  create(t, e, i) {
1328
1328
  if (!this.store.has(e)) throw new Error("Store does not have feature with this id");
@@ -1388,21 +1388,21 @@ class bi extends B {
1388
1388
  find(t, e) {
1389
1389
  let i, o, s, n, a = 1 / 0, l = 1 / 0, d = 1 / 0;
1390
1390
  const c = this.createClickBoundingBox.create(t), h = this.store.search(c);
1391
- for (let u = 0; u < h.length; u++) {
1392
- const p = h[u], g = p.geometry;
1391
+ for (let p = 0; p < h.length; p++) {
1392
+ const u = h[p], g = u.geometry;
1393
1393
  if (g.type === "Point") {
1394
- if (p.properties.selectionPoint || p.properties.coordinatePoint || !e && p.properties[k.MID_POINT]) continue;
1394
+ if (u.properties.selectionPoint || u.properties.coordinatePoint || !e && u.properties[k.MID_POINT]) continue;
1395
1395
  const y = this.pixelDistance.measure(t, g.coordinates);
1396
- p.properties[k.MID_POINT] && y < this.pointerDistance && y < d ? (d = y, s = p) : !p.properties[k.MID_POINT] && y < this.pointerDistance && y < a && (a = y, i = p);
1396
+ u.properties[k.MID_POINT] && y < this.pointerDistance && y < d ? (d = y, s = u) : !u.properties[k.MID_POINT] && y < this.pointerDistance && y < a && (a = y, i = u);
1397
1397
  } else if (g.type === "LineString") {
1398
1398
  if (i) continue;
1399
1399
  for (let y = 0; y < g.coordinates.length - 1; y++) {
1400
1400
  const m = g.coordinates[y], v = g.coordinates[y + 1], C = Dt({ x: t.containerX, y: t.containerY }, this.project(m[0], m[1]), this.project(v[0], v[1]));
1401
- C < this.pointerDistance && C < l && (l = C, o = p);
1401
+ C < this.pointerDistance && C < l && (l = C, o = u);
1402
1402
  }
1403
1403
  } else if (g.type === "Polygon") {
1404
1404
  if (i || o) continue;
1405
- _e([t.lng, t.lat], g.coordinates) && (n = p);
1405
+ _e([t.lng, t.lat], g.coordinates) && (n = u);
1406
1406
  }
1407
1407
  }
1408
1408
  return { clickedFeature: i || o || n, clickedMidPoint: s };
@@ -1433,16 +1433,16 @@ class Ei extends B {
1433
1433
  if (i.type === "Polygon" ? (s = i.coordinates[0], n = s.length - 1) : (s = i.coordinates, n = s.length), !this.dragPosition) return !1;
1434
1434
  for (let c = 0; c < n; c++) {
1435
1435
  const h = s[c];
1436
- let u, p;
1436
+ let p, u;
1437
1437
  if (this.config.projection === "web-mercator") {
1438
- const g = O(this.dragPosition[0], this.dragPosition[1]), y = O(o[0], o[1]), m = O(h[0], h[1]), v = { x: g.x - y.x, y: g.y - y.y }, C = m.x - v.x, f = m.y - v.y, { lng: S, lat: I } = R(C, f);
1439
- u = S, p = I;
1438
+ const g = O(this.dragPosition[0], this.dragPosition[1]), y = O(o[0], o[1]), m = O(h[0], h[1]), v = { x: g.x - y.x, y: g.y - y.y }, C = m.x - v.x, f = m.y - v.y, { lng: P, lat: I } = R(C, f);
1439
+ p = P, u = I;
1440
1440
  } else {
1441
1441
  const g = [this.dragPosition[0] - o[0], this.dragPosition[1] - o[1]];
1442
- u = h[0] - g[0], p = h[1] - g[1];
1442
+ p = h[0] - g[0], u = h[1] - g[1];
1443
1443
  }
1444
- if (u = w(u, this.config.coordinatePrecision), p = w(p, this.config.coordinatePrecision), u > 180 || u < -180 || p > 90 || p < -90) return !1;
1445
- s[c] = [u, p];
1444
+ if (p = w(p, this.config.coordinatePrecision), u = w(u, this.config.coordinatePrecision), p > 180 || p < -180 || u > 90 || u < -90) return !1;
1445
+ s[c] = [p, u];
1446
1446
  }
1447
1447
  i.type === "Polygon" && (s[s.length - 1] = [s[0][0], s[0][1]]);
1448
1448
  const a = this.selectionPoints.getUpdated(s) || [], l = this.midPoints.getUpdated(s) || [], d = this.coordinatePoints.getUpdated(this.draggedFeatureId, s) || [];
@@ -1496,13 +1496,13 @@ class wi extends B {
1496
1496
  drag(t, e, i, o) {
1497
1497
  const s = this.draggedCoordinate.id;
1498
1498
  if (s === null) return !1;
1499
- const n = this.draggedCoordinate.index, a = this.store.getGeometryCopy(s), l = this.store.getPropertiesCopy(s), d = a.type === "LineString" ? a.coordinates : a.coordinates[0], c = a.type === "Polygon" && (n === d.length - 1 || n === 0), h = { type: "Feature", id: s, geometry: a, properties: l }, u = this.snapCoordinate(t, o, h);
1499
+ const n = this.draggedCoordinate.index, a = this.store.getGeometryCopy(s), l = this.store.getPropertiesCopy(s), d = a.type === "LineString" ? a.coordinates : a.coordinates[0], c = a.type === "Polygon" && (n === d.length - 1 || n === 0), h = { type: "Feature", id: s, geometry: a, properties: l }, p = this.snapCoordinate(t, o, h);
1500
1500
  if (t.lng > 180 || t.lng < -180 || t.lat > 90 || t.lat < -90) return !1;
1501
1501
  if (c) {
1502
1502
  const v = d.length - 1;
1503
- d[0] = u, d[v] = u;
1504
- } else d[n] = u;
1505
- const p = this.selectionPoints.getOneUpdated(n, u), g = p ? [p] : [], y = this.midPoints.getUpdated(d) || [], m = this.coordinatePoints.getUpdated(s, d) || [];
1503
+ d[0] = p, d[v] = p;
1504
+ } else d[n] = p;
1505
+ const u = this.selectionPoints.getOneUpdated(n, p), g = u ? [u] : [], y = this.midPoints.getUpdated(d) || [], m = this.coordinatePoints.getUpdated(s, d) || [];
1506
1506
  return !(a.type !== "Point" && !e && Tt({ geometry: a }) || i && !i(h, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional }).valid || (this.store.updateGeometry([{ id: s, geometry: a }, ...g, ...y, ...m]), 0));
1507
1507
  }
1508
1508
  isDragging() {
@@ -1537,8 +1537,8 @@ function _t(r) {
1537
1537
  let i = 0, o = 0, s = 0;
1538
1538
  const n = e.length;
1539
1539
  for (let a = 0; a < n - 1; a++) {
1540
- const [l, d] = e[a], [c, h] = e[a + 1], u = l * h - c * d;
1541
- i += u, o += (l + c) * u, s += (d + h) * u;
1540
+ const [l, d] = e[a], [c, h] = e[a + 1], p = l * h - c * d;
1541
+ i += p, o += (l + c) * p, s += (d + h) * p;
1542
1542
  }
1543
1543
  return i /= 2, o /= 6 * i, s /= 6 * i, { x: o, y: s };
1544
1544
  })(t) : (function(e) {
@@ -1567,21 +1567,21 @@ class Li extends B {
1567
1567
  const a = { type: "Feature", geometry: o, properties: {} };
1568
1568
  if (this.config.projection === "web-mercator") {
1569
1569
  this.selectedGeometryWebMercatorCentroid || (this.selectedGeometryWebMercatorCentroid = _t(a));
1570
- const u = O(t.lng, t.lat);
1571
- if (n = G(this.selectedGeometryWebMercatorCentroid, u), n === 0) return;
1570
+ const p = O(t.lng, t.lat);
1571
+ if (n = G(this.selectedGeometryWebMercatorCentroid, p), n === 0) return;
1572
1572
  if (!this.lastBearing) return void (this.lastBearing = n);
1573
1573
  ke(a, -(this.lastBearing - n));
1574
1574
  } else {
1575
1575
  if (this.config.projection !== "globe") throw new Error("Unsupported projection");
1576
1576
  if (this.selectedGeometryCentroid || (this.selectedGeometryCentroid = ae({ geometry: o })), n = Mt(this.selectedGeometryCentroid, s), !this.lastBearing) return void (this.lastBearing = n + 180);
1577
- (function(u, p) {
1578
- if (p === 0 || p === 360 || p === -360) return u;
1579
- const g = ae(u);
1580
- (u.geometry.type === "Polygon" ? u.geometry.coordinates[0] : u.geometry.coordinates).forEach((y) => {
1581
- const m = Mt(g, y) + p, v = (function(f, S) {
1582
- f[0] += f[0] - S[0] > 180 ? -360 : S[0] - f[0] > 180 ? 360 : 0;
1583
- const I = Se, E = S[1] * Math.PI / 180, L = f[1] * Math.PI / 180, M = L - E;
1584
- let N = Math.abs(f[0] - S[0]) * Math.PI / 180;
1577
+ (function(p, u) {
1578
+ if (u === 0 || u === 360 || u === -360) return p;
1579
+ const g = ae(p);
1580
+ (p.geometry.type === "Polygon" ? p.geometry.coordinates[0] : p.geometry.coordinates).forEach((y) => {
1581
+ const m = Mt(g, y) + u, v = (function(f, P) {
1582
+ f[0] += f[0] - P[0] > 180 ? -360 : P[0] - f[0] > 180 ? 360 : 0;
1583
+ const I = Se, E = P[1] * Math.PI / 180, L = f[1] * Math.PI / 180, M = L - E;
1584
+ let N = Math.abs(f[0] - P[0]) * Math.PI / 180;
1585
1585
  N > Math.PI && (N -= 2 * Math.PI);
1586
1586
  const _ = Math.log(Math.tan(L / 2 + Math.PI / 4) / Math.tan(E / 2 + Math.PI / 4)), T = Math.abs(_) > 1e-11 ? M / _ : Math.cos(E);
1587
1587
  return Math.sqrt(M * M + T * T * N * N) * I;
@@ -1591,8 +1591,8 @@ class Li extends B {
1591
1591
  })(a, -(this.lastBearing - (n + 180)));
1592
1592
  }
1593
1593
  const l = o.type === "Polygon" ? o.coordinates[0] : o.coordinates;
1594
- l.forEach((u) => {
1595
- u[0] = w(u[0], this.coordinatePrecision), u[1] = w(u[1], this.coordinatePrecision);
1594
+ l.forEach((p) => {
1595
+ p[0] = w(p[0], this.coordinatePrecision), p[1] = w(p[1], this.coordinatePrecision);
1596
1596
  });
1597
1597
  const d = this.midPoints.getUpdated(l) || [], c = this.selectionPoints.getUpdated(l) || [], h = this.coordinatePoints.getUpdated(e, l) || [];
1598
1598
  if (i && !i({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional })) return !1;
@@ -1731,8 +1731,8 @@ class Mi extends B {
1731
1731
  }
1732
1732
  performWebMercatorScale(t, e, i, o, s) {
1733
1733
  t.forEach((n) => {
1734
- const { x: a, y: l } = O(n[0], n[1]), d = e + (a - e) * o, c = i + (l - i) * s, { lng: h, lat: u } = R(d, c);
1735
- n[0] = h, n[1] = u;
1734
+ const { x: a, y: l } = O(n[0], n[1]), d = e + (a - e) * o, c = i + (l - i) * s, { lng: h, lat: p } = R(d, c);
1735
+ n[0] = h, n[1] = p;
1736
1736
  });
1737
1737
  }
1738
1738
  getBBoxWebMercator(t) {
@@ -1819,9 +1819,9 @@ class Gt extends qe {
1819
1819
  onRightClick(t) {
1820
1820
  if (!this.selectionPoints.ids.length) return;
1821
1821
  let e, i = 1 / 0;
1822
- if (this.selectionPoints.ids.forEach((u) => {
1823
- const p = this.store.getGeometryCopy(u), g = this.pixelDistance.measure(t, p.coordinates);
1824
- g < this.pointerDistance && g < i && (i = g, e = this.store.getPropertiesCopy(u));
1822
+ if (this.selectionPoints.ids.forEach((p) => {
1823
+ const u = this.store.getGeometryCopy(p), g = this.pixelDistance.measure(t, u.coordinates);
1824
+ g < this.pointerDistance && g < i && (i = g, e = this.store.getPropertiesCopy(p));
1825
1825
  }), !e) return;
1826
1826
  const o = e.selectionPointFeatureId, s = e.index, n = this.store.getPropertiesCopy(o), a = this.flags[n.mode], l = this.validations[n.mode];
1827
1827
  if (!(a && a.feature && a.feature.coordinates && a.feature.coordinates.deletable)) return;
@@ -2004,8 +2004,8 @@ class _i extends A {
2004
2004
  function Te(r, t, e, i, o) {
2005
2005
  for (; i > e; ) {
2006
2006
  if (i - e > 600) {
2007
- const l = i - e + 1, d = t - e + 1, c = Math.log(l), h = 0.5 * Math.exp(2 * c / 3), u = 0.5 * Math.sqrt(c * h * (l - h) / l) * (d - l / 2 < 0 ? -1 : 1);
2008
- Te(r, t, Math.max(e, Math.floor(t - d * h / l + u)), Math.min(i, Math.floor(t + (l - d) * h / l + u)), o);
2007
+ const l = i - e + 1, d = t - e + 1, c = Math.log(l), h = 0.5 * Math.exp(2 * c / 3), p = 0.5 * Math.sqrt(c * h * (l - h) / l) * (d - l / 2 < 0 ? -1 : 1);
2008
+ Te(r, t, Math.max(e, Math.floor(t - d * h / l + p)), Math.min(i, Math.floor(t + (l - d) * h / l + p)), o);
2009
2009
  }
2010
2010
  const s = r[t];
2011
2011
  let n = e, a = i;
@@ -2160,9 +2160,9 @@ class Wi {
2160
2160
  for (let c = e; c <= i; c += d) {
2161
2161
  const h = Math.min(c + d - 1, i);
2162
2162
  de(t, c, h, l, this.compareMinY);
2163
- for (let u = c; u <= h; u += l) {
2164
- const p = Math.min(u + l - 1, h);
2165
- n.children.push(this._build(t, u, p, o - 1));
2163
+ for (let p = c; p <= h; p += l) {
2164
+ const u = Math.min(p + l - 1, h);
2165
+ n.children.push(this._build(t, p, u, o - 1));
2166
2166
  }
2167
2167
  }
2168
2168
  return J(n, this.toBBox), n;
@@ -2171,8 +2171,8 @@ class Wi {
2171
2171
  for (; o.push(e), !e.leaf && o.length - 1 !== i; ) {
2172
2172
  let a, l = 1 / 0, d = 1 / 0;
2173
2173
  for (let c = 0; c < e.children.length; c++) {
2174
- const h = e.children[c], u = Et(h), p = (s = t, n = h, (Math.max(n.maxX, s.maxX) - Math.min(n.minX, s.minX)) * (Math.max(n.maxY, s.maxY) - Math.min(n.minY, s.minY)) - u);
2175
- p < d ? (d = p, l = u < l ? u : l, a = h) : p === d && u < l && (l = u, a = h);
2174
+ const h = e.children[c], p = Et(h), u = (s = t, n = h, (Math.max(n.maxX, s.maxX) - Math.min(n.minX, s.minX)) * (Math.max(n.maxY, s.maxY) - Math.min(n.minY, s.minY)) - p);
2175
+ u < d ? (d = u, l = p < l ? p : l, a = h) : u === d && p < l && (l = p, a = h);
2176
2176
  }
2177
2177
  e = a || e.children[0];
2178
2178
  }
@@ -2301,23 +2301,27 @@ class Ai {
2301
2301
  if (t.length === 0) return [];
2302
2302
  let s = this.clone(t);
2303
2303
  const n = [], a = [];
2304
- return s = s.filter((l) => {
2305
- l.id == null && (l.id = this.idStrategy.getId());
2306
- const d = l.id;
2304
+ s = s.filter((d) => {
2305
+ d.id == null && (d.id = this.idStrategy.getId());
2306
+ const c = d.id;
2307
2307
  if (e) {
2308
- const c = e(l);
2309
- if (!c.valid) return a.push({ id: d, valid: !1, reason: c.reason }), !1;
2308
+ const h = e(d);
2309
+ if (!h.valid) return n.push({ id: c, valid: !1, reason: h.reason }), !1;
2310
2310
  }
2311
2311
  if (this.tracked) {
2312
- if (l.properties.createdAt) {
2313
- if (!qt(l.properties.createdAt)) return a.push({ id: l.id, valid: !1, reason: "createdAt is not a valid numeric timestamp" }), !1;
2314
- } else l.properties.createdAt = +/* @__PURE__ */ new Date();
2315
- if (l.properties.updatedAt) {
2316
- if (!qt(l.properties.updatedAt)) return a.push({ id: l.id, valid: !1, reason: "updatedAt is not a valid numeric timestamp" }), !1;
2317
- } else l.properties.updatedAt = +/* @__PURE__ */ new Date();
2312
+ if (d.properties.createdAt) {
2313
+ if (!qt(d.properties.createdAt)) return n.push({ id: d.id, valid: !1, reason: "createdAt is not a valid numeric timestamp" }), !1;
2314
+ } else d.properties.createdAt = +/* @__PURE__ */ new Date();
2315
+ if (d.properties.updatedAt) {
2316
+ if (!qt(d.properties.updatedAt)) return n.push({ id: d.id, valid: !1, reason: "updatedAt is not a valid numeric timestamp" }), !1;
2317
+ } else d.properties.updatedAt = +/* @__PURE__ */ new Date();
2318
2318
  }
2319
- return this.has(d) ? (a.push({ id: d, valid: !1, reason: `Feature already exists with this id: ${d}` }), !1) : (this.store[d] = l, n.push(d), i && i(l), a.push({ id: d, valid: !0 }), !0);
2320
- }), this.spatialIndex.load(s), n.length > 0 && this._onChange(n, "create", o), a;
2319
+ return this.has(c) ? (n.push({ id: c, valid: !1, reason: `Feature already exists with this id: ${c}` }), !1) : (this.store[c] = d, a.push(d), n.push({ id: c, valid: !0 }), !0);
2320
+ }), this.spatialIndex.load(s);
2321
+ const l = a.map(({ id: d }) => d);
2322
+ return l.length > 0 && (this._onChange(l, "create", o), i && a.forEach((d) => {
2323
+ i(d);
2324
+ })), n;
2321
2325
  }
2322
2326
  search(t, e) {
2323
2327
  const i = this.spatialIndex.search(t).map((o) => this.store[o]);
@@ -2402,7 +2406,7 @@ class We extends A {
2402
2406
  }
2403
2407
  close() {
2404
2408
  if (this.currentId === void 0) return;
2405
- this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
2409
+ this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2406
2410
  const t = this.currentId;
2407
2411
  this.currentCoordinate = 0, this.currentId = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(t, { mode: this.mode, action: "draw" });
2408
2412
  }
@@ -2420,11 +2424,11 @@ class We extends A {
2420
2424
  const o = 1 / Math.pow(10, this.coordinatePrecision - 1), s = Math.max(1e-6, o);
2421
2425
  i = [e[0], [t.lng, t.lat], [t.lng, t.lat - s], e[0]];
2422
2426
  } else if (this.currentCoordinate === 2) {
2423
- const o = e[0], s = e[1], n = De(o, s, this.coordinatePrecision, this.project, this.unproject), a = O(o[0], o[1]), l = O(n[0], n[1]), d = O(s[0], s[1]), c = O(t.lng, t.lat), h = F(c, a) < F(c, d), u = ce(a, l, c), p = h ? 90 - u : ce(a, l, c) - 90, g = F(l, c), y = Math.cos(D(p)) * g, m = G(a, d) + ((function(I, E, L) {
2427
+ const o = e[0], s = e[1], n = De(o, s, this.coordinatePrecision, this.project, this.unproject), a = O(o[0], o[1]), l = O(n[0], n[1]), d = O(s[0], s[1]), c = O(t.lng, t.lat), h = F(c, a) < F(c, d), p = ce(a, l, c), u = h ? 90 - p : ce(a, l, c) - 90, g = F(l, c), y = Math.cos(D(u)) * g, m = G(a, d) + ((function(I, E, L) {
2424
2428
  const M = (L.x - E.x) * (I.y - E.y) - (L.y - E.y) * (I.x - E.x);
2425
2429
  return M > 1e-10 ? "left" : M < -1e-10 ? "right" : "left";
2426
- })(a, d, c) === "right" ? -90 : 90), v = ht(a, y, m), C = ht(d, y, m), f = R(v.x, v.y), S = R(C.x, C.y);
2427
- i = [e[0], e[1], [S.lng, S.lat], [f.lng, f.lat], e[0]];
2430
+ })(a, d, c) === "right" ? -90 : 90), v = ht(a, y, m), C = ht(d, y, m), f = R(v.x, v.y), P = R(C.x, C.y);
2431
+ i = [e[0], e[1], [P.lng, P.lat], [f.lng, f.lat], e[0]];
2428
2432
  }
2429
2433
  i && this.updatePolygonGeometry(this.currentId, i, b.Provisional);
2430
2434
  }
@@ -2434,7 +2438,7 @@ class We extends A {
2434
2438
  }
2435
2439
  onClick(t) {
2436
2440
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) if (this.currentCoordinate > 0 && !this.mouseMove && this.onMouseMove(t), this.mouseMove = !1, this.currentCoordinate === 0) {
2437
- const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }]);
2441
+ const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2438
2442
  this.currentId = e, this.currentCoordinate++, this.setDrawing();
2439
2443
  } else if (this.currentCoordinate === 1 && this.currentId) {
2440
2444
  const e = this.store.getGeometryCopy(this.currentId);
@@ -2489,7 +2493,7 @@ class je extends A {
2489
2493
  close() {
2490
2494
  if (this.currentId === void 0) return;
2491
2495
  const t = pt(this.store.getGeometryCopy(this.currentId));
2492
- t && this.store.updateGeometry([{ id: this.currentId, geometry: t }]), this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
2496
+ t && this.store.updateGeometry([{ id: this.currentId, geometry: t }]), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2493
2497
  const e = this.currentId;
2494
2498
  this.currentCoordinate = 0, this.currentId = void 0, this.direction = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
2495
2499
  }
@@ -2512,13 +2516,13 @@ class je extends A {
2512
2516
  const f = Be(a, l, d);
2513
2517
  this.direction = f ? "clockwise" : "anticlockwise";
2514
2518
  }
2515
- const c = F(a, l), h = G(a, l), u = G(a, d), p = this.arcPoints, g = [o], y = X(h), m = X(u);
2519
+ const c = F(a, l), h = G(a, l), p = G(a, d), u = this.arcPoints, g = [o], y = X(h), m = X(p);
2516
2520
  let v;
2517
2521
  this.direction === "anticlockwise" ? (v = m - y, v < 0 && (v += 360)) : (v = y - m, v < 0 && (v += 360));
2518
- const C = (this.direction === "anticlockwise" ? 1 : -1) * v / p;
2522
+ const C = (this.direction === "anticlockwise" ? 1 : -1) * v / u;
2519
2523
  g.push(s);
2520
- for (let f = 0; f <= p; f++) {
2521
- const S = ht(a, c, y + f * C), { lng: I, lat: E } = R(S.x, S.y), L = [w(I, this.coordinatePrecision), w(E, this.coordinatePrecision)];
2524
+ for (let f = 0; f <= u; f++) {
2525
+ const P = ht(a, c, y + f * C), { lng: I, lat: E } = R(P.x, P.y), L = [w(I, this.coordinatePrecision), w(E, this.coordinatePrecision)];
2522
2526
  L[0] !== g[g.length - 1][0] && L[1] !== g[g.length - 1][1] && g.push(L);
2523
2527
  }
2524
2528
  g.push(o), i = [...g];
@@ -2531,7 +2535,7 @@ class je extends A {
2531
2535
  }
2532
2536
  onClick(t) {
2533
2537
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) if (this.currentCoordinate > 0 && !this.mouseMove && this.onMouseMove(t), this.mouseMove = !1, this.currentCoordinate === 0) {
2534
- const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }]);
2538
+ const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2535
2539
  this.currentId = e, this.currentCoordinate++, this.setDrawing();
2536
2540
  } else if (this.currentCoordinate === 1 && this.currentId) {
2537
2541
  const e = this.store.getGeometryCopy(this.currentId);
@@ -2581,7 +2585,7 @@ class Ae extends A {
2581
2585
  const t = this.currentStartingPointId, e = this.currentInitialArcId, i = this.currentId;
2582
2586
  if (t && this.store.delete([t]), e && this.store.delete([e]), this.currentId) {
2583
2587
  const o = pt(this.store.getGeometryCopy(this.currentId));
2584
- o && this.store.updateGeometry([{ id: this.currentId, geometry: o }]), this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
2588
+ o && this.store.updateGeometry([{ id: this.currentId, geometry: o }]), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2585
2589
  }
2586
2590
  this.currentCoordinate = 0, this.currentStartingPointId = void 0, this.currentInitialArcId = void 0, this.currentId = void 0, this.direction = void 0, this.state === "drawing" && this.setStarted(), i && this.onFinish(i, { mode: this.mode, action: "draw" });
2587
2591
  }
@@ -2599,26 +2603,26 @@ class Ae extends A {
2599
2603
  const C = Be(l, n, a);
2600
2604
  this.direction = C ? "clockwise" : "anticlockwise";
2601
2605
  }
2602
- const c = G(l, n), h = G(l, a), u = this.arcPoints, p = [o], g = X(c), y = X(h);
2606
+ const c = G(l, n), h = G(l, a), p = this.arcPoints, u = [o], g = X(c), y = X(h);
2603
2607
  let m;
2604
2608
  this.direction === "anticlockwise" ? (m = y - g, m < 0 && (m += 360)) : (m = g - y, m < 0 && (m += 360));
2605
- const v = (this.direction === "anticlockwise" ? 1 : -1) * m / u;
2606
- for (let C = 0; C <= u; C++) {
2607
- const f = ht(l, d, g + C * v), { lng: S, lat: I } = R(f.x, f.y), E = [w(S, this.coordinatePrecision), w(I, this.coordinatePrecision)];
2608
- E[0] !== p[p.length - 1][0] && E[1] !== p[p.length - 1][1] && p.push(E);
2609
+ const v = (this.direction === "anticlockwise" ? 1 : -1) * m / p;
2610
+ for (let C = 0; C <= p; C++) {
2611
+ const f = ht(l, d, g + C * v), { lng: P, lat: I } = R(f.x, f.y), E = [w(P, this.coordinatePrecision), w(I, this.coordinatePrecision)];
2612
+ E[0] !== u[u.length - 1][0] && E[1] !== u[u.length - 1][1] && u.push(E);
2609
2613
  }
2610
- this.updateLineStringGeometry(this.currentInitialArcId, p, b.Provisional);
2614
+ this.updateLineStringGeometry(this.currentInitialArcId, u, b.Provisional);
2611
2615
  } else if (this.currentCoordinate === 3) {
2612
2616
  const e = this.store.getGeometryCopy(this.currentInitialArcId).coordinates;
2613
2617
  if (e.length < 2 || !this.direction) return;
2614
- const i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], s = e[e.length - 1], n = O(t.lng, t.lat), a = O(o[0], o[1]), l = O(s[0], s[1]), d = O(i[0], i[1]), c = F(d, a), h = F(d, n) < c ? a : n, u = G(d, n), p = G(d, a), g = G(d, l), y = X(p), m = X(g), v = X(u);
2618
+ const i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], s = e[e.length - 1], n = O(t.lng, t.lat), a = O(o[0], o[1]), l = O(s[0], s[1]), d = O(i[0], i[1]), c = F(d, a), h = F(d, n) < c ? a : n, p = G(d, n), u = G(d, a), g = G(d, l), y = X(u), m = X(g), v = X(p);
2615
2619
  if (this.notInSector({ normalizedCursor: v, normalizedStart: y, normalizedEnd: m, direction: this.direction })) return;
2616
- const C = this.getDeltaBearing(this.direction, y, m), f = this.arcPoints, S = (this.direction === "anticlockwise" ? 1 : -1) * C / f, I = F(d, h), E = [];
2620
+ const C = this.getDeltaBearing(this.direction, y, m), f = this.arcPoints, P = (this.direction === "anticlockwise" ? 1 : -1) * C / f, I = F(d, h), E = [];
2617
2621
  for (let L = 0; L <= f; L++) {
2618
- const M = ht(d, I, y + L * S), { lng: N, lat: _ } = R(M.x, M.y), T = [w(N, this.coordinatePrecision), w(_, this.coordinatePrecision)];
2622
+ const M = ht(d, I, y + L * P), { lng: N, lat: _ } = R(M.x, M.y), T = [w(N, this.coordinatePrecision), w(_, this.coordinatePrecision)];
2619
2623
  T[0] !== e[e.length - 1][0] && T[1] !== e[e.length - 1][1] && E.unshift(T);
2620
2624
  }
2621
- e.push(...E), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, b.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }]);
2625
+ e.push(...E), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, b.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2622
2626
  }
2623
2627
  }
2624
2628
  }
@@ -2784,7 +2788,7 @@ class Re extends A {
2784
2788
  }
2785
2789
  close() {
2786
2790
  if (this.currentId === void 0) return;
2787
- this.currentId && this.store.updateProperty([{ id: this.currentId, property: P.CURRENTLY_DRAWING, value: void 0 }]);
2791
+ this.currentId && this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2788
2792
  const t = this.currentId;
2789
2793
  if (this.validate && t) {
2790
2794
  const e = this.store.getGeometryCopy(t);
@@ -2800,8 +2804,8 @@ class Re extends A {
2800
2804
  }
2801
2805
  onMouseMove(t) {
2802
2806
  if (this.currentId === void 0 || this.startingClick === !1) return void this.setCursor(this.cursors.start);
2803
- const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates.length - 2, [o, s] = e.coordinates[i], { x: n, y: a } = this.project(o, s), l = F({ x: n, y: a }, { x: t.containerX, y: t.containerY }), [d, c] = e.coordinates[e.coordinates.length - 1], { x: h, y: u } = this.project(d, c), p = F({ x: h, y: u }, { x: t.containerX, y: t.containerY });
2804
- if (this.setCursor(p < this.pointerDistance ? this.cursors.close : this.cursors.start), l < this.minDistance) return;
2807
+ const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates.length - 2, [o, s] = e.coordinates[i], { x: n, y: a } = this.project(o, s), l = F({ x: n, y: a }, { x: t.containerX, y: t.containerY }), [d, c] = e.coordinates[e.coordinates.length - 1], { x: h, y: p } = this.project(d, c), u = F({ x: h, y: p }, { x: t.containerX, y: t.containerY });
2808
+ if (this.setCursor(u < this.pointerDistance ? this.cursors.close : this.cursors.start), l < this.minDistance) return;
2805
2809
  const g = { type: "LineString", coordinates: [...e.coordinates, [t.lng, t.lat]] };
2806
2810
  this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: g, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.store.updateGeometry([{ id: this.currentId, geometry: g }]), this.closingPointId && this.store.updateGeometry([{ id: this.closingPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]));
2807
2811
  }
@@ -2809,7 +2813,7 @@ class Re extends A {
2809
2813
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) {
2810
2814
  if (this.preventNewFeature) return;
2811
2815
  if (this.startingClick === !1) {
2812
- const [e, i] = this.store.create([{ geometry: { type: "LineString", coordinates: [[t.lng, t.lat], [t.lng, t.lat]] }, properties: { mode: this.mode, [P.CURRENTLY_DRAWING]: !0 } }, { geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: { mode: this.mode, [P.CLOSING_POINT]: !0 } }]);
2816
+ const [e, i] = this.store.create([{ geometry: { type: "LineString", coordinates: [[t.lng, t.lat], [t.lng, t.lat]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }, { geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
2813
2817
  return this.currentId = e, this.closingPointId = i, this.startingClick = !0, void (this.state !== "drawing" && this.setDrawing());
2814
2818
  }
2815
2819
  this.close();
@@ -2875,33 +2879,33 @@ class Zi {
2875
2879
  }
2876
2880
  }), this._modes = x({}, i, { static: this._mode }), this._eventListeners = { change: [], select: [], deselect: [], finish: [], ready: [] }, this._store = new Ai({ tracked: !!t.tracked, idStrategy: t.idStrategy ? t.idStrategy : void 0 });
2877
2881
  const s = (c) => {
2878
- const h = [], u = this._store.copyAll().filter((p) => !c.includes(p.id) || (h.push(p), !1));
2879
- return { changed: h, unchanged: u };
2882
+ const h = [], p = this._store.copyAll().filter((u) => !c.includes(u.id) || (h.push(u), !1));
2883
+ return { changed: h, unchanged: p };
2880
2884
  }, n = (c, h) => {
2881
- this._enabled && this._eventListeners.finish.forEach((u) => {
2882
- u(c, h);
2885
+ this._enabled && this._eventListeners.finish.forEach((p) => {
2886
+ p(c, h);
2883
2887
  });
2884
- }, a = (c, h, u) => {
2888
+ }, a = (c, h, p) => {
2885
2889
  if (!this._enabled) return;
2886
2890
  this._eventListeners.change.forEach((y) => {
2887
- y(c, h, u);
2891
+ y(c, h, p);
2888
2892
  });
2889
- const { changed: p, unchanged: g } = s(c);
2890
- h === "create" ? this._adapter.render({ created: p, deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles()) : h === "update" ? this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: p }, this.getModeStyles()) : h === "delete" ? this._adapter.render({ created: [], deletedIds: c, unchanged: g, updated: [] }, this.getModeStyles()) : h === "styling" && this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles());
2893
+ const { changed: u, unchanged: g } = s(c);
2894
+ h === "create" ? this._adapter.render({ created: u, deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles()) : h === "update" ? this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: u }, this.getModeStyles()) : h === "delete" ? this._adapter.render({ created: [], deletedIds: c, unchanged: g, updated: [] }, this.getModeStyles()) : h === "styling" && this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles());
2891
2895
  }, l = (c) => {
2892
2896
  if (!this._enabled) return;
2893
- this._eventListeners.select.forEach((p) => {
2894
- p(c);
2897
+ this._eventListeners.select.forEach((u) => {
2898
+ u(c);
2895
2899
  });
2896
- const { changed: h, unchanged: u } = s([c]);
2897
- this._adapter.render({ created: [], deletedIds: [], unchanged: u, updated: h }, this.getModeStyles());
2900
+ const { changed: h, unchanged: p } = s([c]);
2901
+ this._adapter.render({ created: [], deletedIds: [], unchanged: p, updated: h }, this.getModeStyles());
2898
2902
  }, d = (c) => {
2899
2903
  if (!this._enabled) return;
2900
- this._eventListeners.deselect.forEach((p) => {
2901
- p();
2904
+ this._eventListeners.deselect.forEach((u) => {
2905
+ u();
2902
2906
  });
2903
- const { changed: h, unchanged: u } = s([c]);
2904
- h && this._adapter.render({ created: [], deletedIds: [], unchanged: u, updated: h }, this.getModeStyles());
2907
+ const { changed: h, unchanged: p } = s([c]);
2908
+ h && this._adapter.render({ created: [], deletedIds: [], unchanged: p, updated: h }, this.getModeStyles());
2905
2909
  };
2906
2910
  Object.keys(this._modes).forEach((c) => {
2907
2911
  this._modes[c].register({ mode: c, store: this._store, setCursor: this._adapter.setCursor.bind(this._adapter), project: this._adapter.project.bind(this._adapter), unproject: this._adapter.unproject.bind(this._adapter), setDoubleClickToZoom: this._adapter.setDoubleClickToZoom.bind(this._adapter), onChange: a, onSelect: l, onDeselect: d, onFinish: n, coordinatePrecision: this._adapter.getCoordinatePrecision() });
@@ -2917,30 +2921,44 @@ class Zi {
2917
2921
  }), t;
2918
2922
  }
2919
2923
  featuresAtLocation({ lng: t, lat: e }, i) {
2920
- const o = i && i.pointerDistance !== void 0 ? i.pointerDistance : 30, s = !i || i.ignoreSelectFeatures === void 0 || i.ignoreSelectFeatures, n = !(!i || i.ignoreCoordinatePoints === void 0) && i.ignoreCoordinatePoints, a = !(!i || i.ignoreCurrentlyDrawing === void 0) && i.ignoreCurrentlyDrawing, l = !(!i || i.ignoreClosingPoints === void 0) && i.ignoreClosingPoints, d = this._adapter.unproject.bind(this._adapter), c = this._adapter.project.bind(this._adapter), h = c(t, e), u = be({ unproject: d, point: h, pointerDistance: o });
2921
- return this._store.search(u).filter((p) => {
2922
- if (s && (p.properties[k.MID_POINT] || p.properties[k.SELECTION_POINT]) || n && p.properties[P.COORDINATE_POINT] || l && p.properties[P.CLOSING_POINT] || a && p.properties[P.CURRENTLY_DRAWING]) return !1;
2923
- if (p.geometry.type === "Point") {
2924
- const g = p.geometry.coordinates, y = c(g[0], g[1]);
2924
+ const o = i && i.pointerDistance !== void 0 ? i.pointerDistance : 30, s = !i || i.ignoreSelectFeatures === void 0 || i.ignoreSelectFeatures, n = !(!i || i.ignoreCoordinatePoints === void 0) && i.ignoreCoordinatePoints, a = !(!i || i.ignoreCurrentlyDrawing === void 0) && i.ignoreCurrentlyDrawing, l = !(!i || i.ignoreClosingPoints === void 0) && i.ignoreClosingPoints, d = this._adapter.unproject.bind(this._adapter), c = this._adapter.project.bind(this._adapter), h = c(t, e), p = be({ unproject: d, point: h, pointerDistance: o });
2925
+ return this._store.search(p).filter((u) => {
2926
+ if (s && (u.properties[k.MID_POINT] || u.properties[k.SELECTION_POINT]) || n && u.properties[S.COORDINATE_POINT] || l && u.properties[S.CLOSING_POINT] || a && u.properties[S.CURRENTLY_DRAWING]) return !1;
2927
+ if (u.geometry.type === "Point") {
2928
+ const g = u.geometry.coordinates, y = c(g[0], g[1]);
2925
2929
  return F(h, y) < o;
2926
2930
  }
2927
- if (p.geometry.type === "LineString") {
2928
- const g = p.geometry.coordinates;
2931
+ if (u.geometry.type === "LineString") {
2932
+ const g = u.geometry.coordinates;
2929
2933
  for (let y = 0; y < g.length - 1; y++) {
2930
2934
  const m = g[y], v = g[y + 1];
2931
2935
  if (Dt(h, c(m[0], m[1]), c(v[0], v[1])) < o) return !0;
2932
2936
  }
2933
2937
  return !1;
2934
2938
  }
2935
- if (_e([t, e], p.geometry.coordinates)) return !0;
2939
+ if (_e([t, e], u.geometry.coordinates)) return !0;
2936
2940
  if (i != null && i.includePolygonsWithinPointerDistance) {
2937
- const g = p.geometry.coordinates;
2941
+ const g = u.geometry.coordinates;
2938
2942
  for (const y of g) for (let m = 0; m < y.length - 1; m++) {
2939
- const v = y[m], C = y[m + 1], f = c(v[0], v[1]), S = c(C[0], C[1]);
2940
- if (Dt(h, f, S) < o) return !0;
2943
+ const v = y[m], C = y[m + 1], f = c(v[0], v[1]), P = c(C[0], C[1]);
2944
+ if (Dt(h, f, P) < o) return !0;
2941
2945
  }
2942
2946
  }
2943
2947
  return !1;
2948
+ }).map((u) => {
2949
+ if (i == null || !i.addClosestCoordinateInfoToProperties) return u;
2950
+ let g;
2951
+ if (u.geometry.type === "Polygon") g = u.geometry.coordinates[0], g.pop();
2952
+ else {
2953
+ if (u.geometry.type !== "LineString") return u;
2954
+ g = u.geometry.coordinates;
2955
+ }
2956
+ let y, m = -1, v = 1 / 0;
2957
+ for (let C = 0; C < g.length; C++) {
2958
+ const f = g[C], P = F(c(f[0], f[1]), h);
2959
+ P < v && (m = C, v = P, y = f);
2960
+ }
2961
+ return u.properties.closestCoordinateIndexToEvent = m, u.properties.closestCoordinatePixelDistanceToEvent = v, u.properties.closestCoordinateDistanceKmToEvent = U(y, [t, e]), u;
2944
2962
  });
2945
2963
  }
2946
2964
  getSelectModeOrThrow() {
@@ -2954,7 +2972,7 @@ class Zi {
2954
2972
  return t && e !== this._instanceSelectMode && this.setMode(this._instanceSelectMode), this._modes[this._instanceSelectMode];
2955
2973
  }
2956
2974
  isGuidanceFeature(t) {
2957
- return !!(t.properties[k.MID_POINT] || t.properties[k.SELECTION_POINT] || t.properties[P.COORDINATE_POINT] || t.properties[P.SNAPPING_POINT]);
2975
+ return !!(t.properties[k.MID_POINT] || t.properties[k.SELECTION_POINT] || t.properties[S.COORDINATE_POINT] || t.properties[S.SNAPPING_POINT]);
2958
2976
  }
2959
2977
  setModeStyles(t, e) {
2960
2978
  if (this.checkEnabled(), !this._modes[t]) throw new Error("No mode with this name present");
@@ -2995,7 +3013,7 @@ class Zi {
2995
3013
  t.forEach((i) => {
2996
3014
  if (!this._store.has(i)) throw new Error(`No feature with id ${i}, can not delete`);
2997
3015
  const o = this._store.copy(i);
2998
- o.properties[k.SELECTED] && this.deselectFeature(i), o.properties[P.COORDINATE_POINT_IDS] && e.push(...o.properties[P.COORDINATE_POINT_IDS]);
3016
+ o.properties[k.SELECTED] && this.deselectFeature(i), o.properties[S.COORDINATE_POINT_IDS] && e.push(...o.properties[S.COORDINATE_POINT_IDS]);
2999
3017
  }), this._store.delete([...t, ...e], { origin: "api" });
3000
3018
  }
3001
3019
  selectFeature(t) {
@@ -3011,7 +3029,7 @@ class Zi {
3011
3029
  return this._store.has(t);
3012
3030
  }
3013
3031
  checkIsReservedProperty(t) {
3014
- return ![...Object.values(k), ...Object.values(P)].includes(t);
3032
+ return ![...Object.values(k), ...Object.values(S)].includes(t);
3015
3033
  }
3016
3034
  updateFeatureProperties(t, e) {
3017
3035
  if (!this._store.has(t)) throw new Error(`No feature with id ${t} present in store`);
@@ -3188,8 +3206,8 @@ class Qi extends Hi.TerraDrawBaseAdapter {
3188
3206
  if (!this._currentModeCallbacks) return;
3189
3207
  const i = [...t.created, ...t.updated, ...t.unchanged], o = [], s = [], n = [];
3190
3208
  for (let c = 0; c < i.length; c++) {
3191
- const h = i[c], { properties: u } = h, p = e[u.mode](h);
3192
- h.geometry.type === "Point" ? (u.pointColor = p.pointColor, u.pointOutlineColor = p.pointOutlineColor, u.pointOutlineWidth = p.pointOutlineWidth, u.pointWidth = p.pointWidth, u.zIndex = p.zIndex, o.push(h)) : h.geometry.type === "LineString" ? (u.lineStringColor = p.lineStringColor, u.lineStringWidth = p.lineStringWidth, s.push(h)) : h.geometry.type === "Polygon" && (u.polygonFillColor = p.polygonFillColor, u.polygonFillOpacity = p.polygonFillOpacity, u.polygonOutlineColor = p.polygonOutlineColor, u.polygonOutlineWidth = p.polygonOutlineWidth, n.push(h));
3209
+ const h = i[c], { properties: p } = h, u = e[p.mode](h);
3210
+ h.geometry.type === "Point" ? (p.pointColor = u.pointColor, p.pointOutlineColor = u.pointOutlineColor, p.pointOutlineWidth = u.pointOutlineWidth, p.pointWidth = u.pointWidth, p.zIndex = u.zIndex, o.push(h)) : h.geometry.type === "LineString" ? (p.lineStringColor = u.lineStringColor, p.lineStringWidth = u.lineStringWidth, s.push(h)) : h.geometry.type === "Polygon" && (p.polygonFillColor = u.polygonFillColor, p.polygonFillOpacity = u.polygonFillOpacity, p.polygonOutlineColor = u.polygonOutlineColor, p.polygonOutlineWidth = u.polygonOutlineWidth, n.push(h));
3193
3211
  }
3194
3212
  const a = this.changedIds.deletion || this.changedIds.styling, l = a || this.changedIds.linestrings, d = a || this.changedIds.polygons;
3195
3213
  (a || this.changedIds.points) && this._setGeoJSONLayerData("Point", o), l && this._setGeoJSONLayerData("LineString", s), d && this._setGeoJSONLayerData("Polygon", n), this.changedIds = { points: !1, linestrings: !1, polygons: !1, deletion: !1, styling: !1 };
@@ -4084,11 +4102,11 @@ function he(r) {
4084
4102
  }
4085
4103
  function Ge(r, t, e) {
4086
4104
  if (r !== null)
4087
- for (var i, o, s, n, a, l, d, c = 0, h = 0, u, p = r.type, g = p === "FeatureCollection", y = p === "Feature", m = g ? r.features.length : 1, v = 0; v < m; v++) {
4088
- d = g ? r.features[v].geometry : y ? r.geometry : r, u = d ? d.type === "GeometryCollection" : !1, a = u ? d.geometries.length : 1;
4105
+ for (var i, o, s, n, a, l, d, c = 0, h = 0, p, u = r.type, g = u === "FeatureCollection", y = u === "Feature", m = g ? r.features.length : 1, v = 0; v < m; v++) {
4106
+ d = g ? r.features[v].geometry : y ? r.geometry : r, p = d ? d.type === "GeometryCollection" : !1, a = p ? d.geometries.length : 1;
4089
4107
  for (var C = 0; C < a; C++) {
4090
- var f = 0, S = 0;
4091
- if (n = u ? d.geometries[C] : d, n !== null) {
4108
+ var f = 0, P = 0;
4109
+ if (n = p ? d.geometries[C] : d, n !== null) {
4092
4110
  l = n.coordinates;
4093
4111
  var I = n.type;
4094
4112
  switch (c = I === "Polygon" || I === "MultiPolygon" ? 1 : 0, I) {
@@ -4100,7 +4118,7 @@ function Ge(r, t, e) {
4100
4118
  h,
4101
4119
  v,
4102
4120
  f,
4103
- S
4121
+ P
4104
4122
  ) === !1)
4105
4123
  return !1;
4106
4124
  h++, f++;
@@ -4113,7 +4131,7 @@ function Ge(r, t, e) {
4113
4131
  h,
4114
4132
  v,
4115
4133
  f,
4116
- S
4134
+ P
4117
4135
  ) === !1)
4118
4136
  return !1;
4119
4137
  h++, I === "MultiPoint" && f++;
@@ -4129,30 +4147,30 @@ function Ge(r, t, e) {
4129
4147
  h,
4130
4148
  v,
4131
4149
  f,
4132
- S
4150
+ P
4133
4151
  ) === !1)
4134
4152
  return !1;
4135
4153
  h++;
4136
4154
  }
4137
- I === "MultiLineString" && f++, I === "Polygon" && S++;
4155
+ I === "MultiLineString" && f++, I === "Polygon" && P++;
4138
4156
  }
4139
4157
  I === "Polygon" && f++;
4140
4158
  break;
4141
4159
  case "MultiPolygon":
4142
4160
  for (i = 0; i < l.length; i++) {
4143
- for (S = 0, o = 0; o < l[i].length; o++) {
4161
+ for (P = 0, o = 0; o < l[i].length; o++) {
4144
4162
  for (s = 0; s < l[i][o].length - c; s++) {
4145
4163
  if (t(
4146
4164
  l[i][o][s],
4147
4165
  h,
4148
4166
  v,
4149
4167
  f,
4150
- S
4168
+ P
4151
4169
  ) === !1)
4152
4170
  return !1;
4153
4171
  h++;
4154
4172
  }
4155
- S++;
4173
+ P++;
4156
4174
  }
4157
4175
  f++;
4158
4176
  }
@@ -4170,13 +4188,13 @@ function Ge(r, t, e) {
4170
4188
  }
4171
4189
  }
4172
4190
  function no(r, t) {
4173
- var e, i, o, s, n, a, l, d, c, h, u = 0, p = r.type === "FeatureCollection", g = r.type === "Feature", y = p ? r.features.length : 1;
4191
+ var e, i, o, s, n, a, l, d, c, h, p = 0, u = r.type === "FeatureCollection", g = r.type === "Feature", y = u ? r.features.length : 1;
4174
4192
  for (e = 0; e < y; e++) {
4175
- for (a = p ? r.features[e].geometry : g ? r.geometry : r, d = p ? r.features[e].properties : g ? r.properties : {}, c = p ? r.features[e].bbox : g ? r.bbox : void 0, h = p ? r.features[e].id : g ? r.id : void 0, l = a ? a.type === "GeometryCollection" : !1, n = l ? a.geometries.length : 1, o = 0; o < n; o++) {
4193
+ for (a = u ? r.features[e].geometry : g ? r.geometry : r, d = u ? r.features[e].properties : g ? r.properties : {}, c = u ? r.features[e].bbox : g ? r.bbox : void 0, h = u ? r.features[e].id : g ? r.id : void 0, l = a ? a.type === "GeometryCollection" : !1, n = l ? a.geometries.length : 1, o = 0; o < n; o++) {
4176
4194
  if (s = l ? a.geometries[o] : a, s === null) {
4177
4195
  if (t(
4178
4196
  null,
4179
- u,
4197
+ p,
4180
4198
  d,
4181
4199
  c,
4182
4200
  h
@@ -4193,7 +4211,7 @@ function no(r, t) {
4193
4211
  case "MultiPolygon": {
4194
4212
  if (t(
4195
4213
  s,
4196
- u,
4214
+ p,
4197
4215
  d,
4198
4216
  c,
4199
4217
  h
@@ -4205,7 +4223,7 @@ function no(r, t) {
4205
4223
  for (i = 0; i < s.geometries.length; i++)
4206
4224
  if (t(
4207
4225
  s.geometries[i],
4208
- u,
4226
+ p,
4209
4227
  d,
4210
4228
  c,
4211
4229
  h
@@ -4217,7 +4235,7 @@ function no(r, t) {
4217
4235
  throw new Error("Unknown Geometry Type");
4218
4236
  }
4219
4237
  }
4220
- u++;
4238
+ p++;
4221
4239
  }
4222
4240
  }
4223
4241
  function ao(r, t, e) {
@@ -4375,16 +4393,16 @@ const fe = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians
4375
4393
  let a = 0;
4376
4394
  const l = [];
4377
4395
  for (let d = 0; d < n.length - 1; d++) {
4378
- const c = n[d], h = n[d + 1], u = yo(c, h, { units: t });
4379
- a += u;
4380
- const p = JSON.parse(JSON.stringify(r));
4381
- if (p.id = `${p.id}-${d}`, p.geometry.coordinates = [c, h], p.properties.originalId = r.id, p.properties.distance = u, p.properties.total = a, p.properties.unit = fe(t), p.properties.totalUnit = fe(t), o === !0 && s === void 0) {
4396
+ const c = n[d], h = n[d + 1], p = yo(c, h, { units: t });
4397
+ a += p;
4398
+ const u = JSON.parse(JSON.stringify(r));
4399
+ if (u.id = `${u.id}-${d}`, u.geometry.coordinates = [c, h], u.properties.originalId = r.id, u.properties.distance = p, u.properties.total = a, u.properties.unit = fe(t), u.properties.totalUnit = fe(t), o === !0 && s === void 0) {
4382
4400
  const g = i?.queryTerrainElevation(c);
4383
- g && (p.properties.elevation_start = g);
4401
+ g && (u.properties.elevation_start = g);
4384
4402
  const y = i?.queryTerrainElevation(h);
4385
- y && (p.properties.elevation_end = y);
4403
+ y && (u.properties.elevation_end = y);
4386
4404
  }
4387
- l.push(p);
4405
+ l.push(u);
4388
4406
  }
4389
4407
  if (r.properties.distance = l[l.length - 1].properties.total, r.properties.unit = l[l.length - 1].properties.unit, r.properties.segments = JSON.parse(JSON.stringify(l)), t === "kilometers") {
4390
4408
  const d = Ft(r.properties.distance);
@@ -4392,8 +4410,8 @@ const fe = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians
4392
4410
  (c) => {
4393
4411
  const h = Ft(c.properties.distance);
4394
4412
  c.properties.distance = h.distance, c.properties.unit = h.unit;
4395
- const u = Ft(c.properties.total);
4396
- c.properties.total = u.distance, c.properties.totalUnit = u.unit;
4413
+ const p = Ft(c.properties.total);
4414
+ c.properties.total = p.distance, c.properties.totalUnit = p.unit;
4397
4415
  }
4398
4416
  );
4399
4417
  }
@@ -4757,7 +4775,7 @@ class Ye {
4757
4775
  const h = c.getContext("2d");
4758
4776
  if (!h) return l(new Error("Failed to create canvas context"));
4759
4777
  h.drawImage(d, 0, 0);
4760
- const u = h.getImageData(0, 0, d.width, d.height).data, p = this.pixels2rgba(new Uint8Array(u), e, i, o), g = this.calc(p[0], p[1], p[2], p[3]);
4778
+ const p = h.getImageData(0, 0, d.width, d.height).data, u = this.pixels2rgba(new Uint8Array(p), e, i, o), g = this.calc(u[0], u[1], u[2], u[3]);
4761
4779
  a(g);
4762
4780
  }, d.onerror = () => a(void 0), d.src = URL.createObjectURL(n);
4763
4781
  });
@@ -4773,7 +4791,7 @@ class Ye {
4773
4791
  pixels2rgba(t, e, i, o) {
4774
4792
  const s = [];
4775
4793
  for (let d = 0; d < t.length; d += 4) {
4776
- const c = t[d], h = t[d + 1], u = t[d + 2], p = t[d + 3], g = [c, h, u, p];
4794
+ const c = t[d], h = t[d + 1], p = t[d + 2], u = t[d + 3], g = [c, h, p, u];
4777
4795
  s.push(g);
4778
4796
  }
4779
4797
  const n = this.tileToBBOX(e), a = this.getPixelPosition(i, o, n), l = a[0] + a[1] * this.tileSize;
@@ -4901,27 +4919,27 @@ const _o = (r, t = 8) => {
4901
4919
  s.enabled && (n = i || new ze(s.maxSize, s.ttl));
4902
4920
  let a, l = 15;
4903
4921
  if (t) {
4904
- const d = t.url, c = t.encoding ?? "mapbox", h = t.tileSize ?? 512, u = t.minzoom ?? 5;
4922
+ const d = t.url, c = t.encoding ?? "mapbox", h = t.tileSize ?? 512, p = t.minzoom ?? 5;
4905
4923
  l = t.maxzoom ?? 15;
4906
- const p = t.tms ?? !1;
4907
- a = c === "mapbox" ? new Mo(d, h, u, l, p) : new Do(d, h, u, l, p);
4924
+ const u = t.tms ?? !1;
4925
+ a = c === "mapbox" ? new Mo(d, h, p, l, u) : new Do(d, h, p, l, u);
4908
4926
  }
4909
4927
  for (const d of r)
4910
4928
  o.push(
4911
4929
  new Promise((c) => {
4912
4930
  d.geometry.type !== "Point" && c(d);
4913
- const h = d.geometry.coordinates, u = _o(h, s.precision);
4931
+ const h = d.geometry.coordinates, p = _o(h, s.precision);
4914
4932
  if (n) {
4915
- const p = n.get(u);
4916
- if (p !== void 0) {
4917
- isNaN(p) || (d.properties.elevation = p), c(d);
4933
+ const u = n.get(p);
4934
+ if (u !== void 0) {
4935
+ isNaN(u) || (d.properties.elevation = u), c(d);
4918
4936
  return;
4919
4937
  }
4920
4938
  }
4921
- a ? a.getElevation(d.geometry.coordinates, l).then((p) => {
4922
- p != null && typeof p == "number" && (n && n.set(u, p), d.properties.elevation = p), c(d);
4939
+ a ? a.getElevation(d.geometry.coordinates, l).then((u) => {
4940
+ u != null && typeof u == "number" && (n && n.set(p, u), d.properties.elevation = u), c(d);
4923
4941
  }).catch(() => {
4924
- n && n.has(u) && n.delete(u), c(d);
4942
+ n && n.has(p) && n.delete(p), c(d);
4925
4943
  }) : c(d);
4926
4944
  })
4927
4945
  );
@@ -5069,25 +5087,25 @@ class Wo {
5069
5087
  c = [...c, ...f];
5070
5088
  }), this.tripSummary = l.trip.summary, this.tripSummary.length = Number(this.tripSummary.length.toFixed(2)), this.tripSummary.time = Number((this.tripSummary.time / 60).toFixed());
5071
5089
  const h = [];
5072
- let u = 0, p = 0;
5090
+ let p = 0, u = 0;
5073
5091
  const g = [], y = this.geoPoint(this.tripData.map((f) => [f.lng, f.lat]));
5074
- l.trip.legs.forEach((f, S) => {
5092
+ l.trip.legs.forEach((f, P) => {
5075
5093
  const I = this.decodeShape(f.shape);
5076
- h.push(...I), u += Number(f.summary.length.toFixed(2)), p += Number((f.summary.time / 60).toFixed()), g.push(...f.maneuvers);
5077
- const E = y.features[S + 1];
5094
+ h.push(...I), p += Number(f.summary.length.toFixed(2)), u += Number((f.summary.time / 60).toFixed()), g.push(...f.maneuvers);
5095
+ const E = y.features[P + 1];
5078
5096
  E.properties = {
5079
5097
  ...E.properties,
5080
- distance: u,
5098
+ distance: p,
5081
5099
  distance_unit: i === "kilometers" ? "km" : "mi",
5082
- time: p,
5100
+ time: u,
5083
5101
  maneuvers: f.maneuvers
5084
5102
  };
5085
5103
  });
5086
5104
  const m = Nt.find((f) => f.value === e)?.label, v = this.geoLineString(h, {
5087
5105
  costingModel: m,
5088
- distance: u,
5106
+ distance: p,
5089
5107
  distance_unit: i === "kilometers" ? "km" : "mi",
5090
- time: p,
5108
+ time: u,
5091
5109
  maneuvers: g
5092
5110
  }), C = y.features[0];
5093
5111
  return C.properties = {
@@ -5143,7 +5161,7 @@ class Wo {
5143
5161
  * @returns the list of coordinates as [lng, lat] pairs
5144
5162
  */
5145
5163
  decodeShape(t, e = 6) {
5146
- let i = 0, o = 0, s = 0, n = [], a = 0, l = 0, d = null, c, h, u = Math.pow(10, e || 6);
5164
+ let i = 0, o = 0, s = 0, n = [], a = 0, l = 0, d = null, c, h, p = Math.pow(10, e || 6);
5147
5165
  for (; i < t.length; ) {
5148
5166
  d = null, a = 0, l = 0;
5149
5167
  do
@@ -5153,7 +5171,7 @@ class Wo {
5153
5171
  do
5154
5172
  d = t.charCodeAt(i++) - 63, l |= (d & 31) << a, a += 5;
5155
5173
  while (d >= 32);
5156
- h = l & 1 ? ~(l >> 1) : l >> 1, o += c, s += h, n.push([s / u, o / u]);
5174
+ h = l & 1 ? ~(l >> 1) : l >> 1, o += c, s += h, n.push([s / p, o / p]);
5157
5175
  }
5158
5176
  return n;
5159
5177
  }
@@ -5940,17 +5958,17 @@ class Xo extends Ke {
5940
5958
  for (let a = 0; a < n.length; a++) {
5941
5959
  const l = n[a], d = l.geometry.coordinates, c = d[0], h = d[1];
5942
5960
  if (a === 0) {
5943
- const p = JSON.parse(JSON.stringify(l));
5944
- p.id = `${l.id}-node-${a}`, p.geometry = {
5961
+ const u = JSON.parse(JSON.stringify(l));
5962
+ u.id = `${l.id}-node-${a}`, u.geometry = {
5945
5963
  type: "Point",
5946
5964
  coordinates: c
5947
- }, p.properties.distance = 0, p.properties.total = 0, l.properties.elevation_start && (p.properties.elevation = l.properties.elevation_start), typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(p);
5965
+ }, u.properties.distance = 0, u.properties.total = 0, l.properties.elevation_start && (u.properties.elevation = l.properties.elevation_start), typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(u);
5948
5966
  }
5949
- const u = JSON.parse(JSON.stringify(l));
5950
- u.id = `${l.id}-node-${a + 1}`, u.geometry = {
5967
+ const p = JSON.parse(JSON.stringify(l));
5968
+ p.id = `${l.id}-node-${a + 1}`, p.geometry = {
5951
5969
  type: "Point",
5952
5970
  coordinates: h
5953
- }, l.properties.elevation_end && (u.properties.elevation = l.properties.elevation_end), typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(u);
5971
+ }, l.properties.elevation_end && (p.properties.elevation = l.properties.elevation_end), typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(p);
5954
5972
  }
5955
5973
  this.map.getSource(
5956
5974
  this.measureOptions.lineLayerLabelSpec.source
@@ -6356,15 +6374,15 @@ class Ho extends Ke {
6356
6374
  const l = document.createElement("th");
6357
6375
  o.appendChild(l), i.appendChild(o), e.appendChild(i);
6358
6376
  const d = document.createElement("tbody"), c = this.controlOptions.valhallaOptions?.isochroneOptions?.contours;
6359
- c.forEach((u, p) => {
6360
- const g = this.createContourRow(u, p);
6377
+ c.forEach((p, u) => {
6378
+ const g = this.createContourRow(p, u);
6361
6379
  d.appendChild(g);
6362
6380
  }), e.appendChild(d), t.appendChild(e);
6363
6381
  const h = document.createElement("button");
6364
- return h.type = "button", h.classList.add("add-row-button"), h.textContent = "Add Contour", h.hidden = c.length >= 4, h.addEventListener("click", (u) => {
6365
- u.stopPropagation();
6366
- const p = this.valhallaOptions.isochroneOptions?.contours, g = JSON.parse(JSON.stringify(p[p.length - 1])), y = d.children.length, m = this.createContourRow(g, y);
6367
- d.appendChild(m), p.push(g), this.updateAddRowButtonState(), this.dispatchEvent("setting-changed");
6382
+ return h.type = "button", h.classList.add("add-row-button"), h.textContent = "Add Contour", h.hidden = c.length >= 4, h.addEventListener("click", (p) => {
6383
+ p.stopPropagation();
6384
+ const u = this.valhallaOptions.isochroneOptions?.contours, g = JSON.parse(JSON.stringify(u[u.length - 1])), y = d.children.length, m = this.createContourRow(g, y);
6385
+ d.appendChild(m), u.push(g), this.updateAddRowButtonState(), this.dispatchEvent("setting-changed");
6368
6386
  }), t.appendChild(h), t;
6369
6387
  }
6370
6388
  /**
@@ -6392,10 +6410,10 @@ class Ho extends Ke {
6392
6410
  const c = document.createElement("td");
6393
6411
  if (e > 0) {
6394
6412
  const h = document.createElement("button");
6395
- h.type = "button", h.textContent = "×", h.classList.add("delete-button"), h.addEventListener("click", (u) => {
6396
- u.stopPropagation();
6397
- const p = parseInt(i.getAttribute("data-index") || "0");
6398
- i.remove(), this.valhallaOptions.isochroneOptions?.contours && this.valhallaOptions.isochroneOptions.contours.splice(p, 1);
6413
+ h.type = "button", h.textContent = "×", h.classList.add("delete-button"), h.addEventListener("click", (p) => {
6414
+ p.stopPropagation();
6415
+ const u = parseInt(i.getAttribute("data-index") || "0");
6416
+ i.remove(), this.valhallaOptions.isochroneOptions?.contours && this.valhallaOptions.isochroneOptions.contours.splice(u, 1);
6399
6417
  const g = i.parentElement;
6400
6418
  g && Array.from(g.children).forEach((y, m) => {
6401
6419
  y.setAttribute("data-index", m.toString());