@watergis/maplibre-gl-terradraw 1.7.5 → 1.7.6

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.
@@ -1,4 +1,4 @@
1
- import { LngLat as Xe } from "maplibre-gl";
1
+ import { LngLat as He } from "maplibre-gl";
2
2
  function x() {
3
3
  return x = Object.assign ? Object.assign.bind() : function(r) {
4
4
  for (var t = 1; t < arguments.length; t++) {
@@ -13,23 +13,23 @@ var b;
13
13
  r.Commit = "commit", r.Provisional = "provisional", r.Finish = "finish";
14
14
  })(b || (b = {}));
15
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
- function bt(r) {
16
+ function Et(r) {
17
17
  return !!(r && typeof r == "object" && r !== null && !Array.isArray(r));
18
18
  }
19
- function qt(r) {
19
+ function Zt(r) {
20
20
  return !!(r && typeof r == "object" && "properties" in r && typeof r.properties == "object" && r.properties !== null && "mode" in r.properties);
21
21
  }
22
- function Zt(r) {
22
+ function Qt(r) {
23
23
  return !!(function(t) {
24
24
  return typeof t == "number" && !isNaN(new Date(t).valueOf());
25
25
  })(r);
26
26
  }
27
- const He = "Feature mode property does not match the mode being added to";
27
+ const Je = "Feature mode property does not match the mode being added to";
28
28
  var H;
29
29
  (function(r) {
30
30
  r.Drawing = "drawing", r.Select = "select", r.Static = "static", r.Render = "render";
31
31
  })(H || (H = {}));
32
- const Je = { rightClick: !0, contextMenu: !1, leftClick: !0, onDragStart: !0, onDrag: !0, onDragEnd: !0 };
32
+ const qe = { rightClick: !0, contextMenu: !1, leftClick: !0, onDragStart: !0, onDrag: !0, onDragEnd: !0 };
33
33
  class A {
34
34
  get state() {
35
35
  return this._state;
@@ -47,7 +47,7 @@ class A {
47
47
  registerBehaviors(t) {
48
48
  }
49
49
  constructor(t, e = !1) {
50
- this._state = "unregistered", this._styles = {}, this.pointerEvents = Je, this.behaviors = [], this.validate = void 0, this.pointerDistance = 40, this.coordinatePrecision = void 0, this.onStyleChange = void 0, this.store = void 0, this.projection = "web-mercator", this.setDoubleClickToZoom = void 0, this.unproject = void 0, this.project = void 0, this.setCursor = void 0, this.type = H.Drawing, this.mode = "base", e || this.updateOptions(t);
50
+ this._state = "unregistered", this._styles = {}, this.pointerEvents = qe, this.behaviors = [], this.validate = void 0, this.pointerDistance = 40, this.coordinatePrecision = void 0, this.onStyleChange = void 0, this.store = void 0, this.projection = "web-mercator", this.setDoubleClickToZoom = void 0, this.unproject = void 0, this.project = void 0, this.setCursor = void 0, this.type = H.Drawing, this.mode = "base", e || this.updateOptions(t);
51
51
  }
52
52
  updateOptions(t) {
53
53
  t != null && t.styles && (this.styles = x({}, this._styles, t.styles)), t != null && t.pointerDistance && (this.pointerDistance = t.pointerDistance), t != null && t.validation && (this.validate = t && t.validation), t != null && t.projection && (this.projection = t.projection), t?.pointerEvents !== void 0 && (this.pointerEvents = t.pointerEvents);
@@ -82,9 +82,9 @@ class A {
82
82
  if (this._state === "unregistered") throw new Error("Mode must be registered");
83
83
  const e = (function(i, o) {
84
84
  let s;
85
- if (bt(i)) if (i.id == null) s = "Feature has no id";
85
+ if (Et(i)) if (i.id == null) s = "Feature has no id";
86
86
  else if (typeof i.id != "string" && typeof i.id != "number") s = "Feature must be string or number as per GeoJSON spec";
87
- else if (o(i.id)) if (bt(i.geometry)) if (bt(i.properties)) if (typeof i.geometry.type == "string" && ["Polygon", "LineString", "Point"].includes(i.geometry.type)) if (Array.isArray(i.geometry.coordinates)) {
87
+ else if (o(i.id)) if (Et(i.geometry)) if (Et(i.properties)) if (typeof i.geometry.type == "string" && ["Polygon", "LineString", "Point"].includes(i.geometry.type)) if (Array.isArray(i.geometry.coordinates)) {
88
88
  if (!i.properties.mode || typeof i.properties.mode != "string") return { valid: !1, reason: "Feature does not have a valid mode property" };
89
89
  } else s = "Feature coordinates is not an array";
90
90
  else s = "Feature is not Point, LineString or Polygon";
@@ -102,7 +102,7 @@ class A {
102
102
  }
103
103
  validateModeFeature(t, e) {
104
104
  const i = this.performFeatureValidation(t);
105
- return i.valid ? t.properties.mode !== this.mode ? { valid: !1, reason: He } : e(t) : { valid: !1, reason: i.reason };
105
+ return i.valid ? t.properties.mode !== this.mode ? { valid: !1, reason: Je } : e(t) : { valid: !1, reason: i.reason };
106
106
  }
107
107
  onFinish(t, e) {
108
108
  }
@@ -134,7 +134,7 @@ class A {
134
134
  return t === void 0 ? e : typeof t == "function" ? t(i) : t;
135
135
  }
136
136
  }
137
- let qe = class extends A {
137
+ let Ze = class extends A {
138
138
  constructor(...t) {
139
139
  super(...t), this.type = H.Select;
140
140
  }
@@ -143,11 +143,11 @@ function U(r, t) {
143
143
  const e = (d) => d * Math.PI / 180, i = e(r[1]), o = e(r[0]), s = e(t[1]), n = s - i, a = e(t[0]) - o, l = Math.sin(n / 2) * Math.sin(n / 2) + Math.cos(i) * Math.cos(s) * Math.sin(a / 2) * Math.sin(a / 2);
144
144
  return 2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l)) * 6371e3 / 1e3;
145
145
  }
146
- const Se = 63710088e-1;
146
+ const Ie = 63710088e-1;
147
147
  function D(r) {
148
148
  return r % 360 * Math.PI / 180;
149
149
  }
150
- function Ie(r) {
150
+ function xe(r) {
151
151
  return r / 6371.0088;
152
152
  }
153
153
  function V(r) {
@@ -157,20 +157,20 @@ function w(r, t = 9) {
157
157
  const e = Math.pow(10, t);
158
158
  return Math.round(r * e) / e;
159
159
  }
160
- const Qt = 57.29577951308232, te = 0.017453292519943295, Pt = 6378137, O = (r, t) => ({ x: r === 0 ? 0 : r * te * Pt, y: t === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + t * te / 2)) * Pt }), R = (r, t) => ({ lng: r === 0 ? 0 : Qt * (r / Pt), lat: t === 0 ? 0 : (2 * Math.atan(Math.exp(t / Pt)) - Math.PI / 2) * Qt });
161
- function Ze(r, t, e) {
162
- const i = D(r[0]), o = D(r[1]), s = D(e), n = Ie(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(s));
160
+ const te = 57.29577951308232, ee = 0.017453292519943295, St = 6378137, O = (r, t) => ({ x: r === 0 ? 0 : r * ee * St, y: t === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + t * ee / 2)) * St }), R = (r, t) => ({ lng: r === 0 ? 0 : te * (r / St), lat: t === 0 ? 0 : (2 * Math.atan(Math.exp(t / St)) - Math.PI / 2) * te });
161
+ function Qe(r, t, e) {
162
+ const i = D(r[0]), o = D(r[1]), s = D(e), n = xe(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(s));
163
163
  return [V(i + Math.atan2(Math.sin(s) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), V(a)];
164
164
  }
165
- function ee(r) {
165
+ function ie(r) {
166
166
  const { center: t, radiusKilometers: e, coordinatePrecision: i } = r, o = r.steps ? r.steps : 64, s = [];
167
167
  for (let n = 0; n < o; n++) {
168
- const a = Ze(t, e, -360 * n / o);
168
+ const a = Qe(t, e, -360 * n / o);
169
169
  s.push([w(a[0], i), w(a[1], i)]);
170
170
  }
171
171
  return s.push(s[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [s] }, properties: {} };
172
172
  }
173
- function Wt(r) {
173
+ function Bt(r) {
174
174
  let t;
175
175
  if (r.geometry.type === "Polygon") t = r.geometry.coordinates;
176
176
  else {
@@ -197,38 +197,38 @@ function Wt(r) {
197
197
  function gt(r, t) {
198
198
  return r[0] === t[0] && r[1] === t[1];
199
199
  }
200
- function xt(r, t) {
201
- return ie(r[0]) <= t && ie(r[1]) <= t;
200
+ function Ot(r, t) {
201
+ return oe(r[0]) <= t && oe(r[1]) <= t;
202
202
  }
203
- function Bt(r) {
203
+ function jt(r) {
204
204
  return r.length === 2 && typeof r[0] == "number" && typeof r[1] == "number" && r[0] !== 1 / 0 && r[1] !== 1 / 0 && (e = r[0]) >= -180 && e <= 180 && (t = r[1]) >= -90 && t <= 90;
205
205
  var t, e;
206
206
  }
207
- function ie(r) {
207
+ function oe(r) {
208
208
  let t = 1, e = 0;
209
209
  for (; Math.round(r * t) / t !== r; ) t *= 10, e++;
210
210
  return e;
211
211
  }
212
- const Qe = "Feature has holes", ti = "Feature has less than 4 coordinates", ei = "Feature has invalid coordinates", ii = "Feature coordinates are not closed";
213
- function Ot(r, t) {
212
+ const ti = "Feature has holes", ei = "Feature has less than 4 coordinates", ii = "Feature has invalid coordinates", oi = "Feature coordinates are not closed";
213
+ function bt(r, t) {
214
214
  if (r.geometry.type !== "Polygon") return { valid: !1, reason: "Feature is not a Polygon" };
215
- if (r.geometry.coordinates.length !== 1) return { valid: !1, reason: Qe };
216
- if (r.geometry.coordinates[0].length < 4) return { valid: !1, reason: ti };
215
+ if (r.geometry.coordinates.length !== 1) return { valid: !1, reason: ti };
216
+ if (r.geometry.coordinates[0].length < 4) return { valid: !1, reason: ei };
217
217
  for (let o = 0; o < r.geometry.coordinates[0].length; o++) {
218
- if (!Bt(r.geometry.coordinates[0][o])) return { valid: !1, reason: ei };
219
- if (!xt(r.geometry.coordinates[0][o], t)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
218
+ if (!jt(r.geometry.coordinates[0][o])) return { valid: !1, reason: ii };
219
+ if (!Ot(r.geometry.coordinates[0][o], t)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
220
220
  }
221
- return (e = r.geometry.coordinates[0][0])[0] !== (i = r.geometry.coordinates[0][r.geometry.coordinates[0].length - 1])[0] || e[1] !== i[1] ? { valid: !1, reason: ii } : { valid: !0 };
221
+ return (e = r.geometry.coordinates[0][0])[0] !== (i = r.geometry.coordinates[0][r.geometry.coordinates[0].length - 1])[0] || e[1] !== i[1] ? { valid: !1, reason: oi } : { valid: !0 };
222
222
  var e, i;
223
223
  }
224
224
  function ut(r, t) {
225
- const e = Ot(r, t);
226
- return e.valid ? Wt(r) ? { valid: !1, reason: "Feature intersects itself" } : { valid: !0 } : e;
225
+ const e = bt(r, t);
226
+ return e.valid ? Bt(r) ? { valid: !1, reason: "Feature intersects itself" } : { valid: !0 } : e;
227
227
  }
228
- const oi = { cancel: "Escape", finish: "Enter" }, si = { start: "crosshair" };
229
- let xe = class extends A {
228
+ const si = { cancel: "Escape", finish: "Enter" }, ri = { start: "crosshair" };
229
+ let Oe = class extends A {
230
230
  constructor(t) {
231
- super(t, !0), this.mode = "circle", this.center = void 0, this.clickCount = 0, this.currentCircleId = void 0, this.keyEvents = oi, this.cursors = si, this.startingRadiusKilometers = 1e-5, this.cursorMovedAfterInitialCursorDown = !1, this.updateOptions(t);
231
+ super(t, !0), this.mode = "circle", this.center = void 0, this.clickCount = 0, this.currentCircleId = void 0, this.keyEvents = si, this.cursors = ri, this.startingRadiusKilometers = 1e-5, this.cursorMovedAfterInitialCursorDown = !1, this.updateOptions(t);
232
232
  }
233
233
  updateOptions(t) {
234
234
  super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.startingRadiusKilometers && (this.startingRadiusKilometers = t.startingRadiusKilometers);
@@ -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 = ee({ 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 } }]);
255
+ const e = ie({ 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
  }
@@ -306,7 +306,7 @@ let xe = class extends A {
306
306
  })({ center: this.center, radiusKilometers: e * o, coordinatePrecision: this.coordinatePrecision });
307
307
  } else {
308
308
  if (this.projection !== "globe") throw new Error("Invalid projection");
309
- i = ee({ center: this.center, radiusKilometers: e, coordinatePrecision: this.coordinatePrecision });
309
+ i = ie({ center: this.center, radiusKilometers: e, coordinatePrecision: this.coordinatePrecision });
310
310
  }
311
311
  if (this.validate && !this.validate({ type: "Feature", id: this.currentCircleId, geometry: i.geometry, properties: { radiusKilometers: e } }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid) return;
312
312
  this.store.updateGeometry([{ id: this.currentCircleId, geometry: i.geometry }]), this.store.updateProperty([{ id: this.currentCircleId, property: "radiusKilometers", value: e }]);
@@ -331,10 +331,10 @@ function pt(r) {
331
331
  return o < 0;
332
332
  })(r)) return { type: "Polygon", coordinates: [r.coordinates[0].reverse()] };
333
333
  }
334
- const ri = { cancel: "Escape", finish: "Enter" }, ni = { start: "crosshair", close: "pointer" };
335
- class Oe extends A {
334
+ const ni = { cancel: "Escape", finish: "Enter" }, ai = { start: "crosshair", close: "pointer" };
335
+ class be extends A {
336
336
  constructor(t) {
337
- super(t, !0), this.mode = "freehand", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = ri, this.cursors = ni, this.preventPointsNearClose = !0, this.autoClose = !1, this.autoCloseTimeout = 500, this.hasLeftStartingPoint = !1, this.preventNewFeature = !1, this.updateOptions(t);
337
+ super(t, !0), this.mode = "freehand", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = ni, this.cursors = ai, this.preventPointsNearClose = !0, this.autoClose = !1, this.autoCloseTimeout = 500, this.hasLeftStartingPoint = !1, this.preventNewFeature = !1, this.updateOptions(t);
338
338
  }
339
339
  updateOptions(t) {
340
340
  super.updateOptions(t), t != null && t.minDistance && (this.minDistance = t.minDistance), t?.preventPointsNearClose !== void 0 && (this.preventPointsNearClose = t.preventPointsNearClose), t?.autoClose !== void 0 && (this.autoClose = t.autoClose), t != null && t.autoCloseTimeout && (this.autoCloseTimeout = t.autoCloseTimeout), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors));
@@ -405,7 +405,7 @@ class Oe extends A {
405
405
  return t.type === "Feature" && t.geometry.type === "Polygon" && t.properties.mode === this.mode ? (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) : (t.type === "Feature" && t.geometry.type === "Point" && t.properties.mode === this.mode && (e.pointWidth = this.getNumericStylingValue(this.styles.closingPointWidth, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(this.styles.closingPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.closingPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.closingPointOutlineWidth, 2, t), e.zIndex = 50), e);
406
406
  }
407
407
  validateFeature(t) {
408
- return this.validateModeFeature(t, (e) => Ot(e, this.coordinatePrecision));
408
+ return this.validateModeFeature(t, (e) => bt(e, this.coordinatePrecision));
409
409
  }
410
410
  afterFeatureUpdated(t) {
411
411
  this.currentId === t.id && (this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.hasLeftStartingPoint = !1);
@@ -416,7 +416,7 @@ let B = class {
416
416
  this.store = void 0, this.mode = void 0, this.project = void 0, this.unproject = void 0, this.pointerDistance = void 0, this.coordinatePrecision = void 0, this.projection = void 0, this.store = t, this.mode = e, this.project = i, this.unproject = o, this.pointerDistance = s, this.coordinatePrecision = n, this.projection = a;
417
417
  }
418
418
  };
419
- function be({ unproject: r, point: t, pointerDistance: e }) {
419
+ function Ee({ unproject: r, point: t, pointerDistance: e }) {
420
420
  const i = e / 2, { x: o, y: s } = t;
421
421
  return { type: "Feature", properties: {}, geometry: { type: "Polygon", coordinates: [[r(o - i, s - i), r(o + i, s - i), r(o + i, s + i), r(o - i, s + i), r(o - i, s - i)].map((n) => [n.lng, n.lat])] } };
422
422
  }
@@ -426,7 +426,7 @@ class dt extends B {
426
426
  }
427
427
  create(t) {
428
428
  const { containerX: e, containerY: i } = t;
429
- return be({ unproject: this.unproject, point: { x: e, y: i }, pointerDistance: this.pointerDistance });
429
+ return Ee({ unproject: this.unproject, point: { x: e, y: i }, pointerDistance: this.pointerDistance });
430
430
  }
431
431
  }
432
432
  class ct extends B {
@@ -438,7 +438,7 @@ class ct extends B {
438
438
  return F({ x: i, y: o }, { x: t.containerX, y: t.containerY });
439
439
  }
440
440
  }
441
- let St = class extends B {
441
+ let It = class extends B {
442
442
  constructor(t, e, i) {
443
443
  super(t), this.config = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.getSnappableCoordinateFirstClick = (o) => this.getSnappable(o, (s) => !!(s.properties && s.properties.mode === this.mode)).coordinate, this.getSnappableCoordinate = (o, s) => this.getSnappable(o, (n) => !!(n.properties && n.properties.mode === this.mode && n.id !== s)).coordinate, this.config = t, this.pixelDistance = e, this.clickBoundingBox = i;
444
444
  }
@@ -458,15 +458,15 @@ let St = class extends B {
458
458
  }), s;
459
459
  }
460
460
  };
461
- function oe(r, t, e) {
462
- const i = D(r[0]), o = D(r[1]), s = D(e), n = Ie(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(s));
461
+ function se(r, t, e) {
462
+ const i = D(r[0]), o = D(r[1]), s = D(e), n = xe(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(s));
463
463
  return [V(i + Math.atan2(Math.sin(s) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), V(a)];
464
464
  }
465
465
  function ht({ x: r, y: t }, e, i) {
466
466
  const o = D(i);
467
467
  return { x: r + e * Math.cos(o), y: t + e * Math.sin(o) };
468
468
  }
469
- function se(r, t) {
469
+ function re(r, t) {
470
470
  const e = D(r[0]), i = D(t[0]), o = D(r[1]), s = D(t[1]), n = Math.sin(i - e) * Math.cos(s), a = Math.cos(o) * Math.sin(s) - Math.sin(o) * Math.cos(s) * Math.cos(i - e);
471
471
  return V(Math.atan2(n, a));
472
472
  }
@@ -479,15 +479,15 @@ function G({ x: r, y: t }, { x: e, y: i }) {
479
479
  function X(r) {
480
480
  return (r + 360) % 360;
481
481
  }
482
- function ai(r, t, e) {
482
+ function li(r, t, e) {
483
483
  const i = [], o = r.length;
484
484
  let s, n, a, l = 0;
485
485
  for (let c = 0; c < r.length && !(t >= l && c === r.length - 1); c++) {
486
486
  if (l > t && i.length === 0) {
487
487
  if (s = t - l, !s) return i.push(r[c]), i;
488
- n = se(r[c], r[c - 1]) - 180, a = oe(r[c], s, n), i.push(a);
488
+ n = re(r[c], r[c - 1]) - 180, a = se(r[c], s, n), i.push(a);
489
489
  }
490
- if (l >= e) return s = e - l, s ? (n = se(r[c], r[c - 1]) - 180, a = oe(r[c], s, n), i.push(a), i) : (i.push(r[c]), i);
490
+ if (l >= e) return s = e - l, s ? (n = re(r[c], r[c - 1]) - 180, a = se(r[c], s, n), i.push(a), i) : (i.push(r[c]), i);
491
491
  if (l >= t && i.push(r[c]), c === r.length - 1) return i;
492
492
  l += U(r[c], r[c + 1]);
493
493
  }
@@ -498,10 +498,10 @@ function ai(r, t, e) {
498
498
  function yt(r) {
499
499
  return r * (Math.PI / 180);
500
500
  }
501
- function re(r) {
501
+ function ne(r) {
502
502
  return r * (180 / Math.PI);
503
503
  }
504
- class li extends B {
504
+ class di extends B {
505
505
  constructor(t) {
506
506
  super(t), this.config = void 0, this.config = t;
507
507
  }
@@ -514,7 +514,7 @@ class li extends B {
514
514
  Number.isInteger(n) || (n = Math.floor(n) + 1);
515
515
  const a = [];
516
516
  for (let d = 0; d < n; d++) {
517
- const c = ai(o, i * d, i * (d + 1));
517
+ const c = li(o, i * d, i * (d + 1));
518
518
  a.push(c);
519
519
  }
520
520
  const l = [];
@@ -531,7 +531,7 @@ class li extends B {
531
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), P = v * Math.cos(c) * Math.sin(h) + C * Math.cos(u) * Math.sin(p), I = v * Math.sin(c) + C * Math.sin(u);
532
532
  if (isNaN(f) || isNaN(P) || isNaN(I)) continue;
533
533
  const E = Math.atan2(I, Math.sqrt(f ** 2 + P ** 2)), L = Math.atan2(P, f);
534
- isNaN(E) || isNaN(L) || d.push([re(L), re(E)]);
534
+ isNaN(E) || isNaN(L) || d.push([ne(L), ne(E)]);
535
535
  }
536
536
  return d.slice(1, -1);
537
537
  })(t, e, Math.floor(o / i));
@@ -544,26 +544,26 @@ class li extends B {
544
544
  function tt(r, t) {
545
545
  return r[0] === t[0] && r[1] === t[1];
546
546
  }
547
- function jt(r, t) {
547
+ function At(r, t) {
548
548
  if (r.geometry.type !== "LineString") return { valid: !1, reason: "Feature is not a LineString" };
549
549
  if (r.geometry.coordinates.length < 2) return { valid: !1, reason: "Feature has less than 2 coordinates" };
550
550
  for (let e = 0; e < r.geometry.coordinates.length; e++) {
551
- if (!Bt(r.geometry.coordinates[e])) return { valid: !1, reason: "Feature has invalid coordinates" };
552
- if (!xt(r.geometry.coordinates[e], t)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
551
+ if (!jt(r.geometry.coordinates[e])) return { valid: !1, reason: "Feature has invalid coordinates" };
552
+ if (!Ot(r.geometry.coordinates[e], t)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
553
553
  }
554
554
  return { valid: !0 };
555
555
  }
556
- function ne(r) {
556
+ function ae(r) {
557
557
  return Math.sqrt(Math.pow(r[0], 2) + Math.pow(r[1], 2) + Math.pow(r[2], 2));
558
558
  }
559
559
  function Y(r, t) {
560
560
  const e = (function(i, o) {
561
561
  const [s, n, a] = i, [l, d, c] = o;
562
562
  return s * l + n * d + a * c;
563
- })(r, t) / (ne(r) * ne(t));
563
+ })(r, t) / (ae(r) * ae(t));
564
564
  return Math.acos(Math.min(Math.max(e, -1), 1));
565
565
  }
566
- function Et(r) {
566
+ function wt(r) {
567
567
  const t = D(r[1]), e = D(r[0]);
568
568
  return [Math.cos(t) * Math.cos(e), Math.cos(t) * Math.sin(e), Math.sin(t)];
569
569
  }
@@ -571,19 +571,19 @@ function K(r) {
571
571
  const [t, e, i] = r, o = V(Math.asin(i));
572
572
  return [V(Math.atan2(e, t)), o];
573
573
  }
574
- function di(r, t, e) {
575
- const i = Et(r), o = Et(t), s = Et(e), [n, a, l] = s, [d, c, h] = (function(T, $) {
576
- const [$t, Yt, Kt] = T, [Xt, Ht, Jt] = $;
577
- return [Yt * Jt - Kt * Ht, Kt * Xt - $t * Jt, $t * Ht - Yt * Xt];
574
+ function ci(r, t, e) {
575
+ const i = wt(r), o = wt(t), s = wt(e), [n, a, l] = s, [d, c, h] = (function(T, $) {
576
+ const [Yt, Kt, Xt] = T, [Ht, Jt, qt] = $;
577
+ return [Kt * qt - Xt * Jt, Xt * Ht - Yt * qt, Yt * Jt - Kt * Ht];
578
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], 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
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
- function ci(r, t, e) {
582
+ function hi(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)));
584
584
  return { x: r.x + s * i, y: r.y + s * o };
585
585
  }
586
- class At extends B {
586
+ class Rt extends B {
587
587
  constructor(t, e, i) {
588
588
  super(t), this.config = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.getSnappableCoordinateFirstClick = (o) => {
589
589
  const s = this.getSnappable(o, (n) => !!(n.properties && n.properties.mode === this.mode));
@@ -615,7 +615,7 @@ class At extends B {
615
615
  if (C[0] === u[0] && C[1] === u[1]) P = C;
616
616
  else if (f[0] === u[0] && f[1] === u[1]) P = f;
617
617
  else {
618
- const { x: N, y: _ } = ci(E, L, M), { lng: T, lat: $ } = R(N, _);
618
+ const { x: N, y: _ } = hi(E, L, M), { lng: T, lat: $ } = R(N, _);
619
619
  P = [T, $];
620
620
  }
621
621
  P && (I = F(M, O(P[0], P[1])), I < y && (g = P, y = I, m = p.indexOf(v)));
@@ -626,7 +626,7 @@ class At extends B {
626
626
  for (let v of p) {
627
627
  const C = v[0], f = v[1];
628
628
  let P, I = 1 / 0;
629
- C[0] === u[0] && C[1] === u[1] ? P = C : f[0] === u[0] && f[1] === u[1] ? P = f : [P] = di(C, f, u), P && (I = U(u, P), I < y && (g = P, y = I, m = p.indexOf(v)));
629
+ C[0] === u[0] && C[1] === u[1] ? P = C : f[0] === u[0] && f[1] === u[1] ? P = f : [P] = ci(C, f, u), P && (I = U(u, P), I < y && (g = P, y = I, m = p.indexOf(v)));
630
630
  }
631
631
  return y === 1 / 0 ? void 0 : { coordinate: g, distance: y, lineIndex: m };
632
632
  })(c, l)), !d) return;
@@ -635,10 +635,10 @@ class At extends B {
635
635
  }), s;
636
636
  }
637
637
  }
638
- const hi = { cancel: "Escape", finish: "Enter" }, ui = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
639
- class Rt extends A {
638
+ const ui = { cancel: "Escape", finish: "Enter" }, pi = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
639
+ class Gt extends A {
640
640
  constructor(t) {
641
- super(t, !0), this.mode = "linestring", this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.keyEvents = hi, this.snapping = void 0, this.cursors = ui, this.mouseMove = !1, this.insertCoordinates = void 0, this.lastCommittedCoordinates = void 0, this.snappedPointId = void 0, this.lastMouseMoveEvent = void 0, this.editable = !1, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0, this.editedInsertIndex = void 0, this.editedPointId = void 0, this.coordinateSnapping = void 0, this.insertPoint = void 0, this.lineSnapping = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(t);
641
+ super(t, !0), this.mode = "linestring", this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.keyEvents = ui, this.snapping = void 0, this.cursors = pi, this.mouseMove = !1, this.insertCoordinates = void 0, this.lastCommittedCoordinates = void 0, this.snappedPointId = void 0, this.lastMouseMoveEvent = void 0, this.editable = !1, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0, this.editedInsertIndex = void 0, this.editedPointId = void 0, this.coordinateSnapping = void 0, this.insertPoint = void 0, this.lineSnapping = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(t);
642
642
  }
643
643
  updateOptions(t) {
644
644
  super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t != null && t.snapping && (this.snapping = t.snapping), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.insertCoordinates && (this.insertCoordinates = t.insertCoordinates), t && t.editable && (this.editable = t.editable);
@@ -696,7 +696,7 @@ class Rt extends A {
696
696
  this.updateGeometries(l, i[i.length - 1], b.Commit), this.currentCoordinate++;
697
697
  }
698
698
  registerBehaviors(t) {
699
- this.coordinateSnapping = new St(t, new ct(t), new dt(t)), this.insertPoint = new li(t), this.clickBoundingBox = new dt(t), this.pixelDistance = new ct(t), this.lineSnapping = new At(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new St(t, this.pixelDistance, this.clickBoundingBox);
699
+ this.coordinateSnapping = new It(t, new ct(t), new dt(t)), this.insertPoint = new di(t), this.clickBoundingBox = new dt(t), this.pixelDistance = new ct(t), this.lineSnapping = new Rt(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new It(t, this.pixelDistance, this.clickBoundingBox);
700
700
  }
701
701
  start() {
702
702
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -792,7 +792,7 @@ class Rt extends A {
792
792
  return e;
793
793
  }
794
794
  validateFeature(t) {
795
- return this.validateModeFeature(t, (e) => jt(e, this.coordinatePrecision));
795
+ return this.validateModeFeature(t, (e) => At(e, this.coordinatePrecision));
796
796
  }
797
797
  lineStringFilter(t) {
798
798
  return !!(t.geometry.type === "LineString" && t.properties && t.properties.mode === this.mode);
@@ -810,14 +810,14 @@ class Rt extends A {
810
810
  this.editedFeatureId === t.id && this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0), this.snappedPointId && this.lastMouseMoveEvent && this.updateSnappedCoordinate(this.lastMouseMoveEvent), this.currentId === t.id && (this.closingPointId && (this.store.delete([this.closingPointId]), this.closingPointId = void 0), this.currentCoordinate = 0, this.currentId = void 0, this.state === "drawing" && this.setStarted());
811
811
  }
812
812
  }
813
- const pi = "Feature is not a Point", gi = "Feature has invalid coordinates", yi = "Feature has coordinates with excessive precision";
814
- function Ee(r, t) {
815
- return r.geometry.type !== "Point" ? { valid: !1, reason: pi } : Bt(r.geometry.coordinates) ? xt(r.geometry.coordinates, t) ? { valid: !0 } : { valid: !1, reason: yi } : { valid: !1, reason: gi };
813
+ const gi = "Feature is not a Point", yi = "Feature has invalid coordinates", fi = "Feature has coordinates with excessive precision";
814
+ function we(r, t) {
815
+ return r.geometry.type !== "Point" ? { valid: !1, reason: gi } : jt(r.geometry.coordinates) ? Ot(r.geometry.coordinates, t) ? { valid: !0 } : { valid: !1, reason: fi } : { valid: !1, reason: yi };
816
816
  }
817
- const fi = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
818
- class Gt extends A {
817
+ const mi = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
818
+ class Ut extends A {
819
819
  constructor(t) {
820
- super(t, !0), this.mode = "point", this.cursors = fi, this.editable = !1, this.editedFeatureId = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(t);
820
+ super(t, !0), this.mode = "point", this.cursors = mi, this.editable = !1, this.editedFeatureId = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(t);
821
821
  }
822
822
  updateOptions(t) {
823
823
  super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t != null && t.editable && (this.editable = t.editable);
@@ -867,7 +867,7 @@ class Gt extends A {
867
867
  return e;
868
868
  }
869
869
  validateFeature(t) {
870
- return this.validateModeFeature(t, (e) => Ee(e, this.coordinatePrecision));
870
+ return this.validateModeFeature(t, (e) => we(e, this.coordinatePrecision));
871
871
  }
872
872
  onLeftClick(t) {
873
873
  const e = { type: "Point", coordinates: [t.lng, t.lat] }, i = { mode: this.mode };
@@ -895,7 +895,7 @@ class Gt extends A {
895
895
  this.editedFeatureId === t.id && (this.editedFeatureId = void 0, this.setCursor(this.cursors.create));
896
896
  }
897
897
  }
898
- class mi extends B {
898
+ class vi extends B {
899
899
  constructor(t, e) {
900
900
  super(t), this.config = void 0, this.pixelDistance = void 0, this._startEndPoints = [], this.config = t, this.pixelDistance = e;
901
901
  }
@@ -921,7 +921,7 @@ class mi extends B {
921
921
  return { isClosing: o < this.pointerDistance, isPreviousClosing: s < this.pointerDistance };
922
922
  }
923
923
  }
924
- class we extends B {
924
+ class Le extends B {
925
925
  constructor(t) {
926
926
  super(t);
927
927
  }
@@ -976,10 +976,10 @@ class we extends B {
976
976
  e && (this.deleteCoordinatePoints(e), this.setFeatureCoordinatePoints(t, null));
977
977
  }
978
978
  }
979
- const vi = { cancel: "Escape", finish: "Enter" }, Ci = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
980
- class Le extends A {
979
+ const Ci = { cancel: "Escape", finish: "Enter" }, Pi = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
980
+ class Fe extends A {
981
981
  constructor(t) {
982
- super(t, !0), this.mode = "polygon", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = vi, this.cursors = Ci, this.mouseMove = !1, this.showCoordinatePoints = !1, this.lastMouseMoveEvent = void 0, this.snapping = void 0, this.snappedPointId = void 0, this.editable = !1, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0, this.editedInsertIndex = void 0, this.editedPointId = void 0, this.coordinatePoints = void 0, this.lineSnapping = void 0, this.coordinateSnapping = void 0, this.pixelDistance = void 0, this.closingPoints = void 0, this.clickBoundingBox = void 0, this.updateOptions(t);
982
+ super(t, !0), this.mode = "polygon", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Ci, this.cursors = Pi, this.mouseMove = !1, this.showCoordinatePoints = !1, this.lastMouseMoveEvent = void 0, this.snapping = void 0, this.snappedPointId = void 0, this.editable = !1, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0, this.editedInsertIndex = void 0, this.editedPointId = void 0, this.coordinatePoints = void 0, this.lineSnapping = void 0, this.coordinateSnapping = void 0, this.pixelDistance = void 0, this.closingPoints = void 0, this.clickBoundingBox = void 0, this.updateOptions(t);
983
983
  }
984
984
  updateOptions(t) {
985
985
  if (super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.snapping && (this.snapping = t.snapping), t?.editable !== void 0 && (this.editable = t.editable), t?.pointerEvents !== void 0 && (this.pointerEvents = t.pointerEvents), t?.showCoordinatePoints !== void 0) {
@@ -1004,7 +1004,7 @@ class Le extends A {
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
  }
1006
1006
  registerBehaviors(t) {
1007
- this.clickBoundingBox = new dt(t), this.pixelDistance = new ct(t), this.lineSnapping = new At(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new St(t, this.pixelDistance, this.clickBoundingBox), this.closingPoints = new mi(t, this.pixelDistance), this.coordinatePoints = new we(t);
1007
+ this.clickBoundingBox = new dt(t), this.pixelDistance = new ct(t), this.lineSnapping = new Rt(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new It(t, this.pixelDistance, this.clickBoundingBox), this.closingPoints = new vi(t, this.pixelDistance), this.coordinatePoints = new Le(t);
1008
1008
  }
1009
1009
  start() {
1010
1010
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -1161,13 +1161,13 @@ class Le extends A {
1161
1161
  this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(t.id), this.editedFeatureId === t.id && this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0), this.snappedPointId && this.lastMouseMoveEvent && this.updateSnappedCoordinate(this.lastMouseMoveEvent), this.currentId === t.id && (this.currentCoordinate = 0, this.currentId = void 0, this.closingPoints.delete(), this.state === "drawing" && this.setStarted());
1162
1162
  }
1163
1163
  validateFeature(t) {
1164
- return this.validateModeFeature(t, (e) => Ot(e, this.coordinatePrecision));
1164
+ return this.validateModeFeature(t, (e) => bt(e, this.coordinatePrecision));
1165
1165
  }
1166
1166
  }
1167
- const Pi = { cancel: "Escape", finish: "Enter" }, Si = { start: "crosshair" };
1168
- class Fe extends A {
1167
+ const Si = { cancel: "Escape", finish: "Enter" }, Ii = { start: "crosshair" };
1168
+ class Me extends A {
1169
1169
  constructor(t) {
1170
- super(t, !0), this.mode = "rectangle", this.center = void 0, this.clickCount = 0, this.currentRectangleId = void 0, this.keyEvents = Pi, this.cursors = Si, this.updateOptions(t);
1170
+ super(t, !0), this.mode = "rectangle", this.center = void 0, this.clickCount = 0, this.currentRectangleId = void 0, this.keyEvents = Si, this.cursors = Ii, this.updateOptions(t);
1171
1171
  }
1172
1172
  updateOptions(t) {
1173
1173
  super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents));
@@ -1268,50 +1268,50 @@ class Q extends A {
1268
1268
  validateFeature(t) {
1269
1269
  const e = super.validateFeature(t);
1270
1270
  if (e.valid) {
1271
- const i = t, o = Ee(i, this.coordinatePrecision).valid || Ot(i, this.coordinatePrecision).valid || jt(i, this.coordinatePrecision).valid;
1271
+ const i = t, o = we(i, this.coordinatePrecision).valid || bt(i, this.coordinatePrecision).valid || At(i, this.coordinatePrecision).valid;
1272
1272
  return o ? { valid: !0 } : { valid: o, reason: "Feature is not a valid Point, Polygon or LineString feature" };
1273
1273
  }
1274
1274
  return e;
1275
1275
  }
1276
1276
  }
1277
- function Dt(r, t) {
1277
+ function _t(r, t) {
1278
1278
  const e = r, i = t, o = D(e[1]), s = D(i[1]);
1279
1279
  let n = D(i[0] - e[0]);
1280
1280
  n > Math.PI && (n -= 2 * Math.PI), n < -Math.PI && (n += 2 * Math.PI);
1281
1281
  const a = Math.log(Math.tan(s / 2 + Math.PI / 4) / Math.tan(o / 2 + Math.PI / 4)), l = (V(Math.atan2(n, a)) + 360) % 360;
1282
1282
  return l > 180 ? -(360 - l) : l;
1283
1283
  }
1284
- function Me(r, t, e) {
1284
+ function De(r, t, e) {
1285
1285
  let i = t;
1286
1286
  t < 0 && (i = -Math.abs(i));
1287
- const o = i / Se, s = r[0] * Math.PI / 180, n = D(r[1]), a = D(e), l = o * Math.cos(a);
1287
+ const o = i / Ie, 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
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
1291
  return u[0] += u[0] - r[0] > 180 ? -360 : r[0] - u[0] > 180 ? 360 : 0, u;
1292
1292
  }
1293
- function De(r, t, e, i, o) {
1293
+ function _e(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);
1295
1295
  return [w(a, e), w(l, e)];
1296
1296
  }
1297
- function Ii(r, t, e) {
1298
- const i = Me(r, 1e3 * U(r, t) / 2, Dt(r, t));
1297
+ function xi(r, t, e) {
1298
+ const i = De(r, 1e3 * U(r, t) / 2, _t(r, t));
1299
1299
  return [w(i[0], e), w(i[1], e)];
1300
1300
  }
1301
- function ae({ featureCoords: r, precision: t, unproject: e, project: i, projection: o }) {
1301
+ function le({ featureCoords: r, precision: t, unproject: e, project: i, projection: o }) {
1302
1302
  const s = [];
1303
1303
  for (let n = 0; n < r.length - 1; n++) {
1304
1304
  let a;
1305
- if (o === "web-mercator") a = De(r[n], r[n + 1], t, i, e);
1305
+ if (o === "web-mercator") a = _e(r[n], r[n + 1], t, i, e);
1306
1306
  else {
1307
1307
  if (o !== "globe") throw new Error("Invalid projection");
1308
- a = Ii(r[n], r[n + 1], t);
1308
+ a = xi(r[n], r[n + 1], t);
1309
1309
  }
1310
1310
  s.push(a);
1311
1311
  }
1312
1312
  return s;
1313
1313
  }
1314
- class xi extends B {
1314
+ class Oi extends B {
1315
1315
  constructor(t, e, i) {
1316
1316
  super(t), this.config = void 0, this.selectionPointBehavior = void 0, this.coordinatePointBehavior = void 0, this._midPoints = [], this.config = t, this.selectionPointBehavior = e, this.coordinatePointBehavior = i;
1317
1317
  }
@@ -1327,17 +1327,17 @@ class xi extends B {
1327
1327
  create(t, e, i) {
1328
1328
  if (!this.store.has(e)) throw new Error("Store does not have feature with this id");
1329
1329
  this._midPoints = this.store.create((function(o, s, n, a, l, d) {
1330
- return ae({ featureCoords: o, precision: n, project: a, unproject: l, projection: d }).map((c, h) => ({ geometry: { type: "Point", coordinates: c }, properties: s(h) }));
1330
+ return le({ featureCoords: o, precision: n, project: a, unproject: l, projection: d }).map((c, h) => ({ geometry: { type: "Point", coordinates: c }, properties: s(h) }));
1331
1331
  })(t, (o) => ({ mode: this.mode, [k.MID_POINT]: !0, midPointSegment: o, midPointFeatureId: e }), i, this.config.project, this.config.unproject, this.projection));
1332
1332
  }
1333
1333
  delete() {
1334
1334
  this._midPoints.length && (this.store.delete(this._midPoints), this._midPoints = []);
1335
1335
  }
1336
1336
  getUpdated(t) {
1337
- if (this._midPoints.length !== 0) return ae({ featureCoords: t, precision: this.coordinatePrecision, project: this.config.project, unproject: this.config.unproject, projection: this.config.projection }).map((e, i) => ({ id: this._midPoints[i], geometry: { type: "Point", coordinates: e } }));
1337
+ if (this._midPoints.length !== 0) return le({ featureCoords: t, precision: this.coordinatePrecision, project: this.config.project, unproject: this.config.unproject, projection: this.config.projection }).map((e, i) => ({ id: this._midPoints[i], geometry: { type: "Point", coordinates: e } }));
1338
1338
  }
1339
1339
  }
1340
- class Oi extends B {
1340
+ class bi extends B {
1341
1341
  constructor(t) {
1342
1342
  super(t), this._selectionPoints = [];
1343
1343
  }
@@ -1363,7 +1363,7 @@ class Oi extends B {
1363
1363
  if (this._selectionPoints[t] !== void 0) return { id: this._selectionPoints[t], geometry: { type: "Point", coordinates: e } };
1364
1364
  }
1365
1365
  }
1366
- function _e(r, t) {
1366
+ function ke(r, t) {
1367
1367
  let e = !1;
1368
1368
  for (let n = 0, a = t.length; n < a; n++) {
1369
1369
  const l = t[n];
@@ -1372,7 +1372,7 @@ function _e(r, t) {
1372
1372
  var i, o, s;
1373
1373
  return e;
1374
1374
  }
1375
- const _t = (r, t, e) => {
1375
+ const kt = (r, t, e) => {
1376
1376
  const i = (s) => s * s, o = (s, n) => i(s.x - n.x) + i(s.y - n.y);
1377
1377
  return Math.sqrt(((s, n, a) => {
1378
1378
  const l = o(n, a);
@@ -1381,7 +1381,7 @@ const _t = (r, t, e) => {
1381
1381
  return d = Math.max(0, Math.min(1, d)), o(s, { x: n.x + d * (a.x - n.x), y: n.y + d * (a.y - n.y) });
1382
1382
  })(r, t, e));
1383
1383
  };
1384
- class bi extends B {
1384
+ class Ei extends B {
1385
1385
  constructor(t, e, i) {
1386
1386
  super(t), this.config = void 0, this.createClickBoundingBox = void 0, this.pixelDistance = void 0, this.config = t, this.createClickBoundingBox = e, this.pixelDistance = i;
1387
1387
  }
@@ -1397,18 +1397,18 @@ class bi extends B {
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
- const m = g.coordinates[y], v = g.coordinates[y + 1], C = _t({ x: t.containerX, y: t.containerY }, this.project(m[0], m[1]), this.project(v[0], v[1]));
1400
+ const m = g.coordinates[y], v = g.coordinates[y + 1], C = kt({ x: t.containerX, y: t.containerY }, this.project(m[0], m[1]), this.project(v[0], v[1]));
1401
1401
  C < this.pointerDistance && C < l && (l = C, o = p);
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
+ ke([t.lng, t.lat], g.coordinates) && (n = p);
1406
1406
  }
1407
1407
  }
1408
1408
  return { clickedFeature: i || o || n, clickedMidPoint: s };
1409
1409
  }
1410
1410
  }
1411
- class Ei extends B {
1411
+ class wi extends B {
1412
1412
  constructor(t, e, i, o, s) {
1413
1413
  super(t), this.config = void 0, this.featuresAtCursorEvent = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.draggedFeatureId = null, this.dragPosition = void 0, this.config = t, this.featuresAtCursorEvent = e, this.selectionPoints = i, this.midPoints = o, this.coordinatePoints = s;
1414
1414
  }
@@ -1451,7 +1451,7 @@ class Ei extends B {
1451
1451
  } else i.type === "Point" && (this.store.updateGeometry([{ id: this.draggedFeatureId, geometry: { type: "Point", coordinates: o } }]), this.dragPosition = [t.lng, t.lat]);
1452
1452
  }
1453
1453
  }
1454
- class wi extends B {
1454
+ class Li extends B {
1455
1455
  constructor(t, e, i, o, s, n, a) {
1456
1456
  super(t), this.config = void 0, this.pixelDistance = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.coordinateSnapping = void 0, this.lineSnapping = void 0, this.draggedCoordinate = { id: null, index: -1 }, this.config = t, this.pixelDistance = e, this.selectionPoints = i, this.midPoints = o, this.coordinatePoints = s, this.coordinateSnapping = n, this.lineSnapping = a;
1457
1457
  }
@@ -1503,7 +1503,7 @@ class wi extends B {
1503
1503
  d[0] = u, d[v] = u;
1504
1504
  } else d[n] = u;
1505
1505
  const p = this.selectionPoints.getOneUpdated(n, u), g = p ? [p] : [], y = this.midPoints.getUpdated(d) || [], m = this.coordinatePoints.getUpdated(s, d) || [];
1506
- return !(a.type !== "Point" && !e && Wt({ 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));
1506
+ return !(a.type !== "Point" && !e && Bt({ 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() {
1509
1509
  return this.draggedCoordinate.id !== null;
@@ -1515,20 +1515,20 @@ class wi extends B {
1515
1515
  this.draggedCoordinate = { id: null, index: -1 };
1516
1516
  }
1517
1517
  }
1518
- function le(r) {
1518
+ function de(r) {
1519
1519
  let t = 0, e = 0, i = 0;
1520
1520
  return (r.geometry.type === "Polygon" ? r.geometry.coordinates[0].slice(0, -1) : r.geometry.coordinates).forEach((o) => {
1521
1521
  t += o[0], e += o[1], i++;
1522
1522
  }, !0), [t / i, e / i];
1523
1523
  }
1524
- const ke = (r, t) => {
1524
+ const Ne = (r, t) => {
1525
1525
  if (t === 0 || t === 360 || t === -360) return r;
1526
1526
  const e = 0.017453292519943295 * t, i = (r.geometry.type === "Polygon" ? r.geometry.coordinates[0] : r.geometry.coordinates).map(([n, a]) => O(n, a)), o = i.reduce((n, a) => ({ x: n.x + a.x, y: n.y + a.y }), { x: 0, y: 0 });
1527
1527
  o.x /= i.length, o.y /= i.length;
1528
1528
  const s = i.map((n) => ({ x: o.x + (n.x - o.x) * Math.cos(e) - (n.y - o.y) * Math.sin(e), y: o.y + (n.x - o.x) * Math.sin(e) + (n.y - o.y) * Math.cos(e) })).map(({ x: n, y: a }) => [R(n, a).lng, R(n, a).lat]);
1529
1529
  return r.geometry.type === "Polygon" ? r.geometry.coordinates[0] = s : r.geometry.coordinates = s, r;
1530
1530
  };
1531
- function kt(r) {
1531
+ function Nt(r) {
1532
1532
  const t = (r.geometry.type === "Polygon" ? r.geometry.coordinates[0] : r.geometry.coordinates).map((e) => {
1533
1533
  const { x: i, y: o } = O(e[0], e[1]);
1534
1534
  return [i, o];
@@ -1551,7 +1551,7 @@ function kt(r) {
1551
1551
  return { x: o / i, y: s / i };
1552
1552
  })(t);
1553
1553
  }
1554
- class Li extends B {
1554
+ class Fi extends B {
1555
1555
  constructor(t, e, i, o) {
1556
1556
  super(t), this.config = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.lastBearing = void 0, this.selectedGeometry = void 0, this.selectedGeometryCentroid = void 0, this.selectedGeometryWebMercatorCentroid = void 0, this.config = t, this.selectionPoints = e, this.midPoints = i, this.coordinatePoints = o;
1557
1557
  }
@@ -1566,26 +1566,26 @@ class Li extends B {
1566
1566
  let n;
1567
1567
  const a = { type: "Feature", geometry: o, properties: {} };
1568
1568
  if (this.config.projection === "web-mercator") {
1569
- this.selectedGeometryWebMercatorCentroid || (this.selectedGeometryWebMercatorCentroid = kt(a));
1569
+ this.selectedGeometryWebMercatorCentroid || (this.selectedGeometryWebMercatorCentroid = Nt(a));
1570
1570
  const u = O(t.lng, t.lat);
1571
1571
  if (n = G(this.selectedGeometryWebMercatorCentroid, u), n === 0) return;
1572
1572
  if (!this.lastBearing) return void (this.lastBearing = n);
1573
- ke(a, -(this.lastBearing - n));
1573
+ Ne(a, -(this.lastBearing - n));
1574
1574
  } else {
1575
1575
  if (this.config.projection !== "globe") throw new Error("Unsupported projection");
1576
- if (this.selectedGeometryCentroid || (this.selectedGeometryCentroid = le({ geometry: o })), n = Dt(this.selectedGeometryCentroid, s), !this.lastBearing) return void (this.lastBearing = n + 180);
1576
+ if (this.selectedGeometryCentroid || (this.selectedGeometryCentroid = de({ geometry: o })), n = _t(this.selectedGeometryCentroid, s), !this.lastBearing) return void (this.lastBearing = n + 180);
1577
1577
  (function(u, p) {
1578
1578
  if (p === 0 || p === 360 || p === -360) return u;
1579
- const g = le(u);
1579
+ const g = de(u);
1580
1580
  (u.geometry.type === "Polygon" ? u.geometry.coordinates[0] : u.geometry.coordinates).forEach((y) => {
1581
- const m = Dt(g, y) + p, v = (function(f, P) {
1581
+ const m = _t(g, y) + p, v = (function(f, P) {
1582
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;
1583
+ const I = Ie, E = P[1] * Math.PI / 180, L = f[1] * Math.PI / 180, M = L - E;
1584
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;
1588
- })(g, y), C = Me(g, v, m);
1588
+ })(g, y), C = De(g, v, m);
1589
1589
  y[0] = C[0], y[1] = C[1];
1590
1590
  });
1591
1591
  })(a, -(this.lastBearing - (n + 180)));
@@ -1599,7 +1599,7 @@ class Li extends B {
1599
1599
  this.store.updateGeometry([{ id: e, geometry: o }, ...c, ...d, ...h]), this.projection === "web-mercator" ? this.lastBearing = n : this.projection === "globe" && (this.lastBearing = n + 180);
1600
1600
  }
1601
1601
  }
1602
- class Fi extends B {
1602
+ class Mi extends B {
1603
1603
  constructor(t, e) {
1604
1604
  super(t), this.config = void 0, this.dragCoordinateResizeBehavior = void 0, this.config = t, this.dragCoordinateResizeBehavior = e;
1605
1605
  }
@@ -1614,13 +1614,13 @@ class Fi extends B {
1614
1614
  this.dragCoordinateResizeBehavior.stopDragging();
1615
1615
  }
1616
1616
  }
1617
- function Ne({ coordinates: r, originX: t, originY: e, xScale: i, yScale: o }) {
1617
+ function Te({ coordinates: r, originX: t, originY: e, xScale: i, yScale: o }) {
1618
1618
  i === 1 && o === 1 || r.forEach((s) => {
1619
1619
  const { x: n, y: a } = O(s[0], s[1]), l = t + (n - t) * i, d = e + (a - e) * o, { lng: c, lat: h } = R(l, d);
1620
1620
  s[0] = c, s[1] = h;
1621
1621
  });
1622
1622
  }
1623
- class Mi extends B {
1623
+ class Di extends B {
1624
1624
  constructor(t, e, i, o, s) {
1625
1625
  super(t), this.config = void 0, this.pixelDistance = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.minimumScale = 1e-4, this.draggedCoordinate = { id: null, index: -1 }, this.boundingBoxMaps = { opposite: { 0: 4, 1: 5, 2: 6, 3: 7, 4: 0, 5: 1, 6: 2, 7: 3 } }, this.config = t, this.pixelDistance = e, this.selectionPoints = i, this.midPoints = o, this.coordinatePoints = s;
1626
1626
  }
@@ -1679,7 +1679,7 @@ class Mi extends B {
1679
1679
  centerWebMercatorDrag(t) {
1680
1680
  const e = this.getSelectedFeatureDataWebMercator();
1681
1681
  if (!e) return null;
1682
- const { feature: i, boundingBox: o, updatedCoords: s, selectedCoordinate: n } = e, a = kt(i);
1682
+ const { feature: i, boundingBox: o, updatedCoords: s, selectedCoordinate: n } = e, a = Nt(i);
1683
1683
  if (!a) return null;
1684
1684
  const l = O(n[0], n[1]), { closestBBoxIndex: d } = this.getIndexesWebMercator(o, l), c = O(t.lng, t.lat);
1685
1685
  return this.scaleWebMercator({ closestBBoxIndex: d, updatedCoords: s, webMercatorCursor: c, webMercatorSelected: l, webMercatorOrigin: a }), s;
@@ -1687,7 +1687,7 @@ class Mi extends B {
1687
1687
  centerFixedWebMercatorDrag(t) {
1688
1688
  const e = this.getSelectedFeatureDataWebMercator();
1689
1689
  if (!e) return null;
1690
- const { feature: i, boundingBox: o, updatedCoords: s, selectedCoordinate: n } = e, a = kt(i);
1690
+ const { feature: i, boundingBox: o, updatedCoords: s, selectedCoordinate: n } = e, a = Nt(i);
1691
1691
  if (!a) return null;
1692
1692
  const l = O(n[0], n[1]), { closestBBoxIndex: d } = this.getIndexesWebMercator(o, l), c = O(t.lng, t.lat);
1693
1693
  return this.scaleFixedWebMercator({ closestBBoxIndex: d, updatedCoords: s, webMercatorCursor: c, webMercatorSelected: l, webMercatorOrigin: a }), s;
@@ -1695,7 +1695,7 @@ class Mi extends B {
1695
1695
  scaleFixedWebMercator({ closestBBoxIndex: t, webMercatorOrigin: e, webMercatorSelected: i, webMercatorCursor: o, updatedCoords: s }) {
1696
1696
  if (!this.isValidDragWebMercator(t, e.x - o.x, e.y - o.y)) return null;
1697
1697
  let n = F(e, o) / F(e, i);
1698
- return n < 0 && (n = this.minimumScale), Ne({ coordinates: s, originX: e.x, originY: e.y, xScale: n, yScale: n }), s;
1698
+ return n < 0 && (n = this.minimumScale), Te({ coordinates: s, originX: e.x, originY: e.y, xScale: n, yScale: n }), s;
1699
1699
  }
1700
1700
  oppositeFixedWebMercatorDrag(t) {
1701
1701
  const e = this.getSelectedFeatureDataWebMercator();
@@ -1776,19 +1776,19 @@ class Mi extends B {
1776
1776
  if (e === "center" ? s = this.centerWebMercatorDrag(t) : e === "opposite" ? s = this.oppositeWebMercatorDrag(t) : e === "center-fixed" ? s = this.centerFixedWebMercatorDrag(t) : e === "opposite-fixed" && (s = this.oppositeFixedWebMercatorDrag(t)), !s) return !1;
1777
1777
  for (let c = 0; c < s.length; c++) {
1778
1778
  const h = s[c];
1779
- if (h[0] = w(h[0], this.coordinatePrecision), h[1] = w(h[1], this.coordinatePrecision), !xt(h, this.coordinatePrecision)) return !1;
1779
+ if (h[0] = w(h[0], this.coordinatePrecision), h[1] = w(h[1], this.coordinatePrecision), !Ot(h, this.coordinatePrecision)) return !1;
1780
1780
  }
1781
1781
  const n = this.midPoints.getUpdated(s) || [], a = this.selectionPoints.getUpdated(s) || [], l = this.coordinatePoints.getUpdated(o.id, s) || [], d = { type: o.geometry.type, coordinates: o.geometry.type === "Polygon" ? [s] : s };
1782
1782
  return !(i && !i({ id: this.draggedCoordinate.id, type: "Feature", geometry: d, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional }).valid || (this.store.updateGeometry([{ id: this.draggedCoordinate.id, geometry: d }, ...a, ...n, ...l]), 0));
1783
1783
  }
1784
1784
  }
1785
- const Di = { deselect: "Escape", delete: "Delete", rotate: ["Control", "r"], scale: ["Control", "s"] }, de = { pointerOver: "move", dragStart: "move", dragEnd: "move", insertMidpoint: "crosshair" };
1786
- class Ut extends qe {
1785
+ const _i = { deselect: "Escape", delete: "Delete", rotate: ["Control", "r"], scale: ["Control", "s"] }, ce = { pointerOver: "move", dragStart: "move", dragEnd: "move", insertMidpoint: "crosshair" };
1786
+ class zt extends Ze {
1787
1787
  constructor(t) {
1788
- super(t, !0), this.mode = "select", this.allowManualDeselection = !0, this.dragEventThrottle = 5, this.dragEventCount = 0, this.selected = [], this.flags = {}, this.keyEvents = Di, this.cursors = de, this.validations = {}, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinateSnap = void 0, this.featuresAtMouseEvent = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.dragFeature = void 0, this.dragCoordinate = void 0, this.rotateFeature = void 0, this.scaleFeature = void 0, this.dragCoordinateResizeFeature = void 0, this.coordinatePoints = void 0, this.lineSnap = void 0, this.updateOptions(t);
1788
+ super(t, !0), this.mode = "select", this.allowManualDeselection = !0, this.dragEventThrottle = 5, this.dragEventCount = 0, this.selected = [], this.flags = {}, this.keyEvents = _i, this.cursors = ce, this.validations = {}, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinateSnap = void 0, this.featuresAtMouseEvent = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.dragFeature = void 0, this.dragCoordinate = void 0, this.rotateFeature = void 0, this.scaleFeature = void 0, this.dragCoordinateResizeFeature = void 0, this.coordinatePoints = void 0, this.lineSnap = void 0, this.updateOptions(t);
1789
1789
  }
1790
1790
  updateOptions(t) {
1791
- if (super.updateOptions(t), this.cursors = t && t.cursors ? x({}, this.cursors, t.cursors) : de, t?.keyEvents === null ? this.keyEvents = { deselect: null, delete: null, rotate: null, scale: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t?.dragEventThrottle !== void 0 && (this.dragEventThrottle = t.dragEventThrottle), t?.allowManualDeselection !== void 0 && (this.allowManualDeselection = t.allowManualDeselection), t != null && t.flags) {
1791
+ if (super.updateOptions(t), this.cursors = t && t.cursors ? x({}, this.cursors, t.cursors) : ce, t?.keyEvents === null ? this.keyEvents = { deselect: null, delete: null, rotate: null, scale: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t?.dragEventThrottle !== void 0 && (this.dragEventThrottle = t.dragEventThrottle), t?.allowManualDeselection !== void 0 && (this.allowManualDeselection = t.allowManualDeselection), t != null && t.flags) {
1792
1792
  this.flags = x({}, this.flags, t.flags), this.validations = {};
1793
1793
  for (const e in this.flags) {
1794
1794
  const i = this.flags[e].feature;
@@ -1804,7 +1804,7 @@ class Ut extends qe {
1804
1804
  this._state = "selecting";
1805
1805
  }
1806
1806
  registerBehaviors(t) {
1807
- this.pixelDistance = new ct(t), this.clickBoundingBox = new dt(t), this.featuresAtMouseEvent = new bi(t, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new Oi(t), this.coordinatePoints = new we(t), this.midPoints = new xi(t, this.selectionPoints, this.coordinatePoints), this.coordinateSnap = new St(t, this.pixelDistance, this.clickBoundingBox), this.lineSnap = new At(t, this.pixelDistance, this.clickBoundingBox), this.rotateFeature = new Li(t, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragFeature = new Ei(t, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragCoordinate = new wi(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints, this.coordinateSnap, this.lineSnap), this.dragCoordinateResizeFeature = new Mi(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints), this.scaleFeature = new Fi(t, this.dragCoordinateResizeFeature);
1807
+ this.pixelDistance = new ct(t), this.clickBoundingBox = new dt(t), this.featuresAtMouseEvent = new Ei(t, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new bi(t), this.coordinatePoints = new Le(t), this.midPoints = new Oi(t, this.selectionPoints, this.coordinatePoints), this.coordinateSnap = new It(t, this.pixelDistance, this.clickBoundingBox), this.lineSnap = new Rt(t, this.pixelDistance, this.clickBoundingBox), this.rotateFeature = new Fi(t, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragFeature = new wi(t, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragCoordinate = new Li(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints, this.coordinateSnap, this.lineSnap), this.dragCoordinateResizeFeature = new Di(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints), this.scaleFeature = new Mi(t, this.dragCoordinateResizeFeature);
1808
1808
  }
1809
1809
  deselectFeature() {
1810
1810
  this.deselect();
@@ -1973,7 +1973,7 @@ class Ut extends qe {
1973
1973
  }
1974
1974
  }
1975
1975
  }
1976
- class _i extends A {
1976
+ class ki extends A {
1977
1977
  constructor(...t) {
1978
1978
  super(...t), this.type = H.Static, this.mode = "static";
1979
1979
  }
@@ -2001,11 +2001,11 @@ class _i extends A {
2001
2001
  return x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
2002
2002
  }
2003
2003
  }
2004
- function Te(r, t, e, i, o) {
2004
+ function We(r, t, e, i, o) {
2005
2005
  for (; i > e; ) {
2006
2006
  if (i - e > 600) {
2007
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);
2008
+ We(r, t, Math.max(e, Math.floor(t - d * h / l + u)), Math.min(i, Math.floor(t + (l - d) * h / l + u)), o);
2009
2009
  }
2010
2010
  const s = r[t];
2011
2011
  let n = e, a = i;
@@ -2034,23 +2034,23 @@ function nt(r, t, e, i, o) {
2034
2034
  function at(r, t) {
2035
2035
  return r.minX = Math.min(r.minX, t.minX), r.minY = Math.min(r.minY, t.minY), r.maxX = Math.max(r.maxX, t.maxX), r.maxY = Math.max(r.maxY, t.maxY), r;
2036
2036
  }
2037
- function ki(r, t) {
2037
+ function Ni(r, t) {
2038
2038
  return r.minX - t.minX;
2039
2039
  }
2040
- function Ni(r, t) {
2040
+ function Ti(r, t) {
2041
2041
  return r.minY - t.minY;
2042
2042
  }
2043
- function wt(r) {
2043
+ function Lt(r) {
2044
2044
  return (r.maxX - r.minX) * (r.maxY - r.minY);
2045
2045
  }
2046
2046
  function ft(r) {
2047
2047
  return r.maxX - r.minX + (r.maxY - r.minY);
2048
2048
  }
2049
- function Ti(r, t) {
2049
+ function Wi(r, t) {
2050
2050
  const e = Math.max(r.minX, t.minX), i = Math.max(r.minY, t.minY), o = Math.min(r.maxX, t.maxX), s = Math.min(r.maxY, t.maxY);
2051
2051
  return Math.max(0, o - e) * Math.max(0, s - i);
2052
2052
  }
2053
- function Lt(r, t) {
2053
+ function Ft(r, t) {
2054
2054
  return r.minX <= t.minX && r.minY <= t.minY && t.maxX <= r.maxX && t.maxY <= r.maxY;
2055
2055
  }
2056
2056
  function mt(r, t) {
@@ -2059,15 +2059,15 @@ function mt(r, t) {
2059
2059
  function Z(r) {
2060
2060
  return { children: r, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
2061
2061
  }
2062
- function ce(r, t, e, i, o) {
2062
+ function he(r, t, e, i, o) {
2063
2063
  const s = [t, e];
2064
2064
  for (; s.length; ) {
2065
2065
  if ((e = s.pop()) - (t = s.pop()) <= i) continue;
2066
2066
  const n = t + Math.ceil((e - t) / i / 2) * i;
2067
- Te(r, n, t, e, o), s.push(t, n, n, e);
2067
+ We(r, n, t, e, o), s.push(t, n, n, e);
2068
2068
  }
2069
2069
  }
2070
- class Wi {
2070
+ class Bi {
2071
2071
  constructor(t) {
2072
2072
  this._maxEntries = void 0, this._minEntries = void 0, this.data = void 0, this._maxEntries = Math.max(4, t), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
2073
2073
  }
@@ -2079,7 +2079,7 @@ class Wi {
2079
2079
  for (; e; ) {
2080
2080
  for (let n = 0; n < e.children.length; n++) {
2081
2081
  const a = e.children[n], l = e.leaf ? o(a) : a;
2082
- mt(t, l) && (e.leaf ? i.push(a) : Lt(t, l) ? this._all(a, i) : s.push(a));
2082
+ mt(t, l) && (e.leaf ? i.push(a) : Ft(t, l) ? this._all(a, i) : s.push(a));
2083
2083
  }
2084
2084
  e = s.pop();
2085
2085
  }
@@ -2093,7 +2093,7 @@ class Wi {
2093
2093
  for (let o = 0; o < e.children.length; o++) {
2094
2094
  const s = e.children[o], n = e.leaf ? this.toBBox(s) : s;
2095
2095
  if (mt(t, n)) {
2096
- if (e.leaf || Lt(t, n)) return !0;
2096
+ if (e.leaf || Ft(t, n)) return !0;
2097
2097
  i.push(s);
2098
2098
  }
2099
2099
  }
@@ -2133,7 +2133,7 @@ class Wi {
2133
2133
  const d = e.children.indexOf(t);
2134
2134
  d !== -1 && (e.children.splice(d, 1), o.push(e), this._condense(o));
2135
2135
  }
2136
- l || e.leaf || !Lt(e, i) ? a ? (n++, e = a.children[n], l = !1) : e = null : (o.push(e), s.push(n), n = 0, a = e, e = e.children[0]);
2136
+ l || e.leaf || !Ft(e, i) ? a ? (n++, e = a.children[n], l = !1) : e = null : (o.push(e), s.push(n), n = 0, a = e, e = e.children[0]);
2137
2137
  }
2138
2138
  }
2139
2139
  toBBox(t) {
@@ -2156,10 +2156,10 @@ class Wi {
2156
2156
  if (s <= a) return n = Z(t.slice(e, i + 1)), J(n, this.toBBox), n;
2157
2157
  o || (o = Math.ceil(Math.log(s) / Math.log(a)), a = Math.ceil(s / Math.pow(a, o - 1))), n = Z([]), n.leaf = !1, n.height = o;
2158
2158
  const l = Math.ceil(s / a), d = l * Math.ceil(Math.sqrt(a));
2159
- ce(t, e, i, d, this.compareMinX);
2159
+ he(t, e, i, d, this.compareMinX);
2160
2160
  for (let c = e; c <= i; c += d) {
2161
2161
  const h = Math.min(c + d - 1, i);
2162
- ce(t, c, h, l, this.compareMinY);
2162
+ he(t, c, h, l, this.compareMinY);
2163
2163
  for (let u = c; u <= h; u += l) {
2164
2164
  const p = Math.min(u + l - 1, h);
2165
2165
  n.children.push(this._build(t, u, p, o - 1));
@@ -2171,7 +2171,7 @@ 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 = wt(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);
2174
+ const h = e.children[c], u = Lt(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
2175
  p < d ? (d = p, l = u < l ? u : l, a = h) : p === d && u < l && (l = u, a = h);
2176
2176
  }
2177
2177
  e = a || e.children[0];
@@ -2196,13 +2196,13 @@ class Wi {
2196
2196
  _chooseSplitIndex(t, e, i) {
2197
2197
  let o, s = 1 / 0, n = 1 / 0;
2198
2198
  for (let a = e; a <= i - e; a++) {
2199
- const l = nt(t, 0, a, this.toBBox), d = nt(t, a, i, this.toBBox), c = Ti(l, d), h = wt(l) + wt(d);
2199
+ const l = nt(t, 0, a, this.toBBox), d = nt(t, a, i, this.toBBox), c = Wi(l, d), h = Lt(l) + Lt(d);
2200
2200
  c < s ? (s = c, o = a, n = h < n ? h : n) : c === s && h < n && (n = h, o = a);
2201
2201
  }
2202
2202
  return o || i - e;
2203
2203
  }
2204
2204
  _chooseSplitAxis(t, e, i) {
2205
- const o = t.leaf ? this.compareMinX : ki, s = t.leaf ? this.compareMinY : Ni;
2205
+ const o = t.leaf ? this.compareMinX : Ni, s = t.leaf ? this.compareMinY : Ti;
2206
2206
  this._allDistMargin(t, e, i, o) < this._allDistMargin(t, e, i, s) && t.children.sort(o);
2207
2207
  }
2208
2208
  _allDistMargin(t, e, i, o) {
@@ -2226,9 +2226,9 @@ class Wi {
2226
2226
  for (let e, i = t.length - 1; i >= 0; i--) t[i].children.length === 0 ? i > 0 ? (e = t[i - 1].children, e.splice(e.indexOf(t[i]), 1)) : this.clear() : J(t[i], this.toBBox);
2227
2227
  }
2228
2228
  }
2229
- class Bi {
2229
+ class ji {
2230
2230
  constructor(t) {
2231
- this.tree = void 0, this.idToNode = void 0, this.nodeToId = void 0, this.tree = new Wi(t && t.maxEntries ? t.maxEntries : 9), this.idToNode = /* @__PURE__ */ new Map(), this.nodeToId = /* @__PURE__ */ new Map();
2231
+ this.tree = void 0, this.idToNode = void 0, this.nodeToId = void 0, this.tree = new Bi(t && t.maxEntries ? t.maxEntries : 9), this.idToNode = /* @__PURE__ */ new Map(), this.nodeToId = /* @__PURE__ */ new Map();
2232
2232
  }
2233
2233
  setMaps(t, e) {
2234
2234
  this.idToNode.set(t.id, e), this.nodeToId.set(e, t.id);
@@ -2279,14 +2279,14 @@ class Bi {
2279
2279
  return this.tree.collides(this.toBBox(t));
2280
2280
  }
2281
2281
  }
2282
- const ji = { getId: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(r) {
2282
+ const Ai = { getId: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(r) {
2283
2283
  const t = 16 * Math.random() | 0;
2284
2284
  return (r == "x" ? t : 3 & t | 8).toString(16);
2285
2285
  }), isValidId: (r) => typeof r == "string" && r.length === 36 };
2286
- class Ai {
2286
+ class Ri {
2287
2287
  constructor(t) {
2288
2288
  this.idStrategy = void 0, this.tracked = void 0, this.spatialIndex = void 0, this.store = void 0, this._onChange = () => {
2289
- }, this.store = {}, this.spatialIndex = new Bi(), this.tracked = !t || t.tracked !== !1, this.idStrategy = t && t.idStrategy ? t.idStrategy : ji;
2289
+ }, this.store = {}, this.spatialIndex = new ji(), this.tracked = !t || t.tracked !== !1, this.idStrategy = t && t.idStrategy ? t.idStrategy : Ai;
2290
2290
  }
2291
2291
  clone(t) {
2292
2292
  return JSON.parse(JSON.stringify(t));
@@ -2310,10 +2310,10 @@ class Ai {
2310
2310
  }
2311
2311
  if (this.tracked) {
2312
2312
  if (d.properties.createdAt) {
2313
- if (!Zt(d.properties.createdAt)) return n.push({ id: d.id, valid: !1, reason: "createdAt is not a valid numeric timestamp" }), !1;
2313
+ if (!Qt(d.properties.createdAt)) return n.push({ id: d.id, valid: !1, reason: "createdAt is not a valid numeric timestamp" }), !1;
2314
2314
  } else d.properties.createdAt = +/* @__PURE__ */ new Date();
2315
2315
  if (d.properties.updatedAt) {
2316
- if (!Zt(d.properties.updatedAt)) return n.push({ id: d.id, valid: !1, reason: "updatedAt is not a valid numeric timestamp" }), !1;
2316
+ if (!Qt(d.properties.updatedAt)) return n.push({ id: d.id, valid: !1, reason: "updatedAt is not a valid numeric timestamp" }), !1;
2317
2317
  } else d.properties.updatedAt = +/* @__PURE__ */ new Date();
2318
2318
  }
2319
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);
@@ -2390,16 +2390,16 @@ class Ai {
2390
2390
  return Object.keys(this.store).length;
2391
2391
  }
2392
2392
  }
2393
- const Ri = "Feature is not a Polygon or LineString", Gi = "Feature intersects itself", Ui = (r) => r.geometry.type !== "Polygon" && r.geometry.type !== "LineString" ? { valid: !1, reason: Ri } : Wt(r) ? { valid: !1, reason: Gi } : { valid: !0 };
2394
- function he(r, t, e) {
2393
+ const Gi = "Feature is not a Polygon or LineString", Ui = "Feature intersects itself", zi = (r) => r.geometry.type !== "Polygon" && r.geometry.type !== "LineString" ? { valid: !1, reason: Gi } : Bt(r) ? { valid: !1, reason: Ui } : { valid: !0 };
2394
+ function ue(r, t, e) {
2395
2395
  const i = G(r, t);
2396
2396
  let o = G(t, e) - i;
2397
2397
  return o < 0 && (o += 360), 180 - Math.abs(o - 90 - 90);
2398
2398
  }
2399
- const zi = { cancel: "Escape", finish: "Enter" }, Vi = { start: "crosshair", close: "pointer" };
2400
- class We extends A {
2399
+ const Vi = { cancel: "Escape", finish: "Enter" }, $i = { start: "crosshair", close: "pointer" };
2400
+ class Be extends A {
2401
2401
  constructor(t) {
2402
- super(t, !0), this.mode = "angled-rectangle", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = zi, this.cursors = Vi, this.mouseMove = !1, this.updateOptions(t);
2402
+ super(t, !0), this.mode = "angled-rectangle", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Vi, this.cursors = $i, this.mouseMove = !1, this.updateOptions(t);
2403
2403
  }
2404
2404
  updateOptions(t) {
2405
2405
  super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents));
@@ -2424,7 +2424,7 @@ class We extends A {
2424
2424
  const o = 1 / Math.pow(10, this.coordinatePrecision - 1), s = Math.max(1e-6, o);
2425
2425
  i = [e[0], [t.lng, t.lat], [t.lng, t.lat - s], e[0]];
2426
2426
  } else if (this.currentCoordinate === 2) {
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), u = he(a, l, c), p = h ? 90 - u : he(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 = _e(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 = ue(a, l, c), p = h ? 90 - u : ue(a, l, c) - 90, g = F(l, c), y = Math.cos(D(p)) * g, m = G(a, d) + ((function(I, E, L) {
2428
2428
  const M = (L.x - E.x) * (I.y - E.y) - (L.y - E.y) * (I.x - E.x);
2429
2429
  return M > 1e-10 ? "left" : M < -1e-10 ? "right" : "left";
2430
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);
@@ -2479,13 +2479,13 @@ class We extends A {
2479
2479
  this.currentId === t.id && (this.currentId = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
2480
2480
  }
2481
2481
  }
2482
- function Be(r, t, e) {
2482
+ function je(r, t, e) {
2483
2483
  return (t.x - r.x) * (e.y - r.y) - (t.y - r.y) * (e.x - r.x) <= 0;
2484
2484
  }
2485
- const $i = { cancel: "Escape", finish: "Enter" }, Yi = { start: "crosshair", close: "pointer" };
2486
- class je extends A {
2485
+ const Yi = { cancel: "Escape", finish: "Enter" }, Ki = { start: "crosshair", close: "pointer" };
2486
+ class Ae extends A {
2487
2487
  constructor(t) {
2488
- super(t, !0), this.mode = "sector", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = $i, this.direction = void 0, this.arcPoints = 64, this.cursors = Yi, this.mouseMove = !1, this.updateOptions(t);
2488
+ super(t, !0), this.mode = "sector", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Yi, this.direction = void 0, this.arcPoints = 64, this.cursors = Ki, this.mouseMove = !1, this.updateOptions(t);
2489
2489
  }
2490
2490
  updateOptions(t) {
2491
2491
  super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.arcPoints && (this.arcPoints = t.arcPoints);
@@ -2513,7 +2513,7 @@ class je extends A {
2513
2513
  } else if (this.currentCoordinate === 2) {
2514
2514
  const o = e[0], s = e[1], n = [t.lng, t.lat], a = O(o[0], o[1]), l = O(s[0], s[1]), d = O(n[0], n[1]);
2515
2515
  if (this.direction === void 0) {
2516
- const f = Be(a, l, d);
2516
+ const f = je(a, l, d);
2517
2517
  this.direction = f ? "clockwise" : "anticlockwise";
2518
2518
  }
2519
2519
  const c = F(a, l), h = G(a, l), u = G(a, d), p = this.arcPoints, g = [o], y = X(h), m = X(u);
@@ -2572,10 +2572,10 @@ class je extends A {
2572
2572
  this.currentId === t.id && (this.currentId = void 0, this.direction = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
2573
2573
  }
2574
2574
  }
2575
- const Ki = { cancel: "Escape", finish: "Enter" }, Xi = { start: "crosshair", close: "pointer" };
2576
- class Ae extends A {
2575
+ const Xi = { cancel: "Escape", finish: "Enter" }, Hi = { start: "crosshair", close: "pointer" };
2576
+ class Re extends A {
2577
2577
  constructor(t) {
2578
- super(t, !0), this.mode = "sensor", this.currentCoordinate = 0, this.currentId = void 0, this.currentInitialArcId = void 0, this.currentStartingPointId = void 0, this.keyEvents = Ki, this.direction = void 0, this.arcPoints = 64, this.cursors = Xi, this.mouseMove = !1, this.updateOptions(t);
2578
+ super(t, !0), this.mode = "sensor", this.currentCoordinate = 0, this.currentId = void 0, this.currentInitialArcId = void 0, this.currentStartingPointId = void 0, this.keyEvents = Xi, this.direction = void 0, this.arcPoints = 64, this.cursors = Hi, this.mouseMove = !1, this.updateOptions(t);
2579
2579
  }
2580
2580
  updateOptions(t) {
2581
2581
  super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.arcPoints && (this.arcPoints = t.arcPoints);
@@ -2600,7 +2600,7 @@ class Ae extends A {
2600
2600
  if (this.currentCoordinate === 2) {
2601
2601
  const e = this.store.getGeometryCopy(this.currentInitialArcId).coordinates, i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], s = [t.lng, t.lat], n = O(o[0], o[1]), a = O(s[0], s[1]), l = O(i[0], i[1]), d = F(l, n);
2602
2602
  if (this.direction === void 0) {
2603
- const C = Be(l, n, a);
2603
+ const C = je(l, n, a);
2604
2604
  this.direction = C ? "clockwise" : "anticlockwise";
2605
2605
  }
2606
2606
  const c = G(l, n), h = G(l, a), u = this.arcPoints, p = [o], g = X(c), y = X(h);
@@ -2688,7 +2688,7 @@ class q {
2688
2688
  }, this.callback = e;
2689
2689
  }
2690
2690
  }
2691
- var Hi = { __proto__: null, TerraDrawBaseAdapter: class {
2691
+ var Ji = { __proto__: null, TerraDrawBaseAdapter: class {
2692
2692
  constructor(r) {
2693
2693
  this._nextKeyUpIsContextMenu = !1, this._minPixelDragDistance = void 0, this._minPixelDragDistanceDrawing = void 0, this._minPixelDragDistanceSelecting = void 0, this._lastDrawEvent = void 0, this._coordinatePrecision = void 0, this._heldKeys = /* @__PURE__ */ new Set(), this._listeners = [], this._dragState = "not-dragging", this._currentModeCallbacks = void 0, this._minPixelDragDistance = typeof r.minPixelDragDistance == "number" ? r.minPixelDragDistance : 1, this._minPixelDragDistanceSelecting = typeof r.minPixelDragDistanceSelecting == "number" ? r.minPixelDragDistanceSelecting : 1, this._minPixelDragDistanceDrawing = typeof r.minPixelDragDistanceDrawing == "number" ? r.minPixelDragDistanceDrawing : 8, this._coordinatePrecision = typeof r.coordinatePrecision == "number" ? r.coordinatePrecision : 9;
2694
2694
  }
@@ -2778,10 +2778,10 @@ var Hi = { __proto__: null, TerraDrawBaseAdapter: class {
2778
2778
  }), this.clear(), this._currentModeCallbacks = void 0;
2779
2779
  }
2780
2780
  } };
2781
- const Ji = { cancel: "Escape", finish: "Enter" }, qi = { start: "crosshair", close: "pointer" };
2782
- class Re extends A {
2781
+ const qi = { cancel: "Escape", finish: "Enter" }, Zi = { start: "crosshair", close: "pointer" };
2782
+ class Ge extends A {
2783
2783
  constructor(t) {
2784
- super(t, !0), this.mode = "freehand-linestring", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = Ji, this.cursors = qi, this.preventNewFeature = !1, this.updateOptions(t);
2784
+ super(t, !0), this.mode = "freehand-linestring", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = qi, this.cursors = Zi, this.preventNewFeature = !1, this.updateOptions(t);
2785
2785
  }
2786
2786
  updateOptions(t) {
2787
2787
  super.updateOptions(t), t != null && t.minDistance && (this.minDistance = t.minDistance), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors));
@@ -2843,13 +2843,13 @@ class Re extends A {
2843
2843
  return t.type === "Feature" && t.geometry.type === "LineString" && t.properties.mode === this.mode ? (e.lineStringColor = this.getHexColorStylingValue(this.styles.lineStringColor, e.lineStringColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.lineStringWidth, e.lineStringWidth, t), e.zIndex = j, e) : (t.type === "Feature" && t.geometry.type === "Point" && t.properties.mode === this.mode && (e.pointWidth = this.getNumericStylingValue(this.styles.closingPointWidth, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(this.styles.closingPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.closingPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.closingPointOutlineWidth, 2, t), e.zIndex = 50), e);
2844
2844
  }
2845
2845
  validateFeature(t) {
2846
- return this.validateModeFeature(t, (e) => jt(e, this.coordinatePrecision));
2846
+ return this.validateModeFeature(t, (e) => At(e, this.coordinatePrecision));
2847
2847
  }
2848
2848
  afterFeatureUpdated(t) {
2849
2849
  this.currentId === t.id && (this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0);
2850
2850
  }
2851
2851
  }
2852
- function Nt(r) {
2852
+ function Tt(r) {
2853
2853
  if (r === null || typeof r == "boolean" || typeof r == "string") return !0;
2854
2854
  if (r === void 0) return !1;
2855
2855
  if (typeof r == "number") return Number.isFinite(r);
@@ -2860,13 +2860,13 @@ function Nt(r) {
2860
2860
  }
2861
2861
  if (ArrayBuffer.isView(r) && !(r instanceof DataView)) return !1;
2862
2862
  if (Array.isArray(r)) {
2863
- for (const t of r) if (!Nt(t)) return !1;
2863
+ for (const t of r) if (!Tt(t)) return !1;
2864
2864
  }
2865
- return typeof r == "object" && Object.keys(r).every((t) => typeof t == "string" && Nt(r[t]));
2865
+ return typeof r == "object" && Object.keys(r).every((t) => typeof t == "string" && Tt(r[t]));
2866
2866
  }
2867
- class Zi {
2867
+ class Qi {
2868
2868
  constructor(t) {
2869
- this._modes = void 0, this._mode = void 0, this._adapter = void 0, this._enabled = !1, this._store = void 0, this._eventListeners = void 0, this._instanceSelectMode = void 0, this._adapter = t.adapter, this._mode = new _i();
2869
+ this._modes = void 0, this._mode = void 0, this._adapter = void 0, this._enabled = !1, this._store = void 0, this._eventListeners = void 0, this._instanceSelectMode = void 0, this._adapter = t.adapter, this._mode = new ki();
2870
2870
  const e = /* @__PURE__ */ new Set(), i = t.modes.reduce((c, h) => {
2871
2871
  if (e.has(h.mode)) throw new Error(`There is already a ${h.mode} mode provided`);
2872
2872
  return e.add(h.mode), c[h.mode] = h, c;
@@ -2877,7 +2877,7 @@ class Zi {
2877
2877
  if (this._instanceSelectMode) throw new Error("only one type of select mode can be provided");
2878
2878
  this._instanceSelectMode = c;
2879
2879
  }
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 });
2880
+ }), this._modes = x({}, i, { static: this._mode }), this._eventListeners = { change: [], select: [], deselect: [], finish: [], ready: [] }, this._store = new Ri({ tracked: !!t.tracked, idStrategy: t.idStrategy ? t.idStrategy : void 0 });
2881
2881
  const s = (c) => {
2882
2882
  const h = [], u = this._store.copyAll().filter((p) => !c.includes(p.id) || (h.push(p), !1));
2883
2883
  return { changed: h, unchanged: u };
@@ -2921,7 +2921,7 @@ class Zi {
2921
2921
  }), t;
2922
2922
  }
2923
2923
  featuresAtLocation({ lng: t, lat: e }, i) {
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), u = be({ unproject: d, point: h, pointerDistance: o });
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), u = Ee({ unproject: d, point: h, pointerDistance: o });
2925
2925
  return this._store.search(u).filter((p) => {
2926
2926
  if (s && (p.properties[k.MID_POINT] || p.properties[k.SELECTION_POINT]) || n && p.properties[S.COORDINATE_POINT] || l && p.properties[S.CLOSING_POINT] || a && p.properties[S.CURRENTLY_DRAWING]) return !1;
2927
2927
  if (p.geometry.type === "Point") {
@@ -2932,16 +2932,16 @@ class Zi {
2932
2932
  const g = p.geometry.coordinates;
2933
2933
  for (let y = 0; y < g.length - 1; y++) {
2934
2934
  const m = g[y], v = g[y + 1];
2935
- if (_t(h, c(m[0], m[1]), c(v[0], v[1])) < o) return !0;
2935
+ if (kt(h, c(m[0], m[1]), c(v[0], v[1])) < o) return !0;
2936
2936
  }
2937
2937
  return !1;
2938
2938
  }
2939
- if (_e([t, e], p.geometry.coordinates)) return !0;
2939
+ if (ke([t, e], p.geometry.coordinates)) return !0;
2940
2940
  if (i != null && i.includePolygonsWithinPointerDistance) {
2941
2941
  const g = p.geometry.coordinates;
2942
2942
  for (const y of g) for (let m = 0; m < y.length - 1; m++) {
2943
2943
  const v = y[m], C = y[m + 1], f = c(v[0], v[1]), P = c(C[0], C[1]);
2944
- if (_t(h, f, P) < o) return !0;
2944
+ if (kt(h, f, P) < o) return !0;
2945
2945
  }
2946
2946
  }
2947
2947
  return !1;
@@ -3040,7 +3040,7 @@ class Zi {
3040
3040
  const s = Object.entries(e);
3041
3041
  s.forEach(([n, a]) => {
3042
3042
  if (!this.checkIsReservedProperty(n)) throw new Error(`You are trying to update a reserved property name: ${n}. Please choose another name.`);
3043
- if (a !== void 0 && !Nt(a)) throw new Error(`Invalid JSON value provided for property ${n}`);
3043
+ if (a !== void 0 && !Tt(a)) throw new Error(`Invalid JSON value provided for property ${n}`);
3044
3044
  }), this._store.updateProperty(s.map(([n, a]) => ({ id: i.id, property: n, value: a })), { origin: "api" });
3045
3045
  }
3046
3046
  updateFeatureGeometry(t, e) {
@@ -3074,8 +3074,8 @@ class Zi {
3074
3074
  if (e.projection != "web-mercator") throw new Error(`Projection ${e.projection} is not currently supported for transformation`);
3075
3075
  if (e.type === "scale") {
3076
3076
  const { x: a, y: l } = O(e.origin[0], e.origin[1]);
3077
- Ne({ coordinates: n, originX: a, originY: l, xScale: e.options.xScale || 1, yScale: e.options.yScale || 1 });
3078
- } else e.type === "rotate" && (i = ke(i, e.options.angle || 0), n = i.geometry.type === "Polygon" ? i.geometry.coordinates[0] : i.geometry.coordinates);
3077
+ Te({ coordinates: n, originX: a, originY: l, xScale: e.options.xScale || 1, yScale: e.options.yScale || 1 });
3078
+ } else e.type === "rotate" && (i = Ne(i, e.options.angle || 0), n = i.geometry.type === "Polygon" ? i.geometry.coordinates[0] : i.geometry.coordinates);
3079
3079
  if (n = n.map((a) => [w(a[0], this._adapter.getCoordinatePrecision()), w(a[1], this._adapter.getCoordinatePrecision())]), i.geometry.coordinates = i.geometry.type === "Polygon" ? [n] : n, this._store.updateGeometry([{ id: i.id, geometry: i.geometry }], { origin: "api" }), s.afterFeatureUpdated) {
3080
3080
  s.afterFeatureUpdated(i);
3081
3081
  const a = i.properties[k.SELECTED], l = this.getSelectMode({ switchToSelectMode: !1 });
@@ -3084,7 +3084,7 @@ class Zi {
3084
3084
  }
3085
3085
  addFeatures(t) {
3086
3086
  return this.checkEnabled(), t.length === 0 ? [] : this._store.load(t, (e) => {
3087
- if (qt(e)) {
3087
+ if (Zt(e)) {
3088
3088
  const i = e.properties.mode, o = this._modes[i];
3089
3089
  if (!o) return { id: e.id, valid: !1, reason: `${i} mode is not in the list of instantiated modes` };
3090
3090
  const s = o.validateFeature.bind(o)(e);
@@ -3092,7 +3092,7 @@ class Zi {
3092
3092
  }
3093
3093
  return { id: e.id, valid: !1, reason: "Mode property does not exist" };
3094
3094
  }, (e) => {
3095
- if (qt(e)) {
3095
+ if (Zt(e)) {
3096
3096
  const i = this._modes[e.properties.mode];
3097
3097
  i && i.afterFeatureAdded && i.afterFeatureAdded(e);
3098
3098
  }
@@ -3141,7 +3141,7 @@ class Zi {
3141
3141
  i.includes(e) && i.splice(i.indexOf(e), 1);
3142
3142
  }
3143
3143
  }
3144
- class Qi extends Hi.TerraDrawBaseAdapter {
3144
+ class to extends Ji.TerraDrawBaseAdapter {
3145
3145
  constructor(t) {
3146
3146
  super(t), this._renderBeforeLayerId = void 0, this._prefixId = void 0, this._initialDragPan = void 0, this._initialDragRotate = void 0, this._nextRender = void 0, this._map = void 0, this._container = void 0, this.changedIds = { deletion: !1, points: !1, linestrings: !1, polygons: !1, styling: !1 }, this._map = t.map, this._container = this._map.getContainer(), this._initialDragRotate = this._map.dragRotate.isEnabled(), this._initialDragPan = this._map.dragPan.isEnabled(), this._renderBeforeLayerId = t.renderBelowLayerId, this._prefixId = t.prefixId || "td";
3147
3147
  }
@@ -3229,7 +3229,7 @@ class Qi extends Hi.TerraDrawBaseAdapter {
3229
3229
  this._renderBeforeLayerId && (this._map.moveLayer(s, this._renderBeforeLayerId), this._map.moveLayer(o, s), this._map.moveLayer(i + "-outline", o), this._map.moveLayer(i, o)), (e = this._currentModeCallbacks) != null && e.onReady && this._currentModeCallbacks.onReady();
3230
3230
  }
3231
3231
  }
3232
- const zo = [
3232
+ const Vo = [
3233
3233
  "render",
3234
3234
  "point",
3235
3235
  "linestring",
@@ -3245,7 +3245,7 @@ const zo = [
3245
3245
  "delete-selection",
3246
3246
  "delete",
3247
3247
  "download"
3248
- ], Vo = [
3248
+ ], $o = [
3249
3249
  "render",
3250
3250
  "linestring",
3251
3251
  "point",
@@ -3254,7 +3254,7 @@ const zo = [
3254
3254
  "delete",
3255
3255
  "download",
3256
3256
  "settings"
3257
- ], to = {
3257
+ ], eo = {
3258
3258
  modes: [
3259
3259
  "render",
3260
3260
  "point",
@@ -3294,7 +3294,7 @@ const zo = [
3294
3294
  open: !1,
3295
3295
  // see styling parameters of Terra Draw at https://github.com/JamesLMilner/terra-draw/blob/main/guides/5.STYLING.md
3296
3296
  modeOptions: {
3297
- point: new Gt({
3297
+ point: new Ut({
3298
3298
  editable: !0,
3299
3299
  styles: {
3300
3300
  pointColor: "#FFFFFF",
@@ -3303,7 +3303,7 @@ const zo = [
3303
3303
  pointOutlineWidth: 1
3304
3304
  }
3305
3305
  }),
3306
- linestring: new Rt({
3306
+ linestring: new Gt({
3307
3307
  editable: !0,
3308
3308
  styles: {
3309
3309
  lineStringColor: "#666666",
@@ -3314,7 +3314,7 @@ const zo = [
3314
3314
  closingPointOutlineWidth: 1
3315
3315
  }
3316
3316
  }),
3317
- polygon: new Le({
3317
+ polygon: new Fe({
3318
3318
  editable: !0,
3319
3319
  styles: {
3320
3320
  fillColor: "#EDEFF0",
@@ -3327,7 +3327,7 @@ const zo = [
3327
3327
  closingPointOutlineWidth: 1
3328
3328
  }
3329
3329
  }),
3330
- rectangle: new Fe({
3330
+ rectangle: new Me({
3331
3331
  styles: {
3332
3332
  fillColor: "#EDEFF0",
3333
3333
  fillOpacity: 0.7,
@@ -3335,7 +3335,7 @@ const zo = [
3335
3335
  outlineWidth: 2
3336
3336
  }
3337
3337
  }),
3338
- "angled-rectangle": new We({
3338
+ "angled-rectangle": new Be({
3339
3339
  styles: {
3340
3340
  fillColor: "#EDEFF0",
3341
3341
  fillOpacity: 0.7,
@@ -3343,7 +3343,7 @@ const zo = [
3343
3343
  outlineWidth: 2
3344
3344
  }
3345
3345
  }),
3346
- circle: new xe({
3346
+ circle: new Oe({
3347
3347
  styles: {
3348
3348
  fillColor: "#EDEFF0",
3349
3349
  fillOpacity: 0.7,
@@ -3351,7 +3351,7 @@ const zo = [
3351
3351
  outlineWidth: 2
3352
3352
  }
3353
3353
  }),
3354
- freehand: new Oe({
3354
+ freehand: new be({
3355
3355
  styles: {
3356
3356
  fillColor: "#EDEFF0",
3357
3357
  fillOpacity: 0.7,
@@ -3363,7 +3363,7 @@ const zo = [
3363
3363
  closingPointOutlineWidth: 1
3364
3364
  }
3365
3365
  }),
3366
- "freehand-linestring": new Re({
3366
+ "freehand-linestring": new Ge({
3367
3367
  styles: {
3368
3368
  lineStringColor: "#666666",
3369
3369
  lineStringWidth: 2,
@@ -3373,7 +3373,7 @@ const zo = [
3373
3373
  closingPointOutlineWidth: 1
3374
3374
  }
3375
3375
  }),
3376
- sensor: new Ae({
3376
+ sensor: new Re({
3377
3377
  styles: {
3378
3378
  fillColor: "#EDEFF0",
3379
3379
  fillOpacity: 0.7,
@@ -3385,7 +3385,7 @@ const zo = [
3385
3385
  centerPointOutlineWidth: 1
3386
3386
  }
3387
3387
  }),
3388
- sector: new je({
3388
+ sector: new Ae({
3389
3389
  styles: {
3390
3390
  fillColor: "#EDEFF0",
3391
3391
  fillOpacity: 0.7,
@@ -3393,7 +3393,7 @@ const zo = [
3393
3393
  outlineWidth: 2
3394
3394
  }
3395
3395
  }),
3396
- select: new Ut({
3396
+ select: new zt({
3397
3397
  flags: {
3398
3398
  point: {
3399
3399
  feature: {
@@ -3686,7 +3686,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3686
3686
  open: !1,
3687
3687
  // see styling parameters of Terra Draw at https://github.com/JamesLMilner/terra-draw/blob/main/guides/5.STYLING.md
3688
3688
  modeOptions: {
3689
- point: new Gt({
3689
+ point: new Ut({
3690
3690
  editable: !1,
3691
3691
  styles: {
3692
3692
  pointColor: "#FFFFFF",
@@ -3695,7 +3695,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3695
3695
  pointOutlineWidth: 1
3696
3696
  }
3697
3697
  }),
3698
- linestring: new Rt({
3698
+ linestring: new Gt({
3699
3699
  editable: !1,
3700
3700
  styles: {
3701
3701
  lineStringColor: "#FF0000",
@@ -3706,7 +3706,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3706
3706
  closingPointOutlineWidth: 1
3707
3707
  }
3708
3708
  }),
3709
- select: new Ut({
3709
+ select: new zt({
3710
3710
  flags: {
3711
3711
  point: {
3712
3712
  feature: {
@@ -3901,34 +3901,34 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3901
3901
  "text-halo-color": "rgb(255, 255, 255)"
3902
3902
  }
3903
3903
  }
3904
- }, eo = () => ({
3904
+ }, io = () => ({
3905
3905
  render: new Q({
3906
3906
  modeName: "render",
3907
3907
  styles: {}
3908
3908
  }),
3909
- point: new Gt({
3909
+ point: new Ut({
3910
3910
  editable: !0
3911
3911
  }),
3912
- linestring: new Rt({
3912
+ linestring: new Gt({
3913
3913
  editable: !0
3914
3914
  }),
3915
- polygon: new Le({
3915
+ polygon: new Fe({
3916
3916
  editable: !0,
3917
3917
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3918
3918
  // @ts-ignore
3919
3919
  validation: (t, e) => {
3920
3920
  const i = e.updateType;
3921
- return i === "finish" || i === "commit" ? Ui(t) : { valid: !0 };
3921
+ return i === "finish" || i === "commit" ? zi(t) : { valid: !0 };
3922
3922
  }
3923
3923
  }),
3924
- rectangle: new Fe(),
3925
- "angled-rectangle": new We(),
3926
- circle: new xe(),
3927
- freehand: new Oe(),
3928
- "freehand-linestring": new Re(),
3929
- sensor: new Ae(),
3930
- sector: new je(),
3931
- select: new Ut({
3924
+ rectangle: new Me(),
3925
+ "angled-rectangle": new Be(),
3926
+ circle: new Oe(),
3927
+ freehand: new be(),
3928
+ "freehand-linestring": new Ge(),
3929
+ sensor: new Re(),
3930
+ sector: new Ae(),
3931
+ select: new zt({
3932
3932
  flags: {
3933
3933
  point: {
3934
3934
  feature: {
@@ -4054,7 +4054,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
4054
4054
  styles: {}
4055
4055
  })
4056
4056
  });
4057
- var W = 63710088e-1, io = {
4057
+ var W = 63710088e-1, oo = {
4058
4058
  centimeters: W * 100,
4059
4059
  centimetres: W * 100,
4060
4060
  degrees: 360 / (2 * Math.PI),
@@ -4071,26 +4071,26 @@ var W = 63710088e-1, io = {
4071
4071
  radians: 1,
4072
4072
  yards: W * 1.0936
4073
4073
  };
4074
- function oo(r, t, e = {}) {
4074
+ function so(r, t, e = {}) {
4075
4075
  const i = { type: "Feature" };
4076
4076
  return (e.id === 0 || e.id) && (i.id = e.id), e.bbox && (i.bbox = e.bbox), i.properties = t || {}, i.geometry = r, i;
4077
4077
  }
4078
- function so(r, t, e = {}) {
4078
+ function ro(r, t, e = {}) {
4079
4079
  if (!r)
4080
4080
  throw new Error("coordinates is required");
4081
4081
  if (!Array.isArray(r))
4082
4082
  throw new Error("coordinates must be an Array");
4083
4083
  if (r.length < 2)
4084
4084
  throw new Error("coordinates must be at least 2 numbers long");
4085
- if (!ue(r[0]) || !ue(r[1]))
4085
+ if (!pe(r[0]) || !pe(r[1]))
4086
4086
  throw new Error("coordinates must contain numbers");
4087
- return oo({
4087
+ return so({
4088
4088
  type: "Point",
4089
4089
  coordinates: r
4090
4090
  }, t, e);
4091
4091
  }
4092
- function ro(r, t = "kilometers") {
4093
- const e = io[t];
4092
+ function no(r, t = "kilometers") {
4093
+ const e = oo[t];
4094
4094
  if (!e)
4095
4095
  throw new Error(t + " units is invalid");
4096
4096
  return r * e;
@@ -4098,10 +4098,10 @@ function ro(r, t = "kilometers") {
4098
4098
  function vt(r) {
4099
4099
  return r % 360 * Math.PI / 180;
4100
4100
  }
4101
- function ue(r) {
4101
+ function pe(r) {
4102
4102
  return !isNaN(r) && r !== null && !Array.isArray(r);
4103
4103
  }
4104
- function Ge(r, t, e) {
4104
+ function Ue(r, t, e) {
4105
4105
  if (r !== null)
4106
4106
  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++) {
4107
4107
  d = g ? r.features[v].geometry : y ? r.geometry : r, u = d ? d.type === "GeometryCollection" : !1, a = u ? d.geometries.length : 1;
@@ -4178,7 +4178,7 @@ function Ge(r, t, e) {
4178
4178
  break;
4179
4179
  case "GeometryCollection":
4180
4180
  for (i = 0; i < n.geometries.length; i++)
4181
- if (Ge(n.geometries[i], t) === !1)
4181
+ if (Ue(n.geometries[i], t) === !1)
4182
4182
  return !1;
4183
4183
  break;
4184
4184
  default:
@@ -4188,7 +4188,7 @@ function Ge(r, t, e) {
4188
4188
  }
4189
4189
  }
4190
4190
  }
4191
- function no(r, t) {
4191
+ function ao(r, t) {
4192
4192
  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;
4193
4193
  for (e = 0; e < y; e++) {
4194
4194
  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++) {
@@ -4239,9 +4239,9 @@ function no(r, t) {
4239
4239
  u++;
4240
4240
  }
4241
4241
  }
4242
- function ao(r, t, e) {
4242
+ function lo(r, t, e) {
4243
4243
  var i = e;
4244
- return no(
4244
+ return ao(
4245
4245
  r,
4246
4246
  function(o, s, n, a, l) {
4247
4247
  s === 0 && e === void 0 ? i = o : i = t(
@@ -4255,21 +4255,21 @@ function ao(r, t, e) {
4255
4255
  }
4256
4256
  ), i;
4257
4257
  }
4258
- function lo(r) {
4259
- return ao(
4258
+ function co(r) {
4259
+ return lo(
4260
4260
  r,
4261
- (t, e) => t + co(e),
4261
+ (t, e) => t + ho(e),
4262
4262
  0
4263
4263
  );
4264
4264
  }
4265
- function co(r) {
4265
+ function ho(r) {
4266
4266
  let t = 0, e;
4267
4267
  switch (r.type) {
4268
4268
  case "Polygon":
4269
- return pe(r.coordinates);
4269
+ return ge(r.coordinates);
4270
4270
  case "MultiPolygon":
4271
4271
  for (e = 0; e < r.coordinates.length; e++)
4272
- t += pe(r.coordinates[e]);
4272
+ t += ge(r.coordinates[e]);
4273
4273
  return t;
4274
4274
  case "Point":
4275
4275
  case "MultiPoint":
@@ -4279,28 +4279,28 @@ function co(r) {
4279
4279
  }
4280
4280
  return 0;
4281
4281
  }
4282
- function pe(r) {
4282
+ function ge(r) {
4283
4283
  let t = 0;
4284
4284
  if (r && r.length > 0) {
4285
- t += Math.abs(ge(r[0]));
4285
+ t += Math.abs(ye(r[0]));
4286
4286
  for (let e = 1; e < r.length; e++)
4287
- t -= Math.abs(ge(r[e]));
4287
+ t -= Math.abs(ye(r[e]));
4288
4288
  }
4289
4289
  return t;
4290
4290
  }
4291
- var ho = W * W / 2, Ft = Math.PI / 180;
4292
- function ge(r) {
4291
+ var uo = W * W / 2, Mt = Math.PI / 180;
4292
+ function ye(r) {
4293
4293
  const t = r.length - 1;
4294
4294
  if (t <= 2) return 0;
4295
4295
  let e = 0, i = 0;
4296
4296
  for (; i < t; ) {
4297
- const o = r[i], s = r[i + 1 === t ? 0 : i + 1], n = r[i + 2 >= t ? (i + 2) % t : i + 2], a = o[0] * Ft, l = s[1] * Ft, d = n[0] * Ft;
4297
+ const o = r[i], s = r[i + 1 === t ? 0 : i + 1], n = r[i + 2 >= t ? (i + 2) % t : i + 2], a = o[0] * Mt, l = s[1] * Mt, d = n[0] * Mt;
4298
4298
  e += (d - a) * Math.sin(l), i++;
4299
4299
  }
4300
- return e * ho;
4300
+ return e * uo;
4301
4301
  }
4302
- var uo = lo;
4303
- const po = (r, t, e = "auto") => {
4302
+ var po = co;
4303
+ const go = (r, t, e = "auto") => {
4304
4304
  const i = ["m2", "km2", "a", "ha"], o = ["ft2", "yd2", "acre", "mi2"];
4305
4305
  let s = e;
4306
4306
  if (e !== "auto") {
@@ -4348,12 +4348,12 @@ const po = (r, t, e = "auto") => {
4348
4348
  area: e,
4349
4349
  unit: i
4350
4350
  };
4351
- }, ye = (r, t, e, i) => {
4351
+ }, fe = (r, t, e, i) => {
4352
4352
  if (r.geometry.type !== "Polygon") return r;
4353
- const o = uo(r.geometry), s = po(o, t, i);
4353
+ const o = po(r.geometry), s = go(o, t, i);
4354
4354
  return s.area = parseFloat(s.area.toFixed(e)), r.properties.area = s.area, r.properties.unit = s.unit, r;
4355
4355
  };
4356
- function fe(r) {
4356
+ function me(r) {
4357
4357
  if (!r)
4358
4358
  throw new Error("coord is required");
4359
4359
  if (!Array.isArray(r)) {
@@ -4366,26 +4366,26 @@ function fe(r) {
4366
4366
  return [...r];
4367
4367
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
4368
4368
  }
4369
- function go(r, t, e = {}) {
4370
- var i = fe(r), o = fe(t), s = vt(o[1] - i[1]), n = vt(o[0] - i[0]), a = vt(i[1]), l = vt(o[1]), d = Math.pow(Math.sin(s / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
4371
- return ro(
4369
+ function yo(r, t, e = {}) {
4370
+ var i = me(r), o = me(t), s = vt(o[1] - i[1]), n = vt(o[0] - i[0]), a = vt(i[1]), l = vt(o[1]), d = Math.pow(Math.sin(s / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
4371
+ return no(
4372
4372
  2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
4373
4373
  e.units
4374
4374
  );
4375
4375
  }
4376
- var yo = go;
4377
- const Mt = (r, t = "kilometers", e = "auto") => {
4378
- const i = ["cm", "m", "km"];
4379
- let o = e;
4376
+ var fo = yo;
4377
+ const Dt = (r, t = "kilometers", e = "auto") => {
4378
+ const i = ["cm", "m", "km"], o = ["in", "ft", "mi"];
4379
+ let s = e;
4380
4380
  if (e !== "auto") {
4381
- const n = i.includes(e);
4382
- t === "kilometers" && !n && (o = "auto");
4381
+ const a = i.includes(e), l = o.includes(e);
4382
+ (t === "kilometers" && !a || t === "miles" && !l) && (s = "auto");
4383
4383
  }
4384
- let s = {
4384
+ let n = {
4385
4385
  distance: r,
4386
4386
  unit: "km"
4387
4387
  };
4388
- return t === "kilometers" ? s = Ct(r, o) : t === "degrees" ? s.unit = "°" : t === "miles" ? s.unit = "mi" : t === "radians" && (s.unit = "rad"), s;
4388
+ return t === "kilometers" ? n = Ct(r, s) : t === "degrees" ? n.unit = "°" : t === "miles" ? n = Pt(r, s) : t === "radians" && (n.unit = "rad"), n;
4389
4389
  }, Ct = (r, t) => {
4390
4390
  let e = {
4391
4391
  distance: r,
@@ -4409,13 +4409,36 @@ const Mt = (r, t = "kilometers", e = "auto") => {
4409
4409
  break;
4410
4410
  }
4411
4411
  return e;
4412
- }, me = (r, t, e, i, o, s, n) => {
4412
+ }, Pt = (r, t) => {
4413
+ let e = {
4414
+ distance: r,
4415
+ unit: "mi"
4416
+ };
4417
+ switch (t) {
4418
+ case "mi":
4419
+ e.distance = r, e.unit = "mi";
4420
+ break;
4421
+ case "ft":
4422
+ e.distance = r * 5280, e.unit = "ft";
4423
+ break;
4424
+ case "in":
4425
+ e.distance = r * 63360, e.unit = "in";
4426
+ break;
4427
+ case "auto":
4428
+ r >= 1 ? e = Pt(r, "mi") : r * 5280 >= 1 ? e = Pt(r, "ft") : e = Pt(r, "in");
4429
+ break;
4430
+ default:
4431
+ e.distance = r, e.unit = "mi";
4432
+ break;
4433
+ }
4434
+ return e;
4435
+ }, ve = (r, t, e, i, o, s, n) => {
4413
4436
  if (r.geometry.type !== "LineString") return r;
4414
4437
  const a = r.geometry.coordinates;
4415
4438
  let l = 0;
4416
4439
  const d = [];
4417
4440
  for (let h = 0; h < a.length - 1; h++) {
4418
- const u = a[h], p = a[h + 1], g = yo(u, p, { units: t });
4441
+ const u = a[h], p = a[h + 1], g = fo(u, p, { units: t });
4419
4442
  l += g;
4420
4443
  const y = JSON.parse(JSON.stringify(r));
4421
4444
  if (y.id = `${y.id}-${h}`, y.geometry.coordinates = [u, p], y.properties.originalId = r.id, y.properties.distance = g, y.properties.total = l, s === !0 && n === void 0) {
@@ -4427,20 +4450,20 @@ const Mt = (r, t = "kilometers", e = "auto") => {
4427
4450
  d.push(y);
4428
4451
  }
4429
4452
  r.properties.distance = d[d.length - 1].properties.total, r.properties.segments = JSON.parse(JSON.stringify(d));
4430
- const c = Mt(
4453
+ const c = Dt(
4431
4454
  r.properties.distance,
4432
4455
  t,
4433
4456
  i
4434
4457
  );
4435
4458
  return r.properties.distance = c.distance, r.properties.unit = c.unit, r.properties.segments.forEach(
4436
4459
  (h) => {
4437
- const u = Mt(
4460
+ const u = Dt(
4438
4461
  h.properties.distance,
4439
4462
  t,
4440
4463
  i
4441
4464
  );
4442
4465
  h.properties.distance = u.distance, h.properties.unit = u.unit;
4443
- const p = Mt(
4466
+ const p = Dt(
4444
4467
  h.properties.total,
4445
4468
  t,
4446
4469
  i
@@ -4458,25 +4481,25 @@ const Mt = (r, t = "kilometers", e = "auto") => {
4458
4481
  );
4459
4482
  }
4460
4483
  ), r;
4461
- }, ve = (r) => r.charAt(0).toUpperCase() + r.slice(1), et = [
4484
+ }, Ce = (r) => r.charAt(0).toUpperCase() + r.slice(1), et = [
4462
4485
  "{prefix}-point",
4463
4486
  "{prefix}-point-lower",
4464
4487
  "{prefix}-linestring",
4465
4488
  "{prefix}-polygon",
4466
4489
  "{prefix}-polygon-outline"
4467
- ], $o = [
4490
+ ], Yo = [
4468
4491
  ...et,
4469
4492
  lt.polygonLayerSpec?.source,
4470
4493
  lt.lineLayerLabelSpec?.source,
4471
4494
  lt.pointLayerLabelSpec?.source
4472
- ], Yo = [
4495
+ ], Ko = [
4473
4496
  ...et,
4474
4497
  z.routingLineLayerNodeLabelSpec?.source,
4475
4498
  z.routingLineLayerNodeSpec?.source,
4476
4499
  z.isochronePolygonLayerSpec?.source,
4477
4500
  z.isochroneLineLayerSpec?.source,
4478
4501
  z.isochroneLabelLayerSpec?.source
4479
- ], zt = (r, t, e = et, i = "td") => {
4502
+ ], Vt = (r, t, e = et, i = "td") => {
4480
4503
  e = e.map((s) => s.replace("{prefix}", i));
4481
4504
  const o = JSON.parse(JSON.stringify(r));
4482
4505
  return t && (t.onlyTerraDrawLayers === !0 ? (o.layers = o.layers.filter((s) => "source" in s && e.includes(s.source)), Object.keys(o.sources).forEach((s) => {
@@ -4484,13 +4507,13 @@ const Mt = (r, t = "kilometers", e = "auto") => {
4484
4507
  })) : t.excludeTerraDrawLayers === !0 && (o.layers = o.layers.filter((s) => "source" in s && !e.includes(s.source) || s.type === "background"), Object.keys(o.sources).forEach((s) => {
4485
4508
  e.includes(s) && delete o.sources[s];
4486
4509
  }))), o;
4487
- }, Ue = (r, t = 250) => {
4510
+ }, ze = (r, t = 250) => {
4488
4511
  let e;
4489
4512
  return (...i) => {
4490
4513
  clearTimeout(e), e = setTimeout(() => r(...i), t);
4491
4514
  };
4492
4515
  };
4493
- class ze {
4516
+ class Ve {
4494
4517
  cache = /* @__PURE__ */ new Map();
4495
4518
  maxSize;
4496
4519
  ttl;
@@ -4568,7 +4591,7 @@ class ze {
4568
4591
  };
4569
4592
  }
4570
4593
  }
4571
- class fo {
4594
+ class mo {
4572
4595
  className;
4573
4596
  dialog;
4574
4597
  title;
@@ -4657,7 +4680,7 @@ class fo {
4657
4680
  }), o;
4658
4681
  }
4659
4682
  }
4660
- const Ce = (r, t, e, i) => {
4683
+ const Pe = (r, t, e, i) => {
4661
4684
  if (r.geometry.type !== "Point") return r;
4662
4685
  const o = r.geometry.coordinates;
4663
4686
  if (e === !0 && i === void 0) {
@@ -4666,58 +4689,58 @@ const Ce = (r, t, e, i) => {
4666
4689
  }
4667
4690
  return r;
4668
4691
  };
4669
- var mo = Object.defineProperty, vo = (r, t, e) => t in r ? mo(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, rt = (r, t, e) => vo(r, typeof t != "symbol" ? t + "" : t, e), It = 2 * Math.PI * 6378137 / 2;
4670
- function Co(r) {
4692
+ var vo = Object.defineProperty, Co = (r, t, e) => t in r ? vo(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, rt = (r, t, e) => Co(r, typeof t != "symbol" ? t + "" : t, e), xt = 2 * Math.PI * 6378137 / 2;
4693
+ function Po(r) {
4671
4694
  return r = r || 256, 2 * Math.PI * 6378137 / r;
4672
4695
  }
4673
- function Po(r, t, e = { enable: !0, decimal: 1 }) {
4674
- r = Vt(r);
4675
- var i = r[0], o = r[1], s = i * It / 180, n = Math.log(Math.tan((90 + o) * Math.PI / 360)) / (Math.PI / 180);
4676
- return n = n * It / 180, e.enable && (s = Number(s.toFixed(e.decimal)), n = Number(n.toFixed(e.decimal))), [s, n];
4696
+ function So(r, t, e = { enable: !0, decimal: 1 }) {
4697
+ r = $t(r);
4698
+ var i = r[0], o = r[1], s = i * xt / 180, n = Math.log(Math.tan((90 + o) * Math.PI / 360)) / (Math.PI / 180);
4699
+ return n = n * xt / 180, e.enable && (s = Number(s.toFixed(e.decimal)), n = Number(n.toFixed(e.decimal))), [s, n];
4677
4700
  }
4678
- function So(r, t, e) {
4679
- var i = r[0], o = r[1], s = wo(t, e), n = (i + It) / s, a = (o + It) / s;
4701
+ function Io(r, t, e) {
4702
+ var i = r[0], o = r[1], s = Lo(t, e), n = (i + xt) / s, a = (o + xt) / s;
4680
4703
  return [n, a, t];
4681
4704
  }
4682
- function Ve(r, t, e) {
4683
- r = Vt(r);
4684
- var i = Po(r), o = So(i, t);
4685
- return xo(o);
4705
+ function $e(r, t, e) {
4706
+ r = $t(r);
4707
+ var i = So(r), o = Io(i, t);
4708
+ return Oo(o);
4686
4709
  }
4687
- function Io(r, t, e) {
4688
- if (r = Vt(r), t === 0)
4710
+ function xo(r, t, e) {
4711
+ if (r = $t(r), t === 0)
4689
4712
  return [0, 0, 0];
4690
- var i = Ve(r, t);
4691
- return Oo(i);
4713
+ var i = $e(r, t);
4714
+ return bo(i);
4692
4715
  }
4693
- function xo(r, t, e) {
4716
+ function Oo(r, t, e) {
4694
4717
  t = t || 256;
4695
4718
  var i = r[0], o = r[1], s = r[2];
4696
4719
  if (s === 0) return [0, 0, 0];
4697
- $e(s);
4720
+ Ye(s);
4698
4721
  var n = Math.ceil(i / t) - 1, a = Math.ceil(o / t) - 1;
4699
4722
  return n < 0 && (n = 0), a < 0 && (a = 0), [n, a, s];
4700
4723
  }
4701
- function Oo(r, t) {
4702
- bo(r);
4724
+ function bo(r, t) {
4725
+ Eo(r);
4703
4726
  var e = r[0], i = r[1], o = r[2];
4704
4727
  if (o === 0)
4705
4728
  return [0, 0, 0];
4706
4729
  var s = e, n = Math.pow(2, o) - 1 - i;
4707
4730
  return [s, n, o];
4708
4731
  }
4709
- function bo(r, t) {
4732
+ function Eo(r, t) {
4710
4733
  var e = r[0], i = r[1], o = r[2];
4711
4734
  if (o == null) throw new Error("<zoom> is required");
4712
4735
  if (e == null) throw new Error("<x> is required");
4713
4736
  if (i == null) throw new Error("<y> is required");
4714
- return o = $e(o), r = Eo(r), r;
4737
+ return o = Ye(o), r = wo(r), r;
4715
4738
  }
4716
- function Eo(r) {
4739
+ function wo(r) {
4717
4740
  var t = r[0], e = r[1], i = r[2], o = Math.pow(2, i);
4718
4741
  return t = t % o, t < 0 && (t = t + o), [t, e, i];
4719
4742
  }
4720
- function $e(r) {
4743
+ function Ye(r) {
4721
4744
  if (r === !1) return r;
4722
4745
  if (r == null)
4723
4746
  throw new Error("<zoom> is required");
@@ -4727,22 +4750,22 @@ function $e(r) {
4727
4750
  throw new Error("<zoom> cannot be greater than 32");
4728
4751
  return r;
4729
4752
  }
4730
- function Vt(r, t) {
4731
- var e = Fo(r[0]), i = Lo(r[1]);
4753
+ function $t(r, t) {
4754
+ var e = Mo(r[0]), i = Fo(r[1]);
4732
4755
  return i > 85 && (i = 85), i < -85 && (i = -85), [e, i];
4733
4756
  }
4734
- function wo(r, t) {
4735
- return Co(t) / Math.pow(2, r);
4757
+ function Lo(r, t) {
4758
+ return Po(t) / Math.pow(2, r);
4736
4759
  }
4737
- function Lo(r) {
4760
+ function Fo(r) {
4738
4761
  if (r == null) throw new Error("lat is required");
4739
4762
  return (r > 90 || r < -90) && (r = r % 180, r > 90 && (r = -180 + r), r < -90 && (r = 180 + r), r === 0 && (r = 0)), r;
4740
4763
  }
4741
- function Fo(r) {
4764
+ function Mo(r) {
4742
4765
  if (r == null) throw new Error("lng is required");
4743
4766
  return (r > 180 || r < -180) && (r = r % 360, r > 180 && (r = -360 + r), r < -180 && (r = 360 + r), r === 0 && (r = 0)), r;
4744
4767
  }
4745
- class Ye {
4768
+ class Ke {
4746
4769
  /**
4747
4770
  * Constructor
4748
4771
  * @param url URL for terrain RGB raster tilesets
@@ -4767,7 +4790,7 @@ class Ye {
4767
4790
  const s = t[0], n = t[1];
4768
4791
  let a = e;
4769
4792
  e > this.maxzoom ? a = this.maxzoom : e < this.minzoom && (a = this.minzoom);
4770
- const l = this.tms ? Ve([s, n], a) : Io([s, n], a), d = this.url.replace(/{x}/g, l[0].toString()).replace(/{y}/g, l[1].toString()).replace(/{z}/g, l[2].toString());
4793
+ const l = this.tms ? $e([s, n], a) : xo([s, n], a), d = this.url.replace(/{x}/g, l[0].toString()).replace(/{y}/g, l[1].toString()).replace(/{z}/g, l[2].toString());
4771
4794
  let c = this.getUrlExtension(d);
4772
4795
  switch (c || (c = "png"), c) {
4773
4796
  case "png":
@@ -4869,7 +4892,7 @@ class Ye {
4869
4892
  return i * Math.atan(0.5 * (Math.exp(o) - Math.exp(-o)));
4870
4893
  }
4871
4894
  }
4872
- class Mo extends Ye {
4895
+ class Do extends Ke {
4873
4896
  /**
4874
4897
  * Constructor
4875
4898
  * @param url URL for terrain RGB raster tilesets
@@ -4901,7 +4924,7 @@ class Mo extends Ye {
4901
4924
  return -1e4 + (t * 256 * 256 + e * 256 + i) * 0.1;
4902
4925
  }
4903
4926
  }
4904
- class Do extends Ye {
4927
+ class _o extends Ke {
4905
4928
  /**
4906
4929
  * Constructor
4907
4930
  * @param url URL for terrarium raster tilesets
@@ -4935,10 +4958,10 @@ class Do extends Ye {
4935
4958
  return parseInt(o.toFixed(0));
4936
4959
  }
4937
4960
  }
4938
- const _o = (r, t = 8) => {
4961
+ const ko = (r, t = 8) => {
4939
4962
  const [e, i] = r, o = Math.pow(10, t), s = Math.round(e * o) / o, n = Math.round(i * o) / o;
4940
4963
  return `${s},${n}`;
4941
- }, Pe = async (r, t, e, i) => {
4964
+ }, Se = async (r, t, e, i) => {
4942
4965
  const o = [], s = {
4943
4966
  enabled: !0,
4944
4967
  maxSize: 1e3,
@@ -4948,19 +4971,19 @@ const _o = (r, t = 8) => {
4948
4971
  ...e
4949
4972
  };
4950
4973
  let n;
4951
- s.enabled && (n = i || new ze(s.maxSize, s.ttl));
4974
+ s.enabled && (n = i || new Ve(s.maxSize, s.ttl));
4952
4975
  let a, l = 15;
4953
4976
  if (t) {
4954
4977
  const d = t.url, c = t.encoding ?? "mapbox", h = t.tileSize ?? 512, u = t.minzoom ?? 5;
4955
4978
  l = t.maxzoom ?? 15;
4956
4979
  const p = t.tms ?? !1;
4957
- a = c === "mapbox" ? new Mo(d, h, u, l, p) : new Do(d, h, u, l, p);
4980
+ a = c === "mapbox" ? new Do(d, h, u, l, p) : new _o(d, h, u, l, p);
4958
4981
  }
4959
4982
  for (const d of r)
4960
4983
  o.push(
4961
4984
  new Promise((c) => {
4962
4985
  d.geometry.type !== "Point" && c(d);
4963
- const h = d.geometry.coordinates, u = _o(h, s.precision);
4986
+ const h = d.geometry.coordinates, u = ko(h, s.precision);
4964
4987
  if (n) {
4965
4988
  const p = n.get(u);
4966
4989
  if (p !== void 0) {
@@ -4976,7 +4999,7 @@ const _o = (r, t = 8) => {
4976
4999
  })
4977
5000
  );
4978
5001
  return await Promise.all(o);
4979
- }, Ko = (r, t = 9) => {
5002
+ }, Xo = (r, t = 9) => {
4980
5003
  function e(o) {
4981
5004
  return [Number(o[0].toFixed(t)), Number(o[1].toFixed(t))];
4982
5005
  }
@@ -5010,11 +5033,11 @@ const _o = (r, t = 8) => {
5010
5033
  ...o,
5011
5034
  geometry: i(o.geometry)
5012
5035
  }));
5013
- }, ko = [
5036
+ }, No = [
5014
5037
  { value: "time", label: "Time" },
5015
5038
  { value: "distance", label: "Distance" }
5016
5039
  ];
5017
- class No {
5040
+ class To {
5018
5041
  url;
5019
5042
  /**
5020
5043
  * Constructor
@@ -5046,15 +5069,15 @@ class No {
5046
5069
  return await (await fetch(l)).json();
5047
5070
  }
5048
5071
  }
5049
- const Tt = [
5072
+ const Wt = [
5050
5073
  { value: "pedestrian", label: "Pedestrian" },
5051
5074
  { value: "bicycle", label: "Bicycle" },
5052
5075
  { value: "auto", label: "Car" }
5053
- ], To = [
5076
+ ], Wo = [
5054
5077
  { value: "kilometers", label: "km" },
5055
5078
  { value: "miles", label: "mile" }
5056
5079
  ];
5057
- class Wo {
5080
+ class Bo {
5058
5081
  tripData = [];
5059
5082
  /**
5060
5083
  * get the raw trip data from the valhalla routing API.
@@ -5133,7 +5156,7 @@ class Wo {
5133
5156
  maneuvers: f.maneuvers
5134
5157
  };
5135
5158
  });
5136
- const m = Tt.find((f) => f.value === e)?.label, v = this.geoLineString(h, {
5159
+ const m = Wt.find((f) => f.value === e)?.label, v = this.geoLineString(h, {
5137
5160
  costingModel: m,
5138
5161
  distance: u,
5139
5162
  distance_unit: i === "kilometers" ? "km" : "mi",
@@ -5208,7 +5231,7 @@ class Wo {
5208
5231
  return n;
5209
5232
  }
5210
5233
  }
5211
- class Ke {
5234
+ class Xe {
5212
5235
  controlContainer;
5213
5236
  map;
5214
5237
  modeButtons = {};
@@ -5247,7 +5270,7 @@ class Ke {
5247
5270
  i && i.length > 0 && (this.isExpanded ? i.item(0)?.classList.add("enabled") : (i.item(0)?.classList.remove("enabled"), this.resetActiveMode())), this.toggleDeleteSelectionButton(), this.toggleButtonsWhenNoFeature(), this.isExpanded ? this.dispatchEvent("expanded") : this.dispatchEvent("collapsed");
5248
5271
  }
5249
5272
  terradraw;
5250
- options = to;
5273
+ options = eo;
5251
5274
  events = {};
5252
5275
  defaultMode = "render";
5253
5276
  /**
@@ -5275,7 +5298,7 @@ class Ke {
5275
5298
  if (this.options && this.options.modes && this.options.modes.length === 0)
5276
5299
  throw new Error("At least a mode must be enabled.");
5277
5300
  this.map = t;
5278
- const e = eo(), i = [];
5301
+ const e = io(), i = [];
5279
5302
  return this.options?.modes?.forEach((o) => {
5280
5303
  if (this.options.modeOptions && this.options.modeOptions[o]) {
5281
5304
  const s = this.options.modeOptions[o];
@@ -5297,8 +5320,8 @@ class Ke {
5297
5320
  modeName: "default",
5298
5321
  styles: {}
5299
5322
  })
5300
- ), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new Zi({
5301
- adapter: new Qi({ map: t, ...this.options.adapterOptions }),
5323
+ ), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new Qi({
5324
+ adapter: new to({ map: t, ...this.options.adapterOptions }),
5302
5325
  modes: i
5303
5326
  }), this.map?.loaded() ? this.terradraw.start() : this.map?.once("load", () => {
5304
5327
  this.terradraw?.start();
@@ -5396,7 +5419,7 @@ class Ke {
5396
5419
  */
5397
5420
  addTerradrawButton(t) {
5398
5421
  const e = document.createElement("button");
5399
- e.type = "button", this.modeButtons[t] = e, t === "render" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), this.isExpanded && e.classList.add("enabled"), e.type = "button", e.title = ve("expand or collapse drawing tool"), e.addEventListener("click", this.toggleEditor.bind(this))) : (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}add-control`), this.isExpanded || e.classList.add("hidden"), e.title = ve(t.replace(/-/g, " ")), t === "delete" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), e.addEventListener("click", () => {
5422
+ e.type = "button", this.modeButtons[t] = e, t === "render" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), this.isExpanded && e.classList.add("enabled"), e.type = "button", e.title = Ce("expand or collapse drawing tool"), e.addEventListener("click", this.toggleEditor.bind(this))) : (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}add-control`), this.isExpanded || e.classList.add("hidden"), e.title = Ce(t.replace(/-/g, " ")), t === "delete" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), e.addEventListener("click", () => {
5400
5423
  this.terradraw && this.terradraw.enabled && (this.terradraw.clear(), this.deactivate(), this.toggleDeleteSelectionButton(), this.toggleButtonsWhenNoFeature(), this.dispatchEvent("feature-deleted"));
5401
5424
  })) : t === "delete-selection" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), e.classList.add("hidden-delete-selection"), e.addEventListener("click", () => {
5402
5425
  if (!this.terradraw || !this.terradraw.enabled) return;
@@ -5444,7 +5467,7 @@ class Ke {
5444
5467
  * @returns
5445
5468
  */
5446
5469
  cleanStyle(t, e) {
5447
- return zt(
5470
+ return Vt(
5448
5471
  t,
5449
5472
  e,
5450
5473
  et,
@@ -5511,16 +5534,16 @@ class Ke {
5511
5534
  }
5512
5535
  }
5513
5536
  }
5514
- function Bo(r, t = {}) {
5537
+ function jo(r, t = {}) {
5515
5538
  let e = 0, i = 0, o = 0;
5516
- return Ge(
5539
+ return Ue(
5517
5540
  r,
5518
5541
  function(s) {
5519
5542
  e += s[0], i += s[1], o++;
5520
5543
  }
5521
- ), so([e / o, i / o], t.properties);
5544
+ ), ro([e / o, i / o], t.properties);
5522
5545
  }
5523
- class Xo extends Ke {
5546
+ class Ho extends Xe {
5524
5547
  measureOptions;
5525
5548
  elevationCache;
5526
5549
  /**
@@ -5546,8 +5569,10 @@ class Xo extends Ke {
5546
5569
  this.measureOptions.distancePrecision = t, e || this.recalc();
5547
5570
  }
5548
5571
  /**
5549
- * Default is `auto`. If `auto` is set, unit is converted depending on the value in metric. If a specific unit is specified, it returns the value always the same.
5550
- * This property is only effective when distanceUnit is set to 'kilometers'. If distanceUnit is set to other than 'kilometers', it will be ignored, and `auto` will be applied.
5572
+ * Default is `auto`. If `auto` is set, the unit is converted automatically based on the value.
5573
+ * If a specific unit is specified (e.g., 'km', 'm', 'cm', 'mi', 'ft', 'in'), the value is always returned in that unit.
5574
+ * This property is only effective when `distanceUnit` is set to 'kilometers' or 'miles'.
5575
+ * If `distanceUnit` is set to other values (e.g., 'degrees', 'radians'), it will be ignored, and `auto` will be applied.
5551
5576
  * If you need to force other unit type, please use DistanceUnit property.
5552
5577
  */
5553
5578
  get forceDistanceUnit() {
@@ -5650,7 +5675,7 @@ class Xo extends Ke {
5650
5675
  open: e.open,
5651
5676
  modeOptions: e.modeOptions,
5652
5677
  adapterOptions: e.adapterOptions
5653
- }), this._cssPrefix = "measure-", this.measureOptions = e, this.measureOptions.elevationCacheConfig && this.measureOptions.elevationCacheConfig?.enabled && (this.elevationCache = new ze(
5678
+ }), this._cssPrefix = "measure-", this.measureOptions = e, this.measureOptions.elevationCacheConfig && this.measureOptions.elevationCacheConfig?.enabled && (this.elevationCache = new Ve(
5654
5679
  this.measureOptions.elevationCacheConfig.maxSize,
5655
5680
  this.measureOptions.elevationCacheConfig.ttl
5656
5681
  ));
@@ -5721,7 +5746,7 @@ class Xo extends Ke {
5721
5746
  const s = this.measureOptions.lineLayerLabelSpec?.source;
5722
5747
  s && i.push(s);
5723
5748
  const n = this.measureOptions.pointLayerLabelSpec?.source;
5724
- return n && i.push(n), zt(
5749
+ return n && i.push(n), Vt(
5725
5750
  t,
5726
5751
  e,
5727
5752
  i,
@@ -5804,7 +5829,7 @@ class Xo extends Ke {
5804
5829
  * Handle finish event of terradraw. It will be called after finishing adding a feature
5805
5830
  * @param id Feature ID
5806
5831
  */
5807
- handleTerradrawFeatureReady = Ue((t) => {
5832
+ handleTerradrawFeatureReady = ze((t) => {
5808
5833
  this.map && (this.computeElevationByLineFeatureID(t), this.computeElevationByPointFeatureID(t));
5809
5834
  }, 300);
5810
5835
  /**
@@ -5903,7 +5928,7 @@ class Xo extends Ke {
5903
5928
  (o) => o.properties?.originalId === t && o.geometry.type === "Point"
5904
5929
  );
5905
5930
  if (i && i.length > 0) {
5906
- const o = await Pe(
5931
+ const o = await Se(
5907
5932
  i,
5908
5933
  this.measureOptions.terrainSource,
5909
5934
  this.measureOptions.elevationCacheConfig,
@@ -5930,7 +5955,7 @@ class Xo extends Ke {
5930
5955
  (o) => o.id === t && o.geometry.type === "Point" && o.properties?.mode === "point"
5931
5956
  );
5932
5957
  if (i && i.length > 0) {
5933
- const o = await Pe(
5958
+ const o = await Se(
5934
5959
  i,
5935
5960
  this.measureOptions.terrainSource,
5936
5961
  this.measureOptions.elevationCacheConfig,
@@ -5961,7 +5986,7 @@ class Xo extends Ke {
5961
5986
  (a) => a.properties?.originalId !== t
5962
5987
  ));
5963
5988
  const n = JSON.parse(JSON.stringify(o));
5964
- n.id = n.id + "-area-label", n.geometry = Bo(o.geometry).geometry, n.properties.originalId = o.id, o = ye(o, this.areaUnit, this.areaPrecision, this.forceAreaUnit), n.properties.area = o.properties.area, n.properties.unit = o.properties.unit, typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(n), this.map.getSource(
5989
+ n.id = n.id + "-area-label", n.geometry = jo(o.geometry).geometry, n.properties.originalId = o.id, o = fe(o, this.areaUnit, this.areaPrecision, this.forceAreaUnit), n.properties.area = o.properties.area, n.properties.unit = o.properties.unit, typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(n), this.map.getSource(
5965
5990
  this.measureOptions.polygonLayerSpec.source
5966
5991
  )?.setData(s.data), this.map.moveLayer(this.measureOptions.polygonLayerSpec.id), this.map.getLayer(this.measureOptions.lineLayerLabelSpec.id) && this.map.moveLayer(
5967
5992
  this.measureOptions.lineLayerLabelSpec.id
@@ -5991,7 +6016,7 @@ class Xo extends Ke {
5991
6016
  if (s) {
5992
6017
  typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter(
5993
6018
  (a) => a.properties?.originalId !== t
5994
- )), o = me(
6019
+ )), o = ve(
5995
6020
  o,
5996
6021
  this.distanceUnit,
5997
6022
  this.distancePrecision,
@@ -6039,7 +6064,7 @@ class Xo extends Ke {
6039
6064
  let o = e.getSnapshot()?.find((s) => s.id === t && s.geometry.type === "Point");
6040
6065
  if (o) {
6041
6066
  const s = this.map.getStyle().sources[this.measureOptions.pointLayerLabelSpec.source];
6042
- s && (typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter((n) => n.id !== t)), o = Ce(
6067
+ s && (typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter((n) => n.id !== t)), o = Pe(
6043
6068
  o,
6044
6069
  this.map,
6045
6070
  this.computeElevation,
@@ -6084,7 +6109,7 @@ class Xo extends Ke {
6084
6109
  const o = e.features[i];
6085
6110
  if (!this.map || !this.map.loaded()) continue;
6086
6111
  const s = o.geometry.type;
6087
- s === "LineString" ? e.features[i] = me(
6112
+ s === "LineString" ? e.features[i] = ve(
6088
6113
  o,
6089
6114
  this.distanceUnit,
6090
6115
  this.distancePrecision,
@@ -6092,7 +6117,7 @@ class Xo extends Ke {
6092
6117
  this.map,
6093
6118
  this.computeElevation,
6094
6119
  this.measureOptions.terrainSource
6095
- ) : s === "Polygon" ? e.features[i] = ye(o, this.areaUnit, this.areaPrecision, this.forceAreaUnit) : s === "Point" && (e.features[i] = Ce(
6120
+ ) : s === "Polygon" ? e.features[i] = fe(o, this.areaUnit, this.areaPrecision, this.forceAreaUnit) : s === "Point" && (e.features[i] = Pe(
6096
6121
  o,
6097
6122
  this.map,
6098
6123
  this.computeElevation,
@@ -6102,7 +6127,7 @@ class Xo extends Ke {
6102
6127
  return e;
6103
6128
  }
6104
6129
  }
6105
- class Ho extends Ke {
6130
+ class Jo extends Xe {
6106
6131
  controlOptions;
6107
6132
  valhallaOptions;
6108
6133
  _modalDialog;
@@ -6301,13 +6326,13 @@ class Ho extends Ke {
6301
6326
  const i = et, o = this.controlOptions.routingLineLayerNodeSpec?.source;
6302
6327
  o && i.push(o);
6303
6328
  const s = this.controlOptions.isochronePolygonLayerSpec?.source;
6304
- return s && i.push(s), zt(t, e, i, this.options.adapterOptions?.prefixId);
6329
+ return s && i.push(s), Vt(t, e, i, this.options.adapterOptions?.prefixId);
6305
6330
  }
6306
6331
  /**
6307
6332
  * Create the settings dialog for Valhalla control
6308
6333
  */
6309
6334
  createSettingsDialog() {
6310
- this.settingDialog = new fo(
6335
+ this.settingDialog = new mo(
6311
6336
  `maplibregl-terradraw-${this.cssPrefix}settings-dialog`,
6312
6337
  "Settings"
6313
6338
  ), this.settingDialog.create(
@@ -6349,7 +6374,7 @@ class Ho extends Ke {
6349
6374
  const i = document.createElement("label");
6350
6375
  i.textContent = "Means of Transport", i.classList.add("setting-label"), e.appendChild(i), e.appendChild(
6351
6376
  this.settingDialog.createSegmentButtons(
6352
- Tt,
6377
+ Wt,
6353
6378
  this.routingCostingModel,
6354
6379
  (n) => {
6355
6380
  this.valhallaOptions.routingOptions || (this.valhallaOptions.routingOptions = {}), this.valhallaOptions.routingOptions.costingModel = n, this.dispatchEvent("setting-changed");
@@ -6361,7 +6386,7 @@ class Ho extends Ke {
6361
6386
  const s = document.createElement("label");
6362
6387
  return s.textContent = "Distance Unit", s.classList.add("setting-label"), o.appendChild(s), o.appendChild(
6363
6388
  this.settingDialog.createSegmentButtons(
6364
- To,
6389
+ Wo,
6365
6390
  this.routingDistanceUnit,
6366
6391
  (n) => {
6367
6392
  this.valhallaOptions.routingOptions || (this.valhallaOptions.routingOptions = {}), this.valhallaOptions.routingOptions.distanceUnit = n, this.dispatchEvent("setting-changed");
@@ -6378,7 +6403,7 @@ class Ho extends Ke {
6378
6403
  const i = document.createElement("label");
6379
6404
  i.textContent = "Contour Type", i.classList.add("setting-label"), e.appendChild(i), e.appendChild(
6380
6405
  this.settingDialog.createSegmentButtons(
6381
- ko,
6406
+ No,
6382
6407
  this.controlOptions.valhallaOptions?.isochroneOptions?.contourType || "time",
6383
6408
  (d) => {
6384
6409
  this.valhallaOptions.isochroneOptions || (this.valhallaOptions.isochroneOptions = {}), this.valhallaOptions.isochroneOptions.contourType = d, this.dispatchEvent("setting-changed");
@@ -6390,7 +6415,7 @@ class Ho extends Ke {
6390
6415
  const s = document.createElement("label");
6391
6416
  s.textContent = "Means of Transport", s.classList.add("setting-label"), o.appendChild(s), o.appendChild(
6392
6417
  this.settingDialog.createSegmentButtons(
6393
- Tt,
6418
+ Wt,
6394
6419
  this.controlOptions.valhallaOptions?.isochroneOptions?.costingModel || "auto",
6395
6420
  (d) => {
6396
6421
  this.valhallaOptions.isochroneOptions || (this.valhallaOptions.isochroneOptions = {}), this.valhallaOptions.isochroneOptions.costingModel = d, this.dispatchEvent("setting-changed");
@@ -6573,14 +6598,14 @@ class Ho extends Ke {
6573
6598
  * Handle finish event of terradraw. It will be called after finishing adding a feature
6574
6599
  * @param id Feature ID
6575
6600
  */
6576
- handleTerradrawFeatureReady = Ue((t) => {
6601
+ handleTerradrawFeatureReady = ze((t) => {
6577
6602
  this.map && (this.computeRouteByLineFeatureID(t), this.computeIsochroneByPointFeatureID(t));
6578
6603
  }, 300);
6579
6604
  computeIsochroneByPointFeatureID = async (t) => {
6580
6605
  if (!this.map || !this.valhallaOptions.url) return;
6581
6606
  const e = this.terradraw?.getSnapshotFeature(t);
6582
6607
  if (!e || e && e.geometry.type !== "Point") return;
6583
- const i = e.geometry.coordinates, n = (await new No(this.valhallaUrl).calcIsochrone(
6608
+ const i = e.geometry.coordinates, n = (await new To(this.valhallaUrl).calcIsochrone(
6584
6609
  i[0],
6585
6610
  i[1],
6586
6611
  this.isochroneContourType,
@@ -6614,9 +6639,9 @@ class Ho extends Ke {
6614
6639
  if (!this.map || !this.valhallaOptions.url) return;
6615
6640
  const e = this.terradraw?.getSnapshotFeature(t);
6616
6641
  if (!e || e && e.geometry.type !== "LineString") return;
6617
- const i = new Wo(this.valhallaUrl), o = e.geometry.coordinates.map((c) => {
6642
+ const i = new Bo(this.valhallaUrl), o = e.geometry.coordinates.map((c) => {
6618
6643
  const h = c;
6619
- return new Xe(h[0], h[1]);
6644
+ return new He(h[0], h[1]);
6620
6645
  });
6621
6646
  if (!o || o && o.length < 2) return;
6622
6647
  const s = await i.calcRoute(
@@ -6685,34 +6710,34 @@ class Ho extends Ke {
6685
6710
  }
6686
6711
  }
6687
6712
  export {
6688
- zo as AvailableModes,
6689
- Vo as AvailableValhallaModes,
6690
- Xo as MaplibreMeasureControl,
6691
- Ke as MaplibreTerradrawControl,
6692
- Ho as MaplibreValhallaControl,
6693
- ze as MemoryCache,
6694
- fo as ModalDialog,
6695
- $o as TERRADRAW_MEASURE_SOURCE_IDS,
6713
+ Vo as AvailableModes,
6714
+ $o as AvailableValhallaModes,
6715
+ Ho as MaplibreMeasureControl,
6716
+ Xe as MaplibreTerradrawControl,
6717
+ Jo as MaplibreValhallaControl,
6718
+ Ve as MemoryCache,
6719
+ mo as ModalDialog,
6720
+ Yo as TERRADRAW_MEASURE_SOURCE_IDS,
6696
6721
  et as TERRADRAW_SOURCE_IDS,
6697
- Yo as TERRADRAW_VALHALLA_SOURCE_IDS,
6698
- No as ValhallaIsochrone,
6699
- Wo as ValhallaRouting,
6700
- ye as calcArea,
6701
- me as calcDistance,
6702
- ve as capitalize,
6703
- zt as cleanMaplibreStyle,
6704
- ko as contourTypeOptions,
6705
- po as convertAreaUnit,
6706
- Mt as convertDistance,
6707
- Tt as costingModelOptions,
6708
- Ue as debounce,
6709
- to as defaultControlOptions,
6722
+ Ko as TERRADRAW_VALHALLA_SOURCE_IDS,
6723
+ To as ValhallaIsochrone,
6724
+ Bo as ValhallaRouting,
6725
+ fe as calcArea,
6726
+ ve as calcDistance,
6727
+ Ce as capitalize,
6728
+ Vt as cleanMaplibreStyle,
6729
+ No as contourTypeOptions,
6730
+ go as convertAreaUnit,
6731
+ Dt as convertDistance,
6732
+ Wt as costingModelOptions,
6733
+ ze as debounce,
6734
+ eo as defaultControlOptions,
6710
6735
  lt as defaultMeasureControlOptions,
6711
6736
  z as defaultValhallaControlOptions,
6712
- eo as getDefaultModeOptions,
6713
- Ce as queryElevationByPoint,
6714
- Pe as queryElevationFromRasterDEM,
6715
- Ko as roundFeatureCoordinates,
6716
- To as routingDistanceUnitOptions
6737
+ io as getDefaultModeOptions,
6738
+ Pe as queryElevationByPoint,
6739
+ Se as queryElevationFromRasterDEM,
6740
+ Xo as roundFeatureCoordinates,
6741
+ Wo as routingDistanceUnitOptions
6717
6742
  };
6718
6743
  //# sourceMappingURL=maplibre-gl-terradraw.es.js.map