bbl-mapbox-react 0.0.18 → 0.0.20

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
@@ -1781,8 +1781,8 @@ var CanvasImageRenderer = class extends BaseCanvasRenderer {
1781
1781
  if (d === 0) return Math.sqrt((r - a) * (r - a) + (i - o) * (i - o));
1782
1782
  let f = ((r - a) * l + (i - o) * u) / d;
1783
1783
  f = Math.max(0, Math.min(1, f));
1784
- let p = a + f * l, m = o + f * u;
1785
- return Math.sqrt((r - p) * (r - p) + (i - m) * (i - m));
1784
+ let p = a + f * l, ve = o + f * u;
1785
+ return Math.sqrt((r - p) * (r - p) + (i - ve) * (i - ve));
1786
1786
  }
1787
1787
  update(t) {
1788
1788
  let n = this.entity;
@@ -3932,10 +3932,10 @@ var RectangleRenderer = class e {
3932
3932
  }
3933
3933
  };
3934
3934
  const EntityPopup = ({ popupState: e, onClose: r, portalContainer: i, popupRef: s }) => {
3935
- let c = useRef(null), [l, u] = useState("entering"), [d, h] = useState(!1), g = useRef(e.position), _ = useRef(!1), v = s || c;
3936
- _.current || (g.current = e.position), useEffect(() => {
3935
+ let c = useRef(null), [l, u] = useState("entering"), [d, m] = useState(!1), h = useRef(e.position), g = useRef(!1), _ = s || c;
3936
+ g.current || (h.current = e.position), useEffect(() => {
3937
3937
  let e = setTimeout(() => {
3938
- h(!0);
3938
+ m(!0);
3939
3939
  }, 60);
3940
3940
  return () => clearTimeout(e);
3941
3941
  }, []), useEffect(() => {
@@ -3944,19 +3944,19 @@ const EntityPopup = ({ popupState: e, onClose: r, portalContainer: i, popupRef:
3944
3944
  return () => clearTimeout(e);
3945
3945
  }
3946
3946
  }, [l, d]);
3947
- let y = useCallback(() => {
3948
- e.config.animation === "none" ? r() : (_.current = !0, u("exiting"), setTimeout(() => r(), 200));
3947
+ let v = useCallback(() => {
3948
+ e.config.animation === "none" ? r() : (g.current = !0, u("exiting"), setTimeout(() => r(), 200));
3949
3949
  }, [e.config.animation, r]);
3950
3950
  useEffect(() => {
3951
3951
  if (!e.config.closeOnEscape) return;
3952
3952
  let t = (e) => {
3953
- e.key === "Escape" && y();
3953
+ e.key === "Escape" && v();
3954
3954
  };
3955
3955
  return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
3956
- }, [e.config.closeOnEscape, y]), useEffect(() => {
3956
+ }, [e.config.closeOnEscape, v]), useEffect(() => {
3957
3957
  if (!e.config.closeOnClickOutside) return;
3958
3958
  let t = (e) => {
3959
- v.current && !v.current.contains(e.target) && y();
3959
+ _.current && !_.current.contains(e.target) && v();
3960
3960
  }, n = setTimeout(() => {
3961
3961
  document.addEventListener("click", t, !0);
3962
3962
  }, 0);
@@ -3965,10 +3965,10 @@ const EntityPopup = ({ popupState: e, onClose: r, portalContainer: i, popupRef:
3965
3965
  };
3966
3966
  }, [
3967
3967
  e.config.closeOnClickOutside,
3968
- y,
3969
- v
3968
+ v,
3969
+ _
3970
3970
  ]);
3971
- let b = () => {
3971
+ let y = () => {
3972
3972
  switch (e.actualPosition) {
3973
3973
  case "top": return "center bottom";
3974
3974
  case "bottom": return "center top";
@@ -3977,25 +3977,25 @@ const EntityPopup = ({ popupState: e, onClose: r, portalContainer: i, popupRef:
3977
3977
  case "center":
3978
3978
  default: return "center center";
3979
3979
  }
3980
- }, x = g.current, S = /* @__PURE__ */ jsxs("div", {
3981
- ref: v,
3980
+ }, b = h.current, x = /* @__PURE__ */ jsxs("div", {
3981
+ ref: _,
3982
3982
  className: `entity-popup ${d ? `entity-popup--${l} animation-${e.config.animation}` : ""} ${e.config.className || ""}`,
3983
3983
  style: {
3984
3984
  position: "fixed",
3985
- left: `${x.x}px`,
3986
- top: `${x.y}px`,
3985
+ left: `${b.x}px`,
3986
+ top: `${b.y}px`,
3987
3987
  maxWidth: e.config.maxWidth,
3988
3988
  zIndex: e.config.zIndex,
3989
3989
  pointerEvents: "all",
3990
3990
  opacity: d ? void 0 : 0,
3991
- transformOrigin: b(),
3991
+ transformOrigin: y(),
3992
3992
  ...e.config.style
3993
3993
  },
3994
3994
  role: "dialog",
3995
3995
  "aria-modal": "true",
3996
3996
  children: [e.config.showCloseButton && /* @__PURE__ */ jsx("button", {
3997
3997
  className: "entity-popup__close",
3998
- onClick: y,
3998
+ onClick: v,
3999
3999
  "aria-label": "Close popup",
4000
4000
  children: "×"
4001
4001
  }), /* @__PURE__ */ jsx("div", {
@@ -4003,7 +4003,7 @@ const EntityPopup = ({ popupState: e, onClose: r, portalContainer: i, popupRef:
4003
4003
  children: e.config.content
4004
4004
  })]
4005
4005
  });
4006
- return createPortal(S, i);
4006
+ return createPortal(x, i);
4007
4007
  };
4008
4008
  var location_default = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20t='1768373933818'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20p-id='30344'%20width='200'%20height='200'%3e%3cpath%20d='M400.440142%201024h-0.073136a48.781895%2048.781895%200%200%201-45.490763-31.448598L3.383306%2066.061072a48.781895%2048.781895%200%200%201%2062.897196-62.897197l926.563466%20351.419801a48.928168%2048.928168%200%200%201%200.219409%2091.127799L597.761811%20597.688654l-151.904042%20395.082157a48.781895%2048.781895%200%200%201-45.490763%2031.229189zM133.053921%20132.907627l267.678766%20705.691916%20113.87318-296.201913a48.855032%2048.855032%200%200%201%2028.011193-27.938057l296.201913-113.87318-705.765052-267.678766z'%20p-id='30345'%20fill='%23ffffff'%20/%3e%3cscript%20xmlns=''%20/%3e%3c/svg%3e";
4009
4009
  function CoordinateDisplay({ map: e, precision: r = 6, className: i = "", style: a }) {
@@ -4167,9 +4167,9 @@ function detectVectorSource(e) {
4167
4167
  };
4168
4168
  return null;
4169
4169
  }
4170
- function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes: i = [], defaultMinWidth: c = 0, source: l, sourceLayer: u, className: d = "", style: f }) {
4171
- let [g, _] = useState(!1), [v, y] = useState(i), [b, x] = useState(!1), S = useRef(null), C = useRef(null), w = useRef(null), T = useCallback((e, t, n) => {
4172
- if (!e.isStyleLoaded()) return !1;
4170
+ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes: i = [], defaultMinWidth: c = 0, source: l, sourceLayer: u, classField: d = "class", className: f = "", style: h }) {
4171
+ let [g, _] = useState(!1), [v, y] = useState(i), [b, x] = useState(!1), S = useRef(!1), ye = useRef(null), C = useRef(null), w = useRef(null), T = useCallback((e, t, n) => {
4172
+ if (!e.isStyleLoaded() || !e.getSource(t)) return !1;
4173
4173
  let i = !0;
4174
4174
  return ROAD_TYPE_OPTIONS.forEach((a) => {
4175
4175
  let o = `${LAYER_ID_PREFIX}${a.class}`;
@@ -4181,7 +4181,7 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4181
4181
  "source-layer": n,
4182
4182
  filter: [
4183
4183
  "==",
4184
- ["get", "class"],
4184
+ ["get", d],
4185
4185
  a.class
4186
4186
  ],
4187
4187
  paint: {
@@ -4195,7 +4195,7 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4195
4195
  console.error(`Failed to add road highlight layer for ${a.class}:`, e), i = !1;
4196
4196
  }
4197
4197
  }), i;
4198
- }, [r]);
4198
+ }, [r, d]);
4199
4199
  useEffect(() => {
4200
4200
  if (!e) return;
4201
4201
  let t = () => {
@@ -4204,14 +4204,16 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4204
4204
  let r = detectVectorSource(e);
4205
4205
  r && (console.log("Auto-detected vector source:", r), t ||= r.source, n ||= r.sourceLayer);
4206
4206
  }
4207
- t && n ? T(e, t, n) && x(!0) : console.warn("No vector source found for road highlighting");
4207
+ t && n ? T(e, t, n) && (S.current = !0, x(!0)) : console.warn("No vector source found for road highlighting");
4208
4208
  };
4209
4209
  e.isStyleLoaded() ? t() : e.once("load", t);
4210
4210
  let n = () => {
4211
4211
  e.isStyleLoaded() && t();
4212
+ }, r = () => {
4213
+ S.current || t();
4212
4214
  };
4213
- return e.on("styledata", n), () => {
4214
- e.off("styledata", n);
4215
+ return e.on("styledata", n), e.on("sourcedata", r), () => {
4216
+ e.off("styledata", n), e.off("sourcedata", r);
4215
4217
  };
4216
4218
  }, [
4217
4219
  e,
@@ -4235,7 +4237,7 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4235
4237
  ]), useEffect(() => {
4236
4238
  if (!g) return;
4237
4239
  let e = (e) => {
4238
- S.current && !S.current.contains(e.target) && C.current && !C.current.contains(e.target) && _(!1);
4240
+ ye.current && !ye.current.contains(e.target) && C.current && !C.current.contains(e.target) && _(!1);
4239
4241
  }, t = setTimeout(() => {
4240
4242
  document.addEventListener("mousedown", e);
4241
4243
  }, 0);
@@ -4250,18 +4252,18 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4250
4252
  } catch {}
4251
4253
  }), w.current &&= (w.current.remove(), null);
4252
4254
  }, [e]);
4253
- let E = useCallback((e) => ROAD_TYPE_OPTIONS.find((t) => t.class === e)?.label || e, []), D = useCallback((t) => {
4255
+ let be = useCallback((e) => ROAD_TYPE_OPTIONS.find((t) => t.class === e)?.label || e, []), xe = useCallback((t) => {
4254
4256
  if (!e || v.length === 0) {
4255
4257
  w.current && w.current.remove(), e?.getCanvas().style.cursor && (e.getCanvas().style.cursor = "");
4256
4258
  return;
4257
4259
  }
4258
4260
  let n = v.map((e) => `${LAYER_ID_PREFIX}${e}`), r = [[t.point.x - 10, t.point.y - 10], [t.point.x + 10, t.point.y + 10]], i = e.queryRenderedFeatures(r, { layers: n.filter((t) => e.getLayer(t)) });
4259
4261
  if (i.length > 0) {
4260
- let n = i[0].properties || {}, r = t.lngLat, a = n.name || n.name_en || n.name_local || "", o = n.class || "", c = n.type || "", l = n.structure || "", u = n.oneway, d = n.layer, f = n.iso_3166_1 || "", p = n.iso_3166_2 || "", m = (e) => !(e == null || e === "" || typeof e == "string" && e.toLowerCase() === "none"), h = [];
4262
+ let n = i[0].properties || {}, r = t.lngLat, a = n.name || n.name_en || n.name_local || "", o = n[d] || "", c = n.type || "", l = n.structure || "", u = n.oneway, f = n.layer, p = n.iso_3166_1 || "", ve = n.iso_3166_2 || "", m = (e) => !(e == null || e === "" || typeof e == "string" && e.toLowerCase() === "none"), h = [];
4261
4263
  m(o) && h.push(`
4262
4264
  <div class="road-highlight-popup__row">
4263
4265
  <span>道路类型:</span>
4264
- <span class="road-highlight-popup__value">${E(o)}</span>
4266
+ <span class="road-highlight-popup__value">${be(o)}</span>
4265
4267
  </div>
4266
4268
  `), h.push(`
4267
4269
  <div class="road-highlight-popup__row">
@@ -4288,20 +4290,20 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4288
4290
  <span>单行道:</span>
4289
4291
  <span class="road-highlight-popup__value">${u ? "是" : "否"}</span>
4290
4292
  </div>
4291
- `), m(d) && h.push(`
4293
+ `), m(f) && h.push(`
4292
4294
  <div class="road-highlight-popup__row">
4293
4295
  <span>层级:</span>
4294
- <span class="road-highlight-popup__value">${d}</span>
4296
+ <span class="road-highlight-popup__value">${f}</span>
4295
4297
  </div>
4296
- `), m(f) && h.push(`
4298
+ `), m(p) && h.push(`
4297
4299
  <div class="road-highlight-popup__row">
4298
4300
  <span>国家代码:</span>
4299
- <span class="road-highlight-popup__value">${f}</span>
4301
+ <span class="road-highlight-popup__value">${p}</span>
4300
4302
  </div>
4301
- `), m(p) && h.push(`
4303
+ `), m(ve) && h.push(`
4302
4304
  <div class="road-highlight-popup__row">
4303
4305
  <span>地区代码:</span>
4304
- <span class="road-highlight-popup__value">${p}</span>
4306
+ <span class="road-highlight-popup__value">${ve}</span>
4305
4307
  </div>
4306
4308
  `);
4307
4309
  let g = `
@@ -4320,28 +4322,29 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4320
4322
  }, [
4321
4323
  e,
4322
4324
  v,
4323
- E
4325
+ be,
4326
+ d
4324
4327
  ]);
4325
4328
  useEffect(() => {
4326
- if (!(!e || !b)) return e.on("mousemove", D), () => {
4327
- e.off("mousemove", D), w.current && w.current.remove(), e.getCanvas().style.cursor = "";
4329
+ if (!(!e || !b)) return e.on("mousemove", xe), () => {
4330
+ e.off("mousemove", xe), w.current && w.current.remove(), e.getCanvas().style.cursor = "";
4328
4331
  };
4329
4332
  }, [
4330
4333
  e,
4331
4334
  b,
4332
- D
4335
+ xe
4333
4336
  ]);
4334
- let ve = (e, t) => {
4337
+ let D = (e, t) => {
4335
4338
  y((n) => t ? [...n, e] : n.filter((t) => t !== e));
4336
- }, ye = (e) => {
4339
+ }, Se = (e) => {
4337
4340
  y(e ? ROAD_TYPE_OPTIONS.map((e) => e.class) : []);
4338
- }, k = v.length > 0;
4341
+ }, Ce = v.length > 0;
4339
4342
  return /* @__PURE__ */ jsxs("div", {
4340
- className: `mapbox-road-highlight-control ${d}`,
4341
- style: f,
4343
+ className: `mapbox-road-highlight-control ${f}`,
4344
+ style: h,
4342
4345
  children: [/* @__PURE__ */ jsxs("button", {
4343
4346
  ref: C,
4344
- className: `mapbox-control-btn mapbox-road-highlight-control__btn ${k ? "mapbox-road-highlight-control__btn--active" : ""}`,
4347
+ className: `mapbox-control-btn mapbox-road-highlight-control__btn ${Ce ? "mapbox-road-highlight-control__btn--active" : ""}`,
4345
4348
  onClick: () => _(!g),
4346
4349
  title: `路网高亮${v.length > 0 ? ` (已选 ${v.length})` : ""}`,
4347
4350
  children: [/* @__PURE__ */ jsx("img", {
@@ -4350,7 +4353,7 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4350
4353
  className: "mapbox-road-highlight-control__btn-icon"
4351
4354
  }), /* @__PURE__ */ jsxs("span", { children: ["路网", v.length > 0 ? ` (${v.length})` : ""] })]
4352
4355
  }), g && /* @__PURE__ */ jsxs("div", {
4353
- ref: S,
4356
+ ref: ye,
4354
4357
  className: "mapbox-road-highlight-control__panel",
4355
4358
  children: [
4356
4359
  /* @__PURE__ */ jsxs("div", {
@@ -4361,7 +4364,7 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4361
4364
  }), /* @__PURE__ */ jsx(Checkbox, {
4362
4365
  checked: v.length === ROAD_TYPE_OPTIONS.length,
4363
4366
  indeterminate: v.length > 0 && v.length < ROAD_TYPE_OPTIONS.length,
4364
- onChange: ye,
4367
+ onChange: Se,
4365
4368
  style: {
4366
4369
  "--color-text-1": "#fff",
4367
4370
  "--color-border-2": "rgba(255, 255, 255, 0.3)"
@@ -4378,11 +4381,11 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4378
4381
  className: "mapbox-road-highlight-control__type-list",
4379
4382
  children: ROAD_TYPE_OPTIONS.map((e) => /* @__PURE__ */ jsxs("div", {
4380
4383
  className: "mapbox-road-highlight-control__type-item",
4381
- onClick: () => ve(e.class, !v.includes(e.class)),
4384
+ onClick: () => D(e.class, !v.includes(e.class)),
4382
4385
  children: [
4383
4386
  /* @__PURE__ */ jsx(Checkbox, {
4384
4387
  checked: v.includes(e.class),
4385
- onChange: (t) => ve(e.class, t),
4388
+ onChange: (t) => D(e.class, t),
4386
4389
  onClick: (e) => e.stopPropagation(),
4387
4390
  style: {
4388
4391
  "--color-text-1": "#fff",
@@ -4656,64 +4659,64 @@ function clearAllPreviewSources(e) {
4656
4659
  ]) clearPreviewSource(e, `${PREVIEW_PREFIX}${t}`);
4657
4660
  }
4658
4661
  function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDrawModeChange: s, className: c = "", style: l }) {
4659
- let [u, d] = useState(!1), [f, g] = useState(null), [_, v] = useState({
4662
+ let [u, d] = useState(!1), [f, h] = useState(null), [g, _] = useState({
4660
4663
  showArea: !0,
4661
4664
  showLength: !0,
4662
4665
  showRadius: !0
4663
- }), y = r !== void 0, b = y ? {
4666
+ }), v = r !== void 0, y = v ? {
4664
4667
  showArea: r.showArea ?? !0,
4665
4668
  showLength: r.showLength ?? !0,
4666
4669
  showRadius: r.showRadius ?? !0
4667
- } : _, [x, S] = useState([]), C = useRef(/* @__PURE__ */ new Map()), T = useRef(0), E = useRef(null), D = useRef(null), O = useRef(null), k = useRef(null), A = useRef(null), j = useRef([]), M = useRef([]), N = useRef(b);
4668
- N.current = b;
4669
- let Ce = useRef(f);
4670
- Ce.current = f;
4671
- let P = useCallback(() => `measure-${++T.current}`, []);
4670
+ } : g, [b, x] = useState([]), S = useRef(/* @__PURE__ */ new Map()), C = useRef(0), w = useRef(null), T = useRef(null), E = useRef(null), D = useRef(null), O = useRef(null), k = useRef([]), A = useRef([]), j = useRef(y);
4671
+ j.current = y;
4672
+ let Te = useRef(f);
4673
+ Te.current = f;
4674
+ let M = useCallback(() => `measure-${++C.current}`, []);
4672
4675
  useEffect(() => {
4673
4676
  s?.(f !== null);
4674
4677
  }, [f, s]);
4675
- let we = useRef(!1), Te = useCallback(() => {
4676
- !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), we.current = !0);
4678
+ let Ee = useRef(!1), De = useCallback(() => {
4679
+ !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), Ee.current = !0);
4677
4680
  }, [e]);
4678
4681
  useEffect(() => {
4679
4682
  if (!e) return;
4680
4683
  let t = () => {
4681
- initAllPreviewLayers(e), we.current = !0;
4684
+ initAllPreviewLayers(e), Ee.current = !0;
4682
4685
  };
4683
4686
  e.isStyleLoaded() ? t() : e.once("load", t);
4684
4687
  let n = () => {
4685
- we.current = !1;
4688
+ Ee.current = !1;
4686
4689
  };
4687
4690
  return e.on("style.load", n), () => {
4688
4691
  e.off("style.load", n);
4689
4692
  };
4690
4693
  }, [e]), useEffect(() => {
4691
4694
  let e = (e) => {
4692
- E.current && !E.current.contains(e.target) && D.current && !D.current.contains(e.target) && d(!1);
4695
+ w.current && !w.current.contains(e.target) && T.current && !T.current.contains(e.target) && d(!1);
4693
4696
  };
4694
4697
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
4695
4698
  }, []);
4696
- let F = useCallback((t) => {
4699
+ let N = useCallback((t) => {
4697
4700
  if (!e) return;
4698
- let n = applyEntityConfig(t, N.current), r = null;
4701
+ let n = applyEntityConfig(t, j.current), r = null;
4699
4702
  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) {
4700
- C.current.set(n.id, r);
4703
+ S.current.set(n.id, r);
4701
4704
  let e = {
4702
4705
  entity: n,
4703
4706
  shapeLabel: SHAPE_LABELS[n.type] || n.type,
4704
4707
  area: computeEntityArea(n),
4705
4708
  lengthOrRadius: computeEntityLengthOrRadius(n)
4706
4709
  };
4707
- S((t) => [...t, e]);
4708
- }
4709
- }, [e]), Ee = useCallback((e) => {
4710
- let t = C.current.get(e);
4711
- t && (t.destroy(), C.current.delete(e)), S((t) => t.filter((t) => t.entity.id !== e));
4712
- }, []), De = useCallback(() => {
4713
- C.current.forEach((e) => e.destroy()), C.current.clear(), S([]);
4714
- }, []), Oe = useCallback((t) => {
4710
+ x((t) => [...t, e]);
4711
+ }
4712
+ }, [e]), Oe = useCallback((e) => {
4713
+ let t = S.current.get(e);
4714
+ t && (t.destroy(), S.current.delete(e)), x((t) => t.filter((t) => t.entity.id !== e));
4715
+ }, []), ke = useCallback(() => {
4716
+ S.current.forEach((e) => e.destroy()), S.current.clear(), x([]);
4717
+ }, []), Ae = useCallback((t) => {
4715
4718
  if (!e) return;
4716
- let n = C.current.get(t);
4719
+ let n = S.current.get(t);
4717
4720
  if (!n) return;
4718
4721
  let r = n.getBounds();
4719
4722
  e.fitBounds(r, {
@@ -4721,21 +4724,21 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4721
4724
  maxZoom: 18,
4722
4725
  duration: 1e3
4723
4726
  });
4724
- }, [e]), ke = useCallback((e, t) => {
4727
+ }, [e]), je = useCallback((e, t) => {
4725
4728
  let n = {
4726
- ...N.current,
4729
+ ...j.current,
4727
4730
  [e]: t
4728
4731
  };
4729
- y ? i?.({ ...n }) : v(n), S((t) => t.map((t) => {
4732
+ v ? i?.({ ...n }) : _(n), x((t) => t.map((t) => {
4730
4733
  let r = { ...t.entity };
4731
4734
  r[e] = void 0;
4732
- let i = applyEntityConfig(r, n), a = C.current.get(t.entity.id);
4735
+ let i = applyEntityConfig(r, n), a = S.current.get(t.entity.id);
4733
4736
  return a && a.update(i), {
4734
4737
  ...t,
4735
4738
  entity: i
4736
4739
  };
4737
4740
  }));
4738
- }, [y, i]), Ae = useCallback((t, n) => {
4741
+ }, [v, i]), Me = useCallback((t, n) => {
4739
4742
  if (!e) return;
4740
4743
  let [r, i] = t, [a, o] = n, s = [
4741
4744
  [Math.min(r, a), Math.max(i, o)],
@@ -4754,7 +4757,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4754
4757
  });
4755
4758
  let l = e.getSource(`${PREVIEW_PREFIX}rect-preview-measure-source`);
4756
4759
  if (l) {
4757
- let e = N.current, t = [], n = s[0], r = s[1], i = s[2];
4760
+ let e = j.current, t = [], n = s[0], r = s[1], i = s[2];
4758
4761
  if (e?.showArea) {
4759
4762
  let e = distance(n, r), a = distance(r, i);
4760
4763
  t.push({
@@ -4785,7 +4788,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4785
4788
  features: t
4786
4789
  });
4787
4790
  }
4788
- }, [e]), je = useCallback((t, n) => {
4791
+ }, [e]), Ne = useCallback((t, n) => {
4789
4792
  if (!e) return;
4790
4793
  let r = calculateDistance(t, n), i = createCirclePolygon(t, r), a = e.getSource(`${PREVIEW_PREFIX}circle-preview-source`);
4791
4794
  a && a.setData({
@@ -4796,7 +4799,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4796
4799
  },
4797
4800
  properties: {}
4798
4801
  });
4799
- let o = N.current, s = [], c = [];
4802
+ let o = j.current, s = [], c = [];
4800
4803
  if (o?.showArea && s.push({
4801
4804
  type: "Feature",
4802
4805
  geometry: {
@@ -4832,7 +4835,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4832
4835
  type: "FeatureCollection",
4833
4836
  features: c
4834
4837
  });
4835
- }, [e]), Me = useCallback((t, n) => {
4838
+ }, [e]), Pe = useCallback((t, n) => {
4836
4839
  if (!e) return;
4837
4840
  let r = calculateDistance(t, n) * 2, i = createSquareCoords(t, r), a = e.getSource(`${PREVIEW_PREFIX}square-preview-source`);
4838
4841
  a && a.setData({
@@ -4845,7 +4848,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4845
4848
  });
4846
4849
  let o = e.getSource(`${PREVIEW_PREFIX}square-preview-measure-source`);
4847
4850
  if (o) {
4848
- let e = N.current, n = [];
4851
+ let e = j.current, n = [];
4849
4852
  if (e?.showArea && n.push({
4850
4853
  type: "Feature",
4851
4854
  geometry: {
@@ -4869,7 +4872,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4869
4872
  features: n
4870
4873
  });
4871
4874
  }
4872
- }, [e]), Ne = useCallback((t, n) => {
4875
+ }, [e]), Fe = useCallback((t, n) => {
4873
4876
  if (!e) return;
4874
4877
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polygon-preview-source`);
4875
4878
  i && (r.length >= 3 ? i.setData({
@@ -4904,7 +4907,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4904
4907
  });
4905
4908
  let o = e.getSource(`${PREVIEW_PREFIX}polygon-preview-measure-source`);
4906
4909
  if (o) {
4907
- let e = N.current, t = [];
4910
+ let e = j.current, t = [];
4908
4911
  if (e?.showArea && r.length >= 3) {
4909
4912
  let e = polygonArea([...r, r[0]]), n = 0, i = 0;
4910
4913
  for (let e of r) n += e[0], i += e[1];
@@ -4946,7 +4949,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4946
4949
  features: t
4947
4950
  });
4948
4951
  }
4949
- }, [e]), I = useCallback((t, n) => {
4952
+ }, [e]), P = useCallback((t, n) => {
4950
4953
  if (!e) return;
4951
4954
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polyline-preview-source`);
4952
4955
  i && (r.length >= 2 ? i.setData({
@@ -4974,7 +4977,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4974
4977
  });
4975
4978
  let o = e.getSource(`${PREVIEW_PREFIX}polyline-preview-measure-source`);
4976
4979
  if (o) {
4977
- let e = N.current, t = [];
4980
+ let e = j.current, t = [];
4978
4981
  if (e?.showLength && r.length >= 2) for (let e = 0; e < r.length - 1; e++) {
4979
4982
  let n = r[e], i = r[e + 1];
4980
4983
  t.push({
@@ -4994,117 +4997,117 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4994
4997
  }, [e]);
4995
4998
  useEffect(() => {
4996
4999
  if (!e || !f) return;
4997
- Te(), e.getCanvas().style.cursor = "crosshair";
5000
+ De(), e.getCanvas().style.cursor = "crosshair";
4998
5001
  let t = (t) => {
4999
- let n = [t.lngLat.lng, t.lngLat.lat], r = Ce.current;
5002
+ let n = [t.lngLat.lng, t.lngLat.lat], r = Te.current;
5000
5003
  if (r === "rectangle") {
5001
- let t = O.current;
5002
- if (!t) O.current = n;
5004
+ let t = E.current;
5005
+ if (!t) E.current = n;
5003
5006
  else {
5004
5007
  let r = {
5005
- id: P(),
5008
+ id: M(),
5006
5009
  type: "rectangle",
5007
5010
  bounds: [t, n]
5008
5011
  };
5009
- F(r), O.current = null, clearAllPreviewSources(e), g(null);
5012
+ N(r), E.current = null, clearAllPreviewSources(e), h(null);
5010
5013
  }
5011
5014
  } else if (r === "circle") {
5012
- let t = k.current;
5013
- if (!t) k.current = { center: n };
5015
+ let t = D.current;
5016
+ if (!t) D.current = { center: n };
5014
5017
  else {
5015
5018
  let r = calculateDistance(t.center, n), i = {
5016
- id: P(),
5019
+ id: M(),
5017
5020
  type: "circle",
5018
5021
  center: t.center,
5019
5022
  radius: r
5020
5023
  };
5021
- F(i), k.current = null, clearAllPreviewSources(e), g(null);
5024
+ N(i), D.current = null, clearAllPreviewSources(e), h(null);
5022
5025
  }
5023
5026
  } else if (r === "square") {
5024
- let t = A.current;
5025
- if (!t) A.current = { center: n };
5027
+ let t = O.current;
5028
+ if (!t) O.current = { center: n };
5026
5029
  else {
5027
5030
  let r = calculateDistance(t.center, n) * 2, i = {
5028
- id: P(),
5031
+ id: M(),
5029
5032
  type: "square",
5030
5033
  center: t.center,
5031
5034
  length: r
5032
5035
  };
5033
- F(i), A.current = null, clearAllPreviewSources(e), g(null);
5036
+ N(i), O.current = null, clearAllPreviewSources(e), h(null);
5034
5037
  }
5035
5038
  } else if (r === "polygon") {
5036
- let t = j.current;
5039
+ let t = k.current;
5037
5040
  if (t.length >= 3 && calculateDistance(t[0], n) < 20) {
5038
5041
  let n = {
5039
- id: P(),
5042
+ id: M(),
5040
5043
  type: "polygon",
5041
5044
  coordinates: [...t]
5042
5045
  };
5043
- F(n), j.current = [], clearAllPreviewSources(e), g(null);
5046
+ N(n), k.current = [], clearAllPreviewSources(e), h(null);
5044
5047
  return;
5045
5048
  }
5046
- j.current = [...t, n];
5047
- } else r === "polyline" && (M.current = [...M.current, n]);
5049
+ k.current = [...t, n];
5050
+ } else r === "polyline" && (A.current = [...A.current, n]);
5048
5051
  }, n = (e) => {
5049
- let t = [e.lngLat.lng, e.lngLat.lat], n = Ce.current;
5050
- if (n === "rectangle" && O.current) Ae(O.current, t);
5051
- else if (n === "circle" && k.current) je(k.current.center, t);
5052
- else if (n === "square" && A.current) Me(A.current.center, t);
5052
+ let t = [e.lngLat.lng, e.lngLat.lat], n = Te.current;
5053
+ if (n === "rectangle" && E.current) Me(E.current, t);
5054
+ else if (n === "circle" && D.current) Ne(D.current.center, t);
5055
+ else if (n === "square" && O.current) Pe(O.current.center, t);
5053
5056
  else if (n === "polygon") {
5054
- let e = j.current;
5055
- e.length > 0 && Ne(e, t);
5057
+ let e = k.current;
5058
+ e.length > 0 && Fe(e, t);
5056
5059
  } else if (n === "polyline") {
5057
- let e = M.current;
5058
- e.length > 0 && I(e, t);
5060
+ let e = A.current;
5061
+ e.length > 0 && P(e, t);
5059
5062
  }
5060
5063
  }, r = (t) => {
5061
5064
  t.preventDefault();
5062
- let n = Ce.current;
5065
+ let n = Te.current;
5063
5066
  if (n === "polygon") {
5064
- let t = j.current;
5067
+ let t = k.current;
5065
5068
  if (t.length >= 3) {
5066
5069
  let n = {
5067
- id: P(),
5070
+ id: M(),
5068
5071
  type: "polygon",
5069
5072
  coordinates: [...t]
5070
5073
  };
5071
- F(n), j.current = [], clearAllPreviewSources(e), g(null);
5072
- } else j.current = [], clearAllPreviewSources(e);
5074
+ N(n), k.current = [], clearAllPreviewSources(e), h(null);
5075
+ } else k.current = [], clearAllPreviewSources(e);
5073
5076
  } else if (n === "polyline") {
5074
- let t = M.current;
5077
+ let t = A.current;
5075
5078
  if (t.length >= 2) {
5076
5079
  let n = {
5077
- id: P(),
5080
+ id: M(),
5078
5081
  type: "polyline",
5079
5082
  coordinates: [...t]
5080
5083
  };
5081
- F(n), M.current = [], clearAllPreviewSources(e), g(null);
5082
- } else M.current = [], clearAllPreviewSources(e);
5084
+ N(n), A.current = [], clearAllPreviewSources(e), h(null);
5085
+ } else A.current = [], clearAllPreviewSources(e);
5083
5086
  }
5084
5087
  }, i = (t) => {
5085
- t.key === "Escape" && (O.current = null, k.current = null, A.current = null, j.current = [], M.current = [], clearAllPreviewSources(e), g(null));
5088
+ t.key === "Escape" && (E.current = null, D.current = null, O.current = null, k.current = [], A.current = [], clearAllPreviewSources(e), h(null));
5086
5089
  }, a = (t) => {
5087
5090
  t.preventDefault();
5088
- let n = Ce.current;
5091
+ let n = Te.current;
5089
5092
  if (n === "polygon") {
5090
- let t = j.current;
5093
+ let t = k.current;
5091
5094
  if (t.length >= 3) {
5092
5095
  let n = {
5093
- id: P(),
5096
+ id: M(),
5094
5097
  type: "polygon",
5095
5098
  coordinates: [...t]
5096
5099
  };
5097
- F(n), j.current = [], clearAllPreviewSources(e), g(null);
5100
+ N(n), k.current = [], clearAllPreviewSources(e), h(null);
5098
5101
  }
5099
5102
  } else if (n === "polyline") {
5100
- let t = M.current;
5103
+ let t = A.current;
5101
5104
  if (t.length >= 2) {
5102
5105
  let n = {
5103
- id: P(),
5106
+ id: M(),
5104
5107
  type: "polyline",
5105
5108
  coordinates: [...t]
5106
5109
  };
5107
- F(n), M.current = [], clearAllPreviewSources(e), g(null);
5110
+ N(n), A.current = [], clearAllPreviewSources(e), h(null);
5108
5111
  }
5109
5112
  }
5110
5113
  };
@@ -5114,25 +5117,25 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5114
5117
  }, [
5115
5118
  e,
5116
5119
  f,
5117
- P,
5118
- F,
5119
- Te,
5120
- Ae,
5121
- je,
5120
+ M,
5121
+ N,
5122
+ De,
5122
5123
  Me,
5123
5124
  Ne,
5124
- I
5125
+ Pe,
5126
+ Fe,
5127
+ P
5125
5128
  ]), useEffect(() => () => {
5126
- C.current.forEach((e) => e.destroy()), C.current.clear();
5129
+ S.current.forEach((e) => e.destroy()), S.current.clear();
5127
5130
  }, []);
5128
- let Pe = useCallback((t) => {
5129
- g((e) => e === t ? null : t), O.current = null, k.current = null, A.current = null, j.current = [], M.current = [], e && clearAllPreviewSources(e);
5131
+ let Ie = useCallback((t) => {
5132
+ h((e) => e === t ? null : t), E.current = null, D.current = null, O.current = null, k.current = [], A.current = [], e && clearAllPreviewSources(e);
5130
5133
  }, [e]);
5131
5134
  return e ? /* @__PURE__ */ jsxs("div", {
5132
5135
  className: `mapbox-measure-control ${c}`,
5133
5136
  style: l,
5134
5137
  children: [/* @__PURE__ */ jsxs("button", {
5135
- ref: D,
5138
+ ref: T,
5136
5139
  className: `mapbox-control-btn mapbox-measure-control__btn ${u ? "mapbox-measure-control__btn--active" : ""}`,
5137
5140
  onClick: () => d(!u),
5138
5141
  title: "测量",
@@ -5143,14 +5146,14 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5143
5146
  className: "mapbox-measure-control__btn-icon"
5144
5147
  }),
5145
5148
  /* @__PURE__ */ jsx("span", { children: "测量" }),
5146
- x.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
5149
+ b.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
5147
5150
  "(",
5148
- x.length,
5151
+ b.length,
5149
5152
  ")"
5150
5153
  ] })
5151
5154
  ]
5152
5155
  }), u && /* @__PURE__ */ jsxs("div", {
5153
- ref: E,
5156
+ ref: w,
5154
5157
  className: "mapbox-measure-control__panel",
5155
5158
  children: [
5156
5159
  /* @__PURE__ */ jsx("div", {
@@ -5161,18 +5164,18 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5161
5164
  className: "mapbox-measure-control__settings",
5162
5165
  children: [
5163
5166
  /* @__PURE__ */ jsx(Checkbox, {
5164
- checked: b.showArea,
5165
- onChange: (e) => ke("showArea", e),
5167
+ checked: y.showArea,
5168
+ onChange: (e) => je("showArea", e),
5166
5169
  children: "面积"
5167
5170
  }),
5168
5171
  /* @__PURE__ */ jsx(Checkbox, {
5169
- checked: b.showLength,
5170
- onChange: (e) => ke("showLength", e),
5172
+ checked: y.showLength,
5173
+ onChange: (e) => je("showLength", e),
5171
5174
  children: "长度"
5172
5175
  }),
5173
5176
  /* @__PURE__ */ jsx(Checkbox, {
5174
- checked: b.showRadius,
5175
- onChange: (e) => ke("showRadius", e),
5177
+ checked: y.showRadius,
5178
+ onChange: (e) => je("showRadius", e),
5176
5179
  children: "半径"
5177
5180
  })
5178
5181
  ]
@@ -5185,15 +5188,15 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5185
5188
  className: "mapbox-measure-control__tools",
5186
5189
  children: [DRAW_TOOLS.map((e) => /* @__PURE__ */ jsx("button", {
5187
5190
  className: `mapbox-measure-control__tool-btn ${f === e.mode ? "mapbox-measure-control__tool-btn--active" : ""}`,
5188
- onClick: () => Pe(e.mode),
5191
+ onClick: () => Ie(e.mode),
5189
5192
  title: e.label,
5190
5193
  children: /* @__PURE__ */ jsx("img", {
5191
5194
  src: e.icon,
5192
5195
  alt: e.label
5193
5196
  })
5194
- }, e.mode)), x.length > 0 && /* @__PURE__ */ jsx("button", {
5197
+ }, e.mode)), b.length > 0 && /* @__PURE__ */ jsx("button", {
5195
5198
  className: "mapbox-measure-control__tool-btn mapbox-measure-control__tool-btn--danger",
5196
- onClick: De,
5199
+ onClick: ke,
5197
5200
  title: "清除全部",
5198
5201
  children: /* @__PURE__ */ jsx("img", {
5199
5202
  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",
@@ -5201,7 +5204,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5201
5204
  })
5202
5205
  })]
5203
5206
  }),
5204
- x.length > 0 ? /* @__PURE__ */ jsx("div", {
5207
+ b.length > 0 ? /* @__PURE__ */ jsx("div", {
5205
5208
  className: "mapbox-measure-control__list",
5206
5209
  children: /* @__PURE__ */ jsxs("table", {
5207
5210
  className: "mapbox-measure-control__table",
@@ -5211,9 +5214,9 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5211
5214
  /* @__PURE__ */ jsx("th", { children: "面积" }),
5212
5215
  /* @__PURE__ */ jsx("th", { children: "长度/半径" }),
5213
5216
  /* @__PURE__ */ jsx("th", {})
5214
- ] }) }), /* @__PURE__ */ jsx("tbody", { children: x.map((e) => /* @__PURE__ */ jsxs("tr", {
5217
+ ] }) }), /* @__PURE__ */ jsx("tbody", { children: b.map((e) => /* @__PURE__ */ jsxs("tr", {
5215
5218
  className: "mapbox-measure-control__table-row",
5216
- onClick: () => Oe(e.entity.id),
5219
+ onClick: () => Ae(e.entity.id),
5217
5220
  children: [
5218
5221
  /* @__PURE__ */ jsx("td", { children: e.shapeLabel }),
5219
5222
  /* @__PURE__ */ jsx("td", { children: String(e.entity.id) }),
@@ -5222,7 +5225,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5222
5225
  /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", {
5223
5226
  className: "mapbox-measure-control__delete-btn",
5224
5227
  onClick: (t) => {
5225
- t.stopPropagation(), Ee(e.entity.id);
5228
+ t.stopPropagation(), Oe(e.entity.id);
5226
5229
  },
5227
5230
  title: "删除",
5228
5231
  children: /* @__PURE__ */ jsx("img", {
@@ -5277,67 +5280,67 @@ var raster_paint_default = "data:image/svg+xml,%3c?xml%20version='1.0'%20standal
5277
5280
  }
5278
5281
  ];
5279
5282
  function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds: c = [], className: l, style: u }) {
5280
- let [d, f] = useState(!1), [h, _] = useState({ ...DEFAULT_CONFIG }), v = useRef(null), y = useRef(null), b = r !== void 0;
5283
+ let [d, f] = useState(!1), [m, g] = useState({ ...DEFAULT_CONFIG }), _ = useRef(null), v = useRef(null), y = r !== void 0;
5281
5284
  useEffect(() => {
5282
5285
  let e = (e) => {
5283
- v.current && !v.current.contains(e.target) && y.current && !y.current.contains(e.target) && f(!1);
5286
+ _.current && !_.current.contains(e.target) && v.current && !v.current.contains(e.target) && f(!1);
5284
5287
  };
5285
5288
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
5286
5289
  }, []);
5287
- let x = useMemo(() => b ? {
5290
+ let b = useMemo(() => y ? {
5288
5291
  brightness: r.brightness ?? DEFAULT_CONFIG.brightness,
5289
5292
  saturation: r.saturation ?? DEFAULT_CONFIG.saturation,
5290
5293
  contrast: r.contrast ?? DEFAULT_CONFIG.contrast,
5291
5294
  hueRotate: r.hueRotate ?? DEFAULT_CONFIG.hueRotate
5292
- } : h, [
5293
- b,
5295
+ } : m, [
5296
+ y,
5294
5297
  r,
5295
- h
5296
- ]), S = useRef(b);
5298
+ m
5299
+ ]), x = useRef(y);
5297
5300
  useEffect(() => {
5298
- b && !S.current && _({ ...x }), S.current = b;
5299
- }, [b, x]);
5300
- let C = useCallback((t) => {
5301
+ y && !x.current && g({ ...b }), x.current = y;
5302
+ }, [y, b]);
5303
+ let S = useCallback((t) => {
5301
5304
  if (!(!e || c.length === 0)) for (let n of c) e.getLayer(n) && (e.setPaintProperty(n, "raster-brightness-min", 0), e.setPaintProperty(n, "raster-brightness-max", t.brightness), e.setPaintProperty(n, "raster-saturation", t.saturation), e.setPaintProperty(n, "raster-contrast", t.contrast), e.setPaintProperty(n, "raster-hue-rotate", t.hueRotate));
5302
- }, [e, c]), w = useCallback((e, t) => {
5303
- if (b) s?.({
5304
- ...x,
5305
+ }, [e, c]), ye = useCallback((e, t) => {
5306
+ if (y) s?.({
5307
+ ...b,
5305
5308
  [e]: t
5306
5309
  });
5307
5310
  else {
5308
5311
  let n = {
5309
- ...h,
5312
+ ...m,
5310
5313
  [e]: t
5311
5314
  };
5312
- _(n), C(n);
5315
+ g(n), S(n);
5313
5316
  }
5314
5317
  }, [
5315
- b,
5318
+ y,
5316
5319
  s,
5317
- x,
5318
- h,
5319
- C
5320
- ]), T = useCallback(() => {
5321
- b ? s?.({ ...DEFAULT_CONFIG }) : (_({ ...DEFAULT_CONFIG }), C({ ...DEFAULT_CONFIG }));
5322
- }, [
5323
5320
  b,
5321
+ m,
5322
+ S
5323
+ ]), C = useCallback(() => {
5324
+ y ? s?.({ ...DEFAULT_CONFIG }) : (g({ ...DEFAULT_CONFIG }), S({ ...DEFAULT_CONFIG }));
5325
+ }, [
5326
+ y,
5324
5327
  s,
5325
- C
5328
+ S
5326
5329
  ]);
5327
5330
  useEffect(() => {
5328
- !b && c.length > 0 && C(h);
5331
+ !y && c.length > 0 && S(m);
5329
5332
  }, [
5330
5333
  c,
5331
- b,
5332
- C,
5333
- h
5334
+ y,
5335
+ S,
5336
+ m
5334
5337
  ]);
5335
- let E = (e, t) => e === "hueRotate" ? `${Math.round(t)}°` : t.toFixed(2);
5338
+ let w = (e, t) => e === "hueRotate" ? `${Math.round(t)}°` : t.toFixed(2);
5336
5339
  return /* @__PURE__ */ jsxs("div", {
5337
5340
  className: `mapbox-raster-paint-control${l ? ` ${l}` : ""}`,
5338
5341
  style: u,
5339
5342
  children: [/* @__PURE__ */ jsxs("button", {
5340
- ref: y,
5343
+ ref: v,
5341
5344
  className: `mapbox-control-btn mapbox-raster-paint-control__btn${d ? " mapbox-raster-paint-control__btn--active" : ""}`,
5342
5345
  onClick: () => f(!d),
5343
5346
  title: "栅格渲染调节",
@@ -5347,7 +5350,7 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5347
5350
  alt: "raster paint"
5348
5351
  }), /* @__PURE__ */ jsx("span", { children: "渲染" })]
5349
5352
  }), d && /* @__PURE__ */ jsxs("div", {
5350
- ref: v,
5353
+ ref: _,
5351
5354
  className: "mapbox-raster-paint-control__panel",
5352
5355
  children: [SLIDER_CONFIG.map(({ key: e, label: t, min: n, max: r, step: i }) => /* @__PURE__ */ jsxs("div", {
5353
5356
  className: "mapbox-raster-paint-control__slider-row",
@@ -5361,18 +5364,18 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5361
5364
  min: n,
5362
5365
  max: r,
5363
5366
  step: i,
5364
- value: x[e],
5365
- onChange: (t) => w(e, t),
5367
+ value: b[e],
5368
+ onChange: (t) => ye(e, t),
5366
5369
  tooltipVisible: !1
5367
5370
  }),
5368
5371
  /* @__PURE__ */ jsx("span", {
5369
5372
  className: "mapbox-raster-paint-control__value",
5370
- children: E(e, x[e])
5373
+ children: w(e, b[e])
5371
5374
  })
5372
5375
  ]
5373
5376
  }, e)), /* @__PURE__ */ jsx("button", {
5374
5377
  className: "mapbox-raster-paint-control__reset",
5375
- onClick: T,
5378
+ onClick: C,
5376
5379
  children: "重置"
5377
5380
  })]
5378
5381
  })]
@@ -5380,43 +5383,43 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5380
5383
  }
5381
5384
  var marker_default = "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='1769397418113'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='10253'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='128'%20height='128'%3e%3cpath%20d='M755.4048%20217.2928A348.3648%20348.3648%200%200%200%20512%20119.3472a348.3136%20348.3136%200%200%200-243.3536%2097.8944%20328.4992%20328.4992%200%200%200-100.864%20236.3392c0%2049.408%2011.7248%2095.744%2032%20137.728a378.0096%20378.0096%200%200%200%2091.136%20118.4256l203.5712%20179.456%2017.5104%2015.4624%2017.5104-15.4624%20203.4176-179.3536a378.6752%20378.6752%200%200%200%2091.2384-118.4768c20.2752-41.984%2032.0512-88.32%2032.0512-137.7792a328.448%20328.448%200%200%200-100.8128-236.288z%20m24.1152%20353.3824a329.216%20329.216%200%200%201-79.872%20103.0656l-188.0064%20164.6592-187.1872-164.7616a329.0624%20329.0624%200%200%201-79.7696-103.0144%20267.0592%20267.0592%200%200%201-27.136-117.0944c0-78.7968%2032.9728-150.1184%2086.272-201.728a298.3936%20298.3936%200%200%201%20208.2816-83.5584c81.3056%200%20154.9824%2031.9488%20208.2304%2083.6096a279.9104%20279.9104%200%200%201%2086.272%20201.728%20266.496%20266.496%200%200%201-27.0848%20117.0944z%20m-164.1472-212.1728l0.0512-0.0512a146.9952%20146.9952%200%200%200-104.2432-43.2128c-40.6528%200-77.568%2016.5376-104.2432%2043.2128l0.0512%200.0512a147.3536%20147.3536%200%200%200-0.0512%20208.6912%20147.0464%20147.0464%200%200%200%20208.4864%200%20147.5072%20147.5072%200%200%200-0.0512-208.6912z%20m-34.1504%20174.2336a97.536%2097.536%200%200%201-69.2736%2028.7232%2097.6384%2097.6384%200%200%201-69.3248-28.7232%2097.792%2097.792%200%200%201-0.1536-138.4448h0.1024a97.9456%2097.9456%200%200%201%20138.5984%200h0.1536c17.664%2017.6128%2028.5696%2042.1376%2028.5696%2069.2224a97.1776%2097.1776%200%200%201-28.672%2069.2224z'%20fill='%23ffffff'%20p-id='10254'%3e%3c/path%3e%3c/svg%3e";
5382
5385
  const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect: r, drawMode: i, onDrawModeChange: s, showRectangleTool: c = !1, showCircleTool: l = !1, showPolygonTool: u = !1, showSquareTool: d = !1, showPolylineTool: f = !1 }) => {
5383
- let [h, g] = useState(!1), _ = useRef(null);
5386
+ let [m, h] = useState(!1), g = useRef(null);
5384
5387
  useEffect(() => {
5385
5388
  let e = (e) => {
5386
- _.current && !_.current.contains(e.target) && g(!1);
5389
+ g.current && !g.current.contains(e.target) && h(!1);
5387
5390
  };
5388
- if (h) return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
5389
- }, [h]);
5390
- let v = (e) => {
5391
- t?.id === e.id ? (r(null), s(null)) : (r(e), s("marker")), g(!1);
5392
- }, y = () => {
5391
+ if (m) return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
5392
+ }, [m]);
5393
+ let _ = (e) => {
5394
+ t?.id === e.id ? (r(null), s(null)) : (r(e), s("marker")), h(!1);
5395
+ }, v = () => {
5393
5396
  i === "rectangle" ? s(null) : (r(null), s("rectangle"));
5394
- }, b = () => {
5397
+ }, y = () => {
5395
5398
  i === "circle" ? s(null) : (r(null), s("circle"));
5396
- }, x = () => {
5399
+ }, b = () => {
5397
5400
  i === "polygon" ? s(null) : (r(null), s("polygon"));
5398
- }, S = () => {
5401
+ }, x = () => {
5399
5402
  i === "square" ? s(null) : (r(null), s("square"));
5400
- }, C = () => {
5403
+ }, S = () => {
5401
5404
  i === "polyline" ? s(null) : (r(null), s("polyline"));
5402
- }, w = () => {
5403
- (i === "rectangle" || i === "circle" || i === "polygon" || i === "square" || i === "polyline") && s(null), g(!h);
5404
- }, T = (e) => e.size ? {
5405
+ }, ye = () => {
5406
+ (i === "rectangle" || i === "circle" || i === "polygon" || i === "square" || i === "polyline") && s(null), h(!m);
5407
+ }, C = (e) => e.size ? {
5405
5408
  width: e.size,
5406
5409
  height: e.size
5407
5410
  } : {
5408
5411
  width: e.width || 32,
5409
5412
  height: e.height || 32
5410
- }, E = h || t, D = i === "rectangle", O = i === "circle", ve = i === "polygon", ye = i === "square", k = i === "polyline";
5413
+ }, w = m || t, T = i === "rectangle", E = i === "circle", be = i === "polygon", xe = i === "square", D = i === "polyline";
5411
5414
  return /* @__PURE__ */ jsxs("div", {
5412
- ref: _,
5415
+ ref: g,
5413
5416
  className: "mapbox-edit-control",
5414
5417
  children: [/* @__PURE__ */ jsxs("div", {
5415
5418
  className: "mapbox-edit-control__btn-group",
5416
5419
  children: [
5417
5420
  /* @__PURE__ */ jsxs("button", {
5418
- className: `mapbox-control-btn ${E ? "mapbox-control-btn--active" : ""}`,
5419
- onClick: w,
5421
+ className: `mapbox-control-btn ${w ? "mapbox-control-btn--active" : ""}`,
5422
+ onClick: ye,
5420
5423
  title: "Marker",
5421
5424
  children: [t ? /* @__PURE__ */ jsx("img", {
5422
5425
  src: t.icon,
@@ -5429,8 +5432,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5429
5432
  }), /* @__PURE__ */ jsx("span", { children: t ? t.name : "Marker" })]
5430
5433
  }),
5431
5434
  d && /* @__PURE__ */ jsxs("button", {
5432
- className: `mapbox-control-btn ${ye ? "mapbox-control-btn--active" : ""}`,
5433
- onClick: S,
5435
+ className: `mapbox-control-btn ${xe ? "mapbox-control-btn--active" : ""}`,
5436
+ onClick: x,
5434
5437
  title: "绘制正方形",
5435
5438
  children: [/* @__PURE__ */ jsx("img", {
5436
5439
  src: "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20width='128'%20height='128'%3e%3crect%20x='192'%20y='192'%20width='640'%20height='640'%20rx='32'%20ry='32'%20fill='none'%20stroke='%23ffffff'%20stroke-width='64'/%3e%3c/svg%3e",
@@ -5439,8 +5442,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5439
5442
  }), /* @__PURE__ */ jsx("span", { children: "正方形" })]
5440
5443
  }),
5441
5444
  c && /* @__PURE__ */ jsxs("button", {
5442
- className: `mapbox-control-btn ${D ? "mapbox-control-btn--active" : ""}`,
5443
- onClick: y,
5445
+ className: `mapbox-control-btn ${T ? "mapbox-control-btn--active" : ""}`,
5446
+ onClick: v,
5444
5447
  title: "绘制矩形",
5445
5448
  children: [/* @__PURE__ */ jsx("img", {
5446
5449
  src: "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20width='128'%20height='128'%3e%3crect%20x='160'%20y='240'%20width='704'%20height='544'%20rx='32'%20ry='32'%20fill='none'%20stroke='%23ffffff'%20stroke-width='64'/%3e%3c/svg%3e",
@@ -5449,8 +5452,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5449
5452
  }), /* @__PURE__ */ jsx("span", { children: "矩形" })]
5450
5453
  }),
5451
5454
  l && /* @__PURE__ */ jsxs("button", {
5452
- className: `mapbox-control-btn ${O ? "mapbox-control-btn--active" : ""}`,
5453
- onClick: b,
5455
+ className: `mapbox-control-btn ${E ? "mapbox-control-btn--active" : ""}`,
5456
+ onClick: y,
5454
5457
  title: "绘制圆形",
5455
5458
  children: [/* @__PURE__ */ jsx("img", {
5456
5459
  src: "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20width='128'%20height='128'%3e%3ccircle%20cx='512'%20cy='512'%20r='384'%20fill='none'%20stroke='%23ffffff'%20stroke-width='64'/%3e%3c/svg%3e",
@@ -5459,8 +5462,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5459
5462
  }), /* @__PURE__ */ jsx("span", { children: "圆形" })]
5460
5463
  }),
5461
5464
  u && /* @__PURE__ */ jsxs("button", {
5462
- className: `mapbox-control-btn ${ve ? "mapbox-control-btn--active" : ""}`,
5463
- onClick: x,
5465
+ className: `mapbox-control-btn ${be ? "mapbox-control-btn--active" : ""}`,
5466
+ onClick: b,
5464
5467
  title: "绘制多边形",
5465
5468
  children: [/* @__PURE__ */ jsx("img", {
5466
5469
  src: "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20width='128'%20height='128'%3e%3cpolygon%20points='512,128%20864,384%20736,800%20288,800%20160,384'%20fill='none'%20stroke='%23ffffff'%20stroke-width='64'%20stroke-linejoin='round'/%3e%3c/svg%3e",
@@ -5469,8 +5472,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5469
5472
  }), /* @__PURE__ */ jsx("span", { children: "多边形" })]
5470
5473
  }),
5471
5474
  f && /* @__PURE__ */ jsxs("button", {
5472
- className: `mapbox-control-btn ${k ? "mapbox-control-btn--active" : ""}`,
5473
- onClick: C,
5475
+ className: `mapbox-control-btn ${D ? "mapbox-control-btn--active" : ""}`,
5476
+ onClick: S,
5474
5477
  title: "绘制折线",
5475
5478
  children: [/* @__PURE__ */ jsx("img", {
5476
5479
  src: "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20width='128'%20height='128'%3e%3cpolyline%20points='160,768%20384,256%20640,576%20864,192'%20fill='none'%20stroke='%23ffffff'%20stroke-width='64'%20stroke-linejoin='round'%20stroke-linecap='round'/%3e%3c/svg%3e",
@@ -5479,7 +5482,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5479
5482
  }), /* @__PURE__ */ jsx("span", { children: "折线" })]
5480
5483
  })
5481
5484
  ]
5482
- }), h && /* @__PURE__ */ jsxs("div", {
5485
+ }), m && /* @__PURE__ */ jsxs("div", {
5483
5486
  className: "mapbox-edit-control__panel",
5484
5487
  children: [/* @__PURE__ */ jsx("div", {
5485
5488
  className: "mapbox-edit-control__panel-header",
@@ -5487,10 +5490,10 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5487
5490
  }), /* @__PURE__ */ jsx("div", {
5488
5491
  className: "mapbox-edit-control__template-list",
5489
5492
  children: e.map((e) => {
5490
- let n = T(e), r = t?.id === e.id;
5493
+ let n = C(e), r = t?.id === e.id;
5491
5494
  return /* @__PURE__ */ jsxs("div", {
5492
5495
  className: `mapbox-edit-control__template-item ${r ? "mapbox-edit-control__template-item--selected" : ""}`,
5493
- onClick: () => v(e),
5496
+ onClick: () => _(e),
5494
5497
  title: e.name,
5495
5498
  children: [/* @__PURE__ */ jsx("img", {
5496
5499
  src: e.icon,
@@ -5559,28 +5562,28 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5559
5562
  };
5560
5563
  var route_planning_default = "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='1775031767174'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='30653'%20data-spm-anchor-id='a313x.search_index.0.i6.78953a81FCkAe0'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='64'%20height='64'%3e%3cpath%20d='M322.24%20479.210667l-42.453333-42.432%20198.826666-198.826667c53.397333-53.376%20139.306667-53.568%20191.914667-0.981333%2052.608%2052.608%2052.416%20138.517333-0.981333%20191.914666L455.722667%20642.709333l-42.432-42.453333%20213.824-213.802667a74.773333%2074.773333%200%200%200-0.341334-105.728%2074.773333%2074.773333%200%200%200-105.728-0.341333l-198.826666%20198.826667z'%20fill='%23ffffff'%20p-id='30654'%3e%3c/path%3e%3cpath%20d='M699.093333%20613.333333l42.453334%2042.432-169.429334%20169.408c-48.341333%2048.341333-129.28%2042.282667-181.248-9.664-51.968-51.968-58.026667-132.906667-9.664-181.248l234.346667-234.346666%2042.432%2042.410666L423.616%20676.693333c-22.250667%2022.250667-19.050667%2065.024%2011.008%2095.061334%2030.037333%2030.058667%2072.810667%2033.258667%2095.061333%2010.986666l169.429334-169.408zM187.989333%20571.029333c-38.933333-38.933333-38.805333-102.613333%200.853334-142.293333%2039.68-39.68%20103.381333-39.808%20142.293333-0.853333%2038.954667%2038.912%2038.826667%20102.613333-0.853333%20142.293333-39.68%2039.658667-103.381333%2039.786667-142.293334%200.853333z%20m43.733334-43.733333c15.744%2015.744%2040.874667%2015.68%2056.128%200.426667%2015.253333-15.232%2015.296-40.362667-0.426667-56.106667-15.765333-15.744-40.896-15.701333-56.149333-0.448-15.232%2015.232-15.296%2040.384%200.448%2056.106667z'%20fill='%23ffffff'%20p-id='30655'%3e%3c/path%3e%3cpath%20d='M846.144%20489.728l-31.466667%20198.784-56.96-101.461333-104.042666-38.506667z'%20fill='%23ffffff'%20p-id='30656'%3e%3c/path%3e%3c/svg%3e", SOURCE_ID = "route-planning-temp-line", LINE_LAYER_ID = "route-planning-temp-line-layer", POINT_LAYER_ID = "route-planning-temp-point-layer";
5561
5564
  const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointCountInput: c = !1, visualType: l = "marker", onSelectFinished: u, showButton: d = !0 }, f) => {
5562
- let [h, g] = useState("idle"), [_, v] = useState(0), [y, b] = useState(i), [x, S] = useState(!1), C = useRef(null), w = useRef(null), T = useRef([]), E = useRef([]), D = useRef("idle"), O = useRef(null), ve = useRef("");
5565
+ let [m, h] = useState("idle"), [g, _] = useState(0), [v, y] = useState(i), [b, x] = useState(!1), S = useRef(null), ye = useRef(null), C = useRef([]), w = useRef([]), T = useRef("idle"), E = useRef(null), be = useRef("");
5563
5566
  useEffect(() => {
5564
- D.current = h;
5565
- }, [h]), useEffect(() => {
5566
- b(i);
5567
+ T.current = m;
5568
+ }, [m]), useEffect(() => {
5569
+ y(i);
5567
5570
  }, [i]), useEffect(() => {
5568
- if (!x) return;
5571
+ if (!b) return;
5569
5572
  let e = (e) => {
5570
- w.current && !w.current.contains(e.target) && C.current && !C.current.contains(e.target) && S(!1);
5573
+ ye.current && !ye.current.contains(e.target) && S.current && !S.current.contains(e.target) && x(!1);
5571
5574
  }, t = setTimeout(() => {
5572
5575
  document.addEventListener("mousedown", e);
5573
5576
  }, 0);
5574
5577
  return () => {
5575
5578
  clearTimeout(t), document.removeEventListener("mousedown", e);
5576
5579
  };
5577
- }, [x]);
5578
- let ye = useCallback(() => {
5579
- for (let e of E.current) e.remove();
5580
- E.current = [], e && (e.getLayer(LINE_LAYER_ID) && e.removeLayer(LINE_LAYER_ID), e.getLayer(POINT_LAYER_ID) && e.removeLayer(POINT_LAYER_ID), e.getSource(SOURCE_ID) && e.removeSource(SOURCE_ID));
5581
- }, [e]), k = useCallback(() => {
5580
+ }, [b]);
5581
+ let xe = useCallback(() => {
5582
+ for (let e of w.current) e.remove();
5583
+ w.current = [], e && (e.getLayer(LINE_LAYER_ID) && e.removeLayer(LINE_LAYER_ID), e.getLayer(POINT_LAYER_ID) && e.removeLayer(POINT_LAYER_ID), e.getSource(SOURCE_ID) && e.removeSource(SOURCE_ID));
5584
+ }, [e]), D = useCallback(() => {
5582
5585
  if (!e) return;
5583
- let t = T.current, n = {
5586
+ let t = C.current, n = {
5584
5587
  type: "FeatureCollection",
5585
5588
  features: [{
5586
5589
  type: "Feature",
@@ -5631,104 +5634,104 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5631
5634
  "circle-stroke-color": "#fff"
5632
5635
  }
5633
5636
  }));
5634
- }, [e]), be = useCallback((t) => {
5635
- if (!e || !O.current) return;
5636
- let { visualType: n } = O.current;
5637
+ }, [e]), Se = useCallback((t) => {
5638
+ if (!e || !E.current) return;
5639
+ let { visualType: n } = E.current;
5637
5640
  if (n === "marker") {
5638
5641
  let n = document.createElement("div");
5639
- n.className = "route-planning-temp-marker", n.textContent = String(T.current.length);
5642
+ n.className = "route-planning-temp-marker", n.textContent = String(C.current.length);
5640
5643
  let r = new mapboxgl.Marker({ element: n }).setLngLat(t).addTo(e);
5641
- E.current.push(r);
5642
- } else k();
5643
- }, [e, k]), xe = useCallback(() => {
5644
- ye(), T.current = [], O.current = null, v(0), g("idle"), e && (e.getCanvas().style.cursor = ve.current);
5645
- }, [ye, e]), Se = useCallback(async () => {
5646
- let e = O.current, t = [...T.current];
5644
+ w.current.push(r);
5645
+ } else D();
5646
+ }, [e, D]), Ce = useCallback(() => {
5647
+ xe(), C.current = [], E.current = null, _(0), h("idle"), e && (e.getCanvas().style.cursor = be.current);
5648
+ }, [xe, e]), we = useCallback(async () => {
5649
+ let e = E.current, t = [...C.current];
5647
5650
  if (!e || t.length < 2) {
5648
- xe();
5651
+ Ce();
5649
5652
  return;
5650
5653
  }
5651
- g("planning");
5654
+ h("planning");
5652
5655
  try {
5653
5656
  await e.onSelectFinished(t);
5654
5657
  } catch (e) {
5655
5658
  console.error("Route planning onSelectFinished failed:", e);
5656
5659
  } finally {
5657
- xe();
5660
+ Ce();
5658
5661
  }
5659
- }, [xe]), A = useCallback((e) => {
5660
- if (D.current !== "selecting" || !O.current) return;
5662
+ }, [Ce]), O = useCallback((e) => {
5663
+ if (T.current !== "selecting" || !E.current) return;
5661
5664
  let t = [e.lngLat.lng, e.lngLat.lat];
5662
- T.current.push(t);
5663
- let n = T.current.length;
5664
- v(n), be(t), n >= O.current.pointCount && Se();
5665
- }, [be, Se]), j = useCallback((e) => {
5666
- D.current === "selecting" && (e.preventDefault(), xe());
5667
- }, [xe]);
5665
+ C.current.push(t);
5666
+ let n = C.current.length;
5667
+ _(n), Se(t), n >= E.current.pointCount && we();
5668
+ }, [Se, we]), k = useCallback((e) => {
5669
+ T.current === "selecting" && (e.preventDefault(), Ce());
5670
+ }, [Ce]);
5668
5671
  useEffect(() => {
5669
- if (e && h === "selecting") return e.on("click", A), e.on("contextmenu", j), () => {
5670
- e.off("click", A), e.off("contextmenu", j);
5672
+ if (e && m === "selecting") return e.on("click", O), e.on("contextmenu", k), () => {
5673
+ e.off("click", O), e.off("contextmenu", k);
5671
5674
  };
5672
5675
  }, [
5673
5676
  e,
5674
- h,
5675
- A,
5676
- j
5677
+ m,
5678
+ O,
5679
+ k
5677
5680
  ]);
5678
- let M = useCallback((t) => {
5681
+ let A = useCallback((t) => {
5679
5682
  if (!e) return;
5680
- D.current !== "idle" && xe();
5683
+ T.current !== "idle" && Ce();
5681
5684
  let n = Math.max(2, t.pointCount ?? i), r = t.visualType ?? l;
5682
- O.current = {
5685
+ E.current = {
5683
5686
  pointCount: n,
5684
5687
  visualType: r,
5685
5688
  onSelectFinished: t.onSelectFinished
5686
- }, T.current = [], v(0), b(n), S(!1), ve.current = e.getCanvas().style.cursor, e.getCanvas().style.cursor = "crosshair", g("selecting");
5689
+ }, C.current = [], _(0), y(n), x(!1), be.current = e.getCanvas().style.cursor, e.getCanvas().style.cursor = "crosshair", h("selecting");
5687
5690
  }, [
5688
5691
  e,
5689
5692
  i,
5690
5693
  l,
5691
- xe
5694
+ Ce
5692
5695
  ]);
5693
- useImperativeHandle(f, () => ({ startPlanning: M }), [M]);
5694
- let N = () => {
5695
- h === "idle" ? S((e) => !e) : h === "selecting" && xe();
5696
- }, Ce = () => {
5697
- u && M({
5698
- pointCount: Math.max(2, y),
5696
+ useImperativeHandle(f, () => ({ startPlanning: A }), [A]);
5697
+ let j = () => {
5698
+ m === "idle" ? x((e) => !e) : m === "selecting" && Ce();
5699
+ }, Te = () => {
5700
+ u && A({
5701
+ pointCount: Math.max(2, v),
5699
5702
  visualType: l,
5700
5703
  onSelectFinished: u
5701
5704
  });
5702
- }, P = (e) => {
5705
+ }, M = (e) => {
5703
5706
  let t = parseInt(e.target.value, 10);
5704
- !isNaN(t) && t >= 2 ? b(t) : e.target.value === "" && b(2);
5705
- }, we = () => {
5706
- if (h === "planning") return /* @__PURE__ */ jsx("span", { children: "规划中..." });
5707
- if (h === "selecting") {
5708
- let e = O.current?.pointCount ?? y;
5707
+ !isNaN(t) && t >= 2 ? y(t) : e.target.value === "" && y(2);
5708
+ }, Ee = () => {
5709
+ if (m === "planning") return /* @__PURE__ */ jsx("span", { children: "规划中..." });
5710
+ if (m === "selecting") {
5711
+ let e = E.current?.pointCount ?? v;
5709
5712
  return /* @__PURE__ */ jsxs("span", { children: [
5710
- _,
5713
+ g,
5711
5714
  "/",
5712
5715
  e
5713
5716
  ] });
5714
5717
  }
5715
5718
  return "路径规划";
5716
- }, Te = h === "selecting", F = h === "planning";
5717
- return !d && h === "idle" ? null : /* @__PURE__ */ jsxs("div", {
5719
+ }, De = m === "selecting", N = m === "planning";
5720
+ return !d && m === "idle" ? null : /* @__PURE__ */ jsxs("div", {
5718
5721
  className: `mapbox-route-planning-control${d ? "" : " mapbox-route-planning-control--floating"}`,
5719
5722
  children: [/* @__PURE__ */ jsxs("button", {
5720
- ref: C,
5721
- className: `mapbox-control-btn mapbox-route-planning-control__btn${Te ? " mapbox-route-planning-control__btn--active" : ""}${F ? " mapbox-route-planning-control__btn--planning" : ""}${x ? " mapbox-route-planning-control__btn--active" : ""}`,
5722
- onClick: N,
5723
- disabled: F,
5724
- title: h === "idle" ? "路径规划" : h === "selecting" ? "取消选点" : "规划中...",
5723
+ ref: S,
5724
+ className: `mapbox-control-btn mapbox-route-planning-control__btn${De ? " mapbox-route-planning-control__btn--active" : ""}${N ? " mapbox-route-planning-control__btn--planning" : ""}${b ? " mapbox-route-planning-control__btn--active" : ""}`,
5725
+ onClick: j,
5726
+ disabled: N,
5727
+ title: m === "idle" ? "路径规划" : m === "selecting" ? "取消选点" : "规划中...",
5725
5728
  children: [/* @__PURE__ */ jsx("img", {
5726
5729
  src: route_planning_default,
5727
5730
  alt: "route",
5728
5731
  className: "mapbox-route-planning-control__btn-icon"
5729
- }), we()]
5730
- }), x && h === "idle" && /* @__PURE__ */ jsxs("div", {
5731
- ref: w,
5732
+ }), Ee()]
5733
+ }), b && m === "idle" && /* @__PURE__ */ jsxs("div", {
5734
+ ref: ye,
5732
5735
  className: "mapbox-route-planning-control__panel",
5733
5736
  children: [/* @__PURE__ */ jsx("div", {
5734
5737
  className: "mapbox-route-planning-control__panel-header",
@@ -5747,12 +5750,12 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5747
5750
  }), c ? /* @__PURE__ */ jsx("input", {
5748
5751
  type: "number",
5749
5752
  className: "mapbox-route-planning-control__panel-input",
5750
- value: y,
5753
+ value: v,
5751
5754
  min: 2,
5752
- onChange: P
5755
+ onChange: M
5753
5756
  }) : /* @__PURE__ */ jsx("span", {
5754
5757
  className: "mapbox-route-planning-control__panel-value",
5755
- children: y
5758
+ children: v
5756
5759
  })]
5757
5760
  }),
5758
5761
  /* @__PURE__ */ jsx("div", {
@@ -5761,7 +5764,7 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5761
5764
  }),
5762
5765
  /* @__PURE__ */ jsx("button", {
5763
5766
  className: "mapbox-route-planning-control__panel-start",
5764
- onClick: Ce,
5767
+ onClick: Te,
5765
5768
  disabled: !u,
5766
5769
  children: "开始规划"
5767
5770
  })
@@ -5918,53 +5921,53 @@ function adjustPopupForBounds(e, t) {
5918
5921
  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;
5919
5922
  }
5920
5923
  const Mapbox = forwardRef((e, c) => {
5921
- 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: Ce = !0, showScale: P = !0, showResetView: we = !0, showRoadHighlight: Te = !1, showMeasure: Ee = !1, showRasterPaint: Ae = !1, showRoutePlanning: je, onRasterPaintChange: Me, popupDefaults: I, renderPopup: Pe, onMapLoad: Fe, onEntityClick: Ie, onPopupOpen: Le, onPopupClose: Re, className: ze = "", containerStyle: Be } = e, Ve = useRef(null), He = useRef(null), L = useRef(null), R = useRef(/* @__PURE__ */ new Map()), z = useRef(/* @__PURE__ */ new Map()), Ue = useRef(/* @__PURE__ */ new Set()), [B, We] = useState(null), Ge = useRef(null), Ke = useRef(null), qe = useRef(null), [Je, Ye] = useState(null), Xe = useRef(null), Ze = useRef(null), [V, Qe] = useState(null), [$e, et] = useState(_), [tt, nt] = useState(null), rt = useRef(null), [it, H] = useState(null), [at, U] = useState(null), [ot, st] = useState(null), W = useRef(!1), G = useRef(null), ct = useRef(null), K = useRef(null), lt = useRef(null), q = useRef(null), ut = useRef([]), J = useRef(null), dt = useRef(null), ft = useRef(null), pt = useRef([]), mt = useRef(null), ht = useRef(!1), [gt, _t] = useState([]), vt = useRef([]);
5922
- vt.current = gt;
5923
- let Y = useRef(null);
5924
+ let { center: l = [116.4074, 39.9042], zoom: u = 12, pitch: d = 0, bearing: f = 0, style: m = "mapbox://styles/mapbox/dark-v11", maxBounds: h, mode: g = "display", editConfig: _ = {}, pickerConfig: v = {}, onPick: y, interactive: b = {}, layers: x = [], rasterPaint: C, entities: w = [], selectedIds: T = [], entityConfig: E, nameConfig: D, selectNameConfig: O, areaConfig: k, circleConfig: A, lengthConfig: j, showCoordinates: Te = !0, showScale: M = !0, showResetView: Ee = !0, showRoadHighlight: De = !1, showMeasure: Oe = !1, showRasterPaint: Me = !1, showRoutePlanning: Ne, onRasterPaintChange: Pe, popupDefaults: P, renderPopup: Ie, onMapLoad: Le, onEntityClick: Re, onPopupOpen: ze, onPopupClose: Be, className: Ve = "", containerStyle: He } = e, Ue = useRef(null), We = useRef(null), F = useRef(null), I = useRef(/* @__PURE__ */ new Map()), L = useRef(/* @__PURE__ */ new Map()), Ge = useRef(/* @__PURE__ */ new Set()), [R, Ke] = useState(null), qe = useRef(null), Je = useRef(null), Ye = useRef(null), [Xe, Ze] = useState(null), Qe = useRef(null), $e = useRef(null), [z, et] = useState(null), [tt, nt] = useState(g), [rt, it] = useState(null), at = useRef(null), [ot, B] = useState(null), [st, V] = useState(null), [ct, lt] = useState(null), H = useRef(!1), U = useRef(null), ut = useRef(null), W = useRef(null), dt = useRef(null), G = useRef(null), ft = useRef([]), K = useRef(null), pt = useRef(null), q = useRef(null), mt = useRef([]), ht = useRef(null), gt = useRef(!1), [_t, vt] = useState([]), yt = useRef([]);
5925
+ yt.current = _t;
5926
+ let J = useRef(null);
5924
5927
  useEffect(() => {
5925
- et(_);
5926
- }, [_]);
5927
- let yt = useCallback((e) => {
5928
- let t = R.current.get(e), n = z.current.get(e);
5928
+ nt(g);
5929
+ }, [g]);
5930
+ let bt = useCallback((e) => {
5931
+ let t = I.current.get(e), n = L.current.get(e);
5929
5932
  if (t && n) {
5930
5933
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
5931
5934
  let r = {
5932
5935
  ...n,
5933
5936
  isAnimating: !0
5934
5937
  };
5935
- z.current.set(e, r), t.startAnimation();
5938
+ L.current.set(e, r), t.startAnimation();
5936
5939
  } else if (n.type === "circle" && t instanceof CanvasCircleRenderer) {
5937
5940
  let r = {
5938
5941
  ...n,
5939
5942
  isAnimating: !0
5940
5943
  };
5941
- z.current.set(e, r), t.startAnimation();
5944
+ L.current.set(e, r), t.startAnimation();
5942
5945
  }
5943
5946
  }
5944
- }, []), bt = useCallback((e) => {
5945
- let t = R.current.get(e), n = z.current.get(e);
5947
+ }, []), xt = useCallback((e) => {
5948
+ let t = I.current.get(e), n = L.current.get(e);
5946
5949
  if (t && n) {
5947
5950
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
5948
5951
  let r = {
5949
5952
  ...n,
5950
5953
  isAnimating: !1
5951
5954
  };
5952
- z.current.set(e, r), t.stopAnimation();
5955
+ L.current.set(e, r), t.stopAnimation();
5953
5956
  } else if (n.type === "circle" && t instanceof CanvasCircleRenderer) {
5954
5957
  let r = {
5955
5958
  ...n,
5956
5959
  isAnimating: !1
5957
5960
  };
5958
- z.current.set(e, r), t.stopAnimation();
5961
+ L.current.set(e, r), t.stopAnimation();
5959
5962
  }
5960
5963
  }
5961
- }, []), xt = useCallback((e) => {
5962
- let t = z.current.get(e);
5963
- t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? bt(e) : yt(e));
5964
- }, [yt, bt]), St = useCallback((e) => {
5964
+ }, []), St = useCallback((e) => {
5965
+ let t = L.current.get(e);
5966
+ t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? xt(e) : bt(e));
5967
+ }, [bt, xt]), Ct = useCallback((e) => {
5965
5968
  if (e === void 0) {
5966
5969
  let e = !1;
5967
- for (let [, t] of R.current) if (t instanceof UnitRenderer) {
5970
+ for (let [, t] of I.current) if (t instanceof UnitRenderer) {
5968
5971
  let n = t.getShowTrajectory();
5969
5972
  if (n === "all" || typeof n == "number" && n > 0) {
5970
5973
  e = !0;
@@ -5972,46 +5975,46 @@ const Mapbox = forwardRef((e, c) => {
5972
5975
  }
5973
5976
  }
5974
5977
  let t = e ? 0 : "all";
5975
- for (let [, e] of R.current) e instanceof UnitRenderer && e.setShowTrajectory(t);
5978
+ for (let [, e] of I.current) e instanceof UnitRenderer && e.setShowTrajectory(t);
5976
5979
  } else {
5977
5980
  let t = new Set(e.map(String));
5978
- for (let [e, n] of R.current) n instanceof UnitRenderer && n.setShowTrajectory(t.has(String(e)) ? "all" : 0);
5981
+ for (let [e, n] of I.current) n instanceof UnitRenderer && n.setShowTrajectory(t.has(String(e)) ? "all" : 0);
5979
5982
  }
5980
- }, []), Ct = useCallback((e, t, n) => {
5981
- let r = E.find((t) => String(t.id) === String(e));
5982
- if (!r?.popup || !L.current) return;
5983
- let i = r.popup.content ?? Pe?.(r);
5983
+ }, []), wt = useCallback((e, t, n) => {
5984
+ let r = w.find((t) => String(t.id) === String(e));
5985
+ if (!r?.popup || !F.current) return;
5986
+ let i = r.popup.content ?? Ie?.(r);
5984
5987
  if (!i) return;
5985
- let a = mergePopupConfig(r.popup, I, i), { position: o, actualPosition: s } = calculatePopupPosition(r, a, L.current, n);
5986
- We({
5988
+ let a = mergePopupConfig(r.popup, P, i), { position: o, actualPosition: s } = calculatePopupPosition(r, a, F.current, n);
5989
+ Ke({
5987
5990
  entityId: e,
5988
5991
  position: o,
5989
5992
  config: a,
5990
5993
  openedBy: t,
5991
5994
  actualPosition: s
5992
- }), Le?.(e);
5995
+ }), ze?.(e);
5993
5996
  }, [
5994
- E,
5995
- I,
5996
- Pe,
5997
- Le
5998
- ]), wt = useCallback((e) => {
5999
- B?.entityId === e && (We(null), Re?.(e));
6000
- }, [B, Re]), Tt = useCallback(() => {
6001
- We((e) => (e && Re?.(e.entityId), null));
6002
- }, [Re]), Et = useCallback((e) => B?.entityId === e, [B]), Dt = useCallback((e, t, n) => {
6003
- let r = L.current;
5997
+ w,
5998
+ P,
5999
+ Ie,
6000
+ ze
6001
+ ]), Tt = useCallback((e) => {
6002
+ R?.entityId === e && (Ke(null), Be?.(e));
6003
+ }, [R, Be]), Et = useCallback(() => {
6004
+ Ke((e) => (e && Be?.(e.entityId), null));
6005
+ }, [Be]), Dt = useCallback((e) => R?.entityId === e, [R]), Ot = useCallback((e, t, n) => {
6006
+ let r = F.current;
6004
6007
  r && r.flyTo({
6005
6008
  center: e,
6006
6009
  zoom: t ?? r.getZoom(),
6007
6010
  ...n
6008
6011
  });
6009
- }, []), Ot = useCallback((e, t, n) => {
6010
- let r = L.current;
6012
+ }, []), kt = useCallback((e, t, n) => {
6013
+ let r = F.current;
6011
6014
  if (!r || e.length === 0) return;
6012
6015
  let i = [];
6013
6016
  for (let t of e) {
6014
- let e = R.current.get(t);
6017
+ let e = I.current.get(t);
6015
6018
  e && i.push(e.getBounds());
6016
6019
  }
6017
6020
  if (i.length === 0) return;
@@ -6033,19 +6036,19 @@ const Mapbox = forwardRef((e, c) => {
6033
6036
  pitch: n?.pitch ?? r.getPitch()
6034
6037
  };
6035
6038
  t !== void 0 && (p.maxZoom = t), n?.essential !== void 0 && (p.essential = n.essential), r.fitBounds(f, p);
6036
- }, []), kt = useCallback((e) => {
6037
- let t = L.current;
6039
+ }, []), At = useCallback((e) => {
6040
+ let t = F.current;
6038
6041
  if (!t || !t.getContainer()) return;
6039
- let { showMarker: n = !0, markerColor: r = "#3388ff", name: i, nameConfig: a } = y;
6042
+ let { showMarker: n = !0, markerColor: r = "#3388ff", name: i, nameConfig: a } = v;
6040
6043
  if (!n) {
6041
- rt.current &&= (rt.current.remove(), null);
6044
+ at.current &&= (at.current.remove(), null);
6042
6045
  return;
6043
6046
  }
6044
- if (rt.current) {
6045
- rt.current.setLngLat(e);
6046
- let t = rt.current.getElement(), n = t.querySelector(".marker-label");
6047
+ if (at.current) {
6048
+ at.current.setLngLat(e);
6049
+ let t = at.current.getElement(), n = t.querySelector(".marker-label");
6047
6050
  if (i) {
6048
- let e = resolveNameConfig(a, k);
6051
+ let e = resolveNameConfig(a, D);
6049
6052
  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`;
6050
6053
  else {
6051
6054
  let n = document.createElement("div");
@@ -6057,41 +6060,41 @@ const Mapbox = forwardRef((e, c) => {
6057
6060
  n.className = "mapbox-picker-marker";
6058
6061
  let o = document.createElement("div");
6059
6062
  if (o.className = "marker-inner", o.style.background = r, n.appendChild(o), i) {
6060
- let e = resolveNameConfig(a, k), t = document.createElement("div");
6063
+ let e = resolveNameConfig(a, D), t = document.createElement("div");
6061
6064
  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);
6062
6065
  }
6063
- rt.current = new mapboxgl.Marker({
6066
+ at.current = new mapboxgl.Marker({
6064
6067
  element: n,
6065
6068
  anchor: "bottom"
6066
6069
  }).setLngLat(e).addTo(t);
6067
6070
  }
6068
- }, [y, k]), At = useCallback(() => {
6069
- rt.current &&= (rt.current.remove(), null);
6070
- }, []), jt = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), Mt = useCallback((e) => {
6071
- let t = L.current;
6072
- if (Ve.current) if (mt.current &&= (mt.current.remove(), null), e && t) {
6071
+ }, [v, D]), jt = useCallback(() => {
6072
+ at.current &&= (at.current.remove(), null);
6073
+ }, []), Mt = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), Nt = useCallback((e) => {
6074
+ let t = F.current;
6075
+ if (Ue.current) if (ht.current &&= (ht.current.remove(), null), e && t) {
6073
6076
  t.getCanvas().style.cursor = "none";
6074
6077
  let n = document.createElement("div");
6075
6078
  n.className = "mapbox-custom-cursor";
6076
6079
  let r = e.size || e.width || 32;
6077
6080
  n.style.cssText = "\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n transform: translate(-50%, -50%);\n opacity: 0.8;\n ";
6078
6081
  let i = document.createElement("img");
6079
- 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), mt.current = n;
6082
+ 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), ht.current = n;
6080
6083
  let a = (e) => {
6081
- mt.current && (mt.current.style.left = `${e.clientX}px`, mt.current.style.top = `${e.clientY}px`);
6084
+ ht.current && (ht.current.style.left = `${e.clientX}px`, ht.current.style.top = `${e.clientY}px`);
6082
6085
  };
6083
6086
  document.addEventListener("mousemove", a), n.dataset.cleanup = "true", n._cleanup = () => {
6084
6087
  document.removeEventListener("mousemove", a);
6085
6088
  };
6086
6089
  } else t && (t.getCanvas().style.cursor = "");
6087
- }, []), X = useCallback(() => {
6088
- if (mt.current) {
6089
- let e = mt.current._cleanup;
6090
- e && e(), mt.current.remove(), mt.current = null;
6090
+ }, []), Y = useCallback(() => {
6091
+ if (ht.current) {
6092
+ let e = ht.current._cleanup;
6093
+ e && e(), ht.current.remove(), ht.current = null;
6091
6094
  }
6092
- let e = L.current;
6095
+ let e = F.current;
6093
6096
  e && (e.getCanvas().style.cursor = "");
6094
- }, []), Nt = useCallback((e, t, n) => {
6097
+ }, []), Pt = useCallback((e, t, n) => {
6095
6098
  if (!e.getSource(t)) {
6096
6099
  if (!e.getStyle().glyphs) {
6097
6100
  let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
@@ -6127,8 +6130,8 @@ const Mapbox = forwardRef((e, c) => {
6127
6130
  }
6128
6131
  });
6129
6132
  }
6130
- }, []), Pt = useCallback(() => {
6131
- let e = L.current;
6133
+ }, []), Ft = useCallback(() => {
6134
+ let e = F.current;
6132
6135
  e && (e.getSource("rect-preview-source") || (e.addSource("rect-preview-source", {
6133
6136
  type: "geojson",
6134
6137
  data: {
@@ -6152,9 +6155,9 @@ const Mapbox = forwardRef((e, c) => {
6152
6155
  "line-width": 2,
6153
6156
  "line-dasharray": [4, 4]
6154
6157
  }
6155
- }), Nt(e, "rect-preview-measure-source", "rect-preview-measure-label")));
6156
- }, [Nt]), Ft = useCallback((e, t) => {
6157
- let n = L.current;
6158
+ }), Pt(e, "rect-preview-measure-source", "rect-preview-measure-label")));
6159
+ }, [Pt]), It = useCallback((e, t) => {
6160
+ let n = F.current;
6158
6161
  if (!n) return;
6159
6162
  let r = n.getSource("rect-preview-source");
6160
6163
  if (!r) return;
@@ -6173,11 +6176,11 @@ const Mapbox = forwardRef((e, c) => {
6173
6176
  },
6174
6177
  properties: {}
6175
6178
  });
6176
- let l = G.current, u = l?.strokeColor ?? "#3388ff", d = l?.strokeWidth ?? 2, f = l?.fillColor ?? "#3388ff", p = l?.fillOpacity ?? .1;
6179
+ let l = U.current, u = l?.strokeColor ?? "#3388ff", d = l?.strokeWidth ?? 2, f = l?.fillColor ?? "#3388ff", p = l?.fillOpacity ?? .1;
6177
6180
  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));
6178
- let m = n.getSource("rect-preview-measure-source");
6179
- if (m) {
6180
- let e = Nn.current, t = [], n = c[0], r = c[1], i = c[2];
6181
+ let ve = n.getSource("rect-preview-measure-source");
6182
+ if (ve) {
6183
+ let e = Pn.current, t = [], n = c[0], r = c[1], i = c[2];
6181
6184
  if (e?.showArea) {
6182
6185
  let e = [(n[0] + i[0]) / 2, (n[1] + i[1]) / 2], a = distance(n, r), o = distance(r, i);
6183
6186
  t.push({
@@ -6209,13 +6212,13 @@ const Mapbox = forwardRef((e, c) => {
6209
6212
  properties: { label: formatLength(distance(r, i)) }
6210
6213
  });
6211
6214
  }
6212
- m.setData({
6215
+ ve.setData({
6213
6216
  type: "FeatureCollection",
6214
6217
  features: t
6215
6218
  });
6216
6219
  }
6217
- }, []), It = useCallback(() => {
6218
- let e = L.current;
6220
+ }, []), Lt = useCallback(() => {
6221
+ let e = F.current;
6219
6222
  if (!e) return;
6220
6223
  let t = e.getSource("rect-preview-source");
6221
6224
  t && t.setData({
@@ -6227,10 +6230,10 @@ const Mapbox = forwardRef((e, c) => {
6227
6230
  type: "FeatureCollection",
6228
6231
  features: []
6229
6232
  });
6230
- }, []), Z = useCallback(() => {
6231
- st(null), It();
6232
- }, [It]), Lt = useCallback(() => {
6233
- let e = L.current;
6233
+ }, []), X = useCallback(() => {
6234
+ lt(null), Lt();
6235
+ }, [Lt]), Rt = useCallback(() => {
6236
+ let e = F.current;
6234
6237
  e && (e.getSource("circle-preview-source") || (e.addSource("circle-preview-source", {
6235
6238
  type: "geojson",
6236
6239
  data: {
@@ -6254,7 +6257,7 @@ const Mapbox = forwardRef((e, c) => {
6254
6257
  "line-width": 2,
6255
6258
  "line-dasharray": [4, 4]
6256
6259
  }
6257
- }), Nt(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
6260
+ }), Pt(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
6258
6261
  type: "geojson",
6259
6262
  data: {
6260
6263
  type: "FeatureCollection",
@@ -6271,22 +6274,22 @@ const Mapbox = forwardRef((e, c) => {
6271
6274
  "line-dasharray": [4, 4]
6272
6275
  }
6273
6276
  }))));
6274
- }, [Nt]), Rt = useCallback((e, t, n = 64) => {
6277
+ }, [Pt]), zt = useCallback((e, t, n = 64) => {
6275
6278
  let [r, i] = e, a = [], o = t / 6371e3, s = i * Math.PI / 180;
6276
6279
  for (let e = 0; e <= n; e++) {
6277
6280
  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;
6278
6281
  a.push([d, u]);
6279
6282
  }
6280
6283
  return a;
6281
- }, []), zt = useCallback((e, t) => {
6284
+ }, []), Bt = useCallback((e, t) => {
6282
6285
  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);
6283
6286
  return 6371e3 * (2 * Math.atan2(Math.sqrt(c), Math.sqrt(1 - c)));
6284
- }, []), Bt = useCallback((e, t) => {
6285
- let n = L.current;
6287
+ }, []), Vt = useCallback((e, t) => {
6288
+ let n = F.current;
6286
6289
  if (!n) return;
6287
6290
  let r = n.getSource("circle-preview-source");
6288
6291
  if (!r) return;
6289
- let i = zt(e, t), a = Rt(e, i);
6292
+ let i = Bt(e, t), a = zt(e, i);
6290
6293
  r.setData({
6291
6294
  type: "Feature",
6292
6295
  geometry: {
@@ -6295,9 +6298,9 @@ const Mapbox = forwardRef((e, c) => {
6295
6298
  },
6296
6299
  properties: {}
6297
6300
  });
6298
- let o = K.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6301
+ let o = W.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6299
6302
  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));
6300
- let d = Nn.current, f = [], p = [];
6303
+ let d = Pn.current, f = [], p = [];
6301
6304
  if (d?.showArea) {
6302
6305
  let t = Math.PI * i * i;
6303
6306
  f.push({
@@ -6310,7 +6313,7 @@ const Mapbox = forwardRef((e, c) => {
6310
6313
  });
6311
6314
  }
6312
6315
  if (d?.showRadius) {
6313
- let t = K.current?.radiusAngle ?? 90, n = destinationPoint(e, i, t), r = [(e[0] + n[0]) / 2, (e[1] + n[1]) / 2];
6316
+ let t = W.current?.radiusAngle ?? 90, n = destinationPoint(e, i, t), r = [(e[0] + n[0]) / 2, (e[1] + n[1]) / 2];
6314
6317
  p.push({
6315
6318
  type: "Feature",
6316
6319
  geometry: {
@@ -6327,18 +6330,18 @@ const Mapbox = forwardRef((e, c) => {
6327
6330
  properties: { label: formatLength(i) }
6328
6331
  });
6329
6332
  }
6330
- let m = n.getSource("circle-preview-measure-source");
6331
- m && m.setData({
6333
+ let ve = n.getSource("circle-preview-measure-source");
6334
+ ve && ve.setData({
6332
6335
  type: "FeatureCollection",
6333
6336
  features: f
6334
6337
  });
6335
- let h = n.getSource("circle-preview-radius-source");
6336
- h && h.setData({
6338
+ let m = n.getSource("circle-preview-radius-source");
6339
+ m && m.setData({
6337
6340
  type: "FeatureCollection",
6338
6341
  features: p
6339
6342
  });
6340
- }, [zt, Rt]), Vt = useCallback(() => {
6341
- let e = L.current;
6343
+ }, [Bt, zt]), Ht = useCallback(() => {
6344
+ let e = F.current;
6342
6345
  if (!e) return;
6343
6346
  let t = e.getSource("circle-preview-source");
6344
6347
  t && t.setData({
@@ -6355,10 +6358,10 @@ const Mapbox = forwardRef((e, c) => {
6355
6358
  type: "FeatureCollection",
6356
6359
  features: []
6357
6360
  });
6358
- }, []), Ht = useCallback(() => {
6359
- lt.current = null, Vt();
6360
- }, [Vt]), Ut = useCallback(() => {
6361
- let e = L.current;
6361
+ }, []), Ut = useCallback(() => {
6362
+ dt.current = null, Ht();
6363
+ }, [Ht]), Wt = useCallback(() => {
6364
+ let e = F.current;
6362
6365
  e && (e.getSource("polygon-preview-source") || (e.addSource("polygon-preview-source", {
6363
6366
  type: "geojson",
6364
6367
  data: {
@@ -6398,9 +6401,9 @@ const Mapbox = forwardRef((e, c) => {
6398
6401
  "circle-stroke-color": "#ffffff",
6399
6402
  "circle-stroke-width": 2
6400
6403
  }
6401
- }), Nt(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
6402
- }, [Nt]), Wt = useCallback((e, t) => {
6403
- let n = L.current;
6404
+ }), Pt(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
6405
+ }, [Pt]), Gt = useCallback((e, t) => {
6406
+ let n = F.current;
6404
6407
  if (!n) return;
6405
6408
  let r = n.getSource("polygon-preview-source"), i = n.getSource("polygon-vertices-source");
6406
6409
  if (!r || !i) return;
@@ -6437,11 +6440,11 @@ const Mapbox = forwardRef((e, c) => {
6437
6440
  properties: {}
6438
6441
  }))
6439
6442
  });
6440
- let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6443
+ let o = G.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6441
6444
  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);
6442
6445
  let d = n.getSource("polygon-preview-measure-source");
6443
6446
  if (d) {
6444
- let e = Nn.current, t = [];
6447
+ let e = Pn.current, t = [];
6445
6448
  if (e?.showArea && a.length >= 3) {
6446
6449
  let e = [...a, a[0]], n = polygonArea(e), r = 0, i = 0;
6447
6450
  for (let e of a) r += e[0], i += e[1];
@@ -6483,8 +6486,8 @@ const Mapbox = forwardRef((e, c) => {
6483
6486
  features: t
6484
6487
  });
6485
6488
  }
6486
- }, []), Gt = useCallback(() => {
6487
- let e = L.current;
6489
+ }, []), Kt = useCallback(() => {
6490
+ let e = F.current;
6488
6491
  if (!e) return;
6489
6492
  let t = e.getSource("polygon-preview-source");
6490
6493
  t && t.setData({
@@ -6501,10 +6504,10 @@ const Mapbox = forwardRef((e, c) => {
6501
6504
  type: "FeatureCollection",
6502
6505
  features: []
6503
6506
  });
6504
- }, []), Kt = useCallback(() => {
6505
- ut.current = [], Gt();
6506
- }, [Gt]), qt = useCallback(() => {
6507
- let e = L.current;
6507
+ }, []), qt = useCallback(() => {
6508
+ ft.current = [], Kt();
6509
+ }, [Kt]), Jt = useCallback(() => {
6510
+ let e = F.current;
6508
6511
  e && (e.getSource("square-preview-source") || (e.addSource("square-preview-source", {
6509
6512
  type: "geojson",
6510
6513
  data: {
@@ -6528,8 +6531,8 @@ const Mapbox = forwardRef((e, c) => {
6528
6531
  "line-width": 2,
6529
6532
  "line-dasharray": [4, 4]
6530
6533
  }
6531
- }), Nt(e, "square-preview-measure-source", "square-preview-measure-label")));
6532
- }, [Nt]), Jt = useCallback((e, t) => {
6534
+ }), Pt(e, "square-preview-measure-source", "square-preview-measure-label")));
6535
+ }, [Pt]), Yt = useCallback((e, t) => {
6533
6536
  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);
6534
6537
  return [
6535
6538
  [n - s, r + o],
@@ -6538,12 +6541,12 @@ const Mapbox = forwardRef((e, c) => {
6538
6541
  [n - s, r - o],
6539
6542
  [n - s, r + o]
6540
6543
  ];
6541
- }, []), Yt = useCallback((e, t) => {
6542
- let n = L.current;
6544
+ }, []), Xt = useCallback((e, t) => {
6545
+ let n = F.current;
6543
6546
  if (!n) return;
6544
6547
  let r = n.getSource("square-preview-source");
6545
6548
  if (!r) return;
6546
- let i = zt(e, t) * 2, a = Jt(e, i);
6549
+ let i = Bt(e, t) * 2, a = Yt(e, i);
6547
6550
  r.setData({
6548
6551
  type: "Feature",
6549
6552
  geometry: {
@@ -6552,11 +6555,11 @@ const Mapbox = forwardRef((e, c) => {
6552
6555
  },
6553
6556
  properties: {}
6554
6557
  });
6555
- let o = J.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6558
+ let o = K.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6556
6559
  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));
6557
6560
  let d = n.getSource("square-preview-measure-source");
6558
6561
  if (d) {
6559
- let t = Nn.current, n = [];
6562
+ let t = Pn.current, n = [];
6560
6563
  if (t?.showArea && n.push({
6561
6564
  type: "Feature",
6562
6565
  geometry: {
@@ -6580,8 +6583,8 @@ const Mapbox = forwardRef((e, c) => {
6580
6583
  features: n
6581
6584
  });
6582
6585
  }
6583
- }, [zt, Jt]), Xt = useCallback(() => {
6584
- let e = L.current;
6586
+ }, [Bt, Yt]), Zt = useCallback(() => {
6587
+ let e = F.current;
6585
6588
  if (!e) return;
6586
6589
  let t = e.getSource("square-preview-source");
6587
6590
  t && t.setData({
@@ -6593,10 +6596,10 @@ const Mapbox = forwardRef((e, c) => {
6593
6596
  type: "FeatureCollection",
6594
6597
  features: []
6595
6598
  });
6596
- }, []), Zt = useCallback(() => {
6597
- dt.current = null, Xt();
6598
- }, [Xt]), Qt = useCallback(() => {
6599
- let e = L.current;
6599
+ }, []), Qt = useCallback(() => {
6600
+ pt.current = null, Zt();
6601
+ }, [Zt]), $t = useCallback(() => {
6602
+ let e = F.current;
6600
6603
  e && (e.getSource("polyline-preview-source") || (e.addSource("polyline-preview-source", {
6601
6604
  type: "geojson",
6602
6605
  data: {
@@ -6628,9 +6631,9 @@ const Mapbox = forwardRef((e, c) => {
6628
6631
  "circle-stroke-color": "#ffffff",
6629
6632
  "circle-stroke-width": 2
6630
6633
  }
6631
- }), Nt(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
6632
- }, [Nt]), $t = useCallback((e, t) => {
6633
- let n = L.current;
6634
+ }), Pt(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
6635
+ }, [Pt]), en = useCallback((e, t) => {
6636
+ let n = F.current;
6634
6637
  if (!n) return;
6635
6638
  let r = n.getSource("polyline-preview-source"), i = n.getSource("polyline-vertices-source");
6636
6639
  if (!r || !i) return;
@@ -6656,11 +6659,11 @@ const Mapbox = forwardRef((e, c) => {
6656
6659
  properties: {}
6657
6660
  }))
6658
6661
  });
6659
- let o = ft.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
6662
+ let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
6660
6663
  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);
6661
6664
  let l = n.getSource("polyline-preview-measure-source");
6662
6665
  if (l) {
6663
- let e = Nn.current, t = [];
6666
+ let e = Pn.current, t = [];
6664
6667
  if (e?.showLength && a.length >= 2) for (let e = 0; e < a.length - 1; e++) {
6665
6668
  let n = a[e], r = a[e + 1], i = [(n[0] + r[0]) / 2, (n[1] + r[1]) / 2];
6666
6669
  t.push({
@@ -6677,8 +6680,8 @@ const Mapbox = forwardRef((e, c) => {
6677
6680
  features: t
6678
6681
  });
6679
6682
  }
6680
- }, []), en = useCallback(() => {
6681
- let e = L.current;
6683
+ }, []), tn = useCallback(() => {
6684
+ let e = F.current;
6682
6685
  if (!e) return;
6683
6686
  let t = e.getSource("polyline-preview-source");
6684
6687
  t && t.setData({
@@ -6695,159 +6698,159 @@ const Mapbox = forwardRef((e, c) => {
6695
6698
  type: "FeatureCollection",
6696
6699
  features: []
6697
6700
  });
6698
- }, []), Q = useCallback(() => {
6699
- pt.current = [], en();
6700
- }, [en]), tn = useCallback((e) => {
6701
- H(e), Mt(e), e ? (U("marker"), Z(), Ht(), Kt(), Zt(), Q()) : U(null);
6701
+ }, []), Z = useCallback(() => {
6702
+ mt.current = [], tn();
6703
+ }, [tn]), nn = useCallback((e) => {
6704
+ B(e), Nt(e), e ? (V("marker"), X(), Ut(), qt(), Qt(), Z()) : V(null);
6702
6705
  }, [
6703
- Mt,
6704
- Z,
6705
- Ht,
6706
- Kt,
6707
- Zt,
6708
- Q
6709
- ]), nn = useCallback((e) => {
6710
- if (U(e), e === "rectangle") {
6711
- H(null), X(), Ht(), Kt(), Zt(), Q();
6712
- let e = L.current;
6706
+ Nt,
6707
+ X,
6708
+ Ut,
6709
+ qt,
6710
+ Qt,
6711
+ Z
6712
+ ]), rn = useCallback((e) => {
6713
+ if (V(e), e === "rectangle") {
6714
+ B(null), Y(), Ut(), qt(), Qt(), Z();
6715
+ let e = F.current;
6713
6716
  e && (e.getCanvas().style.cursor = "crosshair");
6714
6717
  } else if (e === "circle") {
6715
- H(null), X(), Z(), Kt(), Zt(), Q();
6716
- let e = L.current;
6718
+ B(null), Y(), X(), qt(), Qt(), Z();
6719
+ let e = F.current;
6717
6720
  e && (e.getCanvas().style.cursor = "crosshair");
6718
6721
  } else if (e === "polygon") {
6719
- H(null), X(), Z(), Ht(), Zt(), Q();
6720
- let e = L.current;
6722
+ B(null), Y(), X(), Ut(), Qt(), Z();
6723
+ let e = F.current;
6721
6724
  e && (e.getCanvas().style.cursor = "crosshair");
6722
6725
  } else if (e === "square") {
6723
- H(null), X(), Z(), Ht(), Kt(), Q();
6724
- let e = L.current;
6726
+ B(null), Y(), X(), Ut(), qt(), Z();
6727
+ let e = F.current;
6725
6728
  e && (e.getCanvas().style.cursor = "crosshair");
6726
6729
  } else if (e === "polyline") {
6727
- H(null), X(), Z(), Ht(), Kt(), Zt();
6728
- let e = L.current;
6730
+ B(null), Y(), X(), Ut(), qt(), Qt();
6731
+ let e = F.current;
6729
6732
  e && (e.getCanvas().style.cursor = "crosshair");
6730
- } else e === "marker" ? (Z(), Ht(), Kt(), Zt(), Q()) : (H(null), X(), Z(), Ht(), Kt(), Zt(), Q());
6733
+ } else e === "marker" ? (X(), Ut(), qt(), Qt(), Z()) : (B(null), Y(), X(), Ut(), qt(), Qt(), Z());
6731
6734
  }, [
6735
+ Y,
6732
6736
  X,
6733
- Z,
6734
- Ht,
6735
- Kt,
6736
- Zt,
6737
- Q
6738
- ]), rn = useCallback((e) => {
6737
+ Ut,
6738
+ qt,
6739
+ Qt,
6740
+ Z
6741
+ ]), an = useCallback((e) => {
6739
6742
  if (e !== "picker") {
6740
- let e = y.value && isFinite(y.value.lng) && isFinite(y.value.lat), t = y.showMarker !== !1;
6741
- (!e || !t) && At(), nt(null);
6743
+ let e = v.value && isFinite(v.value.lng) && isFinite(v.value.lat), t = v.showMarker !== !1;
6744
+ (!e || !t) && jt(), it(null);
6742
6745
  }
6743
- e !== "edit" && (H(null), U(null), Z(), Q(), X()), et(e);
6746
+ e !== "edit" && (B(null), V(null), X(), Z(), Y()), nt(e);
6744
6747
  }, [
6745
- At,
6748
+ jt,
6749
+ Y,
6746
6750
  X,
6747
- Z,
6748
- Q
6749
- ]), an = useCallback(() => $e, [$e]), on = useCallback(() => tt, [tt]), sn = useCallback(() => {
6750
- At(), nt(null);
6751
- }, [At]);
6751
+ Z
6752
+ ]), on = useCallback(() => tt, [tt]), sn = useCallback(() => rt, [rt]), cn = useCallback(() => {
6753
+ jt(), it(null);
6754
+ }, [jt]);
6752
6755
  useEffect(() => {
6753
- if (!V) return;
6754
- let e = y.value;
6756
+ if (!z) return;
6757
+ let e = v.value;
6755
6758
  if (e && isFinite(e.lng) && isFinite(e.lat)) {
6756
6759
  let t = [e.lng, e.lat];
6757
- nt(e), kt(t);
6760
+ it(e), At(t);
6758
6761
  }
6759
6762
  }, [
6760
- y.value,
6761
- kt,
6762
- V
6763
+ v.value,
6764
+ At,
6765
+ z
6763
6766
  ]);
6764
- let cn = (e) => "mode" in e, ln = useCallback((e) => {
6765
- if (et("edit"), At(), nt(null), W.current = !0, cn(e)) {
6766
- if (e.mode === "marker") e.markerStyle ? (ct.current = e.markerStyle, G.current = null, K.current = null, q.current = null, J.current = null, ft.current = null, H(null), U("marker"), e.markerStyle.src && e.markerStyle.width ? Mt({
6767
+ let ln = (e) => "mode" in e, un = useCallback((e) => {
6768
+ if (nt("edit"), jt(), it(null), H.current = !0, ln(e)) {
6769
+ if (e.mode === "marker") e.markerStyle ? (ut.current = e.markerStyle, U.current = null, W.current = null, G.current = null, K.current = null, q.current = null, B(null), V("marker"), e.markerStyle.src && e.markerStyle.width ? Nt({
6767
6770
  id: "custom",
6768
6771
  name: e.markerStyle.name || "Marker",
6769
6772
  icon: e.markerStyle.src,
6770
6773
  width: e.markerStyle.width
6771
- }) : X()) : e.template && (ct.current = null, G.current = null, K.current = null, q.current = null, J.current = null, ft.current = null, H(e.template), U("marker"), Mt(e.template));
6774
+ }) : Y()) : e.template && (ut.current = null, U.current = null, W.current = null, G.current = null, K.current = null, q.current = null, B(e.template), V("marker"), Nt(e.template));
6772
6775
  else if (e.mode === "rectangle") {
6773
- G.current = e.rectangleStyle || null, ct.current = null, K.current = null, q.current = null, J.current = null, ft.current = null, H(null), U("rectangle"), X();
6774
- let t = L.current;
6776
+ U.current = e.rectangleStyle || null, ut.current = null, W.current = null, G.current = null, K.current = null, q.current = null, B(null), V("rectangle"), Y();
6777
+ let t = F.current;
6775
6778
  t && (t.getCanvas().style.cursor = "crosshair");
6776
6779
  } else if (e.mode === "circle") {
6777
- K.current = e.circleStyle || null, G.current = null, ct.current = null, q.current = null, J.current = null, ft.current = null, H(null), U("circle"), X();
6778
- let t = L.current;
6780
+ W.current = e.circleStyle || null, U.current = null, ut.current = null, G.current = null, K.current = null, q.current = null, B(null), V("circle"), Y();
6781
+ let t = F.current;
6779
6782
  t && (t.getCanvas().style.cursor = "crosshair");
6780
6783
  } else if (e.mode === "polygon") {
6781
- q.current = e.polygonStyle || null, G.current = null, ct.current = null, K.current = null, J.current = null, ft.current = null, H(null), U("polygon"), X();
6782
- let t = L.current;
6784
+ G.current = e.polygonStyle || null, U.current = null, ut.current = null, W.current = null, K.current = null, q.current = null, B(null), V("polygon"), Y();
6785
+ let t = F.current;
6783
6786
  t && (t.getCanvas().style.cursor = "crosshair");
6784
6787
  } else if (e.mode === "square") {
6785
- J.current = e.squareStyle || null, G.current = null, ct.current = null, K.current = null, q.current = null, ft.current = null, H(null), U("square"), X();
6786
- let t = L.current;
6788
+ K.current = e.squareStyle || null, U.current = null, ut.current = null, W.current = null, G.current = null, q.current = null, B(null), V("square"), Y();
6789
+ let t = F.current;
6787
6790
  t && (t.getCanvas().style.cursor = "crosshair");
6788
6791
  } else if (e.mode === "polyline") {
6789
- ft.current = e.polylineStyle || null, G.current = null, ct.current = null, K.current = null, q.current = null, J.current = null, H(null), U("polyline"), X();
6790
- let t = L.current;
6792
+ q.current = e.polylineStyle || null, U.current = null, ut.current = null, W.current = null, G.current = null, K.current = null, B(null), V("polyline"), Y();
6793
+ let t = F.current;
6791
6794
  t && (t.getCanvas().style.cursor = "crosshair");
6792
6795
  }
6793
- } else H(e), U("marker"), Mt(e), G.current = null, ct.current = null, K.current = null, q.current = null, J.current = null, ft.current = null;
6796
+ } else B(e), V("marker"), Nt(e), U.current = null, ut.current = null, W.current = null, G.current = null, K.current = null, q.current = null;
6794
6797
  }, [
6795
- At,
6796
- Mt,
6797
- X
6798
+ jt,
6799
+ Nt,
6800
+ Y
6798
6801
  ]);
6799
6802
  useImperativeHandle(c, () => ({
6800
- startAnimation: yt,
6801
- stopAnimation: bt,
6802
- toggleAnimation: xt,
6803
- getMap: () => L.current,
6804
- openPopup: (e) => Ct(e, "programmatic"),
6805
- closePopup: wt,
6806
- closeAllPopups: Tt,
6807
- isPopupOpen: Et,
6808
- toggleUnitTrajectory: St,
6809
- flyTo: Dt,
6810
- flyToEntities: Ot,
6811
- getMode: an,
6812
- setMode: rn,
6813
- getPickedLocation: on,
6814
- clearPickedLocation: sn,
6815
- startDrawing: ln,
6816
- getRenderer: (e) => R.current.get(e),
6803
+ startAnimation: bt,
6804
+ stopAnimation: xt,
6805
+ toggleAnimation: St,
6806
+ getMap: () => F.current,
6807
+ openPopup: (e) => wt(e, "programmatic"),
6808
+ closePopup: Tt,
6809
+ closeAllPopups: Et,
6810
+ isPopupOpen: Dt,
6811
+ toggleUnitTrajectory: Ct,
6812
+ flyTo: Ot,
6813
+ flyToEntities: kt,
6814
+ getMode: on,
6815
+ setMode: an,
6816
+ getPickedLocation: sn,
6817
+ clearPickedLocation: cn,
6818
+ startDrawing: un,
6819
+ getRenderer: (e) => I.current.get(e),
6817
6820
  setEditingEntities: (e) => {
6818
- for (let t of vt.current) e.map(String).includes(String(t)) || R.current.get(t)?.setEditing?.(!1);
6819
- for (let t of e) R.current.get(t)?.setEditing?.(!0);
6820
- Y.current &&= (R.current.get(Y.current.entityId)?.cancelEditPreview?.(), null), _t(e);
6821
+ for (let t of yt.current) e.map(String).includes(String(t)) || I.current.get(t)?.setEditing?.(!1);
6822
+ for (let t of e) I.current.get(t)?.setEditing?.(!0);
6823
+ J.current &&= (I.current.get(J.current.entityId)?.cancelEditPreview?.(), null), vt(e);
6821
6824
  },
6822
- getEditingEntities: () => vt.current,
6825
+ getEditingEntities: () => yt.current,
6823
6826
  startRoutePlanning: (e) => {
6824
- He.current?.startPlanning(e);
6827
+ We.current?.startPlanning(e);
6825
6828
  }
6826
6829
  }), [
6827
- yt,
6828
6830
  bt,
6829
6831
  xt,
6830
- Ct,
6832
+ St,
6831
6833
  wt,
6832
6834
  Tt,
6833
6835
  Et,
6834
- St,
6835
6836
  Dt,
6837
+ Ct,
6836
6838
  Ot,
6837
- an,
6838
- rn,
6839
+ kt,
6839
6840
  on,
6841
+ an,
6840
6842
  sn,
6841
- ln
6843
+ cn,
6844
+ un
6842
6845
  ]);
6843
- let un = useCallback(() => {
6844
- let e = L.current;
6846
+ let dn = useCallback(() => {
6847
+ let e = F.current;
6845
6848
  if (!e) return;
6846
- let t = new Set(E.map((e) => e.id)), n = new Set(R.current.keys());
6847
- for (let e of n) t.has(e) || (R.current.get(e)?.destroy(), R.current.delete(e));
6848
- let r = new Set(D.map(String));
6849
- for (let t of E) {
6850
- let n = applyEntityConfig(t, O), i = R.current.get(n.id);
6849
+ let t = new Set(w.map((e) => e.id)), n = new Set(I.current.keys());
6850
+ for (let e of n) t.has(e) || (I.current.get(e)?.destroy(), I.current.delete(e));
6851
+ let r = new Set(T.map(String));
6852
+ for (let t of w) {
6853
+ let n = applyEntityConfig(t, E), i = I.current.get(n.id);
6851
6854
  if (i) if (n.type === "radar" && i instanceof CanvasRadarRenderer) i.update(n);
6852
6855
  else if (n.type === "image" && i instanceof CanvasImageRenderer) i.update(n);
6853
6856
  else if (n.type === "marker" && i instanceof MarkerRenderer) i.update(n);
@@ -6856,38 +6859,38 @@ const Mapbox = forwardRef((e, c) => {
6856
6859
  else if (n.type === "circle") if (n.fillType === "radial-gradient") if (i instanceof CanvasCircleRenderer) i.update(n);
6857
6860
  else {
6858
6861
  i.destroy();
6859
- let t = new CanvasCircleRenderer(e, n, k, A, j, M);
6860
- R.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6862
+ let t = new CanvasCircleRenderer(e, n, D, O, k, A);
6863
+ I.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6861
6864
  }
6862
6865
  else if (i instanceof CircleRenderer) i.update(n);
6863
6866
  else {
6864
6867
  i.destroy();
6865
- let t = new CircleRenderer(e, n, k, A, j, M);
6866
- R.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6868
+ let t = new CircleRenderer(e, n, D, O, k, A);
6869
+ I.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6867
6870
  }
6868
6871
  else (n.type === "square" && i instanceof SquareRenderer || n.type === "rectangle" && i instanceof RectangleRenderer || n.type === "polyline" && i instanceof PolylineRenderer) && i.update(n);
6869
6872
  else {
6870
6873
  let t = null;
6871
- 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 && (R.current.set(n.id, t), t.setSelected(r.has(String(n.id))), vt.current.map(String).includes(String(n.id)) && t.setEditing?.(!0));
6874
+ n.type === "radar" ? t = new CanvasRadarRenderer(e, n, D, O) : n.type === "image" ? t = new CanvasImageRenderer(e, n, D, O) : n.type === "marker" ? t = new MarkerRenderer(e, n, D, O) : n.type === "unit" ? t = new UnitRenderer(e, n, D, O) : n.type === "polygon" ? t = new PolygonRenderer(e, n, D, O, k, j) : n.type === "circle" ? t = n.fillType === "radial-gradient" ? new CanvasCircleRenderer(e, n, D, O, k, A) : new CircleRenderer(e, n, D, O, k, A) : n.type === "square" ? t = new SquareRenderer(e, n, D, O, k, j) : n.type === "rectangle" ? t = new RectangleRenderer(e, n, D, O, k, j) : n.type === "polyline" && (t = new PolylineRenderer(e, n, D, O, j)), t && (I.current.set(n.id, t), t.setSelected(r.has(String(n.id))), yt.current.map(String).includes(String(n.id)) && t.setEditing?.(!0));
6872
6875
  }
6873
6876
  }
6874
- for (let e of vt.current) {
6875
- let t = R.current.get(e);
6877
+ for (let e of yt.current) {
6878
+ let t = I.current.get(e);
6876
6879
  t && t.setEditing?.(!0);
6877
6880
  }
6878
6881
  }, [
6882
+ w,
6883
+ T,
6879
6884
  E,
6880
6885
  D,
6881
6886
  O,
6882
6887
  k,
6883
6888
  A,
6884
- j,
6885
- M,
6886
- N
6887
- ]), dn = useCallback(() => {
6888
- for (let e of R.current.values()) e.destroy();
6889
- R.current.clear();
6890
- }, []), fn = useCallback((e) => {
6889
+ j
6890
+ ]), fn = useCallback(() => {
6891
+ for (let e of I.current.values()) e.destroy();
6892
+ I.current.clear();
6893
+ }, []), pn = useCallback((e) => {
6891
6894
  let t = e.getStyle();
6892
6895
  if (!t?.layers) return;
6893
6896
  let n = [
@@ -6902,10 +6905,10 @@ const Mapbox = forwardRef((e, c) => {
6902
6905
  "marker-"
6903
6906
  ];
6904
6907
  for (let e of t.layers) if (n.some((t) => e.id.startsWith(t))) return e.id;
6905
- }, []), pn = useCallback((e) => {
6906
- 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;
6908
+ }, []), mn = useCallback((e) => {
6909
+ 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;
6907
6910
  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;
6908
- }, [T]), mn = useCallback((e, t) => {
6911
+ }, [C]), hn = useCallback((e, t) => {
6909
6912
  let n = `base-layer-source-${t.id}`, r = `base-layer-${t.id}`, i = {
6910
6913
  type: "raster",
6911
6914
  tiles: [t.url],
@@ -6915,27 +6918,28 @@ const Mapbox = forwardRef((e, c) => {
6915
6918
  scheme: t.scheme ?? "xyz"
6916
6919
  };
6917
6920
  t.bounds && (i.bounds = t.bounds), t.attribution && (i.attribution = t.attribution), e.addSource(n, i);
6918
- let a = fn(e);
6921
+ let a = pn(e);
6919
6922
  e.addLayer({
6920
6923
  id: r,
6921
6924
  type: "raster",
6922
6925
  source: n,
6923
- paint: pn(t),
6926
+ paint: mn(t),
6924
6927
  layout: { visibility: t.visible === !1 ? "none" : "visible" }
6925
6928
  }, a);
6926
- }, [fn, pn]), hn = useCallback(async (e, t) => {
6929
+ }, [pn, mn]), gn = useCallback(async (e, t) => {
6927
6930
  try {
6928
6931
  let n = await (await fetch(t.url)).json(), r = `base-layer-source-${t.id}`, i = `base-layer-${t.id}`;
6929
- if (!Ue.current.has(t.id)) return;
6930
- let a = n.format === "pbf" || n.vector_layers, o = fn(e);
6931
- a ? (e.addSource(r, {
6932
- type: "vector",
6933
- tiles: n.tiles,
6934
- minzoom: n.minzoom ?? 0,
6935
- maxzoom: n.maxzoom ?? 22,
6936
- bounds: n.bounds,
6937
- attribution: n.attribution
6938
- }), console.warn(`TileJSON "${t.id}" 是矢量瓦片,建议使用 type: 'style' 加载完整样式`)) : (e.addSource(r, {
6932
+ if (!Ge.current.has(t.id)) return;
6933
+ let a = n.format === "pbf" || n.vector_layers, o = pn(e);
6934
+ if (a) {
6935
+ let t = {
6936
+ type: "vector",
6937
+ tiles: n.tiles,
6938
+ minzoom: n.minzoom ?? 0,
6939
+ maxzoom: n.maxzoom ?? 22
6940
+ };
6941
+ n.bounds && (t.bounds = n.bounds), n.attribution && (t.attribution = n.attribution), e.addSource(r, t);
6942
+ } else e.addSource(r, {
6939
6943
  type: "raster",
6940
6944
  tiles: n.tiles,
6941
6945
  tileSize: t.tileSize ?? n.tileSize ?? 256,
@@ -6947,21 +6951,21 @@ const Mapbox = forwardRef((e, c) => {
6947
6951
  id: i,
6948
6952
  type: "raster",
6949
6953
  source: r,
6950
- paint: pn(t),
6954
+ paint: mn(t),
6951
6955
  layout: { visibility: t.visible === !1 ? "none" : "visible" }
6952
- }, o));
6956
+ }, o);
6953
6957
  } catch (e) {
6954
6958
  console.error(`Failed to load TileJSON from ${t.url}:`, e);
6955
6959
  }
6956
- }, [fn, pn]), gn = useCallback(async (e, t) => {
6960
+ }, [pn, mn]), _n = useCallback(async (e, t) => {
6957
6961
  try {
6958
6962
  let n = await (await fetch(t.url)).json();
6959
- if (!Ue.current.has(t.id)) return;
6963
+ if (!Ge.current.has(t.id)) return;
6960
6964
  if (n.sources) for (let [r, i] of Object.entries(n.sources)) {
6961
6965
  let n = `base-layer-source-${t.id}-${r}`;
6962
6966
  e.getSource(n) || e.addSource(n, i);
6963
6967
  }
6964
- let r = fn(e);
6968
+ let r = pn(e);
6965
6969
  if (n.layers) for (let i of n.layers) {
6966
6970
  let n = `base-layer-${t.id}-${i.id}`;
6967
6971
  if (e.getLayer(n)) continue;
@@ -6972,7 +6976,7 @@ const Mapbox = forwardRef((e, c) => {
6972
6976
  };
6973
6977
  i.type === "raster" && (a.paint = {
6974
6978
  ...a.paint,
6975
- ...pn(t)
6979
+ ...mn(t)
6976
6980
  }), t.visible === !1 && (a.layout = {
6977
6981
  ...a.layout,
6978
6982
  visibility: "none"
@@ -6985,50 +6989,50 @@ const Mapbox = forwardRef((e, c) => {
6985
6989
  } catch (e) {
6986
6990
  console.error(`Failed to load Style JSON from ${t.url}:`, e);
6987
6991
  }
6988
- }, [fn, pn]), _n = useCallback((e, t) => {
6992
+ }, [pn, mn]), vn = useCallback((e, t) => {
6989
6993
  let n = e.getStyle();
6990
6994
  if (!n) return;
6991
6995
  let r = `base-layer-${t}`, i = n.layers?.filter((e) => e.id.startsWith(r)) ?? [];
6992
6996
  for (let t of i) e.getLayer(t.id) && e.removeLayer(t.id);
6993
6997
  let a = `base-layer-source-${t}`, o = n.sources ?? {};
6994
6998
  for (let t of Object.keys(o)) t.startsWith(a) && e.getSource(t) && e.removeSource(t);
6995
- }, []), vn = useCallback((e) => {
6996
- let t = L.current;
6999
+ }, []), yn = useCallback((e) => {
7000
+ let t = F.current;
6997
7001
  if (!t) return;
6998
- let n = new Set(e.map((e) => e.id)), r = Ue.current;
6999
- for (let e of r) n.has(e) || (_n(t, e), r.delete(e));
7002
+ let n = new Set(e.map((e) => e.id)), r = Ge.current;
7003
+ for (let e of r) n.has(e) || (vn(t, e), r.delete(e));
7000
7004
  for (let n of e) if (r.has(n.id)) {
7001
7005
  let e = `base-layer-${n.id}`;
7002
7006
  if (t.getLayer(e)) {
7003
- let r = pn(n);
7007
+ let r = mn(n);
7004
7008
  for (let [n, i] of Object.entries(r)) t.setPaintProperty(e, n, i);
7005
7009
  t.setLayoutProperty(e, "visibility", n.visible === !1 ? "none" : "visible");
7006
7010
  }
7007
7011
  } else switch (r.add(n.id), n.type) {
7008
7012
  case "raster":
7009
- mn(t, n);
7013
+ hn(t, n);
7010
7014
  break;
7011
7015
  case "tilejson":
7012
- hn(t, n);
7016
+ gn(t, n);
7013
7017
  break;
7014
7018
  case "style":
7015
- gn(t, n);
7019
+ _n(t, n);
7016
7020
  break;
7017
7021
  default: {
7018
7022
  let e = n;
7019
- e.url && mn(t, {
7023
+ e.url && hn(t, {
7020
7024
  ...e,
7021
7025
  type: "raster"
7022
7026
  });
7023
7027
  }
7024
7028
  }
7025
7029
  }, [
7026
- mn,
7027
7030
  hn,
7028
7031
  gn,
7029
7032
  _n,
7030
- pn
7031
- ]), yn = useCallback((e) => {
7033
+ vn,
7034
+ mn
7035
+ ]), bn = useCallback((e) => {
7032
7036
  let t = e;
7033
7037
  for (; t;) {
7034
7038
  let e = t.getAttribute?.("data-entity-id");
@@ -7036,158 +7040,158 @@ const Mapbox = forwardRef((e, c) => {
7036
7040
  t = t.parentElement;
7037
7041
  }
7038
7042
  return null;
7039
- }, []), bn = useCallback((e) => {
7043
+ }, []), xn = useCallback((e) => {
7040
7044
  let t = [e.lngLat.lng, e.lngLat.lat], n = {
7041
7045
  x: e.point.x,
7042
7046
  y: e.point.y
7043
- }, r = On.current;
7047
+ }, r = kn.current;
7044
7048
  if (r === "picker") {
7045
7049
  let e = {
7046
7050
  lng: t[0],
7047
7051
  lat: t[1]
7048
7052
  };
7049
- nt(e), kt(t), kn.current?.(e);
7053
+ it(e), At(t), An.current?.(e);
7050
7054
  return;
7051
7055
  }
7052
- if (ht.current) return;
7056
+ if (gt.current) return;
7053
7057
  if (r === "edit") {
7054
- let e = jn.current;
7058
+ let e = Mn.current;
7055
7059
  if (e === "rectangle") {
7056
- let e = Mn.current;
7057
- if (!e) st(t);
7060
+ let e = Nn.current;
7061
+ if (!e) lt(t);
7058
7062
  else {
7059
- let n = G.current, r = applyEntityConfig({
7063
+ let n = U.current, r = applyEntityConfig({
7060
7064
  ...n,
7061
- id: n?.id ?? jt(),
7065
+ id: n?.id ?? Mt(),
7062
7066
  type: "rectangle",
7063
7067
  bounds: [e, t]
7064
- }, O);
7065
- It();
7066
- let i = L.current;
7067
- if (i && !R.current.has(r.id)) {
7068
- let e = new RectangleRenderer(i, r, k, A, j, N);
7069
- R.current.set(r.id, e);
7068
+ }, E);
7069
+ Lt();
7070
+ let i = F.current;
7071
+ if (i && !I.current.has(r.id)) {
7072
+ let e = new RectangleRenderer(i, r, D, O, k, j);
7073
+ I.current.set(r.id, e);
7070
7074
  }
7071
- $.current.onRectangleAdd?.(r), st(null), G.current = null, W.current && (W.current = !1, U(null), i && (i.getCanvas().style.cursor = ""));
7075
+ Q.current.onRectangleAdd?.(r), lt(null), U.current = null, H.current && (H.current = !1, V(null), i && (i.getCanvas().style.cursor = ""));
7072
7076
  }
7073
7077
  return;
7074
7078
  }
7075
7079
  if (e === "circle") {
7076
- let e = lt.current;
7077
- if (!e) lt.current = { center: t };
7080
+ let e = dt.current;
7081
+ if (!e) dt.current = { center: t };
7078
7082
  else {
7079
- let n = zt(e.center, t), r = K.current, i = applyEntityConfig({
7083
+ let n = Bt(e.center, t), r = W.current, i = applyEntityConfig({
7080
7084
  ...r,
7081
- id: r?.id ?? jt(),
7085
+ id: r?.id ?? Mt(),
7082
7086
  type: "circle",
7083
7087
  center: e.center,
7084
7088
  radius: n
7085
- }, O);
7086
- Vt();
7087
- let a = L.current;
7088
- if (a && !R.current.has(i.id)) {
7089
- let e = new CircleRenderer(a, i, k, A, j, M);
7090
- R.current.set(i.id, e);
7089
+ }, E);
7090
+ Ht();
7091
+ let a = F.current;
7092
+ if (a && !I.current.has(i.id)) {
7093
+ let e = new CircleRenderer(a, i, D, O, k, A);
7094
+ I.current.set(i.id, e);
7091
7095
  }
7092
- $.current.onCircleAdd?.(i), lt.current = null, K.current = null, W.current && (W.current = !1, U(null), a && (a.getCanvas().style.cursor = ""));
7096
+ Q.current.onCircleAdd?.(i), dt.current = null, W.current = null, H.current && (H.current = !1, V(null), a && (a.getCanvas().style.cursor = ""));
7093
7097
  }
7094
7098
  return;
7095
7099
  }
7096
7100
  if (e === "polygon") {
7097
- let e = ut.current;
7101
+ let e = ft.current;
7098
7102
  if (e.length >= 3) {
7099
7103
  let n = e[0];
7100
- if (zt(n, t) < 20) {
7101
- let t = q.current, n = applyEntityConfig({
7104
+ if (Bt(n, t) < 20) {
7105
+ let t = G.current, n = applyEntityConfig({
7102
7106
  ...t,
7103
- id: t?.id ?? jt(),
7107
+ id: t?.id ?? Mt(),
7104
7108
  type: "polygon",
7105
7109
  coordinates: [...e]
7106
- }, O);
7107
- Gt();
7108
- let r = L.current;
7109
- if (r && !R.current.has(n.id)) {
7110
- let e = new PolygonRenderer(r, n, k, A, j, N);
7111
- R.current.set(n.id, e);
7110
+ }, E);
7111
+ Kt();
7112
+ let r = F.current;
7113
+ if (r && !I.current.has(n.id)) {
7114
+ let e = new PolygonRenderer(r, n, D, O, k, j);
7115
+ I.current.set(n.id, e);
7112
7116
  }
7113
- $.current.onPolygonAdd?.(n), ut.current = [], q.current = null, W.current && (W.current = !1, U(null), r && (r.getCanvas().style.cursor = ""));
7117
+ Q.current.onPolygonAdd?.(n), ft.current = [], G.current = null, H.current && (H.current = !1, V(null), r && (r.getCanvas().style.cursor = ""));
7114
7118
  return;
7115
7119
  }
7116
7120
  }
7117
- ut.current = [...e, t];
7121
+ ft.current = [...e, t];
7118
7122
  return;
7119
7123
  }
7120
7124
  if (e === "square") {
7121
- let e = dt.current;
7122
- if (!e) dt.current = { center: t };
7125
+ let e = pt.current;
7126
+ if (!e) pt.current = { center: t };
7123
7127
  else {
7124
- let n = zt(e.center, t) * 2, r = J.current, i = applyEntityConfig({
7128
+ let n = Bt(e.center, t) * 2, r = K.current, i = applyEntityConfig({
7125
7129
  ...r,
7126
- id: r?.id ?? jt(),
7130
+ id: r?.id ?? Mt(),
7127
7131
  type: "square",
7128
7132
  center: e.center,
7129
7133
  length: n
7130
- }, O);
7131
- Xt();
7132
- let a = L.current;
7133
- if (a && !R.current.has(i.id)) {
7134
- let e = new SquareRenderer(a, i, k, A, j, N);
7135
- R.current.set(i.id, e);
7134
+ }, E);
7135
+ Zt();
7136
+ let a = F.current;
7137
+ if (a && !I.current.has(i.id)) {
7138
+ let e = new SquareRenderer(a, i, D, O, k, j);
7139
+ I.current.set(i.id, e);
7136
7140
  }
7137
- $.current.onSquareAdd?.(i), dt.current = null, J.current = null, W.current && (W.current = !1, U(null), a && (a.getCanvas().style.cursor = ""));
7141
+ Q.current.onSquareAdd?.(i), pt.current = null, K.current = null, H.current && (H.current = !1, V(null), a && (a.getCanvas().style.cursor = ""));
7138
7142
  }
7139
7143
  return;
7140
7144
  }
7141
7145
  if (e === "polyline") {
7142
- pt.current = [...pt.current, t];
7146
+ mt.current = [...mt.current, t];
7143
7147
  return;
7144
7148
  }
7145
- let n = ct.current;
7149
+ let n = ut.current;
7146
7150
  if (n && n.src && n.width) {
7147
7151
  let e = {
7148
7152
  ...n,
7149
- id: n.id ?? jt(),
7153
+ id: n.id ?? Mt(),
7150
7154
  type: "marker",
7151
7155
  center: t,
7152
7156
  src: n.src,
7153
7157
  width: n.width
7154
7158
  };
7155
- $.current.onMarkerAdd?.(e), H(null), U(null), X(), ct.current = null, W.current = !1;
7159
+ Q.current.onMarkerAdd?.(e), B(null), V(null), Y(), ut.current = null, H.current = !1;
7156
7160
  return;
7157
7161
  }
7158
- let r = An.current;
7162
+ let r = jn.current;
7159
7163
  if (r) {
7160
7164
  let e = {
7161
- id: jt(),
7165
+ id: Mt(),
7162
7166
  type: "marker",
7163
7167
  name: r.name,
7164
7168
  center: t,
7165
7169
  src: r.icon,
7166
7170
  width: r.size || r.width || 32
7167
7171
  };
7168
- r.customData !== void 0 && (e.customData = r.customData), $.current.onMarkerAdd?.(e), H(null), U(null), X(), W.current = !1;
7172
+ r.customData !== void 0 && (e.customData = r.customData), Q.current.onMarkerAdd?.(e), B(null), V(null), Y(), H.current = !1;
7169
7173
  return;
7170
7174
  }
7171
7175
  }
7172
- if (vt.current.length > 0) {
7173
- let e = L.current?.getZoom() ?? 12;
7174
- if (Y.current) {
7175
- let { entityId: e, activeHandle: n } = Y.current, r = R.current.get(e);
7176
+ if (yt.current.length > 0) {
7177
+ let e = F.current?.getZoom() ?? 12;
7178
+ if (J.current) {
7179
+ let { entityId: e, activeHandle: n } = J.current, r = I.current.get(e);
7176
7180
  if (r?.applyHandleMove) {
7177
7181
  let e = r.applyHandleMove(n, t);
7178
- $.current.onEntityEdit?.(e);
7182
+ Q.current.onEntityEdit?.(e);
7179
7183
  }
7180
- Y.current = null;
7184
+ J.current = null;
7181
7185
  return;
7182
7186
  }
7183
- for (let n of vt.current) {
7184
- let r = R.current.get(n);
7187
+ for (let n of yt.current) {
7188
+ let r = I.current.get(n);
7185
7189
  if (!r?.getEditHandleAt) continue;
7186
7190
  let i = r.getEditHandleAt(t, e);
7187
7191
  if (i) {
7188
7192
  if (i.type === "midpoint" && r.addVertex) {
7189
7193
  let e = r.addVertex(i.index, i.position);
7190
- $.current.onEntityEdit?.(e), Y.current = {
7194
+ Q.current.onEntityEdit?.(e), J.current = {
7191
7195
  entityId: n,
7192
7196
  activeHandle: {
7193
7197
  type: "vertex",
@@ -7195,7 +7199,7 @@ const Mapbox = forwardRef((e, c) => {
7195
7199
  position: i.position
7196
7200
  }
7197
7201
  };
7198
- } else Y.current = {
7202
+ } else J.current = {
7199
7203
  entityId: n,
7200
7204
  activeHandle: i
7201
7205
  };
@@ -7203,186 +7207,186 @@ const Mapbox = forwardRef((e, c) => {
7203
7207
  }
7204
7208
  }
7205
7209
  }
7206
- let i = Tn.current, a = En.current, o = Dn.current, s = yn(e.originalEvent.target);
7210
+ let i = En.current, a = Dn.current, o = On.current, s = bn(e.originalEvent.target);
7207
7211
  if (s) {
7208
7212
  let e = i.find((e) => String(e.id) === s);
7209
7213
  if (e) {
7210
7214
  if (a?.(e), e.popup) {
7211
- let t = e.popup.content ?? Pe?.(e);
7212
- t && mergePopupConfig(e.popup, I, t).trigger === "click" && o(s, "click", n);
7215
+ let t = e.popup.content ?? Ie?.(e);
7216
+ t && mergePopupConfig(e.popup, P, t).trigger === "click" && o(s, "click", n);
7213
7217
  }
7214
7218
  return;
7215
7219
  }
7216
7220
  }
7217
- for (let [t, r] of R.current) {
7221
+ for (let [t, r] of I.current) {
7218
7222
  let s = r.getLabelLayerId();
7219
- if (s && L.current?.getLayer(s) && L.current.queryRenderedFeatures(e.point, { layers: [s] }).length > 0) {
7223
+ if (s && F.current?.getLayer(s) && F.current.queryRenderedFeatures(e.point, { layers: [s] }).length > 0) {
7220
7224
  let e = i.find((e) => e.id === t);
7221
7225
  if (e) {
7222
7226
  if (a?.(e), e.popup) {
7223
- let r = e.popup.content ?? Pe?.(e);
7224
- r && mergePopupConfig(e.popup, I, r).trigger === "click" && o(t, "click", n);
7227
+ let r = e.popup.content ?? Ie?.(e);
7228
+ r && mergePopupConfig(e.popup, P, r).trigger === "click" && o(t, "click", n);
7225
7229
  }
7226
7230
  return;
7227
7231
  }
7228
7232
  }
7229
7233
  }
7230
- for (let [e, r] of R.current) if (r.isPointInEntity(t)) {
7234
+ for (let [e, r] of I.current) if (r.isPointInEntity(t)) {
7231
7235
  let t = i.find((t) => t.id === e);
7232
7236
  if (t) {
7233
7237
  if (a?.(t), t.popup) {
7234
- let r = t.popup.content ?? Pe?.(t);
7235
- r && mergePopupConfig(t.popup, I, r).trigger === "click" && o(e, "click", n);
7238
+ let r = t.popup.content ?? Ie?.(t);
7239
+ r && mergePopupConfig(t.popup, P, r).trigger === "click" && o(e, "click", n);
7236
7240
  }
7237
7241
  return;
7238
7242
  }
7239
7243
  }
7240
7244
  }, [
7241
- I,
7242
- Pe,
7243
- yn
7244
- ]), xn = useCallback((e) => {
7245
+ P,
7246
+ Ie,
7247
+ bn
7248
+ ]), Sn = useCallback((e) => {
7245
7249
  let t = [e.lngLat.lng, e.lngLat.lat];
7246
- if (Y.current) {
7247
- let { entityId: e, activeHandle: n } = Y.current;
7248
- R.current.get(e)?.updateEditPreview?.(n, t);
7250
+ if (J.current) {
7251
+ let { entityId: e, activeHandle: n } = J.current;
7252
+ I.current.get(e)?.updateEditPreview?.(n, t);
7249
7253
  return;
7250
7254
  }
7251
- let n = jn.current, r = Mn.current;
7252
- n === "rectangle" && r && Ft(r, t);
7253
- let i = lt.current;
7254
- n === "circle" && i && Bt(i.center, t);
7255
- let a = ut.current;
7256
- n === "polygon" && a.length > 0 && Wt(a, t);
7257
- let o = dt.current;
7258
- n === "square" && o && Yt(o.center, t);
7259
- let s = pt.current;
7260
- n === "polyline" && s.length > 0 && $t(s, t);
7261
- let c = Tn.current, l = Dn.current;
7262
- for (let [e, n] of R.current) if (n.isPointInEntity(t)) {
7255
+ let n = Mn.current, r = Nn.current;
7256
+ n === "rectangle" && r && It(r, t);
7257
+ let i = dt.current;
7258
+ n === "circle" && i && Vt(i.center, t);
7259
+ let a = ft.current;
7260
+ n === "polygon" && a.length > 0 && Gt(a, t);
7261
+ let o = pt.current;
7262
+ n === "square" && o && Xt(o.center, t);
7263
+ let s = mt.current;
7264
+ n === "polyline" && s.length > 0 && en(s, t);
7265
+ let c = En.current, l = On.current;
7266
+ for (let [e, n] of I.current) if (n.isPointInEntity(t)) {
7263
7267
  let t = c.find((t) => t.id === e);
7264
7268
  if (!t?.popup) continue;
7265
- let n = t.popup.content ?? Pe?.(t);
7269
+ let n = t.popup.content ?? Ie?.(t);
7266
7270
  if (!n) continue;
7267
- let r = mergePopupConfig(t.popup, I, n);
7271
+ let r = mergePopupConfig(t.popup, P, n);
7268
7272
  if (r.trigger === "hover") {
7269
- qe.current && clearTimeout(qe.current), qe.current = window.setTimeout(() => {
7273
+ Ye.current && clearTimeout(Ye.current), Ye.current = window.setTimeout(() => {
7270
7274
  l(e, "hover");
7271
7275
  }, r.hoverDelay);
7272
7276
  return;
7273
7277
  }
7274
7278
  }
7275
- if (qe.current &&= (clearTimeout(qe.current), null), B?.openedBy === "hover") {
7276
- let e = R.current.get(B.entityId);
7277
- e && !e.isPointInEntity(t) && wt(B.entityId);
7279
+ if (Ye.current &&= (clearTimeout(Ye.current), null), R?.openedBy === "hover") {
7280
+ let e = I.current.get(R.entityId);
7281
+ e && !e.isPointInEntity(t) && Tt(R.entityId);
7278
7282
  }
7279
7283
  }, [
7280
- I,
7281
- Pe,
7282
- B,
7283
- wt,
7284
- Ft,
7285
- Bt,
7286
- Wt,
7287
- Yt,
7288
- $t
7289
- ]), Sn = useCallback((e) => {
7290
- if (e.preventDefault(), ht.current) return;
7291
- if (vt.current.length > 0) {
7284
+ P,
7285
+ Ie,
7286
+ R,
7287
+ Tt,
7288
+ It,
7289
+ Vt,
7290
+ Gt,
7291
+ Xt,
7292
+ en
7293
+ ]), Cn = useCallback((e) => {
7294
+ if (e.preventDefault(), gt.current) return;
7295
+ if (yt.current.length > 0) {
7292
7296
  let t = [e.lngLat.lng, e.lngLat.lat];
7293
- if (Y.current) {
7294
- R.current.get(Y.current.entityId)?.cancelEditPreview?.(), Y.current = null;
7297
+ if (J.current) {
7298
+ I.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7295
7299
  return;
7296
7300
  }
7297
- let n = L.current?.getZoom() ?? 12;
7298
- for (let e of vt.current) {
7299
- let r = R.current.get(e);
7301
+ let n = F.current?.getZoom() ?? 12;
7302
+ for (let e of yt.current) {
7303
+ let r = I.current.get(e);
7300
7304
  if (!r?.getEditHandleAt || !r.deleteVertex) continue;
7301
7305
  let i = r.getEditHandleAt(t, n);
7302
7306
  if (i && i.type === "vertex") {
7303
7307
  let e = r.deleteVertex(i.index);
7304
- e && $.current.onEntityEdit?.(e);
7308
+ e && Q.current.onEntityEdit?.(e);
7305
7309
  return;
7306
7310
  }
7307
7311
  }
7308
7312
  }
7309
- if (On.current !== "edit") return;
7310
- if (An.current) {
7311
- H(null), U(null), X();
7313
+ if (kn.current !== "edit") return;
7314
+ if (jn.current) {
7315
+ B(null), V(null), Y();
7312
7316
  return;
7313
7317
  }
7314
- let t = jn.current;
7318
+ let t = Mn.current;
7315
7319
  if (t === "rectangle") {
7316
- if (Mn.current) st(null), It();
7320
+ if (Nn.current) lt(null), Lt();
7317
7321
  else {
7318
- U(null);
7319
- let e = L.current;
7322
+ V(null);
7323
+ let e = F.current;
7320
7324
  e && (e.getCanvas().style.cursor = "");
7321
7325
  }
7322
7326
  return;
7323
7327
  }
7324
7328
  if (t === "circle") {
7325
- if (lt.current) lt.current = null, Vt();
7329
+ if (dt.current) dt.current = null, Ht();
7326
7330
  else {
7327
- U(null);
7328
- let e = L.current;
7331
+ V(null);
7332
+ let e = F.current;
7329
7333
  e && (e.getCanvas().style.cursor = "");
7330
7334
  }
7331
7335
  return;
7332
7336
  }
7333
7337
  if (t === "polygon") {
7334
- let e = ut.current;
7338
+ let e = ft.current;
7335
7339
  if (e.length >= 3) {
7336
- let t = q.current, n = applyEntityConfig({
7340
+ let t = G.current, n = applyEntityConfig({
7337
7341
  ...t,
7338
- id: t?.id ?? jt(),
7342
+ id: t?.id ?? Mt(),
7339
7343
  type: "polygon",
7340
7344
  coordinates: [...e]
7341
- }, O);
7342
- Gt();
7343
- let r = L.current;
7344
- if (r && !R.current.has(n.id)) {
7345
- let e = new PolygonRenderer(r, n, k, A, j, N);
7346
- R.current.set(n.id, e);
7345
+ }, E);
7346
+ Kt();
7347
+ let r = F.current;
7348
+ if (r && !I.current.has(n.id)) {
7349
+ let e = new PolygonRenderer(r, n, D, O, k, j);
7350
+ I.current.set(n.id, e);
7347
7351
  }
7348
- $.current.onPolygonAdd?.(n), ut.current = [], q.current = null, W.current && (W.current = !1, U(null), r && (r.getCanvas().style.cursor = ""));
7349
- } else if (e.length > 0) ut.current = [], Gt();
7352
+ Q.current.onPolygonAdd?.(n), ft.current = [], G.current = null, H.current && (H.current = !1, V(null), r && (r.getCanvas().style.cursor = ""));
7353
+ } else if (e.length > 0) ft.current = [], Kt();
7350
7354
  else {
7351
- U(null);
7352
- let e = L.current;
7355
+ V(null);
7356
+ let e = F.current;
7353
7357
  e && (e.getCanvas().style.cursor = "");
7354
7358
  }
7355
7359
  return;
7356
7360
  }
7357
7361
  if (t === "square") {
7358
- if (dt.current) dt.current = null, Xt();
7362
+ if (pt.current) pt.current = null, Zt();
7359
7363
  else {
7360
- U(null);
7361
- let e = L.current;
7364
+ V(null);
7365
+ let e = F.current;
7362
7366
  e && (e.getCanvas().style.cursor = "");
7363
7367
  }
7364
7368
  return;
7365
7369
  }
7366
7370
  if (t === "polyline") {
7367
- let e = pt.current;
7371
+ let e = mt.current;
7368
7372
  if (e.length >= 2) {
7369
- let t = ft.current, n = applyEntityConfig({
7373
+ let t = q.current, n = applyEntityConfig({
7370
7374
  ...t,
7371
- id: t?.id ?? jt(),
7375
+ id: t?.id ?? Mt(),
7372
7376
  type: "polyline",
7373
7377
  coordinates: [...e]
7374
- }, O);
7375
- en();
7376
- let r = L.current;
7377
- if (r && !R.current.has(n.id)) {
7378
- let e = new PolylineRenderer(r, n, k, A, N);
7379
- R.current.set(n.id, e);
7378
+ }, E);
7379
+ tn();
7380
+ let r = F.current;
7381
+ if (r && !I.current.has(n.id)) {
7382
+ let e = new PolylineRenderer(r, n, D, O, j);
7383
+ I.current.set(n.id, e);
7380
7384
  }
7381
- $.current.onPolylineAdd?.(n), pt.current = [], ft.current = null, W.current && (W.current = !1, U(null), r && (r.getCanvas().style.cursor = ""));
7382
- } else if (e.length > 0) pt.current = [], en();
7385
+ Q.current.onPolylineAdd?.(n), mt.current = [], q.current = null, H.current && (H.current = !1, V(null), r && (r.getCanvas().style.cursor = ""));
7386
+ } else if (e.length > 0) mt.current = [], tn();
7383
7387
  else {
7384
- U(null);
7385
- let e = L.current;
7388
+ V(null);
7389
+ let e = F.current;
7386
7390
  e && (e.getCanvas().style.cursor = "");
7387
7391
  }
7388
7392
  return;
@@ -7390,45 +7394,45 @@ const Mapbox = forwardRef((e, c) => {
7390
7394
  let n = [e.lngLat.lng, e.lngLat.lat], r = {
7391
7395
  x: e.point.x,
7392
7396
  y: e.point.y
7393
- }, i = Tn.current, a = yn(e.originalEvent.target);
7397
+ }, i = En.current, a = bn(e.originalEvent.target);
7394
7398
  if (a) {
7395
7399
  let e = i.find((e) => String(e.id) === a);
7396
7400
  if (e) {
7397
- Cn(e, r, n);
7401
+ wn(e, r, n);
7398
7402
  return;
7399
7403
  }
7400
7404
  }
7401
- for (let [t, a] of R.current) {
7405
+ for (let [t, a] of I.current) {
7402
7406
  let o = a.getLabelLayerId();
7403
- if (o && L.current?.getLayer(o) && L.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
7407
+ if (o && F.current?.getLayer(o) && F.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
7404
7408
  let e = i.find((e) => e.id === t);
7405
7409
  if (e) {
7406
- Cn(e, r, n);
7410
+ wn(e, r, n);
7407
7411
  return;
7408
7412
  }
7409
7413
  }
7410
7414
  }
7411
- for (let [e, t] of R.current) if (t.isPointInEntity(n)) {
7415
+ for (let [e, t] of I.current) if (t.isPointInEntity(n)) {
7412
7416
  let t = i.find((t) => t.id === e);
7413
7417
  if (t) {
7414
- Cn(t, r, n);
7418
+ wn(t, r, n);
7415
7419
  return;
7416
7420
  }
7417
7421
  }
7418
7422
  }, [
7419
- yn,
7420
- X,
7421
- It,
7422
- Vt,
7423
- Gt,
7424
- Xt,
7425
- en
7426
- ]), Cn = useCallback((e, t, n) => {
7427
- let r = Ve.current?.getBoundingClientRect(), i = r ? {
7423
+ bn,
7424
+ Y,
7425
+ Lt,
7426
+ Ht,
7427
+ Kt,
7428
+ Zt,
7429
+ tn
7430
+ ]), wn = useCallback((e, t, n) => {
7431
+ let r = Ue.current?.getBoundingClientRect(), i = r ? {
7428
7432
  x: t.x + r.left,
7429
7433
  y: t.y + r.top
7430
7434
  } : t;
7431
- Ye({
7435
+ Ze({
7432
7436
  position: i,
7433
7437
  lngLat: n,
7434
7438
  items: [{
@@ -7444,12 +7448,12 @@ const Mapbox = forwardRef((e, c) => {
7444
7448
  }),
7445
7449
  danger: !0,
7446
7450
  onClick: () => {
7447
- $.current.onEntityDelete?.(e);
7451
+ Q.current.onEntityDelete?.(e);
7448
7452
  }
7449
7453
  }]
7450
7454
  });
7451
- }, []), wn = useCallback(() => {
7452
- Ye(null);
7455
+ }, []), Tn = useCallback(() => {
7456
+ Ze(null);
7453
7457
  }, []);
7454
7458
  useEffect(() => {
7455
7459
  let e = document.createElement("div");
@@ -7460,11 +7464,11 @@ const Mapbox = forwardRef((e, c) => {
7460
7464
  width: 100%;
7461
7465
  pointer-events: none;
7462
7466
  height: 100%;
7463
- z-index: ${I?.zIndex ?? 1e3};
7464
- `, document.body.appendChild(e), Ge.current = e, () => {
7467
+ z-index: ${P?.zIndex ?? 1e3};
7468
+ `, document.body.appendChild(e), qe.current = e, () => {
7465
7469
  document.body.contains(e) && document.body.removeChild(e);
7466
7470
  };
7467
- }, [I?.zIndex]), useEffect(() => {
7471
+ }, [P?.zIndex]), useEffect(() => {
7468
7472
  let e = document.createElement("div");
7469
7473
  return e.id = `mapbox-context-menu-container-${Date.now()}`, e.style.cssText = `
7470
7474
  position: fixed;
@@ -7473,65 +7477,65 @@ const Mapbox = forwardRef((e, c) => {
7473
7477
  width: 100%;
7474
7478
  pointer-events: none;
7475
7479
  height: 100%;
7476
- z-index: ${(I?.zIndex ?? 1e3) + 100};
7477
- `, document.body.appendChild(e), Xe.current = e, () => {
7480
+ z-index: ${(P?.zIndex ?? 1e3) + 100};
7481
+ `, document.body.appendChild(e), Qe.current = e, () => {
7478
7482
  document.body.contains(e) && document.body.removeChild(e);
7479
7483
  };
7480
- }, [I?.zIndex]);
7481
- let Tn = useRef(E);
7482
- Tn.current = E;
7483
- let En = useRef(Ie);
7484
- En.current = Ie;
7485
- let Dn = useRef(Ct);
7486
- Dn.current = Ct;
7487
- let On = useRef($e);
7488
- On.current = $e;
7489
- let kn = useRef(b);
7490
- kn.current = b;
7491
- let An = useRef(it);
7492
- An.current = it;
7493
- let jn = useRef(at);
7494
- jn.current = at;
7495
- let Mn = useRef(ot);
7496
- Mn.current = ot;
7497
- let $ = useRef(v);
7498
- $.current = v;
7499
- let Nn = useRef(O);
7500
- Nn.current = O, useEffect(() => {
7484
+ }, [P?.zIndex]);
7485
+ let En = useRef(w);
7486
+ En.current = w;
7487
+ let Dn = useRef(Re);
7488
+ Dn.current = Re;
7489
+ let On = useRef(wt);
7490
+ On.current = wt;
7491
+ let kn = useRef(tt);
7492
+ kn.current = tt;
7493
+ let An = useRef(y);
7494
+ An.current = y;
7495
+ let jn = useRef(ot);
7496
+ jn.current = ot;
7497
+ let Mn = useRef(st);
7498
+ Mn.current = st;
7499
+ let Nn = useRef(ct);
7500
+ Nn.current = ct;
7501
+ let Q = useRef(_);
7502
+ Q.current = _;
7503
+ let Pn = useRef(E);
7504
+ Pn.current = E, useEffect(() => {
7501
7505
  let e = (e) => {
7502
- if (e.key === "Escape" && Y.current) {
7503
- R.current.get(Y.current.entityId)?.cancelEditPreview?.(), Y.current = null;
7506
+ if (e.key === "Escape" && J.current) {
7507
+ I.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7504
7508
  return;
7505
7509
  }
7506
- if (e.key === "Escape" && $e === "edit") {
7507
- if (it && (H(null), U(null), X()), at === "rectangle") if (ot) st(null), It();
7510
+ if (e.key === "Escape" && tt === "edit") {
7511
+ if (ot && (B(null), V(null), Y()), st === "rectangle") if (ct) lt(null), Lt();
7508
7512
  else {
7509
- U(null);
7510
- let e = L.current;
7513
+ V(null);
7514
+ let e = F.current;
7511
7515
  e && (e.getCanvas().style.cursor = "");
7512
7516
  }
7513
- if (at === "circle") if (lt.current) lt.current = null, Vt();
7517
+ if (st === "circle") if (dt.current) dt.current = null, Ht();
7514
7518
  else {
7515
- U(null);
7516
- let e = L.current;
7519
+ V(null);
7520
+ let e = F.current;
7517
7521
  e && (e.getCanvas().style.cursor = "");
7518
7522
  }
7519
- if (at === "polygon") if (ut.current.length > 0) ut.current = [], Gt();
7523
+ if (st === "polygon") if (ft.current.length > 0) ft.current = [], Kt();
7520
7524
  else {
7521
- U(null);
7522
- let e = L.current;
7525
+ V(null);
7526
+ let e = F.current;
7523
7527
  e && (e.getCanvas().style.cursor = "");
7524
7528
  }
7525
- if (at === "square") if (dt.current) dt.current = null, Xt();
7529
+ if (st === "square") if (pt.current) pt.current = null, Zt();
7526
7530
  else {
7527
- U(null);
7528
- let e = L.current;
7531
+ V(null);
7532
+ let e = F.current;
7529
7533
  e && (e.getCanvas().style.cursor = "");
7530
7534
  }
7531
- if (at === "polyline") if (pt.current.length > 0) pt.current = [], en();
7535
+ if (st === "polyline") if (mt.current.length > 0) mt.current = [], tn();
7532
7536
  else {
7533
- U(null);
7534
- let e = L.current;
7537
+ V(null);
7538
+ let e = F.current;
7535
7539
  e && (e.getCanvas().style.cursor = "");
7536
7540
  }
7537
7541
  }
@@ -7540,62 +7544,62 @@ const Mapbox = forwardRef((e, c) => {
7540
7544
  document.removeEventListener("keydown", e);
7541
7545
  };
7542
7546
  }, [
7543
- $e,
7544
- it,
7545
- at,
7547
+ tt,
7546
7548
  ot,
7547
- X,
7548
- It,
7549
- Vt,
7550
- Gt,
7551
- Xt,
7552
- en
7549
+ st,
7550
+ ct,
7551
+ Y,
7552
+ Lt,
7553
+ Ht,
7554
+ Kt,
7555
+ Zt,
7556
+ tn
7553
7557
  ]), useEffect(() => {
7554
- let e = L.current;
7555
- if (!e || !B) return;
7556
- let t = B.entityId, n = B.config, r = () => {
7557
- let r = Tn.current.find((e) => e.id === t);
7558
+ let e = F.current;
7559
+ if (!e || !R) return;
7560
+ let t = R.entityId, n = R.config, r = () => {
7561
+ let r = En.current.find((e) => e.id === t);
7558
7562
  if (!r) {
7559
- Tt();
7563
+ Et();
7560
7564
  return;
7561
7565
  }
7562
- let { position: i } = calculatePopupPosition(r, n, e, void 0, Ke.current);
7563
- Ke.current && (Ke.current.style.left = `${i.x}px`, Ke.current.style.top = `${i.y}px`);
7566
+ let { position: i } = calculatePopupPosition(r, n, e, void 0, Je.current);
7567
+ Je.current && (Je.current.style.left = `${i.x}px`, Je.current.style.top = `${i.y}px`);
7564
7568
  }, i = setTimeout(() => {
7565
7569
  r();
7566
7570
  }, 50);
7567
7571
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
7568
7572
  clearTimeout(i), e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
7569
7573
  };
7570
- }, [B?.entityId, Tt]), useEffect(() => {
7571
- let e = L.current, t = Ve.current;
7572
- if (!e || !Je || !t) return;
7573
- let n = Je.lngLat, r = () => {
7574
+ }, [R?.entityId, Et]), useEffect(() => {
7575
+ let e = F.current, t = Ue.current;
7576
+ if (!e || !Xe || !t) return;
7577
+ let n = Xe.lngLat, r = () => {
7574
7578
  let r = e.project(n), i = t.clientWidth, a = t.clientHeight;
7575
7579
  if (r.x < 0 || r.x > i || r.y < 0 || r.y > a) {
7576
- wn();
7580
+ Tn();
7577
7581
  return;
7578
7582
  }
7579
7583
  let o = t.getBoundingClientRect(), s = r.x + o.left, c = r.y + o.top;
7580
- Ze.current && (Ze.current.style.left = `${s}px`, Ze.current.style.top = `${c}px`);
7584
+ $e.current && ($e.current.style.left = `${s}px`, $e.current.style.top = `${c}px`);
7581
7585
  };
7582
7586
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
7583
7587
  e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
7584
7588
  };
7585
- }, [Je?.lngLat, wn]), useEffect(() => {
7586
- if (!Ve.current) return;
7589
+ }, [Xe?.lngLat, Tn]), useEffect(() => {
7590
+ if (!Ue.current) return;
7587
7591
  let e = {
7588
7592
  version: 8,
7589
7593
  sources: {},
7590
7594
  layers: []
7591
- }, { dragPan: t = !0, scrollZoom: n = !0, doubleClickZoom: r = !0, touchZoomRotate: i = !0, keyboard: a = !0, dragRotate: o = !0, pitchWithRotate: c = !0, touchPitch: p = !0, boxZoom: m = !0 } = x, _ = new mapboxgl.Map({
7592
- container: Ve.current,
7593
- style: h || e,
7595
+ }, { dragPan: t = !0, scrollZoom: n = !0, doubleClickZoom: r = !0, touchZoomRotate: i = !0, keyboard: a = !0, dragRotate: o = !0, pitchWithRotate: c = !0, touchPitch: p = !0, boxZoom: ve = !0 } = b, g = new mapboxgl.Map({
7596
+ container: Ue.current,
7597
+ style: m || e,
7594
7598
  center: l,
7595
7599
  zoom: u,
7596
7600
  pitch: d,
7597
7601
  bearing: f,
7598
- maxBounds: g,
7602
+ maxBounds: h,
7599
7603
  dragPan: t,
7600
7604
  scrollZoom: n,
7601
7605
  doubleClickZoom: r,
@@ -7604,7 +7608,7 @@ const Mapbox = forwardRef((e, c) => {
7604
7608
  dragRotate: o,
7605
7609
  pitchWithRotate: c,
7606
7610
  touchPitch: p,
7607
- boxZoom: m,
7611
+ boxZoom: ve,
7608
7612
  transformRequest: (e, t) => {
7609
7613
  if (t === "Glyphs") {
7610
7614
  let t = e.match(/\/fonts\/([^/]+)\/(\d+-\d+)\.pbf/);
@@ -7616,98 +7620,98 @@ const Mapbox = forwardRef((e, c) => {
7616
7620
  return { url: e };
7617
7621
  }
7618
7622
  });
7619
- return L.current = _, _.on("load", () => {
7620
- if (!_.getStyle().glyphs) {
7621
- let e = _.style, t = "/gis-fonts/{fontstack}/{range}.pbf";
7623
+ return F.current = g, g.on("load", () => {
7624
+ if (!g.getStyle().glyphs) {
7625
+ let e = g.style, t = "/gis-fonts/{fontstack}/{range}.pbf";
7622
7626
  e.glyphs = t, e.stylesheet && (e.stylesheet.glyphs = t);
7623
7627
  }
7624
- z.current.clear(), E.forEach((e) => {
7625
- z.current.set(e.id, e);
7626
- }), vn(S), un(), Pt(), Lt(), Ut(), qt(), Qt(), Qe(_), Fe?.(_);
7627
- }), _.on("click", bn), _.on("mousemove", xn), _.on("contextmenu", Sn), () => {
7628
- _.off("click", bn), _.off("mousemove", xn), _.off("contextmenu", Sn), dn(), At(), X(), Z(), Q(), _.remove(), L.current = null;
7628
+ L.current.clear(), w.forEach((e) => {
7629
+ L.current.set(e.id, e);
7630
+ }), yn(x), dn(), Ft(), Rt(), Wt(), Jt(), $t(), et(g), Le?.(g);
7631
+ }), g.on("click", xn), g.on("mousemove", Sn), g.on("contextmenu", Cn), () => {
7632
+ g.off("click", xn), g.off("mousemove", Sn), g.off("contextmenu", Cn), fn(), jt(), Y(), X(), Z(), g.remove(), F.current = null;
7629
7633
  };
7630
7634
  }, []), useEffect(() => {
7631
- if (L.current) {
7632
- if (!L.current.isStyleLoaded()) {
7633
- L.current.once("load", () => {
7634
- z.current.clear(), E.forEach((e) => {
7635
- z.current.set(e.id, e);
7636
- }), un();
7635
+ if (F.current) {
7636
+ if (!F.current.isStyleLoaded()) {
7637
+ F.current.once("load", () => {
7638
+ L.current.clear(), w.forEach((e) => {
7639
+ L.current.set(e.id, e);
7640
+ }), dn();
7637
7641
  });
7638
7642
  return;
7639
7643
  }
7640
- z.current.clear(), E.forEach((e) => {
7641
- z.current.set(e.id, e);
7642
- }), un();
7644
+ L.current.clear(), w.forEach((e) => {
7645
+ L.current.set(e.id, e);
7646
+ }), dn();
7643
7647
  }
7644
- }, [E, un]), useEffect(() => {
7645
- !L.current || !L.current.isStyleLoaded() || (dn(), un());
7648
+ }, [w, dn]), useEffect(() => {
7649
+ !F.current || !F.current.isStyleLoaded() || (fn(), dn());
7646
7650
  }, [
7651
+ D,
7652
+ O,
7647
7653
  k,
7648
7654
  A,
7649
7655
  j,
7650
- M,
7651
- N,
7652
- dn,
7653
- un
7656
+ fn,
7657
+ dn
7654
7658
  ]), useEffect(() => {
7655
- if (L.current) {
7656
- if (!L.current.isStyleLoaded()) {
7657
- L.current.once("load", () => {
7658
- vn(S);
7659
+ if (F.current) {
7660
+ if (!F.current.isStyleLoaded()) {
7661
+ F.current.once("load", () => {
7662
+ yn(x);
7659
7663
  });
7660
7664
  return;
7661
7665
  }
7662
- vn(S);
7663
- }
7664
- }, [S, vn]);
7665
- let Pn = useRef(void 0), Fn = useRef(!0), In = useRef(S);
7666
- In.current = S;
7667
- let Ln = useRef(vn);
7668
- Ln.current = vn;
7669
- let Rn = useRef(dn);
7670
- Rn.current = dn;
7671
- let zn = useRef(un);
7672
- zn.current = un;
7673
- let Bn = useRef(Pt);
7674
- Bn.current = Pt;
7675
- let Vn = useRef(Lt);
7676
- Vn.current = Lt;
7677
- let Hn = useRef(Ut);
7678
- Hn.current = Ut;
7679
- let Un = useRef(qt);
7680
- Un.current = qt;
7681
- let Wn = useRef(Qt);
7682
- Wn.current = Qt, useEffect(() => {
7683
- let e = L.current;
7666
+ yn(x);
7667
+ }
7668
+ }, [x, yn]);
7669
+ let Fn = useRef(void 0), In = useRef(!0), Ln = useRef(x);
7670
+ Ln.current = x;
7671
+ let Rn = useRef(yn);
7672
+ Rn.current = yn;
7673
+ let zn = useRef(fn);
7674
+ zn.current = fn;
7675
+ let Bn = useRef(dn);
7676
+ Bn.current = dn;
7677
+ let Vn = useRef(Ft);
7678
+ Vn.current = Ft;
7679
+ let Hn = useRef(Rt);
7680
+ Hn.current = Rt;
7681
+ let Un = useRef(Wt);
7682
+ Un.current = Wt;
7683
+ let Wn = useRef(Jt);
7684
+ Wn.current = Jt;
7685
+ let Gn = useRef($t);
7686
+ Gn.current = $t, useEffect(() => {
7687
+ let e = F.current;
7684
7688
  if (!e) return;
7685
- let t = h || {
7689
+ let t = m || {
7686
7690
  version: 8,
7687
7691
  sources: {},
7688
7692
  layers: []
7689
7693
  };
7690
- if (Fn.current) {
7691
- Fn.current = !1, Pn.current = h;
7694
+ if (In.current) {
7695
+ In.current = !1, Fn.current = m;
7692
7696
  return;
7693
7697
  }
7694
- Pn.current !== h && (Pn.current = h, e.setStyle(t), e.once("style.load", () => {
7698
+ Fn.current !== m && (Fn.current = m, e.setStyle(t), e.once("style.load", () => {
7695
7699
  if (!e.getStyle().glyphs) {
7696
7700
  let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
7697
7701
  t.glyphs = n, t.stylesheet && (t.stylesheet.glyphs = n);
7698
7702
  }
7699
- Ue.current.clear(), Ln.current(In.current), Rn.current(), zn.current(), Bn.current(), Vn.current(), Hn.current(), Un.current(), Wn.current();
7703
+ Ge.current.clear(), Rn.current(Ln.current), zn.current(), Bn.current(), Vn.current(), Hn.current(), Un.current(), Wn.current(), Gn.current();
7700
7704
  }));
7701
- }, [h]), useEffect(() => {
7702
- let e = new Set(D.map(String));
7703
- for (let [t, n] of R.current) n.setSelected(e.has(String(t)));
7704
- }, [D]);
7705
- let Gn = useRef({});
7705
+ }, [m]), useEffect(() => {
7706
+ let e = new Set(T.map(String));
7707
+ for (let [t, n] of I.current) n.setSelected(e.has(String(t)));
7708
+ }, [T]);
7709
+ let Kn = useRef({});
7706
7710
  useEffect(() => {
7707
- let e = L.current;
7711
+ let e = F.current;
7708
7712
  if (!e) return;
7709
- let t = Gn.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;
7710
- !n && !r && !i && !a || (Gn.current = {
7713
+ let t = Kn.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;
7714
+ !n && !r && !i && !a || (Kn.current = {
7711
7715
  center: l,
7712
7716
  zoom: u,
7713
7717
  pitch: d,
@@ -7724,86 +7728,89 @@ const Mapbox = forwardRef((e, c) => {
7724
7728
  d,
7725
7729
  f
7726
7730
  ]);
7727
- let Kn = (() => Ce === !1 ? null : Ce === !0 ? { enabled: !0 } : Ce)(), qn = (() => P === !1 ? null : P === !0 ? { enabled: !0 } : P)(), Jn = (() => we === !1 ? null : we === !0 ? { enabled: !0 } : we)(), Yn = (() => {
7728
- if (Te === !1) return null;
7729
- let e, t;
7730
- if (S && S.length > 0) {
7731
- let n = S.find((e) => e.hasRoadNetwork === !0) || S[0];
7732
- if (n.type === "style") {
7733
- let t = L.current?.getStyle();
7731
+ let qn = (() => Te === !1 ? null : Te === !0 ? { enabled: !0 } : Te)(), Jn = (() => M === !1 ? null : M === !0 ? { enabled: !0 } : M)(), Yn = (() => Ee === !1 ? null : Ee === !0 ? { enabled: !0 } : Ee)(), $ = (() => {
7732
+ if (De === !1) return null;
7733
+ let e, t, n;
7734
+ if (x && x.length > 0) {
7735
+ let r = x.find((e) => e.hasRoadNetwork === !0) || x[0];
7736
+ if (r.type === "style") {
7737
+ let t = F.current?.getStyle();
7734
7738
  if (t?.sources) {
7735
- let r = `base-layer-source-${n.id}-`, i = Object.keys(t.sources).find((e) => e.startsWith(r));
7739
+ let n = `base-layer-source-${r.id}-`, i = Object.keys(t.sources).find((e) => e.startsWith(n));
7736
7740
  i && (e = i);
7737
7741
  }
7738
- } else e = `base-layer-source-${n.id}`;
7739
- t = n.roadNetworkSourceLayer || "road";
7742
+ } else e = `base-layer-source-${r.id}`;
7743
+ t = r.roadNetworkSourceLayer || "road", n = r.roadNetworkClassField;
7740
7744
  }
7741
- return Te === !0 ? {
7745
+ return De === !0 ? {
7742
7746
  enabled: !0,
7743
7747
  source: e,
7744
- sourceLayer: t
7748
+ sourceLayer: t,
7749
+ classField: n
7745
7750
  } : {
7746
- ...Te,
7747
- source: Te.source || e,
7748
- sourceLayer: Te.sourceLayer || t
7751
+ ...De,
7752
+ source: De.source || e,
7753
+ sourceLayer: De.sourceLayer || t,
7754
+ classField: De.classField || n
7749
7755
  };
7750
- })(), Xn = (() => Ee ? Ee === !0 ? { enabled: !0 } : Ee : null)(), Zn = (() => Ae ? Ae === !0 ? { enabled: !0 } : Ae : null)(), Qn = (() => je || null)(), $n = useMemo(() => {
7756
+ })(), Xn = (() => Oe ? Oe === !0 ? { enabled: !0 } : Oe : null)(), Zn = (() => Me ? Me === !0 ? { enabled: !0 } : Me : null)(), Qn = (() => Ne || null)(), $n = useMemo(() => {
7751
7757
  let e = [];
7752
- for (let t of S) if (t.applyRasterPaint) if (t.type === "style") {
7753
- let n = L.current;
7758
+ for (let t of x) if (t.applyRasterPaint) if (t.type === "style") {
7759
+ let n = F.current;
7754
7760
  if (n) {
7755
7761
  let r = `base-layer-${t.id}-`, i = n.getStyle();
7756
7762
  if (i?.layers) for (let t of i.layers) t.id.startsWith(r) && t.type === "raster" && e.push(t.id);
7757
7763
  }
7758
7764
  } else e.push(`base-layer-${t.id}`);
7759
7765
  return e;
7760
- }, [S, V]);
7766
+ }, [x, z]);
7761
7767
  return /* @__PURE__ */ jsxs("div", {
7762
- className: `comp-mapbox ${$e === "picker" ? "comp-mapbox--picker-mode" : ""} ${ze}`,
7763
- style: Be,
7768
+ className: `comp-mapbox ${tt === "picker" ? "comp-mapbox--picker-mode" : ""} ${Ve}`,
7769
+ style: He,
7764
7770
  children: [
7765
7771
  /* @__PURE__ */ jsx("div", {
7766
- ref: Ve,
7772
+ ref: Ue,
7767
7773
  className: "comp-mapbox__map"
7768
7774
  }),
7769
- $e === "picker" && y.showCrosshair === !0 && /* @__PURE__ */ jsxs("div", {
7775
+ tt === "picker" && v.showCrosshair === !0 && /* @__PURE__ */ jsxs("div", {
7770
7776
  className: "comp-mapbox__crosshair",
7771
7777
  children: [/* @__PURE__ */ jsx("div", {
7772
7778
  className: "comp-mapbox__crosshair-h",
7773
- style: y.crosshairColor ? { backgroundColor: y.crosshairColor } : void 0
7779
+ style: v.crosshairColor ? { backgroundColor: v.crosshairColor } : void 0
7774
7780
  }), /* @__PURE__ */ jsx("div", {
7775
7781
  className: "comp-mapbox__crosshair-v",
7776
- style: y.crosshairColor ? { backgroundColor: y.crosshairColor } : void 0
7782
+ style: v.crosshairColor ? { backgroundColor: v.crosshairColor } : void 0
7777
7783
  })]
7778
7784
  }),
7779
- $e === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) || Yn && Yn.enabled !== !1 || Qn && Qn.enabled !== !1 ? /* @__PURE__ */ jsxs("div", {
7785
+ tt === "edit" && _.showEditTools !== !1 && (_.markerTemplates && _.markerTemplates.length > 0 || _.showRectangleTool || _.showCircleTool || _.showPolygonTool || _.showSquareTool || _.showPolylineTool) || $ && $.enabled !== !1 || Qn && Qn.enabled !== !1 ? /* @__PURE__ */ jsxs("div", {
7780
7786
  className: "comp-mapbox__edit-controls",
7781
7787
  children: [
7782
- $e === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
7783
- markerTemplates: v.markerTemplates || [],
7784
- selectedTemplate: it,
7785
- onTemplateSelect: tn,
7786
- drawMode: at,
7787
- onDrawModeChange: nn,
7788
- showRectangleTool: v.showRectangleTool,
7789
- showCircleTool: v.showCircleTool,
7790
- showPolygonTool: v.showPolygonTool,
7791
- showSquareTool: v.showSquareTool,
7792
- showPolylineTool: v.showPolylineTool
7788
+ tt === "edit" && _.showEditTools !== !1 && (_.markerTemplates && _.markerTemplates.length > 0 || _.showRectangleTool || _.showCircleTool || _.showPolygonTool || _.showSquareTool || _.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
7789
+ markerTemplates: _.markerTemplates || [],
7790
+ selectedTemplate: ot,
7791
+ onTemplateSelect: nn,
7792
+ drawMode: st,
7793
+ onDrawModeChange: rn,
7794
+ showRectangleTool: _.showRectangleTool,
7795
+ showCircleTool: _.showCircleTool,
7796
+ showPolygonTool: _.showPolygonTool,
7797
+ showSquareTool: _.showSquareTool,
7798
+ showPolylineTool: _.showPolylineTool
7793
7799
  }),
7794
- Yn && Yn.enabled !== !1 && /* @__PURE__ */ jsx(RoadHighlightControl, {
7795
- map: V,
7796
- highlightWidth: Yn.highlightWidth,
7797
- defaultRoadTypes: Yn.defaultRoadTypes,
7798
- defaultMinWidth: Yn.defaultMinWidth,
7799
- source: Yn.source,
7800
- sourceLayer: Yn.sourceLayer,
7801
- className: Yn.className,
7802
- style: Yn.style
7800
+ $ && $.enabled !== !1 && /* @__PURE__ */ jsx(RoadHighlightControl, {
7801
+ map: z,
7802
+ highlightWidth: $.highlightWidth,
7803
+ defaultRoadTypes: $.defaultRoadTypes,
7804
+ defaultMinWidth: $.defaultMinWidth,
7805
+ source: $.source,
7806
+ sourceLayer: $.sourceLayer,
7807
+ classField: $.classField,
7808
+ className: $.className,
7809
+ style: $.style
7803
7810
  }),
7804
7811
  Qn && Qn.enabled !== !1 && /* @__PURE__ */ jsx(RoutePlanningControl, {
7805
- ref: He,
7806
- map: V,
7812
+ ref: We,
7813
+ map: z,
7807
7814
  pointCount: Qn.pointCount,
7808
7815
  showPointCountInput: Qn.showPointCountInput,
7809
7816
  visualType: Qn.visualType,
@@ -7811,67 +7818,67 @@ const Mapbox = forwardRef((e, c) => {
7811
7818
  })
7812
7819
  ]
7813
7820
  }) : null,
7814
- (Kn?.enabled !== !1 || qn?.enabled !== !1 || Jn?.enabled !== !1 || Xn && Xn.enabled !== !1 || Zn && Zn.enabled !== !1) && /* @__PURE__ */ jsxs("div", {
7821
+ (qn?.enabled !== !1 || Jn?.enabled !== !1 || Yn?.enabled !== !1 || Xn && Xn.enabled !== !1 || Zn && Zn.enabled !== !1) && /* @__PURE__ */ jsxs("div", {
7815
7822
  className: "comp-mapbox__controls",
7816
7823
  children: [
7817
- Kn && Kn.enabled !== !1 && /* @__PURE__ */ jsx(CoordinateDisplay, {
7818
- map: V,
7819
- precision: Kn.precision,
7820
- className: Kn.className,
7821
- style: Kn.style
7822
- }),
7823
- qn && qn.enabled !== !1 && /* @__PURE__ */ jsx(ScaleControl, {
7824
- map: V,
7825
- maxWidth: qn.maxWidth,
7826
- unit: qn.unit,
7824
+ qn && qn.enabled !== !1 && /* @__PURE__ */ jsx(CoordinateDisplay, {
7825
+ map: z,
7826
+ precision: qn.precision,
7827
7827
  className: qn.className,
7828
7828
  style: qn.style
7829
7829
  }),
7830
+ Jn && Jn.enabled !== !1 && /* @__PURE__ */ jsx(ScaleControl, {
7831
+ map: z,
7832
+ maxWidth: Jn.maxWidth,
7833
+ unit: Jn.unit,
7834
+ className: Jn.className,
7835
+ style: Jn.style
7836
+ }),
7830
7837
  Xn && Xn.enabled !== !1 && /* @__PURE__ */ jsx(MeasureControl, {
7831
- map: V,
7832
- entityConfig: O,
7838
+ map: z,
7839
+ entityConfig: E,
7833
7840
  onDrawModeChange: (e) => {
7834
- ht.current = e;
7841
+ gt.current = e;
7835
7842
  },
7836
7843
  className: Xn.className,
7837
7844
  style: Xn.style
7838
7845
  }),
7839
7846
  Zn && Zn.enabled !== !1 && /* @__PURE__ */ jsx(RasterPaintControl, {
7840
- map: V,
7841
- value: T,
7842
- onChange: Me,
7847
+ map: z,
7848
+ value: C,
7849
+ onChange: Pe,
7843
7850
  rasterPaintLayerIds: $n,
7844
7851
  className: Zn.className,
7845
7852
  style: Zn.style
7846
7853
  }),
7847
- Jn && Jn.enabled !== !1 && /* @__PURE__ */ jsx(ResetViewControl, {
7848
- map: V,
7854
+ Yn && Yn.enabled !== !1 && /* @__PURE__ */ jsx(ResetViewControl, {
7855
+ map: z,
7849
7856
  initialCenter: l,
7850
7857
  initialZoom: u,
7851
7858
  initialPitch: d,
7852
7859
  initialBearing: f,
7853
- duration: Jn.duration,
7854
- className: Jn.className,
7855
- style: Jn.style
7860
+ duration: Yn.duration,
7861
+ className: Yn.className,
7862
+ style: Yn.style
7856
7863
  })
7857
7864
  ]
7858
7865
  }),
7859
7866
  !(Qn && Qn.enabled !== !1) && /* @__PURE__ */ jsx(RoutePlanningControl, {
7860
- ref: He,
7861
- map: V,
7867
+ ref: We,
7868
+ map: z,
7862
7869
  showButton: !1
7863
7870
  }),
7864
- B && Ge.current && /* @__PURE__ */ jsx(EntityPopup, {
7865
- popupState: B,
7866
- onClose: () => wt(B.entityId),
7867
- portalContainer: Ge.current,
7868
- popupRef: Ke
7871
+ R && qe.current && /* @__PURE__ */ jsx(EntityPopup, {
7872
+ popupState: R,
7873
+ onClose: () => Tt(R.entityId),
7874
+ portalContainer: qe.current,
7875
+ popupRef: Je
7869
7876
  }),
7870
- Je && Xe.current && /* @__PURE__ */ jsx(ContextMenu, {
7871
- menuState: Je,
7872
- onClose: wn,
7873
- portalContainer: Xe.current,
7874
- menuRef: Ze
7877
+ Xe && Qe.current && /* @__PURE__ */ jsx(ContextMenu, {
7878
+ menuState: Xe,
7879
+ onClose: Tn,
7880
+ portalContainer: Qe.current,
7881
+ menuRef: $e
7875
7882
  })
7876
7883
  ]
7877
7884
  });