bbl-mapbox-react 0.0.15 → 0.0.17

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.
package/dist/index.mjs CHANGED
@@ -3516,19 +3516,19 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3516
3516
  showRadius: r.showRadius ?? !0
3517
3517
  } : g, [b, x] = useState([]), S = useRef(/* @__PURE__ */ new Map()), C = useRef(0), T = useRef(null), E = useRef(null), D = useRef(null), O = useRef(null), k = useRef(null), A = useRef([]), j = useRef([]), M = useRef(y);
3518
3518
  M.current = y;
3519
- let be = useRef(d);
3520
- be.current = d;
3521
- let xe = useCallback(() => `measure-${++C.current}`, []), Se = useRef(!1), Ce = useCallback(() => {
3522
- !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), Se.current = !0);
3519
+ let N = useRef(d);
3520
+ N.current = d;
3521
+ let be = useCallback(() => `measure-${++C.current}`, []), xe = useRef(!1), Se = useCallback(() => {
3522
+ !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), xe.current = !0);
3523
3523
  }, [e]);
3524
3524
  useEffect(() => {
3525
3525
  if (!e) return;
3526
3526
  let t = () => {
3527
- initAllPreviewLayers(e), Se.current = !0;
3527
+ initAllPreviewLayers(e), xe.current = !0;
3528
3528
  };
3529
3529
  e.isStyleLoaded() ? t() : e.once("load", t);
3530
3530
  let n = () => {
3531
- Se.current = !1;
3531
+ xe.current = !1;
3532
3532
  };
3533
3533
  return e.on("style.load", n), () => {
3534
3534
  e.off("style.load", n);
@@ -3539,7 +3539,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3539
3539
  };
3540
3540
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
3541
3541
  }, []);
3542
- let we = useCallback((t) => {
3542
+ let Ce = useCallback((t) => {
3543
3543
  if (!e) return;
3544
3544
  let n = applyEntityConfig(t, M.current), r = null;
3545
3545
  if (n.type === "circle" ? r = new CircleRenderer(e, n) : n.type === "square" ? r = new SquareRenderer(e, n) : n.type === "rectangle" ? r = new RectangleRenderer(e, n) : n.type === "polygon" ? r = new PolygonRenderer(e, n) : n.type === "polyline" && (r = new PolylineRenderer(e, n)), r) {
@@ -3552,12 +3552,12 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3552
3552
  };
3553
3553
  x((t) => [...t, e]);
3554
3554
  }
3555
- }, [e]), Te = useCallback((e) => {
3555
+ }, [e]), we = useCallback((e) => {
3556
3556
  let t = S.current.get(e);
3557
3557
  t && (t.destroy(), S.current.delete(e)), x((t) => t.filter((t) => t.entity.id !== e));
3558
- }, []), Ee = useCallback(() => {
3558
+ }, []), Te = useCallback(() => {
3559
3559
  S.current.forEach((e) => e.destroy()), S.current.clear(), x([]);
3560
- }, []), De = useCallback((t) => {
3560
+ }, []), Ee = useCallback((t) => {
3561
3561
  if (!e) return;
3562
3562
  let n = S.current.get(t);
3563
3563
  if (!n) return;
@@ -3567,7 +3567,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3567
3567
  maxZoom: 18,
3568
3568
  duration: 1e3
3569
3569
  });
3570
- }, [e]), Oe = useCallback((e, t) => {
3570
+ }, [e]), De = useCallback((e, t) => {
3571
3571
  let n = {
3572
3572
  ...M.current,
3573
3573
  [e]: t
@@ -3581,7 +3581,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3581
3581
  entity: i
3582
3582
  };
3583
3583
  }));
3584
- }, [v, i]), ke = useCallback((t, n) => {
3584
+ }, [v, i]), Oe = useCallback((t, n) => {
3585
3585
  if (!e) return;
3586
3586
  let [r, i] = t, [a, o] = n, s = [
3587
3587
  [Math.min(r, a), Math.max(i, o)],
@@ -3631,7 +3631,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3631
3631
  features: t
3632
3632
  });
3633
3633
  }
3634
- }, [e]), Ae = useCallback((t, n) => {
3634
+ }, [e]), ke = useCallback((t, n) => {
3635
3635
  if (!e) return;
3636
3636
  let r = calculateDistance(t, n), i = createCirclePolygon(t, r), a = e.getSource(`${PREVIEW_PREFIX}circle-preview-source`);
3637
3637
  a && a.setData({
@@ -3678,7 +3678,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3678
3678
  type: "FeatureCollection",
3679
3679
  features: c
3680
3680
  });
3681
- }, [e]), je = useCallback((t, n) => {
3681
+ }, [e]), Ae = useCallback((t, n) => {
3682
3682
  if (!e) return;
3683
3683
  let r = calculateDistance(t, n) * 2, i = createSquareCoords(t, r), a = e.getSource(`${PREVIEW_PREFIX}square-preview-source`);
3684
3684
  a && a.setData({
@@ -3715,7 +3715,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3715
3715
  features: n
3716
3716
  });
3717
3717
  }
3718
- }, [e]), Me = useCallback((t, n) => {
3718
+ }, [e]), je = useCallback((t, n) => {
3719
3719
  if (!e) return;
3720
3720
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polygon-preview-source`);
3721
3721
  i && (r.length >= 3 ? i.setData({
@@ -3792,7 +3792,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3792
3792
  features: t
3793
3793
  });
3794
3794
  }
3795
- }, [e]), N = useCallback((t, n) => {
3795
+ }, [e]), Me = useCallback((t, n) => {
3796
3796
  if (!e) return;
3797
3797
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polyline-preview-source`);
3798
3798
  i && (r.length >= 2 ? i.setData({
@@ -3840,117 +3840,117 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3840
3840
  }, [e]);
3841
3841
  useEffect(() => {
3842
3842
  if (!e || !d) return;
3843
- Ce(), e.getCanvas().style.cursor = "crosshair";
3843
+ Se(), e.getCanvas().style.cursor = "crosshair";
3844
3844
  let t = (t) => {
3845
- let n = [t.lngLat.lng, t.lngLat.lat], r = be.current;
3845
+ let n = [t.lngLat.lng, t.lngLat.lat], r = N.current;
3846
3846
  if (r === "rectangle") {
3847
3847
  let t = D.current;
3848
3848
  if (!t) D.current = n;
3849
3849
  else {
3850
3850
  let r = {
3851
- id: xe(),
3851
+ id: be(),
3852
3852
  type: "rectangle",
3853
3853
  bounds: [t, n]
3854
3854
  };
3855
- we(r), D.current = null, clearAllPreviewSources(e), f(null);
3855
+ Ce(r), D.current = null, clearAllPreviewSources(e), f(null);
3856
3856
  }
3857
3857
  } else if (r === "circle") {
3858
3858
  let t = O.current;
3859
3859
  if (!t) O.current = { center: n };
3860
3860
  else {
3861
3861
  let r = calculateDistance(t.center, n), i = {
3862
- id: xe(),
3862
+ id: be(),
3863
3863
  type: "circle",
3864
3864
  center: t.center,
3865
3865
  radius: r
3866
3866
  };
3867
- we(i), O.current = null, clearAllPreviewSources(e), f(null);
3867
+ Ce(i), O.current = null, clearAllPreviewSources(e), f(null);
3868
3868
  }
3869
3869
  } else if (r === "square") {
3870
3870
  let t = k.current;
3871
3871
  if (!t) k.current = { center: n };
3872
3872
  else {
3873
3873
  let r = calculateDistance(t.center, n) * 2, i = {
3874
- id: xe(),
3874
+ id: be(),
3875
3875
  type: "square",
3876
3876
  center: t.center,
3877
3877
  length: r
3878
3878
  };
3879
- we(i), k.current = null, clearAllPreviewSources(e), f(null);
3879
+ Ce(i), k.current = null, clearAllPreviewSources(e), f(null);
3880
3880
  }
3881
3881
  } else if (r === "polygon") {
3882
3882
  let t = A.current;
3883
3883
  if (t.length >= 3 && calculateDistance(t[0], n) < 20) {
3884
3884
  let n = {
3885
- id: xe(),
3885
+ id: be(),
3886
3886
  type: "polygon",
3887
3887
  coordinates: [...t]
3888
3888
  };
3889
- we(n), A.current = [], clearAllPreviewSources(e), f(null);
3889
+ Ce(n), A.current = [], clearAllPreviewSources(e), f(null);
3890
3890
  return;
3891
3891
  }
3892
3892
  A.current = [...t, n];
3893
3893
  } else r === "polyline" && (j.current = [...j.current, n]);
3894
3894
  }, n = (e) => {
3895
- let t = [e.lngLat.lng, e.lngLat.lat], n = be.current;
3896
- if (n === "rectangle" && D.current) ke(D.current, t);
3897
- else if (n === "circle" && O.current) Ae(O.current.center, t);
3898
- else if (n === "square" && k.current) je(k.current.center, t);
3895
+ let t = [e.lngLat.lng, e.lngLat.lat], n = N.current;
3896
+ if (n === "rectangle" && D.current) Oe(D.current, t);
3897
+ else if (n === "circle" && O.current) ke(O.current.center, t);
3898
+ else if (n === "square" && k.current) Ae(k.current.center, t);
3899
3899
  else if (n === "polygon") {
3900
3900
  let e = A.current;
3901
- e.length > 0 && Me(e, t);
3901
+ e.length > 0 && je(e, t);
3902
3902
  } else if (n === "polyline") {
3903
3903
  let e = j.current;
3904
- e.length > 0 && N(e, t);
3904
+ e.length > 0 && Me(e, t);
3905
3905
  }
3906
3906
  }, r = (t) => {
3907
3907
  t.preventDefault();
3908
- let n = be.current;
3908
+ let n = N.current;
3909
3909
  if (n === "polygon") {
3910
3910
  let t = A.current;
3911
3911
  if (t.length >= 3) {
3912
3912
  let n = {
3913
- id: xe(),
3913
+ id: be(),
3914
3914
  type: "polygon",
3915
3915
  coordinates: [...t]
3916
3916
  };
3917
- we(n), A.current = [], clearAllPreviewSources(e), f(null);
3917
+ Ce(n), A.current = [], clearAllPreviewSources(e), f(null);
3918
3918
  } else A.current = [], clearAllPreviewSources(e);
3919
3919
  } else if (n === "polyline") {
3920
3920
  let t = j.current;
3921
3921
  if (t.length >= 2) {
3922
3922
  let n = {
3923
- id: xe(),
3923
+ id: be(),
3924
3924
  type: "polyline",
3925
3925
  coordinates: [...t]
3926
3926
  };
3927
- we(n), j.current = [], clearAllPreviewSources(e), f(null);
3927
+ Ce(n), j.current = [], clearAllPreviewSources(e), f(null);
3928
3928
  } else j.current = [], clearAllPreviewSources(e);
3929
3929
  }
3930
3930
  }, i = (t) => {
3931
3931
  t.key === "Escape" && (D.current = null, O.current = null, k.current = null, A.current = [], j.current = [], clearAllPreviewSources(e), f(null));
3932
3932
  }, a = (t) => {
3933
3933
  t.preventDefault();
3934
- let n = be.current;
3934
+ let n = N.current;
3935
3935
  if (n === "polygon") {
3936
3936
  let t = A.current;
3937
3937
  if (t.length >= 3) {
3938
3938
  let n = {
3939
- id: xe(),
3939
+ id: be(),
3940
3940
  type: "polygon",
3941
3941
  coordinates: [...t]
3942
3942
  };
3943
- we(n), A.current = [], clearAllPreviewSources(e), f(null);
3943
+ Ce(n), A.current = [], clearAllPreviewSources(e), f(null);
3944
3944
  }
3945
3945
  } else if (n === "polyline") {
3946
3946
  let t = j.current;
3947
3947
  if (t.length >= 2) {
3948
3948
  let n = {
3949
- id: xe(),
3949
+ id: be(),
3950
3950
  type: "polyline",
3951
3951
  coordinates: [...t]
3952
3952
  };
3953
- we(n), j.current = [], clearAllPreviewSources(e), f(null);
3953
+ Ce(n), j.current = [], clearAllPreviewSources(e), f(null);
3954
3954
  }
3955
3955
  }
3956
3956
  };
@@ -3960,14 +3960,14 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
3960
3960
  }, [
3961
3961
  e,
3962
3962
  d,
3963
- xe,
3964
- we,
3963
+ be,
3965
3964
  Ce,
3965
+ Se,
3966
+ Oe,
3966
3967
  ke,
3967
3968
  Ae,
3968
3969
  je,
3969
- Me,
3970
- N
3970
+ Me
3971
3971
  ]), useEffect(() => () => {
3972
3972
  S.current.forEach((e) => e.destroy()), S.current.clear();
3973
3973
  }, []);
@@ -4008,17 +4008,17 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
4008
4008
  children: [
4009
4009
  /* @__PURE__ */ jsx(Checkbox, {
4010
4010
  checked: y.showArea,
4011
- onChange: (e) => Oe("showArea", e),
4011
+ onChange: (e) => De("showArea", e),
4012
4012
  children: "面积"
4013
4013
  }),
4014
4014
  /* @__PURE__ */ jsx(Checkbox, {
4015
4015
  checked: y.showLength,
4016
- onChange: (e) => Oe("showLength", e),
4016
+ onChange: (e) => De("showLength", e),
4017
4017
  children: "长度"
4018
4018
  }),
4019
4019
  /* @__PURE__ */ jsx(Checkbox, {
4020
4020
  checked: y.showRadius,
4021
- onChange: (e) => Oe("showRadius", e),
4021
+ onChange: (e) => De("showRadius", e),
4022
4022
  children: "半径"
4023
4023
  })
4024
4024
  ]
@@ -4039,7 +4039,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
4039
4039
  })
4040
4040
  }, e.mode)), b.length > 0 && /* @__PURE__ */ jsx("button", {
4041
4041
  className: "mapbox-measure-control__tool-btn mapbox-measure-control__tool-btn--danger",
4042
- onClick: Ee,
4042
+ onClick: Te,
4043
4043
  title: "清除全部",
4044
4044
  children: /* @__PURE__ */ jsx("img", {
4045
4045
  src: "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1769394652565'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='6483'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='128'%20height='128'%3e%3cpath%20d='M841.385637%20288.639098a36.479886%2036.479886%200%200%201%2072.74644%207.679976l6.613312%20629.544699A109.866323%20109.866323%200%200%201%20810.665733%201023.9968H222.507571a109.652991%20109.652991%200%200%201-109.012992-98.133027l-3.626656-629.544699a36.479886%2036.479886%200%200%201%2072.74644-7.679976L186.241018%20917.330467a36.479886%2036.479886%200%200%200%2036.266553%2032.639898H810.665733A36.479886%2036.479886%200%200%200%20847.99895%20917.330467z%20m-219.732646%20113.706311a36.479886%2036.479886%200%200%201%2036.693218%2036.479886v255.9992a36.693219%2036.693219%200%201%201-73.173104%200v-255.9992a36.479886%2036.479886%200%200%201%2036.479886-36.479886z%20m-219.305982%200a36.479886%2036.479886%200%200%201%2036.479886%2036.479886v255.9992a36.693219%2036.693219%200%201%201-73.173104%200v-255.9992a36.479886%2036.479886%200%200%201%2036.693218-36.479886z%20m-36.693218-255.9992h292.692418V91.519714a18.346609%2018.346609%200%200%200-18.346609-18.346609H384.0004a18.346609%2018.346609%200%200%200-18.346609%2018.346609z%20m-73.173105%200V73.173105A73.173105%2073.173105%200%200%201%20365.653791%200h292.692418a73.386437%2073.386437%200%200%201%2073.173105%2073.173105v73.173104h255.9992a36.693219%2036.693219%200%200%201%200%2073.173105H36.481486a36.693219%2036.693219%200%200%201%200-73.173105z'%20fill='%23EB6865'%20p-id='6484'%3e%3c/path%3e%3c/svg%3e",
@@ -4059,7 +4059,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
4059
4059
  /* @__PURE__ */ jsx("th", {})
4060
4060
  ] }) }), /* @__PURE__ */ jsx("tbody", { children: b.map((e) => /* @__PURE__ */ jsxs("tr", {
4061
4061
  className: "mapbox-measure-control__table-row",
4062
- onClick: () => De(e.entity.id),
4062
+ onClick: () => Ee(e.entity.id),
4063
4063
  children: [
4064
4064
  /* @__PURE__ */ jsx("td", { children: e.shapeLabel }),
4065
4065
  /* @__PURE__ */ jsx("td", { children: String(e.entity.id) }),
@@ -4068,7 +4068,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, clas
4068
4068
  /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", {
4069
4069
  className: "mapbox-measure-control__delete-btn",
4070
4070
  onClick: (t) => {
4071
- t.stopPropagation(), Te(e.entity.id);
4071
+ t.stopPropagation(), we(e.entity.id);
4072
4072
  },
4073
4073
  title: "删除",
4074
4074
  children: /* @__PURE__ */ jsx("img", {
@@ -4550,51 +4550,51 @@ function adjustPopupForBounds(e, t) {
4550
4550
  return r.x + t.width + 10 > n.width && (r.x = n.width - t.width - 10), r.x < 10 && (r.x = 10), r.y + t.height + 10 > n.height && (r.y = n.height - t.height - 10), r.y < 10 && (r.y = 10), r;
4551
4551
  }
4552
4552
  const Mapbox = forwardRef((e, c) => {
4553
- let { center: l = [116.4074, 39.9042], zoom: u = 12, pitch: d = 0, bearing: f = 0, style: h = "mapbox://styles/mapbox/dark-v11", maxBounds: g, mode: _ = "display", editConfig: v = {}, pickerConfig: y = {}, onPick: b, interactive: x = {}, layers: S = [], rasterPaint: C, entities: T = [], selectedIds: E = [], entityConfig: D, nameConfig: O, selectNameConfig: k, areaConfig: A, circleConfig: j, lengthConfig: M, showCoordinates: be = !0, showScale: Se = !0, showResetView: Ee = !0, showRoadHighlight: De = !1, showMeasure: Oe = !1, showRasterPaint: Ae = !1, onRasterPaintChange: je, popupDefaults: N, renderPopup: Pe, onMapLoad: Fe, onEntityClick: Ie, onPopupOpen: Le, onPopupClose: Re, className: ze = "", containerStyle: Be } = e, Ve = useRef(null), P = useRef(null), F = useRef(/* @__PURE__ */ new Map()), I = useRef(/* @__PURE__ */ new Map()), He = useRef(/* @__PURE__ */ new Set()), [L, Ue] = useState(null), We = useRef(null), Ge = useRef(null), Ke = useRef(null), [qe, Je] = useState(null), Ye = useRef(null), Xe = useRef(null), [Ze, Qe] = useState(null), [R, $e] = useState(_), [et, tt] = useState(null), nt = useRef(null), [rt, z] = useState(null), [it, B] = useState(null), [at, ot] = useState(null), V = useRef(!1), H = useRef(null), U = useRef(null), W = useRef(null), st = useRef(null), G = useRef(null), ct = useRef([]), K = useRef(null), lt = useRef(null), q = useRef(null), ut = useRef([]), J = useRef(null);
4553
+ let { center: l = [116.4074, 39.9042], zoom: u = 12, pitch: d = 0, bearing: f = 0, style: h = "mapbox://styles/mapbox/dark-v11", maxBounds: g, mode: _ = "display", editConfig: v = {}, pickerConfig: y = {}, onPick: b, interactive: x = {}, layers: S = [], rasterPaint: T, entities: E = [], selectedIds: D = [], entityConfig: O, nameConfig: k, selectNameConfig: A, areaConfig: j, circleConfig: M, lengthConfig: N, showCoordinates: xe = !0, showScale: Te = !0, showResetView: Ee = !0, showRoadHighlight: De = !1, showMeasure: ke = !1, showRasterPaint: Ae = !1, onRasterPaintChange: Me, popupDefaults: P, renderPopup: Pe, onMapLoad: Fe, onEntityClick: Ie, onPopupOpen: Le, onPopupClose: Re, className: ze = "", containerStyle: Be } = e, Ve = useRef(null), F = useRef(null), I = useRef(/* @__PURE__ */ new Map()), L = useRef(/* @__PURE__ */ new Map()), He = useRef(/* @__PURE__ */ new Set()), [R, Ue] = useState(null), We = useRef(null), Ge = useRef(null), Ke = useRef(null), [qe, Je] = useState(null), Ye = useRef(null), Xe = useRef(null), [Ze, Qe] = useState(null), [z, $e] = useState(_), [et, tt] = useState(null), nt = useRef(null), [rt, B] = useState(null), [it, V] = useState(null), [at, ot] = useState(null), H = useRef(!1), U = useRef(null), W = useRef(null), G = useRef(null), st = useRef(null), K = useRef(null), ct = useRef([]), q = useRef(null), lt = useRef(null), J = useRef(null), ut = useRef([]), dt = useRef(null);
4554
4554
  useEffect(() => {
4555
4555
  $e(_);
4556
4556
  }, [_]);
4557
- let dt = useCallback((e) => {
4558
- let t = F.current.get(e), n = I.current.get(e);
4557
+ let ft = useCallback((e) => {
4558
+ let t = I.current.get(e), n = L.current.get(e);
4559
4559
  if (t && n) {
4560
4560
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
4561
4561
  let r = {
4562
4562
  ...n,
4563
4563
  isAnimating: !0
4564
4564
  };
4565
- I.current.set(e, r), t.startAnimation();
4565
+ L.current.set(e, r), t.startAnimation();
4566
4566
  } else if (n.type === "circle" && t instanceof CanvasCircleRenderer) {
4567
4567
  let r = {
4568
4568
  ...n,
4569
4569
  isAnimating: !0
4570
4570
  };
4571
- I.current.set(e, r), t.startAnimation();
4571
+ L.current.set(e, r), t.startAnimation();
4572
4572
  }
4573
4573
  }
4574
- }, []), ft = useCallback((e) => {
4575
- let t = F.current.get(e), n = I.current.get(e);
4574
+ }, []), pt = useCallback((e) => {
4575
+ let t = I.current.get(e), n = L.current.get(e);
4576
4576
  if (t && n) {
4577
4577
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
4578
4578
  let r = {
4579
4579
  ...n,
4580
4580
  isAnimating: !1
4581
4581
  };
4582
- I.current.set(e, r), t.stopAnimation();
4582
+ L.current.set(e, r), t.stopAnimation();
4583
4583
  } else if (n.type === "circle" && t instanceof CanvasCircleRenderer) {
4584
4584
  let r = {
4585
4585
  ...n,
4586
4586
  isAnimating: !1
4587
4587
  };
4588
- I.current.set(e, r), t.stopAnimation();
4588
+ L.current.set(e, r), t.stopAnimation();
4589
4589
  }
4590
4590
  }
4591
- }, []), pt = useCallback((e) => {
4592
- let t = I.current.get(e);
4593
- t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? ft(e) : dt(e));
4594
- }, [dt, ft]), mt = useCallback((e) => {
4591
+ }, []), mt = useCallback((e) => {
4592
+ let t = L.current.get(e);
4593
+ t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? pt(e) : ft(e));
4594
+ }, [ft, pt]), ht = useCallback((e) => {
4595
4595
  if (e === void 0) {
4596
4596
  let e = !1;
4597
- for (let [, t] of F.current) if (t instanceof UnitRenderer) {
4597
+ for (let [, t] of I.current) if (t instanceof UnitRenderer) {
4598
4598
  let n = t.getShowTrajectory();
4599
4599
  if (n === "all" || typeof n == "number" && n > 0) {
4600
4600
  e = !0;
@@ -4602,17 +4602,17 @@ const Mapbox = forwardRef((e, c) => {
4602
4602
  }
4603
4603
  }
4604
4604
  let t = e ? 0 : "all";
4605
- for (let [, e] of F.current) e instanceof UnitRenderer && e.setShowTrajectory(t);
4605
+ for (let [, e] of I.current) e instanceof UnitRenderer && e.setShowTrajectory(t);
4606
4606
  } else {
4607
4607
  let t = new Set(e.map(String));
4608
- for (let [e, n] of F.current) n instanceof UnitRenderer && n.setShowTrajectory(t.has(String(e)) ? "all" : 0);
4608
+ for (let [e, n] of I.current) n instanceof UnitRenderer && n.setShowTrajectory(t.has(String(e)) ? "all" : 0);
4609
4609
  }
4610
- }, []), ht = useCallback((e, t, n) => {
4611
- let r = T.find((t) => String(t.id) === String(e));
4612
- if (!r?.popup || !P.current) return;
4610
+ }, []), gt = useCallback((e, t, n) => {
4611
+ let r = E.find((t) => String(t.id) === String(e));
4612
+ if (!r?.popup || !F.current) return;
4613
4613
  let i = r.popup.content ?? Pe?.(r);
4614
4614
  if (!i) return;
4615
- let a = mergePopupConfig(r.popup, N, i), { position: o, actualPosition: s } = calculatePopupPosition(r, a, P.current, n);
4615
+ let a = mergePopupConfig(r.popup, P, i), { position: o, actualPosition: s } = calculatePopupPosition(r, a, F.current, n);
4616
4616
  Ue({
4617
4617
  entityId: e,
4618
4618
  position: o,
@@ -4621,27 +4621,27 @@ const Mapbox = forwardRef((e, c) => {
4621
4621
  actualPosition: s
4622
4622
  }), Le?.(e);
4623
4623
  }, [
4624
- T,
4625
- N,
4624
+ E,
4625
+ P,
4626
4626
  Pe,
4627
4627
  Le
4628
- ]), gt = useCallback((e) => {
4629
- L?.entityId === e && (Ue(null), Re?.(e));
4630
- }, [L, Re]), _t = useCallback(() => {
4628
+ ]), _t = useCallback((e) => {
4629
+ R?.entityId === e && (Ue(null), Re?.(e));
4630
+ }, [R, Re]), vt = useCallback(() => {
4631
4631
  Ue((e) => (e && Re?.(e.entityId), null));
4632
- }, [Re]), vt = useCallback((e) => L?.entityId === e, [L]), yt = useCallback((e, t, n) => {
4633
- let r = P.current;
4632
+ }, [Re]), yt = useCallback((e) => R?.entityId === e, [R]), bt = useCallback((e, t, n) => {
4633
+ let r = F.current;
4634
4634
  r && r.flyTo({
4635
4635
  center: e,
4636
4636
  zoom: t ?? r.getZoom(),
4637
4637
  ...n
4638
4638
  });
4639
- }, []), bt = useCallback((e, t, n) => {
4640
- let r = P.current;
4639
+ }, []), xt = useCallback((e, t, n) => {
4640
+ let r = F.current;
4641
4641
  if (!r || e.length === 0) return;
4642
4642
  let i = [];
4643
4643
  for (let t of e) {
4644
- let e = F.current.get(t);
4644
+ let e = I.current.get(t);
4645
4645
  e && i.push(e.getBounds());
4646
4646
  }
4647
4647
  if (i.length === 0) return;
@@ -4663,51 +4663,65 @@ const Mapbox = forwardRef((e, c) => {
4663
4663
  pitch: n?.pitch ?? r.getPitch()
4664
4664
  };
4665
4665
  t !== void 0 && (p.maxZoom = t), n?.essential !== void 0 && (p.essential = n.essential), r.fitBounds(f, p);
4666
- }, []), xt = useCallback((e) => {
4667
- let t = P.current;
4666
+ }, []), St = useCallback((e) => {
4667
+ let t = F.current;
4668
4668
  if (!t || !t.getContainer()) return;
4669
- let { showMarker: n = !0, markerColor: r = "#3388ff" } = y;
4669
+ let { showMarker: n = !0, markerColor: r = "#3388ff", name: i, nameConfig: a } = y;
4670
4670
  if (!n) {
4671
4671
  nt.current &&= (nt.current.remove(), null);
4672
4672
  return;
4673
4673
  }
4674
- if (nt.current) nt.current.setLngLat(e);
4675
- else {
4674
+ if (nt.current) {
4675
+ nt.current.setLngLat(e);
4676
+ let t = nt.current.getElement(), n = t.querySelector(".marker-label");
4677
+ if (i) {
4678
+ let e = resolveNameConfig(a, k);
4679
+ if (n) n.textContent = i, n.style.color = e.fillColor, n.style.opacity = String(e.fillOpacity), n.style.webkitTextStrokeColor = e.strokeColor, n.style.webkitTextStrokeWidth = `${e.strokeWidth}px`;
4680
+ else {
4681
+ let n = document.createElement("div");
4682
+ n.className = "marker-label", n.textContent = i, n.style.color = e.fillColor, n.style.opacity = String(e.fillOpacity), n.style.webkitTextStrokeColor = e.strokeColor, n.style.webkitTextStrokeWidth = `${e.strokeWidth}px`, t.appendChild(n);
4683
+ }
4684
+ } else n && n.remove();
4685
+ } else {
4676
4686
  let n = document.createElement("div");
4677
4687
  n.className = "mapbox-picker-marker";
4678
- let i = document.createElement("div");
4679
- i.className = "marker-inner", i.style.background = r, n.appendChild(i), nt.current = new mapboxgl.Marker({
4688
+ let o = document.createElement("div");
4689
+ if (o.className = "marker-inner", o.style.background = r, n.appendChild(o), i) {
4690
+ let e = resolveNameConfig(a, k), t = document.createElement("div");
4691
+ t.className = "marker-label", t.textContent = i, t.style.color = e.fillColor, t.style.opacity = String(e.fillOpacity), t.style.webkitTextStrokeColor = e.strokeColor, t.style.webkitTextStrokeWidth = `${e.strokeWidth}px`, n.appendChild(t);
4692
+ }
4693
+ nt.current = new mapboxgl.Marker({
4680
4694
  element: n,
4681
4695
  anchor: "bottom"
4682
4696
  }).setLngLat(e).addTo(t);
4683
4697
  }
4684
- }, [y]), St = useCallback(() => {
4698
+ }, [y, k]), Ct = useCallback(() => {
4685
4699
  nt.current &&= (nt.current.remove(), null);
4686
- }, []), Ct = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), wt = useCallback((e) => {
4687
- let t = P.current;
4688
- if (Ve.current) if (J.current &&= (J.current.remove(), null), e && t) {
4700
+ }, []), wt = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), Tt = useCallback((e) => {
4701
+ let t = F.current;
4702
+ if (Ve.current) if (dt.current &&= (dt.current.remove(), null), e && t) {
4689
4703
  t.getCanvas().style.cursor = "none";
4690
4704
  let n = document.createElement("div");
4691
4705
  n.className = "mapbox-custom-cursor";
4692
4706
  let r = e.size || e.width || 32;
4693
4707
  n.style.cssText = "\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n transform: translate(-50%, -50%);\n opacity: 0.8;\n ";
4694
4708
  let i = document.createElement("img");
4695
- i.src = e.icon, i.style.width = `${r}px`, i.style.height = `${e.size || e.height || r}px`, i.style.objectFit = "contain", n.appendChild(i), document.body.appendChild(n), J.current = n;
4709
+ i.src = e.icon, i.style.width = `${r}px`, i.style.height = `${e.size || e.height || r}px`, i.style.objectFit = "contain", n.appendChild(i), document.body.appendChild(n), dt.current = n;
4696
4710
  let a = (e) => {
4697
- J.current && (J.current.style.left = `${e.clientX}px`, J.current.style.top = `${e.clientY}px`);
4711
+ dt.current && (dt.current.style.left = `${e.clientX}px`, dt.current.style.top = `${e.clientY}px`);
4698
4712
  };
4699
4713
  document.addEventListener("mousemove", a), n.dataset.cleanup = "true", n._cleanup = () => {
4700
4714
  document.removeEventListener("mousemove", a);
4701
4715
  };
4702
4716
  } else t && (t.getCanvas().style.cursor = "");
4703
4717
  }, []), Y = useCallback(() => {
4704
- if (J.current) {
4705
- let e = J.current._cleanup;
4706
- e && e(), J.current.remove(), J.current = null;
4718
+ if (dt.current) {
4719
+ let e = dt.current._cleanup;
4720
+ e && e(), dt.current.remove(), dt.current = null;
4707
4721
  }
4708
- let e = P.current;
4722
+ let e = F.current;
4709
4723
  e && (e.getCanvas().style.cursor = "");
4710
- }, []), X = useCallback((e, t, n) => {
4724
+ }, []), Et = useCallback((e, t, n) => {
4711
4725
  if (!e.getSource(t)) {
4712
4726
  if (!e.getStyle().glyphs) {
4713
4727
  let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
@@ -4743,8 +4757,8 @@ const Mapbox = forwardRef((e, c) => {
4743
4757
  }
4744
4758
  });
4745
4759
  }
4746
- }, []), Tt = useCallback(() => {
4747
- let e = P.current;
4760
+ }, []), Dt = useCallback(() => {
4761
+ let e = F.current;
4748
4762
  e && (e.getSource("rect-preview-source") || (e.addSource("rect-preview-source", {
4749
4763
  type: "geojson",
4750
4764
  data: {
@@ -4768,9 +4782,9 @@ const Mapbox = forwardRef((e, c) => {
4768
4782
  "line-width": 2,
4769
4783
  "line-dasharray": [4, 4]
4770
4784
  }
4771
- }), X(e, "rect-preview-measure-source", "rect-preview-measure-label")));
4772
- }, [X]), Et = useCallback((e, t) => {
4773
- let n = P.current;
4785
+ }), Et(e, "rect-preview-measure-source", "rect-preview-measure-label")));
4786
+ }, [Et]), Ot = useCallback((e, t) => {
4787
+ let n = F.current;
4774
4788
  if (!n) return;
4775
4789
  let r = n.getSource("rect-preview-source");
4776
4790
  if (!r) return;
@@ -4789,11 +4803,11 @@ const Mapbox = forwardRef((e, c) => {
4789
4803
  },
4790
4804
  properties: {}
4791
4805
  });
4792
- let l = H.current, u = l?.strokeColor ?? "#3388ff", d = l?.strokeWidth ?? 2, f = l?.fillColor ?? "#3388ff", p = l?.fillOpacity ?? .1;
4806
+ let l = U.current, u = l?.strokeColor ?? "#3388ff", d = l?.strokeWidth ?? 2, f = l?.fillColor ?? "#3388ff", p = l?.fillOpacity ?? .1;
4793
4807
  n.getLayer("rect-preview-line") && (n.setPaintProperty("rect-preview-line", "line-color", u), n.setPaintProperty("rect-preview-line", "line-width", d)), n.getLayer("rect-preview-fill") && (n.setPaintProperty("rect-preview-fill", "fill-color", f), n.setPaintProperty("rect-preview-fill", "fill-opacity", p));
4794
4808
  let m = n.getSource("rect-preview-measure-source");
4795
4809
  if (m) {
4796
- let e = Tn.current, t = [], n = c[0], r = c[1], i = c[2];
4810
+ let e = En.current, t = [], n = c[0], r = c[1], i = c[2];
4797
4811
  if (e?.showArea) {
4798
4812
  let e = [(n[0] + i[0]) / 2, (n[1] + i[1]) / 2], a = distance(n, r), o = distance(r, i);
4799
4813
  t.push({
@@ -4830,8 +4844,8 @@ const Mapbox = forwardRef((e, c) => {
4830
4844
  features: t
4831
4845
  });
4832
4846
  }
4833
- }, []), Dt = useCallback(() => {
4834
- let e = P.current;
4847
+ }, []), kt = useCallback(() => {
4848
+ let e = F.current;
4835
4849
  if (!e) return;
4836
4850
  let t = e.getSource("rect-preview-source");
4837
4851
  t && t.setData({
@@ -4843,10 +4857,10 @@ const Mapbox = forwardRef((e, c) => {
4843
4857
  type: "FeatureCollection",
4844
4858
  features: []
4845
4859
  });
4846
- }, []), Z = useCallback(() => {
4847
- ot(null), Dt();
4848
- }, [Dt]), Ot = useCallback(() => {
4849
- let e = P.current;
4860
+ }, []), X = useCallback(() => {
4861
+ ot(null), kt();
4862
+ }, [kt]), At = useCallback(() => {
4863
+ let e = F.current;
4850
4864
  e && (e.getSource("circle-preview-source") || (e.addSource("circle-preview-source", {
4851
4865
  type: "geojson",
4852
4866
  data: {
@@ -4870,7 +4884,7 @@ const Mapbox = forwardRef((e, c) => {
4870
4884
  "line-width": 2,
4871
4885
  "line-dasharray": [4, 4]
4872
4886
  }
4873
- }), X(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
4887
+ }), Et(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
4874
4888
  type: "geojson",
4875
4889
  data: {
4876
4890
  type: "FeatureCollection",
@@ -4887,22 +4901,22 @@ const Mapbox = forwardRef((e, c) => {
4887
4901
  "line-dasharray": [4, 4]
4888
4902
  }
4889
4903
  }))));
4890
- }, [X]), kt = useCallback((e, t, n = 64) => {
4904
+ }, [Et]), jt = useCallback((e, t, n = 64) => {
4891
4905
  let [r, i] = e, a = [], o = t / 6371e3, s = i * Math.PI / 180;
4892
4906
  for (let e = 0; e <= n; e++) {
4893
4907
  let t = e / n * 2 * Math.PI, c = o * Math.cos(t), l = o * Math.sin(t) / Math.cos(s), u = i + c * 180 / Math.PI, d = r + l * 180 / Math.PI;
4894
4908
  a.push([d, u]);
4895
4909
  }
4896
4910
  return a;
4897
- }, []), At = useCallback((e, t) => {
4911
+ }, []), Mt = useCallback((e, t) => {
4898
4912
  let [n, r] = e, [i, a] = t, o = (a - r) * Math.PI / 180, s = (i - n) * Math.PI / 180, c = Math.sin(o / 2) * Math.sin(o / 2) + Math.cos(r * Math.PI / 180) * Math.cos(a * Math.PI / 180) * Math.sin(s / 2) * Math.sin(s / 2);
4899
4913
  return 6371e3 * (2 * Math.atan2(Math.sqrt(c), Math.sqrt(1 - c)));
4900
- }, []), jt = useCallback((e, t) => {
4901
- let n = P.current;
4914
+ }, []), Nt = useCallback((e, t) => {
4915
+ let n = F.current;
4902
4916
  if (!n) return;
4903
4917
  let r = n.getSource("circle-preview-source");
4904
4918
  if (!r) return;
4905
- let i = At(e, t), a = kt(e, i);
4919
+ let i = Mt(e, t), a = jt(e, i);
4906
4920
  r.setData({
4907
4921
  type: "Feature",
4908
4922
  geometry: {
@@ -4911,9 +4925,9 @@ const Mapbox = forwardRef((e, c) => {
4911
4925
  },
4912
4926
  properties: {}
4913
4927
  });
4914
- let o = W.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
4928
+ let o = G.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
4915
4929
  n.getLayer("circle-preview-line") && (n.setPaintProperty("circle-preview-line", "line-color", s), n.setPaintProperty("circle-preview-line", "line-width", c)), n.getLayer("circle-preview-fill") && (n.setPaintProperty("circle-preview-fill", "fill-color", l), n.setPaintProperty("circle-preview-fill", "fill-opacity", u));
4916
- let d = Tn.current, f = [], p = [];
4930
+ let d = En.current, f = [], p = [];
4917
4931
  if (d?.showArea) {
4918
4932
  let t = Math.PI * i * i;
4919
4933
  f.push({
@@ -4926,7 +4940,7 @@ const Mapbox = forwardRef((e, c) => {
4926
4940
  });
4927
4941
  }
4928
4942
  if (d?.showRadius) {
4929
- let t = W.current?.radiusAngle ?? 90, n = destinationPoint(e, i, t), r = [(e[0] + n[0]) / 2, (e[1] + n[1]) / 2];
4943
+ let t = G.current?.radiusAngle ?? 90, n = destinationPoint(e, i, t), r = [(e[0] + n[0]) / 2, (e[1] + n[1]) / 2];
4930
4944
  p.push({
4931
4945
  type: "Feature",
4932
4946
  geometry: {
@@ -4953,8 +4967,8 @@ const Mapbox = forwardRef((e, c) => {
4953
4967
  type: "FeatureCollection",
4954
4968
  features: p
4955
4969
  });
4956
- }, [At, kt]), Mt = useCallback(() => {
4957
- let e = P.current;
4970
+ }, [Mt, jt]), Pt = useCallback(() => {
4971
+ let e = F.current;
4958
4972
  if (!e) return;
4959
4973
  let t = e.getSource("circle-preview-source");
4960
4974
  t && t.setData({
@@ -4971,10 +4985,10 @@ const Mapbox = forwardRef((e, c) => {
4971
4985
  type: "FeatureCollection",
4972
4986
  features: []
4973
4987
  });
4974
- }, []), Nt = useCallback(() => {
4975
- st.current = null, Mt();
4976
- }, [Mt]), Pt = useCallback(() => {
4977
- let e = P.current;
4988
+ }, []), Ft = useCallback(() => {
4989
+ st.current = null, Pt();
4990
+ }, [Pt]), It = useCallback(() => {
4991
+ let e = F.current;
4978
4992
  e && (e.getSource("polygon-preview-source") || (e.addSource("polygon-preview-source", {
4979
4993
  type: "geojson",
4980
4994
  data: {
@@ -5014,9 +5028,9 @@ const Mapbox = forwardRef((e, c) => {
5014
5028
  "circle-stroke-color": "#ffffff",
5015
5029
  "circle-stroke-width": 2
5016
5030
  }
5017
- }), X(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
5018
- }, [X]), Ft = useCallback((e, t) => {
5019
- let n = P.current;
5031
+ }), Et(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
5032
+ }, [Et]), Lt = useCallback((e, t) => {
5033
+ let n = F.current;
5020
5034
  if (!n) return;
5021
5035
  let r = n.getSource("polygon-preview-source"), i = n.getSource("polygon-vertices-source");
5022
5036
  if (!r || !i) return;
@@ -5053,11 +5067,11 @@ const Mapbox = forwardRef((e, c) => {
5053
5067
  properties: {}
5054
5068
  }))
5055
5069
  });
5056
- let o = G.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
5070
+ let o = K.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
5057
5071
  n.getLayer("polygon-preview-line") && (n.setPaintProperty("polygon-preview-line", "line-color", s), n.setPaintProperty("polygon-preview-line", "line-width", c)), n.getLayer("polygon-preview-fill") && (n.setPaintProperty("polygon-preview-fill", "fill-color", l), n.setPaintProperty("polygon-preview-fill", "fill-opacity", u)), n.getLayer("polygon-vertices") && n.setPaintProperty("polygon-vertices", "circle-color", s);
5058
5072
  let d = n.getSource("polygon-preview-measure-source");
5059
5073
  if (d) {
5060
- let e = Tn.current, t = [];
5074
+ let e = En.current, t = [];
5061
5075
  if (e?.showArea && a.length >= 3) {
5062
5076
  let e = [...a, a[0]], n = polygonArea(e), r = 0, i = 0;
5063
5077
  for (let e of a) r += e[0], i += e[1];
@@ -5099,8 +5113,8 @@ const Mapbox = forwardRef((e, c) => {
5099
5113
  features: t
5100
5114
  });
5101
5115
  }
5102
- }, []), It = useCallback(() => {
5103
- let e = P.current;
5116
+ }, []), Rt = useCallback(() => {
5117
+ let e = F.current;
5104
5118
  if (!e) return;
5105
5119
  let t = e.getSource("polygon-preview-source");
5106
5120
  t && t.setData({
@@ -5117,10 +5131,10 @@ const Mapbox = forwardRef((e, c) => {
5117
5131
  type: "FeatureCollection",
5118
5132
  features: []
5119
5133
  });
5120
- }, []), Lt = useCallback(() => {
5121
- ct.current = [], It();
5122
- }, [It]), Rt = useCallback(() => {
5123
- let e = P.current;
5134
+ }, []), zt = useCallback(() => {
5135
+ ct.current = [], Rt();
5136
+ }, [Rt]), Bt = useCallback(() => {
5137
+ let e = F.current;
5124
5138
  e && (e.getSource("square-preview-source") || (e.addSource("square-preview-source", {
5125
5139
  type: "geojson",
5126
5140
  data: {
@@ -5144,8 +5158,8 @@ const Mapbox = forwardRef((e, c) => {
5144
5158
  "line-width": 2,
5145
5159
  "line-dasharray": [4, 4]
5146
5160
  }
5147
- }), X(e, "square-preview-measure-source", "square-preview-measure-label")));
5148
- }, [X]), zt = useCallback((e, t) => {
5161
+ }), Et(e, "square-preview-measure-source", "square-preview-measure-label")));
5162
+ }, [Et]), Vt = useCallback((e, t) => {
5149
5163
  let [n, r] = e, i = t / 2 / 6371e3, a = r * Math.PI / 180, o = i * 180 / Math.PI, s = i * 180 / Math.PI / Math.cos(a);
5150
5164
  return [
5151
5165
  [n - s, r + o],
@@ -5154,12 +5168,12 @@ const Mapbox = forwardRef((e, c) => {
5154
5168
  [n - s, r - o],
5155
5169
  [n - s, r + o]
5156
5170
  ];
5157
- }, []), Bt = useCallback((e, t) => {
5158
- let n = P.current;
5171
+ }, []), Ht = useCallback((e, t) => {
5172
+ let n = F.current;
5159
5173
  if (!n) return;
5160
5174
  let r = n.getSource("square-preview-source");
5161
5175
  if (!r) return;
5162
- let i = At(e, t) * 2, a = zt(e, i);
5176
+ let i = Mt(e, t) * 2, a = Vt(e, i);
5163
5177
  r.setData({
5164
5178
  type: "Feature",
5165
5179
  geometry: {
@@ -5168,11 +5182,11 @@ const Mapbox = forwardRef((e, c) => {
5168
5182
  },
5169
5183
  properties: {}
5170
5184
  });
5171
- let o = K.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
5185
+ let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
5172
5186
  n.getLayer("square-preview-line") && (n.setPaintProperty("square-preview-line", "line-color", s), n.setPaintProperty("square-preview-line", "line-width", c)), n.getLayer("square-preview-fill") && (n.setPaintProperty("square-preview-fill", "fill-color", l), n.setPaintProperty("square-preview-fill", "fill-opacity", u));
5173
5187
  let d = n.getSource("square-preview-measure-source");
5174
5188
  if (d) {
5175
- let t = Tn.current, n = [];
5189
+ let t = En.current, n = [];
5176
5190
  if (t?.showArea && n.push({
5177
5191
  type: "Feature",
5178
5192
  geometry: {
@@ -5196,8 +5210,8 @@ const Mapbox = forwardRef((e, c) => {
5196
5210
  features: n
5197
5211
  });
5198
5212
  }
5199
- }, [At, zt]), Vt = useCallback(() => {
5200
- let e = P.current;
5213
+ }, [Mt, Vt]), Ut = useCallback(() => {
5214
+ let e = F.current;
5201
5215
  if (!e) return;
5202
5216
  let t = e.getSource("square-preview-source");
5203
5217
  t && t.setData({
@@ -5209,10 +5223,10 @@ const Mapbox = forwardRef((e, c) => {
5209
5223
  type: "FeatureCollection",
5210
5224
  features: []
5211
5225
  });
5212
- }, []), Ht = useCallback(() => {
5213
- lt.current = null, Vt();
5214
- }, [Vt]), Ut = useCallback(() => {
5215
- let e = P.current;
5226
+ }, []), Wt = useCallback(() => {
5227
+ lt.current = null, Ut();
5228
+ }, [Ut]), Gt = useCallback(() => {
5229
+ let e = F.current;
5216
5230
  e && (e.getSource("polyline-preview-source") || (e.addSource("polyline-preview-source", {
5217
5231
  type: "geojson",
5218
5232
  data: {
@@ -5244,9 +5258,9 @@ const Mapbox = forwardRef((e, c) => {
5244
5258
  "circle-stroke-color": "#ffffff",
5245
5259
  "circle-stroke-width": 2
5246
5260
  }
5247
- }), X(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
5248
- }, [X]), Wt = useCallback((e, t) => {
5249
- let n = P.current;
5261
+ }), Et(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
5262
+ }, [Et]), Kt = useCallback((e, t) => {
5263
+ let n = F.current;
5250
5264
  if (!n) return;
5251
5265
  let r = n.getSource("polyline-preview-source"), i = n.getSource("polyline-vertices-source");
5252
5266
  if (!r || !i) return;
@@ -5272,11 +5286,11 @@ const Mapbox = forwardRef((e, c) => {
5272
5286
  properties: {}
5273
5287
  }))
5274
5288
  });
5275
- let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
5289
+ let o = J.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
5276
5290
  n.getLayer("polyline-preview-line") && (n.setPaintProperty("polyline-preview-line", "line-color", s), n.setPaintProperty("polyline-preview-line", "line-width", c)), n.getLayer("polyline-vertices") && n.setPaintProperty("polyline-vertices", "circle-color", s);
5277
5291
  let l = n.getSource("polyline-preview-measure-source");
5278
5292
  if (l) {
5279
- let e = Tn.current, t = [];
5293
+ let e = En.current, t = [];
5280
5294
  if (e?.showLength && a.length >= 2) for (let e = 0; e < a.length - 1; e++) {
5281
5295
  let n = a[e], r = a[e + 1], i = [(n[0] + r[0]) / 2, (n[1] + r[1]) / 2];
5282
5296
  t.push({
@@ -5293,8 +5307,8 @@ const Mapbox = forwardRef((e, c) => {
5293
5307
  features: t
5294
5308
  });
5295
5309
  }
5296
- }, []), Gt = useCallback(() => {
5297
- let e = P.current;
5310
+ }, []), qt = useCallback(() => {
5311
+ let e = F.current;
5298
5312
  if (!e) return;
5299
5313
  let t = e.getSource("polyline-preview-source");
5300
5314
  t && t.setData({
@@ -5311,147 +5325,150 @@ const Mapbox = forwardRef((e, c) => {
5311
5325
  type: "FeatureCollection",
5312
5326
  features: []
5313
5327
  });
5314
- }, []), Q = useCallback(() => {
5315
- ut.current = [], Gt();
5316
- }, [Gt]), Kt = useCallback((e) => {
5317
- z(e), wt(e), e ? (B("marker"), Z(), Nt(), Lt(), Ht(), Q()) : B(null);
5328
+ }, []), Z = useCallback(() => {
5329
+ ut.current = [], qt();
5330
+ }, [qt]), Jt = useCallback((e) => {
5331
+ B(e), Tt(e), e ? (V("marker"), X(), Ft(), zt(), Wt(), Z()) : V(null);
5318
5332
  }, [
5319
- wt,
5320
- Z,
5321
- Nt,
5322
- Lt,
5323
- Ht,
5324
- Q
5325
- ]), qt = useCallback((e) => {
5326
- if (B(e), e === "rectangle") {
5327
- z(null), Y(), Nt(), Lt(), Ht(), Q();
5328
- let e = P.current;
5333
+ Tt,
5334
+ X,
5335
+ Ft,
5336
+ zt,
5337
+ Wt,
5338
+ Z
5339
+ ]), Yt = useCallback((e) => {
5340
+ if (V(e), e === "rectangle") {
5341
+ B(null), Y(), Ft(), zt(), Wt(), Z();
5342
+ let e = F.current;
5329
5343
  e && (e.getCanvas().style.cursor = "crosshair");
5330
5344
  } else if (e === "circle") {
5331
- z(null), Y(), Z(), Lt(), Ht(), Q();
5332
- let e = P.current;
5345
+ B(null), Y(), X(), zt(), Wt(), Z();
5346
+ let e = F.current;
5333
5347
  e && (e.getCanvas().style.cursor = "crosshair");
5334
5348
  } else if (e === "polygon") {
5335
- z(null), Y(), Z(), Nt(), Ht(), Q();
5336
- let e = P.current;
5349
+ B(null), Y(), X(), Ft(), Wt(), Z();
5350
+ let e = F.current;
5337
5351
  e && (e.getCanvas().style.cursor = "crosshair");
5338
5352
  } else if (e === "square") {
5339
- z(null), Y(), Z(), Nt(), Lt(), Q();
5340
- let e = P.current;
5353
+ B(null), Y(), X(), Ft(), zt(), Z();
5354
+ let e = F.current;
5341
5355
  e && (e.getCanvas().style.cursor = "crosshair");
5342
5356
  } else if (e === "polyline") {
5343
- z(null), Y(), Z(), Nt(), Lt(), Ht();
5344
- let e = P.current;
5357
+ B(null), Y(), X(), Ft(), zt(), Wt();
5358
+ let e = F.current;
5345
5359
  e && (e.getCanvas().style.cursor = "crosshair");
5346
- } else e === "marker" ? (Z(), Nt(), Lt(), Ht(), Q()) : (z(null), Y(), Z(), Nt(), Lt(), Ht(), Q());
5360
+ } else e === "marker" ? (X(), Ft(), zt(), Wt(), Z()) : (B(null), Y(), X(), Ft(), zt(), Wt(), Z());
5347
5361
  }, [
5348
5362
  Y,
5349
- Z,
5350
- Nt,
5351
- Lt,
5352
- Ht,
5353
- Q
5354
- ]), Jt = useCallback((e) => {
5355
- e !== "picker" && (St(), tt(null)), e !== "edit" && (z(null), B(null), Z(), Q(), Y()), $e(e);
5363
+ X,
5364
+ Ft,
5365
+ zt,
5366
+ Wt,
5367
+ Z
5368
+ ]), Xt = useCallback((e) => {
5369
+ if (e !== "picker") {
5370
+ let e = y.value && isFinite(y.value.lng) && isFinite(y.value.lat), t = y.showMarker !== !1;
5371
+ (!e || !t) && Ct(), tt(null);
5372
+ }
5373
+ e !== "edit" && (B(null), V(null), X(), Z(), Y()), $e(e);
5356
5374
  }, [
5357
- St,
5375
+ Ct,
5358
5376
  Y,
5359
- Z,
5360
- Q
5361
- ]), Yt = useCallback(() => R, [R]), Xt = useCallback(() => et, [et]), Zt = useCallback(() => {
5362
- St(), tt(null);
5363
- }, [St]);
5377
+ X,
5378
+ Z
5379
+ ]), Zt = useCallback(() => z, [z]), Qt = useCallback(() => et, [et]), $t = useCallback(() => {
5380
+ Ct(), tt(null);
5381
+ }, [Ct]);
5364
5382
  useEffect(() => {
5365
- if (!Ze || R !== "picker") return;
5383
+ if (!Ze) return;
5366
5384
  let e = y.value;
5367
- if (e) {
5385
+ if (e && isFinite(e.lng) && isFinite(e.lat)) {
5368
5386
  let t = [e.lng, e.lat];
5369
- tt(e), xt(t);
5387
+ tt(e), St(t);
5370
5388
  }
5371
5389
  }, [
5372
5390
  y.value,
5373
- R,
5374
- xt,
5391
+ St,
5375
5392
  Ze
5376
5393
  ]);
5377
- let Qt = (e) => "mode" in e, $t = useCallback((e) => {
5378
- if ($e("edit"), St(), tt(null), V.current = !0, Qt(e)) {
5379
- if (e.mode === "marker") e.markerStyle ? (U.current = e.markerStyle, H.current = null, W.current = null, G.current = null, K.current = null, q.current = null, z(null), B("marker"), e.markerStyle.src && e.markerStyle.width ? wt({
5394
+ let en = (e) => "mode" in e, tn = useCallback((e) => {
5395
+ if ($e("edit"), Ct(), tt(null), H.current = !0, en(e)) {
5396
+ if (e.mode === "marker") e.markerStyle ? (W.current = e.markerStyle, U.current = null, G.current = null, K.current = null, q.current = null, J.current = null, B(null), V("marker"), e.markerStyle.src && e.markerStyle.width ? Tt({
5380
5397
  id: "custom",
5381
5398
  name: e.markerStyle.name || "Marker",
5382
5399
  icon: e.markerStyle.src,
5383
5400
  width: e.markerStyle.width
5384
- }) : Y()) : e.template && (U.current = null, H.current = null, W.current = null, G.current = null, K.current = null, q.current = null, z(e.template), B("marker"), wt(e.template));
5401
+ }) : Y()) : e.template && (W.current = null, U.current = null, G.current = null, K.current = null, q.current = null, J.current = null, B(e.template), V("marker"), Tt(e.template));
5385
5402
  else if (e.mode === "rectangle") {
5386
- H.current = e.rectangleStyle || null, U.current = null, W.current = null, G.current = null, K.current = null, q.current = null, z(null), B("rectangle"), Y();
5387
- let t = P.current;
5403
+ U.current = e.rectangleStyle || null, W.current = null, G.current = null, K.current = null, q.current = null, J.current = null, B(null), V("rectangle"), Y();
5404
+ let t = F.current;
5388
5405
  t && (t.getCanvas().style.cursor = "crosshair");
5389
5406
  } else if (e.mode === "circle") {
5390
- W.current = e.circleStyle || null, H.current = null, U.current = null, G.current = null, K.current = null, q.current = null, z(null), B("circle"), Y();
5391
- let t = P.current;
5407
+ G.current = e.circleStyle || null, U.current = null, W.current = null, K.current = null, q.current = null, J.current = null, B(null), V("circle"), Y();
5408
+ let t = F.current;
5392
5409
  t && (t.getCanvas().style.cursor = "crosshair");
5393
5410
  } else if (e.mode === "polygon") {
5394
- G.current = e.polygonStyle || null, H.current = null, U.current = null, W.current = null, K.current = null, q.current = null, z(null), B("polygon"), Y();
5395
- let t = P.current;
5411
+ K.current = e.polygonStyle || null, U.current = null, W.current = null, G.current = null, q.current = null, J.current = null, B(null), V("polygon"), Y();
5412
+ let t = F.current;
5396
5413
  t && (t.getCanvas().style.cursor = "crosshair");
5397
5414
  } else if (e.mode === "square") {
5398
- K.current = e.squareStyle || null, H.current = null, U.current = null, W.current = null, G.current = null, q.current = null, z(null), B("square"), Y();
5399
- let t = P.current;
5415
+ q.current = e.squareStyle || null, U.current = null, W.current = null, G.current = null, K.current = null, J.current = null, B(null), V("square"), Y();
5416
+ let t = F.current;
5400
5417
  t && (t.getCanvas().style.cursor = "crosshair");
5401
5418
  } else if (e.mode === "polyline") {
5402
- q.current = e.polylineStyle || null, H.current = null, U.current = null, W.current = null, G.current = null, K.current = null, z(null), B("polyline"), Y();
5403
- let t = P.current;
5419
+ J.current = e.polylineStyle || null, U.current = null, W.current = null, G.current = null, K.current = null, q.current = null, B(null), V("polyline"), Y();
5420
+ let t = F.current;
5404
5421
  t && (t.getCanvas().style.cursor = "crosshair");
5405
5422
  }
5406
- } else z(e), B("marker"), wt(e), H.current = null, U.current = null, W.current = null, G.current = null, K.current = null, q.current = null;
5423
+ } else B(e), V("marker"), Tt(e), U.current = null, W.current = null, G.current = null, K.current = null, q.current = null, J.current = null;
5407
5424
  }, [
5408
- St,
5409
- wt,
5425
+ Ct,
5426
+ Tt,
5410
5427
  Y
5411
5428
  ]);
5412
5429
  useImperativeHandle(c, () => ({
5413
- startAnimation: dt,
5414
- stopAnimation: ft,
5415
- toggleAnimation: pt,
5416
- getMap: () => P.current,
5417
- openPopup: (e) => ht(e, "programmatic"),
5418
- closePopup: gt,
5419
- closeAllPopups: _t,
5420
- isPopupOpen: vt,
5421
- toggleUnitTrajectory: mt,
5422
- flyTo: yt,
5423
- flyToEntities: bt,
5424
- getMode: Yt,
5425
- setMode: Jt,
5426
- getPickedLocation: Xt,
5427
- clearPickedLocation: Zt,
5428
- startDrawing: $t,
5429
- getRenderer: (e) => F.current.get(e)
5430
+ startAnimation: ft,
5431
+ stopAnimation: pt,
5432
+ toggleAnimation: mt,
5433
+ getMap: () => F.current,
5434
+ openPopup: (e) => gt(e, "programmatic"),
5435
+ closePopup: _t,
5436
+ closeAllPopups: vt,
5437
+ isPopupOpen: yt,
5438
+ toggleUnitTrajectory: ht,
5439
+ flyTo: bt,
5440
+ flyToEntities: xt,
5441
+ getMode: Zt,
5442
+ setMode: Xt,
5443
+ getPickedLocation: Qt,
5444
+ clearPickedLocation: $t,
5445
+ startDrawing: tn,
5446
+ getRenderer: (e) => I.current.get(e)
5430
5447
  }), [
5431
- dt,
5432
5448
  ft,
5433
5449
  pt,
5434
- ht,
5450
+ mt,
5435
5451
  gt,
5436
5452
  _t,
5437
5453
  vt,
5438
- mt,
5439
5454
  yt,
5455
+ ht,
5440
5456
  bt,
5441
- Yt,
5442
- Jt,
5443
- Xt,
5457
+ xt,
5444
5458
  Zt,
5445
- $t
5459
+ Xt,
5460
+ Qt,
5461
+ $t,
5462
+ tn
5446
5463
  ]);
5447
- let en = useCallback(() => {
5448
- let e = P.current;
5464
+ let nn = useCallback(() => {
5465
+ let e = F.current;
5449
5466
  if (!e) return;
5450
- let t = new Set(T.map((e) => e.id)), n = new Set(F.current.keys());
5451
- for (let e of n) t.has(e) || (F.current.get(e)?.destroy(), F.current.delete(e));
5452
- let r = new Set(E.map(String));
5453
- for (let t of T) {
5454
- let n = applyEntityConfig(t, D), i = F.current.get(n.id);
5467
+ let t = new Set(E.map((e) => e.id)), n = new Set(I.current.keys());
5468
+ for (let e of n) t.has(e) || (I.current.get(e)?.destroy(), I.current.delete(e));
5469
+ let r = new Set(D.map(String));
5470
+ for (let t of E) {
5471
+ let n = applyEntityConfig(t, O), i = I.current.get(n.id);
5455
5472
  if (i) if (n.type === "radar" && i instanceof CanvasRadarRenderer) i.update(n);
5456
5473
  else if (n.type === "image" && i instanceof CanvasImageRenderer) i.update(n);
5457
5474
  else if (n.type === "marker" && i instanceof MarkerRenderer) i.update(n);
@@ -5460,34 +5477,34 @@ const Mapbox = forwardRef((e, c) => {
5460
5477
  else if (n.type === "circle") if (n.fillType === "radial-gradient") if (i instanceof CanvasCircleRenderer) i.update(n);
5461
5478
  else {
5462
5479
  i.destroy();
5463
- let t = new CanvasCircleRenderer(e, n, O, k, A, j);
5464
- F.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
5480
+ let t = new CanvasCircleRenderer(e, n, k, A, j, M);
5481
+ I.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
5465
5482
  }
5466
5483
  else if (i instanceof CircleRenderer) i.update(n);
5467
5484
  else {
5468
5485
  i.destroy();
5469
- let t = new CircleRenderer(e, n, O, k, A, j);
5470
- F.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
5486
+ let t = new CircleRenderer(e, n, k, A, j, M);
5487
+ I.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
5471
5488
  }
5472
5489
  else (n.type === "square" && i instanceof SquareRenderer || n.type === "rectangle" && i instanceof RectangleRenderer || n.type === "polyline" && i instanceof PolylineRenderer) && i.update(n);
5473
5490
  else {
5474
5491
  let t = null;
5475
- n.type === "radar" ? t = new CanvasRadarRenderer(e, n, O, k) : n.type === "image" ? t = new CanvasImageRenderer(e, n, O, k) : n.type === "marker" ? t = new MarkerRenderer(e, n, O, k) : n.type === "unit" ? t = new UnitRenderer(e, n, O, k) : n.type === "polygon" ? t = new PolygonRenderer(e, n, O, k, A, M) : n.type === "circle" ? t = n.fillType === "radial-gradient" ? new CanvasCircleRenderer(e, n, O, k, A, j) : new CircleRenderer(e, n, O, k, A, j) : n.type === "square" ? t = new SquareRenderer(e, n, O, k, A, M) : n.type === "rectangle" ? t = new RectangleRenderer(e, n, O, k, A, M) : n.type === "polyline" && (t = new PolylineRenderer(e, n, O, k, M)), t && (F.current.set(n.id, t), t.setSelected(r.has(String(n.id))));
5492
+ n.type === "radar" ? t = new CanvasRadarRenderer(e, n, k, A) : n.type === "image" ? t = new CanvasImageRenderer(e, n, k, A) : n.type === "marker" ? t = new MarkerRenderer(e, n, k, A) : n.type === "unit" ? t = new UnitRenderer(e, n, k, A) : n.type === "polygon" ? t = new PolygonRenderer(e, n, k, A, j, N) : n.type === "circle" ? t = n.fillType === "radial-gradient" ? new CanvasCircleRenderer(e, n, k, A, j, M) : new CircleRenderer(e, n, k, A, j, M) : n.type === "square" ? t = new SquareRenderer(e, n, k, A, j, N) : n.type === "rectangle" ? t = new RectangleRenderer(e, n, k, A, j, N) : n.type === "polyline" && (t = new PolylineRenderer(e, n, k, A, N)), t && (I.current.set(n.id, t), t.setSelected(r.has(String(n.id))));
5476
5493
  }
5477
5494
  }
5478
5495
  }, [
5479
- T,
5480
5496
  E,
5481
5497
  D,
5482
5498
  O,
5483
5499
  k,
5484
5500
  A,
5485
5501
  j,
5486
- M
5487
- ]), tn = useCallback(() => {
5488
- for (let e of F.current.values()) e.destroy();
5489
- F.current.clear();
5490
- }, []), nn = useCallback((e) => {
5502
+ M,
5503
+ N
5504
+ ]), rn = useCallback(() => {
5505
+ for (let e of I.current.values()) e.destroy();
5506
+ I.current.clear();
5507
+ }, []), an = useCallback((e) => {
5491
5508
  let t = e.getStyle();
5492
5509
  if (!t?.layers) return;
5493
5510
  let n = [
@@ -5502,10 +5519,10 @@ const Mapbox = forwardRef((e, c) => {
5502
5519
  "marker-"
5503
5520
  ];
5504
5521
  for (let e of t.layers) if (n.some((t) => e.id.startsWith(t))) return e.id;
5505
- }, []), rn = useCallback((e) => {
5506
- let t = C, n = { "raster-opacity": e.opacity ?? 1 }, r = e.brightness ?? t?.brightness, i = e.saturation ?? t?.saturation, a = e.contrast ?? t?.contrast, o = e.hueRotate ?? t?.hueRotate;
5522
+ }, []), on = useCallback((e) => {
5523
+ let t = T, n = { "raster-opacity": e.opacity ?? 1 }, r = e.brightness ?? t?.brightness, i = e.saturation ?? t?.saturation, a = e.contrast ?? t?.contrast, o = e.hueRotate ?? t?.hueRotate;
5507
5524
  return r !== void 0 && (n["raster-brightness-min"] = 0, n["raster-brightness-max"] = r), i !== void 0 && (n["raster-saturation"] = i), a !== void 0 && (n["raster-contrast"] = a), o !== void 0 && (n["raster-hue-rotate"] = o), n;
5508
- }, [C]), an = useCallback((e, t) => {
5525
+ }, [T]), sn = useCallback((e, t) => {
5509
5526
  let n = `base-layer-source-${t.id}`, r = `base-layer-${t.id}`, i = {
5510
5527
  type: "raster",
5511
5528
  tiles: [t.url],
@@ -5515,19 +5532,19 @@ const Mapbox = forwardRef((e, c) => {
5515
5532
  scheme: t.scheme ?? "xyz"
5516
5533
  };
5517
5534
  t.bounds && (i.bounds = t.bounds), t.attribution && (i.attribution = t.attribution), e.addSource(n, i);
5518
- let a = nn(e);
5535
+ let a = an(e);
5519
5536
  e.addLayer({
5520
5537
  id: r,
5521
5538
  type: "raster",
5522
5539
  source: n,
5523
- paint: rn(t),
5540
+ paint: on(t),
5524
5541
  layout: { visibility: t.visible === !1 ? "none" : "visible" }
5525
5542
  }, a);
5526
- }, [nn, rn]), on = useCallback(async (e, t) => {
5543
+ }, [an, on]), cn = useCallback(async (e, t) => {
5527
5544
  try {
5528
5545
  let n = await (await fetch(t.url)).json(), r = `base-layer-source-${t.id}`, i = `base-layer-${t.id}`;
5529
5546
  if (!He.current.has(t.id)) return;
5530
- let a = n.format === "pbf" || n.vector_layers, o = nn(e);
5547
+ let a = n.format === "pbf" || n.vector_layers, o = an(e);
5531
5548
  a ? (e.addSource(r, {
5532
5549
  type: "vector",
5533
5550
  tiles: n.tiles,
@@ -5547,13 +5564,13 @@ const Mapbox = forwardRef((e, c) => {
5547
5564
  id: i,
5548
5565
  type: "raster",
5549
5566
  source: r,
5550
- paint: rn(t),
5567
+ paint: on(t),
5551
5568
  layout: { visibility: t.visible === !1 ? "none" : "visible" }
5552
5569
  }, o));
5553
5570
  } catch (e) {
5554
5571
  console.error(`Failed to load TileJSON from ${t.url}:`, e);
5555
5572
  }
5556
- }, [nn, rn]), sn = useCallback(async (e, t) => {
5573
+ }, [an, on]), ln = useCallback(async (e, t) => {
5557
5574
  try {
5558
5575
  let n = await (await fetch(t.url)).json();
5559
5576
  if (!He.current.has(t.id)) return;
@@ -5561,7 +5578,7 @@ const Mapbox = forwardRef((e, c) => {
5561
5578
  let n = `base-layer-source-${t.id}-${r}`;
5562
5579
  e.getSource(n) || e.addSource(n, i);
5563
5580
  }
5564
- let r = nn(e);
5581
+ let r = an(e);
5565
5582
  if (n.layers) for (let i of n.layers) {
5566
5583
  let n = `base-layer-${t.id}-${i.id}`;
5567
5584
  if (e.getLayer(n)) continue;
@@ -5572,7 +5589,7 @@ const Mapbox = forwardRef((e, c) => {
5572
5589
  };
5573
5590
  i.type === "raster" && (a.paint = {
5574
5591
  ...a.paint,
5575
- ...rn(t)
5592
+ ...on(t)
5576
5593
  }), t.visible === !1 && (a.layout = {
5577
5594
  ...a.layout,
5578
5595
  visibility: "none"
@@ -5585,50 +5602,50 @@ const Mapbox = forwardRef((e, c) => {
5585
5602
  } catch (e) {
5586
5603
  console.error(`Failed to load Style JSON from ${t.url}:`, e);
5587
5604
  }
5588
- }, [nn, rn]), cn = useCallback((e, t) => {
5605
+ }, [an, on]), un = useCallback((e, t) => {
5589
5606
  let n = e.getStyle();
5590
5607
  if (!n) return;
5591
5608
  let r = `base-layer-${t}`, i = n.layers?.filter((e) => e.id.startsWith(r)) ?? [];
5592
5609
  for (let t of i) e.getLayer(t.id) && e.removeLayer(t.id);
5593
5610
  let a = `base-layer-source-${t}`, o = n.sources ?? {};
5594
5611
  for (let t of Object.keys(o)) t.startsWith(a) && e.getSource(t) && e.removeSource(t);
5595
- }, []), ln = useCallback((e) => {
5596
- let t = P.current;
5612
+ }, []), dn = useCallback((e) => {
5613
+ let t = F.current;
5597
5614
  if (!t) return;
5598
5615
  let n = new Set(e.map((e) => e.id)), r = He.current;
5599
- for (let e of r) n.has(e) || (cn(t, e), r.delete(e));
5616
+ for (let e of r) n.has(e) || (un(t, e), r.delete(e));
5600
5617
  for (let n of e) if (r.has(n.id)) {
5601
5618
  let e = `base-layer-${n.id}`;
5602
5619
  if (t.getLayer(e)) {
5603
- let r = rn(n);
5620
+ let r = on(n);
5604
5621
  for (let [n, i] of Object.entries(r)) t.setPaintProperty(e, n, i);
5605
5622
  t.setLayoutProperty(e, "visibility", n.visible === !1 ? "none" : "visible");
5606
5623
  }
5607
5624
  } else switch (r.add(n.id), n.type) {
5608
5625
  case "raster":
5609
- an(t, n);
5626
+ sn(t, n);
5610
5627
  break;
5611
5628
  case "tilejson":
5612
- on(t, n);
5629
+ cn(t, n);
5613
5630
  break;
5614
5631
  case "style":
5615
- sn(t, n);
5632
+ ln(t, n);
5616
5633
  break;
5617
5634
  default: {
5618
5635
  let e = n;
5619
- e.url && an(t, {
5636
+ e.url && sn(t, {
5620
5637
  ...e,
5621
5638
  type: "raster"
5622
5639
  });
5623
5640
  }
5624
5641
  }
5625
5642
  }, [
5626
- an,
5627
- on,
5628
5643
  sn,
5629
5644
  cn,
5630
- rn
5631
- ]), un = useCallback((e) => {
5645
+ ln,
5646
+ un,
5647
+ on
5648
+ ]), fn = useCallback((e) => {
5632
5649
  let t = e;
5633
5650
  for (; t;) {
5634
5651
  let e = t.getAttribute?.("data-entity-id");
@@ -5636,38 +5653,38 @@ const Mapbox = forwardRef((e, c) => {
5636
5653
  t = t.parentElement;
5637
5654
  }
5638
5655
  return null;
5639
- }, []), dn = useCallback((e) => {
5656
+ }, []), pn = useCallback((e) => {
5640
5657
  let t = [e.lngLat.lng, e.lngLat.lat], n = {
5641
5658
  x: e.point.x,
5642
5659
  y: e.point.y
5643
- }, r = yn.current;
5660
+ }, r = xn.current;
5644
5661
  if (r === "picker") {
5645
5662
  let e = {
5646
5663
  lng: t[0],
5647
5664
  lat: t[1]
5648
5665
  };
5649
- tt(e), xt(t), bn.current?.(e);
5666
+ tt(e), St(t), Sn.current?.(e);
5650
5667
  return;
5651
5668
  }
5652
5669
  if (r === "edit") {
5653
- let e = Sn.current;
5670
+ let e = wn.current;
5654
5671
  if (e === "rectangle") {
5655
- let e = Cn.current;
5672
+ let e = Tn.current;
5656
5673
  if (!e) ot(t);
5657
5674
  else {
5658
- let n = H.current, r = applyEntityConfig({
5675
+ let n = U.current, r = applyEntityConfig({
5659
5676
  ...n,
5660
- id: n?.id ?? Ct(),
5677
+ id: n?.id ?? wt(),
5661
5678
  type: "rectangle",
5662
5679
  bounds: [e, t]
5663
- }, D);
5664
- Dt();
5665
- let i = P.current;
5666
- if (i && !F.current.has(r.id)) {
5667
- let e = new RectangleRenderer(i, r, O, k, A, M);
5668
- F.current.set(r.id, e);
5680
+ }, O);
5681
+ kt();
5682
+ let i = F.current;
5683
+ if (i && !I.current.has(r.id)) {
5684
+ let e = new RectangleRenderer(i, r, k, A, j, N);
5685
+ I.current.set(r.id, e);
5669
5686
  }
5670
- wn.current.onRectangleAdd?.(r), ot(null), H.current = null, V.current && (V.current = !1, B(null), i && (i.getCanvas().style.cursor = ""));
5687
+ Q.current.onRectangleAdd?.(r), ot(null), U.current = null, H.current && (H.current = !1, V(null), i && (i.getCanvas().style.cursor = ""));
5671
5688
  }
5672
5689
  return;
5673
5690
  }
@@ -5675,20 +5692,20 @@ const Mapbox = forwardRef((e, c) => {
5675
5692
  let e = st.current;
5676
5693
  if (!e) st.current = { center: t };
5677
5694
  else {
5678
- let n = At(e.center, t), r = W.current, i = applyEntityConfig({
5695
+ let n = Mt(e.center, t), r = G.current, i = applyEntityConfig({
5679
5696
  ...r,
5680
- id: r?.id ?? Ct(),
5697
+ id: r?.id ?? wt(),
5681
5698
  type: "circle",
5682
5699
  center: e.center,
5683
5700
  radius: n
5684
- }, D);
5685
- Mt();
5686
- let a = P.current;
5687
- if (a && !F.current.has(i.id)) {
5688
- let e = new CircleRenderer(a, i, O, k, A, j);
5689
- F.current.set(i.id, e);
5701
+ }, O);
5702
+ Pt();
5703
+ let a = F.current;
5704
+ if (a && !I.current.has(i.id)) {
5705
+ let e = new CircleRenderer(a, i, k, A, j, M);
5706
+ I.current.set(i.id, e);
5690
5707
  }
5691
- wn.current.onCircleAdd?.(i), st.current = null, W.current = null, V.current && (V.current = !1, B(null), a && (a.getCanvas().style.cursor = ""));
5708
+ Q.current.onCircleAdd?.(i), st.current = null, G.current = null, H.current && (H.current = !1, V(null), a && (a.getCanvas().style.cursor = ""));
5692
5709
  }
5693
5710
  return;
5694
5711
  }
@@ -5696,20 +5713,20 @@ const Mapbox = forwardRef((e, c) => {
5696
5713
  let e = ct.current;
5697
5714
  if (e.length >= 3) {
5698
5715
  let n = e[0];
5699
- if (At(n, t) < 20) {
5700
- let t = G.current, n = applyEntityConfig({
5716
+ if (Mt(n, t) < 20) {
5717
+ let t = K.current, n = applyEntityConfig({
5701
5718
  ...t,
5702
- id: t?.id ?? Ct(),
5719
+ id: t?.id ?? wt(),
5703
5720
  type: "polygon",
5704
5721
  coordinates: [...e]
5705
- }, D);
5706
- It();
5707
- let r = P.current;
5708
- if (r && !F.current.has(n.id)) {
5709
- let e = new PolygonRenderer(r, n, O, k, A, M);
5710
- F.current.set(n.id, e);
5722
+ }, O);
5723
+ Rt();
5724
+ let r = F.current;
5725
+ if (r && !I.current.has(n.id)) {
5726
+ let e = new PolygonRenderer(r, n, k, A, j, N);
5727
+ I.current.set(n.id, e);
5711
5728
  }
5712
- wn.current.onPolygonAdd?.(n), ct.current = [], G.current = null, V.current && (V.current = !1, B(null), r && (r.getCanvas().style.cursor = ""));
5729
+ Q.current.onPolygonAdd?.(n), ct.current = [], K.current = null, H.current && (H.current = !1, V(null), r && (r.getCanvas().style.cursor = ""));
5713
5730
  return;
5714
5731
  }
5715
5732
  }
@@ -5720,20 +5737,20 @@ const Mapbox = forwardRef((e, c) => {
5720
5737
  let e = lt.current;
5721
5738
  if (!e) lt.current = { center: t };
5722
5739
  else {
5723
- let n = At(e.center, t) * 2, r = K.current, i = applyEntityConfig({
5740
+ let n = Mt(e.center, t) * 2, r = q.current, i = applyEntityConfig({
5724
5741
  ...r,
5725
- id: r?.id ?? Ct(),
5742
+ id: r?.id ?? wt(),
5726
5743
  type: "square",
5727
5744
  center: e.center,
5728
5745
  length: n
5729
- }, D);
5730
- Vt();
5731
- let a = P.current;
5732
- if (a && !F.current.has(i.id)) {
5733
- let e = new SquareRenderer(a, i, O, k, A, M);
5734
- F.current.set(i.id, e);
5746
+ }, O);
5747
+ Ut();
5748
+ let a = F.current;
5749
+ if (a && !I.current.has(i.id)) {
5750
+ let e = new SquareRenderer(a, i, k, A, j, N);
5751
+ I.current.set(i.id, e);
5735
5752
  }
5736
- wn.current.onSquareAdd?.(i), lt.current = null, K.current = null, V.current && (V.current = !1, B(null), a && (a.getCanvas().style.cursor = ""));
5753
+ Q.current.onSquareAdd?.(i), lt.current = null, q.current = null, H.current && (H.current = !1, V(null), a && (a.getCanvas().style.cursor = ""));
5737
5754
  }
5738
5755
  return;
5739
5756
  }
@@ -5741,89 +5758,89 @@ const Mapbox = forwardRef((e, c) => {
5741
5758
  ut.current = [...ut.current, t];
5742
5759
  return;
5743
5760
  }
5744
- let n = U.current;
5761
+ let n = W.current;
5745
5762
  if (n && n.src && n.width) {
5746
5763
  let e = {
5747
5764
  ...n,
5748
- id: n.id ?? Ct(),
5765
+ id: n.id ?? wt(),
5749
5766
  type: "marker",
5750
5767
  center: t,
5751
5768
  src: n.src,
5752
5769
  width: n.width
5753
5770
  };
5754
- wn.current.onMarkerAdd?.(e), z(null), B(null), Y(), U.current = null, V.current = !1;
5771
+ Q.current.onMarkerAdd?.(e), B(null), V(null), Y(), W.current = null, H.current = !1;
5755
5772
  return;
5756
5773
  }
5757
- let r = xn.current;
5774
+ let r = Cn.current;
5758
5775
  if (r) {
5759
5776
  let e = {
5760
- id: Ct(),
5777
+ id: wt(),
5761
5778
  type: "marker",
5762
5779
  name: r.name,
5763
5780
  center: t,
5764
5781
  src: r.icon,
5765
5782
  width: r.size || r.width || 32
5766
5783
  };
5767
- r.customData !== void 0 && (e.customData = r.customData), wn.current.onMarkerAdd?.(e), z(null), B(null), Y(), V.current = !1;
5784
+ r.customData !== void 0 && (e.customData = r.customData), Q.current.onMarkerAdd?.(e), B(null), V(null), Y(), H.current = !1;
5768
5785
  return;
5769
5786
  }
5770
5787
  }
5771
- let i = gn.current, a = _n.current, o = vn.current, s = un(e.originalEvent.target);
5788
+ let i = vn.current, a = yn.current, o = bn.current, s = fn(e.originalEvent.target);
5772
5789
  if (s) {
5773
5790
  let e = i.find((e) => String(e.id) === s);
5774
5791
  if (e) {
5775
5792
  if (a?.(e), e.popup) {
5776
5793
  let t = e.popup.content ?? Pe?.(e);
5777
- t && mergePopupConfig(e.popup, N, t).trigger === "click" && o(s, "click", n);
5794
+ t && mergePopupConfig(e.popup, P, t).trigger === "click" && o(s, "click", n);
5778
5795
  }
5779
5796
  return;
5780
5797
  }
5781
5798
  }
5782
- for (let [t, r] of F.current) {
5799
+ for (let [t, r] of I.current) {
5783
5800
  let s = r.getLabelLayerId();
5784
- if (s && P.current?.getLayer(s) && P.current.queryRenderedFeatures(e.point, { layers: [s] }).length > 0) {
5801
+ if (s && F.current?.getLayer(s) && F.current.queryRenderedFeatures(e.point, { layers: [s] }).length > 0) {
5785
5802
  let e = i.find((e) => e.id === t);
5786
5803
  if (e) {
5787
5804
  if (a?.(e), e.popup) {
5788
5805
  let r = e.popup.content ?? Pe?.(e);
5789
- r && mergePopupConfig(e.popup, N, r).trigger === "click" && o(t, "click", n);
5806
+ r && mergePopupConfig(e.popup, P, r).trigger === "click" && o(t, "click", n);
5790
5807
  }
5791
5808
  return;
5792
5809
  }
5793
5810
  }
5794
5811
  }
5795
- for (let [e, r] of F.current) if (r.isPointInEntity(t)) {
5812
+ for (let [e, r] of I.current) if (r.isPointInEntity(t)) {
5796
5813
  let t = i.find((t) => t.id === e);
5797
5814
  if (t) {
5798
5815
  if (a?.(t), t.popup) {
5799
5816
  let r = t.popup.content ?? Pe?.(t);
5800
- r && mergePopupConfig(t.popup, N, r).trigger === "click" && o(e, "click", n);
5817
+ r && mergePopupConfig(t.popup, P, r).trigger === "click" && o(e, "click", n);
5801
5818
  }
5802
5819
  return;
5803
5820
  }
5804
5821
  }
5805
5822
  }, [
5806
- N,
5823
+ P,
5807
5824
  Pe,
5808
- un
5809
- ]), fn = useCallback((e) => {
5810
- let t = [e.lngLat.lng, e.lngLat.lat], n = Sn.current, r = Cn.current;
5811
- n === "rectangle" && r && Et(r, t);
5825
+ fn
5826
+ ]), mn = useCallback((e) => {
5827
+ let t = [e.lngLat.lng, e.lngLat.lat], n = wn.current, r = Tn.current;
5828
+ n === "rectangle" && r && Ot(r, t);
5812
5829
  let i = st.current;
5813
- n === "circle" && i && jt(i.center, t);
5830
+ n === "circle" && i && Nt(i.center, t);
5814
5831
  let a = ct.current;
5815
- n === "polygon" && a.length > 0 && Ft(a, t);
5832
+ n === "polygon" && a.length > 0 && Lt(a, t);
5816
5833
  let o = lt.current;
5817
- n === "square" && o && Bt(o.center, t);
5834
+ n === "square" && o && Ht(o.center, t);
5818
5835
  let s = ut.current;
5819
- n === "polyline" && s.length > 0 && Wt(s, t);
5820
- let c = gn.current, l = vn.current;
5821
- for (let [e, n] of F.current) if (n.isPointInEntity(t)) {
5836
+ n === "polyline" && s.length > 0 && Kt(s, t);
5837
+ let c = vn.current, l = bn.current;
5838
+ for (let [e, n] of I.current) if (n.isPointInEntity(t)) {
5822
5839
  let t = c.find((t) => t.id === e);
5823
5840
  if (!t?.popup) continue;
5824
5841
  let n = t.popup.content ?? Pe?.(t);
5825
5842
  if (!n) continue;
5826
- let r = mergePopupConfig(t.popup, N, n);
5843
+ let r = mergePopupConfig(t.popup, P, n);
5827
5844
  if (r.trigger === "hover") {
5828
5845
  Ke.current && clearTimeout(Ke.current), Ke.current = window.setTimeout(() => {
5829
5846
  l(e, "hover");
@@ -5831,41 +5848,41 @@ const Mapbox = forwardRef((e, c) => {
5831
5848
  return;
5832
5849
  }
5833
5850
  }
5834
- if (Ke.current &&= (clearTimeout(Ke.current), null), L?.openedBy === "hover") {
5835
- let e = F.current.get(L.entityId);
5836
- e && !e.isPointInEntity(t) && gt(L.entityId);
5851
+ if (Ke.current &&= (clearTimeout(Ke.current), null), R?.openedBy === "hover") {
5852
+ let e = I.current.get(R.entityId);
5853
+ e && !e.isPointInEntity(t) && _t(R.entityId);
5837
5854
  }
5838
5855
  }, [
5839
- N,
5856
+ P,
5840
5857
  Pe,
5841
- L,
5842
- gt,
5843
- Et,
5844
- jt,
5845
- Ft,
5846
- Bt,
5847
- Wt
5848
- ]), pn = useCallback((e) => {
5849
- if (e.preventDefault(), yn.current !== "edit") return;
5850
- if (xn.current) {
5851
- z(null), B(null), Y();
5858
+ R,
5859
+ _t,
5860
+ Ot,
5861
+ Nt,
5862
+ Lt,
5863
+ Ht,
5864
+ Kt
5865
+ ]), hn = useCallback((e) => {
5866
+ if (e.preventDefault(), xn.current !== "edit") return;
5867
+ if (Cn.current) {
5868
+ B(null), V(null), Y();
5852
5869
  return;
5853
5870
  }
5854
- let t = Sn.current;
5871
+ let t = wn.current;
5855
5872
  if (t === "rectangle") {
5856
- if (Cn.current) ot(null), Dt();
5873
+ if (Tn.current) ot(null), kt();
5857
5874
  else {
5858
- B(null);
5859
- let e = P.current;
5875
+ V(null);
5876
+ let e = F.current;
5860
5877
  e && (e.getCanvas().style.cursor = "");
5861
5878
  }
5862
5879
  return;
5863
5880
  }
5864
5881
  if (t === "circle") {
5865
- if (st.current) st.current = null, Mt();
5882
+ if (st.current) st.current = null, Pt();
5866
5883
  else {
5867
- B(null);
5868
- let e = P.current;
5884
+ V(null);
5885
+ let e = F.current;
5869
5886
  e && (e.getCanvas().style.cursor = "");
5870
5887
  }
5871
5888
  return;
@@ -5873,32 +5890,32 @@ const Mapbox = forwardRef((e, c) => {
5873
5890
  if (t === "polygon") {
5874
5891
  let e = ct.current;
5875
5892
  if (e.length >= 3) {
5876
- let t = G.current, n = applyEntityConfig({
5893
+ let t = K.current, n = applyEntityConfig({
5877
5894
  ...t,
5878
- id: t?.id ?? Ct(),
5895
+ id: t?.id ?? wt(),
5879
5896
  type: "polygon",
5880
5897
  coordinates: [...e]
5881
- }, D);
5882
- It();
5883
- let r = P.current;
5884
- if (r && !F.current.has(n.id)) {
5885
- let e = new PolygonRenderer(r, n, O, k, A, M);
5886
- F.current.set(n.id, e);
5898
+ }, O);
5899
+ Rt();
5900
+ let r = F.current;
5901
+ if (r && !I.current.has(n.id)) {
5902
+ let e = new PolygonRenderer(r, n, k, A, j, N);
5903
+ I.current.set(n.id, e);
5887
5904
  }
5888
- wn.current.onPolygonAdd?.(n), ct.current = [], G.current = null, V.current && (V.current = !1, B(null), r && (r.getCanvas().style.cursor = ""));
5889
- } else if (e.length > 0) ct.current = [], It();
5905
+ Q.current.onPolygonAdd?.(n), ct.current = [], K.current = null, H.current && (H.current = !1, V(null), r && (r.getCanvas().style.cursor = ""));
5906
+ } else if (e.length > 0) ct.current = [], Rt();
5890
5907
  else {
5891
- B(null);
5892
- let e = P.current;
5908
+ V(null);
5909
+ let e = F.current;
5893
5910
  e && (e.getCanvas().style.cursor = "");
5894
5911
  }
5895
5912
  return;
5896
5913
  }
5897
5914
  if (t === "square") {
5898
- if (lt.current) lt.current = null, Vt();
5915
+ if (lt.current) lt.current = null, Ut();
5899
5916
  else {
5900
- B(null);
5901
- let e = P.current;
5917
+ V(null);
5918
+ let e = F.current;
5902
5919
  e && (e.getCanvas().style.cursor = "");
5903
5920
  }
5904
5921
  return;
@@ -5906,23 +5923,23 @@ const Mapbox = forwardRef((e, c) => {
5906
5923
  if (t === "polyline") {
5907
5924
  let e = ut.current;
5908
5925
  if (e.length >= 2) {
5909
- let t = q.current, n = applyEntityConfig({
5926
+ let t = J.current, n = applyEntityConfig({
5910
5927
  ...t,
5911
- id: t?.id ?? Ct(),
5928
+ id: t?.id ?? wt(),
5912
5929
  type: "polyline",
5913
5930
  coordinates: [...e]
5914
- }, D);
5915
- Gt();
5916
- let r = P.current;
5917
- if (r && !F.current.has(n.id)) {
5918
- let e = new PolylineRenderer(r, n, O, k, M);
5919
- F.current.set(n.id, e);
5931
+ }, O);
5932
+ qt();
5933
+ let r = F.current;
5934
+ if (r && !I.current.has(n.id)) {
5935
+ let e = new PolylineRenderer(r, n, k, A, N);
5936
+ I.current.set(n.id, e);
5920
5937
  }
5921
- wn.current.onPolylineAdd?.(n), ut.current = [], q.current = null, V.current && (V.current = !1, B(null), r && (r.getCanvas().style.cursor = ""));
5922
- } else if (e.length > 0) ut.current = [], Gt();
5938
+ Q.current.onPolylineAdd?.(n), ut.current = [], J.current = null, H.current && (H.current = !1, V(null), r && (r.getCanvas().style.cursor = ""));
5939
+ } else if (e.length > 0) ut.current = [], qt();
5923
5940
  else {
5924
- B(null);
5925
- let e = P.current;
5941
+ V(null);
5942
+ let e = F.current;
5926
5943
  e && (e.getCanvas().style.cursor = "");
5927
5944
  }
5928
5945
  return;
@@ -5930,40 +5947,40 @@ const Mapbox = forwardRef((e, c) => {
5930
5947
  let n = [e.lngLat.lng, e.lngLat.lat], r = {
5931
5948
  x: e.point.x,
5932
5949
  y: e.point.y
5933
- }, i = gn.current, a = un(e.originalEvent.target);
5950
+ }, i = vn.current, a = fn(e.originalEvent.target);
5934
5951
  if (a) {
5935
5952
  let e = i.find((e) => String(e.id) === a);
5936
5953
  if (e) {
5937
- mn(e, r, n);
5954
+ gn(e, r, n);
5938
5955
  return;
5939
5956
  }
5940
5957
  }
5941
- for (let [t, a] of F.current) {
5958
+ for (let [t, a] of I.current) {
5942
5959
  let o = a.getLabelLayerId();
5943
- if (o && P.current?.getLayer(o) && P.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
5960
+ if (o && F.current?.getLayer(o) && F.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
5944
5961
  let e = i.find((e) => e.id === t);
5945
5962
  if (e) {
5946
- mn(e, r, n);
5963
+ gn(e, r, n);
5947
5964
  return;
5948
5965
  }
5949
5966
  }
5950
5967
  }
5951
- for (let [e, t] of F.current) if (t.isPointInEntity(n)) {
5968
+ for (let [e, t] of I.current) if (t.isPointInEntity(n)) {
5952
5969
  let t = i.find((t) => t.id === e);
5953
5970
  if (t) {
5954
- mn(t, r, n);
5971
+ gn(t, r, n);
5955
5972
  return;
5956
5973
  }
5957
5974
  }
5958
5975
  }, [
5959
- un,
5976
+ fn,
5960
5977
  Y,
5961
- Dt,
5962
- Mt,
5963
- It,
5964
- Vt,
5965
- Gt
5966
- ]), mn = useCallback((e, t, n) => {
5978
+ kt,
5979
+ Pt,
5980
+ Rt,
5981
+ Ut,
5982
+ qt
5983
+ ]), gn = useCallback((e, t, n) => {
5967
5984
  let r = Ve.current?.getBoundingClientRect(), i = r ? {
5968
5985
  x: t.x + r.left,
5969
5986
  y: t.y + r.top
@@ -5984,11 +6001,11 @@ const Mapbox = forwardRef((e, c) => {
5984
6001
  }),
5985
6002
  danger: !0,
5986
6003
  onClick: () => {
5987
- wn.current.onEntityDelete?.(e);
6004
+ Q.current.onEntityDelete?.(e);
5988
6005
  }
5989
6006
  }]
5990
6007
  });
5991
- }, []), hn = useCallback(() => {
6008
+ }, []), _n = useCallback(() => {
5992
6009
  Je(null);
5993
6010
  }, []);
5994
6011
  useEffect(() => {
@@ -6000,11 +6017,11 @@ const Mapbox = forwardRef((e, c) => {
6000
6017
  width: 100%;
6001
6018
  pointer-events: none;
6002
6019
  height: 100%;
6003
- z-index: ${N?.zIndex ?? 1e3};
6020
+ z-index: ${P?.zIndex ?? 1e3};
6004
6021
  `, document.body.appendChild(e), We.current = e, () => {
6005
6022
  document.body.contains(e) && document.body.removeChild(e);
6006
6023
  };
6007
- }, [N?.zIndex]), useEffect(() => {
6024
+ }, [P?.zIndex]), useEffect(() => {
6008
6025
  let e = document.createElement("div");
6009
6026
  return e.id = `mapbox-context-menu-container-${Date.now()}`, e.style.cssText = `
6010
6027
  position: fixed;
@@ -6013,61 +6030,61 @@ const Mapbox = forwardRef((e, c) => {
6013
6030
  width: 100%;
6014
6031
  pointer-events: none;
6015
6032
  height: 100%;
6016
- z-index: ${(N?.zIndex ?? 1e3) + 100};
6033
+ z-index: ${(P?.zIndex ?? 1e3) + 100};
6017
6034
  `, document.body.appendChild(e), Ye.current = e, () => {
6018
6035
  document.body.contains(e) && document.body.removeChild(e);
6019
6036
  };
6020
- }, [N?.zIndex]);
6021
- let gn = useRef(T);
6022
- gn.current = T;
6023
- let _n = useRef(Ie);
6024
- _n.current = Ie;
6025
- let vn = useRef(ht);
6026
- vn.current = ht;
6027
- let yn = useRef(R);
6028
- yn.current = R;
6029
- let bn = useRef(b);
6030
- bn.current = b;
6031
- let xn = useRef(rt);
6032
- xn.current = rt;
6033
- let Sn = useRef(it);
6034
- Sn.current = it;
6035
- let Cn = useRef(at);
6036
- Cn.current = at;
6037
- let wn = useRef(v);
6038
- wn.current = v;
6039
- let Tn = useRef(D);
6040
- Tn.current = D, useEffect(() => {
6037
+ }, [P?.zIndex]);
6038
+ let vn = useRef(E);
6039
+ vn.current = E;
6040
+ let yn = useRef(Ie);
6041
+ yn.current = Ie;
6042
+ let bn = useRef(gt);
6043
+ bn.current = gt;
6044
+ let xn = useRef(z);
6045
+ xn.current = z;
6046
+ let Sn = useRef(b);
6047
+ Sn.current = b;
6048
+ let Cn = useRef(rt);
6049
+ Cn.current = rt;
6050
+ let wn = useRef(it);
6051
+ wn.current = it;
6052
+ let Tn = useRef(at);
6053
+ Tn.current = at;
6054
+ let Q = useRef(v);
6055
+ Q.current = v;
6056
+ let En = useRef(O);
6057
+ En.current = O, useEffect(() => {
6041
6058
  let e = (e) => {
6042
- if (e.key === "Escape" && R === "edit") {
6043
- if (rt && (z(null), B(null), Y()), it === "rectangle") if (at) ot(null), Dt();
6059
+ if (e.key === "Escape" && z === "edit") {
6060
+ if (rt && (B(null), V(null), Y()), it === "rectangle") if (at) ot(null), kt();
6044
6061
  else {
6045
- B(null);
6046
- let e = P.current;
6062
+ V(null);
6063
+ let e = F.current;
6047
6064
  e && (e.getCanvas().style.cursor = "");
6048
6065
  }
6049
- if (it === "circle") if (st.current) st.current = null, Mt();
6066
+ if (it === "circle") if (st.current) st.current = null, Pt();
6050
6067
  else {
6051
- B(null);
6052
- let e = P.current;
6068
+ V(null);
6069
+ let e = F.current;
6053
6070
  e && (e.getCanvas().style.cursor = "");
6054
6071
  }
6055
- if (it === "polygon") if (ct.current.length > 0) ct.current = [], It();
6072
+ if (it === "polygon") if (ct.current.length > 0) ct.current = [], Rt();
6056
6073
  else {
6057
- B(null);
6058
- let e = P.current;
6074
+ V(null);
6075
+ let e = F.current;
6059
6076
  e && (e.getCanvas().style.cursor = "");
6060
6077
  }
6061
- if (it === "square") if (lt.current) lt.current = null, Vt();
6078
+ if (it === "square") if (lt.current) lt.current = null, Ut();
6062
6079
  else {
6063
- B(null);
6064
- let e = P.current;
6080
+ V(null);
6081
+ let e = F.current;
6065
6082
  e && (e.getCanvas().style.cursor = "");
6066
6083
  }
6067
- if (it === "polyline") if (ut.current.length > 0) ut.current = [], Gt();
6084
+ if (it === "polyline") if (ut.current.length > 0) ut.current = [], qt();
6068
6085
  else {
6069
- B(null);
6070
- let e = P.current;
6086
+ V(null);
6087
+ let e = F.current;
6071
6088
  e && (e.getCanvas().style.cursor = "");
6072
6089
  }
6073
6090
  }
@@ -6076,23 +6093,23 @@ const Mapbox = forwardRef((e, c) => {
6076
6093
  document.removeEventListener("keydown", e);
6077
6094
  };
6078
6095
  }, [
6079
- R,
6096
+ z,
6080
6097
  rt,
6081
6098
  it,
6082
6099
  at,
6083
6100
  Y,
6084
- Dt,
6085
- Mt,
6086
- It,
6087
- Vt,
6088
- Gt
6101
+ kt,
6102
+ Pt,
6103
+ Rt,
6104
+ Ut,
6105
+ qt
6089
6106
  ]), useEffect(() => {
6090
- let e = P.current;
6091
- if (!e || !L) return;
6092
- let t = L.entityId, n = L.config, r = () => {
6093
- let r = gn.current.find((e) => e.id === t);
6107
+ let e = F.current;
6108
+ if (!e || !R) return;
6109
+ let t = R.entityId, n = R.config, r = () => {
6110
+ let r = vn.current.find((e) => e.id === t);
6094
6111
  if (!r) {
6095
- _t();
6112
+ vt();
6096
6113
  return;
6097
6114
  }
6098
6115
  let { position: i } = calculatePopupPosition(r, n, e, void 0, Ge.current);
@@ -6103,13 +6120,13 @@ const Mapbox = forwardRef((e, c) => {
6103
6120
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
6104
6121
  clearTimeout(i), e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
6105
6122
  };
6106
- }, [L?.entityId, _t]), useEffect(() => {
6107
- let e = P.current, t = Ve.current;
6123
+ }, [R?.entityId, vt]), useEffect(() => {
6124
+ let e = F.current, t = Ve.current;
6108
6125
  if (!e || !qe || !t) return;
6109
6126
  let n = qe.lngLat, r = () => {
6110
6127
  let r = e.project(n), i = t.clientWidth, a = t.clientHeight;
6111
6128
  if (r.x < 0 || r.x > i || r.y < 0 || r.y > a) {
6112
- hn();
6129
+ _n();
6113
6130
  return;
6114
6131
  }
6115
6132
  let o = t.getBoundingClientRect(), s = r.x + o.left, c = r.y + o.top;
@@ -6118,7 +6135,7 @@ const Mapbox = forwardRef((e, c) => {
6118
6135
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
6119
6136
  e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
6120
6137
  };
6121
- }, [qe?.lngLat, hn]), useEffect(() => {
6138
+ }, [qe?.lngLat, _n]), useEffect(() => {
6122
6139
  if (!Ve.current) return;
6123
6140
  let e = {
6124
6141
  version: 8,
@@ -6152,98 +6169,98 @@ const Mapbox = forwardRef((e, c) => {
6152
6169
  return { url: e };
6153
6170
  }
6154
6171
  });
6155
- return P.current = _, _.on("load", () => {
6172
+ return F.current = _, _.on("load", () => {
6156
6173
  if (!_.getStyle().glyphs) {
6157
6174
  let e = _.style, t = "/gis-fonts/{fontstack}/{range}.pbf";
6158
6175
  e.glyphs = t, e.stylesheet && (e.stylesheet.glyphs = t);
6159
6176
  }
6160
- I.current.clear(), T.forEach((e) => {
6161
- I.current.set(e.id, e);
6162
- }), ln(S), en(), Tt(), Ot(), Pt(), Rt(), Ut(), Qe(_), Fe?.(_);
6163
- }), _.on("click", dn), _.on("mousemove", fn), _.on("contextmenu", pn), () => {
6164
- _.off("click", dn), _.off("mousemove", fn), _.off("contextmenu", pn), tn(), St(), Y(), Z(), Q(), _.remove(), P.current = null;
6177
+ L.current.clear(), E.forEach((e) => {
6178
+ L.current.set(e.id, e);
6179
+ }), dn(S), nn(), Dt(), At(), It(), Bt(), Gt(), Qe(_), Fe?.(_);
6180
+ }), _.on("click", pn), _.on("mousemove", mn), _.on("contextmenu", hn), () => {
6181
+ _.off("click", pn), _.off("mousemove", mn), _.off("contextmenu", hn), rn(), Ct(), Y(), X(), Z(), _.remove(), F.current = null;
6165
6182
  };
6166
6183
  }, []), useEffect(() => {
6167
- if (P.current) {
6168
- if (!P.current.isStyleLoaded()) {
6169
- P.current.once("load", () => {
6170
- I.current.clear(), T.forEach((e) => {
6171
- I.current.set(e.id, e);
6172
- }), en();
6184
+ if (F.current) {
6185
+ if (!F.current.isStyleLoaded()) {
6186
+ F.current.once("load", () => {
6187
+ L.current.clear(), E.forEach((e) => {
6188
+ L.current.set(e.id, e);
6189
+ }), nn();
6173
6190
  });
6174
6191
  return;
6175
6192
  }
6176
- I.current.clear(), T.forEach((e) => {
6177
- I.current.set(e.id, e);
6178
- }), en();
6193
+ L.current.clear(), E.forEach((e) => {
6194
+ L.current.set(e.id, e);
6195
+ }), nn();
6179
6196
  }
6180
- }, [T, en]), useEffect(() => {
6181
- !P.current || !P.current.isStyleLoaded() || (tn(), en());
6197
+ }, [E, nn]), useEffect(() => {
6198
+ !F.current || !F.current.isStyleLoaded() || (rn(), nn());
6182
6199
  }, [
6183
- O,
6184
6200
  k,
6185
6201
  A,
6186
6202
  j,
6187
6203
  M,
6188
- tn,
6189
- en
6204
+ N,
6205
+ rn,
6206
+ nn
6190
6207
  ]), useEffect(() => {
6191
- if (P.current) {
6192
- if (!P.current.isStyleLoaded()) {
6193
- P.current.once("load", () => {
6194
- ln(S);
6208
+ if (F.current) {
6209
+ if (!F.current.isStyleLoaded()) {
6210
+ F.current.once("load", () => {
6211
+ dn(S);
6195
6212
  });
6196
6213
  return;
6197
6214
  }
6198
- ln(S);
6215
+ dn(S);
6199
6216
  }
6200
- }, [S, ln]);
6201
- let En = useRef(void 0), Dn = useRef(!0), On = useRef(S);
6202
- On.current = S;
6203
- let kn = useRef(ln);
6204
- kn.current = ln;
6205
- let An = useRef(tn);
6206
- An.current = tn;
6207
- let jn = useRef(en);
6208
- jn.current = en;
6209
- let Mn = useRef(Tt);
6210
- Mn.current = Tt;
6211
- let Nn = useRef(Ot);
6212
- Nn.current = Ot;
6213
- let Pn = useRef(Pt);
6214
- Pn.current = Pt;
6215
- let Fn = useRef(Rt);
6216
- Fn.current = Rt;
6217
- let In = useRef(Ut);
6218
- In.current = Ut, useEffect(() => {
6219
- let e = P.current;
6217
+ }, [S, dn]);
6218
+ let Dn = useRef(void 0), On = useRef(!0), kn = useRef(S);
6219
+ kn.current = S;
6220
+ let An = useRef(dn);
6221
+ An.current = dn;
6222
+ let jn = useRef(rn);
6223
+ jn.current = rn;
6224
+ let Mn = useRef(nn);
6225
+ Mn.current = nn;
6226
+ let Nn = useRef(Dt);
6227
+ Nn.current = Dt;
6228
+ let Pn = useRef(At);
6229
+ Pn.current = At;
6230
+ let Fn = useRef(It);
6231
+ Fn.current = It;
6232
+ let In = useRef(Bt);
6233
+ In.current = Bt;
6234
+ let Ln = useRef(Gt);
6235
+ Ln.current = Gt, useEffect(() => {
6236
+ let e = F.current;
6220
6237
  if (!e) return;
6221
6238
  let t = h || {
6222
6239
  version: 8,
6223
6240
  sources: {},
6224
6241
  layers: []
6225
6242
  };
6226
- if (Dn.current) {
6227
- Dn.current = !1, En.current = h;
6243
+ if (On.current) {
6244
+ On.current = !1, Dn.current = h;
6228
6245
  return;
6229
6246
  }
6230
- En.current !== h && (En.current = h, e.setStyle(t), e.once("style.load", () => {
6247
+ Dn.current !== h && (Dn.current = h, e.setStyle(t), e.once("style.load", () => {
6231
6248
  if (!e.getStyle().glyphs) {
6232
6249
  let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
6233
6250
  t.glyphs = n, t.stylesheet && (t.stylesheet.glyphs = n);
6234
6251
  }
6235
- He.current.clear(), kn.current(On.current), An.current(), jn.current(), Mn.current(), Nn.current(), Pn.current(), Fn.current(), In.current();
6252
+ He.current.clear(), An.current(kn.current), jn.current(), Mn.current(), Nn.current(), Pn.current(), Fn.current(), In.current(), Ln.current();
6236
6253
  }));
6237
6254
  }, [h]), useEffect(() => {
6238
- let e = new Set(E.map(String));
6239
- for (let [t, n] of F.current) n.setSelected(e.has(String(t)));
6240
- }, [E]);
6241
- let Ln = useRef({});
6255
+ let e = new Set(D.map(String));
6256
+ for (let [t, n] of I.current) n.setSelected(e.has(String(t)));
6257
+ }, [D]);
6258
+ let Rn = useRef({});
6242
6259
  useEffect(() => {
6243
- let e = P.current;
6260
+ let e = F.current;
6244
6261
  if (!e) return;
6245
- let t = Ln.current, n = l && (t.center?.[0] !== l[0] || t.center?.[1] !== l[1]), r = t.zoom !== u, i = t.pitch !== d, a = t.bearing !== f;
6246
- !n && !r && !i && !a || (Ln.current = {
6262
+ let t = Rn.current, n = l && (t.center?.[0] !== l[0] || t.center?.[1] !== l[1]), r = t.zoom !== u, i = t.pitch !== d, a = t.bearing !== f;
6263
+ !n && !r && !i && !a || (Rn.current = {
6247
6264
  center: l,
6248
6265
  zoom: u,
6249
6266
  pitch: d,
@@ -6260,13 +6277,13 @@ const Mapbox = forwardRef((e, c) => {
6260
6277
  d,
6261
6278
  f
6262
6279
  ]);
6263
- let Rn = (() => be === !1 ? null : be === !0 ? { enabled: !0 } : be)(), zn = (() => Se === !1 ? null : Se === !0 ? { enabled: !0 } : Se)(), Bn = (() => Ee === !1 ? null : Ee === !0 ? { enabled: !0 } : Ee)(), $ = (() => {
6280
+ let zn = (() => xe === !1 ? null : xe === !0 ? { enabled: !0 } : xe)(), Bn = (() => Te === !1 ? null : Te === !0 ? { enabled: !0 } : Te)(), Vn = (() => Ee === !1 ? null : Ee === !0 ? { enabled: !0 } : Ee)(), $ = (() => {
6264
6281
  if (De === !1) return null;
6265
6282
  let e, t;
6266
6283
  if (S && S.length > 0) {
6267
6284
  let n = S.find((e) => e.hasRoadNetwork === !0) || S[0];
6268
6285
  if (n.type === "style") {
6269
- let t = P.current?.getStyle();
6286
+ let t = F.current?.getStyle();
6270
6287
  if (t?.sources) {
6271
6288
  let r = `base-layer-source-${n.id}-`, i = Object.keys(t.sources).find((e) => e.startsWith(r));
6272
6289
  i && (e = i);
@@ -6283,10 +6300,10 @@ const Mapbox = forwardRef((e, c) => {
6283
6300
  source: De.source || e,
6284
6301
  sourceLayer: De.sourceLayer || t
6285
6302
  };
6286
- })(), Vn = (() => Oe ? Oe === !0 ? { enabled: !0 } : Oe : null)(), Hn = (() => Ae ? Ae === !0 ? { enabled: !0 } : Ae : null)(), Un = useMemo(() => {
6303
+ })(), Hn = (() => ke ? ke === !0 ? { enabled: !0 } : ke : null)(), Un = (() => Ae ? Ae === !0 ? { enabled: !0 } : Ae : null)(), Wn = useMemo(() => {
6287
6304
  let e = [];
6288
6305
  for (let t of S) if (t.applyRasterPaint) if (t.type === "style") {
6289
- let n = P.current;
6306
+ let n = F.current;
6290
6307
  if (n) {
6291
6308
  let r = `base-layer-${t.id}-`, i = n.getStyle();
6292
6309
  if (i?.layers) for (let t of i.layers) t.id.startsWith(r) && t.type === "raster" && e.push(t.id);
@@ -6295,14 +6312,14 @@ const Mapbox = forwardRef((e, c) => {
6295
6312
  return e;
6296
6313
  }, [S, Ze]);
6297
6314
  return /* @__PURE__ */ jsxs("div", {
6298
- className: `comp-mapbox ${R === "picker" ? "comp-mapbox--picker-mode" : ""} ${ze}`,
6315
+ className: `comp-mapbox ${z === "picker" ? "comp-mapbox--picker-mode" : ""} ${ze}`,
6299
6316
  style: Be,
6300
6317
  children: [
6301
6318
  /* @__PURE__ */ jsx("div", {
6302
6319
  ref: Ve,
6303
6320
  className: "comp-mapbox__map"
6304
6321
  }),
6305
- R === "picker" && y.showCrosshair === !0 && /* @__PURE__ */ jsxs("div", {
6322
+ z === "picker" && y.showCrosshair === !0 && /* @__PURE__ */ jsxs("div", {
6306
6323
  className: "comp-mapbox__crosshair",
6307
6324
  children: [/* @__PURE__ */ jsx("div", {
6308
6325
  className: "comp-mapbox__crosshair-h",
@@ -6312,14 +6329,14 @@ const Mapbox = forwardRef((e, c) => {
6312
6329
  style: y.crosshairColor ? { backgroundColor: y.crosshairColor } : void 0
6313
6330
  })]
6314
6331
  }),
6315
- R === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) || $ && $.enabled !== !1 ? /* @__PURE__ */ jsxs("div", {
6332
+ z === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) || $ && $.enabled !== !1 ? /* @__PURE__ */ jsxs("div", {
6316
6333
  className: "comp-mapbox__edit-controls",
6317
- children: [R === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
6334
+ children: [z === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
6318
6335
  markerTemplates: v.markerTemplates || [],
6319
6336
  selectedTemplate: rt,
6320
- onTemplateSelect: Kt,
6337
+ onTemplateSelect: Jt,
6321
6338
  drawMode: it,
6322
- onDrawModeChange: qt,
6339
+ onDrawModeChange: Yt,
6323
6340
  showRectangleTool: v.showRectangleTool,
6324
6341
  showCircleTool: v.showCircleTool,
6325
6342
  showPolygonTool: v.showPolygonTool,
@@ -6336,57 +6353,57 @@ const Mapbox = forwardRef((e, c) => {
6336
6353
  style: $.style
6337
6354
  })]
6338
6355
  }) : null,
6339
- (Rn?.enabled !== !1 || zn?.enabled !== !1 || Bn?.enabled !== !1 || Vn && Vn.enabled !== !1 || Hn && Hn.enabled !== !1) && /* @__PURE__ */ jsxs("div", {
6356
+ (zn?.enabled !== !1 || Bn?.enabled !== !1 || Vn?.enabled !== !1 || Hn && Hn.enabled !== !1 || Un && Un.enabled !== !1) && /* @__PURE__ */ jsxs("div", {
6340
6357
  className: "comp-mapbox__controls",
6341
6358
  children: [
6342
- Rn && Rn.enabled !== !1 && /* @__PURE__ */ jsx(CoordinateDisplay, {
6343
- map: Ze,
6344
- precision: Rn.precision,
6345
- className: Rn.className,
6346
- style: Rn.style
6347
- }),
6348
- zn && zn.enabled !== !1 && /* @__PURE__ */ jsx(ScaleControl, {
6359
+ zn && zn.enabled !== !1 && /* @__PURE__ */ jsx(CoordinateDisplay, {
6349
6360
  map: Ze,
6350
- maxWidth: zn.maxWidth,
6351
- unit: zn.unit,
6361
+ precision: zn.precision,
6352
6362
  className: zn.className,
6353
6363
  style: zn.style
6354
6364
  }),
6355
- Vn && Vn.enabled !== !1 && /* @__PURE__ */ jsx(MeasureControl, {
6365
+ Bn && Bn.enabled !== !1 && /* @__PURE__ */ jsx(ScaleControl, {
6356
6366
  map: Ze,
6357
- entityConfig: D,
6358
- className: Vn.className,
6359
- style: Vn.style
6367
+ maxWidth: Bn.maxWidth,
6368
+ unit: Bn.unit,
6369
+ className: Bn.className,
6370
+ style: Bn.style
6360
6371
  }),
6361
- Hn && Hn.enabled !== !1 && /* @__PURE__ */ jsx(RasterPaintControl, {
6372
+ Hn && Hn.enabled !== !1 && /* @__PURE__ */ jsx(MeasureControl, {
6362
6373
  map: Ze,
6363
- value: C,
6364
- onChange: je,
6365
- rasterPaintLayerIds: Un,
6374
+ entityConfig: O,
6366
6375
  className: Hn.className,
6367
6376
  style: Hn.style
6368
6377
  }),
6369
- Bn && Bn.enabled !== !1 && /* @__PURE__ */ jsx(ResetViewControl, {
6378
+ Un && Un.enabled !== !1 && /* @__PURE__ */ jsx(RasterPaintControl, {
6379
+ map: Ze,
6380
+ value: T,
6381
+ onChange: Me,
6382
+ rasterPaintLayerIds: Wn,
6383
+ className: Un.className,
6384
+ style: Un.style
6385
+ }),
6386
+ Vn && Vn.enabled !== !1 && /* @__PURE__ */ jsx(ResetViewControl, {
6370
6387
  map: Ze,
6371
6388
  initialCenter: l,
6372
6389
  initialZoom: u,
6373
6390
  initialPitch: d,
6374
6391
  initialBearing: f,
6375
- duration: Bn.duration,
6376
- className: Bn.className,
6377
- style: Bn.style
6392
+ duration: Vn.duration,
6393
+ className: Vn.className,
6394
+ style: Vn.style
6378
6395
  })
6379
6396
  ]
6380
6397
  }),
6381
- L && We.current && /* @__PURE__ */ jsx(EntityPopup, {
6382
- popupState: L,
6383
- onClose: () => gt(L.entityId),
6398
+ R && We.current && /* @__PURE__ */ jsx(EntityPopup, {
6399
+ popupState: R,
6400
+ onClose: () => _t(R.entityId),
6384
6401
  portalContainer: We.current,
6385
6402
  popupRef: Ge
6386
6403
  }),
6387
6404
  qe && Ye.current && /* @__PURE__ */ jsx(ContextMenu, {
6388
6405
  menuState: qe,
6389
- onClose: hn,
6406
+ onClose: _n,
6390
6407
  portalContainer: Ye.current,
6391
6408
  menuRef: Xe
6392
6409
  })