@watergis/maplibre-gl-terradraw 1.7.5 → 1.8.0

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.
Files changed (30) hide show
  1. package/dist/maplibre-gl-terradraw.es.js +602 -546
  2. package/dist/maplibre-gl-terradraw.es.js.map +1 -1
  3. package/dist/maplibre-gl-terradraw.umd.js +3 -3
  4. package/dist/maplibre-gl-terradraw.umd.js.map +1 -1
  5. package/dist/types/constants/defaultMeasureControlOptions.d.ts.map +1 -1
  6. package/dist/types/constants/defaultMeasureUnitSymbols.d.ts +3 -0
  7. package/dist/types/constants/defaultMeasureUnitSymbols.d.ts.map +1 -0
  8. package/dist/types/constants/index.d.ts +1 -0
  9. package/dist/types/constants/index.d.ts.map +1 -1
  10. package/dist/types/controls/MaplibreMeasureControl.d.ts +5 -5
  11. package/dist/types/controls/MaplibreMeasureControl.d.ts.map +1 -1
  12. package/dist/types/helpers/calcArea.d.ts +2 -2
  13. package/dist/types/helpers/calcArea.d.ts.map +1 -1
  14. package/dist/types/helpers/calcDistance.d.ts +2 -2
  15. package/dist/types/helpers/calcDistance.d.ts.map +1 -1
  16. package/dist/types/helpers/convertAreaUnit.d.ts +2 -2
  17. package/dist/types/helpers/convertAreaUnit.d.ts.map +1 -1
  18. package/dist/types/helpers/convertDistance.d.ts +3 -3
  19. package/dist/types/helpers/convertDistance.d.ts.map +1 -1
  20. package/dist/types/interfaces/MeasureControlOptions.d.ts +4 -4
  21. package/dist/types/interfaces/MeasureControlOptions.d.ts.map +1 -1
  22. package/dist/types/interfaces/MeasureUnit.d.ts +9 -0
  23. package/dist/types/interfaces/MeasureUnit.d.ts.map +1 -0
  24. package/dist/types/interfaces/index.d.ts +1 -2
  25. package/dist/types/interfaces/index.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/dist/types/interfaces/AreaUnit.d.ts +0 -5
  28. package/dist/types/interfaces/AreaUnit.d.ts.map +0 -1
  29. package/dist/types/interfaces/DistanceUnit.d.ts +0 -5
  30. package/dist/types/interfaces/DistanceUnit.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { LngLat as Xe } from "maplibre-gl";
1
+ import { LngLat as Je } 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++) {
@@ -8,28 +8,28 @@ function x() {
8
8
  return r;
9
9
  }, x.apply(null, arguments);
10
10
  }
11
- var b;
11
+ var E;
12
12
  (function(r) {
13
13
  r.Commit = "commit", r.Provisional = "provisional", r.Finish = "finish";
14
- })(b || (b = {}));
14
+ })(E || (E = {}));
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 wt(r) {
17
17
  return !!(r && typeof r == "object" && r !== null && !Array.isArray(r));
18
18
  }
19
- function qt(r) {
19
+ function Qt(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 te(r) {
23
23
  return !!(function(t) {
24
24
  return typeof t == "number" && !isNaN(new Date(t).valueOf());
25
25
  })(r);
26
26
  }
27
27
  const He = "Feature mode property does not match the mode being added to";
28
- var H;
28
+ var q;
29
29
  (function(r) {
30
30
  r.Drawing = "drawing", r.Select = "select", r.Static = "static", r.Render = "render";
31
- })(H || (H = {}));
32
- const Je = { rightClick: !0, contextMenu: !1, leftClick: !0, onDragStart: !0, onDrag: !0, onDragEnd: !0 };
31
+ })(q || (q = {}));
32
+ const Ze = { 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 = Ze, 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 = q.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 (wt(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 (wt(i.geometry)) if (wt(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";
@@ -95,7 +95,7 @@ class A {
95
95
  return s ? { valid: !1, reason: s } : { valid: !0 };
96
96
  })(t, this.store.idStrategy.isValidId);
97
97
  if (this.validate) {
98
- const i = this.validate(t, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional });
98
+ const i = this.validate(t, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional });
99
99
  return { valid: e.valid && i.valid, reason: i.reason };
100
100
  }
101
101
  return { valid: e.valid, reason: e.reason };
@@ -134,20 +134,20 @@ 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 Qe = class extends A {
138
138
  constructor(...t) {
139
- super(...t), this.type = H.Select;
139
+ super(...t), this.type = q.Select;
140
140
  }
141
141
  };
142
142
  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 xe = 63710088e-1;
147
147
  function D(r) {
148
148
  return r % 360 * Math.PI / 180;
149
149
  }
150
- function Ie(r) {
150
+ function Oe(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 ee = 57.29577951308232, ie = 0.017453292519943295, St = 6378137, O = (r, t) => ({ x: r === 0 ? 0 : r * ie * St, y: t === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + t * ie / 2)) * St }), R = (r, t) => ({ lng: r === 0 ? 0 : ee * (r / St), lat: t === 0 ? 0 : (2 * Math.atan(Math.exp(t / St)) - Math.PI / 2) * ee });
161
+ function ti(r, t, e) {
162
+ const i = D(r[0]), o = D(r[1]), s = D(e), n = Oe(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 oe(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 = ti(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 jt(r) {
174
174
  let t;
175
175
  if (r.geometry.type === "Polygon") t = r.geometry.coordinates;
176
176
  else {
@@ -186,8 +186,8 @@ function Wt(r) {
186
186
  function o(s, n, a, l) {
187
187
  const d = t[s][n], c = t[s][n + 1], h = t[a][l], u = t[a][l + 1], p = (function(m, v, C, f) {
188
188
  if (gt(m, C) || gt(m, f) || gt(v, C) || gt(f, C)) return null;
189
- const P = m[0], I = m[1], E = v[0], L = v[1], M = C[0], N = C[1], _ = f[0], T = f[1], $ = (P - E) * (N - T) - (I - L) * (M - _);
190
- return $ === 0 ? null : [((P * L - I * E) * (M - _) - (P - E) * (M * T - N * _)) / $, ((P * L - I * E) * (N - T) - (I - L) * (M * T - N * _)) / $];
189
+ const P = m[0], I = m[1], b = v[0], L = v[1], M = C[0], N = C[1], _ = f[0], T = f[1], $ = (P - b) * (N - T) - (I - L) * (M - _);
190
+ return $ === 0 ? null : [((P * L - I * b) * (M - _) - (P - b) * (M * T - N * _)) / $, ((P * L - I * b) * (N - T) - (I - L) * (M * T - N * _)) / $];
191
191
  })(d, c, h, u);
192
192
  if (p === null) return;
193
193
  let g, y;
@@ -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 se(r[0]) <= t && se(r[1]) <= t;
202
202
  }
203
- function Bt(r) {
203
+ function At(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 se(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 ei = "Feature has holes", ii = "Feature has less than 4 coordinates", oi = "Feature has invalid coordinates", si = "Feature coordinates are not closed";
213
+ function Et(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: ei };
216
+ if (r.geometry.coordinates[0].length < 4) return { valid: !1, reason: ii };
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 (!At(r.geometry.coordinates[0][o])) return { valid: !1, reason: oi };
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: si } : { 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 = Et(r, t);
226
+ return e.valid ? jt(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 ri = { cancel: "Escape", finish: "Enter" }, ni = { start: "crosshair" };
229
+ let Ee = 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 = ri, this.cursors = ni, 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);
@@ -239,7 +239,7 @@ let xe = class extends A {
239
239
  const t = this.currentCircleId;
240
240
  if (this.validate && t) {
241
241
  const e = this.store.getGeometryCopy(t);
242
- if (!this.validate({ type: "Feature", id: t, geometry: e, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish }).valid) return;
242
+ if (!this.validate({ type: "Feature", id: t, geometry: e, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
243
243
  }
244
244
  this.cursorMovedAfterInitialCursorDown = !1, this.center = void 0, this.currentCircleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted(), this.onFinish(t, { mode: this.mode, action: "draw" });
245
245
  }
@@ -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 = oe({ 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
  }
@@ -299,16 +299,16 @@ let xe = class extends A {
299
299
  i = (function(s) {
300
300
  const { center: n, radiusKilometers: a, coordinatePrecision: l } = s, d = s.steps ? s.steps : 64, c = 1e3 * a, [h, u] = n, { x: p, y: g } = O(h, u), y = [];
301
301
  for (let m = 0; m < d; m++) {
302
- const v = 360 * m / d * Math.PI / 180, C = c * Math.cos(v), f = c * Math.sin(v), [P, I] = [p + C, g + f], { lng: E, lat: L } = R(P, I);
303
- y.push([w(E, l), w(L, l)]);
302
+ const v = 360 * m / d * Math.PI / 180, C = c * Math.cos(v), f = c * Math.sin(v), [P, I] = [p + C, g + f], { lng: b, lat: L } = R(P, I);
303
+ y.push([w(b, l), w(L, l)]);
304
304
  }
305
305
  return y.push(y[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [y] }, properties: {} };
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 = oe({ center: this.center, radiusKilometers: e, coordinatePrecision: this.coordinatePrecision });
310
310
  }
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;
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: E.Provisional }).valid) return;
312
312
  this.store.updateGeometry([{ id: this.currentCircleId, geometry: i.geometry }]), this.store.updateProperty([{ id: this.currentCircleId, property: "radiusKilometers", value: e }]);
313
313
  }
314
314
  }
@@ -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 ai = { cancel: "Escape", finish: "Enter" }, li = { 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 = ai, this.cursors = li, 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));
@@ -348,7 +348,7 @@ class Oe extends A {
348
348
  const t = this.currentId;
349
349
  if (this.validate && t) {
350
350
  const e = this.store.getGeometryCopy(t);
351
- if (!this.validate({ type: "Feature", id: t, geometry: e, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish }).valid) return;
351
+ if (!this.validate({ type: "Feature", id: t, geometry: e, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
352
352
  }
353
353
  this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.hasLeftStartingPoint = !1, this.state === "drawing" && this.setStarted(), this.onFinish(t, { mode: this.mode, action: "draw" });
354
354
  }
@@ -369,7 +369,7 @@ class Oe extends A {
369
369
  if (l < this.minDistance) return;
370
370
  e.coordinates[0].pop();
371
371
  const p = { type: "Polygon", coordinates: [[...e.coordinates[0], [t.lng, t.lat], e.coordinates[0][0]]] };
372
- this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: p, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || this.store.updateGeometry([{ id: this.currentId, geometry: p }]);
372
+ this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: p, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || this.store.updateGeometry([{ id: this.currentId, geometry: p }]);
373
373
  }
374
374
  onClick(t) {
375
375
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) {
@@ -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) => Et(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 we({ 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 we({ 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 re(r, t, e) {
462
+ const i = D(r[0]), o = D(r[1]), s = D(e), n = Oe(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 ne(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 di(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 = ne(r[c], r[c - 1]) - 180, a = re(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 = ne(r[c], r[c - 1]) - 180, a = re(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 ae(r) {
502
502
  return r * (180 / Math.PI);
503
503
  }
504
- class li extends B {
504
+ class ci 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 = di(o, i * d, i * (d + 1));
518
518
  a.push(c);
519
519
  }
520
520
  const l = [];
@@ -530,8 +530,8 @@ class li extends B {
530
530
  for (let y = 0; y <= l; y++) {
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
- 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)]);
533
+ const b = Math.atan2(I, Math.sqrt(f ** 2 + P ** 2)), L = Math.atan2(P, f);
534
+ isNaN(b) || isNaN(L) || d.push([ae(L), ae(b)]);
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 Rt(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 (!At(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 le(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) / (le(r) * le(t));
564
564
  return Math.acos(Math.min(Math.max(e, -1), 1));
565
565
  }
566
- function Et(r) {
566
+ function Lt(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];
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);
574
+ function hi(r, t, e) {
575
+ const i = Lt(r), o = Lt(t), s = Lt(e), [n, a, l] = s, [d, c, h] = (function(T, $) {
576
+ const [Kt, Xt, qt] = T, [Jt, Ht, Zt] = $;
577
+ return [Xt * Zt - qt * Ht, qt * Jt - Kt * Zt, Kt * Ht - Xt * Jt];
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), b = Y(i, f), L = Y(o, f), M = Y(i, P), N = Y(o, P);
579
579
  let _;
580
- return _ = E < M && E < N || L < M && L < N ? f : 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];
580
+ return _ = b < M && b < 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 ui(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 Gt 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));
@@ -611,11 +611,11 @@ class At extends B {
611
611
  for (let v of p) {
612
612
  const C = v[0], f = v[1];
613
613
  let P, I = 1 / 0;
614
- const E = O(C[0], C[1]), L = O(f[0], f[1]), M = O(u[0], u[1]);
614
+ const b = O(C[0], C[1]), L = O(f[0], f[1]), M = O(u[0], u[1]);
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: _ } = ui(b, 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] = hi(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 pi = { cancel: "Escape", finish: "Enter" }, gi = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
639
+ class Ut 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 = pi, this.snapping = void 0, this.cursors = gi, 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);
@@ -658,7 +658,7 @@ class Rt extends A {
658
658
  close() {
659
659
  if (this.currentId === void 0) return;
660
660
  const t = this.store.getGeometryCopy(this.currentId);
661
- t.coordinates.pop(), this.updateGeometries([...t.coordinates], void 0, b.Commit), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
661
+ t.coordinates.pop(), this.updateGeometries([...t.coordinates], void 0, E.Commit), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
662
662
  const e = this.currentId;
663
663
  this.closingPointId && this.store.delete([this.closingPointId]), this.snappedPointId && this.store.delete([this.snappedPointId]), this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.snappedPointId = void 0, this.lastCommittedCoordinates = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
664
664
  }
@@ -685,7 +685,7 @@ class Rt extends A {
685
685
  const e = this.store.getGeometryCopy(this.currentId).coordinates, [i] = this.store.create([{ geometry: { type: "Point", coordinates: [...t] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
686
686
  this.closingPointId = i, this.setCursor(this.cursors.close);
687
687
  const o = [...e, t];
688
- this.updateGeometries(o, void 0, b.Commit), this.currentCoordinate++;
688
+ this.updateGeometries(o, void 0, E.Commit), this.currentCoordinate++;
689
689
  }
690
690
  updateToLine(t, e) {
691
691
  if (!this.currentId) return;
@@ -693,10 +693,10 @@ class Rt extends A {
693
693
  if (F({ x: n, y: a }, { x: e.x, y: e.y }) < this.pointerDistance) return void this.close();
694
694
  this.setCursor(this.cursors.close);
695
695
  const l = [...i, t];
696
- this.updateGeometries(l, i[i.length - 1], b.Commit), this.currentCoordinate++;
696
+ this.updateGeometries(l, i[i.length - 1], E.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 ci(t), this.clickBoundingBox = new dt(t), this.pixelDistance = new ct(t), this.lineSnapping = new Gt(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);
@@ -721,7 +721,7 @@ class Rt extends A {
721
721
  o = [...this.lastCommittedCoordinates.slice(0, -1), ...a, e];
722
722
  }
723
723
  }
724
- this.updateGeometries(o, void 0, b.Provisional);
724
+ this.updateGeometries(o, void 0, E.Provisional);
725
725
  }
726
726
  onRightClick(t) {
727
727
  if (!this.editable || this.state !== "started") return;
@@ -730,7 +730,7 @@ class Rt extends A {
730
730
  const o = this.store.getGeometryCopy(e);
731
731
  let s;
732
732
  if (o.type === "LineString" && (s = o.coordinates, !(s.length <= 2))) {
733
- if (s.splice(i, 1), this.validate && !this.validate({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Commit }).valid) return;
733
+ if (s.splice(i, 1), this.validate && !this.validate({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Commit }).valid) return;
734
734
  this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: e, geometry: o }]), this.onFinish(e, { mode: this.mode, action: "edit" });
735
735
  }
736
736
  }
@@ -769,7 +769,7 @@ class Rt extends A {
769
769
  const i = this.store.getGeometryCopy(this.editedFeatureId);
770
770
  this.editedSnapType === "coordinate" || this.editedSnapType === "line" && this.editedInsertIndex !== void 0 ? i.coordinates[this.editedFeatureCoordinateIndex] = [t.lng, t.lat] : this.editedSnapType === "line" && this.editedInsertIndex === void 0 && (this.editedInsertIndex = this.editedFeatureCoordinateIndex + 1, i.coordinates.splice(this.editedInsertIndex, 0, [t.lng, t.lat]), this.editedFeatureCoordinateIndex++);
771
771
  const o = { type: "LineString", coordinates: i.coordinates };
772
- this.validate && !this.validate({ type: "Feature", geometry: o, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: o }]), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
772
+ this.validate && !this.validate({ type: "Feature", geometry: o, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: o }]), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
773
773
  }
774
774
  onDragEnd(t, e) {
775
775
  this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, e(!0));
@@ -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) => Rt(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 yi = "Feature is not a Point", fi = "Feature has invalid coordinates", mi = "Feature has coordinates with excessive precision";
814
+ function Le(r, t) {
815
+ return r.geometry.type !== "Point" ? { valid: !1, reason: yi } : At(r.geometry.coordinates) ? Ot(r.geometry.coordinates, t) ? { valid: !0 } : { valid: !1, reason: mi } : { valid: !1, reason: fi };
816
816
  }
817
- const fi = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
818
- class Gt extends A {
817
+ const vi = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
818
+ class zt 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 = vi, 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);
@@ -850,7 +850,7 @@ class Gt extends A {
850
850
  }
851
851
  }
852
852
  onDrag(t, e) {
853
- this.allowPointerEvent(this.pointerEvents.onDrag, t) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }])));
853
+ this.allowPointerEvent(this.pointerEvents.onDrag, t) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }])));
854
854
  }
855
855
  onDragEnd(t, e) {
856
856
  this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.setCursor(this.cursors.dragEnd), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.editedFeatureId = void 0, e(!0));
@@ -867,11 +867,11 @@ 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) => Le(e, this.coordinatePrecision));
871
871
  }
872
872
  onLeftClick(t) {
873
873
  const e = { type: "Point", coordinates: [t.lng, t.lat] }, i = { mode: this.mode };
874
- if (this.validate && !this.validate({ type: "Feature", geometry: e, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish }).valid) return;
874
+ if (this.validate && !this.validate({ type: "Feature", geometry: e, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
875
875
  const [o] = this.store.create([{ geometry: e, properties: i }]);
876
876
  this.onFinish(o, { mode: this.mode, action: "draw" });
877
877
  }
@@ -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 Ci 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 Fe 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 Pi = { cancel: "Escape", finish: "Enter" }, Si = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
980
+ class Me 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 = Pi, this.cursors = Si, 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) {
@@ -995,7 +995,7 @@ class Le extends A {
995
995
  close() {
996
996
  if (this.currentId === void 0) return;
997
997
  const t = this.store.getGeometryCopy(this.currentId).coordinates[0];
998
- if (t.length < 5 || !this.updatePolygonGeometry([...t.slice(0, -2), t[0]], b.Finish)) return;
998
+ if (t.length < 5 || !this.updatePolygonGeometry([...t.slice(0, -2), t[0]], E.Finish)) return;
999
999
  const e = this.currentId;
1000
1000
  if (this.currentId) {
1001
1001
  const i = pt(this.store.getGeometryCopy(this.currentId));
@@ -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 Gt(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new It(t, this.pixelDistance, this.clickBoundingBox), this.closingPoints = new Ci(t, this.pixelDistance), this.coordinatePoints = new Fe(t);
1008
1008
  }
1009
1009
  start() {
1010
1010
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -1035,7 +1035,7 @@ class Le extends A {
1035
1035
  const { isClosing: o, isPreviousClosing: s } = this.closingPoints.isClosingPoint(t);
1036
1036
  s || o ? (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.setCursor(this.cursors.close), i = [...e.slice(0, -2), e[0], e[0]]) : i = [...e.slice(0, -2), [t.lng, t.lat], e[0]];
1037
1037
  }
1038
- this.store.updateProperty([{ id: this.currentId, property: S.PROVISIONAL_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.updatePolygonGeometry(i, b.Provisional);
1038
+ this.store.updateProperty([{ id: this.currentId, property: S.PROVISIONAL_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.updatePolygonGeometry(i, E.Provisional);
1039
1039
  }
1040
1040
  updatePolygonGeometry(t, e) {
1041
1041
  if (!this.currentId) return !1;
@@ -1064,7 +1064,7 @@ class Le extends A {
1064
1064
  if (!e || i === void 0) return;
1065
1065
  const o = this.store.getGeometryCopy(e);
1066
1066
  let s;
1067
- o.type === "Polygon" && (s = o.coordinates[0], s.length <= 4 || (o.type !== "Polygon" || i !== 0 && i !== s.length - 1 ? s.splice(i, 1) : (s.shift(), s.pop(), s.push([s[0][0], s[0][1]])), (!this.validate || this.validate({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Commit }).valid) && (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: e, geometry: o }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(e), this.onFinish(e, { mode: this.mode, action: "edit" }))));
1067
+ o.type === "Polygon" && (s = o.coordinates[0], s.length <= 4 || (o.type !== "Polygon" || i !== 0 && i !== s.length - 1 ? s.splice(i, 1) : (s.shift(), s.pop(), s.push([s[0][0], s[0][1]])), (!this.validate || this.validate({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Commit }).valid) && (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: e, geometry: o }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(e), this.onFinish(e, { mode: this.mode, action: "edit" }))));
1068
1068
  }
1069
1069
  onLeftClick(t) {
1070
1070
  if (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.currentCoordinate === 0) {
@@ -1076,13 +1076,13 @@ class Le extends A {
1076
1076
  const e = this.snapCoordinate(t);
1077
1077
  e && (t.lng = e[0], t.lat = e[1]);
1078
1078
  const i = this.store.getGeometryCopy(this.currentId);
1079
- if (tt([t.lng, t.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], i.coordinates[0][0]], b.Commit)) return;
1079
+ if (tt([t.lng, t.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], i.coordinates[0][0]], E.Commit)) return;
1080
1080
  this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1081
1081
  } else if (this.currentCoordinate === 2 && this.currentId) {
1082
1082
  const e = this.snapCoordinate(t);
1083
1083
  e && (t.lng = e[0], t.lat = e[1]);
1084
1084
  const i = this.store.getGeometryCopy(this.currentId).coordinates[0];
1085
- if (tt([t.lng, t.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [t.lng, t.lat], [t.lng, t.lat], i[0]], b.Commit)) return;
1085
+ if (tt([t.lng, t.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [t.lng, t.lat], [t.lng, t.lat], i[0]], E.Commit)) return;
1086
1086
  this.currentCoordinate === 2 && this.closingPoints.create(i, "polygon"), this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1087
1087
  } else if (this.currentId) {
1088
1088
  const e = this.store.getGeometryCopy(this.currentId).coordinates[0], { isClosing: i, isPreviousClosing: o } = this.closingPoints.isClosingPoint(t);
@@ -1093,7 +1093,7 @@ class Le extends A {
1093
1093
  const n = /* @__PURE__ */ (function(a = [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]) {
1094
1094
  return { type: "Feature", geometry: { type: "Polygon", coordinates: a }, properties: {} };
1095
1095
  })([[...e.slice(0, -1), [t.lng, t.lat], e[0]]]);
1096
- if (!this.updatePolygonGeometry(n.geometry.coordinates[0], b.Commit)) return;
1096
+ if (!this.updatePolygonGeometry(n.geometry.coordinates[0], E.Commit)) return;
1097
1097
  this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++, this.closingPoints.ids.length && this.closingPoints.update(n.geometry.coordinates[0]);
1098
1098
  }
1099
1099
  }
@@ -1128,7 +1128,7 @@ class Le extends A {
1128
1128
  const i = this.store.getGeometryCopy(this.editedFeatureId), o = i.coordinates[0];
1129
1129
  this.editedSnapType === "coordinate" || this.editedSnapType === "line" && this.editedInsertIndex !== void 0 ? this.editedFeatureCoordinateIndex === 0 || this.editedFeatureCoordinateIndex === i.coordinates[0].length - 1 ? (o[0] = [t.lng, t.lat], o[o.length - 1] = [t.lng, t.lat]) : o[this.editedFeatureCoordinateIndex] = [t.lng, t.lat] : this.editedSnapType === "line" && this.editedInsertIndex === void 0 && (this.editedInsertIndex = this.editedFeatureCoordinateIndex + 1, i.coordinates[0].splice(this.editedInsertIndex, 0, [t.lng, t.lat]), this.editedFeatureCoordinateIndex++);
1130
1130
  const s = { type: "Polygon", coordinates: i.coordinates };
1131
- this.validate && !this.validate({ type: "Feature", geometry: s, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: s }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.editedFeatureId), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
1131
+ this.validate && !this.validate({ type: "Feature", geometry: s, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: s }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.editedFeatureId), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
1132
1132
  }
1133
1133
  onDragEnd(t, e) {
1134
1134
  this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, e(!0));
@@ -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) => Et(e, this.coordinatePrecision));
1165
1165
  }
1166
1166
  }
1167
- const Pi = { cancel: "Escape", finish: "Enter" }, Si = { start: "crosshair" };
1168
- class Fe extends A {
1167
+ const Ii = { cancel: "Escape", finish: "Enter" }, xi = { start: "crosshair" };
1168
+ class De 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 = Ii, this.cursors = xi, 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));
@@ -1198,10 +1198,10 @@ class Fe extends A {
1198
1198
  this.center = [t.lng, t.lat];
1199
1199
  const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
1200
1200
  this.currentRectangleId = e, this.clickCount++, this.setDrawing();
1201
- } else this.updateRectangle(t, b.Finish), this.close();
1201
+ } else this.updateRectangle(t, E.Finish), this.close();
1202
1202
  }
1203
1203
  onMouseMove(t) {
1204
- this.updateRectangle(t, b.Provisional);
1204
+ this.updateRectangle(t, E.Provisional);
1205
1205
  }
1206
1206
  onKeyDown() {
1207
1207
  }
@@ -1232,7 +1232,7 @@ class Fe extends A {
1232
1232
  class Q extends A {
1233
1233
  constructor(t) {
1234
1234
  if (!t.modeName) throw new Error("Mode name is required for TerraDrawRenderMode");
1235
- super(t, !0), this.type = H.Render, this.mode = "render", this.updateOptions(t);
1235
+ super(t, !0), this.type = q.Render, this.mode = "render", this.updateOptions(t);
1236
1236
  }
1237
1237
  updateOptions(t) {
1238
1238
  super.updateOptions(t), t != null && t.modeName && (this.mode = t.modeName);
@@ -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 = Le(i, this.coordinatePrecision).valid || Et(i, this.coordinatePrecision).valid || Rt(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 kt(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 _e(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 / xe, 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 ke(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 Oi(r, t, e) {
1298
+ const i = _e(r, 1e3 * U(r, t) / 2, kt(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 de({ 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 = ke(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 = Oi(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 Ei 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 de({ 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 de({ 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 Ne(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 Nt = (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 wi 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 = Nt({ 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
+ Ne([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 Li 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
  }
@@ -1446,12 +1446,12 @@ class Ei extends B {
1446
1446
  }
1447
1447
  i.type === "Polygon" && (s[s.length - 1] = [s[0][0], s[0][1]]);
1448
1448
  const a = this.selectionPoints.getUpdated(s) || [], l = this.midPoints.getUpdated(s) || [], d = this.coordinatePoints.getUpdated(this.draggedFeatureId, s) || [];
1449
- if (e && !e({ type: "Feature", id: this.draggedFeatureId, geometry: i, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional }).valid) return !1;
1449
+ if (e && !e({ type: "Feature", id: this.draggedFeatureId, geometry: i, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional }).valid) return !1;
1450
1450
  this.store.updateGeometry([{ id: this.draggedFeatureId, geometry: i }, ...a, ...l, ...d]), this.dragPosition = [t.lng, t.lat];
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 Fi 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 && jt({ geometry: a }) || i && !i(h, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.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 ce(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 Te = (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 Tt(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 Mi 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 = Tt(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
+ Te(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 = ce({ geometry: o })), n = kt(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 = ce(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 = kt(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 = xe, b = P[1] * Math.PI / 180, L = f[1] * Math.PI / 180, M = L - b;
1584
1584
  let N = Math.abs(f[0] - P[0]) * Math.PI / 180;
1585
1585
  N > Math.PI && (N -= 2 * Math.PI);
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);
1586
+ const _ = Math.log(Math.tan(L / 2 + Math.PI / 4) / Math.tan(b / 2 + Math.PI / 4)), T = Math.abs(_) > 1e-11 ? M / _ : Math.cos(b);
1587
1587
  return Math.sqrt(M * M + T * T * N * N) * I;
1588
- })(g, y), C = Me(g, v, m);
1588
+ })(g, y), C = _e(g, v, m);
1589
1589
  y[0] = C[0], y[1] = C[1];
1590
1590
  });
1591
1591
  })(a, -(this.lastBearing - (n + 180)));
@@ -1595,11 +1595,11 @@ class Li extends B {
1595
1595
  u[0] = w(u[0], this.coordinatePrecision), u[1] = w(u[1], this.coordinatePrecision);
1596
1596
  });
1597
1597
  const d = this.midPoints.getUpdated(l) || [], c = this.selectionPoints.getUpdated(l) || [], h = this.coordinatePoints.getUpdated(e, l) || [];
1598
- if (i && !i({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional })) return !1;
1598
+ if (i && !i({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional })) return !1;
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 Di 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 We({ 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 _i 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 = Tt(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 = Tt(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), We({ 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
- 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));
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: E.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 ki = { deselect: "Escape", delete: "Delete", rotate: ["Control", "r"], scale: ["Control", "s"] }, he = { pointerOver: "move", dragStart: "move", dragEnd: "move", insertMidpoint: "crosshair" };
1786
+ class Vt extends Qe {
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 = ki, this.cursors = he, 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) : he, 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 wi(t, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new bi(t), this.coordinatePoints = new Fe(t), this.midPoints = new Ei(t, this.selectionPoints, this.coordinatePoints), this.coordinateSnap = new It(t, this.pixelDistance, this.clickBoundingBox), this.lineSnap = new Gt(t, this.pixelDistance, this.clickBoundingBox), this.rotateFeature = new Mi(t, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragFeature = new Li(t, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragCoordinate = new Fi(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints, this.coordinateSnap, this.lineSnap), this.dragCoordinateResizeFeature = new _i(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints), this.scaleFeature = new Di(t, this.dragCoordinateResizeFeature);
1808
1808
  }
1809
1809
  deselectFeature() {
1810
1810
  this.deselect();
@@ -1830,7 +1830,7 @@ class Ut extends qe {
1830
1830
  if (d.type === "Polygon") {
1831
1831
  if (c = d.coordinates[0], c.length <= 4) return;
1832
1832
  } else if (d.type === "LineString" && (c = d.coordinates, c.length <= 2)) return;
1833
- if (!c || (d.type !== "Polygon" || s !== 0 && s !== c.length - 1 ? c.splice(s, 1) : (c.shift(), c.pop(), c.push([c[0][0], c[0][1]])), l && !l({ id: o, type: "Feature", geometry: d, properties: n }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Commit }).valid)) return;
1833
+ if (!c || (d.type !== "Polygon" || s !== 0 && s !== c.length - 1 ? c.splice(s, 1) : (c.shift(), c.pop(), c.push([c[0][0], c[0][1]])), l && !l({ id: o, type: "Feature", geometry: d, properties: n }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Commit }).valid)) return;
1834
1834
  const h = [...this.midPoints.ids, ...this.selectionPoints.ids];
1835
1835
  this.store.delete(h), this.store.updateGeometry([{ id: o, geometry: d }]), n.coordinatePointIds && this.coordinatePoints.createOrUpdate(o), this.selectionPoints.create(c, d.type, o), a && a.feature && a.feature.coordinates && a.feature.coordinates.midpoints && this.midPoints.create(c, o, this.coordinatePrecision);
1836
1836
  }
@@ -1973,9 +1973,9 @@ class Ut extends qe {
1973
1973
  }
1974
1974
  }
1975
1975
  }
1976
- class _i extends A {
1976
+ class Ni extends A {
1977
1977
  constructor(...t) {
1978
- super(...t), this.type = H.Static, this.mode = "static";
1978
+ super(...t), this.type = q.Static, this.mode = "static";
1979
1979
  }
1980
1980
  start() {
1981
1981
  }
@@ -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 Be(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
+ Be(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 Ti(r, t) {
2038
2038
  return r.minX - t.minX;
2039
2039
  }
2040
- function Ni(r, t) {
2040
+ function Wi(r, t) {
2041
2041
  return r.minY - t.minY;
2042
2042
  }
2043
- function wt(r) {
2043
+ function Ft(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 Bi(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 Mt(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 ue(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
+ Be(r, n, t, e, o), s.push(t, n, n, e);
2068
2068
  }
2069
2069
  }
2070
- class Wi {
2070
+ class ji {
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) : Mt(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 || Mt(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 || !Mt(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
+ ue(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
+ ue(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 = Ft(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 = Bi(l, d), h = Ft(l) + Ft(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 : Ti, s = t.leaf ? this.compareMinY : Wi;
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 Ai {
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 ji(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 Ri = { 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 Gi {
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 Ai(), this.tracked = !t || t.tracked !== !1, this.idStrategy = t && t.idStrategy ? t.idStrategy : Ri;
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 (!te(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 (!te(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 Ui = "Feature is not a Polygon or LineString", zi = "Feature intersects itself", Vi = (r) => r.geometry.type !== "Polygon" && r.geometry.type !== "LineString" ? { valid: !1, reason: Ui } : jt(r) ? { valid: !1, reason: zi } : { valid: !0 };
2394
+ function pe(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 $i = { cancel: "Escape", finish: "Enter" }, Yi = { start: "crosshair", close: "pointer" };
2400
+ class je 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 = $i, this.cursors = Yi, 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,13 +2424,13 @@ 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) {
2428
- const M = (L.x - E.x) * (I.y - E.y) - (L.y - E.y) * (I.x - E.x);
2427
+ const o = e[0], s = e[1], n = ke(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 = pe(a, l, c), p = h ? 90 - u : pe(a, l, c) - 90, g = F(l, c), y = Math.cos(D(p)) * g, m = G(a, d) + ((function(I, b, L) {
2428
+ const M = (L.x - b.x) * (I.y - b.y) - (L.y - b.y) * (I.x - b.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);
2431
2431
  i = [e[0], e[1], [P.lng, P.lat], [f.lng, f.lat], e[0]];
2432
2432
  }
2433
- i && this.updatePolygonGeometry(this.currentId, i, b.Provisional);
2433
+ i && this.updatePolygonGeometry(this.currentId, i, E.Provisional);
2434
2434
  }
2435
2435
  updatePolygonGeometry(t, e, i) {
2436
2436
  const o = { type: "Polygon", coordinates: [e] };
@@ -2442,7 +2442,7 @@ class We extends A {
2442
2442
  this.currentId = e, this.currentCoordinate++, this.setDrawing();
2443
2443
  } else if (this.currentCoordinate === 1 && this.currentId) {
2444
2444
  const e = this.store.getGeometryCopy(this.currentId);
2445
- if (tt([t.lng, t.lat], e.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [e.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], e.coordinates[0][0]], b.Commit)) return;
2445
+ if (tt([t.lng, t.lat], e.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [e.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], e.coordinates[0][0]], E.Commit)) return;
2446
2446
  this.currentCoordinate++;
2447
2447
  } else this.currentCoordinate === 2 && this.currentId && this.close();
2448
2448
  }
@@ -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 Ae(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 Ki = { cancel: "Escape", finish: "Enter" }, Xi = { start: "crosshair", close: "pointer" };
2486
+ class Re 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 = Ki, this.direction = void 0, this.arcPoints = 64, this.cursors = Xi, 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 = Ae(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);
@@ -2522,12 +2522,12 @@ class je extends A {
2522
2522
  const C = (this.direction === "anticlockwise" ? 1 : -1) * v / p;
2523
2523
  g.push(s);
2524
2524
  for (let f = 0; f <= p; f++) {
2525
- const P = ht(a, c, y + f * C), { lng: I, lat: E } = R(P.x, P.y), L = [w(I, this.coordinatePrecision), w(E, this.coordinatePrecision)];
2525
+ const P = ht(a, c, y + f * C), { lng: I, lat: b } = R(P.x, P.y), L = [w(I, this.coordinatePrecision), w(b, this.coordinatePrecision)];
2526
2526
  L[0] !== g[g.length - 1][0] && L[1] !== g[g.length - 1][1] && g.push(L);
2527
2527
  }
2528
2528
  g.push(o), i = [...g];
2529
2529
  }
2530
- i && this.updatePolygonGeometry(this.currentId, i, b.Provisional);
2530
+ i && this.updatePolygonGeometry(this.currentId, i, E.Provisional);
2531
2531
  }
2532
2532
  updatePolygonGeometry(t, e, i) {
2533
2533
  const o = { type: "Polygon", coordinates: [e] };
@@ -2539,7 +2539,7 @@ class je extends A {
2539
2539
  this.currentId = e, this.currentCoordinate++, this.setDrawing();
2540
2540
  } else if (this.currentCoordinate === 1 && this.currentId) {
2541
2541
  const e = this.store.getGeometryCopy(this.currentId);
2542
- if (tt([t.lng, t.lat], e.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [e.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], e.coordinates[0][0]], b.Commit)) return;
2542
+ if (tt([t.lng, t.lat], e.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [e.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], e.coordinates[0][0]], E.Commit)) return;
2543
2543
  this.currentCoordinate++;
2544
2544
  } else this.currentCoordinate === 2 && this.currentId && this.close();
2545
2545
  }
@@ -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 qi = { cancel: "Escape", finish: "Enter" }, Ji = { start: "crosshair", close: "pointer" };
2576
+ class Ge 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 = qi, this.direction = void 0, this.arcPoints = 64, this.cursors = Ji, 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 = Ae(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);
@@ -2608,21 +2608,21 @@ class Ae extends A {
2608
2608
  this.direction === "anticlockwise" ? (m = y - g, m < 0 && (m += 360)) : (m = g - y, m < 0 && (m += 360));
2609
2609
  const v = (this.direction === "anticlockwise" ? 1 : -1) * m / u;
2610
2610
  for (let C = 0; C <= u; C++) {
2611
- const f = ht(l, d, g + C * v), { lng: P, lat: I } = R(f.x, f.y), E = [w(P, this.coordinatePrecision), w(I, this.coordinatePrecision)];
2612
- E[0] !== p[p.length - 1][0] && E[1] !== p[p.length - 1][1] && p.push(E);
2611
+ const f = ht(l, d, g + C * v), { lng: P, lat: I } = R(f.x, f.y), b = [w(P, this.coordinatePrecision), w(I, this.coordinatePrecision)];
2612
+ b[0] !== p[p.length - 1][0] && b[1] !== p[p.length - 1][1] && p.push(b);
2613
2613
  }
2614
- this.updateLineStringGeometry(this.currentInitialArcId, p, b.Provisional);
2614
+ this.updateLineStringGeometry(this.currentInitialArcId, p, E.Provisional);
2615
2615
  } else if (this.currentCoordinate === 3) {
2616
2616
  const e = this.store.getGeometryCopy(this.currentInitialArcId).coordinates;
2617
2617
  if (e.length < 2 || !this.direction) return;
2618
2618
  const i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], s = e[e.length - 1], n = O(t.lng, t.lat), a = O(o[0], o[1]), l = O(s[0], s[1]), d = O(i[0], i[1]), c = F(d, a), h = F(d, n) < c ? a : n, u = G(d, n), p = G(d, a), g = G(d, l), y = X(p), m = X(g), v = X(u);
2619
2619
  if (this.notInSector({ normalizedCursor: v, normalizedStart: y, normalizedEnd: m, direction: this.direction })) return;
2620
- const C = this.getDeltaBearing(this.direction, y, m), f = this.arcPoints, P = (this.direction === "anticlockwise" ? 1 : -1) * C / f, I = F(d, h), E = [];
2620
+ const C = this.getDeltaBearing(this.direction, y, m), f = this.arcPoints, P = (this.direction === "anticlockwise" ? 1 : -1) * C / f, I = F(d, h), b = [];
2621
2621
  for (let L = 0; L <= f; L++) {
2622
2622
  const M = ht(d, I, y + L * P), { lng: N, lat: _ } = R(M.x, M.y), T = [w(N, this.coordinatePrecision), w(_, this.coordinatePrecision)];
2623
- T[0] !== e[e.length - 1][0] && T[1] !== e[e.length - 1][1] && E.unshift(T);
2623
+ T[0] !== e[e.length - 1][0] && T[1] !== e[e.length - 1][1] && b.unshift(T);
2624
2624
  }
2625
- e.push(...E), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, b.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2625
+ e.push(...b), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, E.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2626
2626
  }
2627
2627
  }
2628
2628
  }
@@ -2679,7 +2679,7 @@ class Ae extends A {
2679
2679
  return o === "clockwise" ? e <= i ? t >= e && t <= i : t >= e || t <= i : e >= i ? t <= e && t >= i : t <= e || t >= i;
2680
2680
  }
2681
2681
  }
2682
- class q {
2682
+ class H {
2683
2683
  constructor({ name: t, callback: e, unregister: i, register: o }) {
2684
2684
  this.name = void 0, this.callback = void 0, this.registered = !1, this.register = void 0, this.unregister = void 0, this.name = t, this.register = () => {
2685
2685
  this.registered || (this.registered = !0, o(e));
@@ -2714,7 +2714,7 @@ var Hi = { __proto__: null, TerraDrawBaseAdapter: class {
2714
2714
  return this._coordinatePrecision;
2715
2715
  }
2716
2716
  getAdapterListeners() {
2717
- return [new q({ name: "pointerdown", callback: (r) => {
2717
+ return [new H({ name: "pointerdown", callback: (r) => {
2718
2718
  if (!this._currentModeCallbacks || !r.isPrimary) return;
2719
2719
  const t = this.getDrawEventFromEvent(r);
2720
2720
  t && (this._dragState = "pre-dragging", this._lastDrawEvent = t);
@@ -2722,7 +2722,7 @@ var Hi = { __proto__: null, TerraDrawBaseAdapter: class {
2722
2722
  this.getMapEventElement().addEventListener("pointerdown", r);
2723
2723
  }, unregister: (r) => {
2724
2724
  this.getMapEventElement().removeEventListener("pointerdown", r);
2725
- } }), new q({ name: "pointermove", callback: (r) => {
2725
+ } }), new H({ name: "pointermove", callback: (r) => {
2726
2726
  if (!this._currentModeCallbacks || !r.isPrimary) return;
2727
2727
  r.preventDefault();
2728
2728
  const t = this.getDrawEventFromEvent(r);
@@ -2742,13 +2742,13 @@ var Hi = { __proto__: null, TerraDrawBaseAdapter: class {
2742
2742
  this.getMapEventElement().addEventListener("pointermove", r);
2743
2743
  }, unregister: (r) => {
2744
2744
  this.getMapEventElement().removeEventListener("pointermove", r);
2745
- } }), new q({ name: "contextmenu", callback: (r) => {
2745
+ } }), new H({ name: "contextmenu", callback: (r) => {
2746
2746
  this._currentModeCallbacks && (r.preventDefault(), this._nextKeyUpIsContextMenu = !0);
2747
2747
  }, register: (r) => {
2748
2748
  this.getMapEventElement().addEventListener("contextmenu", r);
2749
2749
  }, unregister: (r) => {
2750
2750
  this.getMapEventElement().removeEventListener("contextmenu", r);
2751
- } }), new q({ name: "pointerup", callback: (r) => {
2751
+ } }), new H({ name: "pointerup", callback: (r) => {
2752
2752
  if (!this._currentModeCallbacks || r.target !== this.getMapEventElement() || !r.isPrimary) return;
2753
2753
  const t = this.getDrawEventFromEvent(r);
2754
2754
  t && (this._dragState === "dragging" ? this._currentModeCallbacks.onDragEnd(t, (e) => {
@@ -2758,13 +2758,13 @@ var Hi = { __proto__: null, TerraDrawBaseAdapter: class {
2758
2758
  this.getMapEventElement().addEventListener("pointerup", r);
2759
2759
  }, unregister: (r) => {
2760
2760
  this.getMapEventElement().removeEventListener("pointerup", r);
2761
- } }), new q({ name: "keyup", callback: (r) => {
2761
+ } }), new H({ name: "keyup", callback: (r) => {
2762
2762
  this._currentModeCallbacks && (this._heldKeys.delete(r.key), this._currentModeCallbacks.onKeyUp({ key: r.key, heldKeys: Array.from(this._heldKeys), preventDefault: () => r.preventDefault() }));
2763
2763
  }, register: (r) => {
2764
2764
  this.getMapEventElement().addEventListener("keyup", r);
2765
2765
  }, unregister: (r) => {
2766
2766
  this.getMapEventElement().removeEventListener("keyup", r);
2767
- } }), new q({ name: "keydown", callback: (r) => {
2767
+ } }), new H({ name: "keydown", callback: (r) => {
2768
2768
  this._currentModeCallbacks && (this._heldKeys.add(r.key), this._currentModeCallbacks.onKeyDown({ key: r.key, heldKeys: Array.from(this._heldKeys), preventDefault: () => r.preventDefault() }));
2769
2769
  }, register: (r) => {
2770
2770
  this.getMapEventElement().addEventListener("keydown", r);
@@ -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 Zi = { cancel: "Escape", finish: "Enter" }, Qi = { start: "crosshair", close: "pointer" };
2782
+ class Ue 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 = Zi, this.cursors = Qi, 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));
@@ -2792,7 +2792,7 @@ class Re extends A {
2792
2792
  const t = this.currentId;
2793
2793
  if (this.validate && t) {
2794
2794
  const e = this.store.getGeometryCopy(t);
2795
- if (!this.validate({ type: "Feature", id: t, geometry: e, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish }).valid) return;
2795
+ if (!this.validate({ type: "Feature", id: t, geometry: e, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
2796
2796
  }
2797
2797
  this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(t, { mode: this.mode, action: "draw" });
2798
2798
  }
@@ -2807,7 +2807,7 @@ class Re extends A {
2807
2807
  const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates.length - 2, [o, s] = e.coordinates[i], { x: n, y: a } = this.project(o, s), l = F({ x: n, y: a }, { x: t.containerX, y: t.containerY }), [d, c] = e.coordinates[e.coordinates.length - 1], { x: h, y: u } = this.project(d, c), p = F({ x: h, y: u }, { x: t.containerX, y: t.containerY });
2808
2808
  if (this.setCursor(p < this.pointerDistance ? this.cursors.close : this.cursors.start), l < this.minDistance) return;
2809
2809
  const g = { type: "LineString", coordinates: [...e.coordinates, [t.lng, t.lat]] };
2810
- this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: g, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.store.updateGeometry([{ id: this.currentId, geometry: g }]), this.closingPointId && this.store.updateGeometry([{ id: this.closingPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]));
2810
+ this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: g, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || (this.store.updateGeometry([{ id: this.currentId, geometry: g }]), this.closingPointId && this.store.updateGeometry([{ id: this.closingPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]));
2811
2811
  }
2812
2812
  onClick(t) {
2813
2813
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) {
@@ -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) => Rt(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 Wt(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,24 +2860,24 @@ 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 (!Wt(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" && Wt(r[t]));
2866
2866
  }
2867
- class Zi {
2867
+ class to {
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 Ni();
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;
2873
2873
  }, {}), o = Object.keys(i);
2874
2874
  if (o.length === 0) throw new Error("No modes provided");
2875
2875
  o.forEach((c) => {
2876
- if (i[c].type === H.Select) {
2876
+ if (i[c].type === q.Select) {
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 Gi({ 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 = we({ 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 (Nt(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 (Ne([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 (Nt(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 && !Wt(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
+ We({ coordinates: n, originX: a, originY: l, xScale: e.options.xScale || 1, yScale: e.options.yScale || 1 });
3078
+ } else e.type === "rotate" && (i = Te(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 (Qt(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 (Qt(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 eo extends Hi.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 $o = [
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
+ ], Yo = [
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
+ ], io = {
3258
3258
  modes: [
3259
3259
  "render",
3260
3260
  "point",
@@ -3273,6 +3273,21 @@ const zo = [
3273
3273
  "download"
3274
3274
  ],
3275
3275
  open: !1
3276
+ }, bt = {
3277
+ kilometer: "km",
3278
+ meter: "m",
3279
+ centimeter: "cm",
3280
+ mile: "mi",
3281
+ foot: "ft",
3282
+ inch: "in",
3283
+ "square meters": "m²",
3284
+ "square kilometers": "km²",
3285
+ ares: "a",
3286
+ hectares: "ha",
3287
+ "square feet": "ft²",
3288
+ "square yards": "yd²",
3289
+ acres: "acres",
3290
+ "square miles": "mi²"
3276
3291
  }, lt = {
3277
3292
  modes: [
3278
3293
  "render",
@@ -3294,7 +3309,7 @@ const zo = [
3294
3309
  open: !1,
3295
3310
  // see styling parameters of Terra Draw at https://github.com/JamesLMilner/terra-draw/blob/main/guides/5.STYLING.md
3296
3311
  modeOptions: {
3297
- point: new Gt({
3312
+ point: new zt({
3298
3313
  editable: !0,
3299
3314
  styles: {
3300
3315
  pointColor: "#FFFFFF",
@@ -3303,7 +3318,7 @@ const zo = [
3303
3318
  pointOutlineWidth: 1
3304
3319
  }
3305
3320
  }),
3306
- linestring: new Rt({
3321
+ linestring: new Ut({
3307
3322
  editable: !0,
3308
3323
  styles: {
3309
3324
  lineStringColor: "#666666",
@@ -3314,7 +3329,7 @@ const zo = [
3314
3329
  closingPointOutlineWidth: 1
3315
3330
  }
3316
3331
  }),
3317
- polygon: new Le({
3332
+ polygon: new Me({
3318
3333
  editable: !0,
3319
3334
  styles: {
3320
3335
  fillColor: "#EDEFF0",
@@ -3327,7 +3342,7 @@ const zo = [
3327
3342
  closingPointOutlineWidth: 1
3328
3343
  }
3329
3344
  }),
3330
- rectangle: new Fe({
3345
+ rectangle: new De({
3331
3346
  styles: {
3332
3347
  fillColor: "#EDEFF0",
3333
3348
  fillOpacity: 0.7,
@@ -3335,7 +3350,7 @@ const zo = [
3335
3350
  outlineWidth: 2
3336
3351
  }
3337
3352
  }),
3338
- "angled-rectangle": new We({
3353
+ "angled-rectangle": new je({
3339
3354
  styles: {
3340
3355
  fillColor: "#EDEFF0",
3341
3356
  fillOpacity: 0.7,
@@ -3343,7 +3358,7 @@ const zo = [
3343
3358
  outlineWidth: 2
3344
3359
  }
3345
3360
  }),
3346
- circle: new xe({
3361
+ circle: new Ee({
3347
3362
  styles: {
3348
3363
  fillColor: "#EDEFF0",
3349
3364
  fillOpacity: 0.7,
@@ -3351,7 +3366,7 @@ const zo = [
3351
3366
  outlineWidth: 2
3352
3367
  }
3353
3368
  }),
3354
- freehand: new Oe({
3369
+ freehand: new be({
3355
3370
  styles: {
3356
3371
  fillColor: "#EDEFF0",
3357
3372
  fillOpacity: 0.7,
@@ -3363,7 +3378,7 @@ const zo = [
3363
3378
  closingPointOutlineWidth: 1
3364
3379
  }
3365
3380
  }),
3366
- "freehand-linestring": new Re({
3381
+ "freehand-linestring": new Ue({
3367
3382
  styles: {
3368
3383
  lineStringColor: "#666666",
3369
3384
  lineStringWidth: 2,
@@ -3373,7 +3388,7 @@ const zo = [
3373
3388
  closingPointOutlineWidth: 1
3374
3389
  }
3375
3390
  }),
3376
- sensor: new Ae({
3391
+ sensor: new Ge({
3377
3392
  styles: {
3378
3393
  fillColor: "#EDEFF0",
3379
3394
  fillOpacity: 0.7,
@@ -3385,7 +3400,7 @@ const zo = [
3385
3400
  centerPointOutlineWidth: 1
3386
3401
  }
3387
3402
  }),
3388
- sector: new je({
3403
+ sector: new Re({
3389
3404
  styles: {
3390
3405
  fillColor: "#EDEFF0",
3391
3406
  fillOpacity: 0.7,
@@ -3393,7 +3408,7 @@ const zo = [
3393
3408
  outlineWidth: 2
3394
3409
  }
3395
3410
  }),
3396
- select: new Ut({
3411
+ select: new Vt({
3397
3412
  flags: {
3398
3413
  point: {
3399
3414
  feature: {
@@ -3655,12 +3670,12 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3655
3670
  maxzoom: 15,
3656
3671
  tms: !1
3657
3672
  },
3658
- distanceUnit: "kilometers",
3673
+ measureUnitType: "metric",
3659
3674
  distancePrecision: 2,
3660
3675
  forceDistanceUnit: "auto",
3661
- areaUnit: "metric",
3662
3676
  areaPrecision: 2,
3663
3677
  forceAreaUnit: "auto",
3678
+ measureUnitSymbols: JSON.parse(JSON.stringify(bt)),
3664
3679
  elevationCacheConfig: {
3665
3680
  enabled: !0,
3666
3681
  maxSize: 1e3,
@@ -3686,7 +3701,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3686
3701
  open: !1,
3687
3702
  // see styling parameters of Terra Draw at https://github.com/JamesLMilner/terra-draw/blob/main/guides/5.STYLING.md
3688
3703
  modeOptions: {
3689
- point: new Gt({
3704
+ point: new zt({
3690
3705
  editable: !1,
3691
3706
  styles: {
3692
3707
  pointColor: "#FFFFFF",
@@ -3695,7 +3710,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3695
3710
  pointOutlineWidth: 1
3696
3711
  }
3697
3712
  }),
3698
- linestring: new Rt({
3713
+ linestring: new Ut({
3699
3714
  editable: !1,
3700
3715
  styles: {
3701
3716
  lineStringColor: "#FF0000",
@@ -3706,7 +3721,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3706
3721
  closingPointOutlineWidth: 1
3707
3722
  }
3708
3723
  }),
3709
- select: new Ut({
3724
+ select: new Vt({
3710
3725
  flags: {
3711
3726
  point: {
3712
3727
  feature: {
@@ -3901,34 +3916,34 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3901
3916
  "text-halo-color": "rgb(255, 255, 255)"
3902
3917
  }
3903
3918
  }
3904
- }, eo = () => ({
3919
+ }, oo = () => ({
3905
3920
  render: new Q({
3906
3921
  modeName: "render",
3907
3922
  styles: {}
3908
3923
  }),
3909
- point: new Gt({
3924
+ point: new zt({
3910
3925
  editable: !0
3911
3926
  }),
3912
- linestring: new Rt({
3927
+ linestring: new Ut({
3913
3928
  editable: !0
3914
3929
  }),
3915
- polygon: new Le({
3930
+ polygon: new Me({
3916
3931
  editable: !0,
3917
3932
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3918
3933
  // @ts-ignore
3919
3934
  validation: (t, e) => {
3920
3935
  const i = e.updateType;
3921
- return i === "finish" || i === "commit" ? Ui(t) : { valid: !0 };
3936
+ return i === "finish" || i === "commit" ? Vi(t) : { valid: !0 };
3922
3937
  }
3923
3938
  }),
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({
3939
+ rectangle: new De(),
3940
+ "angled-rectangle": new je(),
3941
+ circle: new Ee(),
3942
+ freehand: new be(),
3943
+ "freehand-linestring": new Ue(),
3944
+ sensor: new Ge(),
3945
+ sector: new Re(),
3946
+ select: new Vt({
3932
3947
  flags: {
3933
3948
  point: {
3934
3949
  feature: {
@@ -4054,7 +4069,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
4054
4069
  styles: {}
4055
4070
  })
4056
4071
  });
4057
- var W = 63710088e-1, io = {
4072
+ var W = 63710088e-1, so = {
4058
4073
  centimeters: W * 100,
4059
4074
  centimetres: W * 100,
4060
4075
  degrees: 360 / (2 * Math.PI),
@@ -4071,26 +4086,26 @@ var W = 63710088e-1, io = {
4071
4086
  radians: 1,
4072
4087
  yards: W * 1.0936
4073
4088
  };
4074
- function oo(r, t, e = {}) {
4089
+ function ro(r, t, e = {}) {
4075
4090
  const i = { type: "Feature" };
4076
4091
  return (e.id === 0 || e.id) && (i.id = e.id), e.bbox && (i.bbox = e.bbox), i.properties = t || {}, i.geometry = r, i;
4077
4092
  }
4078
- function so(r, t, e = {}) {
4093
+ function no(r, t, e = {}) {
4079
4094
  if (!r)
4080
4095
  throw new Error("coordinates is required");
4081
4096
  if (!Array.isArray(r))
4082
4097
  throw new Error("coordinates must be an Array");
4083
4098
  if (r.length < 2)
4084
4099
  throw new Error("coordinates must be at least 2 numbers long");
4085
- if (!ue(r[0]) || !ue(r[1]))
4100
+ if (!ge(r[0]) || !ge(r[1]))
4086
4101
  throw new Error("coordinates must contain numbers");
4087
- return oo({
4102
+ return ro({
4088
4103
  type: "Point",
4089
4104
  coordinates: r
4090
4105
  }, t, e);
4091
4106
  }
4092
- function ro(r, t = "kilometers") {
4093
- const e = io[t];
4107
+ function ao(r, t = "kilometers") {
4108
+ const e = so[t];
4094
4109
  if (!e)
4095
4110
  throw new Error(t + " units is invalid");
4096
4111
  return r * e;
@@ -4098,10 +4113,10 @@ function ro(r, t = "kilometers") {
4098
4113
  function vt(r) {
4099
4114
  return r % 360 * Math.PI / 180;
4100
4115
  }
4101
- function ue(r) {
4116
+ function ge(r) {
4102
4117
  return !isNaN(r) && r !== null && !Array.isArray(r);
4103
4118
  }
4104
- function Ge(r, t, e) {
4119
+ function ze(r, t, e) {
4105
4120
  if (r !== null)
4106
4121
  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
4122
  d = g ? r.features[v].geometry : y ? r.geometry : r, u = d ? d.type === "GeometryCollection" : !1, a = u ? d.geometries.length : 1;
@@ -4178,7 +4193,7 @@ function Ge(r, t, e) {
4178
4193
  break;
4179
4194
  case "GeometryCollection":
4180
4195
  for (i = 0; i < n.geometries.length; i++)
4181
- if (Ge(n.geometries[i], t) === !1)
4196
+ if (ze(n.geometries[i], t) === !1)
4182
4197
  return !1;
4183
4198
  break;
4184
4199
  default:
@@ -4188,7 +4203,7 @@ function Ge(r, t, e) {
4188
4203
  }
4189
4204
  }
4190
4205
  }
4191
- function no(r, t) {
4206
+ function lo(r, t) {
4192
4207
  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
4208
  for (e = 0; e < y; e++) {
4194
4209
  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 +4254,9 @@ function no(r, t) {
4239
4254
  u++;
4240
4255
  }
4241
4256
  }
4242
- function ao(r, t, e) {
4257
+ function co(r, t, e) {
4243
4258
  var i = e;
4244
- return no(
4259
+ return lo(
4245
4260
  r,
4246
4261
  function(o, s, n, a, l) {
4247
4262
  s === 0 && e === void 0 ? i = o : i = t(
@@ -4255,21 +4270,21 @@ function ao(r, t, e) {
4255
4270
  }
4256
4271
  ), i;
4257
4272
  }
4258
- function lo(r) {
4259
- return ao(
4273
+ function ho(r) {
4274
+ return co(
4260
4275
  r,
4261
- (t, e) => t + co(e),
4276
+ (t, e) => t + uo(e),
4262
4277
  0
4263
4278
  );
4264
4279
  }
4265
- function co(r) {
4280
+ function uo(r) {
4266
4281
  let t = 0, e;
4267
4282
  switch (r.type) {
4268
4283
  case "Polygon":
4269
- return pe(r.coordinates);
4284
+ return ye(r.coordinates);
4270
4285
  case "MultiPolygon":
4271
4286
  for (e = 0; e < r.coordinates.length; e++)
4272
- t += pe(r.coordinates[e]);
4287
+ t += ye(r.coordinates[e]);
4273
4288
  return t;
4274
4289
  case "Point":
4275
4290
  case "MultiPoint":
@@ -4279,81 +4294,81 @@ function co(r) {
4279
4294
  }
4280
4295
  return 0;
4281
4296
  }
4282
- function pe(r) {
4297
+ function ye(r) {
4283
4298
  let t = 0;
4284
4299
  if (r && r.length > 0) {
4285
- t += Math.abs(ge(r[0]));
4300
+ t += Math.abs(fe(r[0]));
4286
4301
  for (let e = 1; e < r.length; e++)
4287
- t -= Math.abs(ge(r[e]));
4302
+ t -= Math.abs(fe(r[e]));
4288
4303
  }
4289
4304
  return t;
4290
4305
  }
4291
- var ho = W * W / 2, Ft = Math.PI / 180;
4292
- function ge(r) {
4306
+ var po = W * W / 2, Dt = Math.PI / 180;
4307
+ function fe(r) {
4293
4308
  const t = r.length - 1;
4294
4309
  if (t <= 2) return 0;
4295
4310
  let e = 0, i = 0;
4296
4311
  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;
4312
+ 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] * Dt, l = s[1] * Dt, d = n[0] * Dt;
4298
4313
  e += (d - a) * Math.sin(l), i++;
4299
4314
  }
4300
- return e * ho;
4315
+ return e * po;
4301
4316
  }
4302
- var uo = lo;
4303
- const po = (r, t, e = "auto") => {
4304
- const i = ["m2", "km2", "a", "ha"], o = ["ft2", "yd2", "acre", "mi2"];
4305
- let s = e;
4317
+ var go = ho;
4318
+ const yo = (r, t, e = "auto", i = bt) => {
4319
+ const o = ["square meters", "square kilometers", "ares", "hectares"], s = ["square feet", "square yards", "acres", "square miles"];
4320
+ let n = e;
4306
4321
  if (e !== "auto") {
4307
- const n = i.includes(e), a = o.includes(e);
4308
- (t === "metric" && !n || t === "imperial" && !a) && (s = "auto");
4322
+ const a = o.includes(e), l = s.includes(e);
4323
+ (t === "metric" && !a || t === "imperial" && !l) && (n = "auto");
4309
4324
  }
4310
- return t === "metric" ? s !== "auto" ? ot(r, s) : r >= 1e6 ? ot(r, "km2") : r >= 1e4 ? ot(r, "ha") : r >= 100 ? ot(r, "a") : ot(r, "m2") : s !== "auto" ? st(r, s) : r >= 258998811e-2 ? st(r, "mi2") : r >= 4046.856 ? st(r, "acre") : r >= 0.83612736 ? st(r, "yd2") : st(r, "ft2");
4311
- }, ot = (r, t) => {
4312
- let e = r, i = "";
4325
+ return t === "metric" ? n !== "auto" ? ot(r, n, i) : r >= 1e6 ? ot(r, "square kilometers", i) : r >= 1e4 ? ot(r, "hectares", i) : r >= 100 ? ot(r, "ares", i) : ot(r, "square meters", i) : n !== "auto" ? st(r, n, i) : r >= 258998811e-2 ? st(r, "square miles", i) : r >= 4046.856 ? st(r, "acres", i) : r >= 0.83612736 ? st(r, "square yards", i) : st(r, "square feet", i);
4326
+ }, ot = (r, t, e) => {
4327
+ let i = r, o = e["square meters"];
4313
4328
  switch (t) {
4314
- case "m2":
4315
- e = r, i = "";
4329
+ case "square meters":
4330
+ i = r, o = e["square meters"];
4316
4331
  break;
4317
- case "a":
4318
- e = r / 100, i = "a";
4332
+ case "ares":
4333
+ i = r / 100, o = e.ares;
4319
4334
  break;
4320
- case "ha":
4321
- e = r / 1e4, i = "ha";
4335
+ case "hectares":
4336
+ i = r / 1e4, o = e.hectares;
4322
4337
  break;
4323
- case "km2":
4324
- e = r / 1e6, i = "km²";
4338
+ case "square kilometers":
4339
+ i = r / 1e6, o = e["square kilometers"];
4325
4340
  break;
4326
4341
  }
4327
4342
  return {
4328
- area: e,
4329
- unit: i
4343
+ area: i,
4344
+ unit: o
4330
4345
  };
4331
- }, st = (r, t) => {
4332
- let e = r / 258998811e-2, i = "";
4346
+ }, st = (r, t, e) => {
4347
+ let i = r / 258998811e-2, o = e["square meters"];
4333
4348
  switch (t) {
4334
- case "ft2":
4335
- e = r / 0.09290304, i = "ft²";
4349
+ case "square feet":
4350
+ i = r / 0.09290304, o = e["square feet"];
4336
4351
  break;
4337
- case "yd2":
4338
- e = r / 0.83612736, i = "yd²";
4352
+ case "square yards":
4353
+ i = r / 0.83612736, o = e["square yards"];
4339
4354
  break;
4340
- case "acre":
4341
- e = r / 4046.856, i = "acre";
4355
+ case "acres":
4356
+ i = r / 4046.856, o = e.acres;
4342
4357
  break;
4343
- case "mi2":
4344
- e = r / 258998811e-2, i = "mi²";
4358
+ case "square miles":
4359
+ i = r / 258998811e-2, o = e["square miles"];
4345
4360
  break;
4346
4361
  }
4347
4362
  return {
4348
- area: e,
4349
- unit: i
4363
+ area: i,
4364
+ unit: o
4350
4365
  };
4351
- }, ye = (r, t, e, i) => {
4366
+ }, me = (r, t, e, i, o) => {
4352
4367
  if (r.geometry.type !== "Polygon") return r;
4353
- const o = uo(r.geometry), s = po(o, t, i);
4354
- return s.area = parseFloat(s.area.toFixed(e)), r.properties.area = s.area, r.properties.unit = s.unit, r;
4368
+ const s = go(r.geometry), n = yo(s, t, i, o);
4369
+ return n.area = parseFloat(n.area.toFixed(e)), r.properties.area = n.area, r.properties.unit = n.unit, r;
4355
4370
  };
4356
- function fe(r) {
4371
+ function ve(r) {
4357
4372
  if (!r)
4358
4373
  throw new Error("coord is required");
4359
4374
  if (!Array.isArray(r)) {
@@ -4366,117 +4381,143 @@ function fe(r) {
4366
4381
  return [...r];
4367
4382
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
4368
4383
  }
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(
4384
+ function fo(r, t, e = {}) {
4385
+ var i = ve(r), o = ve(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);
4386
+ return ao(
4372
4387
  2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
4373
4388
  e.units
4374
4389
  );
4375
4390
  }
4376
- var yo = go;
4377
- const Mt = (r, t = "kilometers", e = "auto") => {
4378
- const i = ["cm", "m", "km"];
4379
- let o = e;
4391
+ var mo = fo;
4392
+ const _t = (r, t = "metric", e = "auto", i = bt) => {
4393
+ const o = ["centimeter", "meter", "kilometer"], s = ["inch", "foot", "mile"];
4394
+ let n = e;
4380
4395
  if (e !== "auto") {
4381
- const n = i.includes(e);
4382
- t === "kilometers" && !n && (o = "auto");
4396
+ const l = o.includes(e), d = s.includes(e);
4397
+ (t === "metric" && !l || t === "imperial" && !d) && (n = "auto");
4383
4398
  }
4384
- let s = {
4399
+ let a = {
4385
4400
  distance: r,
4386
- unit: "km"
4401
+ unit: i.kilometer
4387
4402
  };
4388
- return t === "kilometers" ? s = Ct(r, o) : t === "degrees" ? s.unit = "°" : t === "miles" ? s.unit = "mi" : t === "radians" && (s.unit = "rad"), s;
4389
- }, Ct = (r, t) => {
4390
- let e = {
4403
+ return t === "metric" ? a = Ct(r, n, i) : t === "imperial" && (a = Pt(r, n, i)), a;
4404
+ }, Ct = (r, t, e) => {
4405
+ let i = {
4391
4406
  distance: r,
4392
- unit: "km"
4407
+ unit: e.kilometer
4393
4408
  };
4394
4409
  switch (t) {
4395
- case "km":
4396
- e.distance = r, e.unit = "km";
4410
+ case "kilometer":
4411
+ i.distance = r, i.unit = e[t];
4397
4412
  break;
4398
- case "m":
4399
- e.distance = r * 1e3, e.unit = "m";
4413
+ case "meter":
4414
+ i.distance = r * 1e3, i.unit = e[t];
4400
4415
  break;
4401
- case "cm":
4402
- e.distance = r * 1e5, e.unit = "cm";
4416
+ case "centimeter":
4417
+ i.distance = r * 1e5, i.unit = e[t];
4403
4418
  break;
4404
4419
  case "auto":
4405
- r >= 1 ? e = Ct(r, "km") : r * 1e3 >= 1 ? e = Ct(r, "m") : e = Ct(r, "cm");
4420
+ r >= 1 ? i = Ct(r, "kilometer", e) : r * 1e3 >= 1 ? i = Ct(r, "meter", e) : i = Ct(r, "centimeter", e);
4406
4421
  break;
4407
4422
  default:
4408
- e.distance = r, e.unit = "km";
4423
+ i.distance = r, i.unit = e.kilometer;
4409
4424
  break;
4410
4425
  }
4411
- return e;
4412
- }, me = (r, t, e, i, o, s, n) => {
4426
+ return i;
4427
+ }, Pt = (r, t, e) => {
4428
+ let i = {
4429
+ distance: r,
4430
+ unit: e.mile
4431
+ };
4432
+ switch (t) {
4433
+ case "mile":
4434
+ i.distance = r, i.unit = e[t];
4435
+ break;
4436
+ case "foot":
4437
+ i.distance = r * 5280, i.unit = e[t];
4438
+ break;
4439
+ case "inch":
4440
+ i.distance = r * 63360, i.unit = e[t];
4441
+ break;
4442
+ case "auto":
4443
+ r >= 1 ? i = Pt(r, "mile", e) : r * 5280 >= 1 ? i = Pt(r, "foot", e) : i = Pt(r, "inch", e);
4444
+ break;
4445
+ default:
4446
+ i.distance = r, i.unit = e.mile;
4447
+ break;
4448
+ }
4449
+ return i;
4450
+ }, Ce = (r, t, e, i, o, s, n, a) => {
4413
4451
  if (r.geometry.type !== "LineString") return r;
4414
- const a = r.geometry.coordinates;
4415
- let l = 0;
4416
- const d = [];
4417
- for (let h = 0; h < a.length - 1; h++) {
4418
- const u = a[h], p = a[h + 1], g = yo(u, p, { units: t });
4419
- l += g;
4420
- const y = JSON.parse(JSON.stringify(r));
4421
- 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) {
4422
- const m = o?.queryTerrainElevation(u);
4423
- m && (y.properties.elevation_start = m);
4424
- const v = o?.queryTerrainElevation(p);
4425
- v && (y.properties.elevation_end = v);
4426
- }
4427
- d.push(y);
4428
- }
4429
- r.properties.distance = d[d.length - 1].properties.total, r.properties.segments = JSON.parse(JSON.stringify(d));
4430
- const c = Mt(
4452
+ const l = r.geometry.coordinates;
4453
+ let d = 0;
4454
+ const c = [];
4455
+ for (let u = 0; u < l.length - 1; u++) {
4456
+ const p = l[u], g = l[u + 1], y = mo(p, g, { units: t === "metric" ? "kilometers" : "miles" });
4457
+ d += y;
4458
+ const m = JSON.parse(JSON.stringify(r));
4459
+ if (m.id = `${m.id}-${u}`, m.geometry.coordinates = [p, g], m.properties.originalId = r.id, m.properties.distance = y, m.properties.total = d, n === !0 && a === void 0) {
4460
+ const v = s?.queryTerrainElevation(p);
4461
+ v && (m.properties.elevation_start = v);
4462
+ const C = s?.queryTerrainElevation(g);
4463
+ C && (m.properties.elevation_end = C);
4464
+ }
4465
+ c.push(m);
4466
+ }
4467
+ r.properties.distance = c[c.length - 1].properties.total, r.properties.segments = JSON.parse(JSON.stringify(c));
4468
+ const h = _t(
4431
4469
  r.properties.distance,
4432
4470
  t,
4433
- i
4471
+ i,
4472
+ o
4434
4473
  );
4435
- return r.properties.distance = c.distance, r.properties.unit = c.unit, r.properties.segments.forEach(
4436
- (h) => {
4437
- const u = Mt(
4438
- h.properties.distance,
4474
+ return r.properties.distance = h.distance, r.properties.unit = h.unit, r.properties.segments.forEach(
4475
+ (u) => {
4476
+ const p = _t(
4477
+ u.properties.distance,
4439
4478
  t,
4440
- i
4479
+ i,
4480
+ o
4441
4481
  );
4442
- h.properties.distance = u.distance, h.properties.unit = u.unit;
4443
- const p = Mt(
4444
- h.properties.total,
4482
+ u.properties.distance = p.distance, u.properties.unit = p.unit;
4483
+ const g = _t(
4484
+ u.properties.total,
4445
4485
  t,
4446
- i
4486
+ i,
4487
+ o
4447
4488
  );
4448
- h.properties.total = p.distance, h.properties.totalUnit = p.unit;
4489
+ u.properties.total = g.distance, u.properties.totalUnit = g.unit;
4449
4490
  }
4450
4491
  ), r.properties.distance = parseFloat(
4451
4492
  r.properties.distance.toFixed(e)
4452
4493
  ), r.properties.segments.forEach(
4453
- (h) => {
4454
- h.properties.distance = parseFloat(
4455
- h.properties.distance.toFixed(e)
4456
- ), h.properties.total = parseFloat(
4457
- h.properties.total.toFixed(e)
4494
+ (u) => {
4495
+ u.properties.distance = parseFloat(
4496
+ u.properties.distance.toFixed(e)
4497
+ ), u.properties.total = parseFloat(
4498
+ u.properties.total.toFixed(e)
4458
4499
  );
4459
4500
  }
4460
4501
  ), r;
4461
- }, ve = (r) => r.charAt(0).toUpperCase() + r.slice(1), et = [
4502
+ }, Pe = (r) => r.charAt(0).toUpperCase() + r.slice(1), et = [
4462
4503
  "{prefix}-point",
4463
4504
  "{prefix}-point-lower",
4464
4505
  "{prefix}-linestring",
4465
4506
  "{prefix}-polygon",
4466
4507
  "{prefix}-polygon-outline"
4467
- ], $o = [
4508
+ ], Ko = [
4468
4509
  ...et,
4469
4510
  lt.polygonLayerSpec?.source,
4470
4511
  lt.lineLayerLabelSpec?.source,
4471
4512
  lt.pointLayerLabelSpec?.source
4472
- ], Yo = [
4513
+ ], Xo = [
4473
4514
  ...et,
4474
4515
  z.routingLineLayerNodeLabelSpec?.source,
4475
4516
  z.routingLineLayerNodeSpec?.source,
4476
4517
  z.isochronePolygonLayerSpec?.source,
4477
4518
  z.isochroneLineLayerSpec?.source,
4478
4519
  z.isochroneLabelLayerSpec?.source
4479
- ], zt = (r, t, e = et, i = "td") => {
4520
+ ], $t = (r, t, e = et, i = "td") => {
4480
4521
  e = e.map((s) => s.replace("{prefix}", i));
4481
4522
  const o = JSON.parse(JSON.stringify(r));
4482
4523
  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 +4525,13 @@ const Mt = (r, t = "kilometers", e = "auto") => {
4484
4525
  })) : 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
4526
  e.includes(s) && delete o.sources[s];
4486
4527
  }))), o;
4487
- }, Ue = (r, t = 250) => {
4528
+ }, Ve = (r, t = 250) => {
4488
4529
  let e;
4489
4530
  return (...i) => {
4490
4531
  clearTimeout(e), e = setTimeout(() => r(...i), t);
4491
4532
  };
4492
4533
  };
4493
- class ze {
4534
+ class $e {
4494
4535
  cache = /* @__PURE__ */ new Map();
4495
4536
  maxSize;
4496
4537
  ttl;
@@ -4568,7 +4609,7 @@ class ze {
4568
4609
  };
4569
4610
  }
4570
4611
  }
4571
- class fo {
4612
+ class vo {
4572
4613
  className;
4573
4614
  dialog;
4574
4615
  title;
@@ -4657,7 +4698,7 @@ class fo {
4657
4698
  }), o;
4658
4699
  }
4659
4700
  }
4660
- const Ce = (r, t, e, i) => {
4701
+ const Se = (r, t, e, i) => {
4661
4702
  if (r.geometry.type !== "Point") return r;
4662
4703
  const o = r.geometry.coordinates;
4663
4704
  if (e === !0 && i === void 0) {
@@ -4666,58 +4707,58 @@ const Ce = (r, t, e, i) => {
4666
4707
  }
4667
4708
  return r;
4668
4709
  };
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) {
4710
+ var Co = Object.defineProperty, Po = (r, t, e) => t in r ? Co(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, rt = (r, t, e) => Po(r, typeof t != "symbol" ? t + "" : t, e), xt = 2 * Math.PI * 6378137 / 2;
4711
+ function So(r) {
4671
4712
  return r = r || 256, 2 * Math.PI * 6378137 / r;
4672
4713
  }
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];
4714
+ function Io(r, t, e = { enable: !0, decimal: 1 }) {
4715
+ r = Yt(r);
4716
+ var i = r[0], o = r[1], s = i * xt / 180, n = Math.log(Math.tan((90 + o) * Math.PI / 360)) / (Math.PI / 180);
4717
+ return n = n * xt / 180, e.enable && (s = Number(s.toFixed(e.decimal)), n = Number(n.toFixed(e.decimal))), [s, n];
4677
4718
  }
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;
4719
+ function xo(r, t, e) {
4720
+ var i = r[0], o = r[1], s = Fo(t, e), n = (i + xt) / s, a = (o + xt) / s;
4680
4721
  return [n, a, t];
4681
4722
  }
4682
- function Ve(r, t, e) {
4683
- r = Vt(r);
4684
- var i = Po(r), o = So(i, t);
4685
- return xo(o);
4723
+ function Ye(r, t, e) {
4724
+ r = Yt(r);
4725
+ var i = Io(r), o = xo(i, t);
4726
+ return Eo(o);
4686
4727
  }
4687
- function Io(r, t, e) {
4688
- if (r = Vt(r), t === 0)
4728
+ function Oo(r, t, e) {
4729
+ if (r = Yt(r), t === 0)
4689
4730
  return [0, 0, 0];
4690
- var i = Ve(r, t);
4691
- return Oo(i);
4731
+ var i = Ye(r, t);
4732
+ return bo(i);
4692
4733
  }
4693
- function xo(r, t, e) {
4734
+ function Eo(r, t, e) {
4694
4735
  t = t || 256;
4695
4736
  var i = r[0], o = r[1], s = r[2];
4696
4737
  if (s === 0) return [0, 0, 0];
4697
- $e(s);
4738
+ Ke(s);
4698
4739
  var n = Math.ceil(i / t) - 1, a = Math.ceil(o / t) - 1;
4699
4740
  return n < 0 && (n = 0), a < 0 && (a = 0), [n, a, s];
4700
4741
  }
4701
- function Oo(r, t) {
4702
- bo(r);
4742
+ function bo(r, t) {
4743
+ wo(r);
4703
4744
  var e = r[0], i = r[1], o = r[2];
4704
4745
  if (o === 0)
4705
4746
  return [0, 0, 0];
4706
4747
  var s = e, n = Math.pow(2, o) - 1 - i;
4707
4748
  return [s, n, o];
4708
4749
  }
4709
- function bo(r, t) {
4750
+ function wo(r, t) {
4710
4751
  var e = r[0], i = r[1], o = r[2];
4711
4752
  if (o == null) throw new Error("<zoom> is required");
4712
4753
  if (e == null) throw new Error("<x> is required");
4713
4754
  if (i == null) throw new Error("<y> is required");
4714
- return o = $e(o), r = Eo(r), r;
4755
+ return o = Ke(o), r = Lo(r), r;
4715
4756
  }
4716
- function Eo(r) {
4757
+ function Lo(r) {
4717
4758
  var t = r[0], e = r[1], i = r[2], o = Math.pow(2, i);
4718
4759
  return t = t % o, t < 0 && (t = t + o), [t, e, i];
4719
4760
  }
4720
- function $e(r) {
4761
+ function Ke(r) {
4721
4762
  if (r === !1) return r;
4722
4763
  if (r == null)
4723
4764
  throw new Error("<zoom> is required");
@@ -4727,22 +4768,22 @@ function $e(r) {
4727
4768
  throw new Error("<zoom> cannot be greater than 32");
4728
4769
  return r;
4729
4770
  }
4730
- function Vt(r, t) {
4731
- var e = Fo(r[0]), i = Lo(r[1]);
4771
+ function Yt(r, t) {
4772
+ var e = Do(r[0]), i = Mo(r[1]);
4732
4773
  return i > 85 && (i = 85), i < -85 && (i = -85), [e, i];
4733
4774
  }
4734
- function wo(r, t) {
4735
- return Co(t) / Math.pow(2, r);
4775
+ function Fo(r, t) {
4776
+ return So(t) / Math.pow(2, r);
4736
4777
  }
4737
- function Lo(r) {
4778
+ function Mo(r) {
4738
4779
  if (r == null) throw new Error("lat is required");
4739
4780
  return (r > 90 || r < -90) && (r = r % 180, r > 90 && (r = -180 + r), r < -90 && (r = 180 + r), r === 0 && (r = 0)), r;
4740
4781
  }
4741
- function Fo(r) {
4782
+ function Do(r) {
4742
4783
  if (r == null) throw new Error("lng is required");
4743
4784
  return (r > 180 || r < -180) && (r = r % 360, r > 180 && (r = -360 + r), r < -180 && (r = 360 + r), r === 0 && (r = 0)), r;
4744
4785
  }
4745
- class Ye {
4786
+ class Xe {
4746
4787
  /**
4747
4788
  * Constructor
4748
4789
  * @param url URL for terrain RGB raster tilesets
@@ -4767,7 +4808,7 @@ class Ye {
4767
4808
  const s = t[0], n = t[1];
4768
4809
  let a = e;
4769
4810
  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());
4811
+ const l = this.tms ? Ye([s, n], a) : Oo([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
4812
  let c = this.getUrlExtension(d);
4772
4813
  switch (c || (c = "png"), c) {
4773
4814
  case "png":
@@ -4869,7 +4910,7 @@ class Ye {
4869
4910
  return i * Math.atan(0.5 * (Math.exp(o) - Math.exp(-o)));
4870
4911
  }
4871
4912
  }
4872
- class Mo extends Ye {
4913
+ class _o extends Xe {
4873
4914
  /**
4874
4915
  * Constructor
4875
4916
  * @param url URL for terrain RGB raster tilesets
@@ -4901,7 +4942,7 @@ class Mo extends Ye {
4901
4942
  return -1e4 + (t * 256 * 256 + e * 256 + i) * 0.1;
4902
4943
  }
4903
4944
  }
4904
- class Do extends Ye {
4945
+ class ko extends Xe {
4905
4946
  /**
4906
4947
  * Constructor
4907
4948
  * @param url URL for terrarium raster tilesets
@@ -4935,10 +4976,10 @@ class Do extends Ye {
4935
4976
  return parseInt(o.toFixed(0));
4936
4977
  }
4937
4978
  }
4938
- const _o = (r, t = 8) => {
4979
+ const No = (r, t = 8) => {
4939
4980
  const [e, i] = r, o = Math.pow(10, t), s = Math.round(e * o) / o, n = Math.round(i * o) / o;
4940
4981
  return `${s},${n}`;
4941
- }, Pe = async (r, t, e, i) => {
4982
+ }, Ie = async (r, t, e, i) => {
4942
4983
  const o = [], s = {
4943
4984
  enabled: !0,
4944
4985
  maxSize: 1e3,
@@ -4948,19 +4989,19 @@ const _o = (r, t = 8) => {
4948
4989
  ...e
4949
4990
  };
4950
4991
  let n;
4951
- s.enabled && (n = i || new ze(s.maxSize, s.ttl));
4992
+ s.enabled && (n = i || new $e(s.maxSize, s.ttl));
4952
4993
  let a, l = 15;
4953
4994
  if (t) {
4954
4995
  const d = t.url, c = t.encoding ?? "mapbox", h = t.tileSize ?? 512, u = t.minzoom ?? 5;
4955
4996
  l = t.maxzoom ?? 15;
4956
4997
  const p = t.tms ?? !1;
4957
- a = c === "mapbox" ? new Mo(d, h, u, l, p) : new Do(d, h, u, l, p);
4998
+ a = c === "mapbox" ? new _o(d, h, u, l, p) : new ko(d, h, u, l, p);
4958
4999
  }
4959
5000
  for (const d of r)
4960
5001
  o.push(
4961
5002
  new Promise((c) => {
4962
5003
  d.geometry.type !== "Point" && c(d);
4963
- const h = d.geometry.coordinates, u = _o(h, s.precision);
5004
+ const h = d.geometry.coordinates, u = No(h, s.precision);
4964
5005
  if (n) {
4965
5006
  const p = n.get(u);
4966
5007
  if (p !== void 0) {
@@ -4976,7 +5017,7 @@ const _o = (r, t = 8) => {
4976
5017
  })
4977
5018
  );
4978
5019
  return await Promise.all(o);
4979
- }, Ko = (r, t = 9) => {
5020
+ }, qo = (r, t = 9) => {
4980
5021
  function e(o) {
4981
5022
  return [Number(o[0].toFixed(t)), Number(o[1].toFixed(t))];
4982
5023
  }
@@ -5010,11 +5051,11 @@ const _o = (r, t = 8) => {
5010
5051
  ...o,
5011
5052
  geometry: i(o.geometry)
5012
5053
  }));
5013
- }, ko = [
5054
+ }, To = [
5014
5055
  { value: "time", label: "Time" },
5015
5056
  { value: "distance", label: "Distance" }
5016
5057
  ];
5017
- class No {
5058
+ class Wo {
5018
5059
  url;
5019
5060
  /**
5020
5061
  * Constructor
@@ -5046,15 +5087,15 @@ class No {
5046
5087
  return await (await fetch(l)).json();
5047
5088
  }
5048
5089
  }
5049
- const Tt = [
5090
+ const Bt = [
5050
5091
  { value: "pedestrian", label: "Pedestrian" },
5051
5092
  { value: "bicycle", label: "Bicycle" },
5052
5093
  { value: "auto", label: "Car" }
5053
- ], To = [
5094
+ ], Bo = [
5054
5095
  { value: "kilometers", label: "km" },
5055
5096
  { value: "miles", label: "mile" }
5056
5097
  ];
5057
- class Wo {
5098
+ class jo {
5058
5099
  tripData = [];
5059
5100
  /**
5060
5101
  * get the raw trip data from the valhalla routing API.
@@ -5124,16 +5165,16 @@ class Wo {
5124
5165
  l.trip.legs.forEach((f, P) => {
5125
5166
  const I = this.decodeShape(f.shape);
5126
5167
  h.push(...I), u += Number(f.summary.length.toFixed(2)), p += Number((f.summary.time / 60).toFixed()), g.push(...f.maneuvers);
5127
- const E = y.features[P + 1];
5128
- E.properties = {
5129
- ...E.properties,
5168
+ const b = y.features[P + 1];
5169
+ b.properties = {
5170
+ ...b.properties,
5130
5171
  distance: u,
5131
5172
  distance_unit: i === "kilometers" ? "km" : "mi",
5132
5173
  time: p,
5133
5174
  maneuvers: f.maneuvers
5134
5175
  };
5135
5176
  });
5136
- const m = Tt.find((f) => f.value === e)?.label, v = this.geoLineString(h, {
5177
+ const m = Bt.find((f) => f.value === e)?.label, v = this.geoLineString(h, {
5137
5178
  costingModel: m,
5138
5179
  distance: u,
5139
5180
  distance_unit: i === "kilometers" ? "km" : "mi",
@@ -5208,7 +5249,7 @@ class Wo {
5208
5249
  return n;
5209
5250
  }
5210
5251
  }
5211
- class Ke {
5252
+ class qe {
5212
5253
  controlContainer;
5213
5254
  map;
5214
5255
  modeButtons = {};
@@ -5247,7 +5288,7 @@ class Ke {
5247
5288
  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
5289
  }
5249
5290
  terradraw;
5250
- options = to;
5291
+ options = io;
5251
5292
  events = {};
5252
5293
  defaultMode = "render";
5253
5294
  /**
@@ -5275,7 +5316,7 @@ class Ke {
5275
5316
  if (this.options && this.options.modes && this.options.modes.length === 0)
5276
5317
  throw new Error("At least a mode must be enabled.");
5277
5318
  this.map = t;
5278
- const e = eo(), i = [];
5319
+ const e = oo(), i = [];
5279
5320
  return this.options?.modes?.forEach((o) => {
5280
5321
  if (this.options.modeOptions && this.options.modeOptions[o]) {
5281
5322
  const s = this.options.modeOptions[o];
@@ -5297,8 +5338,8 @@ class Ke {
5297
5338
  modeName: "default",
5298
5339
  styles: {}
5299
5340
  })
5300
- ), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new Zi({
5301
- adapter: new Qi({ map: t, ...this.options.adapterOptions }),
5341
+ ), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new to({
5342
+ adapter: new eo({ map: t, ...this.options.adapterOptions }),
5302
5343
  modes: i
5303
5344
  }), this.map?.loaded() ? this.terradraw.start() : this.map?.once("load", () => {
5304
5345
  this.terradraw?.start();
@@ -5396,7 +5437,7 @@ class Ke {
5396
5437
  */
5397
5438
  addTerradrawButton(t) {
5398
5439
  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", () => {
5440
+ 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 = Pe("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 = Pe(t.replace(/-/g, " ")), t === "delete" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), e.addEventListener("click", () => {
5400
5441
  this.terradraw && this.terradraw.enabled && (this.terradraw.clear(), this.deactivate(), this.toggleDeleteSelectionButton(), this.toggleButtonsWhenNoFeature(), this.dispatchEvent("feature-deleted"));
5401
5442
  })) : t === "delete-selection" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), e.classList.add("hidden-delete-selection"), e.addEventListener("click", () => {
5402
5443
  if (!this.terradraw || !this.terradraw.enabled) return;
@@ -5444,7 +5485,7 @@ class Ke {
5444
5485
  * @returns
5445
5486
  */
5446
5487
  cleanStyle(t, e) {
5447
- return zt(
5488
+ return $t(
5448
5489
  t,
5449
5490
  e,
5450
5491
  et,
@@ -5511,43 +5552,44 @@ class Ke {
5511
5552
  }
5512
5553
  }
5513
5554
  }
5514
- function Bo(r, t = {}) {
5555
+ function Ao(r, t = {}) {
5515
5556
  let e = 0, i = 0, o = 0;
5516
- return Ge(
5557
+ return ze(
5517
5558
  r,
5518
5559
  function(s) {
5519
5560
  e += s[0], i += s[1], o++;
5520
5561
  }
5521
- ), so([e / o, i / o], t.properties);
5562
+ ), no([e / o, i / o], t.properties);
5522
5563
  }
5523
- class Xo extends Ke {
5564
+ class Jo extends qe {
5524
5565
  measureOptions;
5525
5566
  elevationCache;
5526
5567
  /**
5527
- * The unit of distance can be degrees, radians, miles, or kilometers (default 'kilometers')
5568
+ * The unit of measurement can be metric or imperial. Default is metric.
5528
5569
  * The measuring result will be recalculated once new value is set
5529
5570
  */
5530
- get distanceUnit() {
5531
- return this.measureOptions.distanceUnit ?? "kilometers";
5571
+ get measureUnitType() {
5572
+ return this.measureOptions.measureUnitType ?? "metric";
5532
5573
  }
5533
- set distanceUnit(t) {
5534
- const e = this.measureOptions.distanceUnit === t;
5535
- this.measureOptions.distanceUnit = t, e || this.recalc();
5574
+ set measureUnitType(t) {
5575
+ const e = this.measureOptions.measureUnitType === t;
5576
+ this.measureOptions.measureUnitType = t, e || this.recalc();
5536
5577
  }
5537
5578
  /**
5538
5579
  * The precision of distance value. It will be set different value when distance unit is changed. Using setter to override the value if you want.
5539
5580
  */
5540
5581
  get distancePrecision() {
5541
- let t = 2;
5542
- return this.measureOptions.distanceUnit === "degrees" && (t = 6), this.measureOptions.distancePrecision ?? t;
5582
+ return this.measureOptions.distancePrecision ?? 2;
5543
5583
  }
5544
5584
  set distancePrecision(t) {
5545
5585
  const e = this.measureOptions.distancePrecision === t;
5546
5586
  this.measureOptions.distancePrecision = t, e || this.recalc();
5547
5587
  }
5548
5588
  /**
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.
5589
+ * Default is `auto`. If `auto` is set, the unit is converted automatically based on the value.
5590
+ * If a specific unit is specified (e.g., 'km', 'm', 'cm', 'mi', 'ft', 'in'), the value is always returned in that unit.
5591
+ * This property is only effective when `distanceUnit` is set to 'kilometers' or 'miles'.
5592
+ * If `distanceUnit` is set to other values (e.g., 'degrees', 'radians'), it will be ignored, and `auto` will be applied.
5551
5593
  * If you need to force other unit type, please use DistanceUnit property.
5552
5594
  */
5553
5595
  get forceDistanceUnit() {
@@ -5557,17 +5599,6 @@ class Xo extends Ke {
5557
5599
  const e = this.measureOptions.forceDistanceUnit === t;
5558
5600
  this.measureOptions.forceDistanceUnit = t, e || this.recalc();
5559
5601
  }
5560
- /**
5561
- * The unit of area can be metric (m², ha, km²) or imperial (yd², acre, mi²). Default is metric.
5562
- * The measuring result will be recalculated once new value is set
5563
- */
5564
- get areaUnit() {
5565
- return this.measureOptions.areaUnit ?? "metric";
5566
- }
5567
- set areaUnit(t) {
5568
- const e = this.measureOptions.areaUnit === t;
5569
- this.measureOptions.areaUnit = t, e || this.recalc();
5570
- }
5571
5602
  /**
5572
5603
  * The precision of area value. Using setter to override the value if you want.
5573
5604
  */
@@ -5588,6 +5619,16 @@ class Xo extends Ke {
5588
5619
  const e = this.measureOptions.forceAreaUnit === t;
5589
5620
  this.measureOptions.forceAreaUnit = t, e || this.recalc();
5590
5621
  }
5622
+ /**
5623
+ * Measure unit symbols. If you want to change the default symbol, please overwrite the symbol by this option.
5624
+ */
5625
+ get measureUnitSymbols() {
5626
+ return this.measureOptions.measureUnitSymbols ?? JSON.parse(JSON.stringify(bt));
5627
+ }
5628
+ set measureUnitSymbols(t) {
5629
+ const e = JSON.stringify(this.measureOptions.measureUnitSymbols) === JSON.stringify(t);
5630
+ this.measureOptions.measureUnitSymbols = t, e || this.recalc();
5631
+ }
5591
5632
  /**
5592
5633
  * The flag of whether computing elevation. Default is false.
5593
5634
  * Using setter to override the value if you want.
@@ -5650,7 +5691,7 @@ class Xo extends Ke {
5650
5691
  open: e.open,
5651
5692
  modeOptions: e.modeOptions,
5652
5693
  adapterOptions: e.adapterOptions
5653
- }), this._cssPrefix = "measure-", this.measureOptions = e, this.measureOptions.elevationCacheConfig && this.measureOptions.elevationCacheConfig?.enabled && (this.elevationCache = new ze(
5694
+ }), this._cssPrefix = "measure-", this.measureOptions = e, this.measureOptions.elevationCacheConfig && this.measureOptions.elevationCacheConfig?.enabled && (this.elevationCache = new $e(
5654
5695
  this.measureOptions.elevationCacheConfig.maxSize,
5655
5696
  this.measureOptions.elevationCacheConfig.ttl
5656
5697
  ));
@@ -5721,7 +5762,7 @@ class Xo extends Ke {
5721
5762
  const s = this.measureOptions.lineLayerLabelSpec?.source;
5722
5763
  s && i.push(s);
5723
5764
  const n = this.measureOptions.pointLayerLabelSpec?.source;
5724
- return n && i.push(n), zt(
5765
+ return n && i.push(n), $t(
5725
5766
  t,
5726
5767
  e,
5727
5768
  i,
@@ -5804,7 +5845,7 @@ class Xo extends Ke {
5804
5845
  * Handle finish event of terradraw. It will be called after finishing adding a feature
5805
5846
  * @param id Feature ID
5806
5847
  */
5807
- handleTerradrawFeatureReady = Ue((t) => {
5848
+ handleTerradrawFeatureReady = Ve((t) => {
5808
5849
  this.map && (this.computeElevationByLineFeatureID(t), this.computeElevationByPointFeatureID(t));
5809
5850
  }, 300);
5810
5851
  /**
@@ -5903,7 +5944,7 @@ class Xo extends Ke {
5903
5944
  (o) => o.properties?.originalId === t && o.geometry.type === "Point"
5904
5945
  );
5905
5946
  if (i && i.length > 0) {
5906
- const o = await Pe(
5947
+ const o = await Ie(
5907
5948
  i,
5908
5949
  this.measureOptions.terrainSource,
5909
5950
  this.measureOptions.elevationCacheConfig,
@@ -5930,7 +5971,7 @@ class Xo extends Ke {
5930
5971
  (o) => o.id === t && o.geometry.type === "Point" && o.properties?.mode === "point"
5931
5972
  );
5932
5973
  if (i && i.length > 0) {
5933
- const o = await Pe(
5974
+ const o = await Ie(
5934
5975
  i,
5935
5976
  this.measureOptions.terrainSource,
5936
5977
  this.measureOptions.elevationCacheConfig,
@@ -5961,7 +6002,13 @@ class Xo extends Ke {
5961
6002
  (a) => a.properties?.originalId !== t
5962
6003
  ));
5963
6004
  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(
6005
+ n.id = n.id + "-area-label", n.geometry = Ao(o.geometry).geometry, n.properties.originalId = o.id, o = me(
6006
+ o,
6007
+ this.measureUnitType,
6008
+ this.areaPrecision,
6009
+ this.forceAreaUnit,
6010
+ this.measureUnitSymbols
6011
+ ), 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
6012
  this.measureOptions.polygonLayerSpec.source
5966
6013
  )?.setData(s.data), this.map.moveLayer(this.measureOptions.polygonLayerSpec.id), this.map.getLayer(this.measureOptions.lineLayerLabelSpec.id) && this.map.moveLayer(
5967
6014
  this.measureOptions.lineLayerLabelSpec.id
@@ -5991,11 +6038,12 @@ class Xo extends Ke {
5991
6038
  if (s) {
5992
6039
  typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter(
5993
6040
  (a) => a.properties?.originalId !== t
5994
- )), o = me(
6041
+ )), o = Ce(
5995
6042
  o,
5996
- this.distanceUnit,
6043
+ this.measureUnitType,
5997
6044
  this.distancePrecision,
5998
6045
  this.forceDistanceUnit,
6046
+ this.measureUnitSymbols,
5999
6047
  this.map,
6000
6048
  this.computeElevation,
6001
6049
  this.measureOptions.terrainSource
@@ -6039,7 +6087,7 @@ class Xo extends Ke {
6039
6087
  let o = e.getSnapshot()?.find((s) => s.id === t && s.geometry.type === "Point");
6040
6088
  if (o) {
6041
6089
  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(
6090
+ s && (typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter((n) => n.id !== t)), o = Se(
6043
6091
  o,
6044
6092
  this.map,
6045
6093
  this.computeElevation,
@@ -6084,15 +6132,22 @@ class Xo extends Ke {
6084
6132
  const o = e.features[i];
6085
6133
  if (!this.map || !this.map.loaded()) continue;
6086
6134
  const s = o.geometry.type;
6087
- s === "LineString" ? e.features[i] = me(
6135
+ s === "LineString" ? e.features[i] = Ce(
6088
6136
  o,
6089
- this.distanceUnit,
6137
+ this.measureUnitType,
6090
6138
  this.distancePrecision,
6091
6139
  this.forceDistanceUnit,
6140
+ this.measureUnitSymbols,
6092
6141
  this.map,
6093
6142
  this.computeElevation,
6094
6143
  this.measureOptions.terrainSource
6095
- ) : s === "Polygon" ? e.features[i] = ye(o, this.areaUnit, this.areaPrecision, this.forceAreaUnit) : s === "Point" && (e.features[i] = Ce(
6144
+ ) : s === "Polygon" ? e.features[i] = me(
6145
+ o,
6146
+ this.measureUnitType,
6147
+ this.areaPrecision,
6148
+ this.forceAreaUnit,
6149
+ this.measureUnitSymbols
6150
+ ) : s === "Point" && (e.features[i] = Se(
6096
6151
  o,
6097
6152
  this.map,
6098
6153
  this.computeElevation,
@@ -6102,7 +6157,7 @@ class Xo extends Ke {
6102
6157
  return e;
6103
6158
  }
6104
6159
  }
6105
- class Ho extends Ke {
6160
+ class Ho extends qe {
6106
6161
  controlOptions;
6107
6162
  valhallaOptions;
6108
6163
  _modalDialog;
@@ -6301,13 +6356,13 @@ class Ho extends Ke {
6301
6356
  const i = et, o = this.controlOptions.routingLineLayerNodeSpec?.source;
6302
6357
  o && i.push(o);
6303
6358
  const s = this.controlOptions.isochronePolygonLayerSpec?.source;
6304
- return s && i.push(s), zt(t, e, i, this.options.adapterOptions?.prefixId);
6359
+ return s && i.push(s), $t(t, e, i, this.options.adapterOptions?.prefixId);
6305
6360
  }
6306
6361
  /**
6307
6362
  * Create the settings dialog for Valhalla control
6308
6363
  */
6309
6364
  createSettingsDialog() {
6310
- this.settingDialog = new fo(
6365
+ this.settingDialog = new vo(
6311
6366
  `maplibregl-terradraw-${this.cssPrefix}settings-dialog`,
6312
6367
  "Settings"
6313
6368
  ), this.settingDialog.create(
@@ -6349,7 +6404,7 @@ class Ho extends Ke {
6349
6404
  const i = document.createElement("label");
6350
6405
  i.textContent = "Means of Transport", i.classList.add("setting-label"), e.appendChild(i), e.appendChild(
6351
6406
  this.settingDialog.createSegmentButtons(
6352
- Tt,
6407
+ Bt,
6353
6408
  this.routingCostingModel,
6354
6409
  (n) => {
6355
6410
  this.valhallaOptions.routingOptions || (this.valhallaOptions.routingOptions = {}), this.valhallaOptions.routingOptions.costingModel = n, this.dispatchEvent("setting-changed");
@@ -6361,7 +6416,7 @@ class Ho extends Ke {
6361
6416
  const s = document.createElement("label");
6362
6417
  return s.textContent = "Distance Unit", s.classList.add("setting-label"), o.appendChild(s), o.appendChild(
6363
6418
  this.settingDialog.createSegmentButtons(
6364
- To,
6419
+ Bo,
6365
6420
  this.routingDistanceUnit,
6366
6421
  (n) => {
6367
6422
  this.valhallaOptions.routingOptions || (this.valhallaOptions.routingOptions = {}), this.valhallaOptions.routingOptions.distanceUnit = n, this.dispatchEvent("setting-changed");
@@ -6378,7 +6433,7 @@ class Ho extends Ke {
6378
6433
  const i = document.createElement("label");
6379
6434
  i.textContent = "Contour Type", i.classList.add("setting-label"), e.appendChild(i), e.appendChild(
6380
6435
  this.settingDialog.createSegmentButtons(
6381
- ko,
6436
+ To,
6382
6437
  this.controlOptions.valhallaOptions?.isochroneOptions?.contourType || "time",
6383
6438
  (d) => {
6384
6439
  this.valhallaOptions.isochroneOptions || (this.valhallaOptions.isochroneOptions = {}), this.valhallaOptions.isochroneOptions.contourType = d, this.dispatchEvent("setting-changed");
@@ -6390,7 +6445,7 @@ class Ho extends Ke {
6390
6445
  const s = document.createElement("label");
6391
6446
  s.textContent = "Means of Transport", s.classList.add("setting-label"), o.appendChild(s), o.appendChild(
6392
6447
  this.settingDialog.createSegmentButtons(
6393
- Tt,
6448
+ Bt,
6394
6449
  this.controlOptions.valhallaOptions?.isochroneOptions?.costingModel || "auto",
6395
6450
  (d) => {
6396
6451
  this.valhallaOptions.isochroneOptions || (this.valhallaOptions.isochroneOptions = {}), this.valhallaOptions.isochroneOptions.costingModel = d, this.dispatchEvent("setting-changed");
@@ -6573,14 +6628,14 @@ class Ho extends Ke {
6573
6628
  * Handle finish event of terradraw. It will be called after finishing adding a feature
6574
6629
  * @param id Feature ID
6575
6630
  */
6576
- handleTerradrawFeatureReady = Ue((t) => {
6631
+ handleTerradrawFeatureReady = Ve((t) => {
6577
6632
  this.map && (this.computeRouteByLineFeatureID(t), this.computeIsochroneByPointFeatureID(t));
6578
6633
  }, 300);
6579
6634
  computeIsochroneByPointFeatureID = async (t) => {
6580
6635
  if (!this.map || !this.valhallaOptions.url) return;
6581
6636
  const e = this.terradraw?.getSnapshotFeature(t);
6582
6637
  if (!e || e && e.geometry.type !== "Point") return;
6583
- const i = e.geometry.coordinates, n = (await new No(this.valhallaUrl).calcIsochrone(
6638
+ const i = e.geometry.coordinates, n = (await new Wo(this.valhallaUrl).calcIsochrone(
6584
6639
  i[0],
6585
6640
  i[1],
6586
6641
  this.isochroneContourType,
@@ -6614,9 +6669,9 @@ class Ho extends Ke {
6614
6669
  if (!this.map || !this.valhallaOptions.url) return;
6615
6670
  const e = this.terradraw?.getSnapshotFeature(t);
6616
6671
  if (!e || e && e.geometry.type !== "LineString") return;
6617
- const i = new Wo(this.valhallaUrl), o = e.geometry.coordinates.map((c) => {
6672
+ const i = new jo(this.valhallaUrl), o = e.geometry.coordinates.map((c) => {
6618
6673
  const h = c;
6619
- return new Xe(h[0], h[1]);
6674
+ return new Je(h[0], h[1]);
6620
6675
  });
6621
6676
  if (!o || o && o.length < 2) return;
6622
6677
  const s = await i.calcRoute(
@@ -6685,34 +6740,35 @@ class Ho extends Ke {
6685
6740
  }
6686
6741
  }
6687
6742
  export {
6688
- zo as AvailableModes,
6689
- Vo as AvailableValhallaModes,
6690
- Xo as MaplibreMeasureControl,
6691
- Ke as MaplibreTerradrawControl,
6743
+ $o as AvailableModes,
6744
+ Yo as AvailableValhallaModes,
6745
+ Jo as MaplibreMeasureControl,
6746
+ qe as MaplibreTerradrawControl,
6692
6747
  Ho as MaplibreValhallaControl,
6693
- ze as MemoryCache,
6694
- fo as ModalDialog,
6695
- $o as TERRADRAW_MEASURE_SOURCE_IDS,
6748
+ $e as MemoryCache,
6749
+ vo as ModalDialog,
6750
+ Ko as TERRADRAW_MEASURE_SOURCE_IDS,
6696
6751
  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,
6752
+ Xo as TERRADRAW_VALHALLA_SOURCE_IDS,
6753
+ Wo as ValhallaIsochrone,
6754
+ jo as ValhallaRouting,
6755
+ me as calcArea,
6756
+ Ce as calcDistance,
6757
+ Pe as capitalize,
6758
+ $t as cleanMaplibreStyle,
6759
+ To as contourTypeOptions,
6760
+ yo as convertAreaUnit,
6761
+ _t as convertDistance,
6762
+ Bt as costingModelOptions,
6763
+ Ve as debounce,
6764
+ io as defaultControlOptions,
6710
6765
  lt as defaultMeasureControlOptions,
6766
+ bt as defaultMeasureUnitSymbols,
6711
6767
  z as defaultValhallaControlOptions,
6712
- eo as getDefaultModeOptions,
6713
- Ce as queryElevationByPoint,
6714
- Pe as queryElevationFromRasterDEM,
6715
- Ko as roundFeatureCoordinates,
6716
- To as routingDistanceUnitOptions
6768
+ oo as getDefaultModeOptions,
6769
+ Se as queryElevationByPoint,
6770
+ Ie as queryElevationFromRasterDEM,
6771
+ qo as roundFeatureCoordinates,
6772
+ Bo as routingDistanceUnitOptions
6717
6773
  };
6718
6774
  //# sourceMappingURL=maplibre-gl-terradraw.es.js.map