@watergis/maplibre-gl-terradraw 1.7.2 → 1.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { LngLat as Ze } from "maplibre-gl";
1
+ import { LngLat as Xe } 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++) {
@@ -12,25 +12,25 @@ var b;
12
12
  (function(r) {
13
13
  r.Commit = "commit", r.Provisional = "provisional", r.Finish = "finish";
14
14
  })(b || (b = {}));
15
- const k = { SELECTED: "selected", MID_POINT: "midPoint", SELECTION_POINT_FEATURE_ID: "selectionPointFeatureId", SELECTION_POINT: "selectionPoint" }, D = "currentlyDrawing", z = "edited", J = "closingPoint", xt = "snappingPoint", It = "coordinatePoint", Qe = "coordinatePointFeatureId", ht = "coordinatePointIds", T = 10;
16
- function Ft(r) {
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 Ot(r) {
17
17
  return !!(r && typeof r == "object" && r !== null && !Array.isArray(r));
18
18
  }
19
- function te(r) {
19
+ function Jt(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 ee(r) {
22
+ function qt(r) {
23
23
  return !!(function(t) {
24
24
  return typeof t == "number" && !isNaN(new Date(t).valueOf());
25
25
  })(r);
26
26
  }
27
- const ti = "Feature mode property does not match the mode being added to";
28
- var q;
27
+ const He = "Feature mode property does not match the mode being added to";
28
+ var H;
29
29
  (function(r) {
30
30
  r.Drawing = "drawing", r.Select = "select", r.Static = "static", r.Render = "render";
31
- })(q || (q = {}));
32
- const ei = { rightClick: !0, contextMenu: !1, leftClick: !0, onDragStart: !0, onDrag: !0, onDragEnd: !0 };
33
- let G = class {
31
+ })(H || (H = {}));
32
+ const Je = { rightClick: !0, contextMenu: !1, leftClick: !0, onDragStart: !0, onDrag: !0, onDragEnd: !0 };
33
+ class A {
34
34
  get state() {
35
35
  return this._state;
36
36
  }
@@ -47,7 +47,7 @@ let G = class {
47
47
  registerBehaviors(t) {
48
48
  }
49
49
  constructor(t, e = !1) {
50
- this._state = "unregistered", this._styles = {}, this.pointerEvents = ei, 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);
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);
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 @@ let G = class {
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 (Ft(i)) if (i.id == null) s = "Feature has no id";
85
+ if (Ot(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 (Ft(i.geometry)) if (Ft(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 (Ot(i.geometry)) if (Ot(i.properties)) if (typeof i.geometry.type == "string" && ["Polygon", "LineString", "Point"].includes(i.geometry.type)) if (Array.isArray(i.geometry.coordinates)) {
88
88
  if (!i.properties.mode || typeof i.properties.mode != "string") return { valid: !1, reason: "Feature does not have a valid mode property" };
89
89
  } else s = "Feature coordinates is not an array";
90
90
  else s = "Feature is not Point, LineString or Polygon";
@@ -102,7 +102,7 @@ let G = class {
102
102
  }
103
103
  validateModeFeature(t, e) {
104
104
  const i = this.performFeatureValidation(t);
105
- return i.valid ? t.properties.mode !== this.mode ? { valid: !1, reason: ti } : e(t) : { valid: !1, reason: i.reason };
105
+ return i.valid ? t.properties.mode !== this.mode ? { valid: !1, reason: He } : e(t) : { valid: !1, reason: i.reason };
106
106
  }
107
107
  onFinish(t, e) {
108
108
  }
@@ -133,44 +133,44 @@ let G = class {
133
133
  getStylingValue(t, e, i) {
134
134
  return t === void 0 ? e : typeof t == "function" ? t(i) : t;
135
135
  }
136
- };
137
- class ii extends G {
136
+ }
137
+ let qe = class extends A {
138
138
  constructor(...t) {
139
- super(...t), this.type = q.Select;
139
+ super(...t), this.type = H.Select;
140
140
  }
141
- }
142
- function R(r, t) {
141
+ };
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 Ee = 63710088e-1;
147
- function M(r) {
146
+ const Se = 63710088e-1;
147
+ function D(r) {
148
148
  return r % 360 * Math.PI / 180;
149
149
  }
150
- function we(r) {
150
+ function Ie(r) {
151
151
  return r / 6371.0088;
152
152
  }
153
- function $(r) {
153
+ function V(r) {
154
154
  return r % (2 * Math.PI) * 180 / Math.PI;
155
155
  }
156
156
  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 ie = 57.29577951308232, oe = 0.017453292519943295, bt = 6378137, I = (r, t) => ({ x: r === 0 ? 0 : r * oe * bt, y: t === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + t * oe / 2)) * bt }), A = (r, t) => ({ lng: r === 0 ? 0 : ie * (r / bt), lat: t === 0 ? 0 : (2 * Math.atan(Math.exp(t / bt)) - Math.PI / 2) * ie });
161
- function oi(r, t, e) {
162
- const i = M(r[0]), o = M(r[1]), s = M(e), n = we(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(s));
163
- return [$(i + Math.atan2(Math.sin(s) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), $(a)];
160
+ const Zt = 57.29577951308232, Qt = 0.017453292519943295, Ct = 6378137, O = (r, t) => ({ x: r === 0 ? 0 : r * Qt * Ct, y: t === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + t * Qt / 2)) * Ct }), R = (r, t) => ({ lng: r === 0 ? 0 : Zt * (r / Ct), lat: t === 0 ? 0 : (2 * Math.atan(Math.exp(t / Ct)) - Math.PI / 2) * Zt });
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));
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 se(r) {
165
+ function te(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 = oi(t, e, -360 * n / o);
168
+ const a = Ze(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 Gt(r) {
173
+ function Tt(r) {
174
174
  let t;
175
175
  if (r.geometry.type === "Polygon") t = r.geometry.coordinates;
176
176
  else {
@@ -184,58 +184,58 @@ function Gt(r) {
184
184
  return s < 0 || s > 1;
185
185
  }
186
186
  function o(s, n, a, l) {
187
- const d = t[s][n], c = t[s][n + 1], h = t[a][l], u = t[a][l + 1], p = (function(m, v, C, f) {
188
- if (mt(m, C) || mt(m, f) || mt(v, C) || mt(f, C)) return null;
189
- const P = m[0], S = m[1], E = v[0], O = v[1], F = C[0], N = C[1], _ = f[0], B = f[1], K = (P - E) * (N - B) - (S - O) * (F - _);
190
- return K === 0 ? null : [((P * O - S * E) * (F - _) - (P - E) * (F * B - N * _)) / K, ((P * O - S * E) * (N - B) - (S - O) * (F * B - N * _)) / K];
191
- })(d, c, h, u);
192
- if (p === null) return;
187
+ const d = t[s][n], c = t[s][n + 1], h = t[a][l], p = t[a][l + 1], u = (function(m, v, C, f) {
188
+ 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 * _)) / $];
191
+ })(d, c, h, p);
192
+ if (u === null) return;
193
193
  let g, y;
194
- g = c[0] !== d[0] ? (p[0] - d[0]) / (c[0] - d[0]) : (p[1] - d[1]) / (c[1] - d[1]), y = u[0] !== h[0] ? (p[0] - h[0]) / (u[0] - h[0]) : (p[1] - h[1]) / (u[1] - h[1]), i(g) || i(y) || (p.toString(), e.push(p));
194
+ g = c[0] !== d[0] ? (u[0] - d[0]) / (c[0] - d[0]) : (u[1] - d[1]) / (c[1] - d[1]), y = p[0] !== h[0] ? (u[0] - h[0]) / (p[0] - h[0]) : (u[1] - h[1]) / (p[1] - h[1]), i(g) || i(y) || (u.toString(), e.push(u));
195
195
  }
196
196
  }
197
- function mt(r, t) {
197
+ function gt(r, t) {
198
198
  return r[0] === t[0] && r[1] === t[1];
199
199
  }
200
- function Ot(r, t) {
201
- return re(r[0]) <= t && re(r[1]) <= t;
200
+ function It(r, t) {
201
+ return ee(r[0]) <= t && ee(r[1]) <= t;
202
202
  }
203
- function At(r) {
203
+ function Wt(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 re(r) {
207
+ function ee(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 si = "Feature has holes", ri = "Feature has less than 4 coordinates", ni = "Feature has invalid coordinates", ai = "Feature coordinates are not closed";
213
- function Lt(r, t) {
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 xt(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: si };
216
- if (r.geometry.coordinates[0].length < 4) return { valid: !1, reason: ri };
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 };
217
217
  for (let o = 0; o < r.geometry.coordinates[0].length; o++) {
218
- if (!At(r.geometry.coordinates[0][o])) return { valid: !1, reason: ni };
219
- if (!Ot(r.geometry.coordinates[0][o], t)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
218
+ if (!Wt(r.geometry.coordinates[0][o])) return { valid: !1, reason: ei };
219
+ if (!It(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: ai } : { 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: ii } : { valid: !0 };
222
222
  var e, i;
223
223
  }
224
- function yt(r, t) {
225
- const e = Lt(r, t);
226
- return e.valid ? Gt(r) ? { valid: !1, reason: "Feature intersects itself" } : { valid: !0 } : e;
224
+ function ut(r, t) {
225
+ const e = xt(r, t);
226
+ return e.valid ? Tt(r) ? { valid: !1, reason: "Feature intersects itself" } : { valid: !0 } : e;
227
227
  }
228
- const li = { cancel: "Escape", finish: "Enter" }, di = { start: "crosshair" };
229
- class Oe extends G {
228
+ const oi = { cancel: "Escape", finish: "Enter" }, si = { start: "crosshair" };
229
+ let xe = 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 = li, this.cursors = di, 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 = oi, this.cursors = si, 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);
235
235
  }
236
236
  close() {
237
237
  if (this.currentCircleId === void 0) return;
238
- this.store.updateProperty([{ id: this.currentCircleId, property: D, value: void 0 }]);
238
+ this.store.updateProperty([{ id: this.currentCircleId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
239
239
  const t = this.currentCircleId;
240
240
  if (this.validate && t) {
241
241
  const e = this.store.getGeometryCopy(t);
@@ -252,7 +252,7 @@ class Oe extends G {
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 = se({ center: this.center, radiusKilometers: this.startingRadiusKilometers, coordinatePrecision: this.coordinatePrecision }), [i] = this.store.create([{ geometry: e.geometry, properties: { mode: this.mode, radiusKilometers: this.startingRadiusKilometers, [D]: !0 } }]);
255
+ const e = te({ center: this.center, radiusKilometers: this.startingRadiusKilometers, coordinatePrecision: this.coordinatePrecision }), [i] = this.store.create([{ geometry: e.geometry, properties: { mode: this.mode, radiusKilometers: this.startingRadiusKilometers, [S.CURRENTLY_DRAWING]: !0 } }]);
256
256
  this.currentCircleId = i, this.clickCount++, this.cursorMovedAfterInitialCursorDown = !1, this.setDrawing();
257
257
  } else this.clickCount === 1 && this.center && this.currentCircleId !== void 0 && this.cursorMovedAfterInitialCursorDown && this.updateCircle(t), this.close();
258
258
  }
@@ -280,33 +280,33 @@ class Oe extends G {
280
280
  }
281
281
  styleFeature(t) {
282
282
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
283
- 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 = T), e;
283
+ 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;
284
284
  }
285
285
  validateFeature(t) {
286
- return this.validateModeFeature(t, (e) => yt(e, this.coordinatePrecision));
286
+ return this.validateModeFeature(t, (e) => ut(e, this.coordinatePrecision));
287
287
  }
288
288
  updateCircle(t) {
289
289
  if (this.clickCount === 1 && this.center && this.currentCircleId) {
290
- const e = R(this.center, [t.lng, t.lat]);
290
+ const e = U(this.center, [t.lng, t.lat]);
291
291
  let i;
292
292
  if (this.projection === "web-mercator") {
293
293
  const o = (function(s, n) {
294
- const a = 1e3 * R(s, n);
294
+ const a = 1e3 * U(s, n);
295
295
  if (a === 0) return 1;
296
- const { x: l, y: d } = I(s[0], s[1]), { x: c, y: h } = I(n[0], n[1]);
296
+ const { x: l, y: d } = O(s[0], s[1]), { x: c, y: h } = O(n[0], n[1]);
297
297
  return Math.sqrt(Math.pow(c - l, 2) + Math.pow(h - d, 2)) / a;
298
298
  })(this.center, [t.lng, t.lat]);
299
299
  i = (function(s) {
300
- const { center: n, radiusKilometers: a, coordinatePrecision: l } = s, d = s.steps ? s.steps : 64, c = 1e3 * a, [h, u] = n, { x: p, y: g } = I(h, u), y = [];
300
+ const { center: n, radiusKilometers: a, coordinatePrecision: l } = s, d = s.steps ? s.steps : 64, c = 1e3 * a, [h, p] = n, { x: u, y: g } = O(h, p), y = [];
301
301
  for (let m = 0; m < d; m++) {
302
- const v = 360 * m / d * Math.PI / 180, C = c * Math.cos(v), f = c * Math.sin(v), [P, S] = [p + C, g + f], { lng: E, lat: O } = A(P, S);
303
- y.push([w(E, l), w(O, l)]);
302
+ const v = 360 * m / d * Math.PI / 180, C = c * Math.cos(v), f = c * Math.sin(v), [P, I] = [u + C, g + f], { lng: E, lat: L } = R(P, I);
303
+ y.push([w(E, l), w(L, l)]);
304
304
  }
305
305
  return y.push(y[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [y] }, properties: {} };
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 = se({ center: this.center, radiusKilometers: e, coordinatePrecision: this.coordinatePrecision });
309
+ i = te({ center: this.center, radiusKilometers: e, coordinatePrecision: this.coordinatePrecision });
310
310
  }
311
311
  if (this.validate && !this.validate({ type: "Feature", id: this.currentCircleId, geometry: i.geometry, properties: { radiusKilometers: e } }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid) return;
312
312
  this.store.updateGeometry([{ id: this.currentCircleId, geometry: i.geometry }]), this.store.updateProperty([{ id: this.currentCircleId, property: "radiusKilometers", value: e }]);
@@ -315,12 +315,12 @@ class Oe extends G {
315
315
  afterFeatureUpdated(t) {
316
316
  this.currentCircleId === t.id && (this.cursorMovedAfterInitialCursorDown = !1, this.center = void 0, this.currentCircleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted());
317
317
  }
318
- }
319
- const L = (r, t) => {
318
+ };
319
+ const F = (r, t) => {
320
320
  const { x: e, y: i } = r, { x: o, y: s } = t, n = o - e, a = s - i;
321
321
  return Math.sqrt(a * a + n * n);
322
322
  };
323
- function ft(r) {
323
+ function pt(r) {
324
324
  if (!(function(e) {
325
325
  const i = e.coordinates[0];
326
326
  let o = 0;
@@ -331,10 +331,10 @@ function ft(r) {
331
331
  return o < 0;
332
332
  })(r)) return { type: "Polygon", coordinates: [r.coordinates[0].reverse()] };
333
333
  }
334
- const ci = { cancel: "Escape", finish: "Enter" }, hi = { start: "crosshair", close: "pointer" };
335
- class Le extends G {
334
+ const ri = { cancel: "Escape", finish: "Enter" }, ni = { start: "crosshair", close: "pointer" };
335
+ class Oe 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 = ci, this.cursors = hi, 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 = ri, this.cursors = ni, 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));
@@ -342,8 +342,8 @@ class Le extends G {
342
342
  close() {
343
343
  if (this.currentId === void 0) return;
344
344
  if (this.currentId) {
345
- const e = ft(this.store.getGeometryCopy(this.currentId));
346
- e && this.store.updateGeometry([{ id: this.currentId, geometry: e }]), this.store.updateProperty([{ id: this.currentId, property: D, value: void 0 }]);
345
+ const e = pt(this.store.getGeometryCopy(this.currentId));
346
+ e && this.store.updateGeometry([{ id: this.currentId, geometry: e }]), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
347
347
  }
348
348
  const t = this.currentId;
349
349
  if (this.validate && t) {
@@ -360,22 +360,22 @@ class Le extends G {
360
360
  }
361
361
  onMouseMove(t) {
362
362
  if (this.currentId === void 0 || this.startingClick === !1) return void this.setCursor(this.cursors.start);
363
- const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates[0].length - 2, [o, s] = e.coordinates[0][i], { x: n, y: a } = this.project(o, s), l = L({ x: n, y: a }, { x: t.containerX, y: t.containerY }), [d, c] = e.coordinates[0][0], { x: h, y: u } = this.project(d, c);
364
- if (L({ x: h, y: u }, { x: t.containerX, y: t.containerY }) < this.pointerDistance) {
363
+ const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates[0].length - 2, [o, s] = e.coordinates[0][i], { x: n, y: a } = this.project(o, s), l = F({ x: n, y: a }, { x: t.containerX, y: t.containerY }), [d, c] = e.coordinates[0][0], { x: h, y: p } = this.project(d, c);
364
+ if (F({ x: h, y: p }, { x: t.containerX, y: t.containerY }) < this.pointerDistance) {
365
365
  if (this.autoClose && this.hasLeftStartingPoint && (this.preventNewFeature = !0, setTimeout(() => {
366
366
  this.preventNewFeature = !1;
367
367
  }, this.autoCloseTimeout), this.close()), this.setCursor(this.cursors.close), this.preventPointsNearClose) return;
368
368
  } else this.hasLeftStartingPoint = !0, this.setCursor(this.cursors.start);
369
369
  if (l < this.minDistance) return;
370
370
  e.coordinates[0].pop();
371
- const p = { type: "Polygon", coordinates: [[...e.coordinates[0], [t.lng, t.lat], e.coordinates[0][0]]] };
372
- this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: p, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || this.store.updateGeometry([{ id: this.currentId, geometry: p }]);
371
+ const u = { type: "Polygon", coordinates: [[...e.coordinates[0], [t.lng, t.lat], e.coordinates[0][0]]] };
372
+ this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: u, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || this.store.updateGeometry([{ id: this.currentId, geometry: u }]);
373
373
  }
374
374
  onClick(t) {
375
375
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) {
376
376
  if (this.preventNewFeature) return;
377
377
  if (this.startingClick === !1) {
378
- const [e, i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [D]: !0 } }, { geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: { mode: this.mode, [J]: !0 } }]);
378
+ const [e, i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }, { geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
379
379
  return this.currentId = e, this.closingPointId = i, this.startingClick = !0, void (this.state !== "drawing" && this.setDrawing());
380
380
  }
381
381
  this.close();
@@ -402,43 +402,43 @@ class Le extends G {
402
402
  }
403
403
  styleFeature(t) {
404
404
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
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 = T, 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);
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) => Lt(e, this.coordinatePrecision));
408
+ return this.validateModeFeature(t, (e) => xt(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);
412
412
  }
413
413
  }
414
- class W {
414
+ let B = class {
415
415
  constructor({ store: t, mode: e, project: i, unproject: o, pointerDistance: s, coordinatePrecision: n, projection: a }) {
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
- }
419
- function Fe({ unproject: r, point: t, pointerDistance: e }) {
418
+ };
419
+ function be({ 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
  }
423
- class ut extends W {
423
+ class dt extends B {
424
424
  constructor(t) {
425
425
  super(t);
426
426
  }
427
427
  create(t) {
428
428
  const { containerX: e, containerY: i } = t;
429
- return Fe({ unproject: this.unproject, point: { x: e, y: i }, pointerDistance: this.pointerDistance });
429
+ return be({ unproject: this.unproject, point: { x: e, y: i }, pointerDistance: this.pointerDistance });
430
430
  }
431
431
  }
432
- class pt extends W {
432
+ class ct extends B {
433
433
  constructor(t) {
434
434
  super(t);
435
435
  }
436
436
  measure(t, e) {
437
437
  const { x: i, y: o } = this.project(e[0], e[1]);
438
- return L({ x: i, y: o }, { x: t.containerX, y: t.containerY });
438
+ return F({ x: i, y: o }, { x: t.containerX, y: t.containerY });
439
439
  }
440
440
  }
441
- class Et extends W {
441
+ let Pt = 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
  }
@@ -457,64 +457,64 @@ class Et extends W {
457
457
  });
458
458
  }), s;
459
459
  }
460
+ };
461
+ function ie(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));
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)];
460
464
  }
461
- function ne(r, t, e) {
462
- const i = M(r[0]), o = M(r[1]), s = M(e), n = we(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(s));
463
- return [$(i + Math.atan2(Math.sin(s) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), $(a)];
464
- }
465
- function gt({ x: r, y: t }, e, i) {
466
- const o = M(i);
465
+ function ht({ x: r, y: t }, e, i) {
466
+ const o = D(i);
467
467
  return { x: r + e * Math.cos(o), y: t + e * Math.sin(o) };
468
468
  }
469
- function ae(r, t) {
470
- const e = M(r[0]), i = M(t[0]), o = M(r[1]), s = M(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
- return $(Math.atan2(n, a));
469
+ function oe(r, t) {
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
+ return V(Math.atan2(n, a));
472
472
  }
473
- function U({ x: r, y: t }, { x: e, y: i }) {
473
+ function G({ x: r, y: t }, { x: e, y: i }) {
474
474
  const o = e - r, s = i - t;
475
475
  if (o === 0 && s === 0) return 0;
476
476
  let n = Math.atan2(s, o);
477
477
  return n *= 180 / Math.PI, n > 180 ? n -= 360 : n < -180 && (n += 360), n;
478
478
  }
479
- function H(r) {
479
+ function X(r) {
480
480
  return (r + 360) % 360;
481
481
  }
482
- function ui(r, t, e) {
482
+ function ai(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 = ae(r[c], r[c - 1]) - 180, a = ne(r[c], s, n), i.push(a);
488
+ n = oe(r[c], r[c - 1]) - 180, a = ie(r[c], s, n), i.push(a);
489
489
  }
490
- if (l >= e) return s = e - l, s ? (n = ae(r[c], r[c - 1]) - 180, a = ne(r[c], s, n), i.push(a), i) : (i.push(r[c]), i);
490
+ if (l >= e) return s = e - l, s ? (n = oe(r[c], r[c - 1]) - 180, a = ie(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
- l += R(r[c], r[c + 1]);
492
+ l += U(r[c], r[c + 1]);
493
493
  }
494
494
  if (l < t && r.length === o) throw new Error("Start position is beyond line");
495
495
  const d = r[r.length - 1];
496
496
  return [d, d];
497
497
  }
498
- function vt(r) {
498
+ function yt(r) {
499
499
  return r * (Math.PI / 180);
500
500
  }
501
- function le(r) {
501
+ function se(r) {
502
502
  return r * (180 / Math.PI);
503
503
  }
504
- class pi extends W {
504
+ class li extends B {
505
505
  constructor(t) {
506
506
  super(t), this.config = void 0, this.config = t;
507
507
  }
508
508
  generateInsertionCoordinates(t, e, i) {
509
509
  const o = [t, e];
510
510
  let s = 0;
511
- for (let d = 0; d < o.length - 1; d++) s += R(o[0], o[1]);
511
+ for (let d = 0; d < o.length - 1; d++) s += U(o[0], o[1]);
512
512
  if (s <= i) return o;
513
513
  let n = s / i - 1;
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 = ui(o, i * d, i * (d + 1));
517
+ const c = ai(o, i * d, i * (d + 1));
518
518
  a.push(c);
519
519
  }
520
520
  const l = [];
@@ -522,16 +522,16 @@ class pi extends W {
522
522
  return this.limitCoordinates(l);
523
523
  }
524
524
  generateInsertionGeodesicCoordinates(t, e, i) {
525
- const o = R(t, e), s = (function(n, a, l) {
526
- const d = [], c = vt(n[1]), h = vt(n[0]), u = vt(a[1]), p = vt(a[0]);
525
+ const o = U(t, e), s = (function(n, a, l) {
526
+ const d = [], c = yt(n[1]), h = yt(n[0]), p = yt(a[1]), u = yt(a[0]);
527
527
  l += 1;
528
- const g = 2 * Math.asin(Math.sqrt(Math.sin((u - c) / 2) ** 2 + Math.cos(c) * Math.cos(u) * Math.sin((p - h) / 2) ** 2));
528
+ const g = 2 * Math.asin(Math.sqrt(Math.sin((p - c) / 2) ** 2 + Math.cos(c) * Math.cos(p) * Math.sin((u - h) / 2) ** 2));
529
529
  if (g === 0 || isNaN(g)) return d;
530
530
  for (let y = 0; y <= l; y++) {
531
- const m = y / l, v = Math.sin((1 - m) * g) / Math.sin(g), C = Math.sin(m * g) / Math.sin(g), f = v * Math.cos(c) * Math.cos(h) + C * Math.cos(u) * Math.cos(p), P = v * Math.cos(c) * Math.sin(h) + C * Math.cos(u) * Math.sin(p), S = v * Math.sin(c) + C * Math.sin(u);
532
- if (isNaN(f) || isNaN(P) || isNaN(S)) continue;
533
- const E = Math.atan2(S, Math.sqrt(f ** 2 + P ** 2)), O = Math.atan2(P, f);
534
- isNaN(E) || isNaN(O) || d.push([le(O), le(E)]);
531
+ const m = y / l, v = Math.sin((1 - m) * g) / Math.sin(g), C = Math.sin(m * g) / Math.sin(g), f = v * Math.cos(c) * Math.cos(h) + C * Math.cos(p) * Math.cos(u), P = v * Math.cos(c) * Math.sin(h) + C * Math.cos(p) * Math.sin(u), I = v * Math.sin(c) + C * Math.sin(p);
532
+ if (isNaN(f) || isNaN(P) || isNaN(I)) continue;
533
+ const E = Math.atan2(I, Math.sqrt(f ** 2 + P ** 2)), L = Math.atan2(P, f);
534
+ isNaN(E) || isNaN(L) || d.push([se(L), se(E)]);
535
535
  }
536
536
  return d.slice(1, -1);
537
537
  })(t, e, Math.floor(o / i));
@@ -541,49 +541,49 @@ class pi extends W {
541
541
  return t.map((e) => [w(e[0], this.config.coordinatePrecision), w(e[1], this.config.coordinatePrecision)]);
542
542
  }
543
543
  }
544
- function it(r, t) {
544
+ function tt(r, t) {
545
545
  return r[0] === t[0] && r[1] === t[1];
546
546
  }
547
- function Ut(r, t) {
547
+ function Bt(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 (!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" };
551
+ if (!Wt(r.geometry.coordinates[e])) return { valid: !1, reason: "Feature has invalid coordinates" };
552
+ if (!It(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 de(r) {
556
+ function re(r) {
557
557
  return Math.sqrt(Math.pow(r[0], 2) + Math.pow(r[1], 2) + Math.pow(r[2], 2));
558
558
  }
559
- function X(r, t) {
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) / (de(r) * de(t));
563
+ })(r, t) / (re(r) * re(t));
564
564
  return Math.acos(Math.min(Math.max(e, -1), 1));
565
565
  }
566
- function Mt(r) {
567
- const t = M(r[1]), e = M(r[0]);
566
+ function bt(r) {
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
  }
570
- function Y(r) {
571
- const [t, e, i] = r, o = $(Math.asin(i));
572
- return [$(Math.atan2(e, t)), o];
570
+ function K(r) {
571
+ const [t, e, i] = r, o = V(Math.asin(i));
572
+ return [V(Math.atan2(e, t)), o];
573
573
  }
574
- function gi(r, t, e) {
575
- const i = Mt(r), o = Mt(t), s = Mt(e), [n, a, l] = s, [d, c, h] = (function(B, K) {
576
- const [Yt, Ht, Jt] = B, [qt, Zt, Qt] = K;
577
- return [Ht * Qt - Jt * Zt, Jt * qt - Yt * Qt, Yt * Zt - Ht * qt];
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], S = X(i, o), E = X(i, f), O = X(o, f), F = X(i, P), N = X(o, P);
574
+ function di(r, t, e) {
575
+ const i = bt(r), o = bt(t), s = bt(e), [n, a, l] = s, [d, c, h] = (function(T, $) {
576
+ const [Vt, $t, Yt] = T, [Kt, Xt, Ht] = $;
577
+ return [$t * Ht - Yt * Xt, Yt * Kt - Vt * Ht, Vt * Xt - $t * Kt];
578
+ })(i, o), p = c * l - h * a, u = h * n - d * l, g = d * a - c * n, y = g * c - u * h, m = p * h - g * d, v = u * d - p * c, C = 1 / Math.sqrt(Math.pow(y, 2) + Math.pow(m, 2) + Math.pow(v, 2)), f = [y * C, m * C, v * C], P = [-1 * y * C, -1 * m * C, -1 * v * C], I = Y(i, o), E = Y(i, f), L = Y(o, f), M = Y(i, P), N = Y(o, P);
579
579
  let _;
580
- return _ = E < F && E < N || O < F && O < N ? f : P, X(i, _) > S || X(o, _) > S ? R(Y(_), Y(i)) <= R(Y(_), Y(o)) ? [Y(i), !0, !1] : [Y(o), !1, !0] : [Y(_), !1, !1];
580
+ return _ = E < M && E < N || L < M && L < N ? f : P, Y(i, _) > I || Y(o, _) > I ? U(K(_), K(i)) <= U(K(_), K(o)) ? [K(i), !0, !1] : [K(o), !1, !0] : [K(_), !1, !1];
581
581
  }
582
- function yi(r, t, e) {
582
+ function ci(r, t, e) {
583
583
  const i = t.x - r.x, o = t.y - r.y, s = Math.max(0, Math.min(1, ((e.x - r.x) * i + (e.y - r.y) * o) / (i * i + o * o)));
584
584
  return { x: r.x + s * i, y: r.y + s * o };
585
585
  }
586
- class Rt extends W {
586
+ class jt 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));
@@ -603,30 +603,30 @@ class Rt extends W {
603
603
  a = n.geometry.coordinates;
604
604
  }
605
605
  const l = [];
606
- for (let u = 0; u < a.length - 1; u++) l.push([a[u], a[u + 1]]);
606
+ for (let p = 0; p < a.length - 1; p++) l.push([a[p], a[p + 1]]);
607
607
  let d;
608
608
  const c = [t.lng, t.lat];
609
- if (this.config.projection === "web-mercator" ? d = (function(u, p) {
609
+ if (this.config.projection === "web-mercator" ? d = (function(p, u) {
610
610
  let g = [1 / 0, 1 / 0], y = 1 / 0, m = 0;
611
- for (let v of p) {
611
+ for (let v of u) {
612
612
  const C = v[0], f = v[1];
613
- let P, S = 1 / 0;
614
- const E = I(C[0], C[1]), O = I(f[0], f[1]), F = I(u[0], u[1]);
615
- if (C[0] === u[0] && C[1] === u[1]) P = C;
616
- else if (f[0] === u[0] && f[1] === u[1]) P = f;
613
+ let P, I = 1 / 0;
614
+ const E = O(C[0], C[1]), L = O(f[0], f[1]), M = O(p[0], p[1]);
615
+ if (C[0] === p[0] && C[1] === p[1]) P = C;
616
+ else if (f[0] === p[0] && f[1] === p[1]) P = f;
617
617
  else {
618
- const { x: N, y: _ } = yi(E, O, F), { lng: B, lat: K } = A(N, _);
619
- P = [B, K];
618
+ const { x: N, y: _ } = ci(E, L, M), { lng: T, lat: $ } = R(N, _);
619
+ P = [T, $];
620
620
  }
621
- P && (S = L(F, I(P[0], P[1])), S < y && (g = P, y = S, m = p.indexOf(v)));
621
+ P && (I = F(M, O(P[0], P[1])), I < y && (g = P, y = I, m = u.indexOf(v)));
622
622
  }
623
623
  return y === 1 / 0 ? void 0 : { coordinate: g, lineIndex: m, distance: y };
624
- })(c, l) : this.config.projection === "globe" && (d = (function(u, p) {
624
+ })(c, l) : this.config.projection === "globe" && (d = (function(p, u) {
625
625
  let g = [1 / 0, 1 / 0], y = 1 / 0, m = 0;
626
- for (let v of p) {
626
+ for (let v of u) {
627
627
  const C = v[0], f = v[1];
628
- let P, S = 1 / 0;
629
- C[0] === u[0] && C[1] === u[1] ? P = C : f[0] === u[0] && f[1] === u[1] ? P = f : [P] = gi(C, f, u), P && (S = R(u, P), S < y && (g = P, y = S, m = p.indexOf(v)));
628
+ let P, I = 1 / 0;
629
+ C[0] === p[0] && C[1] === p[1] ? P = C : f[0] === p[0] && f[1] === p[1] ? P = f : [P] = di(C, f, p), P && (I = U(p, P), I < y && (g = P, y = I, m = u.indexOf(v)));
630
630
  }
631
631
  return y === 1 / 0 ? void 0 : { coordinate: g, distance: y, lineIndex: m };
632
632
  })(c, l)), !d) return;
@@ -635,10 +635,10 @@ class Rt extends W {
635
635
  }), s;
636
636
  }
637
637
  }
638
- const fi = { cancel: "Escape", finish: "Enter" }, mi = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
639
- class zt extends G {
638
+ const hi = { cancel: "Escape", finish: "Enter" }, ui = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
639
+ class At 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 = fi, this.snapping = void 0, this.cursors = mi, 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 = 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);
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);
@@ -648,7 +648,7 @@ class zt extends G {
648
648
  if (e) {
649
649
  if (this.snappedPointId) this.store.updateGeometry([{ id: this.snappedPointId, geometry: { type: "Point", coordinates: e } }]);
650
650
  else {
651
- const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [xt]: !0 } }]);
651
+ const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [S.SNAPPING_POINT]: !0 } }]);
652
652
  this.snappedPointId = i;
653
653
  }
654
654
  t.lng = e[0], t.lat = e[1];
@@ -658,7 +658,7 @@ class zt extends G {
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: D, value: void 0 }]);
661
+ t.coordinates.pop(), this.updateGeometries([...t.coordinates], void 0, b.Commit), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
662
662
  const e = this.currentId;
663
663
  this.closingPointId && this.store.delete([this.closingPointId]), this.snappedPointId && this.store.delete([this.snappedPointId]), this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.snappedPointId = void 0, this.lastCommittedCoordinates = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
664
664
  }
@@ -672,17 +672,17 @@ class zt extends G {
672
672
  generateInsertCoordinates(t, e) {
673
673
  if (!this.insertCoordinates || !this.lastCommittedCoordinates) throw new Error("Not able to insert coordinates");
674
674
  if (this.insertCoordinates.strategy !== "amount") throw new Error("Strategy does not exist");
675
- const i = R(t, e) / (this.insertCoordinates.value + 1);
675
+ const i = U(t, e) / (this.insertCoordinates.value + 1);
676
676
  let o = [];
677
677
  return this.projection === "globe" ? o = this.insertPoint.generateInsertionGeodesicCoordinates(t, e, i) : this.projection === "web-mercator" && (o = this.insertPoint.generateInsertionCoordinates(t, e, i)), o;
678
678
  }
679
679
  createLine(t) {
680
- const [e] = this.store.create([{ geometry: { type: "LineString", coordinates: [t, t] }, properties: { mode: this.mode, [D]: !0 } }]);
680
+ const [e] = this.store.create([{ geometry: { type: "LineString", coordinates: [t, t] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
681
681
  this.lastCommittedCoordinates = [t, t], this.currentId = e, this.currentCoordinate++, this.setDrawing();
682
682
  }
683
683
  firstUpdateToLine(t) {
684
684
  if (!this.currentId) return;
685
- const e = this.store.getGeometryCopy(this.currentId).coordinates, [i] = this.store.create([{ geometry: { type: "Point", coordinates: [...t] }, properties: { mode: this.mode } }]);
685
+ const e = this.store.getGeometryCopy(this.currentId).coordinates, [i] = this.store.create([{ geometry: { type: "Point", coordinates: [...t] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
686
686
  this.closingPointId = i, this.setCursor(this.cursors.close);
687
687
  const o = [...e, t];
688
688
  this.updateGeometries(o, void 0, b.Commit), this.currentCoordinate++;
@@ -690,13 +690,13 @@ class zt extends G {
690
690
  updateToLine(t, e) {
691
691
  if (!this.currentId) return;
692
692
  const i = this.store.getGeometryCopy(this.currentId).coordinates, [o, s] = this.lastCommittedCoordinates ? this.lastCommittedCoordinates[this.lastCommittedCoordinates.length - 1] : i[i.length - 2], { x: n, y: a } = this.project(o, s);
693
- if (L({ x: n, y: a }, { x: e.x, y: e.y }) < this.pointerDistance) return void this.close();
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
696
  this.updateGeometries(l, i[i.length - 1], b.Commit), this.currentCoordinate++;
697
697
  }
698
698
  registerBehaviors(t) {
699
- this.coordinateSnapping = new Et(t, new pt(t), new ut(t)), this.insertPoint = new pi(t), this.clickBoundingBox = new ut(t), this.pixelDistance = new pt(t), this.lineSnapping = new Rt(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new Et(t, this.pixelDistance, this.clickBoundingBox);
699
+ this.coordinateSnapping = new Pt(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 jt(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new Pt(t, this.pixelDistance, this.clickBoundingBox);
700
700
  }
701
701
  start() {
702
702
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -711,12 +711,12 @@ class zt extends G {
711
711
  const i = this.store.getGeometryCopy(this.currentId).coordinates;
712
712
  if (i.pop(), this.closingPointId) {
713
713
  const [s, n] = i[i.length - 1], { x: a, y: l } = this.project(s, n);
714
- L({ x: a, y: l }, { x: t.containerX, y: t.containerY }) < this.pointerDistance && this.setCursor(this.cursors.close);
714
+ F({ x: a, y: l }, { x: t.containerX, y: t.containerY }) < this.pointerDistance && this.setCursor(this.cursors.close);
715
715
  }
716
716
  let o = [...i, e];
717
717
  if (this.insertCoordinates && this.currentId && this.lastCommittedCoordinates) {
718
718
  const s = this.lastCommittedCoordinates[this.lastCommittedCoordinates.length - 1], n = e;
719
- if (!it(s, n)) {
719
+ if (!tt(s, n)) {
720
720
  const a = this.generateInsertCoordinates(s, n);
721
721
  o = [...this.lastCommittedCoordinates.slice(0, -1), ...a, e];
722
722
  }
@@ -758,7 +758,7 @@ class zt extends G {
758
758
  }
759
759
  if (this.editedFeatureId && i) {
760
760
  if (!this.editedPointId) {
761
- const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [z]: !0 } }]);
761
+ const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [S.EDITED]: !0 } }]);
762
762
  this.editedPointId = o;
763
763
  }
764
764
  this.setCursor(this.cursors.dragStart), e(!1);
@@ -769,10 +769,10 @@ class zt extends G {
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: z, value: !0 }]));
772
+ this.validate && !this.validate({ type: "Feature", geometry: o, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: o }]), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
773
773
  }
774
774
  onDragEnd(t, e) {
775
- this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: z, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, e(!0));
775
+ this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, e(!0));
776
776
  }
777
777
  cleanUp() {
778
778
  const t = this.currentId, e = this.closingPointId, i = this.snappedPointId;
@@ -784,15 +784,15 @@ class zt extends G {
784
784
  }
785
785
  styleFeature(t) {
786
786
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
787
- if (t.type === "Feature" && t.geometry.type === "LineString" && t.properties.mode === this.mode) return e.lineStringColor = this.getHexColorStylingValue(this.styles.lineStringColor, e.lineStringColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.lineStringWidth, e.lineStringWidth, t), e.zIndex = T, e;
787
+ if (t.type === "Feature" && t.geometry.type === "LineString" && t.properties.mode === this.mode) return e.lineStringColor = this.getHexColorStylingValue(this.styles.lineStringColor, e.lineStringColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.lineStringWidth, e.lineStringWidth, t), e.zIndex = j, e;
788
788
  if (t.type === "Feature" && t.geometry.type === "Point" && t.properties.mode === this.mode) {
789
- const i = t.properties[J];
789
+ const i = t.properties[S.CLOSING_POINT];
790
790
  return e.pointColor = this.getHexColorStylingValue(i ? this.styles.closingPointColor : this.styles.snappingPointColor, e.pointColor, t), e.pointWidth = this.getNumericStylingValue(i ? this.styles.closingPointWidth : this.styles.snappingPointWidth, e.pointWidth, t), e.pointOutlineColor = this.getHexColorStylingValue(i ? this.styles.closingPointOutlineColor : this.styles.snappingPointOutlineColor, "#ffffff", t), e.pointOutlineWidth = this.getNumericStylingValue(i ? this.styles.closingPointOutlineWidth : this.styles.snappingPointOutlineWidth, 2, t), e.zIndex = 50, e;
791
791
  }
792
792
  return e;
793
793
  }
794
794
  validateFeature(t) {
795
- return this.validateModeFeature(t, (e) => Ut(e, this.coordinatePrecision));
795
+ return this.validateModeFeature(t, (e) => Bt(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 zt extends G {
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 vi = "Feature is not a Point", Ci = "Feature has invalid coordinates", Pi = "Feature has coordinates with excessive precision";
814
- function Me(r, t) {
815
- return r.geometry.type !== "Point" ? { valid: !1, reason: vi } : At(r.geometry.coordinates) ? Ot(r.geometry.coordinates, t) ? { valid: !0 } : { valid: !1, reason: Pi } : { valid: !1, reason: Ci };
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 } : Wt(r.geometry.coordinates) ? It(r.geometry.coordinates, t) ? { valid: !0 } : { valid: !1, reason: yi } : { valid: !1, reason: gi };
816
816
  }
817
- const Si = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
818
- class Vt extends G {
817
+ const fi = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
818
+ class Rt extends A {
819
819
  constructor(t) {
820
- super(t, !0), this.mode = "point", this.cursors = Si, 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 = fi, 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,13 +850,13 @@ class Vt extends G {
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: z, value: !0 }])));
853
+ this.allowPointerEvent(this.pointerEvents.onDrag, t) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }])));
854
854
  }
855
855
  onDragEnd(t, e) {
856
- this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.setCursor(this.cursors.dragEnd), this.store.updateProperty([{ id: this.editedFeatureId, property: z, value: !1 }]), this.editedFeatureId = void 0, e(!0));
856
+ this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.setCursor(this.cursors.dragEnd), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.editedFeatureId = void 0, e(!0));
857
857
  }
858
858
  registerBehaviors(t) {
859
- this.pixelDistance = new pt(t), this.clickBoundingBox = new ut(t);
859
+ this.pixelDistance = new ct(t), this.clickBoundingBox = new dt(t);
860
860
  }
861
861
  styleFeature(t) {
862
862
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
@@ -867,7 +867,7 @@ class Vt extends G {
867
867
  return e;
868
868
  }
869
869
  validateFeature(t) {
870
- return this.validateModeFeature(t, (e) => Me(e, this.coordinatePrecision));
870
+ return this.validateModeFeature(t, (e) => Ee(e, this.coordinatePrecision));
871
871
  }
872
872
  onLeftClick(t) {
873
873
  const e = { type: "Point", coordinates: [t.lng, t.lat] }, i = { mode: this.mode };
@@ -895,7 +895,7 @@ class Vt extends G {
895
895
  this.editedFeatureId === t.id && (this.editedFeatureId = void 0, this.setCursor(this.cursors.create));
896
896
  }
897
897
  }
898
- class xi extends W {
898
+ class mi 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
  }
@@ -907,7 +907,7 @@ class xi extends W {
907
907
  create(t, e) {
908
908
  if (this.ids.length) throw new Error("Opening and closing points already created");
909
909
  if (t.length <= 3) throw new Error("Requires at least 4 coordinates");
910
- this._startEndPoints = this.store.create([{ geometry: { type: "Point", coordinates: t[0] }, properties: { mode: e, [J]: !0 } }, { geometry: { type: "Point", coordinates: t[t.length - 2] }, properties: { mode: e, [J]: !0 } }]);
910
+ this._startEndPoints = this.store.create([{ geometry: { type: "Point", coordinates: t[0] }, properties: { mode: e, [S.CLOSING_POINT]: !0 } }, { geometry: { type: "Point", coordinates: t[t.length - 2] }, properties: { mode: e, [S.CLOSING_POINT]: !0 } }]);
911
911
  }
912
912
  delete() {
913
913
  this.ids.length && (this.store.delete(this.ids), this._startEndPoints = []);
@@ -921,7 +921,7 @@ class xi extends W {
921
921
  return { isClosing: o < this.pointerDistance, isPreviousClosing: s < this.pointerDistance };
922
922
  }
923
923
  }
924
- class De extends W {
924
+ class we extends B {
925
925
  constructor(t) {
926
926
  super(t);
927
927
  }
@@ -962,10 +962,10 @@ class De extends W {
962
962
  if (i.coordinatePointIds) return i.coordinatePointIds.map((o, s) => ({ id: o, geometry: x({}, this.store.getGeometryCopy(o), { coordinates: e[s] }) }));
963
963
  }
964
964
  createPoints(t, e, i) {
965
- return this.store.create(t.map((o, s) => ({ geometry: { type: "Point", coordinates: o }, properties: { mode: e, [It]: !0, [Qe]: i, index: s } })));
965
+ return this.store.create(t.map((o, s) => ({ geometry: { type: "Point", coordinates: o }, properties: { mode: e, [S.COORDINATE_POINT]: !0, [S.COORDINATE_POINT_FEATURE_ID]: i, index: s } })));
966
966
  }
967
967
  setFeatureCoordinatePoints(t, e) {
968
- this.store.updateProperty([{ id: t, property: ht, value: e }]);
968
+ this.store.updateProperty([{ id: t, property: S.COORDINATE_POINT_IDS, value: e }]);
969
969
  }
970
970
  deleteCoordinatePoints(t) {
971
971
  const e = t.filter((i) => this.store.has(i));
@@ -976,10 +976,10 @@ class De extends W {
976
976
  e && (this.deleteCoordinatePoints(e), this.setFeatureCoordinatePoints(t, null));
977
977
  }
978
978
  }
979
- const Ii = { cancel: "Escape", finish: "Enter" }, bi = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
980
- class _e extends G {
979
+ const vi = { cancel: "Escape", finish: "Enter" }, Ci = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
980
+ class Le extends A {
981
981
  constructor(t) {
982
- super(t, !0), this.mode = "polygon", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Ii, this.cursors = bi, 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 = 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);
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) {
@@ -987,7 +987,7 @@ class _e extends G {
987
987
  this.coordinatePoints.createOrUpdate(e);
988
988
  });
989
989
  else if (this.coordinatePoints && this.showCoordinatePoints === !1) {
990
- const e = this.store.copyAllWhere((i) => i.mode === this.mode && !!i[ht]);
990
+ const e = this.store.copyAllWhere((i) => i.mode === this.mode && !!i[S.COORDINATE_POINT_IDS]);
991
991
  this.coordinatePoints.deletePointsByFeatureIds(e.map((i) => i.id));
992
992
  }
993
993
  }
@@ -998,13 +998,13 @@ class _e extends G {
998
998
  if (t.length < 5 || !this.updatePolygonGeometry([...t.slice(0, -2), t[0]], b.Finish)) return;
999
999
  const e = this.currentId;
1000
1000
  if (this.currentId) {
1001
- const i = ft(this.store.getGeometryCopy(this.currentId));
1002
- i && this.store.updateGeometry([{ id: this.currentId, geometry: i }]), this.store.updateProperty([{ id: this.currentId, property: D, value: void 0 }]);
1001
+ const i = pt(this.store.getGeometryCopy(this.currentId));
1002
+ i && (this.store.updateGeometry([{ id: this.currentId, geometry: i }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.currentId)), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }, { id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: void 0 }, { id: this.currentId, property: S.PROVISIONAL_COORDINATE_COUNT, value: void 0 }]);
1003
1003
  }
1004
1004
  this.snappedPointId && this.store.delete([this.snappedPointId]), this.currentCoordinate = 0, this.currentId = void 0, this.snappedPointId = void 0, this.closingPoints.delete(), this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
1005
1005
  }
1006
1006
  registerBehaviors(t) {
1007
- this.clickBoundingBox = new ut(t), this.pixelDistance = new pt(t), this.lineSnapping = new Rt(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new Et(t, this.pixelDistance, this.clickBoundingBox), this.closingPoints = new xi(t, this.pixelDistance), this.coordinatePoints = new De(t);
1007
+ this.clickBoundingBox = new dt(t), this.pixelDistance = new ct(t), this.lineSnapping = new jt(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new Pt(t, this.pixelDistance, this.clickBoundingBox), this.closingPoints = new mi(t, this.pixelDistance), this.coordinatePoints = new we(t);
1008
1008
  }
1009
1009
  start() {
1010
1010
  this.setStarted(), this.setCursor(this.cursors.start);
@@ -1017,7 +1017,7 @@ class _e extends G {
1017
1017
  if (e) {
1018
1018
  if (this.snappedPointId) this.store.updateGeometry([{ id: this.snappedPointId, geometry: { type: "Point", coordinates: e } }]);
1019
1019
  else {
1020
- const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [xt]: !0 } }]);
1020
+ const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [S.SNAPPING_POINT]: !0 } }]);
1021
1021
  this.snappedPointId = i;
1022
1022
  }
1023
1023
  t.lng = e[0], t.lat = e[1];
@@ -1035,7 +1035,7 @@ class _e extends G {
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.updatePolygonGeometry(i, b.Provisional);
1038
+ this.store.updateProperty([{ id: this.currentId, property: S.PROVISIONAL_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.updatePolygonGeometry(i, b.Provisional);
1039
1039
  }
1040
1040
  updatePolygonGeometry(t, e) {
1041
1041
  if (!this.currentId) return !1;
@@ -1070,31 +1070,31 @@ class _e extends G {
1070
1070
  if (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.currentCoordinate === 0) {
1071
1071
  const e = this.snapCoordinate(t);
1072
1072
  e && (t.lng = e[0], t.lat = e[1]);
1073
- const [i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [D]: !0 } }]);
1073
+ const [i] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0, [S.COMMITTED_COORDINATE_COUNT]: this.currentCoordinate + 1, [S.PROVISIONAL_COORDINATE_COUNT]: this.currentCoordinate + 1 } }]);
1074
1074
  this.currentId = i, this.currentCoordinate++, this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(i), this.setDrawing();
1075
1075
  } else if (this.currentCoordinate === 1 && this.currentId) {
1076
1076
  const e = this.snapCoordinate(t);
1077
1077
  e && (t.lng = e[0], t.lat = e[1]);
1078
1078
  const i = this.store.getGeometryCopy(this.currentId);
1079
- if (it([t.lng, t.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], i.coordinates[0][0]], b.Commit)) return;
1080
- this.currentCoordinate++;
1079
+ if (tt([t.lng, t.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [t.lng, t.lat], [t.lng, t.lat], i.coordinates[0][0]], b.Commit)) return;
1080
+ this.store.updateProperty([{ id: this.currentId, property: 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 (it([t.lng, t.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [t.lng, t.lat], [t.lng, t.lat], i[0]], b.Commit)) return;
1086
- this.currentCoordinate === 2 && this.closingPoints.create(i, "polygon"), this.currentCoordinate++;
1085
+ if (tt([t.lng, t.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [t.lng, t.lat], [t.lng, t.lat], i[0]], b.Commit)) return;
1086
+ this.currentCoordinate === 2 && this.closingPoints.create(i, "polygon"), this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
1087
1087
  } else if (this.currentId) {
1088
1088
  const e = this.store.getGeometryCopy(this.currentId).coordinates[0], { isClosing: i, isPreviousClosing: o } = this.closingPoints.isClosingPoint(t);
1089
1089
  if (o || i) this.close();
1090
1090
  else {
1091
1091
  const s = this.snapCoordinate(t);
1092
- if (s && (t.lng = s[0], t.lat = s[1]), it([t.lng, t.lat], e[this.currentCoordinate - 1])) return;
1092
+ if (s && (t.lng = s[0], t.lat = s[1]), tt([t.lng, t.lat], e[this.currentCoordinate - 1])) return;
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
1096
  if (!this.updatePolygonGeometry(n.geometry.coordinates[0], b.Commit)) return;
1097
- this.currentCoordinate++, this.closingPoints.ids.length && this.closingPoints.update(n.geometry.coordinates[0]);
1097
+ this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++, this.closingPoints.ids.length && this.closingPoints.update(n.geometry.coordinates[0]);
1098
1098
  }
1099
1099
  }
1100
1100
  }
@@ -1117,7 +1117,7 @@ class _e extends G {
1117
1117
  }
1118
1118
  if (this.editedFeatureId && i) {
1119
1119
  if (!this.editedPointId) {
1120
- const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [z]: !0 } }]);
1120
+ const [o] = this.store.create([{ geometry: { type: "Point", coordinates: i }, properties: { mode: this.mode, [S.EDITED]: !0 } }]);
1121
1121
  this.editedPointId = o;
1122
1122
  }
1123
1123
  this.setCursor(this.cursors.dragStart), e(!1);
@@ -1128,10 +1128,10 @@ class _e extends G {
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: z, value: !0 }]));
1131
+ this.validate && !this.validate({ type: "Feature", geometry: s, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: s }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.editedFeatureId), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
1132
1132
  }
1133
1133
  onDragEnd(t, e) {
1134
- this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: z, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, e(!0));
1134
+ this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, e(!0));
1135
1135
  }
1136
1136
  cleanUp() {
1137
1137
  const t = this.currentId, e = this.snappedPointId, i = this.editedPointId;
@@ -1144,9 +1144,9 @@ class _e extends G {
1144
1144
  styleFeature(t) {
1145
1145
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
1146
1146
  if (t.properties.mode === this.mode) {
1147
- if (t.geometry.type === "Polygon") return e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = T, e;
1147
+ if (t.geometry.type === "Polygon") return e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = j, e;
1148
1148
  if (t.geometry.type === "Point") {
1149
- const i = t.properties[z], o = t.properties[It], s = i ? "editedPoint" : t.properties[J] ? "closingPoint" : t.properties[xt] ? "snappingPoint" : o ? "coordinatePoint" : void 0;
1149
+ const i = t.properties[S.EDITED], o = t.properties[S.COORDINATE_POINT], s = i ? "editedPoint" : t.properties[S.CLOSING_POINT] ? "closingPoint" : t.properties[S.SNAPPING_POINT] ? "snappingPoint" : o ? "coordinatePoint" : void 0;
1150
1150
  if (!s) return e;
1151
1151
  const n = { editedPoint: { width: this.styles.editedPointOutlineWidth, color: this.styles.editedPointColor, outlineColor: this.styles.editedPointOutlineColor, outlineWidth: this.styles.editedPointOutlineWidth }, closingPoint: { width: this.styles.closingPointWidth, color: this.styles.closingPointColor, outlineColor: this.styles.closingPointOutlineColor, outlineWidth: this.styles.closingPointOutlineWidth }, snappingPoint: { width: this.styles.snappingPointWidth, color: this.styles.snappingPointColor, outlineColor: this.styles.snappingPointOutlineColor, outlineWidth: this.styles.snappingPointOutlineWidth }, coordinatePoint: { width: this.styles.coordinatePointWidth, color: this.styles.coordinatePointColor, outlineColor: this.styles.coordinatePointOutlineColor, outlineWidth: this.styles.coordinatePointOutlineWidth } };
1152
1152
  return e.pointWidth = this.getNumericStylingValue(n[s].width, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(n[s].color, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(n[s].outlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(n[s].outlineWidth, 2, t), e.zIndex = i ? 40 : o ? 20 : 30, e;
@@ -1161,13 +1161,13 @@ class _e extends G {
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) => Lt(e, this.coordinatePrecision));
1164
+ return this.validateModeFeature(t, (e) => xt(e, this.coordinatePrecision));
1165
1165
  }
1166
1166
  }
1167
- const Ei = { cancel: "Escape", finish: "Enter" }, wi = { start: "crosshair" };
1168
- class ke extends G {
1167
+ const Pi = { cancel: "Escape", finish: "Enter" }, Si = { start: "crosshair" };
1168
+ class Fe 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 = Ei, this.cursors = wi, this.updateOptions(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);
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));
@@ -1182,8 +1182,8 @@ class ke extends G {
1182
1182
  close() {
1183
1183
  const t = this.currentRectangleId;
1184
1184
  if (t) {
1185
- const e = ft(this.store.getGeometryCopy(t));
1186
- e && this.store.updateGeometry([{ id: t, geometry: e }]), this.store.updateProperty([{ id: t, property: D, value: void 0 }]);
1185
+ const e = pt(this.store.getGeometryCopy(t));
1186
+ e && this.store.updateGeometry([{ id: t, geometry: e }]), this.store.updateProperty([{ id: t, property: S.CURRENTLY_DRAWING, value: void 0 }]);
1187
1187
  }
1188
1188
  this.center = void 0, this.currentRectangleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted(), t !== void 0 && this.onFinish(t, { mode: this.mode, action: "draw" });
1189
1189
  }
@@ -1196,7 +1196,7 @@ class ke extends G {
1196
1196
  onClick(t) {
1197
1197
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) if (this.clickCount === 0) {
1198
1198
  this.center = [t.lng, t.lat];
1199
- const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [D]: !0 } }]);
1199
+ const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
1200
1200
  this.currentRectangleId = e, this.clickCount++, this.setDrawing();
1201
1201
  } else this.updateRectangle(t, b.Finish), this.close();
1202
1202
  }
@@ -1220,19 +1220,19 @@ class ke extends G {
1220
1220
  }
1221
1221
  styleFeature(t) {
1222
1222
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
1223
- 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 = T), e;
1223
+ 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;
1224
1224
  }
1225
1225
  validateFeature(t) {
1226
- return this.validateModeFeature(t, (e) => yt(e, this.coordinatePrecision));
1226
+ return this.validateModeFeature(t, (e) => ut(e, this.coordinatePrecision));
1227
1227
  }
1228
1228
  afterFeatureUpdated(t) {
1229
1229
  this.currentRectangleId === t.id && (this.center = void 0, this.currentRectangleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted());
1230
1230
  }
1231
1231
  }
1232
- class et extends G {
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 = q.Render, this.mode = "render", this.updateOptions(t);
1235
+ super(t, !0), this.type = H.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 et extends G {
1268
1268
  validateFeature(t) {
1269
1269
  const e = super.validateFeature(t);
1270
1270
  if (e.valid) {
1271
- const i = t, o = Me(i, this.coordinatePrecision).valid || Lt(i, this.coordinatePrecision).valid || Ut(i, this.coordinatePrecision).valid;
1271
+ const i = t, o = Ee(i, this.coordinatePrecision).valid || xt(i, this.coordinatePrecision).valid || Bt(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 Bt(r, t) {
1278
- const e = r, i = t, o = M(e[1]), s = M(i[1]);
1279
- let n = M(i[0] - e[0]);
1277
+ function Mt(r, t) {
1278
+ const e = r, i = t, o = D(e[1]), s = D(i[1]);
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
- const a = Math.log(Math.tan(s / 2 + Math.PI / 4) / Math.tan(o / 2 + Math.PI / 4)), l = ($(Math.atan2(n, a)) + 360) % 360;
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 Ne(r, t, e) {
1284
+ function Me(r, t, e) {
1285
1285
  let i = t;
1286
1286
  t < 0 && (i = -Math.abs(i));
1287
- const o = i / Ee, s = r[0] * Math.PI / 180, n = M(r[1]), a = M(e), l = o * Math.cos(a);
1287
+ const o = i / Se, s = r[0] * Math.PI / 180, n = D(r[1]), a = D(e), l = o * Math.cos(a);
1288
1288
  let d = n + l;
1289
1289
  Math.abs(d) > Math.PI / 2 && (d = d > 0 ? Math.PI - d : -Math.PI - d);
1290
- const c = Math.log(Math.tan(d / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4)), h = Math.abs(c) > 1e-11 ? l / c : Math.cos(n), u = [(180 * (s + o * Math.sin(a) / h) / Math.PI + 540) % 360 - 180, 180 * d / Math.PI];
1291
- return u[0] += u[0] - r[0] > 180 ? -360 : r[0] - u[0] > 180 ? 360 : 0, u;
1290
+ const c = Math.log(Math.tan(d / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4)), h = Math.abs(c) > 1e-11 ? l / c : Math.cos(n), p = [(180 * (s + o * Math.sin(a) / h) / Math.PI + 540) % 360 - 180, 180 * d / Math.PI];
1291
+ return p[0] += p[0] - r[0] > 180 ? -360 : r[0] - p[0] > 180 ? 360 : 0, p;
1292
1292
  }
1293
- function Be(r, t, e, i, o) {
1293
+ function De(r, t, e, i, o) {
1294
1294
  const s = i(r[0], r[1]), n = i(t[0], t[1]), { lng: a, lat: l } = o((s.x + n.x) / 2, (s.y + n.y) / 2);
1295
1295
  return [w(a, e), w(l, e)];
1296
1296
  }
1297
- function Oi(r, t, e) {
1298
- const i = Ne(r, 1e3 * R(r, t) / 2, Bt(r, t));
1297
+ function Ii(r, t, e) {
1298
+ const i = Me(r, 1e3 * U(r, t) / 2, Mt(r, t));
1299
1299
  return [w(i[0], e), w(i[1], e)];
1300
1300
  }
1301
- function ce({ featureCoords: r, precision: t, unproject: e, project: i, projection: o }) {
1301
+ function ne({ 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 = Be(r[n], r[n + 1], t, i, e);
1305
+ if (o === "web-mercator") a = De(r[n], r[n + 1], t, i, e);
1306
1306
  else {
1307
1307
  if (o !== "globe") throw new Error("Invalid projection");
1308
- a = Oi(r[n], r[n + 1], t);
1308
+ a = Ii(r[n], r[n + 1], t);
1309
1309
  }
1310
1310
  s.push(a);
1311
1311
  }
1312
1312
  return s;
1313
1313
  }
1314
- class Li extends W {
1314
+ class xi 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
  }
@@ -1322,22 +1322,22 @@ class Li extends W {
1322
1322
  }
1323
1323
  insert(t, e, i) {
1324
1324
  const o = this.store.getGeometryCopy(e), { midPointFeatureId: s, midPointSegment: n } = this.store.getPropertiesCopy(e), a = this.store.getGeometryCopy(s), l = a.type === "Polygon" ? a.coordinates[0] : a.coordinates;
1325
- l.splice(n + 1, 0, o.coordinates), a.coordinates = a.type === "Polygon" ? [l] : l, this.store.updateGeometry([{ id: s, geometry: a }]), this.store.getPropertiesCopy(t)[ht] && this.coordinatePointBehavior.createOrUpdate(t), this.store.delete([...this._midPoints, ...this.selectionPointBehavior.ids]), this.create(l, s, i), this.selectionPointBehavior.create(l, a.type, s);
1325
+ l.splice(n + 1, 0, o.coordinates), a.coordinates = a.type === "Polygon" ? [l] : l, this.store.updateGeometry([{ id: s, geometry: a }]), this.store.getPropertiesCopy(t)[S.COORDINATE_POINT_IDS] && this.coordinatePointBehavior.createOrUpdate(t), this.store.delete([...this._midPoints, ...this.selectionPointBehavior.ids]), this.create(l, s, i), this.selectionPointBehavior.create(l, a.type, s);
1326
1326
  }
1327
1327
  create(t, e, i) {
1328
1328
  if (!this.store.has(e)) throw new Error("Store does not have feature with this id");
1329
1329
  this._midPoints = this.store.create((function(o, s, n, a, l, d) {
1330
- return ce({ featureCoords: o, precision: n, project: a, unproject: l, projection: d }).map((c, h) => ({ geometry: { type: "Point", coordinates: c }, properties: s(h) }));
1330
+ return ne({ 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 ce({ 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 ne({ 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 Fi extends W {
1340
+ class Oi extends B {
1341
1341
  constructor(t) {
1342
1342
  super(t), this._selectionPoints = [];
1343
1343
  }
@@ -1363,7 +1363,7 @@ class Fi extends W {
1363
1363
  if (this._selectionPoints[t] !== void 0) return { id: this._selectionPoints[t], geometry: { type: "Point", coordinates: e } };
1364
1364
  }
1365
1365
  }
1366
- function je(r, t) {
1366
+ function _e(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 je(r, t) {
1372
1372
  var i, o, s;
1373
1373
  return e;
1374
1374
  }
1375
- const jt = (r, t, e) => {
1375
+ const Dt = (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,34 +1381,34 @@ const jt = (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 Mi extends W {
1384
+ class bi 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
  }
1388
1388
  find(t, e) {
1389
1389
  let i, o, s, n, a = 1 / 0, l = 1 / 0, d = 1 / 0;
1390
1390
  const c = this.createClickBoundingBox.create(t), h = this.store.search(c);
1391
- for (let u = 0; u < h.length; u++) {
1392
- const p = h[u], g = p.geometry;
1391
+ for (let p = 0; p < h.length; p++) {
1392
+ const u = h[p], g = u.geometry;
1393
1393
  if (g.type === "Point") {
1394
- if (p.properties.selectionPoint || p.properties.coordinatePoint || !e && p.properties[k.MID_POINT]) continue;
1394
+ if (u.properties.selectionPoint || u.properties.coordinatePoint || !e && u.properties[k.MID_POINT]) continue;
1395
1395
  const y = this.pixelDistance.measure(t, g.coordinates);
1396
- p.properties[k.MID_POINT] && y < this.pointerDistance && y < d ? (d = y, s = p) : !p.properties[k.MID_POINT] && y < this.pointerDistance && y < a && (a = y, i = p);
1396
+ u.properties[k.MID_POINT] && y < this.pointerDistance && y < d ? (d = y, s = u) : !u.properties[k.MID_POINT] && y < this.pointerDistance && y < a && (a = y, i = u);
1397
1397
  } else if (g.type === "LineString") {
1398
1398
  if (i) continue;
1399
1399
  for (let y = 0; y < g.coordinates.length - 1; y++) {
1400
- const m = g.coordinates[y], v = g.coordinates[y + 1], C = jt({ x: t.containerX, y: t.containerY }, this.project(m[0], m[1]), this.project(v[0], v[1]));
1401
- C < this.pointerDistance && C < l && (l = C, o = p);
1400
+ const m = g.coordinates[y], v = g.coordinates[y + 1], C = Dt({ x: t.containerX, y: t.containerY }, this.project(m[0], m[1]), this.project(v[0], v[1]));
1401
+ C < this.pointerDistance && C < l && (l = C, o = u);
1402
1402
  }
1403
1403
  } else if (g.type === "Polygon") {
1404
1404
  if (i || o) continue;
1405
- je([t.lng, t.lat], g.coordinates) && (n = p);
1405
+ _e([t.lng, t.lat], g.coordinates) && (n = u);
1406
1406
  }
1407
1407
  }
1408
1408
  return { clickedFeature: i || o || n, clickedMidPoint: s };
1409
1409
  }
1410
1410
  }
1411
- class Di extends W {
1411
+ class Ei 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
  }
@@ -1433,16 +1433,16 @@ class Di extends W {
1433
1433
  if (i.type === "Polygon" ? (s = i.coordinates[0], n = s.length - 1) : (s = i.coordinates, n = s.length), !this.dragPosition) return !1;
1434
1434
  for (let c = 0; c < n; c++) {
1435
1435
  const h = s[c];
1436
- let u, p;
1436
+ let p, u;
1437
1437
  if (this.config.projection === "web-mercator") {
1438
- const g = I(this.dragPosition[0], this.dragPosition[1]), y = I(o[0], o[1]), m = I(h[0], h[1]), v = { x: g.x - y.x, y: g.y - y.y }, C = m.x - v.x, f = m.y - v.y, { lng: P, lat: S } = A(C, f);
1439
- u = P, p = S;
1438
+ const g = O(this.dragPosition[0], this.dragPosition[1]), y = O(o[0], o[1]), m = O(h[0], h[1]), v = { x: g.x - y.x, y: g.y - y.y }, C = m.x - v.x, f = m.y - v.y, { lng: P, lat: I } = R(C, f);
1439
+ p = P, u = I;
1440
1440
  } else {
1441
1441
  const g = [this.dragPosition[0] - o[0], this.dragPosition[1] - o[1]];
1442
- u = h[0] - g[0], p = h[1] - g[1];
1442
+ p = h[0] - g[0], u = h[1] - g[1];
1443
1443
  }
1444
- if (u = w(u, this.config.coordinatePrecision), p = w(p, this.config.coordinatePrecision), u > 180 || u < -180 || p > 90 || p < -90) return !1;
1445
- s[c] = [u, p];
1444
+ if (p = w(p, this.config.coordinatePrecision), u = w(u, this.config.coordinatePrecision), p > 180 || p < -180 || u > 90 || u < -90) return !1;
1445
+ s[c] = [p, u];
1446
1446
  }
1447
1447
  i.type === "Polygon" && (s[s.length - 1] = [s[0][0], s[0][1]]);
1448
1448
  const a = this.selectionPoints.getUpdated(s) || [], l = this.midPoints.getUpdated(s) || [], d = this.coordinatePoints.getUpdated(this.draggedFeatureId, s) || [];
@@ -1451,7 +1451,7 @@ class Di extends W {
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 _i extends W {
1454
+ class wi 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
  }
@@ -1496,14 +1496,14 @@ class _i extends W {
1496
1496
  drag(t, e, i, o) {
1497
1497
  const s = this.draggedCoordinate.id;
1498
1498
  if (s === null) return !1;
1499
- const n = this.draggedCoordinate.index, a = this.store.getGeometryCopy(s), l = this.store.getPropertiesCopy(s), d = a.type === "LineString" ? a.coordinates : a.coordinates[0], c = a.type === "Polygon" && (n === d.length - 1 || n === 0), h = { type: "Feature", id: s, geometry: a, properties: l }, u = this.snapCoordinate(t, o, h);
1499
+ const n = this.draggedCoordinate.index, a = this.store.getGeometryCopy(s), l = this.store.getPropertiesCopy(s), d = a.type === "LineString" ? a.coordinates : a.coordinates[0], c = a.type === "Polygon" && (n === d.length - 1 || n === 0), h = { type: "Feature", id: s, geometry: a, properties: l }, p = this.snapCoordinate(t, o, h);
1500
1500
  if (t.lng > 180 || t.lng < -180 || t.lat > 90 || t.lat < -90) return !1;
1501
1501
  if (c) {
1502
1502
  const v = d.length - 1;
1503
- d[0] = u, d[v] = u;
1504
- } else d[n] = u;
1505
- const p = this.selectionPoints.getOneUpdated(n, u), g = p ? [p] : [], y = this.midPoints.getUpdated(d) || [], m = this.coordinatePoints.getUpdated(s, d) || [];
1506
- return !(a.type !== "Point" && !e && Gt({ 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));
1503
+ d[0] = p, d[v] = p;
1504
+ } else d[n] = p;
1505
+ const u = this.selectionPoints.getOneUpdated(n, p), g = u ? [u] : [], y = this.midPoints.getUpdated(d) || [], m = this.coordinatePoints.getUpdated(s, d) || [];
1506
+ return !(a.type !== "Point" && !e && Tt({ geometry: a }) || i && !i(h, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional }).valid || (this.store.updateGeometry([{ id: s, geometry: a }, ...g, ...y, ...m]), 0));
1507
1507
  }
1508
1508
  isDragging() {
1509
1509
  return this.draggedCoordinate.id !== null;
@@ -1515,30 +1515,30 @@ class _i extends W {
1515
1515
  this.draggedCoordinate = { id: null, index: -1 };
1516
1516
  }
1517
1517
  }
1518
- function he(r) {
1518
+ function ae(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 We = (r, t) => {
1524
+ const ke = (r, t) => {
1525
1525
  if (t === 0 || t === 360 || t === -360) return r;
1526
- const e = 0.017453292519943295 * t, i = (r.geometry.type === "Polygon" ? r.geometry.coordinates[0] : r.geometry.coordinates).map(([n, a]) => I(n, a)), o = i.reduce((n, a) => ({ x: n.x + a.x, y: n.y + a.y }), { x: 0, y: 0 });
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
- 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 }) => [A(n, a).lng, A(n, a).lat]);
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 Wt(r) {
1531
+ function _t(r) {
1532
1532
  const t = (r.geometry.type === "Polygon" ? r.geometry.coordinates[0] : r.geometry.coordinates).map((e) => {
1533
- const { x: i, y: o } = I(e[0], e[1]);
1533
+ const { x: i, y: o } = O(e[0], e[1]);
1534
1534
  return [i, o];
1535
1535
  });
1536
1536
  return r.geometry.type === "Polygon" ? (function(e) {
1537
1537
  let i = 0, o = 0, s = 0;
1538
1538
  const n = e.length;
1539
1539
  for (let a = 0; a < n - 1; a++) {
1540
- const [l, d] = e[a], [c, h] = e[a + 1], u = l * h - c * d;
1541
- i += u, o += (l + c) * u, s += (d + h) * u;
1540
+ const [l, d] = e[a], [c, h] = e[a + 1], p = l * h - c * d;
1541
+ i += p, o += (l + c) * p, s += (d + h) * p;
1542
1542
  }
1543
1543
  return i /= 2, o /= 6 * i, s /= 6 * i, { x: o, y: s };
1544
1544
  })(t) : (function(e) {
@@ -1551,7 +1551,7 @@ function Wt(r) {
1551
1551
  return { x: o / i, y: s / i };
1552
1552
  })(t);
1553
1553
  }
1554
- class ki extends W {
1554
+ class Li 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,40 +1566,40 @@ class ki extends W {
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 = Wt(a));
1570
- const u = I(t.lng, t.lat);
1571
- if (n = U(this.selectedGeometryWebMercatorCentroid, u), n === 0) return;
1569
+ this.selectedGeometryWebMercatorCentroid || (this.selectedGeometryWebMercatorCentroid = _t(a));
1570
+ const p = O(t.lng, t.lat);
1571
+ if (n = G(this.selectedGeometryWebMercatorCentroid, p), n === 0) return;
1572
1572
  if (!this.lastBearing) return void (this.lastBearing = n);
1573
- We(a, -(this.lastBearing - n));
1573
+ ke(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 = he({ geometry: o })), n = Bt(this.selectedGeometryCentroid, s), !this.lastBearing) return void (this.lastBearing = n + 180);
1577
- (function(u, p) {
1578
- if (p === 0 || p === 360 || p === -360) return u;
1579
- const g = he(u);
1580
- (u.geometry.type === "Polygon" ? u.geometry.coordinates[0] : u.geometry.coordinates).forEach((y) => {
1581
- const m = Bt(g, y) + p, v = (function(f, P) {
1576
+ if (this.selectedGeometryCentroid || (this.selectedGeometryCentroid = ae({ geometry: o })), n = Mt(this.selectedGeometryCentroid, s), !this.lastBearing) return void (this.lastBearing = n + 180);
1577
+ (function(p, u) {
1578
+ if (u === 0 || u === 360 || u === -360) return p;
1579
+ const g = ae(p);
1580
+ (p.geometry.type === "Polygon" ? p.geometry.coordinates[0] : p.geometry.coordinates).forEach((y) => {
1581
+ const m = Mt(g, y) + u, v = (function(f, P) {
1582
1582
  f[0] += f[0] - P[0] > 180 ? -360 : P[0] - f[0] > 180 ? 360 : 0;
1583
- const S = Ee, E = P[1] * Math.PI / 180, O = f[1] * Math.PI / 180, F = O - E;
1583
+ const I = Se, E = P[1] * Math.PI / 180, L = f[1] * Math.PI / 180, M = L - E;
1584
1584
  let N = Math.abs(f[0] - P[0]) * Math.PI / 180;
1585
1585
  N > Math.PI && (N -= 2 * Math.PI);
1586
- const _ = Math.log(Math.tan(O / 2 + Math.PI / 4) / Math.tan(E / 2 + Math.PI / 4)), B = Math.abs(_) > 1e-11 ? F / _ : Math.cos(E);
1587
- return Math.sqrt(F * F + B * B * N * N) * S;
1588
- })(g, y), C = Ne(g, v, m);
1586
+ const _ = Math.log(Math.tan(L / 2 + Math.PI / 4) / Math.tan(E / 2 + Math.PI / 4)), T = Math.abs(_) > 1e-11 ? M / _ : Math.cos(E);
1587
+ return Math.sqrt(M * M + T * T * N * N) * I;
1588
+ })(g, y), C = Me(g, v, m);
1589
1589
  y[0] = C[0], y[1] = C[1];
1590
1590
  });
1591
1591
  })(a, -(this.lastBearing - (n + 180)));
1592
1592
  }
1593
1593
  const l = o.type === "Polygon" ? o.coordinates[0] : o.coordinates;
1594
- l.forEach((u) => {
1595
- u[0] = w(u[0], this.coordinatePrecision), u[1] = w(u[1], this.coordinatePrecision);
1594
+ l.forEach((p) => {
1595
+ p[0] = w(p[0], this.coordinatePrecision), p[1] = w(p[1], this.coordinatePrecision);
1596
1596
  });
1597
1597
  const d = this.midPoints.getUpdated(l) || [], c = this.selectionPoints.getUpdated(l) || [], h = this.coordinatePoints.getUpdated(e, l) || [];
1598
1598
  if (i && !i({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional })) return !1;
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 Ni extends W {
1602
+ class Fi 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 Ni extends W {
1614
1614
  this.dragCoordinateResizeBehavior.stopDragging();
1615
1615
  }
1616
1616
  }
1617
- function Te({ coordinates: r, originX: t, originY: e, xScale: i, yScale: o }) {
1617
+ function Ne({ coordinates: r, originX: t, originY: e, xScale: i, yScale: o }) {
1618
1618
  i === 1 && o === 1 || r.forEach((s) => {
1619
- const { x: n, y: a } = I(s[0], s[1]), l = t + (n - t) * i, d = e + (a - e) * o, { lng: c, lat: h } = A(l, d);
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 Bi extends W {
1623
+ class Mi 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,34 +1679,34 @@ class Bi extends W {
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 = Wt(i);
1682
+ const { feature: i, boundingBox: o, updatedCoords: s, selectedCoordinate: n } = e, a = _t(i);
1683
1683
  if (!a) return null;
1684
- const l = I(n[0], n[1]), { closestBBoxIndex: d } = this.getIndexesWebMercator(o, l), c = I(t.lng, t.lat);
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;
1686
1686
  }
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 = Wt(i);
1690
+ const { feature: i, boundingBox: o, updatedCoords: s, selectedCoordinate: n } = e, a = _t(i);
1691
1691
  if (!a) return null;
1692
- const l = I(n[0], n[1]), { closestBBoxIndex: d } = this.getIndexesWebMercator(o, l), c = I(t.lng, t.lat);
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;
1694
1694
  }
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
- let n = L(e, o) / L(e, i);
1698
- return n < 0 && (n = this.minimumScale), Te({ coordinates: s, originX: e.x, originY: e.y, xScale: n, yScale: n }), s;
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;
1699
1699
  }
1700
1700
  oppositeFixedWebMercatorDrag(t) {
1701
1701
  const e = this.getSelectedFeatureDataWebMercator();
1702
1702
  if (!e) return null;
1703
- const { boundingBox: i, updatedCoords: o, selectedCoordinate: s } = e, n = I(s[0], s[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), d = { x: i[a][0], y: i[a][1] }, c = I(t.lng, t.lat);
1703
+ const { boundingBox: i, updatedCoords: o, selectedCoordinate: s } = e, n = O(s[0], s[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), d = { x: i[a][0], y: i[a][1] }, c = O(t.lng, t.lat);
1704
1704
  return this.scaleFixedWebMercator({ closestBBoxIndex: l, updatedCoords: o, webMercatorCursor: c, webMercatorSelected: n, webMercatorOrigin: d }), o;
1705
1705
  }
1706
1706
  oppositeWebMercatorDrag(t) {
1707
1707
  const e = this.getSelectedFeatureDataWebMercator();
1708
1708
  if (!e) return null;
1709
- const { boundingBox: i, updatedCoords: o, selectedCoordinate: s } = e, n = I(s[0], s[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), d = { x: i[a][0], y: i[a][1] }, c = I(t.lng, t.lat);
1709
+ const { boundingBox: i, updatedCoords: o, selectedCoordinate: s } = e, n = O(s[0], s[1]), { oppositeBboxIndex: a, closestBBoxIndex: l } = this.getIndexesWebMercator(i, n), d = { x: i[a][0], y: i[a][1] }, c = O(t.lng, t.lat);
1710
1710
  return this.scaleWebMercator({ closestBBoxIndex: l, updatedCoords: o, webMercatorCursor: c, webMercatorSelected: n, webMercatorOrigin: d }), o;
1711
1711
  }
1712
1712
  scaleWebMercator({ closestBBoxIndex: t, webMercatorOrigin: e, webMercatorSelected: i, webMercatorCursor: o, updatedCoords: s }) {
@@ -1731,14 +1731,14 @@ class Bi extends W {
1731
1731
  }
1732
1732
  performWebMercatorScale(t, e, i, o, s) {
1733
1733
  t.forEach((n) => {
1734
- const { x: a, y: l } = I(n[0], n[1]), d = e + (a - e) * o, c = i + (l - i) * s, { lng: h, lat: u } = A(d, c);
1735
- n[0] = h, n[1] = u;
1734
+ const { x: a, y: l } = O(n[0], n[1]), d = e + (a - e) * o, c = i + (l - i) * s, { lng: h, lat: p } = R(d, c);
1735
+ n[0] = h, n[1] = p;
1736
1736
  });
1737
1737
  }
1738
1738
  getBBoxWebMercator(t) {
1739
1739
  const e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
1740
1740
  (t = t.map((a) => {
1741
- const { x: l, y: d } = I(a[0], a[1]);
1741
+ const { x: l, y: d } = O(a[0], a[1]);
1742
1742
  return [l, d];
1743
1743
  })).forEach(([a, l]) => {
1744
1744
  a < e[0] && (e[0] = a), l < e[1] && (e[1] = l), a > e[2] && (e[2] = a), l > e[3] && (e[3] = l);
@@ -1749,7 +1749,7 @@ class Bi extends W {
1749
1749
  getIndexesWebMercator(t, e) {
1750
1750
  let i, o = 1 / 0;
1751
1751
  for (let s = 0; s < t.length; s++) {
1752
- const n = L({ x: e.x, y: e.y }, { x: t[s][0], y: t[s][1] });
1752
+ const n = F({ x: e.x, y: e.y }, { x: t[s][0], y: t[s][1] });
1753
1753
  n < o && (i = s, o = n);
1754
1754
  }
1755
1755
  if (i === void 0) throw new Error("No closest coordinate found");
@@ -1776,19 +1776,19 @@ class Bi extends W {
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), !Ot(h, this.coordinatePrecision)) return !1;
1779
+ if (h[0] = w(h[0], this.coordinatePrecision), h[1] = w(h[1], this.coordinatePrecision), !It(h, this.coordinatePrecision)) return !1;
1780
1780
  }
1781
1781
  const n = this.midPoints.getUpdated(s) || [], a = this.selectionPoints.getUpdated(s) || [], l = this.coordinatePoints.getUpdated(o.id, s) || [], d = { type: o.geometry.type, coordinates: o.geometry.type === "Polygon" ? [s] : s };
1782
1782
  return !(i && !i({ id: this.draggedCoordinate.id, type: "Feature", geometry: d, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional }).valid || (this.store.updateGeometry([{ id: this.draggedCoordinate.id, geometry: d }, ...a, ...n, ...l]), 0));
1783
1783
  }
1784
1784
  }
1785
- const ji = { deselect: "Escape", delete: "Delete", rotate: ["Control", "r"], scale: ["Control", "s"] }, ue = { pointerOver: "move", dragStart: "move", dragEnd: "move", insertMidpoint: "crosshair" };
1786
- class $t extends ii {
1785
+ const Di = { deselect: "Escape", delete: "Delete", rotate: ["Control", "r"], scale: ["Control", "s"] }, le = { pointerOver: "move", dragStart: "move", dragEnd: "move", insertMidpoint: "crosshair" };
1786
+ class Gt 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 = ji, this.cursors = ue, 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 = Di, this.cursors = le, 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) : ue, 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) : le, 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 $t extends ii {
1804
1804
  this._state = "selecting";
1805
1805
  }
1806
1806
  registerBehaviors(t) {
1807
- this.pixelDistance = new pt(t), this.clickBoundingBox = new ut(t), this.featuresAtMouseEvent = new Mi(t, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new Fi(t), this.coordinatePoints = new De(t), this.midPoints = new Li(t, this.selectionPoints, this.coordinatePoints), this.coordinateSnap = new Et(t, this.pixelDistance, this.clickBoundingBox), this.lineSnap = new Rt(t, this.pixelDistance, this.clickBoundingBox), this.rotateFeature = new ki(t, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragFeature = new Di(t, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragCoordinate = new _i(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints, this.coordinateSnap, this.lineSnap), this.dragCoordinateResizeFeature = new Bi(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints), this.scaleFeature = new Ni(t, this.dragCoordinateResizeFeature);
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 Pt(t, this.pixelDistance, this.clickBoundingBox), this.lineSnap = new jt(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);
1808
1808
  }
1809
1809
  deselectFeature() {
1810
1810
  this.deselect();
@@ -1819,9 +1819,9 @@ class $t extends ii {
1819
1819
  onRightClick(t) {
1820
1820
  if (!this.selectionPoints.ids.length) return;
1821
1821
  let e, i = 1 / 0;
1822
- if (this.selectionPoints.ids.forEach((u) => {
1823
- const p = this.store.getGeometryCopy(u), g = this.pixelDistance.measure(t, p.coordinates);
1824
- g < this.pointerDistance && g < i && (i = g, e = this.store.getPropertiesCopy(u));
1822
+ if (this.selectionPoints.ids.forEach((p) => {
1823
+ const u = this.store.getGeometryCopy(p), g = this.pixelDistance.measure(t, u.coordinates);
1824
+ g < this.pointerDistance && g < i && (i = g, e = this.store.getPropertiesCopy(p));
1825
1825
  }), !e) return;
1826
1826
  const o = e.selectionPointFeatureId, s = e.index, n = this.store.getPropertiesCopy(o), a = this.flags[n.mode], l = this.validations[n.mode];
1827
1827
  if (!(a && a.feature && a.feature.coordinates && a.feature.coordinates.deletable)) return;
@@ -1951,9 +1951,9 @@ class $t extends ii {
1951
1951
  if (t.properties.selectionPoint) return e.pointColor = this.getHexColorStylingValue(this.styles.selectionPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.selectionPointOutlineColor, e.pointOutlineColor, t), e.pointWidth = this.getNumericStylingValue(this.styles.selectionPointWidth, e.pointWidth, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.selectionPointOutlineWidth, 2, t), e.zIndex = 30, e;
1952
1952
  if (t.properties.midPoint) return e.pointColor = this.getHexColorStylingValue(this.styles.midPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.midPointOutlineColor, e.pointOutlineColor, t), e.pointWidth = this.getNumericStylingValue(this.styles.midPointWidth, 4, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.midPointOutlineWidth, 2, t), e.zIndex = 50, e;
1953
1953
  } else if (t.properties[k.SELECTED]) {
1954
- if (t.geometry.type === "Polygon") return e.polygonFillColor = this.getHexColorStylingValue(this.styles.selectedPolygonColor, e.polygonFillColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.selectedPolygonOutlineWidth, e.polygonOutlineWidth, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.selectedPolygonOutlineColor, e.polygonOutlineColor, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.selectedPolygonFillOpacity, e.polygonFillOpacity, t), e.zIndex = T, e;
1955
- if (t.geometry.type === "LineString") return e.lineStringColor = this.getHexColorStylingValue(this.styles.selectedLineStringColor, e.lineStringColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.selectedLineStringWidth, e.lineStringWidth, t), e.zIndex = T, e;
1956
- if (t.geometry.type === "Point") return e.pointWidth = this.getNumericStylingValue(this.styles.selectedPointWidth, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(this.styles.selectedPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.selectedPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.selectedPointOutlineWidth, e.pointOutlineWidth, t), e.zIndex = T, e;
1954
+ if (t.geometry.type === "Polygon") return e.polygonFillColor = this.getHexColorStylingValue(this.styles.selectedPolygonColor, e.polygonFillColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.selectedPolygonOutlineWidth, e.polygonOutlineWidth, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.selectedPolygonOutlineColor, e.polygonOutlineColor, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.selectedPolygonFillOpacity, e.polygonFillOpacity, t), e.zIndex = j, e;
1955
+ if (t.geometry.type === "LineString") return e.lineStringColor = this.getHexColorStylingValue(this.styles.selectedLineStringColor, e.lineStringColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.selectedLineStringWidth, e.lineStringWidth, t), e.zIndex = j, e;
1956
+ if (t.geometry.type === "Point") return e.pointWidth = this.getNumericStylingValue(this.styles.selectedPointWidth, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(this.styles.selectedPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.selectedPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.selectedPointOutlineWidth, e.pointOutlineWidth, t), e.zIndex = j, e;
1957
1957
  }
1958
1958
  return e;
1959
1959
  }
@@ -1973,9 +1973,9 @@ class $t extends ii {
1973
1973
  }
1974
1974
  }
1975
1975
  }
1976
- class Wi extends G {
1976
+ class _i extends A {
1977
1977
  constructor(...t) {
1978
- super(...t), this.type = q.Static, this.mode = "static";
1978
+ super(...t), this.type = H.Static, this.mode = "static";
1979
1979
  }
1980
1980
  start() {
1981
1981
  }
@@ -2001,85 +2001,85 @@ class Wi extends G {
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 Ge(r, t, e, i, o) {
2004
+ function Te(r, t, e, i, o) {
2005
2005
  for (; i > e; ) {
2006
2006
  if (i - e > 600) {
2007
- const l = i - e + 1, d = t - e + 1, c = Math.log(l), h = 0.5 * Math.exp(2 * c / 3), u = 0.5 * Math.sqrt(c * h * (l - h) / l) * (d - l / 2 < 0 ? -1 : 1);
2008
- Ge(r, t, Math.max(e, Math.floor(t - d * h / l + u)), Math.min(i, Math.floor(t + (l - d) * h / l + u)), o);
2007
+ const l = i - e + 1, d = t - e + 1, c = Math.log(l), h = 0.5 * Math.exp(2 * c / 3), p = 0.5 * Math.sqrt(c * h * (l - h) / l) * (d - l / 2 < 0 ? -1 : 1);
2008
+ Te(r, t, Math.max(e, Math.floor(t - d * h / l + p)), Math.min(i, Math.floor(t + (l - d) * h / l + p)), o);
2009
2009
  }
2010
2010
  const s = r[t];
2011
2011
  let n = e, a = i;
2012
- for (st(r, e, t), o(r[i], s) > 0 && st(r, e, i); n < a; ) {
2013
- for (st(r, n, a), n++, a--; o(r[n], s) < 0; ) n++;
2012
+ for (it(r, e, t), o(r[i], s) > 0 && it(r, e, i); n < a; ) {
2013
+ for (it(r, n, a), n++, a--; o(r[n], s) < 0; ) n++;
2014
2014
  for (; o(r[a], s) > 0; ) a--;
2015
2015
  }
2016
- o(r[e], s) === 0 ? st(r, e, a) : (a++, st(r, a, i)), a <= t && (e = a + 1), t <= a && (i = a - 1);
2016
+ o(r[e], s) === 0 ? it(r, e, a) : (a++, it(r, a, i)), a <= t && (e = a + 1), t <= a && (i = a - 1);
2017
2017
  }
2018
2018
  }
2019
- function st(r, t, e) {
2019
+ function it(r, t, e) {
2020
2020
  const i = r[t];
2021
2021
  r[t] = r[e], r[e] = i;
2022
2022
  }
2023
- function Z(r, t) {
2024
- lt(r, 0, r.children.length, t, r);
2023
+ function J(r, t) {
2024
+ nt(r, 0, r.children.length, t, r);
2025
2025
  }
2026
- function lt(r, t, e, i, o) {
2027
- o || (o = tt([])), o.minX = 1 / 0, o.minY = 1 / 0, o.maxX = -1 / 0, o.maxY = -1 / 0;
2026
+ function nt(r, t, e, i, o) {
2027
+ o || (o = Z([])), o.minX = 1 / 0, o.minY = 1 / 0, o.maxX = -1 / 0, o.maxY = -1 / 0;
2028
2028
  for (let s = t; s < e; s++) {
2029
2029
  const n = r.children[s];
2030
- dt(o, r.leaf ? i(n) : n);
2030
+ at(o, r.leaf ? i(n) : n);
2031
2031
  }
2032
2032
  return o;
2033
2033
  }
2034
- function dt(r, t) {
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 Ti(r, t) {
2037
+ function ki(r, t) {
2038
2038
  return r.minX - t.minX;
2039
2039
  }
2040
- function Gi(r, t) {
2040
+ function Ni(r, t) {
2041
2041
  return r.minY - t.minY;
2042
2042
  }
2043
- function Dt(r) {
2043
+ function Et(r) {
2044
2044
  return (r.maxX - r.minX) * (r.maxY - r.minY);
2045
2045
  }
2046
- function Ct(r) {
2046
+ function ft(r) {
2047
2047
  return r.maxX - r.minX + (r.maxY - r.minY);
2048
2048
  }
2049
- function Ai(r, t) {
2049
+ function Ti(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 _t(r, t) {
2053
+ function wt(r, t) {
2054
2054
  return r.minX <= t.minX && r.minY <= t.minY && t.maxX <= r.maxX && t.maxY <= r.maxY;
2055
2055
  }
2056
- function Pt(r, t) {
2056
+ function mt(r, t) {
2057
2057
  return t.minX <= r.maxX && t.minY <= r.maxY && t.maxX >= r.minX && t.maxY >= r.minY;
2058
2058
  }
2059
- function tt(r) {
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 pe(r, t, e, i, o) {
2062
+ function de(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
- Ge(r, n, t, e, o), s.push(t, n, n, e);
2067
+ Te(r, n, t, e, o), s.push(t, n, n, e);
2068
2068
  }
2069
2069
  }
2070
- class Ui {
2070
+ class Wi {
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
  }
2074
2074
  search(t) {
2075
2075
  let e = this.data;
2076
2076
  const i = [];
2077
- if (!Pt(t, e)) return i;
2077
+ if (!mt(t, e)) return i;
2078
2078
  const o = this.toBBox, s = [];
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
- Pt(t, l) && (e.leaf ? i.push(a) : _t(t, l) ? this._all(a, i) : s.push(a));
2082
+ mt(t, l) && (e.leaf ? i.push(a) : wt(t, l) ? this._all(a, i) : s.push(a));
2083
2083
  }
2084
2084
  e = s.pop();
2085
2085
  }
@@ -2087,13 +2087,13 @@ class Ui {
2087
2087
  }
2088
2088
  collides(t) {
2089
2089
  let e = this.data;
2090
- if (Pt(t, e)) {
2090
+ if (mt(t, e)) {
2091
2091
  const i = [];
2092
2092
  for (; e; ) {
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
- if (Pt(t, n)) {
2096
- if (e.leaf || _t(t, n)) return !0;
2095
+ if (mt(t, n)) {
2096
+ if (e.leaf || wt(t, n)) return !0;
2097
2097
  i.push(s);
2098
2098
  }
2099
2099
  }
@@ -2122,7 +2122,7 @@ class Ui {
2122
2122
  this._insert(t, this.data.height - 1);
2123
2123
  }
2124
2124
  clear() {
2125
- this.data = tt([]);
2125
+ this.data = Z([]);
2126
2126
  }
2127
2127
  remove(t) {
2128
2128
  let e = this.data;
@@ -2133,7 +2133,7 @@ class Ui {
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 || !_t(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 || !wt(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) {
@@ -2153,26 +2153,26 @@ class Ui {
2153
2153
  _build(t, e, i, o) {
2154
2154
  const s = i - e + 1;
2155
2155
  let n, a = this._maxEntries;
2156
- if (s <= a) return n = tt(t.slice(e, i + 1)), Z(n, this.toBBox), n;
2157
- o || (o = Math.ceil(Math.log(s) / Math.log(a)), a = Math.ceil(s / Math.pow(a, o - 1))), n = tt([]), n.leaf = !1, n.height = o;
2156
+ if (s <= a) return n = Z(t.slice(e, i + 1)), J(n, this.toBBox), n;
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
- pe(t, e, i, d, this.compareMinX);
2159
+ de(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
- pe(t, c, h, l, this.compareMinY);
2163
- for (let u = c; u <= h; u += l) {
2164
- const p = Math.min(u + l - 1, h);
2165
- n.children.push(this._build(t, u, p, o - 1));
2162
+ de(t, c, h, l, this.compareMinY);
2163
+ for (let p = c; p <= h; p += l) {
2164
+ const u = Math.min(p + l - 1, h);
2165
+ n.children.push(this._build(t, p, u, o - 1));
2166
2166
  }
2167
2167
  }
2168
- return Z(n, this.toBBox), n;
2168
+ return J(n, this.toBBox), n;
2169
2169
  }
2170
2170
  _chooseSubtree(t, e, i, o) {
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 = Dt(h), p = (s = t, n = h, (Math.max(n.maxX, s.maxX) - Math.min(n.minX, s.minX)) * (Math.max(n.maxY, s.maxY) - Math.min(n.minY, s.minY)) - u);
2175
- p < d ? (d = p, l = u < l ? u : l, a = h) : p === d && u < l && (l = u, a = h);
2174
+ const h = e.children[c], p = Et(h), u = (s = t, n = h, (Math.max(n.maxX, s.maxX) - Math.min(n.minX, s.minX)) * (Math.max(n.maxY, s.maxY) - Math.min(n.minY, s.minY)) - p);
2175
+ u < d ? (d = u, l = p < l ? p : l, a = h) : u === d && p < l && (l = p, a = h);
2176
2176
  }
2177
2177
  e = a || e.children[0];
2178
2178
  }
@@ -2181,54 +2181,54 @@ class Ui {
2181
2181
  }
2182
2182
  _insert(t, e, i) {
2183
2183
  const o = i ? t : this.toBBox(t), s = [], n = this._chooseSubtree(o, this.data, e, s);
2184
- for (n.children.push(t), dt(n, o); e >= 0 && s[e].children.length > this._maxEntries; ) this._split(s, e), e--;
2184
+ for (n.children.push(t), at(n, o); e >= 0 && s[e].children.length > this._maxEntries; ) this._split(s, e), e--;
2185
2185
  this._adjustParentBBoxes(o, s, e);
2186
2186
  }
2187
2187
  _split(t, e) {
2188
2188
  const i = t[e], o = i.children.length, s = this._minEntries;
2189
2189
  this._chooseSplitAxis(i, s, o);
2190
- const n = this._chooseSplitIndex(i, s, o), a = tt(i.children.splice(n, i.children.length - n));
2191
- a.height = i.height, a.leaf = i.leaf, Z(i, this.toBBox), Z(a, this.toBBox), e ? t[e - 1].children.push(a) : this._splitRoot(i, a);
2190
+ const n = this._chooseSplitIndex(i, s, o), a = Z(i.children.splice(n, i.children.length - n));
2191
+ a.height = i.height, a.leaf = i.leaf, J(i, this.toBBox), J(a, this.toBBox), e ? t[e - 1].children.push(a) : this._splitRoot(i, a);
2192
2192
  }
2193
2193
  _splitRoot(t, e) {
2194
- this.data = tt([t, e]), this.data.height = t.height + 1, this.data.leaf = !1, Z(this.data, this.toBBox);
2194
+ this.data = Z([t, e]), this.data.height = t.height + 1, this.data.leaf = !1, J(this.data, this.toBBox);
2195
2195
  }
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 = lt(t, 0, a, this.toBBox), d = lt(t, a, i, this.toBBox), c = Ai(l, d), h = Dt(l) + Dt(d);
2199
+ const l = nt(t, 0, a, this.toBBox), d = nt(t, a, i, this.toBBox), c = Ti(l, d), h = Et(l) + Et(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 : Ti, s = t.leaf ? this.compareMinY : Gi;
2205
+ const o = t.leaf ? this.compareMinX : ki, s = t.leaf ? this.compareMinY : Ni;
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) {
2209
2209
  t.children.sort(o);
2210
- const s = this.toBBox, n = lt(t, 0, e, s), a = lt(t, i - e, i, s);
2211
- let l = Ct(n) + Ct(a);
2210
+ const s = this.toBBox, n = nt(t, 0, e, s), a = nt(t, i - e, i, s);
2211
+ let l = ft(n) + ft(a);
2212
2212
  for (let d = e; d < i - e; d++) {
2213
2213
  const c = t.children[d];
2214
- dt(n, t.leaf ? s(c) : c), l += Ct(n);
2214
+ at(n, t.leaf ? s(c) : c), l += ft(n);
2215
2215
  }
2216
2216
  for (let d = i - e - 1; d >= e; d--) {
2217
2217
  const c = t.children[d];
2218
- dt(a, t.leaf ? s(c) : c), l += Ct(a);
2218
+ at(a, t.leaf ? s(c) : c), l += ft(a);
2219
2219
  }
2220
2220
  return l;
2221
2221
  }
2222
2222
  _adjustParentBBoxes(t, e, i) {
2223
- for (let o = i; o >= 0; o--) dt(e[o], t);
2223
+ for (let o = i; o >= 0; o--) at(e[o], t);
2224
2224
  }
2225
2225
  _condense(t) {
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() : Z(t[i], this.toBBox);
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 Ri {
2229
+ class Bi {
2230
2230
  constructor(t) {
2231
- this.tree = void 0, this.idToNode = void 0, this.nodeToId = void 0, this.tree = new Ui(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 Wi(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 Ri {
2279
2279
  return this.tree.collides(this.toBBox(t));
2280
2280
  }
2281
2281
  }
2282
- const zi = { getId: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(r) {
2282
+ const ji = { 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 Vi {
2286
+ class Ai {
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 Ri(), this.tracked = !t || t.tracked !== !1, this.idStrategy = t && t.idStrategy ? t.idStrategy : zi;
2289
+ }, this.store = {}, this.spatialIndex = new Bi(), this.tracked = !t || t.tracked !== !1, this.idStrategy = t && t.idStrategy ? t.idStrategy : ji;
2290
2290
  }
2291
2291
  clone(t) {
2292
2292
  return JSON.parse(JSON.stringify(t));
@@ -2301,23 +2301,27 @@ class Vi {
2301
2301
  if (t.length === 0) return [];
2302
2302
  let s = this.clone(t);
2303
2303
  const n = [], a = [];
2304
- return s = s.filter((l) => {
2305
- l.id == null && (l.id = this.idStrategy.getId());
2306
- const d = l.id;
2304
+ s = s.filter((d) => {
2305
+ d.id == null && (d.id = this.idStrategy.getId());
2306
+ const c = d.id;
2307
2307
  if (e) {
2308
- const c = e(l);
2309
- if (!c.valid) return a.push({ id: d, valid: !1, reason: c.reason }), !1;
2308
+ const h = e(d);
2309
+ if (!h.valid) return n.push({ id: c, valid: !1, reason: h.reason }), !1;
2310
2310
  }
2311
2311
  if (this.tracked) {
2312
- if (l.properties.createdAt) {
2313
- if (!ee(l.properties.createdAt)) return a.push({ id: l.id, valid: !1, reason: "createdAt is not a valid numeric timestamp" }), !1;
2314
- } else l.properties.createdAt = +/* @__PURE__ */ new Date();
2315
- if (l.properties.updatedAt) {
2316
- if (!ee(l.properties.updatedAt)) return a.push({ id: l.id, valid: !1, reason: "updatedAt is not a valid numeric timestamp" }), !1;
2317
- } else l.properties.updatedAt = +/* @__PURE__ */ new Date();
2312
+ if (d.properties.createdAt) {
2313
+ if (!qt(d.properties.createdAt)) return n.push({ id: d.id, valid: !1, reason: "createdAt is not a valid numeric timestamp" }), !1;
2314
+ } else d.properties.createdAt = +/* @__PURE__ */ new Date();
2315
+ if (d.properties.updatedAt) {
2316
+ if (!qt(d.properties.updatedAt)) return n.push({ id: d.id, valid: !1, reason: "updatedAt is not a valid numeric timestamp" }), !1;
2317
+ } else d.properties.updatedAt = +/* @__PURE__ */ new Date();
2318
2318
  }
2319
- return this.has(d) ? (a.push({ id: d, valid: !1, reason: `Feature already exists with this id: ${d}` }), !1) : (this.store[d] = l, n.push(d), i && i(l), a.push({ id: d, valid: !0 }), !0);
2320
- }), this.spatialIndex.load(s), n.length > 0 && this._onChange(n, "create", o), a;
2319
+ return this.has(c) ? (n.push({ id: c, valid: !1, reason: `Feature already exists with this id: ${c}` }), !1) : (this.store[c] = d, a.push(d), n.push({ id: c, valid: !0 }), !0);
2320
+ }), this.spatialIndex.load(s);
2321
+ const l = a.map(({ id: d }) => d);
2322
+ return l.length > 0 && (this._onChange(l, "create", o), i && a.forEach((d) => {
2323
+ i(d);
2324
+ })), n;
2321
2325
  }
2322
2326
  search(t, e) {
2323
2327
  const i = this.spatialIndex.search(t).map((o) => this.store[o]);
@@ -2386,23 +2390,23 @@ class Vi {
2386
2390
  return Object.keys(this.store).length;
2387
2391
  }
2388
2392
  }
2389
- const $i = "Feature is not a Polygon or LineString", Ki = "Feature intersects itself", Xi = (r) => r.geometry.type !== "Polygon" && r.geometry.type !== "LineString" ? { valid: !1, reason: $i } : Gt(r) ? { valid: !1, reason: Ki } : { valid: !0 };
2390
- function ge(r, t, e) {
2391
- const i = U(r, t);
2392
- let o = U(t, e) - i;
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 } : Tt(r) ? { valid: !1, reason: Gi } : { valid: !0 };
2394
+ function ce(r, t, e) {
2395
+ const i = G(r, t);
2396
+ let o = G(t, e) - i;
2393
2397
  return o < 0 && (o += 360), 180 - Math.abs(o - 90 - 90);
2394
2398
  }
2395
- const Yi = { cancel: "Escape", finish: "Enter" }, Hi = { start: "crosshair", close: "pointer" };
2396
- class Ae extends G {
2399
+ const zi = { cancel: "Escape", finish: "Enter" }, Vi = { start: "crosshair", close: "pointer" };
2400
+ class We extends A {
2397
2401
  constructor(t) {
2398
- super(t, !0), this.mode = "angled-rectangle", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Yi, this.cursors = Hi, this.mouseMove = !1, this.updateOptions(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);
2399
2403
  }
2400
2404
  updateOptions(t) {
2401
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));
2402
2406
  }
2403
2407
  close() {
2404
2408
  if (this.currentId === void 0) return;
2405
- this.store.updateProperty([{ id: this.currentId, property: D, value: void 0 }]);
2409
+ this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2406
2410
  const t = this.currentId;
2407
2411
  this.currentCoordinate = 0, this.currentId = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(t, { mode: this.mode, action: "draw" });
2408
2412
  }
@@ -2420,10 +2424,10 @@ class Ae extends G {
2420
2424
  const o = 1 / Math.pow(10, this.coordinatePrecision - 1), s = Math.max(1e-6, o);
2421
2425
  i = [e[0], [t.lng, t.lat], [t.lng, t.lat - s], e[0]];
2422
2426
  } else if (this.currentCoordinate === 2) {
2423
- const o = e[0], s = e[1], n = Be(o, s, this.coordinatePrecision, this.project, this.unproject), a = I(o[0], o[1]), l = I(n[0], n[1]), d = I(s[0], s[1]), c = I(t.lng, t.lat), h = L(c, a) < L(c, d), u = ge(a, l, c), p = h ? 90 - u : ge(a, l, c) - 90, g = L(l, c), y = Math.cos(M(p)) * g, m = U(a, d) + ((function(S, E, O) {
2424
- const F = (O.x - E.x) * (S.y - E.y) - (O.y - E.y) * (S.x - E.x);
2425
- return F > 1e-10 ? "left" : F < -1e-10 ? "right" : "left";
2426
- })(a, d, c) === "right" ? -90 : 90), v = gt(a, y, m), C = gt(d, y, m), f = A(v.x, v.y), P = A(C.x, C.y);
2427
+ const o = e[0], s = e[1], n = De(o, s, this.coordinatePrecision, this.project, this.unproject), a = O(o[0], o[1]), l = O(n[0], n[1]), d = O(s[0], s[1]), c = O(t.lng, t.lat), h = F(c, a) < F(c, d), p = ce(a, l, c), u = h ? 90 - p : ce(a, l, c) - 90, g = F(l, c), y = Math.cos(D(u)) * g, m = G(a, d) + ((function(I, E, L) {
2428
+ const M = (L.x - E.x) * (I.y - E.y) - (L.y - E.y) * (I.x - E.x);
2429
+ return M > 1e-10 ? "left" : M < -1e-10 ? "right" : "left";
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);
2427
2431
  i = [e[0], e[1], [P.lng, P.lat], [f.lng, f.lat], e[0]];
2428
2432
  }
2429
2433
  i && this.updatePolygonGeometry(this.currentId, i, b.Provisional);
@@ -2434,11 +2438,11 @@ class Ae extends G {
2434
2438
  }
2435
2439
  onClick(t) {
2436
2440
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) if (this.currentCoordinate > 0 && !this.mouseMove && this.onMouseMove(t), this.mouseMove = !1, this.currentCoordinate === 0) {
2437
- const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [D]: !0 } }]);
2441
+ const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2438
2442
  this.currentId = e, this.currentCoordinate++, this.setDrawing();
2439
2443
  } else if (this.currentCoordinate === 1 && this.currentId) {
2440
2444
  const e = this.store.getGeometryCopy(this.currentId);
2441
- if (it([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]], b.Commit)) return;
2442
2446
  this.currentCoordinate++;
2443
2447
  } else this.currentCoordinate === 2 && this.currentId && this.close();
2444
2448
  }
@@ -2466,30 +2470,30 @@ class Ae extends G {
2466
2470
  }
2467
2471
  styleFeature(t) {
2468
2472
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
2469
- return t.properties.mode === this.mode && t.geometry.type === "Polygon" && (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 = T), e;
2473
+ return t.properties.mode === this.mode && t.geometry.type === "Polygon" && (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;
2470
2474
  }
2471
2475
  validateFeature(t) {
2472
- return this.validateModeFeature(t, (e) => yt(e, this.coordinatePrecision));
2476
+ return this.validateModeFeature(t, (e) => ut(e, this.coordinatePrecision));
2473
2477
  }
2474
2478
  afterFeatureUpdated(t) {
2475
2479
  this.currentId === t.id && (this.currentId = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
2476
2480
  }
2477
2481
  }
2478
- function Ue(r, t, e) {
2482
+ function Be(r, t, e) {
2479
2483
  return (t.x - r.x) * (e.y - r.y) - (t.y - r.y) * (e.x - r.x) <= 0;
2480
2484
  }
2481
- const Ji = { cancel: "Escape", finish: "Enter" }, qi = { start: "crosshair", close: "pointer" };
2482
- class Re extends G {
2485
+ const $i = { cancel: "Escape", finish: "Enter" }, Yi = { start: "crosshair", close: "pointer" };
2486
+ class je extends A {
2483
2487
  constructor(t) {
2484
- super(t, !0), this.mode = "sector", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Ji, this.direction = void 0, this.arcPoints = 64, this.cursors = qi, this.mouseMove = !1, this.updateOptions(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);
2485
2489
  }
2486
2490
  updateOptions(t) {
2487
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);
2488
2492
  }
2489
2493
  close() {
2490
2494
  if (this.currentId === void 0) return;
2491
- const t = ft(this.store.getGeometryCopy(this.currentId));
2492
- t && this.store.updateGeometry([{ id: this.currentId, geometry: t }]), this.store.updateProperty([{ id: this.currentId, property: D, value: void 0 }]);
2495
+ const t = pt(this.store.getGeometryCopy(this.currentId));
2496
+ t && this.store.updateGeometry([{ id: this.currentId, geometry: t }]), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2493
2497
  const e = this.currentId;
2494
2498
  this.currentCoordinate = 0, this.currentId = void 0, this.direction = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
2495
2499
  }
@@ -2507,19 +2511,19 @@ class Re extends G {
2507
2511
  const o = 1 / Math.pow(10, this.coordinatePrecision - 1), s = Math.max(1e-6, o);
2508
2512
  i = [e[0], [t.lng, t.lat], [t.lng, t.lat - s], e[0]];
2509
2513
  } else if (this.currentCoordinate === 2) {
2510
- const o = e[0], s = e[1], n = [t.lng, t.lat], a = I(o[0], o[1]), l = I(s[0], s[1]), d = I(n[0], n[1]);
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]);
2511
2515
  if (this.direction === void 0) {
2512
- const f = Ue(a, l, d);
2516
+ const f = Be(a, l, d);
2513
2517
  this.direction = f ? "clockwise" : "anticlockwise";
2514
2518
  }
2515
- const c = L(a, l), h = U(a, l), u = U(a, d), p = this.arcPoints, g = [o], y = H(h), m = H(u);
2519
+ const c = F(a, l), h = G(a, l), p = G(a, d), u = this.arcPoints, g = [o], y = X(h), m = X(p);
2516
2520
  let v;
2517
2521
  this.direction === "anticlockwise" ? (v = m - y, v < 0 && (v += 360)) : (v = y - m, v < 0 && (v += 360));
2518
- const C = (this.direction === "anticlockwise" ? 1 : -1) * v / p;
2522
+ const C = (this.direction === "anticlockwise" ? 1 : -1) * v / u;
2519
2523
  g.push(s);
2520
- for (let f = 0; f <= p; f++) {
2521
- const P = gt(a, c, y + f * C), { lng: S, lat: E } = A(P.x, P.y), O = [w(S, this.coordinatePrecision), w(E, this.coordinatePrecision)];
2522
- O[0] !== g[g.length - 1][0] && O[1] !== g[g.length - 1][1] && g.push(O);
2524
+ for (let f = 0; f <= u; f++) {
2525
+ const P = ht(a, c, y + f * C), { lng: I, lat: E } = R(P.x, P.y), L = [w(I, this.coordinatePrecision), w(E, this.coordinatePrecision)];
2526
+ L[0] !== g[g.length - 1][0] && L[1] !== g[g.length - 1][1] && g.push(L);
2523
2527
  }
2524
2528
  g.push(o), i = [...g];
2525
2529
  }
@@ -2531,11 +2535,11 @@ class Re extends G {
2531
2535
  }
2532
2536
  onClick(t) {
2533
2537
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) if (this.currentCoordinate > 0 && !this.mouseMove && this.onMouseMove(t), this.mouseMove = !1, this.currentCoordinate === 0) {
2534
- const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [D]: !0 } }]);
2538
+ const [e] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat], [t.lng, t.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2535
2539
  this.currentId = e, this.currentCoordinate++, this.setDrawing();
2536
2540
  } else if (this.currentCoordinate === 1 && this.currentId) {
2537
2541
  const e = this.store.getGeometryCopy(this.currentId);
2538
- if (it([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]], b.Commit)) return;
2539
2543
  this.currentCoordinate++;
2540
2544
  } else this.currentCoordinate === 2 && this.currentId && this.close();
2541
2545
  }
@@ -2559,19 +2563,19 @@ class Re extends G {
2559
2563
  }
2560
2564
  styleFeature(t) {
2561
2565
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
2562
- return t.properties.mode === this.mode && t.geometry.type === "Polygon" && (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 = T), e;
2566
+ return t.properties.mode === this.mode && t.geometry.type === "Polygon" && (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;
2563
2567
  }
2564
2568
  validateFeature(t) {
2565
- return this.validateModeFeature(t, (e) => yt(e, this.coordinatePrecision));
2569
+ return this.validateModeFeature(t, (e) => ut(e, this.coordinatePrecision));
2566
2570
  }
2567
2571
  afterFeatureUpdated(t) {
2568
2572
  this.currentId === t.id && (this.currentId = void 0, this.direction = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
2569
2573
  }
2570
2574
  }
2571
- const Zi = { cancel: "Escape", finish: "Enter" }, Qi = { start: "crosshair", close: "pointer" };
2572
- class ze extends G {
2575
+ const Ki = { cancel: "Escape", finish: "Enter" }, Xi = { start: "crosshair", close: "pointer" };
2576
+ class Ae extends A {
2573
2577
  constructor(t) {
2574
- super(t, !0), this.mode = "sensor", this.currentCoordinate = 0, this.currentId = void 0, this.currentInitialArcId = void 0, this.currentStartingPointId = void 0, this.keyEvents = Zi, this.direction = void 0, this.arcPoints = 64, this.cursors = Qi, 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 = Ki, this.direction = void 0, this.arcPoints = 64, this.cursors = Xi, this.mouseMove = !1, this.updateOptions(t);
2575
2579
  }
2576
2580
  updateOptions(t) {
2577
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);
@@ -2580,8 +2584,8 @@ class ze extends G {
2580
2584
  if (this.currentStartingPointId === void 0) return;
2581
2585
  const t = this.currentStartingPointId, e = this.currentInitialArcId, i = this.currentId;
2582
2586
  if (t && this.store.delete([t]), e && this.store.delete([e]), this.currentId) {
2583
- const o = ft(this.store.getGeometryCopy(this.currentId));
2584
- o && this.store.updateGeometry([{ id: this.currentId, geometry: o }]), this.store.updateProperty([{ id: this.currentId, property: D, value: void 0 }]);
2587
+ const o = pt(this.store.getGeometryCopy(this.currentId));
2588
+ o && this.store.updateGeometry([{ id: this.currentId, geometry: o }]), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2585
2589
  }
2586
2590
  this.currentCoordinate = 0, this.currentStartingPointId = void 0, this.currentInitialArcId = void 0, this.currentId = void 0, this.direction = void 0, this.state === "drawing" && this.setStarted(), i && this.onFinish(i, { mode: this.mode, action: "draw" });
2587
2591
  }
@@ -2594,31 +2598,31 @@ class ze extends G {
2594
2598
  onMouseMove(t) {
2595
2599
  if (this.mouseMove = !0, this.setCursor(this.cursors.start), this.currentInitialArcId !== void 0 && this.currentStartingPointId !== void 0 && this.currentCoordinate !== 0) {
2596
2600
  if (this.currentCoordinate === 2) {
2597
- const e = this.store.getGeometryCopy(this.currentInitialArcId).coordinates, i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], s = [t.lng, t.lat], n = I(o[0], o[1]), a = I(s[0], s[1]), l = I(i[0], i[1]), d = L(l, n);
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);
2598
2602
  if (this.direction === void 0) {
2599
- const C = Ue(l, n, a);
2603
+ const C = Be(l, n, a);
2600
2604
  this.direction = C ? "clockwise" : "anticlockwise";
2601
2605
  }
2602
- const c = U(l, n), h = U(l, a), u = this.arcPoints, p = [o], g = H(c), y = H(h);
2606
+ const c = G(l, n), h = G(l, a), p = this.arcPoints, u = [o], g = X(c), y = X(h);
2603
2607
  let m;
2604
2608
  this.direction === "anticlockwise" ? (m = y - g, m < 0 && (m += 360)) : (m = g - y, m < 0 && (m += 360));
2605
- const v = (this.direction === "anticlockwise" ? 1 : -1) * m / u;
2606
- for (let C = 0; C <= u; C++) {
2607
- const f = gt(l, d, g + C * v), { lng: P, lat: S } = A(f.x, f.y), E = [w(P, this.coordinatePrecision), w(S, this.coordinatePrecision)];
2608
- E[0] !== p[p.length - 1][0] && E[1] !== p[p.length - 1][1] && p.push(E);
2609
+ const v = (this.direction === "anticlockwise" ? 1 : -1) * m / p;
2610
+ for (let C = 0; C <= p; C++) {
2611
+ const f = ht(l, d, g + C * v), { lng: P, lat: I } = R(f.x, f.y), E = [w(P, this.coordinatePrecision), w(I, this.coordinatePrecision)];
2612
+ E[0] !== u[u.length - 1][0] && E[1] !== u[u.length - 1][1] && u.push(E);
2609
2613
  }
2610
- this.updateLineStringGeometry(this.currentInitialArcId, p, b.Provisional);
2614
+ this.updateLineStringGeometry(this.currentInitialArcId, u, b.Provisional);
2611
2615
  } else if (this.currentCoordinate === 3) {
2612
2616
  const e = this.store.getGeometryCopy(this.currentInitialArcId).coordinates;
2613
2617
  if (e.length < 2 || !this.direction) return;
2614
- const i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], s = e[e.length - 1], n = I(t.lng, t.lat), a = I(o[0], o[1]), l = I(s[0], s[1]), d = I(i[0], i[1]), c = L(d, a), h = L(d, n) < c ? a : n, u = U(d, n), p = U(d, a), g = U(d, l), y = H(p), m = H(g), v = H(u);
2618
+ const i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], s = e[e.length - 1], n = O(t.lng, t.lat), a = O(o[0], o[1]), l = O(s[0], s[1]), d = O(i[0], i[1]), c = F(d, a), h = F(d, n) < c ? a : n, p = G(d, n), u = G(d, a), g = G(d, l), y = X(u), m = X(g), v = X(p);
2615
2619
  if (this.notInSector({ normalizedCursor: v, normalizedStart: y, normalizedEnd: m, direction: this.direction })) return;
2616
- const C = this.getDeltaBearing(this.direction, y, m), f = this.arcPoints, P = (this.direction === "anticlockwise" ? 1 : -1) * C / f, S = L(d, h), E = [];
2617
- for (let O = 0; O <= f; O++) {
2618
- const F = gt(d, S, y + O * P), { lng: N, lat: _ } = A(F.x, F.y), B = [w(N, this.coordinatePrecision), w(_, this.coordinatePrecision)];
2619
- B[0] !== e[e.length - 1][0] && B[1] !== e[e.length - 1][1] && E.unshift(B);
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 = [];
2621
+ for (let L = 0; L <= f; L++) {
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);
2620
2624
  }
2621
- e.push(...E), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, b.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode, [D]: !0 } }]);
2625
+ e.push(...E), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, b.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
2622
2626
  }
2623
2627
  }
2624
2628
  }
@@ -2659,10 +2663,10 @@ class ze extends G {
2659
2663
  }
2660
2664
  styleFeature(t) {
2661
2665
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
2662
- return t.properties.mode === this.mode && (t.geometry.type === "Polygon" ? (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 = T) : t.geometry.type === "LineString" ? (e.lineStringColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.zIndex = T) : t.geometry.type === "Point" && (e.pointColor = this.getHexColorStylingValue(this.styles.centerPointColor, e.pointColor, t), e.pointWidth = this.getNumericStylingValue(this.styles.centerPointWidth, e.pointWidth, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.centerPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.centerPointOutlineWidth, e.pointOutlineWidth, t), e.zIndex = 20)), e;
2666
+ return t.properties.mode === this.mode && (t.geometry.type === "Polygon" ? (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) : t.geometry.type === "LineString" ? (e.lineStringColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.zIndex = j) : t.geometry.type === "Point" && (e.pointColor = this.getHexColorStylingValue(this.styles.centerPointColor, e.pointColor, t), e.pointWidth = this.getNumericStylingValue(this.styles.centerPointWidth, e.pointWidth, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.centerPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.centerPointOutlineWidth, e.pointOutlineWidth, t), e.zIndex = 20)), e;
2663
2667
  }
2664
2668
  validateFeature(t) {
2665
- return this.validateModeFeature(t, (e) => yt(e, this.coordinatePrecision));
2669
+ return this.validateModeFeature(t, (e) => ut(e, this.coordinatePrecision));
2666
2670
  }
2667
2671
  afterFeatureUpdated(t) {
2668
2672
  this.currentId === t.id && (this.currentStartingPointId && this.store.delete([this.currentStartingPointId]), this.currentInitialArcId && this.store.delete([this.currentInitialArcId]), this.currentStartingPointId = void 0, this.direction = void 0, this.currentId = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
@@ -2675,7 +2679,7 @@ class ze extends G {
2675
2679
  return o === "clockwise" ? e <= i ? t >= e && t <= i : t >= e || t <= i : e >= i ? t <= e && t >= i : t <= e || t >= i;
2676
2680
  }
2677
2681
  }
2678
- class Q {
2682
+ class q {
2679
2683
  constructor({ name: t, callback: e, unregister: i, register: o }) {
2680
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 = () => {
2681
2685
  this.registered || (this.registered = !0, o(e));
@@ -2684,7 +2688,7 @@ class Q {
2684
2688
  }, this.callback = e;
2685
2689
  }
2686
2690
  }
2687
- var to = { __proto__: null, TerraDrawBaseAdapter: class {
2691
+ var Hi = { __proto__: null, TerraDrawBaseAdapter: class {
2688
2692
  constructor(r) {
2689
2693
  this._nextKeyUpIsContextMenu = !1, this._minPixelDragDistance = void 0, this._minPixelDragDistanceDrawing = void 0, this._minPixelDragDistanceSelecting = void 0, this._lastDrawEvent = void 0, this._coordinatePrecision = void 0, this._heldKeys = /* @__PURE__ */ new Set(), this._listeners = [], this._dragState = "not-dragging", this._currentModeCallbacks = void 0, this._minPixelDragDistance = typeof r.minPixelDragDistance == "number" ? r.minPixelDragDistance : 1, this._minPixelDragDistanceSelecting = typeof r.minPixelDragDistanceSelecting == "number" ? r.minPixelDragDistanceSelecting : 1, this._minPixelDragDistanceDrawing = typeof r.minPixelDragDistanceDrawing == "number" ? r.minPixelDragDistanceDrawing : 8, this._coordinatePrecision = typeof r.coordinatePrecision == "number" ? r.coordinatePrecision : 9;
2690
2694
  }
@@ -2710,7 +2714,7 @@ var to = { __proto__: null, TerraDrawBaseAdapter: class {
2710
2714
  return this._coordinatePrecision;
2711
2715
  }
2712
2716
  getAdapterListeners() {
2713
- return [new Q({ name: "pointerdown", callback: (r) => {
2717
+ return [new q({ name: "pointerdown", callback: (r) => {
2714
2718
  if (!this._currentModeCallbacks || !r.isPrimary) return;
2715
2719
  const t = this.getDrawEventFromEvent(r);
2716
2720
  t && (this._dragState = "pre-dragging", this._lastDrawEvent = t);
@@ -2718,14 +2722,14 @@ var to = { __proto__: null, TerraDrawBaseAdapter: class {
2718
2722
  this.getMapEventElement().addEventListener("pointerdown", r);
2719
2723
  }, unregister: (r) => {
2720
2724
  this.getMapEventElement().removeEventListener("pointerdown", r);
2721
- } }), new Q({ name: "pointermove", callback: (r) => {
2725
+ } }), new q({ name: "pointermove", callback: (r) => {
2722
2726
  if (!this._currentModeCallbacks || !r.isPrimary) return;
2723
2727
  r.preventDefault();
2724
2728
  const t = this.getDrawEventFromEvent(r);
2725
2729
  if (t) if (this._dragState === "not-dragging") this._currentModeCallbacks.onMouseMove(t), this._lastDrawEvent = t;
2726
2730
  else if (this._dragState === "pre-dragging") {
2727
2731
  if (!this._lastDrawEvent) return;
2728
- const e = { x: this._lastDrawEvent.containerX, y: this._lastDrawEvent.containerY }, i = { x: t.containerX, y: t.containerY }, o = this._currentModeCallbacks.getState(), s = L(e, i);
2732
+ const e = { x: this._lastDrawEvent.containerX, y: this._lastDrawEvent.containerY }, i = { x: t.containerX, y: t.containerY }, o = this._currentModeCallbacks.getState(), s = F(e, i);
2729
2733
  let n = !1;
2730
2734
  if (n = o === "drawing" ? s < this._minPixelDragDistanceDrawing : o === "selecting" ? s < this._minPixelDragDistanceSelecting : s < this._minPixelDragDistance, n) return;
2731
2735
  this._nextKeyUpIsContextMenu = !1, this._dragState = "dragging", this._currentModeCallbacks.onDragStart(t, (a) => {
@@ -2738,13 +2742,13 @@ var to = { __proto__: null, TerraDrawBaseAdapter: class {
2738
2742
  this.getMapEventElement().addEventListener("pointermove", r);
2739
2743
  }, unregister: (r) => {
2740
2744
  this.getMapEventElement().removeEventListener("pointermove", r);
2741
- } }), new Q({ name: "contextmenu", callback: (r) => {
2745
+ } }), new q({ name: "contextmenu", callback: (r) => {
2742
2746
  this._currentModeCallbacks && (r.preventDefault(), this._nextKeyUpIsContextMenu = !0);
2743
2747
  }, register: (r) => {
2744
2748
  this.getMapEventElement().addEventListener("contextmenu", r);
2745
2749
  }, unregister: (r) => {
2746
2750
  this.getMapEventElement().removeEventListener("contextmenu", r);
2747
- } }), new Q({ name: "pointerup", callback: (r) => {
2751
+ } }), new q({ name: "pointerup", callback: (r) => {
2748
2752
  if (!this._currentModeCallbacks || r.target !== this.getMapEventElement() || !r.isPrimary) return;
2749
2753
  const t = this.getDrawEventFromEvent(r);
2750
2754
  t && (this._dragState === "dragging" ? this._currentModeCallbacks.onDragEnd(t, (e) => {
@@ -2754,13 +2758,13 @@ var to = { __proto__: null, TerraDrawBaseAdapter: class {
2754
2758
  this.getMapEventElement().addEventListener("pointerup", r);
2755
2759
  }, unregister: (r) => {
2756
2760
  this.getMapEventElement().removeEventListener("pointerup", r);
2757
- } }), new Q({ name: "keyup", callback: (r) => {
2761
+ } }), new q({ name: "keyup", callback: (r) => {
2758
2762
  this._currentModeCallbacks && (this._heldKeys.delete(r.key), this._currentModeCallbacks.onKeyUp({ key: r.key, heldKeys: Array.from(this._heldKeys), preventDefault: () => r.preventDefault() }));
2759
2763
  }, register: (r) => {
2760
2764
  this.getMapEventElement().addEventListener("keyup", r);
2761
2765
  }, unregister: (r) => {
2762
2766
  this.getMapEventElement().removeEventListener("keyup", r);
2763
- } }), new Q({ name: "keydown", callback: (r) => {
2767
+ } }), new q({ name: "keydown", callback: (r) => {
2764
2768
  this._currentModeCallbacks && (this._heldKeys.add(r.key), this._currentModeCallbacks.onKeyDown({ key: r.key, heldKeys: Array.from(this._heldKeys), preventDefault: () => r.preventDefault() }));
2765
2769
  }, register: (r) => {
2766
2770
  this.getMapEventElement().addEventListener("keydown", r);
@@ -2774,17 +2778,17 @@ var to = { __proto__: null, TerraDrawBaseAdapter: class {
2774
2778
  }), this.clear(), this._currentModeCallbacks = void 0;
2775
2779
  }
2776
2780
  } };
2777
- const eo = { cancel: "Escape", finish: "Enter" }, io = { start: "crosshair", close: "pointer" };
2778
- class Ve extends G {
2781
+ const Ji = { cancel: "Escape", finish: "Enter" }, qi = { start: "crosshair", close: "pointer" };
2782
+ class Re extends A {
2779
2783
  constructor(t) {
2780
- super(t, !0), this.mode = "freehand-linestring", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = eo, this.cursors = io, 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 = Ji, this.cursors = qi, this.preventNewFeature = !1, this.updateOptions(t);
2781
2785
  }
2782
2786
  updateOptions(t) {
2783
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));
2784
2788
  }
2785
2789
  close() {
2786
2790
  if (this.currentId === void 0) return;
2787
- this.currentId && this.store.updateProperty([{ id: this.currentId, property: D, value: void 0 }]);
2791
+ this.currentId && this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
2788
2792
  const t = this.currentId;
2789
2793
  if (this.validate && t) {
2790
2794
  const e = this.store.getGeometryCopy(t);
@@ -2800,8 +2804,8 @@ class Ve extends G {
2800
2804
  }
2801
2805
  onMouseMove(t) {
2802
2806
  if (this.currentId === void 0 || this.startingClick === !1) return void this.setCursor(this.cursors.start);
2803
- const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates.length - 2, [o, s] = e.coordinates[i], { x: n, y: a } = this.project(o, s), l = L({ 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 = L({ x: h, y: u }, { x: t.containerX, y: t.containerY });
2804
- if (this.setCursor(p < this.pointerDistance ? this.cursors.close : this.cursors.start), l < this.minDistance) return;
2807
+ const e = this.store.getGeometryCopy(this.currentId), i = e.coordinates.length - 2, [o, s] = e.coordinates[i], { x: n, y: a } = this.project(o, s), l = F({ x: n, y: a }, { x: t.containerX, y: t.containerY }), [d, c] = e.coordinates[e.coordinates.length - 1], { x: h, y: p } = this.project(d, c), u = F({ x: h, y: p }, { x: t.containerX, y: t.containerY });
2808
+ if (this.setCursor(u < this.pointerDistance ? this.cursors.close : this.cursors.start), l < this.minDistance) return;
2805
2809
  const g = { type: "LineString", coordinates: [...e.coordinates, [t.lng, t.lat]] };
2806
2810
  this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: g, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid || (this.store.updateGeometry([{ id: this.currentId, geometry: g }]), this.closingPointId && this.store.updateGeometry([{ id: this.closingPointId, geometry: { type: "Point", coordinates: [t.lng, t.lat] } }]));
2807
2811
  }
@@ -2809,7 +2813,7 @@ class Ve extends G {
2809
2813
  if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) {
2810
2814
  if (this.preventNewFeature) return;
2811
2815
  if (this.startingClick === !1) {
2812
- const [e, i] = this.store.create([{ geometry: { type: "LineString", coordinates: [[t.lng, t.lat], [t.lng, t.lat]] }, properties: { mode: this.mode, [D]: !0 } }, { geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: { mode: this.mode, [J]: !0 } }]);
2816
+ const [e, i] = this.store.create([{ geometry: { type: "LineString", coordinates: [[t.lng, t.lat], [t.lng, t.lat]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }, { geometry: { type: "Point", coordinates: [t.lng, t.lat] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
2813
2817
  return this.currentId = e, this.closingPointId = i, this.startingClick = !0, void (this.state !== "drawing" && this.setDrawing());
2814
2818
  }
2815
2819
  this.close();
@@ -2836,57 +2840,72 @@ class Ve extends G {
2836
2840
  }
2837
2841
  styleFeature(t) {
2838
2842
  const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
2839
- 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 = T, 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);
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);
2840
2844
  }
2841
2845
  validateFeature(t) {
2842
- return this.validateModeFeature(t, (e) => Ut(e, this.coordinatePrecision));
2846
+ return this.validateModeFeature(t, (e) => Bt(e, this.coordinatePrecision));
2843
2847
  }
2844
2848
  afterFeatureUpdated(t) {
2845
2849
  this.currentId === t.id && (this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0);
2846
2850
  }
2847
2851
  }
2848
- class oo {
2852
+ function kt(r) {
2853
+ if (r === null || typeof r == "boolean" || typeof r == "string") return !0;
2854
+ if (r === void 0) return !1;
2855
+ if (typeof r == "number") return Number.isFinite(r);
2856
+ if (typeof r == "bigint" || typeof r == "symbol" || typeof r == "function" || r instanceof RegExp || r instanceof Map || r instanceof Set || r instanceof Date) return !1;
2857
+ if (typeof r == "object" && r !== null && !Array.isArray(r)) {
2858
+ const t = Object.getPrototypeOf(r);
2859
+ if (t !== Object.prototype && t !== null) return !1;
2860
+ }
2861
+ if (ArrayBuffer.isView(r) && !(r instanceof DataView)) return !1;
2862
+ if (Array.isArray(r)) {
2863
+ for (const t of r) if (!kt(t)) return !1;
2864
+ }
2865
+ return typeof r == "object" && Object.keys(r).every((t) => typeof t == "string" && kt(r[t]));
2866
+ }
2867
+ class Zi {
2849
2868
  constructor(t) {
2850
- 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 Wi();
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();
2851
2870
  const e = /* @__PURE__ */ new Set(), i = t.modes.reduce((c, h) => {
2852
2871
  if (e.has(h.mode)) throw new Error(`There is already a ${h.mode} mode provided`);
2853
2872
  return e.add(h.mode), c[h.mode] = h, c;
2854
2873
  }, {}), o = Object.keys(i);
2855
2874
  if (o.length === 0) throw new Error("No modes provided");
2856
2875
  o.forEach((c) => {
2857
- if (i[c].type === q.Select) {
2876
+ if (i[c].type === H.Select) {
2858
2877
  if (this._instanceSelectMode) throw new Error("only one type of select mode can be provided");
2859
2878
  this._instanceSelectMode = c;
2860
2879
  }
2861
- }), this._modes = x({}, i, { static: this._mode }), this._eventListeners = { change: [], select: [], deselect: [], finish: [], ready: [] }, this._store = new Vi({ 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 Ai({ tracked: !!t.tracked, idStrategy: t.idStrategy ? t.idStrategy : void 0 });
2862
2881
  const s = (c) => {
2863
- const h = [], u = this._store.copyAll().filter((p) => !c.includes(p.id) || (h.push(p), !1));
2864
- return { changed: h, unchanged: u };
2882
+ const h = [], p = this._store.copyAll().filter((u) => !c.includes(u.id) || (h.push(u), !1));
2883
+ return { changed: h, unchanged: p };
2865
2884
  }, n = (c, h) => {
2866
- this._enabled && this._eventListeners.finish.forEach((u) => {
2867
- u(c, h);
2885
+ this._enabled && this._eventListeners.finish.forEach((p) => {
2886
+ p(c, h);
2868
2887
  });
2869
- }, a = (c, h, u) => {
2888
+ }, a = (c, h, p) => {
2870
2889
  if (!this._enabled) return;
2871
2890
  this._eventListeners.change.forEach((y) => {
2872
- y(c, h, u);
2891
+ y(c, h, p);
2873
2892
  });
2874
- const { changed: p, unchanged: g } = s(c);
2875
- h === "create" ? this._adapter.render({ created: p, deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles()) : h === "update" ? this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: p }, this.getModeStyles()) : h === "delete" ? this._adapter.render({ created: [], deletedIds: c, unchanged: g, updated: [] }, this.getModeStyles()) : h === "styling" && this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles());
2893
+ const { changed: u, unchanged: g } = s(c);
2894
+ h === "create" ? this._adapter.render({ created: u, deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles()) : h === "update" ? this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: u }, this.getModeStyles()) : h === "delete" ? this._adapter.render({ created: [], deletedIds: c, unchanged: g, updated: [] }, this.getModeStyles()) : h === "styling" && this._adapter.render({ created: [], deletedIds: [], unchanged: g, updated: [] }, this.getModeStyles());
2876
2895
  }, l = (c) => {
2877
2896
  if (!this._enabled) return;
2878
- this._eventListeners.select.forEach((p) => {
2879
- p(c);
2897
+ this._eventListeners.select.forEach((u) => {
2898
+ u(c);
2880
2899
  });
2881
- const { changed: h, unchanged: u } = s([c]);
2882
- this._adapter.render({ created: [], deletedIds: [], unchanged: u, updated: h }, this.getModeStyles());
2900
+ const { changed: h, unchanged: p } = s([c]);
2901
+ this._adapter.render({ created: [], deletedIds: [], unchanged: p, updated: h }, this.getModeStyles());
2883
2902
  }, d = (c) => {
2884
2903
  if (!this._enabled) return;
2885
- this._eventListeners.deselect.forEach((p) => {
2886
- p();
2904
+ this._eventListeners.deselect.forEach((u) => {
2905
+ u();
2887
2906
  });
2888
- const { changed: h, unchanged: u } = s([c]);
2889
- h && this._adapter.render({ created: [], deletedIds: [], unchanged: u, updated: h }, this.getModeStyles());
2907
+ const { changed: h, unchanged: p } = s([c]);
2908
+ h && this._adapter.render({ created: [], deletedIds: [], unchanged: p, updated: h }, this.getModeStyles());
2890
2909
  };
2891
2910
  Object.keys(this._modes).forEach((c) => {
2892
2911
  this._modes[c].register({ mode: c, store: this._store, setCursor: this._adapter.setCursor.bind(this._adapter), project: this._adapter.project.bind(this._adapter), unproject: this._adapter.unproject.bind(this._adapter), setDoubleClickToZoom: this._adapter.setDoubleClickToZoom.bind(this._adapter), onChange: a, onSelect: l, onDeselect: d, onFinish: n, coordinatePrecision: this._adapter.getCoordinatePrecision() });
@@ -2902,30 +2921,44 @@ class oo {
2902
2921
  }), t;
2903
2922
  }
2904
2923
  featuresAtLocation({ lng: t, lat: e }, i) {
2905
- 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 = Fe({ unproject: d, point: h, pointerDistance: o });
2906
- return this._store.search(u).filter((p) => {
2907
- if (s && (p.properties[k.MID_POINT] || p.properties[k.SELECTION_POINT]) || n && p.properties[It] || l && p.properties[J] || a && p.properties[D]) return !1;
2908
- if (p.geometry.type === "Point") {
2909
- const g = p.geometry.coordinates, y = c(g[0], g[1]);
2910
- return L(h, y) < 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), p = be({ unproject: d, point: h, pointerDistance: o });
2925
+ return this._store.search(p).filter((u) => {
2926
+ if (s && (u.properties[k.MID_POINT] || u.properties[k.SELECTION_POINT]) || n && u.properties[S.COORDINATE_POINT] || l && u.properties[S.CLOSING_POINT] || a && u.properties[S.CURRENTLY_DRAWING]) return !1;
2927
+ if (u.geometry.type === "Point") {
2928
+ const g = u.geometry.coordinates, y = c(g[0], g[1]);
2929
+ return F(h, y) < o;
2911
2930
  }
2912
- if (p.geometry.type === "LineString") {
2913
- const g = p.geometry.coordinates;
2931
+ if (u.geometry.type === "LineString") {
2932
+ const g = u.geometry.coordinates;
2914
2933
  for (let y = 0; y < g.length - 1; y++) {
2915
2934
  const m = g[y], v = g[y + 1];
2916
- if (jt(h, c(m[0], m[1]), c(v[0], v[1])) < o) return !0;
2935
+ if (Dt(h, c(m[0], m[1]), c(v[0], v[1])) < o) return !0;
2917
2936
  }
2918
2937
  return !1;
2919
2938
  }
2920
- if (je([t, e], p.geometry.coordinates)) return !0;
2939
+ if (_e([t, e], u.geometry.coordinates)) return !0;
2921
2940
  if (i != null && i.includePolygonsWithinPointerDistance) {
2922
- const g = p.geometry.coordinates;
2941
+ const g = u.geometry.coordinates;
2923
2942
  for (const y of g) for (let m = 0; m < y.length - 1; m++) {
2924
2943
  const v = y[m], C = y[m + 1], f = c(v[0], v[1]), P = c(C[0], C[1]);
2925
- if (jt(h, f, P) < o) return !0;
2944
+ if (Dt(h, f, P) < o) return !0;
2926
2945
  }
2927
2946
  }
2928
2947
  return !1;
2948
+ }).map((u) => {
2949
+ if (i == null || !i.addClosestCoordinateInfoToProperties) return u;
2950
+ let g;
2951
+ if (u.geometry.type === "Polygon") g = u.geometry.coordinates[0], g.pop();
2952
+ else {
2953
+ if (u.geometry.type !== "LineString") return u;
2954
+ g = u.geometry.coordinates;
2955
+ }
2956
+ let y, m = -1, v = 1 / 0;
2957
+ for (let C = 0; C < g.length; C++) {
2958
+ const f = g[C], P = F(c(f[0], f[1]), h);
2959
+ P < v && (m = C, v = P, y = f);
2960
+ }
2961
+ return u.properties.closestCoordinateIndexToEvent = m, u.properties.closestCoordinatePixelDistanceToEvent = v, u.properties.closestCoordinateDistanceKmToEvent = U(y, [t, e]), u;
2929
2962
  });
2930
2963
  }
2931
2964
  getSelectModeOrThrow() {
@@ -2939,7 +2972,7 @@ class oo {
2939
2972
  return t && e !== this._instanceSelectMode && this.setMode(this._instanceSelectMode), this._modes[this._instanceSelectMode];
2940
2973
  }
2941
2974
  isGuidanceFeature(t) {
2942
- return !!(t.properties[k.MID_POINT] || t.properties[k.SELECTION_POINT] || t.properties[It] || t.properties[xt]);
2975
+ return !!(t.properties[k.MID_POINT] || t.properties[k.SELECTION_POINT] || t.properties[S.COORDINATE_POINT] || t.properties[S.SNAPPING_POINT]);
2943
2976
  }
2944
2977
  setModeStyles(t, e) {
2945
2978
  if (this.checkEnabled(), !this._modes[t]) throw new Error("No mode with this name present");
@@ -2980,7 +3013,7 @@ class oo {
2980
3013
  t.forEach((i) => {
2981
3014
  if (!this._store.has(i)) throw new Error(`No feature with id ${i}, can not delete`);
2982
3015
  const o = this._store.copy(i);
2983
- o.properties[k.SELECTED] && this.deselectFeature(i), o.properties[ht] && e.push(...o.properties[ht]);
3016
+ o.properties[k.SELECTED] && this.deselectFeature(i), o.properties[S.COORDINATE_POINT_IDS] && e.push(...o.properties[S.COORDINATE_POINT_IDS]);
2984
3017
  }), this._store.delete([...t, ...e], { origin: "api" });
2985
3018
  }
2986
3019
  selectFeature(t) {
@@ -2995,6 +3028,21 @@ class oo {
2995
3028
  hasFeature(t) {
2996
3029
  return this._store.has(t);
2997
3030
  }
3031
+ checkIsReservedProperty(t) {
3032
+ return ![...Object.values(k), ...Object.values(S)].includes(t);
3033
+ }
3034
+ updateFeatureProperties(t, e) {
3035
+ if (!this._store.has(t)) throw new Error(`No feature with id ${t} present in store`);
3036
+ const i = this._store.copy(t);
3037
+ if (this.isGuidanceFeature(i)) throw new Error("Guidance features are not allowed to be updated directly.");
3038
+ const o = i.properties.mode;
3039
+ if (!this._modes[o]) throw new Error(`No mode with name ${o} present in instance`);
3040
+ const s = Object.entries(e);
3041
+ s.forEach(([n, a]) => {
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 && !kt(a)) throw new Error(`Invalid JSON value provided for property ${n}`);
3044
+ }), this._store.updateProperty(s.map(([n, a]) => ({ id: i.id, property: n, value: a })), { origin: "api" });
3045
+ }
2998
3046
  updateFeatureGeometry(t, e) {
2999
3047
  if (!this._store.has(t)) throw new Error(`No feature with id ${t} present in store`);
3000
3048
  const i = this._store.copy(t);
@@ -3025,9 +3073,9 @@ class oo {
3025
3073
  }
3026
3074
  if (e.projection != "web-mercator") throw new Error(`Projection ${e.projection} is not currently supported for transformation`);
3027
3075
  if (e.type === "scale") {
3028
- const { x: a, y: l } = I(e.origin[0], e.origin[1]);
3029
- Te({ coordinates: n, originX: a, originY: l, xScale: e.options.xScale || 1, yScale: e.options.yScale || 1 });
3030
- } else e.type === "rotate" && (i = We(i, e.options.angle || 0), n = i.geometry.type === "Polygon" ? i.geometry.coordinates[0] : i.geometry.coordinates);
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);
3031
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) {
3032
3080
  s.afterFeatureUpdated(i);
3033
3081
  const a = i.properties[k.SELECTED], l = this.getSelectMode({ switchToSelectMode: !1 });
@@ -3036,7 +3084,7 @@ class oo {
3036
3084
  }
3037
3085
  addFeatures(t) {
3038
3086
  return this.checkEnabled(), t.length === 0 ? [] : this._store.load(t, (e) => {
3039
- if (te(e)) {
3087
+ if (Jt(e)) {
3040
3088
  const i = e.properties.mode, o = this._modes[i];
3041
3089
  if (!o) return { id: e.id, valid: !1, reason: `${i} mode is not in the list of instantiated modes` };
3042
3090
  const s = o.validateFeature.bind(o)(e);
@@ -3044,7 +3092,7 @@ class oo {
3044
3092
  }
3045
3093
  return { id: e.id, valid: !1, reason: "Mode property does not exist" };
3046
3094
  }, (e) => {
3047
- if (te(e)) {
3095
+ if (Jt(e)) {
3048
3096
  const i = this._modes[e.properties.mode];
3049
3097
  i && i.afterFeatureAdded && i.afterFeatureAdded(e);
3050
3098
  }
@@ -3093,7 +3141,7 @@ class oo {
3093
3141
  i.includes(e) && i.splice(i.indexOf(e), 1);
3094
3142
  }
3095
3143
  }
3096
- class so extends to.TerraDrawBaseAdapter {
3144
+ class Qi extends Hi.TerraDrawBaseAdapter {
3097
3145
  constructor(t) {
3098
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";
3099
3147
  }
@@ -3158,8 +3206,8 @@ class so extends to.TerraDrawBaseAdapter {
3158
3206
  if (!this._currentModeCallbacks) return;
3159
3207
  const i = [...t.created, ...t.updated, ...t.unchanged], o = [], s = [], n = [];
3160
3208
  for (let c = 0; c < i.length; c++) {
3161
- const h = i[c], { properties: u } = h, p = e[u.mode](h);
3162
- h.geometry.type === "Point" ? (u.pointColor = p.pointColor, u.pointOutlineColor = p.pointOutlineColor, u.pointOutlineWidth = p.pointOutlineWidth, u.pointWidth = p.pointWidth, u.zIndex = p.zIndex, o.push(h)) : h.geometry.type === "LineString" ? (u.lineStringColor = p.lineStringColor, u.lineStringWidth = p.lineStringWidth, s.push(h)) : h.geometry.type === "Polygon" && (u.polygonFillColor = p.polygonFillColor, u.polygonFillOpacity = p.polygonFillOpacity, u.polygonOutlineColor = p.polygonOutlineColor, u.polygonOutlineWidth = p.polygonOutlineWidth, n.push(h));
3209
+ const h = i[c], { properties: p } = h, u = e[p.mode](h);
3210
+ h.geometry.type === "Point" ? (p.pointColor = u.pointColor, p.pointOutlineColor = u.pointOutlineColor, p.pointOutlineWidth = u.pointOutlineWidth, p.pointWidth = u.pointWidth, p.zIndex = u.zIndex, o.push(h)) : h.geometry.type === "LineString" ? (p.lineStringColor = u.lineStringColor, p.lineStringWidth = u.lineStringWidth, s.push(h)) : h.geometry.type === "Polygon" && (p.polygonFillColor = u.polygonFillColor, p.polygonFillOpacity = u.polygonFillOpacity, p.polygonOutlineColor = u.polygonOutlineColor, p.polygonOutlineWidth = u.polygonOutlineWidth, n.push(h));
3163
3211
  }
3164
3212
  const a = this.changedIds.deletion || this.changedIds.styling, l = a || this.changedIds.linestrings, d = a || this.changedIds.polygons;
3165
3213
  (a || this.changedIds.points) && this._setGeoJSONLayerData("Point", o), l && this._setGeoJSONLayerData("LineString", s), d && this._setGeoJSONLayerData("Polygon", n), this.changedIds = { points: !1, linestrings: !1, polygons: !1, deletion: !1, styling: !1 };
@@ -3181,7 +3229,7 @@ class so extends to.TerraDrawBaseAdapter {
3181
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();
3182
3230
  }
3183
3231
  }
3184
- const $o = [
3232
+ const zo = [
3185
3233
  "render",
3186
3234
  "point",
3187
3235
  "linestring",
@@ -3197,7 +3245,7 @@ const $o = [
3197
3245
  "delete-selection",
3198
3246
  "delete",
3199
3247
  "download"
3200
- ], Ko = [
3248
+ ], Vo = [
3201
3249
  "render",
3202
3250
  "linestring",
3203
3251
  "point",
@@ -3206,7 +3254,7 @@ const $o = [
3206
3254
  "delete",
3207
3255
  "download",
3208
3256
  "settings"
3209
- ], ro = {
3257
+ ], to = {
3210
3258
  modes: [
3211
3259
  "render",
3212
3260
  "point",
@@ -3225,7 +3273,7 @@ const $o = [
3225
3273
  "download"
3226
3274
  ],
3227
3275
  open: !1
3228
- }, ct = {
3276
+ }, lt = {
3229
3277
  modes: [
3230
3278
  "render",
3231
3279
  "point",
@@ -3246,7 +3294,7 @@ const $o = [
3246
3294
  open: !1,
3247
3295
  // see styling parameters of Terra Draw at https://github.com/JamesLMilner/terra-draw/blob/main/guides/5.STYLING.md
3248
3296
  modeOptions: {
3249
- point: new Vt({
3297
+ point: new Rt({
3250
3298
  editable: !0,
3251
3299
  styles: {
3252
3300
  pointColor: "#FFFFFF",
@@ -3255,7 +3303,7 @@ const $o = [
3255
3303
  pointOutlineWidth: 1
3256
3304
  }
3257
3305
  }),
3258
- linestring: new zt({
3306
+ linestring: new At({
3259
3307
  editable: !0,
3260
3308
  styles: {
3261
3309
  lineStringColor: "#666666",
@@ -3266,7 +3314,7 @@ const $o = [
3266
3314
  closingPointOutlineWidth: 1
3267
3315
  }
3268
3316
  }),
3269
- polygon: new _e({
3317
+ polygon: new Le({
3270
3318
  editable: !0,
3271
3319
  styles: {
3272
3320
  fillColor: "#EDEFF0",
@@ -3279,7 +3327,7 @@ const $o = [
3279
3327
  closingPointOutlineWidth: 1
3280
3328
  }
3281
3329
  }),
3282
- rectangle: new ke({
3330
+ rectangle: new Fe({
3283
3331
  styles: {
3284
3332
  fillColor: "#EDEFF0",
3285
3333
  fillOpacity: 0.7,
@@ -3287,7 +3335,7 @@ const $o = [
3287
3335
  outlineWidth: 2
3288
3336
  }
3289
3337
  }),
3290
- "angled-rectangle": new Ae({
3338
+ "angled-rectangle": new We({
3291
3339
  styles: {
3292
3340
  fillColor: "#EDEFF0",
3293
3341
  fillOpacity: 0.7,
@@ -3295,7 +3343,7 @@ const $o = [
3295
3343
  outlineWidth: 2
3296
3344
  }
3297
3345
  }),
3298
- circle: new Oe({
3346
+ circle: new xe({
3299
3347
  styles: {
3300
3348
  fillColor: "#EDEFF0",
3301
3349
  fillOpacity: 0.7,
@@ -3303,7 +3351,7 @@ const $o = [
3303
3351
  outlineWidth: 2
3304
3352
  }
3305
3353
  }),
3306
- freehand: new Le({
3354
+ freehand: new Oe({
3307
3355
  styles: {
3308
3356
  fillColor: "#EDEFF0",
3309
3357
  fillOpacity: 0.7,
@@ -3315,7 +3363,7 @@ const $o = [
3315
3363
  closingPointOutlineWidth: 1
3316
3364
  }
3317
3365
  }),
3318
- "freehand-linestring": new Ve({
3366
+ "freehand-linestring": new Re({
3319
3367
  styles: {
3320
3368
  lineStringColor: "#666666",
3321
3369
  lineStringWidth: 2,
@@ -3325,7 +3373,7 @@ const $o = [
3325
3373
  closingPointOutlineWidth: 1
3326
3374
  }
3327
3375
  }),
3328
- sensor: new ze({
3376
+ sensor: new Ae({
3329
3377
  styles: {
3330
3378
  fillColor: "#EDEFF0",
3331
3379
  fillOpacity: 0.7,
@@ -3337,7 +3385,7 @@ const $o = [
3337
3385
  centerPointOutlineWidth: 1
3338
3386
  }
3339
3387
  }),
3340
- sector: new Re({
3388
+ sector: new je({
3341
3389
  styles: {
3342
3390
  fillColor: "#EDEFF0",
3343
3391
  fillOpacity: 0.7,
@@ -3345,7 +3393,7 @@ const $o = [
3345
3393
  outlineWidth: 2
3346
3394
  }
3347
3395
  }),
3348
- select: new $t({
3396
+ select: new Gt({
3349
3397
  flags: {
3350
3398
  point: {
3351
3399
  feature: {
@@ -3623,7 +3671,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3623
3671
  adapterOptions: {
3624
3672
  prefixId: "td-measure"
3625
3673
  }
3626
- }, V = {
3674
+ }, z = {
3627
3675
  modes: [
3628
3676
  "render",
3629
3677
  "linestring",
@@ -3637,7 +3685,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3637
3685
  open: !1,
3638
3686
  // see styling parameters of Terra Draw at https://github.com/JamesLMilner/terra-draw/blob/main/guides/5.STYLING.md
3639
3687
  modeOptions: {
3640
- point: new Vt({
3688
+ point: new Rt({
3641
3689
  editable: !1,
3642
3690
  styles: {
3643
3691
  pointColor: "#FFFFFF",
@@ -3646,7 +3694,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3646
3694
  pointOutlineWidth: 1
3647
3695
  }
3648
3696
  }),
3649
- linestring: new zt({
3697
+ linestring: new At({
3650
3698
  editable: !1,
3651
3699
  styles: {
3652
3700
  lineStringColor: "#FF0000",
@@ -3657,7 +3705,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3657
3705
  closingPointOutlineWidth: 1
3658
3706
  }
3659
3707
  }),
3660
- select: new $t({
3708
+ select: new Gt({
3661
3709
  flags: {
3662
3710
  point: {
3663
3711
  feature: {
@@ -3678,7 +3726,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3678
3726
  }
3679
3727
  }
3680
3728
  }),
3681
- settings: new et({
3729
+ settings: new Q({
3682
3730
  modeName: "settings",
3683
3731
  styles: {}
3684
3732
  })
@@ -3852,34 +3900,34 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3852
3900
  "text-halo-color": "rgb(255, 255, 255)"
3853
3901
  }
3854
3902
  }
3855
- }, no = () => ({
3856
- render: new et({
3903
+ }, eo = () => ({
3904
+ render: new Q({
3857
3905
  modeName: "render",
3858
3906
  styles: {}
3859
3907
  }),
3860
- point: new Vt({
3908
+ point: new Rt({
3861
3909
  editable: !0
3862
3910
  }),
3863
- linestring: new zt({
3911
+ linestring: new At({
3864
3912
  editable: !0
3865
3913
  }),
3866
- polygon: new _e({
3914
+ polygon: new Le({
3867
3915
  editable: !0,
3868
3916
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3869
3917
  // @ts-ignore
3870
3918
  validation: (t, e) => {
3871
3919
  const i = e.updateType;
3872
- return i === "finish" || i === "commit" ? Xi(t) : { valid: !0 };
3920
+ return i === "finish" || i === "commit" ? Ui(t) : { valid: !0 };
3873
3921
  }
3874
3922
  }),
3875
- rectangle: new ke(),
3876
- "angled-rectangle": new Ae(),
3877
- circle: new Oe(),
3878
- freehand: new Le(),
3879
- "freehand-linestring": new Ve(),
3880
- sensor: new ze(),
3881
- sector: new Re(),
3882
- select: new $t({
3923
+ rectangle: new Fe(),
3924
+ "angled-rectangle": new We(),
3925
+ circle: new xe(),
3926
+ freehand: new Oe(),
3927
+ "freehand-linestring": new Re(),
3928
+ sensor: new Ae(),
3929
+ sector: new je(),
3930
+ select: new Gt({
3883
3931
  flags: {
3884
3932
  point: {
3885
3933
  feature: {
@@ -3992,76 +4040,76 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
3992
4040
  }
3993
4041
  }
3994
4042
  }),
3995
- delete: new et({
4043
+ delete: new Q({
3996
4044
  modeName: "delete",
3997
4045
  styles: {}
3998
4046
  }),
3999
- "delete-selection": new et({
4047
+ "delete-selection": new Q({
4000
4048
  modeName: "delete-selection",
4001
4049
  styles: {}
4002
4050
  }),
4003
- download: new et({
4051
+ download: new Q({
4004
4052
  modeName: "download",
4005
4053
  styles: {}
4006
4054
  })
4007
4055
  });
4008
- var j = 63710088e-1, ao = {
4009
- centimeters: j * 100,
4010
- centimetres: j * 100,
4056
+ var W = 63710088e-1, io = {
4057
+ centimeters: W * 100,
4058
+ centimetres: W * 100,
4011
4059
  degrees: 360 / (2 * Math.PI),
4012
- feet: j * 3.28084,
4013
- inches: j * 39.37,
4014
- kilometers: j / 1e3,
4015
- kilometres: j / 1e3,
4016
- meters: j,
4017
- metres: j,
4018
- miles: j / 1609.344,
4019
- millimeters: j * 1e3,
4020
- millimetres: j * 1e3,
4021
- nauticalmiles: j / 1852,
4060
+ feet: W * 3.28084,
4061
+ inches: W * 39.37,
4062
+ kilometers: W / 1e3,
4063
+ kilometres: W / 1e3,
4064
+ meters: W,
4065
+ metres: W,
4066
+ miles: W / 1609.344,
4067
+ millimeters: W * 1e3,
4068
+ millimetres: W * 1e3,
4069
+ nauticalmiles: W / 1852,
4022
4070
  radians: 1,
4023
- yards: j * 1.0936
4071
+ yards: W * 1.0936
4024
4072
  };
4025
- function lo(r, t, e = {}) {
4073
+ function oo(r, t, e = {}) {
4026
4074
  const i = { type: "Feature" };
4027
4075
  return (e.id === 0 || e.id) && (i.id = e.id), e.bbox && (i.bbox = e.bbox), i.properties = t || {}, i.geometry = r, i;
4028
4076
  }
4029
- function co(r, t, e = {}) {
4077
+ function so(r, t, e = {}) {
4030
4078
  if (!r)
4031
4079
  throw new Error("coordinates is required");
4032
4080
  if (!Array.isArray(r))
4033
4081
  throw new Error("coordinates must be an Array");
4034
4082
  if (r.length < 2)
4035
4083
  throw new Error("coordinates must be at least 2 numbers long");
4036
- if (!ye(r[0]) || !ye(r[1]))
4084
+ if (!he(r[0]) || !he(r[1]))
4037
4085
  throw new Error("coordinates must contain numbers");
4038
- return lo({
4086
+ return oo({
4039
4087
  type: "Point",
4040
4088
  coordinates: r
4041
4089
  }, t, e);
4042
4090
  }
4043
- function ho(r, t = "kilometers") {
4044
- const e = ao[t];
4091
+ function ro(r, t = "kilometers") {
4092
+ const e = io[t];
4045
4093
  if (!e)
4046
4094
  throw new Error(t + " units is invalid");
4047
4095
  return r * e;
4048
4096
  }
4049
- function St(r) {
4097
+ function vt(r) {
4050
4098
  return r % 360 * Math.PI / 180;
4051
4099
  }
4052
- function ye(r) {
4100
+ function he(r) {
4053
4101
  return !isNaN(r) && r !== null && !Array.isArray(r);
4054
4102
  }
4055
- function $e(r, t, e) {
4103
+ function Ge(r, t, e) {
4056
4104
  if (r !== null)
4057
- 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++) {
4058
- d = g ? r.features[v].geometry : y ? r.geometry : r, u = d ? d.type === "GeometryCollection" : !1, a = u ? d.geometries.length : 1;
4105
+ for (var i, o, s, n, a, l, d, c = 0, h = 0, p, u = r.type, g = u === "FeatureCollection", y = u === "Feature", m = g ? r.features.length : 1, v = 0; v < m; v++) {
4106
+ d = g ? r.features[v].geometry : y ? r.geometry : r, p = d ? d.type === "GeometryCollection" : !1, a = p ? d.geometries.length : 1;
4059
4107
  for (var C = 0; C < a; C++) {
4060
4108
  var f = 0, P = 0;
4061
- if (n = u ? d.geometries[C] : d, n !== null) {
4109
+ if (n = p ? d.geometries[C] : d, n !== null) {
4062
4110
  l = n.coordinates;
4063
- var S = n.type;
4064
- switch (c = S === "Polygon" || S === "MultiPolygon" ? 1 : 0, S) {
4111
+ var I = n.type;
4112
+ switch (c = I === "Polygon" || I === "MultiPolygon" ? 1 : 0, I) {
4065
4113
  case null:
4066
4114
  break;
4067
4115
  case "Point":
@@ -4086,9 +4134,9 @@ function $e(r, t, e) {
4086
4134
  P
4087
4135
  ) === !1)
4088
4136
  return !1;
4089
- h++, S === "MultiPoint" && f++;
4137
+ h++, I === "MultiPoint" && f++;
4090
4138
  }
4091
- S === "LineString" && f++;
4139
+ I === "LineString" && f++;
4092
4140
  break;
4093
4141
  case "Polygon":
4094
4142
  case "MultiLineString":
@@ -4104,9 +4152,9 @@ function $e(r, t, e) {
4104
4152
  return !1;
4105
4153
  h++;
4106
4154
  }
4107
- S === "MultiLineString" && f++, S === "Polygon" && P++;
4155
+ I === "MultiLineString" && f++, I === "Polygon" && P++;
4108
4156
  }
4109
- S === "Polygon" && f++;
4157
+ I === "Polygon" && f++;
4110
4158
  break;
4111
4159
  case "MultiPolygon":
4112
4160
  for (i = 0; i < l.length; i++) {
@@ -4129,7 +4177,7 @@ function $e(r, t, e) {
4129
4177
  break;
4130
4178
  case "GeometryCollection":
4131
4179
  for (i = 0; i < n.geometries.length; i++)
4132
- if ($e(n.geometries[i], t) === !1)
4180
+ if (Ge(n.geometries[i], t) === !1)
4133
4181
  return !1;
4134
4182
  break;
4135
4183
  default:
@@ -4139,14 +4187,14 @@ function $e(r, t, e) {
4139
4187
  }
4140
4188
  }
4141
4189
  }
4142
- function uo(r, t) {
4143
- 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;
4190
+ function no(r, t) {
4191
+ var e, i, o, s, n, a, l, d, c, h, p = 0, u = r.type === "FeatureCollection", g = r.type === "Feature", y = u ? r.features.length : 1;
4144
4192
  for (e = 0; e < y; e++) {
4145
- for (a = p ? r.features[e].geometry : g ? r.geometry : r, d = p ? r.features[e].properties : g ? r.properties : {}, c = p ? r.features[e].bbox : g ? r.bbox : void 0, h = p ? r.features[e].id : g ? r.id : void 0, l = a ? a.type === "GeometryCollection" : !1, n = l ? a.geometries.length : 1, o = 0; o < n; o++) {
4193
+ for (a = u ? r.features[e].geometry : g ? r.geometry : r, d = u ? r.features[e].properties : g ? r.properties : {}, c = u ? r.features[e].bbox : g ? r.bbox : void 0, h = u ? r.features[e].id : g ? r.id : void 0, l = a ? a.type === "GeometryCollection" : !1, n = l ? a.geometries.length : 1, o = 0; o < n; o++) {
4146
4194
  if (s = l ? a.geometries[o] : a, s === null) {
4147
4195
  if (t(
4148
4196
  null,
4149
- u,
4197
+ p,
4150
4198
  d,
4151
4199
  c,
4152
4200
  h
@@ -4163,7 +4211,7 @@ function uo(r, t) {
4163
4211
  case "MultiPolygon": {
4164
4212
  if (t(
4165
4213
  s,
4166
- u,
4214
+ p,
4167
4215
  d,
4168
4216
  c,
4169
4217
  h
@@ -4175,7 +4223,7 @@ function uo(r, t) {
4175
4223
  for (i = 0; i < s.geometries.length; i++)
4176
4224
  if (t(
4177
4225
  s.geometries[i],
4178
- u,
4226
+ p,
4179
4227
  d,
4180
4228
  c,
4181
4229
  h
@@ -4187,12 +4235,12 @@ function uo(r, t) {
4187
4235
  throw new Error("Unknown Geometry Type");
4188
4236
  }
4189
4237
  }
4190
- u++;
4238
+ p++;
4191
4239
  }
4192
4240
  }
4193
- function po(r, t, e) {
4241
+ function ao(r, t, e) {
4194
4242
  var i = e;
4195
- return uo(
4243
+ return no(
4196
4244
  r,
4197
4245
  function(o, s, n, a, l) {
4198
4246
  s === 0 && e === void 0 ? i = o : i = t(
@@ -4206,21 +4254,21 @@ function po(r, t, e) {
4206
4254
  }
4207
4255
  ), i;
4208
4256
  }
4209
- function go(r) {
4210
- return po(
4257
+ function lo(r) {
4258
+ return ao(
4211
4259
  r,
4212
- (t, e) => t + yo(e),
4260
+ (t, e) => t + co(e),
4213
4261
  0
4214
4262
  );
4215
4263
  }
4216
- function yo(r) {
4264
+ function co(r) {
4217
4265
  let t = 0, e;
4218
4266
  switch (r.type) {
4219
4267
  case "Polygon":
4220
- return fe(r.coordinates);
4268
+ return ue(r.coordinates);
4221
4269
  case "MultiPolygon":
4222
4270
  for (e = 0; e < r.coordinates.length; e++)
4223
- t += fe(r.coordinates[e]);
4271
+ t += ue(r.coordinates[e]);
4224
4272
  return t;
4225
4273
  case "Point":
4226
4274
  case "MultiPoint":
@@ -4230,36 +4278,36 @@ function yo(r) {
4230
4278
  }
4231
4279
  return 0;
4232
4280
  }
4233
- function fe(r) {
4281
+ function ue(r) {
4234
4282
  let t = 0;
4235
4283
  if (r && r.length > 0) {
4236
- t += Math.abs(me(r[0]));
4284
+ t += Math.abs(pe(r[0]));
4237
4285
  for (let e = 1; e < r.length; e++)
4238
- t -= Math.abs(me(r[e]));
4286
+ t -= Math.abs(pe(r[e]));
4239
4287
  }
4240
4288
  return t;
4241
4289
  }
4242
- var fo = j * j / 2, kt = Math.PI / 180;
4243
- function me(r) {
4290
+ var ho = W * W / 2, Lt = Math.PI / 180;
4291
+ function pe(r) {
4244
4292
  const t = r.length - 1;
4245
4293
  if (t <= 2) return 0;
4246
4294
  let e = 0, i = 0;
4247
4295
  for (; i < t; ) {
4248
- 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] * kt, l = s[1] * kt, d = n[0] * kt;
4296
+ 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] * Lt, l = s[1] * Lt, d = n[0] * Lt;
4249
4297
  e += (d - a) * Math.sin(l), i++;
4250
4298
  }
4251
- return e * fo;
4299
+ return e * ho;
4252
4300
  }
4253
- var mo = go;
4254
- const vo = (r, t, e = "auto") => {
4301
+ var uo = lo;
4302
+ const po = (r, t, e = "auto") => {
4255
4303
  const i = ["m2", "km2", "a", "ha"], o = ["ft2", "yd2", "acre", "mi2"];
4256
4304
  let s = e;
4257
4305
  if (e !== "auto") {
4258
4306
  const n = i.includes(e), a = o.includes(e);
4259
4307
  (t === "metric" && !n || t === "imperial" && !a) && (s = "auto");
4260
4308
  }
4261
- return t === "metric" ? s !== "auto" ? rt(r, s) : r >= 1e6 ? rt(r, "km2") : r >= 1e4 ? rt(r, "ha") : r >= 100 ? rt(r, "a") : rt(r, "m2") : s !== "auto" ? nt(r, s) : r >= 258998811e-2 ? nt(r, "mi2") : r >= 4046.856 ? nt(r, "acre") : r >= 0.83612736 ? nt(r, "yd2") : nt(r, "ft2");
4262
- }, rt = (r, t) => {
4309
+ 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");
4310
+ }, ot = (r, t) => {
4263
4311
  let e = r, i = "m²";
4264
4312
  switch (t) {
4265
4313
  case "m2":
@@ -4279,7 +4327,7 @@ const vo = (r, t, e = "auto") => {
4279
4327
  area: e,
4280
4328
  unit: i
4281
4329
  };
4282
- }, nt = (r, t) => {
4330
+ }, st = (r, t) => {
4283
4331
  let e = r / 258998811e-2, i = "m²";
4284
4332
  switch (t) {
4285
4333
  case "ft2":
@@ -4299,12 +4347,12 @@ const vo = (r, t, e = "auto") => {
4299
4347
  area: e,
4300
4348
  unit: i
4301
4349
  };
4302
- }, ve = (r, t, e, i) => {
4350
+ }, ge = (r, t, e, i) => {
4303
4351
  if (r.geometry.type !== "Polygon") return r;
4304
- const o = mo(r.geometry), s = vo(o, t, i);
4352
+ const o = uo(r.geometry), s = po(o, t, i);
4305
4353
  return s.area = parseFloat(s.area.toFixed(e)), r.properties.area = s.area, r.properties.unit = s.unit, r;
4306
4354
  };
4307
- function Ce(r) {
4355
+ function ye(r) {
4308
4356
  if (!r)
4309
4357
  throw new Error("coord is required");
4310
4358
  if (!Array.isArray(r)) {
@@ -4317,15 +4365,15 @@ function Ce(r) {
4317
4365
  return [...r];
4318
4366
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
4319
4367
  }
4320
- function Co(r, t, e = {}) {
4321
- var i = Ce(r), o = Ce(t), s = St(o[1] - i[1]), n = St(o[0] - i[0]), a = St(i[1]), l = St(o[1]), d = Math.pow(Math.sin(s / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
4322
- return ho(
4368
+ function go(r, t, e = {}) {
4369
+ var i = ye(r), o = ye(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);
4370
+ return ro(
4323
4371
  2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
4324
4372
  e.units
4325
4373
  );
4326
4374
  }
4327
- var Po = Co;
4328
- const Pe = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians" ? "rad" : "km", Nt = (r) => {
4375
+ var yo = go;
4376
+ const fe = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians" ? "rad" : "km", Ft = (r) => {
4329
4377
  if (r >= 1)
4330
4378
  return {
4331
4379
  distance: r,
@@ -4339,31 +4387,31 @@ const Pe = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians
4339
4387
  distance: t * 100,
4340
4388
  unit: "cm"
4341
4389
  };
4342
- }, Se = (r, t, e, i, o, s) => {
4390
+ }, me = (r, t, e, i, o, s) => {
4343
4391
  if (r.geometry.type !== "LineString") return r;
4344
4392
  const n = r.geometry.coordinates;
4345
4393
  let a = 0;
4346
4394
  const l = [];
4347
4395
  for (let d = 0; d < n.length - 1; d++) {
4348
- const c = n[d], h = n[d + 1], u = Po(c, h, { units: t });
4349
- a += u;
4350
- const p = JSON.parse(JSON.stringify(r));
4351
- if (p.id = `${p.id}-${d}`, p.geometry.coordinates = [c, h], p.properties.originalId = r.id, p.properties.distance = u, p.properties.total = a, p.properties.unit = Pe(t), p.properties.totalUnit = Pe(t), o === !0 && s === void 0) {
4396
+ const c = n[d], h = n[d + 1], p = yo(c, h, { units: t });
4397
+ a += p;
4398
+ const u = JSON.parse(JSON.stringify(r));
4399
+ if (u.id = `${u.id}-${d}`, u.geometry.coordinates = [c, h], u.properties.originalId = r.id, u.properties.distance = p, u.properties.total = a, u.properties.unit = fe(t), u.properties.totalUnit = fe(t), o === !0 && s === void 0) {
4352
4400
  const g = i?.queryTerrainElevation(c);
4353
- g && (p.properties.elevation_start = g);
4401
+ g && (u.properties.elevation_start = g);
4354
4402
  const y = i?.queryTerrainElevation(h);
4355
- y && (p.properties.elevation_end = y);
4403
+ y && (u.properties.elevation_end = y);
4356
4404
  }
4357
- l.push(p);
4405
+ l.push(u);
4358
4406
  }
4359
4407
  if (r.properties.distance = l[l.length - 1].properties.total, r.properties.unit = l[l.length - 1].properties.unit, r.properties.segments = JSON.parse(JSON.stringify(l)), t === "kilometers") {
4360
- const d = Nt(r.properties.distance);
4408
+ const d = Ft(r.properties.distance);
4361
4409
  r.properties.distance = d.distance, r.properties.unit = d.unit, r.properties.segments.forEach(
4362
4410
  (c) => {
4363
- const h = Nt(c.properties.distance);
4411
+ const h = Ft(c.properties.distance);
4364
4412
  c.properties.distance = h.distance, c.properties.unit = h.unit;
4365
- const u = Nt(c.properties.total);
4366
- c.properties.total = u.distance, c.properties.totalUnit = u.unit;
4413
+ const p = Ft(c.properties.total);
4414
+ c.properties.total = p.distance, c.properties.totalUnit = p.unit;
4367
4415
  }
4368
4416
  );
4369
4417
  }
@@ -4378,25 +4426,25 @@ const Pe = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians
4378
4426
  );
4379
4427
  }
4380
4428
  ), r;
4381
- }, xe = (r) => r.charAt(0).toUpperCase() + r.slice(1), ot = [
4429
+ }, ve = (r) => r.charAt(0).toUpperCase() + r.slice(1), et = [
4382
4430
  "{prefix}-point",
4383
4431
  "{prefix}-point-lower",
4384
4432
  "{prefix}-linestring",
4385
4433
  "{prefix}-polygon",
4386
4434
  "{prefix}-polygon-outline"
4387
- ], Xo = [
4388
- ...ot,
4389
- ct.polygonLayerSpec?.source,
4390
- ct.lineLayerLabelSpec?.source,
4391
- ct.pointLayerLabelSpec?.source
4435
+ ], $o = [
4436
+ ...et,
4437
+ lt.polygonLayerSpec?.source,
4438
+ lt.lineLayerLabelSpec?.source,
4439
+ lt.pointLayerLabelSpec?.source
4392
4440
  ], Yo = [
4393
- ...ot,
4394
- V.routingLineLayerNodeLabelSpec?.source,
4395
- V.routingLineLayerNodeSpec?.source,
4396
- V.isochronePolygonLayerSpec?.source,
4397
- V.isochroneLineLayerSpec?.source,
4398
- V.isochroneLabelLayerSpec?.source
4399
- ], Kt = (r, t, e = ot, i = "td") => {
4441
+ ...et,
4442
+ z.routingLineLayerNodeLabelSpec?.source,
4443
+ z.routingLineLayerNodeSpec?.source,
4444
+ z.isochronePolygonLayerSpec?.source,
4445
+ z.isochroneLineLayerSpec?.source,
4446
+ z.isochroneLabelLayerSpec?.source
4447
+ ], Ut = (r, t, e = et, i = "td") => {
4400
4448
  e = e.map((s) => s.replace("{prefix}", i));
4401
4449
  const o = JSON.parse(JSON.stringify(r));
4402
4450
  return t && (t.onlyTerraDrawLayers === !0 ? (o.layers = o.layers.filter((s) => "source" in s && e.includes(s.source)), Object.keys(o.sources).forEach((s) => {
@@ -4404,13 +4452,13 @@ const Pe = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians
4404
4452
  })) : 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) => {
4405
4453
  e.includes(s) && delete o.sources[s];
4406
4454
  }))), o;
4407
- }, Ke = (r, t = 250) => {
4455
+ }, Ue = (r, t = 250) => {
4408
4456
  let e;
4409
4457
  return (...i) => {
4410
4458
  clearTimeout(e), e = setTimeout(() => r(...i), t);
4411
4459
  };
4412
4460
  };
4413
- class Xe {
4461
+ class ze {
4414
4462
  cache = /* @__PURE__ */ new Map();
4415
4463
  maxSize;
4416
4464
  ttl;
@@ -4488,7 +4536,7 @@ class Xe {
4488
4536
  };
4489
4537
  }
4490
4538
  }
4491
- class So {
4539
+ class fo {
4492
4540
  className;
4493
4541
  dialog;
4494
4542
  title;
@@ -4577,7 +4625,7 @@ class So {
4577
4625
  }), o;
4578
4626
  }
4579
4627
  }
4580
- const Ie = (r, t, e, i) => {
4628
+ const Ce = (r, t, e, i) => {
4581
4629
  if (r.geometry.type !== "Point") return r;
4582
4630
  const o = r.geometry.coordinates;
4583
4631
  if (e === !0 && i === void 0) {
@@ -4586,58 +4634,58 @@ const Ie = (r, t, e, i) => {
4586
4634
  }
4587
4635
  return r;
4588
4636
  };
4589
- var xo = Object.defineProperty, Io = (r, t, e) => t in r ? xo(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, at = (r, t, e) => Io(r, typeof t != "symbol" ? t + "" : t, e), wt = 2 * Math.PI * 6378137 / 2;
4590
- function bo(r) {
4637
+ 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), St = 2 * Math.PI * 6378137 / 2;
4638
+ function Co(r) {
4591
4639
  return r = r || 256, 2 * Math.PI * 6378137 / r;
4592
4640
  }
4593
- function Eo(r, t, e = { enable: !0, decimal: 1 }) {
4594
- r = Xt(r);
4595
- var i = r[0], o = r[1], s = i * wt / 180, n = Math.log(Math.tan((90 + o) * Math.PI / 360)) / (Math.PI / 180);
4596
- return n = n * wt / 180, e.enable && (s = Number(s.toFixed(e.decimal)), n = Number(n.toFixed(e.decimal))), [s, n];
4641
+ function Po(r, t, e = { enable: !0, decimal: 1 }) {
4642
+ r = zt(r);
4643
+ var i = r[0], o = r[1], s = i * St / 180, n = Math.log(Math.tan((90 + o) * Math.PI / 360)) / (Math.PI / 180);
4644
+ return n = n * St / 180, e.enable && (s = Number(s.toFixed(e.decimal)), n = Number(n.toFixed(e.decimal))), [s, n];
4597
4645
  }
4598
- function wo(r, t, e) {
4599
- var i = r[0], o = r[1], s = _o(t, e), n = (i + wt) / s, a = (o + wt) / s;
4646
+ function So(r, t, e) {
4647
+ var i = r[0], o = r[1], s = wo(t, e), n = (i + St) / s, a = (o + St) / s;
4600
4648
  return [n, a, t];
4601
4649
  }
4602
- function Ye(r, t, e) {
4603
- r = Xt(r);
4604
- var i = Eo(r), o = wo(i, t);
4605
- return Lo(o);
4650
+ function Ve(r, t, e) {
4651
+ r = zt(r);
4652
+ var i = Po(r), o = So(i, t);
4653
+ return xo(o);
4606
4654
  }
4607
- function Oo(r, t, e) {
4608
- if (r = Xt(r), t === 0)
4655
+ function Io(r, t, e) {
4656
+ if (r = zt(r), t === 0)
4609
4657
  return [0, 0, 0];
4610
- var i = Ye(r, t);
4611
- return Fo(i);
4658
+ var i = Ve(r, t);
4659
+ return Oo(i);
4612
4660
  }
4613
- function Lo(r, t, e) {
4661
+ function xo(r, t, e) {
4614
4662
  t = t || 256;
4615
4663
  var i = r[0], o = r[1], s = r[2];
4616
4664
  if (s === 0) return [0, 0, 0];
4617
- He(s);
4665
+ $e(s);
4618
4666
  var n = Math.ceil(i / t) - 1, a = Math.ceil(o / t) - 1;
4619
4667
  return n < 0 && (n = 0), a < 0 && (a = 0), [n, a, s];
4620
4668
  }
4621
- function Fo(r, t) {
4622
- Mo(r);
4669
+ function Oo(r, t) {
4670
+ bo(r);
4623
4671
  var e = r[0], i = r[1], o = r[2];
4624
4672
  if (o === 0)
4625
4673
  return [0, 0, 0];
4626
4674
  var s = e, n = Math.pow(2, o) - 1 - i;
4627
4675
  return [s, n, o];
4628
4676
  }
4629
- function Mo(r, t) {
4677
+ function bo(r, t) {
4630
4678
  var e = r[0], i = r[1], o = r[2];
4631
4679
  if (o == null) throw new Error("<zoom> is required");
4632
4680
  if (e == null) throw new Error("<x> is required");
4633
4681
  if (i == null) throw new Error("<y> is required");
4634
- return o = He(o), r = Do(r), r;
4682
+ return o = $e(o), r = Eo(r), r;
4635
4683
  }
4636
- function Do(r) {
4684
+ function Eo(r) {
4637
4685
  var t = r[0], e = r[1], i = r[2], o = Math.pow(2, i);
4638
4686
  return t = t % o, t < 0 && (t = t + o), [t, e, i];
4639
4687
  }
4640
- function He(r) {
4688
+ function $e(r) {
4641
4689
  if (r === !1) return r;
4642
4690
  if (r == null)
4643
4691
  throw new Error("<zoom> is required");
@@ -4647,22 +4695,22 @@ function He(r) {
4647
4695
  throw new Error("<zoom> cannot be greater than 32");
4648
4696
  return r;
4649
4697
  }
4650
- function Xt(r, t) {
4651
- var e = No(r[0]), i = ko(r[1]);
4698
+ function zt(r, t) {
4699
+ var e = Fo(r[0]), i = Lo(r[1]);
4652
4700
  return i > 85 && (i = 85), i < -85 && (i = -85), [e, i];
4653
4701
  }
4654
- function _o(r, t) {
4655
- return bo(t) / Math.pow(2, r);
4702
+ function wo(r, t) {
4703
+ return Co(t) / Math.pow(2, r);
4656
4704
  }
4657
- function ko(r) {
4705
+ function Lo(r) {
4658
4706
  if (r == null) throw new Error("lat is required");
4659
4707
  return (r > 90 || r < -90) && (r = r % 180, r > 90 && (r = -180 + r), r < -90 && (r = 180 + r), r === 0 && (r = 0)), r;
4660
4708
  }
4661
- function No(r) {
4709
+ function Fo(r) {
4662
4710
  if (r == null) throw new Error("lng is required");
4663
4711
  return (r > 180 || r < -180) && (r = r % 360, r > 180 && (r = -360 + r), r < -180 && (r = 360 + r), r === 0 && (r = 0)), r;
4664
4712
  }
4665
- class Je {
4713
+ class Ye {
4666
4714
  /**
4667
4715
  * Constructor
4668
4716
  * @param url URL for terrain RGB raster tilesets
@@ -4673,7 +4721,7 @@ class Je {
4673
4721
  * @param tms whether it is Tile Map Service
4674
4722
  */
4675
4723
  constructor(t, e, i, o, s) {
4676
- at(this, "url"), at(this, "tileSize"), at(this, "tms"), at(this, "minzoom"), at(this, "maxzoom"), this.url = t, this.tileSize = e, this.tms = s, this.minzoom = i, this.maxzoom = o, this.tms = s;
4724
+ rt(this, "url"), rt(this, "tileSize"), rt(this, "tms"), rt(this, "minzoom"), rt(this, "maxzoom"), this.url = t, this.tileSize = e, this.tms = s, this.minzoom = i, this.maxzoom = o, this.tms = s;
4677
4725
  }
4678
4726
  /**
4679
4727
  * Get the value from target coordinates and zoom level by using certain formula.
@@ -4687,7 +4735,7 @@ class Je {
4687
4735
  const s = t[0], n = t[1];
4688
4736
  let a = e;
4689
4737
  e > this.maxzoom ? a = this.maxzoom : e < this.minzoom && (a = this.minzoom);
4690
- 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());
4738
+ 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());
4691
4739
  let c = this.getUrlExtension(d);
4692
4740
  switch (c || (c = "png"), c) {
4693
4741
  case "png":
@@ -4727,7 +4775,7 @@ class Je {
4727
4775
  const h = c.getContext("2d");
4728
4776
  if (!h) return l(new Error("Failed to create canvas context"));
4729
4777
  h.drawImage(d, 0, 0);
4730
- const u = h.getImageData(0, 0, d.width, d.height).data, p = this.pixels2rgba(new Uint8Array(u), e, i, o), g = this.calc(p[0], p[1], p[2], p[3]);
4778
+ const p = h.getImageData(0, 0, d.width, d.height).data, u = this.pixels2rgba(new Uint8Array(p), e, i, o), g = this.calc(u[0], u[1], u[2], u[3]);
4731
4779
  a(g);
4732
4780
  }, d.onerror = () => a(void 0), d.src = URL.createObjectURL(n);
4733
4781
  });
@@ -4743,7 +4791,7 @@ class Je {
4743
4791
  pixels2rgba(t, e, i, o) {
4744
4792
  const s = [];
4745
4793
  for (let d = 0; d < t.length; d += 4) {
4746
- const c = t[d], h = t[d + 1], u = t[d + 2], p = t[d + 3], g = [c, h, u, p];
4794
+ const c = t[d], h = t[d + 1], p = t[d + 2], u = t[d + 3], g = [c, h, p, u];
4747
4795
  s.push(g);
4748
4796
  }
4749
4797
  const n = this.tileToBBOX(e), a = this.getPixelPosition(i, o, n), l = a[0] + a[1] * this.tileSize;
@@ -4789,7 +4837,7 @@ class Je {
4789
4837
  return i * Math.atan(0.5 * (Math.exp(o) - Math.exp(-o)));
4790
4838
  }
4791
4839
  }
4792
- class Bo extends Je {
4840
+ class Mo extends Ye {
4793
4841
  /**
4794
4842
  * Constructor
4795
4843
  * @param url URL for terrain RGB raster tilesets
@@ -4821,7 +4869,7 @@ class Bo extends Je {
4821
4869
  return -1e4 + (t * 256 * 256 + e * 256 + i) * 0.1;
4822
4870
  }
4823
4871
  }
4824
- class jo extends Je {
4872
+ class Do extends Ye {
4825
4873
  /**
4826
4874
  * Constructor
4827
4875
  * @param url URL for terrarium raster tilesets
@@ -4855,10 +4903,10 @@ class jo extends Je {
4855
4903
  return parseInt(o.toFixed(0));
4856
4904
  }
4857
4905
  }
4858
- const Wo = (r, t = 8) => {
4906
+ const _o = (r, t = 8) => {
4859
4907
  const [e, i] = r, o = Math.pow(10, t), s = Math.round(e * o) / o, n = Math.round(i * o) / o;
4860
4908
  return `${s},${n}`;
4861
- }, be = async (r, t, e, i) => {
4909
+ }, Pe = async (r, t, e, i) => {
4862
4910
  const o = [], s = {
4863
4911
  enabled: !0,
4864
4912
  maxSize: 1e3,
@@ -4868,35 +4916,35 @@ const Wo = (r, t = 8) => {
4868
4916
  ...e
4869
4917
  };
4870
4918
  let n;
4871
- s.enabled && (n = i || new Xe(s.maxSize, s.ttl));
4919
+ s.enabled && (n = i || new ze(s.maxSize, s.ttl));
4872
4920
  let a, l = 15;
4873
4921
  if (t) {
4874
- const d = t.url, c = t.encoding ?? "mapbox", h = t.tileSize ?? 512, u = t.minzoom ?? 5;
4922
+ const d = t.url, c = t.encoding ?? "mapbox", h = t.tileSize ?? 512, p = t.minzoom ?? 5;
4875
4923
  l = t.maxzoom ?? 15;
4876
- const p = t.tms ?? !1;
4877
- a = c === "mapbox" ? new Bo(d, h, u, l, p) : new jo(d, h, u, l, p);
4924
+ const u = t.tms ?? !1;
4925
+ a = c === "mapbox" ? new Mo(d, h, p, l, u) : new Do(d, h, p, l, u);
4878
4926
  }
4879
4927
  for (const d of r)
4880
4928
  o.push(
4881
4929
  new Promise((c) => {
4882
4930
  d.geometry.type !== "Point" && c(d);
4883
- const h = d.geometry.coordinates, u = Wo(h, s.precision);
4931
+ const h = d.geometry.coordinates, p = _o(h, s.precision);
4884
4932
  if (n) {
4885
- const p = n.get(u);
4886
- if (p !== void 0) {
4887
- isNaN(p) || (d.properties.elevation = p), c(d);
4933
+ const u = n.get(p);
4934
+ if (u !== void 0) {
4935
+ isNaN(u) || (d.properties.elevation = u), c(d);
4888
4936
  return;
4889
4937
  }
4890
4938
  }
4891
- a ? a.getElevation(d.geometry.coordinates, l).then((p) => {
4892
- p != null && typeof p == "number" && (n && n.set(u, p), d.properties.elevation = p), c(d);
4939
+ a ? a.getElevation(d.geometry.coordinates, l).then((u) => {
4940
+ u != null && typeof u == "number" && (n && n.set(p, u), d.properties.elevation = u), c(d);
4893
4941
  }).catch(() => {
4894
- n && n.has(u) && n.delete(u), c(d);
4942
+ n && n.has(p) && n.delete(p), c(d);
4895
4943
  }) : c(d);
4896
4944
  })
4897
4945
  );
4898
4946
  return await Promise.all(o);
4899
- }, Ho = (r, t = 9) => {
4947
+ }, Ko = (r, t = 9) => {
4900
4948
  function e(o) {
4901
4949
  return [Number(o[0].toFixed(t)), Number(o[1].toFixed(t))];
4902
4950
  }
@@ -4930,11 +4978,11 @@ const Wo = (r, t = 8) => {
4930
4978
  ...o,
4931
4979
  geometry: i(o.geometry)
4932
4980
  }));
4933
- }, To = [
4981
+ }, ko = [
4934
4982
  { value: "time", label: "Time" },
4935
4983
  { value: "distance", label: "Distance" }
4936
4984
  ];
4937
- class Go {
4985
+ class No {
4938
4986
  url;
4939
4987
  /**
4940
4988
  * Constructor
@@ -4966,15 +5014,15 @@ class Go {
4966
5014
  return await (await fetch(l)).json();
4967
5015
  }
4968
5016
  }
4969
- const Tt = [
5017
+ const Nt = [
4970
5018
  { value: "pedestrian", label: "Pedestrian" },
4971
5019
  { value: "bicycle", label: "Bicycle" },
4972
5020
  { value: "auto", label: "Car" }
4973
- ], Ao = [
5021
+ ], To = [
4974
5022
  { value: "kilometers", label: "km" },
4975
5023
  { value: "miles", label: "mile" }
4976
5024
  ];
4977
- class Uo {
5025
+ class Wo {
4978
5026
  tripData = [];
4979
5027
  /**
4980
5028
  * get the raw trip data from the valhalla routing API.
@@ -5039,25 +5087,25 @@ class Uo {
5039
5087
  c = [...c, ...f];
5040
5088
  }), this.tripSummary = l.trip.summary, this.tripSummary.length = Number(this.tripSummary.length.toFixed(2)), this.tripSummary.time = Number((this.tripSummary.time / 60).toFixed());
5041
5089
  const h = [];
5042
- let u = 0, p = 0;
5090
+ let p = 0, u = 0;
5043
5091
  const g = [], y = this.geoPoint(this.tripData.map((f) => [f.lng, f.lat]));
5044
5092
  l.trip.legs.forEach((f, P) => {
5045
- const S = this.decodeShape(f.shape);
5046
- h.push(...S), u += Number(f.summary.length.toFixed(2)), p += Number((f.summary.time / 60).toFixed()), g.push(...f.maneuvers);
5093
+ const I = this.decodeShape(f.shape);
5094
+ h.push(...I), p += Number(f.summary.length.toFixed(2)), u += Number((f.summary.time / 60).toFixed()), g.push(...f.maneuvers);
5047
5095
  const E = y.features[P + 1];
5048
5096
  E.properties = {
5049
5097
  ...E.properties,
5050
- distance: u,
5098
+ distance: p,
5051
5099
  distance_unit: i === "kilometers" ? "km" : "mi",
5052
- time: p,
5100
+ time: u,
5053
5101
  maneuvers: f.maneuvers
5054
5102
  };
5055
5103
  });
5056
- const m = Tt.find((f) => f.value === e)?.label, v = this.geoLineString(h, {
5104
+ const m = Nt.find((f) => f.value === e)?.label, v = this.geoLineString(h, {
5057
5105
  costingModel: m,
5058
- distance: u,
5106
+ distance: p,
5059
5107
  distance_unit: i === "kilometers" ? "km" : "mi",
5060
- time: p,
5108
+ time: u,
5061
5109
  maneuvers: g
5062
5110
  }), C = y.features[0];
5063
5111
  return C.properties = {
@@ -5113,7 +5161,7 @@ class Uo {
5113
5161
  * @returns the list of coordinates as [lng, lat] pairs
5114
5162
  */
5115
5163
  decodeShape(t, e = 6) {
5116
- let i = 0, o = 0, s = 0, n = [], a = 0, l = 0, d = null, c, h, u = Math.pow(10, e || 6);
5164
+ let i = 0, o = 0, s = 0, n = [], a = 0, l = 0, d = null, c, h, p = Math.pow(10, e || 6);
5117
5165
  for (; i < t.length; ) {
5118
5166
  d = null, a = 0, l = 0;
5119
5167
  do
@@ -5123,12 +5171,12 @@ class Uo {
5123
5171
  do
5124
5172
  d = t.charCodeAt(i++) - 63, l |= (d & 31) << a, a += 5;
5125
5173
  while (d >= 32);
5126
- h = l & 1 ? ~(l >> 1) : l >> 1, o += c, s += h, n.push([s / u, o / u]);
5174
+ h = l & 1 ? ~(l >> 1) : l >> 1, o += c, s += h, n.push([s / p, o / p]);
5127
5175
  }
5128
5176
  return n;
5129
5177
  }
5130
5178
  }
5131
- class qe {
5179
+ class Ke {
5132
5180
  controlContainer;
5133
5181
  map;
5134
5182
  modeButtons = {};
@@ -5167,7 +5215,7 @@ class qe {
5167
5215
  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");
5168
5216
  }
5169
5217
  terradraw;
5170
- options = ro;
5218
+ options = to;
5171
5219
  events = {};
5172
5220
  defaultMode = "render";
5173
5221
  /**
@@ -5195,7 +5243,7 @@ class qe {
5195
5243
  if (this.options && this.options.modes && this.options.modes.length === 0)
5196
5244
  throw new Error("At least a mode must be enabled.");
5197
5245
  this.map = t;
5198
- const e = no(), i = [];
5246
+ const e = eo(), i = [];
5199
5247
  return this.options?.modes?.forEach((o) => {
5200
5248
  if (this.options.modeOptions && this.options.modeOptions[o]) {
5201
5249
  const s = this.options.modeOptions[o];
@@ -5213,12 +5261,12 @@ class qe {
5213
5261
  }), i.forEach((o) => {
5214
5262
  o.state !== "unregistered" && (o._state = "unregistered");
5215
5263
  }), this.options?.modes?.includes("render") || (i.push(
5216
- new et({
5264
+ new Q({
5217
5265
  modeName: "default",
5218
5266
  styles: {}
5219
5267
  })
5220
- ), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new oo({
5221
- adapter: new so({ map: t, ...this.options.adapterOptions }),
5268
+ ), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new Zi({
5269
+ adapter: new Qi({ map: t, ...this.options.adapterOptions }),
5222
5270
  modes: i
5223
5271
  }), this.map?.loaded() ? this.terradraw.start() : this.map?.once("load", () => {
5224
5272
  this.terradraw?.start();
@@ -5316,7 +5364,7 @@ class qe {
5316
5364
  */
5317
5365
  addTerradrawButton(t) {
5318
5366
  const e = document.createElement("button");
5319
- 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 = xe("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 = xe(t.replace(/-/g, " ")), t === "delete" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), e.addEventListener("click", () => {
5367
+ 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", () => {
5320
5368
  this.terradraw && this.terradraw.enabled && (this.terradraw.clear(), this.deactivate(), this.toggleDeleteSelectionButton(), this.toggleButtonsWhenNoFeature(), this.dispatchEvent("feature-deleted"));
5321
5369
  })) : t === "delete-selection" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), e.classList.add("hidden-delete-selection"), e.addEventListener("click", () => {
5322
5370
  if (!this.terradraw || !this.terradraw.enabled) return;
@@ -5364,10 +5412,10 @@ class qe {
5364
5412
  * @returns
5365
5413
  */
5366
5414
  cleanStyle(t, e) {
5367
- return Kt(
5415
+ return Ut(
5368
5416
  t,
5369
5417
  e,
5370
- ot,
5418
+ et,
5371
5419
  this.options.adapterOptions?.prefixId
5372
5420
  );
5373
5421
  }
@@ -5431,16 +5479,16 @@ class qe {
5431
5479
  }
5432
5480
  }
5433
5481
  }
5434
- function Ro(r, t = {}) {
5482
+ function Bo(r, t = {}) {
5435
5483
  let e = 0, i = 0, o = 0;
5436
- return $e(
5484
+ return Ge(
5437
5485
  r,
5438
5486
  function(s) {
5439
5487
  e += s[0], i += s[1], o++;
5440
5488
  }
5441
- ), co([e / o, i / o], t.properties);
5489
+ ), so([e / o, i / o], t.properties);
5442
5490
  }
5443
- class Jo extends qe {
5491
+ class Xo extends Ke {
5444
5492
  measureOptions;
5445
5493
  elevationCache;
5446
5494
  /**
@@ -5547,8 +5595,8 @@ class Jo extends qe {
5547
5595
  */
5548
5596
  constructor(t) {
5549
5597
  let e = {
5550
- ...JSON.parse(JSON.stringify(ct)),
5551
- modeOptions: { ...ct.modeOptions }
5598
+ ...JSON.parse(JSON.stringify(lt)),
5599
+ modeOptions: { ...lt.modeOptions }
5552
5600
  };
5553
5601
  t && (e = Object.assign(e, t));
5554
5602
  const i = e.adapterOptions?.prefixId ?? "td-measure";
@@ -5557,7 +5605,7 @@ class Jo extends qe {
5557
5605
  open: e.open,
5558
5606
  modeOptions: e.modeOptions,
5559
5607
  adapterOptions: e.adapterOptions
5560
- }), this._cssPrefix = "measure-", this.measureOptions = e, this.measureOptions.elevationCacheConfig && this.measureOptions.elevationCacheConfig?.enabled && (this.elevationCache = new Xe(
5608
+ }), this._cssPrefix = "measure-", this.measureOptions = e, this.measureOptions.elevationCacheConfig && this.measureOptions.elevationCacheConfig?.enabled && (this.elevationCache = new ze(
5561
5609
  this.measureOptions.elevationCacheConfig.maxSize,
5562
5610
  this.measureOptions.elevationCacheConfig.ttl
5563
5611
  ));
@@ -5623,12 +5671,12 @@ class Jo extends qe {
5623
5671
  * @returns
5624
5672
  */
5625
5673
  cleanStyle(t, e) {
5626
- const i = ot, o = this.measureOptions.polygonLayerSpec?.source;
5674
+ const i = et, o = this.measureOptions.polygonLayerSpec?.source;
5627
5675
  o && i.push(o);
5628
5676
  const s = this.measureOptions.lineLayerLabelSpec?.source;
5629
5677
  s && i.push(s);
5630
5678
  const n = this.measureOptions.pointLayerLabelSpec?.source;
5631
- return n && i.push(n), Kt(
5679
+ return n && i.push(n), Ut(
5632
5680
  t,
5633
5681
  e,
5634
5682
  i,
@@ -5711,7 +5759,7 @@ class Jo extends qe {
5711
5759
  * Handle finish event of terradraw. It will be called after finishing adding a feature
5712
5760
  * @param id Feature ID
5713
5761
  */
5714
- handleTerradrawFeatureReady = Ke((t) => {
5762
+ handleTerradrawFeatureReady = Ue((t) => {
5715
5763
  this.map && (this.computeElevationByLineFeatureID(t), this.computeElevationByPointFeatureID(t));
5716
5764
  }, 300);
5717
5765
  /**
@@ -5776,7 +5824,7 @@ class Jo extends qe {
5776
5824
  if (o && typeof o.data != "string" && o.data.type === "FeatureCollection") {
5777
5825
  const s = [];
5778
5826
  for (const a of t)
5779
- this.terradraw?.getSnapshotFeature(a.id) && s.push(a);
5827
+ (this.terradraw?.getSnapshotFeature(a.id) || this.terradraw?.getSnapshotFeature(a.properties.originalId)) && s.push(a);
5780
5828
  const n = s.map((a) => a.id);
5781
5829
  if (typeof o.data != "string" && o.data.type === "FeatureCollection") {
5782
5830
  i === "linestring" ? o.data.features = [
@@ -5810,7 +5858,7 @@ class Jo extends qe {
5810
5858
  (o) => o.properties?.originalId === t && o.geometry.type === "Point"
5811
5859
  );
5812
5860
  if (i && i.length > 0) {
5813
- const o = await be(
5861
+ const o = await Pe(
5814
5862
  i,
5815
5863
  this.measureOptions.terrainSource,
5816
5864
  this.measureOptions.elevationCacheConfig,
@@ -5837,7 +5885,7 @@ class Jo extends qe {
5837
5885
  (o) => o.id === t && o.geometry.type === "Point" && o.properties?.mode === "point"
5838
5886
  );
5839
5887
  if (i && i.length > 0) {
5840
- const o = await be(
5888
+ const o = await Pe(
5841
5889
  i,
5842
5890
  this.measureOptions.terrainSource,
5843
5891
  this.measureOptions.elevationCacheConfig,
@@ -5868,7 +5916,7 @@ class Jo extends qe {
5868
5916
  (a) => a.properties?.originalId !== t
5869
5917
  ));
5870
5918
  const n = JSON.parse(JSON.stringify(o));
5871
- n.id = n.id + "-area-label", n.geometry = Ro(o.geometry).geometry, n.properties.originalId = o.id, o = ve(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(
5919
+ n.id = n.id + "-area-label", n.geometry = Bo(o.geometry).geometry, n.properties.originalId = o.id, o = ge(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(
5872
5920
  this.measureOptions.polygonLayerSpec.source
5873
5921
  )?.setData(s.data), this.map.moveLayer(this.measureOptions.polygonLayerSpec.id), this.map.getLayer(this.measureOptions.lineLayerLabelSpec.id) && this.map.moveLayer(
5874
5922
  this.measureOptions.lineLayerLabelSpec.id
@@ -5898,7 +5946,7 @@ class Jo extends qe {
5898
5946
  if (s) {
5899
5947
  typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter(
5900
5948
  (a) => a.properties?.originalId !== t
5901
- )), o = Se(
5949
+ )), o = me(
5902
5950
  o,
5903
5951
  this.distanceUnit,
5904
5952
  this.distancePrecision,
@@ -5908,21 +5956,19 @@ class Jo extends qe {
5908
5956
  );
5909
5957
  const n = o.properties.segments;
5910
5958
  for (let a = 0; a < n.length; a++) {
5911
- const l = n[a];
5912
- typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(l);
5913
- const d = l.geometry.coordinates, c = d[0], h = d[1];
5959
+ const l = n[a], d = l.geometry.coordinates, c = d[0], h = d[1];
5914
5960
  if (a === 0) {
5915
- const p = JSON.parse(JSON.stringify(l));
5916
- p.id = `${l.id}-node-${a}`, p.geometry = {
5961
+ const u = JSON.parse(JSON.stringify(l));
5962
+ u.id = `${l.id}-node-${a}`, u.geometry = {
5917
5963
  type: "Point",
5918
5964
  coordinates: c
5919
- }, p.properties.distance = 0, p.properties.total = 0, l.properties.elevation_start && (p.properties.elevation = l.properties.elevation_start), typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(p);
5965
+ }, u.properties.distance = 0, u.properties.total = 0, l.properties.elevation_start && (u.properties.elevation = l.properties.elevation_start), typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(u);
5920
5966
  }
5921
- const u = JSON.parse(JSON.stringify(l));
5922
- u.id = `${l.id}-node-${a + 1}`, u.geometry = {
5967
+ const p = JSON.parse(JSON.stringify(l));
5968
+ p.id = `${l.id}-node-${a + 1}`, p.geometry = {
5923
5969
  type: "Point",
5924
5970
  coordinates: h
5925
- }, l.properties.elevation_end && (u.properties.elevation = l.properties.elevation_end), typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(u);
5971
+ }, l.properties.elevation_end && (p.properties.elevation = l.properties.elevation_end), typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(p);
5926
5972
  }
5927
5973
  this.map.getSource(
5928
5974
  this.measureOptions.lineLayerLabelSpec.source
@@ -5947,7 +5993,7 @@ class Jo extends qe {
5947
5993
  let o = e.getSnapshot()?.find((s) => s.id === t && s.geometry.type === "Point");
5948
5994
  if (o) {
5949
5995
  const s = this.map.getStyle().sources[this.measureOptions.pointLayerLabelSpec.source];
5950
- s && (typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter((n) => n.id !== t)), o = Ie(
5996
+ s && (typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter((n) => n.id !== t)), o = Ce(
5951
5997
  o,
5952
5998
  this.map,
5953
5999
  this.computeElevation,
@@ -5992,14 +6038,14 @@ class Jo extends qe {
5992
6038
  const o = e.features[i];
5993
6039
  if (!this.map || !this.map.loaded()) continue;
5994
6040
  const s = o.geometry.type;
5995
- s === "LineString" ? e.features[i] = Se(
6041
+ s === "LineString" ? e.features[i] = me(
5996
6042
  o,
5997
6043
  this.distanceUnit,
5998
6044
  this.distancePrecision,
5999
6045
  this.map,
6000
6046
  this.computeElevation,
6001
6047
  this.measureOptions.terrainSource
6002
- ) : s === "Polygon" ? e.features[i] = ve(o, this.areaUnit, this.areaPrecision, this.forceAreaUnit) : s === "Point" && (e.features[i] = Ie(
6048
+ ) : s === "Polygon" ? e.features[i] = ge(o, this.areaUnit, this.areaPrecision, this.forceAreaUnit) : s === "Point" && (e.features[i] = Ce(
6003
6049
  o,
6004
6050
  this.map,
6005
6051
  this.computeElevation,
@@ -6009,7 +6055,7 @@ class Jo extends qe {
6009
6055
  return e;
6010
6056
  }
6011
6057
  }
6012
- class qo extends qe {
6058
+ class Ho extends Ke {
6013
6059
  controlOptions;
6014
6060
  valhallaOptions;
6015
6061
  _modalDialog;
@@ -6149,11 +6195,11 @@ class qo extends qe {
6149
6195
  */
6150
6196
  constructor(t) {
6151
6197
  let e = {
6152
- ...JSON.parse(JSON.stringify(V)),
6153
- modeOptions: { ...V.modeOptions }
6198
+ ...JSON.parse(JSON.stringify(z)),
6199
+ modeOptions: { ...z.modeOptions }
6154
6200
  };
6155
6201
  t && (e = Object.assign(e, t), e.valhallaOptions = Object.assign(
6156
- JSON.parse(JSON.stringify(V.valhallaOptions)),
6202
+ JSON.parse(JSON.stringify(z.valhallaOptions)),
6157
6203
  e.valhallaOptions
6158
6204
  )), e.adapterOptions || (e.adapterOptions = {}), e.adapterOptions.prefixId = e.adapterOptions?.prefixId ?? "td-valhalla";
6159
6205
  const i = e.adapterOptions?.prefixId ?? "td-valhalla";
@@ -6205,16 +6251,16 @@ class qo extends qe {
6205
6251
  * @returns
6206
6252
  */
6207
6253
  cleanStyle(t, e) {
6208
- const i = ot, o = this.controlOptions.routingLineLayerNodeSpec?.source;
6254
+ const i = et, o = this.controlOptions.routingLineLayerNodeSpec?.source;
6209
6255
  o && i.push(o);
6210
6256
  const s = this.controlOptions.isochronePolygonLayerSpec?.source;
6211
- return s && i.push(s), Kt(t, e, i, this.options.adapterOptions?.prefixId);
6257
+ return s && i.push(s), Ut(t, e, i, this.options.adapterOptions?.prefixId);
6212
6258
  }
6213
6259
  /**
6214
6260
  * Create the settings dialog for Valhalla control
6215
6261
  */
6216
6262
  createSettingsDialog() {
6217
- this.settingDialog = new So(
6263
+ this.settingDialog = new fo(
6218
6264
  `maplibregl-terradraw-${this.cssPrefix}settings-dialog`,
6219
6265
  "Settings"
6220
6266
  ), this.settingDialog.create(
@@ -6256,7 +6302,7 @@ class qo extends qe {
6256
6302
  const i = document.createElement("label");
6257
6303
  i.textContent = "Means of Transport", i.classList.add("setting-label"), e.appendChild(i), e.appendChild(
6258
6304
  this.settingDialog.createSegmentButtons(
6259
- Tt,
6305
+ Nt,
6260
6306
  this.routingCostingModel,
6261
6307
  (n) => {
6262
6308
  this.valhallaOptions.routingOptions || (this.valhallaOptions.routingOptions = {}), this.valhallaOptions.routingOptions.costingModel = n, this.dispatchEvent("setting-changed");
@@ -6268,7 +6314,7 @@ class qo extends qe {
6268
6314
  const s = document.createElement("label");
6269
6315
  return s.textContent = "Distance Unit", s.classList.add("setting-label"), o.appendChild(s), o.appendChild(
6270
6316
  this.settingDialog.createSegmentButtons(
6271
- Ao,
6317
+ To,
6272
6318
  this.routingDistanceUnit,
6273
6319
  (n) => {
6274
6320
  this.valhallaOptions.routingOptions || (this.valhallaOptions.routingOptions = {}), this.valhallaOptions.routingOptions.distanceUnit = n, this.dispatchEvent("setting-changed");
@@ -6285,7 +6331,7 @@ class qo extends qe {
6285
6331
  const i = document.createElement("label");
6286
6332
  i.textContent = "Contour Type", i.classList.add("setting-label"), e.appendChild(i), e.appendChild(
6287
6333
  this.settingDialog.createSegmentButtons(
6288
- To,
6334
+ ko,
6289
6335
  this.controlOptions.valhallaOptions?.isochroneOptions?.contourType || "time",
6290
6336
  (d) => {
6291
6337
  this.valhallaOptions.isochroneOptions || (this.valhallaOptions.isochroneOptions = {}), this.valhallaOptions.isochroneOptions.contourType = d, this.dispatchEvent("setting-changed");
@@ -6297,7 +6343,7 @@ class qo extends qe {
6297
6343
  const s = document.createElement("label");
6298
6344
  s.textContent = "Means of Transport", s.classList.add("setting-label"), o.appendChild(s), o.appendChild(
6299
6345
  this.settingDialog.createSegmentButtons(
6300
- Tt,
6346
+ Nt,
6301
6347
  this.controlOptions.valhallaOptions?.isochroneOptions?.costingModel || "auto",
6302
6348
  (d) => {
6303
6349
  this.valhallaOptions.isochroneOptions || (this.valhallaOptions.isochroneOptions = {}), this.valhallaOptions.isochroneOptions.costingModel = d, this.dispatchEvent("setting-changed");
@@ -6328,15 +6374,15 @@ class qo extends qe {
6328
6374
  const l = document.createElement("th");
6329
6375
  o.appendChild(l), i.appendChild(o), e.appendChild(i);
6330
6376
  const d = document.createElement("tbody"), c = this.controlOptions.valhallaOptions?.isochroneOptions?.contours;
6331
- c.forEach((u, p) => {
6332
- const g = this.createContourRow(u, p);
6377
+ c.forEach((p, u) => {
6378
+ const g = this.createContourRow(p, u);
6333
6379
  d.appendChild(g);
6334
6380
  }), e.appendChild(d), t.appendChild(e);
6335
6381
  const h = document.createElement("button");
6336
- return h.type = "button", h.classList.add("add-row-button"), h.textContent = "Add Contour", h.hidden = c.length >= 4, h.addEventListener("click", (u) => {
6337
- u.stopPropagation();
6338
- const p = this.valhallaOptions.isochroneOptions?.contours, g = JSON.parse(JSON.stringify(p[p.length - 1])), y = d.children.length, m = this.createContourRow(g, y);
6339
- d.appendChild(m), p.push(g), this.updateAddRowButtonState(), this.dispatchEvent("setting-changed");
6382
+ return h.type = "button", h.classList.add("add-row-button"), h.textContent = "Add Contour", h.hidden = c.length >= 4, h.addEventListener("click", (p) => {
6383
+ p.stopPropagation();
6384
+ const u = this.valhallaOptions.isochroneOptions?.contours, g = JSON.parse(JSON.stringify(u[u.length - 1])), y = d.children.length, m = this.createContourRow(g, y);
6385
+ d.appendChild(m), u.push(g), this.updateAddRowButtonState(), this.dispatchEvent("setting-changed");
6340
6386
  }), t.appendChild(h), t;
6341
6387
  }
6342
6388
  /**
@@ -6364,10 +6410,10 @@ class qo extends qe {
6364
6410
  const c = document.createElement("td");
6365
6411
  if (e > 0) {
6366
6412
  const h = document.createElement("button");
6367
- h.type = "button", h.textContent = "×", h.classList.add("delete-button"), h.addEventListener("click", (u) => {
6368
- u.stopPropagation();
6369
- const p = parseInt(i.getAttribute("data-index") || "0");
6370
- i.remove(), this.valhallaOptions.isochroneOptions?.contours && this.valhallaOptions.isochroneOptions.contours.splice(p, 1);
6413
+ h.type = "button", h.textContent = "×", h.classList.add("delete-button"), h.addEventListener("click", (p) => {
6414
+ p.stopPropagation();
6415
+ const u = parseInt(i.getAttribute("data-index") || "0");
6416
+ i.remove(), this.valhallaOptions.isochroneOptions?.contours && this.valhallaOptions.isochroneOptions.contours.splice(u, 1);
6371
6417
  const g = i.parentElement;
6372
6418
  g && Array.from(g.children).forEach((y, m) => {
6373
6419
  y.setAttribute("data-index", m.toString());
@@ -6480,32 +6526,34 @@ class qo extends qe {
6480
6526
  * Handle finish event of terradraw. It will be called after finishing adding a feature
6481
6527
  * @param id Feature ID
6482
6528
  */
6483
- handleTerradrawFeatureReady = Ke((t) => {
6529
+ handleTerradrawFeatureReady = Ue((t) => {
6484
6530
  this.map && (this.computeRouteByLineFeatureID(t), this.computeIsochroneByPointFeatureID(t));
6485
6531
  }, 300);
6486
6532
  computeIsochroneByPointFeatureID = async (t) => {
6487
6533
  if (!this.map || !this.valhallaOptions.url) return;
6488
6534
  const e = this.terradraw?.getSnapshotFeature(t);
6489
6535
  if (!e || e && e.geometry.type !== "Point") return;
6490
- const i = e.geometry.coordinates, n = (await new Go(this.valhallaUrl).calcIsochrone(
6536
+ const i = e.geometry.coordinates, n = (await new No(this.valhallaUrl).calcIsochrone(
6491
6537
  i[0],
6492
6538
  i[1],
6493
6539
  this.isochroneContourType,
6494
6540
  this.isochroneCostingModel,
6495
6541
  this.isochroneContours
6496
- )).features.map((l) => (l.id = `${t}-${l.properties.contour}`, l.properties.originalId = t, l));
6497
- e.properties = {
6498
- ...e.properties,
6542
+ )).features.map((d) => (d.id = `${t}-${d.properties.contour}`, d.properties.originalId = t, d)), a = {
6499
6543
  contourType: this.isochroneContourType,
6500
6544
  costingModel: this.isochroneCostingModel,
6501
6545
  result: n
6502
- }, this.terradraw?.removeFeatures([t]), this.terradraw?.addFeatures([e]);
6503
- const a = this.map.getStyle().sources[this.controlOptions.isochronePolygonLayerSpec.source];
6504
- a && (typeof a.data != "string" && a.data.type === "FeatureCollection" && (a.data.features = a.data.features.filter(
6505
- (l) => l.properties?.originalId !== t
6506
- )), typeof a.data != "string" && a.data.type === "FeatureCollection" && a.data.features.push(...n), this.map.getSource(
6546
+ };
6547
+ e.properties = {
6548
+ ...e.properties,
6549
+ ...a
6550
+ }, this.terradraw?.updateFeatureProperties(t, a);
6551
+ const l = this.map.getStyle().sources[this.controlOptions.isochronePolygonLayerSpec.source];
6552
+ l && (typeof l.data != "string" && l.data.type === "FeatureCollection" && (l.data.features = l.data.features.filter(
6553
+ (d) => d.properties?.originalId !== t
6554
+ )), typeof l.data != "string" && l.data.type === "FeatureCollection" && l.data.features.push(...n), this.map.getSource(
6507
6555
  this.controlOptions.isochronePolygonLayerSpec.source
6508
- )?.setData(a.data), this.map.moveLayer(
6556
+ )?.setData(l.data), this.map.moveLayer(
6509
6557
  this.controlOptions.isochronePolygonLayerSpec.id
6510
6558
  ), this.map.moveLayer(this.controlOptions.isochroneLineLayerSpec.id), this.map.moveLayer(
6511
6559
  this.controlOptions.isochroneLabelLayerSpec.id
@@ -6519,9 +6567,9 @@ class qo extends qe {
6519
6567
  if (!this.map || !this.valhallaOptions.url) return;
6520
6568
  const e = this.terradraw?.getSnapshotFeature(t);
6521
6569
  if (!e || e && e.geometry.type !== "LineString") return;
6522
- const i = new Uo(this.valhallaUrl), o = e.geometry.coordinates.map((c) => {
6570
+ const i = new Wo(this.valhallaUrl), o = e.geometry.coordinates.map((c) => {
6523
6571
  const h = c;
6524
- return new Ze(h[0], h[1]);
6572
+ return new Xe(h[0], h[1]);
6525
6573
  });
6526
6574
  if (!o || o && o.length < 2) return;
6527
6575
  const s = await i.calcRoute(
@@ -6531,10 +6579,10 @@ class qo extends qe {
6531
6579
  );
6532
6580
  if (!s || !s.feature) return;
6533
6581
  const n = s?.feature.geometry;
6534
- e.geometry = n, e.properties = {
6582
+ this.terradraw?.updateFeatureGeometry(t, n), e.geometry = n, e.properties = {
6535
6583
  ...e.properties,
6536
6584
  ...s?.feature.properties
6537
- }, this.terradraw?.removeFeatures([t]), this.terradraw?.addFeatures([e]);
6585
+ }, this.terradraw?.updateFeatureProperties(t, s?.feature.properties);
6538
6586
  const l = (s?.pointFeatures).features.map((c) => (c.id = `${t}-${c.id}`, c.properties.originalId = t, c)), d = this.map.getStyle().sources[this.controlOptions.routingLineLayerNodeSpec.source];
6539
6587
  d && (typeof d.data != "string" && d.data.type === "FeatureCollection" && (d.data.features = d.data.features.filter(
6540
6588
  (c) => c.properties?.originalId !== t
@@ -6590,35 +6638,35 @@ class qo extends qe {
6590
6638
  }
6591
6639
  }
6592
6640
  export {
6593
- $o as AvailableModes,
6594
- Ko as AvailableValhallaModes,
6595
- Jo as MaplibreMeasureControl,
6596
- qe as MaplibreTerradrawControl,
6597
- qo as MaplibreValhallaControl,
6598
- Xe as MemoryCache,
6599
- So as ModalDialog,
6600
- Xo as TERRADRAW_MEASURE_SOURCE_IDS,
6601
- ot as TERRADRAW_SOURCE_IDS,
6641
+ zo as AvailableModes,
6642
+ Vo as AvailableValhallaModes,
6643
+ Xo as MaplibreMeasureControl,
6644
+ Ke as MaplibreTerradrawControl,
6645
+ Ho as MaplibreValhallaControl,
6646
+ ze as MemoryCache,
6647
+ fo as ModalDialog,
6648
+ $o as TERRADRAW_MEASURE_SOURCE_IDS,
6649
+ et as TERRADRAW_SOURCE_IDS,
6602
6650
  Yo as TERRADRAW_VALHALLA_SOURCE_IDS,
6603
- Go as ValhallaIsochrone,
6604
- Uo as ValhallaRouting,
6605
- ve as calcArea,
6606
- Se as calcDistance,
6607
- xe as capitalize,
6608
- Kt as cleanMaplibreStyle,
6609
- To as contourTypeOptions,
6610
- vo as convertAreaUnit,
6611
- Nt as convertMetricDistance,
6612
- Tt as costingModelOptions,
6613
- Ke as debounce,
6614
- ro as defaultControlOptions,
6615
- ct as defaultMeasureControlOptions,
6616
- V as defaultValhallaControlOptions,
6617
- no as getDefaultModeOptions,
6618
- Pe as getDistanceUnitName,
6619
- Ie as queryElevationByPoint,
6620
- be as queryElevationFromRasterDEM,
6621
- Ho as roundFeatureCoordinates,
6622
- Ao as routingDistanceUnitOptions
6651
+ No as ValhallaIsochrone,
6652
+ Wo as ValhallaRouting,
6653
+ ge as calcArea,
6654
+ me as calcDistance,
6655
+ ve as capitalize,
6656
+ Ut as cleanMaplibreStyle,
6657
+ ko as contourTypeOptions,
6658
+ po as convertAreaUnit,
6659
+ Ft as convertMetricDistance,
6660
+ Nt as costingModelOptions,
6661
+ Ue as debounce,
6662
+ to as defaultControlOptions,
6663
+ lt as defaultMeasureControlOptions,
6664
+ z as defaultValhallaControlOptions,
6665
+ eo as getDefaultModeOptions,
6666
+ fe as getDistanceUnitName,
6667
+ Ce as queryElevationByPoint,
6668
+ Pe as queryElevationFromRasterDEM,
6669
+ Ko as roundFeatureCoordinates,
6670
+ To as routingDistanceUnitOptions
6623
6671
  };
6624
6672
  //# sourceMappingURL=maplibre-gl-terradraw.es.js.map