bbl-mapbox-react 0.0.19 → 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.
Files changed (3) hide show
  1. package/dist/index.cjs +19 -19
  2. package/dist/index.mjs +711 -710
  3. package/package.json +1 -1
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,8 +4167,8 @@ 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, classField: d = "class", className: f = "", style: g }) {
4171
- let [_, v] = useState(!1), [y, b] = useState(i), [x, S] = useState(!1), C = useRef(!1), ve = useRef(null), w = useRef(null), T = useRef(null), E = useCallback((e, t, n) => {
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
4172
  if (!e.isStyleLoaded() || !e.getSource(t)) return !1;
4173
4173
  let i = !0;
4174
4174
  return ROAD_TYPE_OPTIONS.forEach((a) => {
@@ -4204,13 +4204,13 @@ 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 ? E(e, t, n) && (C.current = !0, S(!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
4212
  }, r = () => {
4213
- C.current || t();
4213
+ S.current || t();
4214
4214
  };
4215
4215
  return e.on("styledata", n), e.on("sourcedata", r), () => {
4216
4216
  e.off("styledata", n), e.off("sourcedata", r);
@@ -4219,12 +4219,12 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4219
4219
  e,
4220
4220
  l,
4221
4221
  u,
4222
- E
4222
+ T
4223
4223
  ]), useEffect(() => {
4224
- !e || !x || ROAD_TYPE_OPTIONS.forEach((t) => {
4224
+ !e || !b || ROAD_TYPE_OPTIONS.forEach((t) => {
4225
4225
  let n = `${LAYER_ID_PREFIX}${t.class}`;
4226
4226
  if (e.getLayer(n)) try {
4227
- let r = y.includes(t.class);
4227
+ let r = v.includes(t.class);
4228
4228
  e.setLayoutProperty(n, "visibility", r ? "visible" : "none");
4229
4229
  } catch (e) {
4230
4230
  console.error(`Failed to update layer ${n}:`, e);
@@ -4232,38 +4232,38 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4232
4232
  });
4233
4233
  }, [
4234
4234
  e,
4235
- x,
4236
- y
4235
+ b,
4236
+ v
4237
4237
  ]), useEffect(() => {
4238
- if (!_) return;
4238
+ if (!g) return;
4239
4239
  let e = (e) => {
4240
- ve.current && !ve.current.contains(e.target) && w.current && !w.current.contains(e.target) && v(!1);
4240
+ ye.current && !ye.current.contains(e.target) && C.current && !C.current.contains(e.target) && _(!1);
4241
4241
  }, t = setTimeout(() => {
4242
4242
  document.addEventListener("mousedown", e);
4243
4243
  }, 0);
4244
4244
  return () => {
4245
4245
  clearTimeout(t), document.removeEventListener("mousedown", e);
4246
4246
  };
4247
- }, [_]), useEffect(() => () => {
4247
+ }, [g]), useEffect(() => () => {
4248
4248
  e && e.getStyle() && ROAD_TYPE_OPTIONS.forEach((t) => {
4249
4249
  let n = `${LAYER_ID_PREFIX}${t.class}`;
4250
4250
  if (e.getLayer(n)) try {
4251
4251
  e.removeLayer(n);
4252
4252
  } catch {}
4253
- }), T.current &&= (T.current.remove(), null);
4253
+ }), w.current &&= (w.current.remove(), null);
4254
4254
  }, [e]);
4255
- let ye = useCallback((e) => ROAD_TYPE_OPTIONS.find((t) => t.class === e)?.label || e, []), be = useCallback((t) => {
4256
- if (!e || y.length === 0) {
4257
- T.current && T.current.remove(), e?.getCanvas().style.cursor && (e.getCanvas().style.cursor = "");
4255
+ let be = useCallback((e) => ROAD_TYPE_OPTIONS.find((t) => t.class === e)?.label || e, []), xe = useCallback((t) => {
4256
+ if (!e || v.length === 0) {
4257
+ w.current && w.current.remove(), e?.getCanvas().style.cursor && (e.getCanvas().style.cursor = "");
4258
4258
  return;
4259
4259
  }
4260
- let n = y.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)) });
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)) });
4261
4261
  if (i.length > 0) {
4262
- 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 = [];
4263
4263
  m(o) && h.push(`
4264
4264
  <div class="road-highlight-popup__row">
4265
4265
  <span>道路类型:</span>
4266
- <span class="road-highlight-popup__value">${ye(o)}</span>
4266
+ <span class="road-highlight-popup__value">${be(o)}</span>
4267
4267
  </div>
4268
4268
  `), h.push(`
4269
4269
  <div class="road-highlight-popup__row">
@@ -4290,20 +4290,20 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4290
4290
  <span>单行道:</span>
4291
4291
  <span class="road-highlight-popup__value">${u ? "是" : "否"}</span>
4292
4292
  </div>
4293
- `), m(d) && h.push(`
4293
+ `), m(f) && h.push(`
4294
4294
  <div class="road-highlight-popup__row">
4295
4295
  <span>层级:</span>
4296
- <span class="road-highlight-popup__value">${d}</span>
4296
+ <span class="road-highlight-popup__value">${f}</span>
4297
4297
  </div>
4298
- `), m(f) && h.push(`
4298
+ `), m(p) && h.push(`
4299
4299
  <div class="road-highlight-popup__row">
4300
4300
  <span>国家代码:</span>
4301
- <span class="road-highlight-popup__value">${f}</span>
4301
+ <span class="road-highlight-popup__value">${p}</span>
4302
4302
  </div>
4303
- `), m(p) && h.push(`
4303
+ `), m(ve) && h.push(`
4304
4304
  <div class="road-highlight-popup__row">
4305
4305
  <span>地区代码:</span>
4306
- <span class="road-highlight-popup__value">${p}</span>
4306
+ <span class="road-highlight-popup__value">${ve}</span>
4307
4307
  </div>
4308
4308
  `);
4309
4309
  let g = `
@@ -4312,47 +4312,48 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4312
4312
  <div class="road-highlight-popup__info">${h.join("")}</div>
4313
4313
  </div>
4314
4314
  `;
4315
- T.current ||= new mapboxgl.Popup({
4315
+ w.current ||= new mapboxgl.Popup({
4316
4316
  closeButton: !1,
4317
4317
  closeOnClick: !1,
4318
4318
  offset: 15,
4319
4319
  className: "road-highlight-popup"
4320
- }), T.current.setLngLat(r).setHTML(g).addTo(e), e.getCanvas().style.cursor = "pointer";
4321
- } else T.current && T.current.remove(), e.getCanvas().style.cursor = "";
4320
+ }), w.current.setLngLat(r).setHTML(g).addTo(e), e.getCanvas().style.cursor = "pointer";
4321
+ } else w.current && w.current.remove(), e.getCanvas().style.cursor = "";
4322
4322
  }, [
4323
4323
  e,
4324
- y,
4325
- ye
4324
+ v,
4325
+ be,
4326
+ d
4326
4327
  ]);
4327
4328
  useEffect(() => {
4328
- if (!(!e || !x)) return e.on("mousemove", be), () => {
4329
- e.off("mousemove", be), T.current && T.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 = "";
4330
4331
  };
4331
4332
  }, [
4332
4333
  e,
4333
- x,
4334
- be
4334
+ b,
4335
+ xe
4335
4336
  ]);
4336
- let O = (e, t) => {
4337
- b((n) => t ? [...n, e] : n.filter((t) => t !== e));
4338
- }, xe = (e) => {
4339
- b(e ? ROAD_TYPE_OPTIONS.map((e) => e.class) : []);
4340
- }, Se = y.length > 0;
4337
+ let D = (e, t) => {
4338
+ y((n) => t ? [...n, e] : n.filter((t) => t !== e));
4339
+ }, Se = (e) => {
4340
+ y(e ? ROAD_TYPE_OPTIONS.map((e) => e.class) : []);
4341
+ }, Ce = v.length > 0;
4341
4342
  return /* @__PURE__ */ jsxs("div", {
4342
4343
  className: `mapbox-road-highlight-control ${f}`,
4343
- style: g,
4344
+ style: h,
4344
4345
  children: [/* @__PURE__ */ jsxs("button", {
4345
- ref: w,
4346
- className: `mapbox-control-btn mapbox-road-highlight-control__btn ${Se ? "mapbox-road-highlight-control__btn--active" : ""}`,
4347
- onClick: () => v(!_),
4348
- title: `路网高亮${y.length > 0 ? ` (已选 ${y.length})` : ""}`,
4346
+ ref: C,
4347
+ className: `mapbox-control-btn mapbox-road-highlight-control__btn ${Ce ? "mapbox-road-highlight-control__btn--active" : ""}`,
4348
+ onClick: () => _(!g),
4349
+ title: `路网高亮${v.length > 0 ? ` (已选 ${v.length})` : ""}`,
4349
4350
  children: [/* @__PURE__ */ jsx("img", {
4350
4351
  src: road_default,
4351
4352
  alt: "road",
4352
4353
  className: "mapbox-road-highlight-control__btn-icon"
4353
- }), /* @__PURE__ */ jsxs("span", { children: ["路网", y.length > 0 ? ` (${y.length})` : ""] })]
4354
- }), _ && /* @__PURE__ */ jsxs("div", {
4355
- ref: ve,
4354
+ }), /* @__PURE__ */ jsxs("span", { children: ["路网", v.length > 0 ? ` (${v.length})` : ""] })]
4355
+ }), g && /* @__PURE__ */ jsxs("div", {
4356
+ ref: ye,
4356
4357
  className: "mapbox-road-highlight-control__panel",
4357
4358
  children: [
4358
4359
  /* @__PURE__ */ jsxs("div", {
@@ -4361,9 +4362,9 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4361
4362
  className: "mapbox-road-highlight-control__panel-title",
4362
4363
  children: "道路类型"
4363
4364
  }), /* @__PURE__ */ jsx(Checkbox, {
4364
- checked: y.length === ROAD_TYPE_OPTIONS.length,
4365
- indeterminate: y.length > 0 && y.length < ROAD_TYPE_OPTIONS.length,
4366
- onChange: xe,
4365
+ checked: v.length === ROAD_TYPE_OPTIONS.length,
4366
+ indeterminate: v.length > 0 && v.length < ROAD_TYPE_OPTIONS.length,
4367
+ onChange: Se,
4367
4368
  style: {
4368
4369
  "--color-text-1": "#fff",
4369
4370
  "--color-border-2": "rgba(255, 255, 255, 0.3)"
@@ -4380,11 +4381,11 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4380
4381
  className: "mapbox-road-highlight-control__type-list",
4381
4382
  children: ROAD_TYPE_OPTIONS.map((e) => /* @__PURE__ */ jsxs("div", {
4382
4383
  className: "mapbox-road-highlight-control__type-item",
4383
- onClick: () => O(e.class, !y.includes(e.class)),
4384
+ onClick: () => D(e.class, !v.includes(e.class)),
4384
4385
  children: [
4385
4386
  /* @__PURE__ */ jsx(Checkbox, {
4386
- checked: y.includes(e.class),
4387
- onChange: (t) => O(e.class, t),
4387
+ checked: v.includes(e.class),
4388
+ onChange: (t) => D(e.class, t),
4388
4389
  onClick: (e) => e.stopPropagation(),
4389
4390
  style: {
4390
4391
  "--color-text-1": "#fff",
@@ -4409,7 +4410,7 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4409
4410
  className: "mapbox-road-highlight-control__tip",
4410
4411
  children: "💡 选中道路类型后立即显示高亮"
4411
4412
  }),
4412
- !x && /* @__PURE__ */ jsx("div", {
4413
+ !b && /* @__PURE__ */ jsx("div", {
4413
4414
  className: "mapbox-road-highlight-control__warning",
4414
4415
  children: "⚠️ 正在初始化图层..."
4415
4416
  })
@@ -4658,64 +4659,64 @@ function clearAllPreviewSources(e) {
4658
4659
  ]) clearPreviewSource(e, `${PREVIEW_PREFIX}${t}`);
4659
4660
  }
4660
4661
  function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDrawModeChange: s, className: c = "", style: l }) {
4661
- let [u, d] = useState(!1), [f, g] = useState(null), [_, v] = useState({
4662
+ let [u, d] = useState(!1), [f, h] = useState(null), [g, _] = useState({
4662
4663
  showArea: !0,
4663
4664
  showLength: !0,
4664
4665
  showRadius: !0
4665
- }), y = r !== void 0, b = y ? {
4666
+ }), v = r !== void 0, y = v ? {
4666
4667
  showArea: r.showArea ?? !0,
4667
4668
  showLength: r.showLength ?? !0,
4668
4669
  showRadius: r.showRadius ?? !0
4669
- } : _, [x, S] = useState([]), C = useRef(/* @__PURE__ */ new Map()), w = useRef(0), T = useRef(null), E = useRef(null), D = useRef(null), O = useRef(null), k = useRef(null), A = useRef([]), j = useRef([]), M = useRef(b);
4670
- M.current = b;
4671
- let we = useRef(f);
4672
- we.current = f;
4673
- let N = useCallback(() => `measure-${++w.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}`, []);
4674
4675
  useEffect(() => {
4675
4676
  s?.(f !== null);
4676
4677
  }, [f, s]);
4677
- let Te = useRef(!1), Ee = useCallback(() => {
4678
- !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), Te.current = !0);
4678
+ let Ee = useRef(!1), De = useCallback(() => {
4679
+ !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), Ee.current = !0);
4679
4680
  }, [e]);
4680
4681
  useEffect(() => {
4681
4682
  if (!e) return;
4682
4683
  let t = () => {
4683
- initAllPreviewLayers(e), Te.current = !0;
4684
+ initAllPreviewLayers(e), Ee.current = !0;
4684
4685
  };
4685
4686
  e.isStyleLoaded() ? t() : e.once("load", t);
4686
4687
  let n = () => {
4687
- Te.current = !1;
4688
+ Ee.current = !1;
4688
4689
  };
4689
4690
  return e.on("style.load", n), () => {
4690
4691
  e.off("style.load", n);
4691
4692
  };
4692
4693
  }, [e]), useEffect(() => {
4693
4694
  let e = (e) => {
4694
- T.current && !T.current.contains(e.target) && E.current && !E.current.contains(e.target) && d(!1);
4695
+ w.current && !w.current.contains(e.target) && T.current && !T.current.contains(e.target) && d(!1);
4695
4696
  };
4696
4697
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
4697
4698
  }, []);
4698
- let P = useCallback((t) => {
4699
+ let N = useCallback((t) => {
4699
4700
  if (!e) return;
4700
- let n = applyEntityConfig(t, M.current), r = null;
4701
+ let n = applyEntityConfig(t, j.current), r = null;
4701
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) {
4702
- C.current.set(n.id, r);
4703
+ S.current.set(n.id, r);
4703
4704
  let e = {
4704
4705
  entity: n,
4705
4706
  shapeLabel: SHAPE_LABELS[n.type] || n.type,
4706
4707
  area: computeEntityArea(n),
4707
4708
  lengthOrRadius: computeEntityLengthOrRadius(n)
4708
4709
  };
4709
- S((t) => [...t, e]);
4710
- }
4711
- }, [e]), De = useCallback((e) => {
4712
- let t = C.current.get(e);
4713
- t && (t.destroy(), C.current.delete(e)), S((t) => t.filter((t) => t.entity.id !== e));
4714
- }, []), Oe = useCallback(() => {
4715
- C.current.forEach((e) => e.destroy()), C.current.clear(), S([]);
4716
- }, []), ke = 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) => {
4717
4718
  if (!e) return;
4718
- let n = C.current.get(t);
4719
+ let n = S.current.get(t);
4719
4720
  if (!n) return;
4720
4721
  let r = n.getBounds();
4721
4722
  e.fitBounds(r, {
@@ -4723,21 +4724,21 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4723
4724
  maxZoom: 18,
4724
4725
  duration: 1e3
4725
4726
  });
4726
- }, [e]), Ae = useCallback((e, t) => {
4727
+ }, [e]), je = useCallback((e, t) => {
4727
4728
  let n = {
4728
- ...M.current,
4729
+ ...j.current,
4729
4730
  [e]: t
4730
4731
  };
4731
- y ? i?.({ ...n }) : v(n), S((t) => t.map((t) => {
4732
+ v ? i?.({ ...n }) : _(n), x((t) => t.map((t) => {
4732
4733
  let r = { ...t.entity };
4733
4734
  r[e] = void 0;
4734
- 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);
4735
4736
  return a && a.update(i), {
4736
4737
  ...t,
4737
4738
  entity: i
4738
4739
  };
4739
4740
  }));
4740
- }, [y, i]), je = useCallback((t, n) => {
4741
+ }, [v, i]), Me = useCallback((t, n) => {
4741
4742
  if (!e) return;
4742
4743
  let [r, i] = t, [a, o] = n, s = [
4743
4744
  [Math.min(r, a), Math.max(i, o)],
@@ -4756,7 +4757,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4756
4757
  });
4757
4758
  let l = e.getSource(`${PREVIEW_PREFIX}rect-preview-measure-source`);
4758
4759
  if (l) {
4759
- let e = M.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];
4760
4761
  if (e?.showArea) {
4761
4762
  let e = distance(n, r), a = distance(r, i);
4762
4763
  t.push({
@@ -4787,7 +4788,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4787
4788
  features: t
4788
4789
  });
4789
4790
  }
4790
- }, [e]), Me = useCallback((t, n) => {
4791
+ }, [e]), Ne = useCallback((t, n) => {
4791
4792
  if (!e) return;
4792
4793
  let r = calculateDistance(t, n), i = createCirclePolygon(t, r), a = e.getSource(`${PREVIEW_PREFIX}circle-preview-source`);
4793
4794
  a && a.setData({
@@ -4798,7 +4799,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4798
4799
  },
4799
4800
  properties: {}
4800
4801
  });
4801
- let o = M.current, s = [], c = [];
4802
+ let o = j.current, s = [], c = [];
4802
4803
  if (o?.showArea && s.push({
4803
4804
  type: "Feature",
4804
4805
  geometry: {
@@ -4834,7 +4835,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4834
4835
  type: "FeatureCollection",
4835
4836
  features: c
4836
4837
  });
4837
- }, [e]), Ne = useCallback((t, n) => {
4838
+ }, [e]), Pe = useCallback((t, n) => {
4838
4839
  if (!e) return;
4839
4840
  let r = calculateDistance(t, n) * 2, i = createSquareCoords(t, r), a = e.getSource(`${PREVIEW_PREFIX}square-preview-source`);
4840
4841
  a && a.setData({
@@ -4847,7 +4848,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4847
4848
  });
4848
4849
  let o = e.getSource(`${PREVIEW_PREFIX}square-preview-measure-source`);
4849
4850
  if (o) {
4850
- let e = M.current, n = [];
4851
+ let e = j.current, n = [];
4851
4852
  if (e?.showArea && n.push({
4852
4853
  type: "Feature",
4853
4854
  geometry: {
@@ -4871,7 +4872,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4871
4872
  features: n
4872
4873
  });
4873
4874
  }
4874
- }, [e]), Pe = useCallback((t, n) => {
4875
+ }, [e]), Fe = useCallback((t, n) => {
4875
4876
  if (!e) return;
4876
4877
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polygon-preview-source`);
4877
4878
  i && (r.length >= 3 ? i.setData({
@@ -4906,7 +4907,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4906
4907
  });
4907
4908
  let o = e.getSource(`${PREVIEW_PREFIX}polygon-preview-measure-source`);
4908
4909
  if (o) {
4909
- let e = M.current, t = [];
4910
+ let e = j.current, t = [];
4910
4911
  if (e?.showArea && r.length >= 3) {
4911
4912
  let e = polygonArea([...r, r[0]]), n = 0, i = 0;
4912
4913
  for (let e of r) n += e[0], i += e[1];
@@ -4948,7 +4949,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4948
4949
  features: t
4949
4950
  });
4950
4951
  }
4951
- }, [e]), F = useCallback((t, n) => {
4952
+ }, [e]), P = useCallback((t, n) => {
4952
4953
  if (!e) return;
4953
4954
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polyline-preview-source`);
4954
4955
  i && (r.length >= 2 ? i.setData({
@@ -4976,7 +4977,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4976
4977
  });
4977
4978
  let o = e.getSource(`${PREVIEW_PREFIX}polyline-preview-measure-source`);
4978
4979
  if (o) {
4979
- let e = M.current, t = [];
4980
+ let e = j.current, t = [];
4980
4981
  if (e?.showLength && r.length >= 2) for (let e = 0; e < r.length - 1; e++) {
4981
4982
  let n = r[e], i = r[e + 1];
4982
4983
  t.push({
@@ -4996,117 +4997,117 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4996
4997
  }, [e]);
4997
4998
  useEffect(() => {
4998
4999
  if (!e || !f) return;
4999
- Ee(), e.getCanvas().style.cursor = "crosshair";
5000
+ De(), e.getCanvas().style.cursor = "crosshair";
5000
5001
  let t = (t) => {
5001
- let n = [t.lngLat.lng, t.lngLat.lat], r = we.current;
5002
+ let n = [t.lngLat.lng, t.lngLat.lat], r = Te.current;
5002
5003
  if (r === "rectangle") {
5003
- let t = D.current;
5004
- if (!t) D.current = n;
5004
+ let t = E.current;
5005
+ if (!t) E.current = n;
5005
5006
  else {
5006
5007
  let r = {
5007
- id: N(),
5008
+ id: M(),
5008
5009
  type: "rectangle",
5009
5010
  bounds: [t, n]
5010
5011
  };
5011
- P(r), D.current = null, clearAllPreviewSources(e), g(null);
5012
+ N(r), E.current = null, clearAllPreviewSources(e), h(null);
5012
5013
  }
5013
5014
  } else if (r === "circle") {
5014
- let t = O.current;
5015
- if (!t) O.current = { center: n };
5015
+ let t = D.current;
5016
+ if (!t) D.current = { center: n };
5016
5017
  else {
5017
5018
  let r = calculateDistance(t.center, n), i = {
5018
- id: N(),
5019
+ id: M(),
5019
5020
  type: "circle",
5020
5021
  center: t.center,
5021
5022
  radius: r
5022
5023
  };
5023
- P(i), O.current = null, clearAllPreviewSources(e), g(null);
5024
+ N(i), D.current = null, clearAllPreviewSources(e), h(null);
5024
5025
  }
5025
5026
  } else if (r === "square") {
5026
- let t = k.current;
5027
- if (!t) k.current = { center: n };
5027
+ let t = O.current;
5028
+ if (!t) O.current = { center: n };
5028
5029
  else {
5029
5030
  let r = calculateDistance(t.center, n) * 2, i = {
5030
- id: N(),
5031
+ id: M(),
5031
5032
  type: "square",
5032
5033
  center: t.center,
5033
5034
  length: r
5034
5035
  };
5035
- P(i), k.current = null, clearAllPreviewSources(e), g(null);
5036
+ N(i), O.current = null, clearAllPreviewSources(e), h(null);
5036
5037
  }
5037
5038
  } else if (r === "polygon") {
5038
- let t = A.current;
5039
+ let t = k.current;
5039
5040
  if (t.length >= 3 && calculateDistance(t[0], n) < 20) {
5040
5041
  let n = {
5041
- id: N(),
5042
+ id: M(),
5042
5043
  type: "polygon",
5043
5044
  coordinates: [...t]
5044
5045
  };
5045
- P(n), A.current = [], clearAllPreviewSources(e), g(null);
5046
+ N(n), k.current = [], clearAllPreviewSources(e), h(null);
5046
5047
  return;
5047
5048
  }
5048
- A.current = [...t, n];
5049
- } else r === "polyline" && (j.current = [...j.current, n]);
5049
+ k.current = [...t, n];
5050
+ } else r === "polyline" && (A.current = [...A.current, n]);
5050
5051
  }, n = (e) => {
5051
- let t = [e.lngLat.lng, e.lngLat.lat], n = we.current;
5052
- if (n === "rectangle" && D.current) je(D.current, t);
5053
- else if (n === "circle" && O.current) Me(O.current.center, t);
5054
- else if (n === "square" && k.current) Ne(k.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);
5055
5056
  else if (n === "polygon") {
5056
- let e = A.current;
5057
- e.length > 0 && Pe(e, t);
5057
+ let e = k.current;
5058
+ e.length > 0 && Fe(e, t);
5058
5059
  } else if (n === "polyline") {
5059
- let e = j.current;
5060
- e.length > 0 && F(e, t);
5060
+ let e = A.current;
5061
+ e.length > 0 && P(e, t);
5061
5062
  }
5062
5063
  }, r = (t) => {
5063
5064
  t.preventDefault();
5064
- let n = we.current;
5065
+ let n = Te.current;
5065
5066
  if (n === "polygon") {
5066
- let t = A.current;
5067
+ let t = k.current;
5067
5068
  if (t.length >= 3) {
5068
5069
  let n = {
5069
- id: N(),
5070
+ id: M(),
5070
5071
  type: "polygon",
5071
5072
  coordinates: [...t]
5072
5073
  };
5073
- P(n), A.current = [], clearAllPreviewSources(e), g(null);
5074
- } else A.current = [], clearAllPreviewSources(e);
5074
+ N(n), k.current = [], clearAllPreviewSources(e), h(null);
5075
+ } else k.current = [], clearAllPreviewSources(e);
5075
5076
  } else if (n === "polyline") {
5076
- let t = j.current;
5077
+ let t = A.current;
5077
5078
  if (t.length >= 2) {
5078
5079
  let n = {
5079
- id: N(),
5080
+ id: M(),
5080
5081
  type: "polyline",
5081
5082
  coordinates: [...t]
5082
5083
  };
5083
- P(n), j.current = [], clearAllPreviewSources(e), g(null);
5084
- } else j.current = [], clearAllPreviewSources(e);
5084
+ N(n), A.current = [], clearAllPreviewSources(e), h(null);
5085
+ } else A.current = [], clearAllPreviewSources(e);
5085
5086
  }
5086
5087
  }, i = (t) => {
5087
- t.key === "Escape" && (D.current = null, O.current = null, k.current = null, A.current = [], j.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));
5088
5089
  }, a = (t) => {
5089
5090
  t.preventDefault();
5090
- let n = we.current;
5091
+ let n = Te.current;
5091
5092
  if (n === "polygon") {
5092
- let t = A.current;
5093
+ let t = k.current;
5093
5094
  if (t.length >= 3) {
5094
5095
  let n = {
5095
- id: N(),
5096
+ id: M(),
5096
5097
  type: "polygon",
5097
5098
  coordinates: [...t]
5098
5099
  };
5099
- P(n), A.current = [], clearAllPreviewSources(e), g(null);
5100
+ N(n), k.current = [], clearAllPreviewSources(e), h(null);
5100
5101
  }
5101
5102
  } else if (n === "polyline") {
5102
- let t = j.current;
5103
+ let t = A.current;
5103
5104
  if (t.length >= 2) {
5104
5105
  let n = {
5105
- id: N(),
5106
+ id: M(),
5106
5107
  type: "polyline",
5107
5108
  coordinates: [...t]
5108
5109
  };
5109
- P(n), j.current = [], clearAllPreviewSources(e), g(null);
5110
+ N(n), A.current = [], clearAllPreviewSources(e), h(null);
5110
5111
  }
5111
5112
  }
5112
5113
  };
@@ -5116,25 +5117,25 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5116
5117
  }, [
5117
5118
  e,
5118
5119
  f,
5120
+ M,
5119
5121
  N,
5120
- P,
5121
- Ee,
5122
- je,
5122
+ De,
5123
5123
  Me,
5124
5124
  Ne,
5125
5125
  Pe,
5126
- F
5126
+ Fe,
5127
+ P
5127
5128
  ]), useEffect(() => () => {
5128
- C.current.forEach((e) => e.destroy()), C.current.clear();
5129
+ S.current.forEach((e) => e.destroy()), S.current.clear();
5129
5130
  }, []);
5130
- let Fe = useCallback((t) => {
5131
- g((e) => e === t ? null : t), D.current = null, O.current = null, k.current = null, A.current = [], j.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);
5132
5133
  }, [e]);
5133
5134
  return e ? /* @__PURE__ */ jsxs("div", {
5134
5135
  className: `mapbox-measure-control ${c}`,
5135
5136
  style: l,
5136
5137
  children: [/* @__PURE__ */ jsxs("button", {
5137
- ref: E,
5138
+ ref: T,
5138
5139
  className: `mapbox-control-btn mapbox-measure-control__btn ${u ? "mapbox-measure-control__btn--active" : ""}`,
5139
5140
  onClick: () => d(!u),
5140
5141
  title: "测量",
@@ -5145,14 +5146,14 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5145
5146
  className: "mapbox-measure-control__btn-icon"
5146
5147
  }),
5147
5148
  /* @__PURE__ */ jsx("span", { children: "测量" }),
5148
- x.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
5149
+ b.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
5149
5150
  "(",
5150
- x.length,
5151
+ b.length,
5151
5152
  ")"
5152
5153
  ] })
5153
5154
  ]
5154
5155
  }), u && /* @__PURE__ */ jsxs("div", {
5155
- ref: T,
5156
+ ref: w,
5156
5157
  className: "mapbox-measure-control__panel",
5157
5158
  children: [
5158
5159
  /* @__PURE__ */ jsx("div", {
@@ -5163,18 +5164,18 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5163
5164
  className: "mapbox-measure-control__settings",
5164
5165
  children: [
5165
5166
  /* @__PURE__ */ jsx(Checkbox, {
5166
- checked: b.showArea,
5167
- onChange: (e) => Ae("showArea", e),
5167
+ checked: y.showArea,
5168
+ onChange: (e) => je("showArea", e),
5168
5169
  children: "面积"
5169
5170
  }),
5170
5171
  /* @__PURE__ */ jsx(Checkbox, {
5171
- checked: b.showLength,
5172
- onChange: (e) => Ae("showLength", e),
5172
+ checked: y.showLength,
5173
+ onChange: (e) => je("showLength", e),
5173
5174
  children: "长度"
5174
5175
  }),
5175
5176
  /* @__PURE__ */ jsx(Checkbox, {
5176
- checked: b.showRadius,
5177
- onChange: (e) => Ae("showRadius", e),
5177
+ checked: y.showRadius,
5178
+ onChange: (e) => je("showRadius", e),
5178
5179
  children: "半径"
5179
5180
  })
5180
5181
  ]
@@ -5187,15 +5188,15 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5187
5188
  className: "mapbox-measure-control__tools",
5188
5189
  children: [DRAW_TOOLS.map((e) => /* @__PURE__ */ jsx("button", {
5189
5190
  className: `mapbox-measure-control__tool-btn ${f === e.mode ? "mapbox-measure-control__tool-btn--active" : ""}`,
5190
- onClick: () => Fe(e.mode),
5191
+ onClick: () => Ie(e.mode),
5191
5192
  title: e.label,
5192
5193
  children: /* @__PURE__ */ jsx("img", {
5193
5194
  src: e.icon,
5194
5195
  alt: e.label
5195
5196
  })
5196
- }, e.mode)), x.length > 0 && /* @__PURE__ */ jsx("button", {
5197
+ }, e.mode)), b.length > 0 && /* @__PURE__ */ jsx("button", {
5197
5198
  className: "mapbox-measure-control__tool-btn mapbox-measure-control__tool-btn--danger",
5198
- onClick: Oe,
5199
+ onClick: ke,
5199
5200
  title: "清除全部",
5200
5201
  children: /* @__PURE__ */ jsx("img", {
5201
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",
@@ -5203,7 +5204,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5203
5204
  })
5204
5205
  })]
5205
5206
  }),
5206
- x.length > 0 ? /* @__PURE__ */ jsx("div", {
5207
+ b.length > 0 ? /* @__PURE__ */ jsx("div", {
5207
5208
  className: "mapbox-measure-control__list",
5208
5209
  children: /* @__PURE__ */ jsxs("table", {
5209
5210
  className: "mapbox-measure-control__table",
@@ -5213,9 +5214,9 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5213
5214
  /* @__PURE__ */ jsx("th", { children: "面积" }),
5214
5215
  /* @__PURE__ */ jsx("th", { children: "长度/半径" }),
5215
5216
  /* @__PURE__ */ jsx("th", {})
5216
- ] }) }), /* @__PURE__ */ jsx("tbody", { children: x.map((e) => /* @__PURE__ */ jsxs("tr", {
5217
+ ] }) }), /* @__PURE__ */ jsx("tbody", { children: b.map((e) => /* @__PURE__ */ jsxs("tr", {
5217
5218
  className: "mapbox-measure-control__table-row",
5218
- onClick: () => ke(e.entity.id),
5219
+ onClick: () => Ae(e.entity.id),
5219
5220
  children: [
5220
5221
  /* @__PURE__ */ jsx("td", { children: e.shapeLabel }),
5221
5222
  /* @__PURE__ */ jsx("td", { children: String(e.entity.id) }),
@@ -5224,7 +5225,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5224
5225
  /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", {
5225
5226
  className: "mapbox-measure-control__delete-btn",
5226
5227
  onClick: (t) => {
5227
- t.stopPropagation(), De(e.entity.id);
5228
+ t.stopPropagation(), Oe(e.entity.id);
5228
5229
  },
5229
5230
  title: "删除",
5230
5231
  children: /* @__PURE__ */ jsx("img", {
@@ -5279,67 +5280,67 @@ var raster_paint_default = "data:image/svg+xml,%3c?xml%20version='1.0'%20standal
5279
5280
  }
5280
5281
  ];
5281
5282
  function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds: c = [], className: l, style: u }) {
5282
- 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;
5283
5284
  useEffect(() => {
5284
5285
  let e = (e) => {
5285
- 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);
5286
5287
  };
5287
5288
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
5288
5289
  }, []);
5289
- let x = useMemo(() => b ? {
5290
+ let b = useMemo(() => y ? {
5290
5291
  brightness: r.brightness ?? DEFAULT_CONFIG.brightness,
5291
5292
  saturation: r.saturation ?? DEFAULT_CONFIG.saturation,
5292
5293
  contrast: r.contrast ?? DEFAULT_CONFIG.contrast,
5293
5294
  hueRotate: r.hueRotate ?? DEFAULT_CONFIG.hueRotate
5294
- } : h, [
5295
- b,
5295
+ } : m, [
5296
+ y,
5296
5297
  r,
5297
- h
5298
- ]), S = useRef(b);
5298
+ m
5299
+ ]), x = useRef(y);
5299
5300
  useEffect(() => {
5300
- b && !S.current && _({ ...x }), S.current = b;
5301
- }, [b, x]);
5302
- let C = useCallback((t) => {
5301
+ y && !x.current && g({ ...b }), x.current = y;
5302
+ }, [y, b]);
5303
+ let S = useCallback((t) => {
5303
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));
5304
- }, [e, c]), ve = useCallback((e, t) => {
5305
- if (b) s?.({
5306
- ...x,
5305
+ }, [e, c]), ye = useCallback((e, t) => {
5306
+ if (y) s?.({
5307
+ ...b,
5307
5308
  [e]: t
5308
5309
  });
5309
5310
  else {
5310
5311
  let n = {
5311
- ...h,
5312
+ ...m,
5312
5313
  [e]: t
5313
5314
  };
5314
- _(n), C(n);
5315
+ g(n), S(n);
5315
5316
  }
5316
5317
  }, [
5317
- b,
5318
+ y,
5318
5319
  s,
5319
- x,
5320
- h,
5321
- C
5322
- ]), w = useCallback(() => {
5323
- b ? s?.({ ...DEFAULT_CONFIG }) : (_({ ...DEFAULT_CONFIG }), C({ ...DEFAULT_CONFIG }));
5324
- }, [
5325
5320
  b,
5321
+ m,
5322
+ S
5323
+ ]), C = useCallback(() => {
5324
+ y ? s?.({ ...DEFAULT_CONFIG }) : (g({ ...DEFAULT_CONFIG }), S({ ...DEFAULT_CONFIG }));
5325
+ }, [
5326
+ y,
5326
5327
  s,
5327
- C
5328
+ S
5328
5329
  ]);
5329
5330
  useEffect(() => {
5330
- !b && c.length > 0 && C(h);
5331
+ !y && c.length > 0 && S(m);
5331
5332
  }, [
5332
5333
  c,
5333
- b,
5334
- C,
5335
- h
5334
+ y,
5335
+ S,
5336
+ m
5336
5337
  ]);
5337
- let T = (e, t) => e === "hueRotate" ? `${Math.round(t)}°` : t.toFixed(2);
5338
+ let w = (e, t) => e === "hueRotate" ? `${Math.round(t)}°` : t.toFixed(2);
5338
5339
  return /* @__PURE__ */ jsxs("div", {
5339
5340
  className: `mapbox-raster-paint-control${l ? ` ${l}` : ""}`,
5340
5341
  style: u,
5341
5342
  children: [/* @__PURE__ */ jsxs("button", {
5342
- ref: y,
5343
+ ref: v,
5343
5344
  className: `mapbox-control-btn mapbox-raster-paint-control__btn${d ? " mapbox-raster-paint-control__btn--active" : ""}`,
5344
5345
  onClick: () => f(!d),
5345
5346
  title: "栅格渲染调节",
@@ -5349,7 +5350,7 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5349
5350
  alt: "raster paint"
5350
5351
  }), /* @__PURE__ */ jsx("span", { children: "渲染" })]
5351
5352
  }), d && /* @__PURE__ */ jsxs("div", {
5352
- ref: v,
5353
+ ref: _,
5353
5354
  className: "mapbox-raster-paint-control__panel",
5354
5355
  children: [SLIDER_CONFIG.map(({ key: e, label: t, min: n, max: r, step: i }) => /* @__PURE__ */ jsxs("div", {
5355
5356
  className: "mapbox-raster-paint-control__slider-row",
@@ -5363,18 +5364,18 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5363
5364
  min: n,
5364
5365
  max: r,
5365
5366
  step: i,
5366
- value: x[e],
5367
- onChange: (t) => ve(e, t),
5367
+ value: b[e],
5368
+ onChange: (t) => ye(e, t),
5368
5369
  tooltipVisible: !1
5369
5370
  }),
5370
5371
  /* @__PURE__ */ jsx("span", {
5371
5372
  className: "mapbox-raster-paint-control__value",
5372
- children: T(e, x[e])
5373
+ children: w(e, b[e])
5373
5374
  })
5374
5375
  ]
5375
5376
  }, e)), /* @__PURE__ */ jsx("button", {
5376
5377
  className: "mapbox-raster-paint-control__reset",
5377
- onClick: w,
5378
+ onClick: C,
5378
5379
  children: "重置"
5379
5380
  })]
5380
5381
  })]
@@ -5382,43 +5383,43 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5382
5383
  }
5383
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";
5384
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 }) => {
5385
- let [h, g] = useState(!1), _ = useRef(null);
5386
+ let [m, h] = useState(!1), g = useRef(null);
5386
5387
  useEffect(() => {
5387
5388
  let e = (e) => {
5388
- _.current && !_.current.contains(e.target) && g(!1);
5389
+ g.current && !g.current.contains(e.target) && h(!1);
5389
5390
  };
5390
- if (h) return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
5391
- }, [h]);
5392
- let v = (e) => {
5393
- t?.id === e.id ? (r(null), s(null)) : (r(e), s("marker")), g(!1);
5394
- }, 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 = () => {
5395
5396
  i === "rectangle" ? s(null) : (r(null), s("rectangle"));
5396
- }, b = () => {
5397
+ }, y = () => {
5397
5398
  i === "circle" ? s(null) : (r(null), s("circle"));
5398
- }, x = () => {
5399
+ }, b = () => {
5399
5400
  i === "polygon" ? s(null) : (r(null), s("polygon"));
5400
- }, S = () => {
5401
+ }, x = () => {
5401
5402
  i === "square" ? s(null) : (r(null), s("square"));
5402
- }, C = () => {
5403
+ }, S = () => {
5403
5404
  i === "polyline" ? s(null) : (r(null), s("polyline"));
5404
- }, ve = () => {
5405
- (i === "rectangle" || i === "circle" || i === "polygon" || i === "square" || i === "polyline") && s(null), g(!h);
5406
- }, w = (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 ? {
5407
5408
  width: e.size,
5408
5409
  height: e.size
5409
5410
  } : {
5410
5411
  width: e.width || 32,
5411
5412
  height: e.height || 32
5412
- }, T = h || t, E = i === "rectangle", D = i === "circle", ye = i === "polygon", be = i === "square", O = i === "polyline";
5413
+ }, w = m || t, T = i === "rectangle", E = i === "circle", be = i === "polygon", xe = i === "square", D = i === "polyline";
5413
5414
  return /* @__PURE__ */ jsxs("div", {
5414
- ref: _,
5415
+ ref: g,
5415
5416
  className: "mapbox-edit-control",
5416
5417
  children: [/* @__PURE__ */ jsxs("div", {
5417
5418
  className: "mapbox-edit-control__btn-group",
5418
5419
  children: [
5419
5420
  /* @__PURE__ */ jsxs("button", {
5420
- className: `mapbox-control-btn ${T ? "mapbox-control-btn--active" : ""}`,
5421
- onClick: ve,
5421
+ className: `mapbox-control-btn ${w ? "mapbox-control-btn--active" : ""}`,
5422
+ onClick: ye,
5422
5423
  title: "Marker",
5423
5424
  children: [t ? /* @__PURE__ */ jsx("img", {
5424
5425
  src: t.icon,
@@ -5431,8 +5432,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5431
5432
  }), /* @__PURE__ */ jsx("span", { children: t ? t.name : "Marker" })]
5432
5433
  }),
5433
5434
  d && /* @__PURE__ */ jsxs("button", {
5434
- className: `mapbox-control-btn ${be ? "mapbox-control-btn--active" : ""}`,
5435
- onClick: S,
5435
+ className: `mapbox-control-btn ${xe ? "mapbox-control-btn--active" : ""}`,
5436
+ onClick: x,
5436
5437
  title: "绘制正方形",
5437
5438
  children: [/* @__PURE__ */ jsx("img", {
5438
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",
@@ -5441,8 +5442,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5441
5442
  }), /* @__PURE__ */ jsx("span", { children: "正方形" })]
5442
5443
  }),
5443
5444
  c && /* @__PURE__ */ jsxs("button", {
5444
- className: `mapbox-control-btn ${E ? "mapbox-control-btn--active" : ""}`,
5445
- onClick: y,
5445
+ className: `mapbox-control-btn ${T ? "mapbox-control-btn--active" : ""}`,
5446
+ onClick: v,
5446
5447
  title: "绘制矩形",
5447
5448
  children: [/* @__PURE__ */ jsx("img", {
5448
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",
@@ -5451,8 +5452,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5451
5452
  }), /* @__PURE__ */ jsx("span", { children: "矩形" })]
5452
5453
  }),
5453
5454
  l && /* @__PURE__ */ jsxs("button", {
5454
- className: `mapbox-control-btn ${D ? "mapbox-control-btn--active" : ""}`,
5455
- onClick: b,
5455
+ className: `mapbox-control-btn ${E ? "mapbox-control-btn--active" : ""}`,
5456
+ onClick: y,
5456
5457
  title: "绘制圆形",
5457
5458
  children: [/* @__PURE__ */ jsx("img", {
5458
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",
@@ -5461,8 +5462,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5461
5462
  }), /* @__PURE__ */ jsx("span", { children: "圆形" })]
5462
5463
  }),
5463
5464
  u && /* @__PURE__ */ jsxs("button", {
5464
- className: `mapbox-control-btn ${ye ? "mapbox-control-btn--active" : ""}`,
5465
- onClick: x,
5465
+ className: `mapbox-control-btn ${be ? "mapbox-control-btn--active" : ""}`,
5466
+ onClick: b,
5466
5467
  title: "绘制多边形",
5467
5468
  children: [/* @__PURE__ */ jsx("img", {
5468
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",
@@ -5471,8 +5472,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5471
5472
  }), /* @__PURE__ */ jsx("span", { children: "多边形" })]
5472
5473
  }),
5473
5474
  f && /* @__PURE__ */ jsxs("button", {
5474
- className: `mapbox-control-btn ${O ? "mapbox-control-btn--active" : ""}`,
5475
- onClick: C,
5475
+ className: `mapbox-control-btn ${D ? "mapbox-control-btn--active" : ""}`,
5476
+ onClick: S,
5476
5477
  title: "绘制折线",
5477
5478
  children: [/* @__PURE__ */ jsx("img", {
5478
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",
@@ -5481,7 +5482,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5481
5482
  }), /* @__PURE__ */ jsx("span", { children: "折线" })]
5482
5483
  })
5483
5484
  ]
5484
- }), h && /* @__PURE__ */ jsxs("div", {
5485
+ }), m && /* @__PURE__ */ jsxs("div", {
5485
5486
  className: "mapbox-edit-control__panel",
5486
5487
  children: [/* @__PURE__ */ jsx("div", {
5487
5488
  className: "mapbox-edit-control__panel-header",
@@ -5489,10 +5490,10 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5489
5490
  }), /* @__PURE__ */ jsx("div", {
5490
5491
  className: "mapbox-edit-control__template-list",
5491
5492
  children: e.map((e) => {
5492
- let n = w(e), r = t?.id === e.id;
5493
+ let n = C(e), r = t?.id === e.id;
5493
5494
  return /* @__PURE__ */ jsxs("div", {
5494
5495
  className: `mapbox-edit-control__template-item ${r ? "mapbox-edit-control__template-item--selected" : ""}`,
5495
- onClick: () => v(e),
5496
+ onClick: () => _(e),
5496
5497
  title: e.name,
5497
5498
  children: [/* @__PURE__ */ jsx("img", {
5498
5499
  src: e.icon,
@@ -5561,28 +5562,28 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5561
5562
  };
5562
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";
5563
5564
  const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointCountInput: c = !1, visualType: l = "marker", onSelectFinished: u, showButton: d = !0 }, f) => {
5564
- let [h, g] = useState("idle"), [_, v] = useState(0), [y, b] = useState(i), [x, S] = useState(!1), C = useRef(null), ve = useRef(null), w = useRef([]), T = useRef([]), E = useRef("idle"), D = useRef(null), ye = 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("");
5565
5566
  useEffect(() => {
5566
- E.current = h;
5567
- }, [h]), useEffect(() => {
5568
- b(i);
5567
+ T.current = m;
5568
+ }, [m]), useEffect(() => {
5569
+ y(i);
5569
5570
  }, [i]), useEffect(() => {
5570
- if (!x) return;
5571
+ if (!b) return;
5571
5572
  let e = (e) => {
5572
- ve.current && !ve.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);
5573
5574
  }, t = setTimeout(() => {
5574
5575
  document.addEventListener("mousedown", e);
5575
5576
  }, 0);
5576
5577
  return () => {
5577
5578
  clearTimeout(t), document.removeEventListener("mousedown", e);
5578
5579
  };
5579
- }, [x]);
5580
- let be = useCallback(() => {
5581
- for (let e of T.current) e.remove();
5582
- T.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));
5583
- }, [e]), O = 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(() => {
5584
5585
  if (!e) return;
5585
- let t = w.current, n = {
5586
+ let t = C.current, n = {
5586
5587
  type: "FeatureCollection",
5587
5588
  features: [{
5588
5589
  type: "Feature",
@@ -5633,104 +5634,104 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5633
5634
  "circle-stroke-color": "#fff"
5634
5635
  }
5635
5636
  }));
5636
- }, [e]), xe = useCallback((t) => {
5637
- if (!e || !D.current) return;
5638
- let { visualType: n } = D.current;
5637
+ }, [e]), Se = useCallback((t) => {
5638
+ if (!e || !E.current) return;
5639
+ let { visualType: n } = E.current;
5639
5640
  if (n === "marker") {
5640
5641
  let n = document.createElement("div");
5641
- n.className = "route-planning-temp-marker", n.textContent = String(w.current.length);
5642
+ n.className = "route-planning-temp-marker", n.textContent = String(C.current.length);
5642
5643
  let r = new mapboxgl.Marker({ element: n }).setLngLat(t).addTo(e);
5643
- T.current.push(r);
5644
- } else O();
5645
- }, [e, O]), Se = useCallback(() => {
5646
- be(), w.current = [], D.current = null, v(0), g("idle"), e && (e.getCanvas().style.cursor = ye.current);
5647
- }, [be, e]), Ce = useCallback(async () => {
5648
- let e = D.current, t = [...w.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];
5649
5650
  if (!e || t.length < 2) {
5650
- Se();
5651
+ Ce();
5651
5652
  return;
5652
5653
  }
5653
- g("planning");
5654
+ h("planning");
5654
5655
  try {
5655
5656
  await e.onSelectFinished(t);
5656
5657
  } catch (e) {
5657
5658
  console.error("Route planning onSelectFinished failed:", e);
5658
5659
  } finally {
5659
- Se();
5660
+ Ce();
5660
5661
  }
5661
- }, [Se]), k = useCallback((e) => {
5662
- if (E.current !== "selecting" || !D.current) return;
5662
+ }, [Ce]), O = useCallback((e) => {
5663
+ if (T.current !== "selecting" || !E.current) return;
5663
5664
  let t = [e.lngLat.lng, e.lngLat.lat];
5664
- w.current.push(t);
5665
- let n = w.current.length;
5666
- v(n), xe(t), n >= D.current.pointCount && Ce();
5667
- }, [xe, Ce]), A = useCallback((e) => {
5668
- E.current === "selecting" && (e.preventDefault(), Se());
5669
- }, [Se]);
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]);
5670
5671
  useEffect(() => {
5671
- if (e && h === "selecting") return e.on("click", k), e.on("contextmenu", A), () => {
5672
- e.off("click", k), e.off("contextmenu", A);
5672
+ if (e && m === "selecting") return e.on("click", O), e.on("contextmenu", k), () => {
5673
+ e.off("click", O), e.off("contextmenu", k);
5673
5674
  };
5674
5675
  }, [
5675
5676
  e,
5676
- h,
5677
- k,
5678
- A
5677
+ m,
5678
+ O,
5679
+ k
5679
5680
  ]);
5680
- let j = useCallback((t) => {
5681
+ let A = useCallback((t) => {
5681
5682
  if (!e) return;
5682
- E.current !== "idle" && Se();
5683
+ T.current !== "idle" && Ce();
5683
5684
  let n = Math.max(2, t.pointCount ?? i), r = t.visualType ?? l;
5684
- D.current = {
5685
+ E.current = {
5685
5686
  pointCount: n,
5686
5687
  visualType: r,
5687
5688
  onSelectFinished: t.onSelectFinished
5688
- }, w.current = [], v(0), b(n), S(!1), ye.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");
5689
5690
  }, [
5690
5691
  e,
5691
5692
  i,
5692
5693
  l,
5693
- Se
5694
+ Ce
5694
5695
  ]);
5695
- useImperativeHandle(f, () => ({ startPlanning: j }), [j]);
5696
- let M = () => {
5697
- h === "idle" ? S((e) => !e) : h === "selecting" && Se();
5698
- }, we = () => {
5699
- u && j({
5700
- 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),
5701
5702
  visualType: l,
5702
5703
  onSelectFinished: u
5703
5704
  });
5704
- }, N = (e) => {
5705
+ }, M = (e) => {
5705
5706
  let t = parseInt(e.target.value, 10);
5706
- !isNaN(t) && t >= 2 ? b(t) : e.target.value === "" && b(2);
5707
- }, Te = () => {
5708
- if (h === "planning") return /* @__PURE__ */ jsx("span", { children: "规划中..." });
5709
- if (h === "selecting") {
5710
- let e = D.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;
5711
5712
  return /* @__PURE__ */ jsxs("span", { children: [
5712
- _,
5713
+ g,
5713
5714
  "/",
5714
5715
  e
5715
5716
  ] });
5716
5717
  }
5717
5718
  return "路径规划";
5718
- }, Ee = h === "selecting", P = h === "planning";
5719
- return !d && h === "idle" ? null : /* @__PURE__ */ jsxs("div", {
5719
+ }, De = m === "selecting", N = m === "planning";
5720
+ return !d && m === "idle" ? null : /* @__PURE__ */ jsxs("div", {
5720
5721
  className: `mapbox-route-planning-control${d ? "" : " mapbox-route-planning-control--floating"}`,
5721
5722
  children: [/* @__PURE__ */ jsxs("button", {
5722
- ref: C,
5723
- className: `mapbox-control-btn mapbox-route-planning-control__btn${Ee ? " mapbox-route-planning-control__btn--active" : ""}${P ? " mapbox-route-planning-control__btn--planning" : ""}${x ? " mapbox-route-planning-control__btn--active" : ""}`,
5724
- onClick: M,
5725
- disabled: P,
5726
- 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" ? "取消选点" : "规划中...",
5727
5728
  children: [/* @__PURE__ */ jsx("img", {
5728
5729
  src: route_planning_default,
5729
5730
  alt: "route",
5730
5731
  className: "mapbox-route-planning-control__btn-icon"
5731
- }), Te()]
5732
- }), x && h === "idle" && /* @__PURE__ */ jsxs("div", {
5733
- ref: ve,
5732
+ }), Ee()]
5733
+ }), b && m === "idle" && /* @__PURE__ */ jsxs("div", {
5734
+ ref: ye,
5734
5735
  className: "mapbox-route-planning-control__panel",
5735
5736
  children: [/* @__PURE__ */ jsx("div", {
5736
5737
  className: "mapbox-route-planning-control__panel-header",
@@ -5749,12 +5750,12 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5749
5750
  }), c ? /* @__PURE__ */ jsx("input", {
5750
5751
  type: "number",
5751
5752
  className: "mapbox-route-planning-control__panel-input",
5752
- value: y,
5753
+ value: v,
5753
5754
  min: 2,
5754
- onChange: N
5755
+ onChange: M
5755
5756
  }) : /* @__PURE__ */ jsx("span", {
5756
5757
  className: "mapbox-route-planning-control__panel-value",
5757
- children: y
5758
+ children: v
5758
5759
  })]
5759
5760
  }),
5760
5761
  /* @__PURE__ */ jsx("div", {
@@ -5763,7 +5764,7 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5763
5764
  }),
5764
5765
  /* @__PURE__ */ jsx("button", {
5765
5766
  className: "mapbox-route-planning-control__panel-start",
5766
- onClick: we,
5767
+ onClick: Te,
5767
5768
  disabled: !u,
5768
5769
  children: "开始规划"
5769
5770
  })
@@ -5920,53 +5921,53 @@ function adjustPopupForBounds(e, t) {
5920
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;
5921
5922
  }
5922
5923
  const Mapbox = forwardRef((e, c) => {
5923
- 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: w, entities: T = [], selectedIds: E = [], entityConfig: D, nameConfig: O, selectNameConfig: k, areaConfig: A, circleConfig: j, lengthConfig: M, showCoordinates: we = !0, showScale: N = !0, showResetView: Te = !0, showRoadHighlight: Ee = !1, showMeasure: De = !1, showRasterPaint: je = !1, showRoutePlanning: Me, onRasterPaintChange: Ne, popupDefaults: F, renderPopup: Fe, onMapLoad: Ie, onEntityClick: Le, onPopupOpen: Re, onPopupClose: ze, className: Be = "", containerStyle: Ve } = e, He = useRef(null), Ue = useRef(null), I = useRef(null), L = useRef(/* @__PURE__ */ new Map()), R = useRef(/* @__PURE__ */ new Map()), We = useRef(/* @__PURE__ */ new Set()), [z, Ge] = useState(null), Ke = useRef(null), qe = useRef(null), Je = useRef(null), [Ye, Xe] = useState(null), Ze = useRef(null), Qe = useRef(null), [B, $e] = useState(null), [et, tt] = useState(_), [nt, rt] = useState(null), it = useRef(null), [at, V] = useState(null), [ot, H] = useState(null), [st, ct] = useState(null), U = useRef(!1), W = useRef(null), lt = useRef(null), G = useRef(null), ut = useRef(null), K = useRef(null), dt = useRef([]), q = useRef(null), ft = useRef(null), pt = useRef(null), mt = useRef([]), ht = useRef(null), gt = useRef(!1), [_t, vt] = useState([]), yt = useRef([]);
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([]);
5924
5925
  yt.current = _t;
5925
5926
  let J = useRef(null);
5926
5927
  useEffect(() => {
5927
- tt(_);
5928
- }, [_]);
5928
+ nt(g);
5929
+ }, [g]);
5929
5930
  let bt = useCallback((e) => {
5930
- let t = L.current.get(e), n = R.current.get(e);
5931
+ let t = I.current.get(e), n = L.current.get(e);
5931
5932
  if (t && n) {
5932
5933
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
5933
5934
  let r = {
5934
5935
  ...n,
5935
5936
  isAnimating: !0
5936
5937
  };
5937
- R.current.set(e, r), t.startAnimation();
5938
+ L.current.set(e, r), t.startAnimation();
5938
5939
  } else if (n.type === "circle" && t instanceof CanvasCircleRenderer) {
5939
5940
  let r = {
5940
5941
  ...n,
5941
5942
  isAnimating: !0
5942
5943
  };
5943
- R.current.set(e, r), t.startAnimation();
5944
+ L.current.set(e, r), t.startAnimation();
5944
5945
  }
5945
5946
  }
5946
5947
  }, []), xt = useCallback((e) => {
5947
- let t = L.current.get(e), n = R.current.get(e);
5948
+ let t = I.current.get(e), n = L.current.get(e);
5948
5949
  if (t && n) {
5949
5950
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
5950
5951
  let r = {
5951
5952
  ...n,
5952
5953
  isAnimating: !1
5953
5954
  };
5954
- R.current.set(e, r), t.stopAnimation();
5955
+ L.current.set(e, r), t.stopAnimation();
5955
5956
  } else if (n.type === "circle" && t instanceof CanvasCircleRenderer) {
5956
5957
  let r = {
5957
5958
  ...n,
5958
5959
  isAnimating: !1
5959
5960
  };
5960
- R.current.set(e, r), t.stopAnimation();
5961
+ L.current.set(e, r), t.stopAnimation();
5961
5962
  }
5962
5963
  }
5963
5964
  }, []), St = useCallback((e) => {
5964
- let t = R.current.get(e);
5965
+ let t = L.current.get(e);
5965
5966
  t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? xt(e) : bt(e));
5966
5967
  }, [bt, xt]), Ct = useCallback((e) => {
5967
5968
  if (e === void 0) {
5968
5969
  let e = !1;
5969
- for (let [, t] of L.current) if (t instanceof UnitRenderer) {
5970
+ for (let [, t] of I.current) if (t instanceof UnitRenderer) {
5970
5971
  let n = t.getShowTrajectory();
5971
5972
  if (n === "all" || typeof n == "number" && n > 0) {
5972
5973
  e = !0;
@@ -5974,46 +5975,46 @@ const Mapbox = forwardRef((e, c) => {
5974
5975
  }
5975
5976
  }
5976
5977
  let t = e ? 0 : "all";
5977
- for (let [, e] of L.current) e instanceof UnitRenderer && e.setShowTrajectory(t);
5978
+ for (let [, e] of I.current) e instanceof UnitRenderer && e.setShowTrajectory(t);
5978
5979
  } else {
5979
5980
  let t = new Set(e.map(String));
5980
- for (let [e, n] of L.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);
5981
5982
  }
5982
5983
  }, []), wt = useCallback((e, t, n) => {
5983
- let r = T.find((t) => String(t.id) === String(e));
5984
- if (!r?.popup || !I.current) return;
5985
- let i = r.popup.content ?? Fe?.(r);
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);
5986
5987
  if (!i) return;
5987
- let a = mergePopupConfig(r.popup, F, i), { position: o, actualPosition: s } = calculatePopupPosition(r, a, I.current, n);
5988
- Ge({
5988
+ let a = mergePopupConfig(r.popup, P, i), { position: o, actualPosition: s } = calculatePopupPosition(r, a, F.current, n);
5989
+ Ke({
5989
5990
  entityId: e,
5990
5991
  position: o,
5991
5992
  config: a,
5992
5993
  openedBy: t,
5993
5994
  actualPosition: s
5994
- }), Re?.(e);
5995
+ }), ze?.(e);
5995
5996
  }, [
5996
- T,
5997
- F,
5998
- Fe,
5999
- Re
5997
+ w,
5998
+ P,
5999
+ Ie,
6000
+ ze
6000
6001
  ]), Tt = useCallback((e) => {
6001
- z?.entityId === e && (Ge(null), ze?.(e));
6002
- }, [z, ze]), Et = useCallback(() => {
6003
- Ge((e) => (e && ze?.(e.entityId), null));
6004
- }, [ze]), Dt = useCallback((e) => z?.entityId === e, [z]), Ot = useCallback((e, t, n) => {
6005
- let r = I.current;
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;
6006
6007
  r && r.flyTo({
6007
6008
  center: e,
6008
6009
  zoom: t ?? r.getZoom(),
6009
6010
  ...n
6010
6011
  });
6011
6012
  }, []), kt = useCallback((e, t, n) => {
6012
- let r = I.current;
6013
+ let r = F.current;
6013
6014
  if (!r || e.length === 0) return;
6014
6015
  let i = [];
6015
6016
  for (let t of e) {
6016
- let e = L.current.get(t);
6017
+ let e = I.current.get(t);
6017
6018
  e && i.push(e.getBounds());
6018
6019
  }
6019
6020
  if (i.length === 0) return;
@@ -6036,18 +6037,18 @@ const Mapbox = forwardRef((e, c) => {
6036
6037
  };
6037
6038
  t !== void 0 && (p.maxZoom = t), n?.essential !== void 0 && (p.essential = n.essential), r.fitBounds(f, p);
6038
6039
  }, []), At = useCallback((e) => {
6039
- let t = I.current;
6040
+ let t = F.current;
6040
6041
  if (!t || !t.getContainer()) return;
6041
- 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;
6042
6043
  if (!n) {
6043
- it.current &&= (it.current.remove(), null);
6044
+ at.current &&= (at.current.remove(), null);
6044
6045
  return;
6045
6046
  }
6046
- if (it.current) {
6047
- it.current.setLngLat(e);
6048
- let t = it.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");
6049
6050
  if (i) {
6050
- let e = resolveNameConfig(a, O);
6051
+ let e = resolveNameConfig(a, D);
6051
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`;
6052
6053
  else {
6053
6054
  let n = document.createElement("div");
@@ -6059,19 +6060,19 @@ const Mapbox = forwardRef((e, c) => {
6059
6060
  n.className = "mapbox-picker-marker";
6060
6061
  let o = document.createElement("div");
6061
6062
  if (o.className = "marker-inner", o.style.background = r, n.appendChild(o), i) {
6062
- let e = resolveNameConfig(a, O), t = document.createElement("div");
6063
+ let e = resolveNameConfig(a, D), t = document.createElement("div");
6063
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);
6064
6065
  }
6065
- it.current = new mapboxgl.Marker({
6066
+ at.current = new mapboxgl.Marker({
6066
6067
  element: n,
6067
6068
  anchor: "bottom"
6068
6069
  }).setLngLat(e).addTo(t);
6069
6070
  }
6070
- }, [y, O]), jt = useCallback(() => {
6071
- it.current &&= (it.current.remove(), null);
6071
+ }, [v, D]), jt = useCallback(() => {
6072
+ at.current &&= (at.current.remove(), null);
6072
6073
  }, []), Mt = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), Nt = useCallback((e) => {
6073
- let t = I.current;
6074
- if (He.current) if (ht.current &&= (ht.current.remove(), null), e && t) {
6074
+ let t = F.current;
6075
+ if (Ue.current) if (ht.current &&= (ht.current.remove(), null), e && t) {
6075
6076
  t.getCanvas().style.cursor = "none";
6076
6077
  let n = document.createElement("div");
6077
6078
  n.className = "mapbox-custom-cursor";
@@ -6091,7 +6092,7 @@ const Mapbox = forwardRef((e, c) => {
6091
6092
  let e = ht.current._cleanup;
6092
6093
  e && e(), ht.current.remove(), ht.current = null;
6093
6094
  }
6094
- let e = I.current;
6095
+ let e = F.current;
6095
6096
  e && (e.getCanvas().style.cursor = "");
6096
6097
  }, []), Pt = useCallback((e, t, n) => {
6097
6098
  if (!e.getSource(t)) {
@@ -6130,7 +6131,7 @@ const Mapbox = forwardRef((e, c) => {
6130
6131
  });
6131
6132
  }
6132
6133
  }, []), Ft = useCallback(() => {
6133
- let e = I.current;
6134
+ let e = F.current;
6134
6135
  e && (e.getSource("rect-preview-source") || (e.addSource("rect-preview-source", {
6135
6136
  type: "geojson",
6136
6137
  data: {
@@ -6156,7 +6157,7 @@ const Mapbox = forwardRef((e, c) => {
6156
6157
  }
6157
6158
  }), Pt(e, "rect-preview-measure-source", "rect-preview-measure-label")));
6158
6159
  }, [Pt]), It = useCallback((e, t) => {
6159
- let n = I.current;
6160
+ let n = F.current;
6160
6161
  if (!n) return;
6161
6162
  let r = n.getSource("rect-preview-source");
6162
6163
  if (!r) return;
@@ -6175,10 +6176,10 @@ const Mapbox = forwardRef((e, c) => {
6175
6176
  },
6176
6177
  properties: {}
6177
6178
  });
6178
- let l = W.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;
6179
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));
6180
- let m = n.getSource("rect-preview-measure-source");
6181
- if (m) {
6181
+ let ve = n.getSource("rect-preview-measure-source");
6182
+ if (ve) {
6182
6183
  let e = Pn.current, t = [], n = c[0], r = c[1], i = c[2];
6183
6184
  if (e?.showArea) {
6184
6185
  let e = [(n[0] + i[0]) / 2, (n[1] + i[1]) / 2], a = distance(n, r), o = distance(r, i);
@@ -6211,13 +6212,13 @@ const Mapbox = forwardRef((e, c) => {
6211
6212
  properties: { label: formatLength(distance(r, i)) }
6212
6213
  });
6213
6214
  }
6214
- m.setData({
6215
+ ve.setData({
6215
6216
  type: "FeatureCollection",
6216
6217
  features: t
6217
6218
  });
6218
6219
  }
6219
6220
  }, []), Lt = useCallback(() => {
6220
- let e = I.current;
6221
+ let e = F.current;
6221
6222
  if (!e) return;
6222
6223
  let t = e.getSource("rect-preview-source");
6223
6224
  t && t.setData({
@@ -6230,9 +6231,9 @@ const Mapbox = forwardRef((e, c) => {
6230
6231
  features: []
6231
6232
  });
6232
6233
  }, []), X = useCallback(() => {
6233
- ct(null), Lt();
6234
+ lt(null), Lt();
6234
6235
  }, [Lt]), Rt = useCallback(() => {
6235
- let e = I.current;
6236
+ let e = F.current;
6236
6237
  e && (e.getSource("circle-preview-source") || (e.addSource("circle-preview-source", {
6237
6238
  type: "geojson",
6238
6239
  data: {
@@ -6284,7 +6285,7 @@ const Mapbox = forwardRef((e, c) => {
6284
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);
6285
6286
  return 6371e3 * (2 * Math.atan2(Math.sqrt(c), Math.sqrt(1 - c)));
6286
6287
  }, []), Vt = useCallback((e, t) => {
6287
- let n = I.current;
6288
+ let n = F.current;
6288
6289
  if (!n) return;
6289
6290
  let r = n.getSource("circle-preview-source");
6290
6291
  if (!r) return;
@@ -6297,7 +6298,7 @@ const Mapbox = forwardRef((e, c) => {
6297
6298
  },
6298
6299
  properties: {}
6299
6300
  });
6300
- let o = G.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;
6301
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));
6302
6303
  let d = Pn.current, f = [], p = [];
6303
6304
  if (d?.showArea) {
@@ -6312,7 +6313,7 @@ const Mapbox = forwardRef((e, c) => {
6312
6313
  });
6313
6314
  }
6314
6315
  if (d?.showRadius) {
6315
- let t = G.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];
6316
6317
  p.push({
6317
6318
  type: "Feature",
6318
6319
  geometry: {
@@ -6329,18 +6330,18 @@ const Mapbox = forwardRef((e, c) => {
6329
6330
  properties: { label: formatLength(i) }
6330
6331
  });
6331
6332
  }
6332
- let m = n.getSource("circle-preview-measure-source");
6333
- m && m.setData({
6333
+ let ve = n.getSource("circle-preview-measure-source");
6334
+ ve && ve.setData({
6334
6335
  type: "FeatureCollection",
6335
6336
  features: f
6336
6337
  });
6337
- let h = n.getSource("circle-preview-radius-source");
6338
- h && h.setData({
6338
+ let m = n.getSource("circle-preview-radius-source");
6339
+ m && m.setData({
6339
6340
  type: "FeatureCollection",
6340
6341
  features: p
6341
6342
  });
6342
6343
  }, [Bt, zt]), Ht = useCallback(() => {
6343
- let e = I.current;
6344
+ let e = F.current;
6344
6345
  if (!e) return;
6345
6346
  let t = e.getSource("circle-preview-source");
6346
6347
  t && t.setData({
@@ -6358,9 +6359,9 @@ const Mapbox = forwardRef((e, c) => {
6358
6359
  features: []
6359
6360
  });
6360
6361
  }, []), Ut = useCallback(() => {
6361
- ut.current = null, Ht();
6362
+ dt.current = null, Ht();
6362
6363
  }, [Ht]), Wt = useCallback(() => {
6363
- let e = I.current;
6364
+ let e = F.current;
6364
6365
  e && (e.getSource("polygon-preview-source") || (e.addSource("polygon-preview-source", {
6365
6366
  type: "geojson",
6366
6367
  data: {
@@ -6402,7 +6403,7 @@ const Mapbox = forwardRef((e, c) => {
6402
6403
  }
6403
6404
  }), Pt(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
6404
6405
  }, [Pt]), Gt = useCallback((e, t) => {
6405
- let n = I.current;
6406
+ let n = F.current;
6406
6407
  if (!n) return;
6407
6408
  let r = n.getSource("polygon-preview-source"), i = n.getSource("polygon-vertices-source");
6408
6409
  if (!r || !i) return;
@@ -6439,7 +6440,7 @@ const Mapbox = forwardRef((e, c) => {
6439
6440
  properties: {}
6440
6441
  }))
6441
6442
  });
6442
- let o = K.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;
6443
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);
6444
6445
  let d = n.getSource("polygon-preview-measure-source");
6445
6446
  if (d) {
@@ -6486,7 +6487,7 @@ const Mapbox = forwardRef((e, c) => {
6486
6487
  });
6487
6488
  }
6488
6489
  }, []), Kt = useCallback(() => {
6489
- let e = I.current;
6490
+ let e = F.current;
6490
6491
  if (!e) return;
6491
6492
  let t = e.getSource("polygon-preview-source");
6492
6493
  t && t.setData({
@@ -6504,9 +6505,9 @@ const Mapbox = forwardRef((e, c) => {
6504
6505
  features: []
6505
6506
  });
6506
6507
  }, []), qt = useCallback(() => {
6507
- dt.current = [], Kt();
6508
+ ft.current = [], Kt();
6508
6509
  }, [Kt]), Jt = useCallback(() => {
6509
- let e = I.current;
6510
+ let e = F.current;
6510
6511
  e && (e.getSource("square-preview-source") || (e.addSource("square-preview-source", {
6511
6512
  type: "geojson",
6512
6513
  data: {
@@ -6541,7 +6542,7 @@ const Mapbox = forwardRef((e, c) => {
6541
6542
  [n - s, r + o]
6542
6543
  ];
6543
6544
  }, []), Xt = useCallback((e, t) => {
6544
- let n = I.current;
6545
+ let n = F.current;
6545
6546
  if (!n) return;
6546
6547
  let r = n.getSource("square-preview-source");
6547
6548
  if (!r) return;
@@ -6554,7 +6555,7 @@ const Mapbox = forwardRef((e, c) => {
6554
6555
  },
6555
6556
  properties: {}
6556
6557
  });
6557
- let o = q.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;
6558
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));
6559
6560
  let d = n.getSource("square-preview-measure-source");
6560
6561
  if (d) {
@@ -6583,7 +6584,7 @@ const Mapbox = forwardRef((e, c) => {
6583
6584
  });
6584
6585
  }
6585
6586
  }, [Bt, Yt]), Zt = useCallback(() => {
6586
- let e = I.current;
6587
+ let e = F.current;
6587
6588
  if (!e) return;
6588
6589
  let t = e.getSource("square-preview-source");
6589
6590
  t && t.setData({
@@ -6596,9 +6597,9 @@ const Mapbox = forwardRef((e, c) => {
6596
6597
  features: []
6597
6598
  });
6598
6599
  }, []), Qt = useCallback(() => {
6599
- ft.current = null, Zt();
6600
+ pt.current = null, Zt();
6600
6601
  }, [Zt]), $t = useCallback(() => {
6601
- let e = I.current;
6602
+ let e = F.current;
6602
6603
  e && (e.getSource("polyline-preview-source") || (e.addSource("polyline-preview-source", {
6603
6604
  type: "geojson",
6604
6605
  data: {
@@ -6632,7 +6633,7 @@ const Mapbox = forwardRef((e, c) => {
6632
6633
  }
6633
6634
  }), Pt(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
6634
6635
  }, [Pt]), en = useCallback((e, t) => {
6635
- let n = I.current;
6636
+ let n = F.current;
6636
6637
  if (!n) return;
6637
6638
  let r = n.getSource("polyline-preview-source"), i = n.getSource("polyline-vertices-source");
6638
6639
  if (!r || !i) return;
@@ -6658,7 +6659,7 @@ const Mapbox = forwardRef((e, c) => {
6658
6659
  properties: {}
6659
6660
  }))
6660
6661
  });
6661
- let o = pt.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
6662
+ let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
6662
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);
6663
6664
  let l = n.getSource("polyline-preview-measure-source");
6664
6665
  if (l) {
@@ -6680,7 +6681,7 @@ const Mapbox = forwardRef((e, c) => {
6680
6681
  });
6681
6682
  }
6682
6683
  }, []), tn = useCallback(() => {
6683
- let e = I.current;
6684
+ let e = F.current;
6684
6685
  if (!e) return;
6685
6686
  let t = e.getSource("polyline-preview-source");
6686
6687
  t && t.setData({
@@ -6700,7 +6701,7 @@ const Mapbox = forwardRef((e, c) => {
6700
6701
  }, []), Z = useCallback(() => {
6701
6702
  mt.current = [], tn();
6702
6703
  }, [tn]), nn = useCallback((e) => {
6703
- V(e), Nt(e), e ? (H("marker"), X(), Ut(), qt(), Qt(), Z()) : H(null);
6704
+ B(e), Nt(e), e ? (V("marker"), X(), Ut(), qt(), Qt(), Z()) : V(null);
6704
6705
  }, [
6705
6706
  Nt,
6706
6707
  X,
@@ -6709,27 +6710,27 @@ const Mapbox = forwardRef((e, c) => {
6709
6710
  Qt,
6710
6711
  Z
6711
6712
  ]), rn = useCallback((e) => {
6712
- if (H(e), e === "rectangle") {
6713
- V(null), Y(), Ut(), qt(), Qt(), Z();
6714
- let e = I.current;
6713
+ if (V(e), e === "rectangle") {
6714
+ B(null), Y(), Ut(), qt(), Qt(), Z();
6715
+ let e = F.current;
6715
6716
  e && (e.getCanvas().style.cursor = "crosshair");
6716
6717
  } else if (e === "circle") {
6717
- V(null), Y(), X(), qt(), Qt(), Z();
6718
- let e = I.current;
6718
+ B(null), Y(), X(), qt(), Qt(), Z();
6719
+ let e = F.current;
6719
6720
  e && (e.getCanvas().style.cursor = "crosshair");
6720
6721
  } else if (e === "polygon") {
6721
- V(null), Y(), X(), Ut(), Qt(), Z();
6722
- let e = I.current;
6722
+ B(null), Y(), X(), Ut(), Qt(), Z();
6723
+ let e = F.current;
6723
6724
  e && (e.getCanvas().style.cursor = "crosshair");
6724
6725
  } else if (e === "square") {
6725
- V(null), Y(), X(), Ut(), qt(), Z();
6726
- let e = I.current;
6726
+ B(null), Y(), X(), Ut(), qt(), Z();
6727
+ let e = F.current;
6727
6728
  e && (e.getCanvas().style.cursor = "crosshair");
6728
6729
  } else if (e === "polyline") {
6729
- V(null), Y(), X(), Ut(), qt(), Qt();
6730
- let e = I.current;
6730
+ B(null), Y(), X(), Ut(), qt(), Qt();
6731
+ let e = F.current;
6731
6732
  e && (e.getCanvas().style.cursor = "crosshair");
6732
- } else e === "marker" ? (X(), Ut(), qt(), Qt(), Z()) : (V(null), Y(), X(), Ut(), qt(), Qt(), Z());
6733
+ } else e === "marker" ? (X(), Ut(), qt(), Qt(), Z()) : (B(null), Y(), X(), Ut(), qt(), Qt(), Z());
6733
6734
  }, [
6734
6735
  Y,
6735
6736
  X,
@@ -6739,60 +6740,60 @@ const Mapbox = forwardRef((e, c) => {
6739
6740
  Z
6740
6741
  ]), an = useCallback((e) => {
6741
6742
  if (e !== "picker") {
6742
- let e = y.value && isFinite(y.value.lng) && isFinite(y.value.lat), t = y.showMarker !== !1;
6743
- (!e || !t) && jt(), rt(null);
6743
+ let e = v.value && isFinite(v.value.lng) && isFinite(v.value.lat), t = v.showMarker !== !1;
6744
+ (!e || !t) && jt(), it(null);
6744
6745
  }
6745
- e !== "edit" && (V(null), H(null), X(), Z(), Y()), tt(e);
6746
+ e !== "edit" && (B(null), V(null), X(), Z(), Y()), nt(e);
6746
6747
  }, [
6747
6748
  jt,
6748
6749
  Y,
6749
6750
  X,
6750
6751
  Z
6751
- ]), on = useCallback(() => et, [et]), sn = useCallback(() => nt, [nt]), cn = useCallback(() => {
6752
- jt(), rt(null);
6752
+ ]), on = useCallback(() => tt, [tt]), sn = useCallback(() => rt, [rt]), cn = useCallback(() => {
6753
+ jt(), it(null);
6753
6754
  }, [jt]);
6754
6755
  useEffect(() => {
6755
- if (!B) return;
6756
- let e = y.value;
6756
+ if (!z) return;
6757
+ let e = v.value;
6757
6758
  if (e && isFinite(e.lng) && isFinite(e.lat)) {
6758
6759
  let t = [e.lng, e.lat];
6759
- rt(e), At(t);
6760
+ it(e), At(t);
6760
6761
  }
6761
6762
  }, [
6762
- y.value,
6763
+ v.value,
6763
6764
  At,
6764
- B
6765
+ z
6765
6766
  ]);
6766
6767
  let ln = (e) => "mode" in e, un = useCallback((e) => {
6767
- if (tt("edit"), jt(), rt(null), U.current = !0, ln(e)) {
6768
- if (e.mode === "marker") e.markerStyle ? (lt.current = e.markerStyle, W.current = null, G.current = null, K.current = null, q.current = null, pt.current = null, V(null), H("marker"), e.markerStyle.src && e.markerStyle.width ? Nt({
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({
6769
6770
  id: "custom",
6770
6771
  name: e.markerStyle.name || "Marker",
6771
6772
  icon: e.markerStyle.src,
6772
6773
  width: e.markerStyle.width
6773
- }) : Y()) : e.template && (lt.current = null, W.current = null, G.current = null, K.current = null, q.current = null, pt.current = null, V(e.template), H("marker"), Nt(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));
6774
6775
  else if (e.mode === "rectangle") {
6775
- W.current = e.rectangleStyle || null, lt.current = null, G.current = null, K.current = null, q.current = null, pt.current = null, V(null), H("rectangle"), Y();
6776
- let t = I.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;
6777
6778
  t && (t.getCanvas().style.cursor = "crosshair");
6778
6779
  } else if (e.mode === "circle") {
6779
- G.current = e.circleStyle || null, W.current = null, lt.current = null, K.current = null, q.current = null, pt.current = null, V(null), H("circle"), Y();
6780
- let t = I.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;
6781
6782
  t && (t.getCanvas().style.cursor = "crosshair");
6782
6783
  } else if (e.mode === "polygon") {
6783
- K.current = e.polygonStyle || null, W.current = null, lt.current = null, G.current = null, q.current = null, pt.current = null, V(null), H("polygon"), Y();
6784
- let t = I.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;
6785
6786
  t && (t.getCanvas().style.cursor = "crosshair");
6786
6787
  } else if (e.mode === "square") {
6787
- q.current = e.squareStyle || null, W.current = null, lt.current = null, G.current = null, K.current = null, pt.current = null, V(null), H("square"), Y();
6788
- let t = I.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;
6789
6790
  t && (t.getCanvas().style.cursor = "crosshair");
6790
6791
  } else if (e.mode === "polyline") {
6791
- pt.current = e.polylineStyle || null, W.current = null, lt.current = null, G.current = null, K.current = null, q.current = null, V(null), H("polyline"), Y();
6792
- let t = I.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;
6793
6794
  t && (t.getCanvas().style.cursor = "crosshair");
6794
6795
  }
6795
- } else V(e), H("marker"), Nt(e), W.current = null, lt.current = null, G.current = null, K.current = null, q.current = null, pt.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;
6796
6797
  }, [
6797
6798
  jt,
6798
6799
  Nt,
@@ -6802,7 +6803,7 @@ const Mapbox = forwardRef((e, c) => {
6802
6803
  startAnimation: bt,
6803
6804
  stopAnimation: xt,
6804
6805
  toggleAnimation: St,
6805
- getMap: () => I.current,
6806
+ getMap: () => F.current,
6806
6807
  openPopup: (e) => wt(e, "programmatic"),
6807
6808
  closePopup: Tt,
6808
6809
  closeAllPopups: Et,
@@ -6815,15 +6816,15 @@ const Mapbox = forwardRef((e, c) => {
6815
6816
  getPickedLocation: sn,
6816
6817
  clearPickedLocation: cn,
6817
6818
  startDrawing: un,
6818
- getRenderer: (e) => L.current.get(e),
6819
+ getRenderer: (e) => I.current.get(e),
6819
6820
  setEditingEntities: (e) => {
6820
- for (let t of yt.current) e.map(String).includes(String(t)) || L.current.get(t)?.setEditing?.(!1);
6821
- for (let t of e) L.current.get(t)?.setEditing?.(!0);
6822
- J.current &&= (L.current.get(J.current.entityId)?.cancelEditPreview?.(), null), vt(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);
6823
6824
  },
6824
6825
  getEditingEntities: () => yt.current,
6825
6826
  startRoutePlanning: (e) => {
6826
- Ue.current?.startPlanning(e);
6827
+ We.current?.startPlanning(e);
6827
6828
  }
6828
6829
  }), [
6829
6830
  bt,
@@ -6843,13 +6844,13 @@ const Mapbox = forwardRef((e, c) => {
6843
6844
  un
6844
6845
  ]);
6845
6846
  let dn = useCallback(() => {
6846
- let e = I.current;
6847
+ let e = F.current;
6847
6848
  if (!e) return;
6848
- let t = new Set(T.map((e) => e.id)), n = new Set(L.current.keys());
6849
- for (let e of n) t.has(e) || (L.current.get(e)?.destroy(), L.current.delete(e));
6850
- let r = new Set(E.map(String));
6851
- for (let t of T) {
6852
- let n = applyEntityConfig(t, D), i = L.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);
6853
6854
  if (i) if (n.type === "radar" && i instanceof CanvasRadarRenderer) i.update(n);
6854
6855
  else if (n.type === "image" && i instanceof CanvasImageRenderer) i.update(n);
6855
6856
  else if (n.type === "marker" && i instanceof MarkerRenderer) i.update(n);
@@ -6858,37 +6859,37 @@ const Mapbox = forwardRef((e, c) => {
6858
6859
  else if (n.type === "circle") if (n.fillType === "radial-gradient") if (i instanceof CanvasCircleRenderer) i.update(n);
6859
6860
  else {
6860
6861
  i.destroy();
6861
- let t = new CanvasCircleRenderer(e, n, O, k, A, j);
6862
- L.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)));
6863
6864
  }
6864
6865
  else if (i instanceof CircleRenderer) i.update(n);
6865
6866
  else {
6866
6867
  i.destroy();
6867
- let t = new CircleRenderer(e, n, O, k, A, j);
6868
- L.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)));
6869
6870
  }
6870
6871
  else (n.type === "square" && i instanceof SquareRenderer || n.type === "rectangle" && i instanceof RectangleRenderer || n.type === "polyline" && i instanceof PolylineRenderer) && i.update(n);
6871
6872
  else {
6872
6873
  let t = null;
6873
- n.type === "radar" ? t = new CanvasRadarRenderer(e, n, O, k) : n.type === "image" ? t = new CanvasImageRenderer(e, n, O, k) : n.type === "marker" ? t = new MarkerRenderer(e, n, O, k) : n.type === "unit" ? t = new UnitRenderer(e, n, O, k) : n.type === "polygon" ? t = new PolygonRenderer(e, n, O, k, A, M) : n.type === "circle" ? t = n.fillType === "radial-gradient" ? new CanvasCircleRenderer(e, n, O, k, A, j) : new CircleRenderer(e, n, O, k, A, j) : n.type === "square" ? t = new SquareRenderer(e, n, O, k, A, M) : n.type === "rectangle" ? t = new RectangleRenderer(e, n, O, k, A, M) : n.type === "polyline" && (t = new PolylineRenderer(e, n, O, k, M)), t && (L.current.set(n.id, t), t.setSelected(r.has(String(n.id))), yt.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));
6874
6875
  }
6875
6876
  }
6876
6877
  for (let e of yt.current) {
6877
- let t = L.current.get(e);
6878
+ let t = I.current.get(e);
6878
6879
  t && t.setEditing?.(!0);
6879
6880
  }
6880
6881
  }, [
6882
+ w,
6881
6883
  T,
6882
6884
  E,
6883
6885
  D,
6884
6886
  O,
6885
6887
  k,
6886
6888
  A,
6887
- j,
6888
- M
6889
+ j
6889
6890
  ]), fn = useCallback(() => {
6890
- for (let e of L.current.values()) e.destroy();
6891
- L.current.clear();
6891
+ for (let e of I.current.values()) e.destroy();
6892
+ I.current.clear();
6892
6893
  }, []), pn = useCallback((e) => {
6893
6894
  let t = e.getStyle();
6894
6895
  if (!t?.layers) return;
@@ -6905,9 +6906,9 @@ const Mapbox = forwardRef((e, c) => {
6905
6906
  ];
6906
6907
  for (let e of t.layers) if (n.some((t) => e.id.startsWith(t))) return e.id;
6907
6908
  }, []), mn = useCallback((e) => {
6908
- let t = w, 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;
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;
6909
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;
6910
- }, [w]), hn = useCallback((e, t) => {
6911
+ }, [C]), hn = useCallback((e, t) => {
6911
6912
  let n = `base-layer-source-${t.id}`, r = `base-layer-${t.id}`, i = {
6912
6913
  type: "raster",
6913
6914
  tiles: [t.url],
@@ -6928,7 +6929,7 @@ const Mapbox = forwardRef((e, c) => {
6928
6929
  }, [pn, mn]), gn = useCallback(async (e, t) => {
6929
6930
  try {
6930
6931
  let n = await (await fetch(t.url)).json(), r = `base-layer-source-${t.id}`, i = `base-layer-${t.id}`;
6931
- if (!We.current.has(t.id)) return;
6932
+ if (!Ge.current.has(t.id)) return;
6932
6933
  let a = n.format === "pbf" || n.vector_layers, o = pn(e);
6933
6934
  if (a) {
6934
6935
  let t = {
@@ -6959,7 +6960,7 @@ const Mapbox = forwardRef((e, c) => {
6959
6960
  }, [pn, mn]), _n = useCallback(async (e, t) => {
6960
6961
  try {
6961
6962
  let n = await (await fetch(t.url)).json();
6962
- if (!We.current.has(t.id)) return;
6963
+ if (!Ge.current.has(t.id)) return;
6963
6964
  if (n.sources) for (let [r, i] of Object.entries(n.sources)) {
6964
6965
  let n = `base-layer-source-${t.id}-${r}`;
6965
6966
  e.getSource(n) || e.addSource(n, i);
@@ -6996,9 +6997,9 @@ const Mapbox = forwardRef((e, c) => {
6996
6997
  let a = `base-layer-source-${t}`, o = n.sources ?? {};
6997
6998
  for (let t of Object.keys(o)) t.startsWith(a) && e.getSource(t) && e.removeSource(t);
6998
6999
  }, []), yn = useCallback((e) => {
6999
- let t = I.current;
7000
+ let t = F.current;
7000
7001
  if (!t) return;
7001
- let n = new Set(e.map((e) => e.id)), r = We.current;
7002
+ let n = new Set(e.map((e) => e.id)), r = Ge.current;
7002
7003
  for (let e of r) n.has(e) || (vn(t, e), r.delete(e));
7003
7004
  for (let n of e) if (r.has(n.id)) {
7004
7005
  let e = `base-layer-${n.id}`;
@@ -7049,7 +7050,7 @@ const Mapbox = forwardRef((e, c) => {
7049
7050
  lng: t[0],
7050
7051
  lat: t[1]
7051
7052
  };
7052
- rt(e), At(t), An.current?.(e);
7053
+ it(e), At(t), An.current?.(e);
7053
7054
  return;
7054
7055
  }
7055
7056
  if (gt.current) return;
@@ -7057,87 +7058,87 @@ const Mapbox = forwardRef((e, c) => {
7057
7058
  let e = Mn.current;
7058
7059
  if (e === "rectangle") {
7059
7060
  let e = Nn.current;
7060
- if (!e) ct(t);
7061
+ if (!e) lt(t);
7061
7062
  else {
7062
- let n = W.current, r = applyEntityConfig({
7063
+ let n = U.current, r = applyEntityConfig({
7063
7064
  ...n,
7064
7065
  id: n?.id ?? Mt(),
7065
7066
  type: "rectangle",
7066
7067
  bounds: [e, t]
7067
- }, D);
7068
+ }, E);
7068
7069
  Lt();
7069
- let i = I.current;
7070
- if (i && !L.current.has(r.id)) {
7071
- let e = new RectangleRenderer(i, r, O, k, A, M);
7072
- L.current.set(r.id, e);
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);
7073
7074
  }
7074
- Q.current.onRectangleAdd?.(r), ct(null), W.current = null, U.current && (U.current = !1, H(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 = ""));
7075
7076
  }
7076
7077
  return;
7077
7078
  }
7078
7079
  if (e === "circle") {
7079
- let e = ut.current;
7080
- if (!e) ut.current = { center: t };
7080
+ let e = dt.current;
7081
+ if (!e) dt.current = { center: t };
7081
7082
  else {
7082
- let n = Bt(e.center, t), r = G.current, i = applyEntityConfig({
7083
+ let n = Bt(e.center, t), r = W.current, i = applyEntityConfig({
7083
7084
  ...r,
7084
7085
  id: r?.id ?? Mt(),
7085
7086
  type: "circle",
7086
7087
  center: e.center,
7087
7088
  radius: n
7088
- }, D);
7089
+ }, E);
7089
7090
  Ht();
7090
- let a = I.current;
7091
- if (a && !L.current.has(i.id)) {
7092
- let e = new CircleRenderer(a, i, O, k, A, j);
7093
- L.current.set(i.id, e);
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);
7094
7095
  }
7095
- Q.current.onCircleAdd?.(i), ut.current = null, G.current = null, U.current && (U.current = !1, H(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 = ""));
7096
7097
  }
7097
7098
  return;
7098
7099
  }
7099
7100
  if (e === "polygon") {
7100
- let e = dt.current;
7101
+ let e = ft.current;
7101
7102
  if (e.length >= 3) {
7102
7103
  let n = e[0];
7103
7104
  if (Bt(n, t) < 20) {
7104
- let t = K.current, n = applyEntityConfig({
7105
+ let t = G.current, n = applyEntityConfig({
7105
7106
  ...t,
7106
7107
  id: t?.id ?? Mt(),
7107
7108
  type: "polygon",
7108
7109
  coordinates: [...e]
7109
- }, D);
7110
+ }, E);
7110
7111
  Kt();
7111
- let r = I.current;
7112
- if (r && !L.current.has(n.id)) {
7113
- let e = new PolygonRenderer(r, n, O, k, A, M);
7114
- L.current.set(n.id, e);
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);
7115
7116
  }
7116
- Q.current.onPolygonAdd?.(n), dt.current = [], K.current = null, U.current && (U.current = !1, H(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 = ""));
7117
7118
  return;
7118
7119
  }
7119
7120
  }
7120
- dt.current = [...e, t];
7121
+ ft.current = [...e, t];
7121
7122
  return;
7122
7123
  }
7123
7124
  if (e === "square") {
7124
- let e = ft.current;
7125
- if (!e) ft.current = { center: t };
7125
+ let e = pt.current;
7126
+ if (!e) pt.current = { center: t };
7126
7127
  else {
7127
- let n = Bt(e.center, t) * 2, r = q.current, i = applyEntityConfig({
7128
+ let n = Bt(e.center, t) * 2, r = K.current, i = applyEntityConfig({
7128
7129
  ...r,
7129
7130
  id: r?.id ?? Mt(),
7130
7131
  type: "square",
7131
7132
  center: e.center,
7132
7133
  length: n
7133
- }, D);
7134
+ }, E);
7134
7135
  Zt();
7135
- let a = I.current;
7136
- if (a && !L.current.has(i.id)) {
7137
- let e = new SquareRenderer(a, i, O, k, A, M);
7138
- L.current.set(i.id, e);
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);
7139
7140
  }
7140
- Q.current.onSquareAdd?.(i), ft.current = null, q.current = null, U.current && (U.current = !1, H(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 = ""));
7141
7142
  }
7142
7143
  return;
7143
7144
  }
@@ -7145,7 +7146,7 @@ const Mapbox = forwardRef((e, c) => {
7145
7146
  mt.current = [...mt.current, t];
7146
7147
  return;
7147
7148
  }
7148
- let n = lt.current;
7149
+ let n = ut.current;
7149
7150
  if (n && n.src && n.width) {
7150
7151
  let e = {
7151
7152
  ...n,
@@ -7155,7 +7156,7 @@ const Mapbox = forwardRef((e, c) => {
7155
7156
  src: n.src,
7156
7157
  width: n.width
7157
7158
  };
7158
- Q.current.onMarkerAdd?.(e), V(null), H(null), Y(), lt.current = null, U.current = !1;
7159
+ Q.current.onMarkerAdd?.(e), B(null), V(null), Y(), ut.current = null, H.current = !1;
7159
7160
  return;
7160
7161
  }
7161
7162
  let r = jn.current;
@@ -7168,14 +7169,14 @@ const Mapbox = forwardRef((e, c) => {
7168
7169
  src: r.icon,
7169
7170
  width: r.size || r.width || 32
7170
7171
  };
7171
- r.customData !== void 0 && (e.customData = r.customData), Q.current.onMarkerAdd?.(e), V(null), H(null), Y(), U.current = !1;
7172
+ r.customData !== void 0 && (e.customData = r.customData), Q.current.onMarkerAdd?.(e), B(null), V(null), Y(), H.current = !1;
7172
7173
  return;
7173
7174
  }
7174
7175
  }
7175
7176
  if (yt.current.length > 0) {
7176
- let e = I.current?.getZoom() ?? 12;
7177
+ let e = F.current?.getZoom() ?? 12;
7177
7178
  if (J.current) {
7178
- let { entityId: e, activeHandle: n } = J.current, r = L.current.get(e);
7179
+ let { entityId: e, activeHandle: n } = J.current, r = I.current.get(e);
7179
7180
  if (r?.applyHandleMove) {
7180
7181
  let e = r.applyHandleMove(n, t);
7181
7182
  Q.current.onEntityEdit?.(e);
@@ -7184,7 +7185,7 @@ const Mapbox = forwardRef((e, c) => {
7184
7185
  return;
7185
7186
  }
7186
7187
  for (let n of yt.current) {
7187
- let r = L.current.get(n);
7188
+ let r = I.current.get(n);
7188
7189
  if (!r?.getEditHandleAt) continue;
7189
7190
  let i = r.getEditHandleAt(t, e);
7190
7191
  if (i) {
@@ -7211,78 +7212,78 @@ const Mapbox = forwardRef((e, c) => {
7211
7212
  let e = i.find((e) => String(e.id) === s);
7212
7213
  if (e) {
7213
7214
  if (a?.(e), e.popup) {
7214
- let t = e.popup.content ?? Fe?.(e);
7215
- t && mergePopupConfig(e.popup, F, 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);
7216
7217
  }
7217
7218
  return;
7218
7219
  }
7219
7220
  }
7220
- for (let [t, r] of L.current) {
7221
+ for (let [t, r] of I.current) {
7221
7222
  let s = r.getLabelLayerId();
7222
- if (s && I.current?.getLayer(s) && I.current.queryRenderedFeatures(e.point, { layers: [s] }).length > 0) {
7223
+ if (s && F.current?.getLayer(s) && F.current.queryRenderedFeatures(e.point, { layers: [s] }).length > 0) {
7223
7224
  let e = i.find((e) => e.id === t);
7224
7225
  if (e) {
7225
7226
  if (a?.(e), e.popup) {
7226
- let r = e.popup.content ?? Fe?.(e);
7227
- r && mergePopupConfig(e.popup, F, 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);
7228
7229
  }
7229
7230
  return;
7230
7231
  }
7231
7232
  }
7232
7233
  }
7233
- for (let [e, r] of L.current) if (r.isPointInEntity(t)) {
7234
+ for (let [e, r] of I.current) if (r.isPointInEntity(t)) {
7234
7235
  let t = i.find((t) => t.id === e);
7235
7236
  if (t) {
7236
7237
  if (a?.(t), t.popup) {
7237
- let r = t.popup.content ?? Fe?.(t);
7238
- r && mergePopupConfig(t.popup, F, 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);
7239
7240
  }
7240
7241
  return;
7241
7242
  }
7242
7243
  }
7243
7244
  }, [
7244
- F,
7245
- Fe,
7245
+ P,
7246
+ Ie,
7246
7247
  bn
7247
7248
  ]), Sn = useCallback((e) => {
7248
7249
  let t = [e.lngLat.lng, e.lngLat.lat];
7249
7250
  if (J.current) {
7250
7251
  let { entityId: e, activeHandle: n } = J.current;
7251
- L.current.get(e)?.updateEditPreview?.(n, t);
7252
+ I.current.get(e)?.updateEditPreview?.(n, t);
7252
7253
  return;
7253
7254
  }
7254
7255
  let n = Mn.current, r = Nn.current;
7255
7256
  n === "rectangle" && r && It(r, t);
7256
- let i = ut.current;
7257
+ let i = dt.current;
7257
7258
  n === "circle" && i && Vt(i.center, t);
7258
- let a = dt.current;
7259
+ let a = ft.current;
7259
7260
  n === "polygon" && a.length > 0 && Gt(a, t);
7260
- let o = ft.current;
7261
+ let o = pt.current;
7261
7262
  n === "square" && o && Xt(o.center, t);
7262
7263
  let s = mt.current;
7263
7264
  n === "polyline" && s.length > 0 && en(s, t);
7264
7265
  let c = En.current, l = On.current;
7265
- for (let [e, n] of L.current) if (n.isPointInEntity(t)) {
7266
+ for (let [e, n] of I.current) if (n.isPointInEntity(t)) {
7266
7267
  let t = c.find((t) => t.id === e);
7267
7268
  if (!t?.popup) continue;
7268
- let n = t.popup.content ?? Fe?.(t);
7269
+ let n = t.popup.content ?? Ie?.(t);
7269
7270
  if (!n) continue;
7270
- let r = mergePopupConfig(t.popup, F, n);
7271
+ let r = mergePopupConfig(t.popup, P, n);
7271
7272
  if (r.trigger === "hover") {
7272
- Je.current && clearTimeout(Je.current), Je.current = window.setTimeout(() => {
7273
+ Ye.current && clearTimeout(Ye.current), Ye.current = window.setTimeout(() => {
7273
7274
  l(e, "hover");
7274
7275
  }, r.hoverDelay);
7275
7276
  return;
7276
7277
  }
7277
7278
  }
7278
- if (Je.current &&= (clearTimeout(Je.current), null), z?.openedBy === "hover") {
7279
- let e = L.current.get(z.entityId);
7280
- e && !e.isPointInEntity(t) && Tt(z.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);
7281
7282
  }
7282
7283
  }, [
7283
- F,
7284
- Fe,
7285
- z,
7284
+ P,
7285
+ Ie,
7286
+ R,
7286
7287
  Tt,
7287
7288
  It,
7288
7289
  Vt,
@@ -7294,12 +7295,12 @@ const Mapbox = forwardRef((e, c) => {
7294
7295
  if (yt.current.length > 0) {
7295
7296
  let t = [e.lngLat.lng, e.lngLat.lat];
7296
7297
  if (J.current) {
7297
- L.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7298
+ I.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7298
7299
  return;
7299
7300
  }
7300
- let n = I.current?.getZoom() ?? 12;
7301
+ let n = F.current?.getZoom() ?? 12;
7301
7302
  for (let e of yt.current) {
7302
- let r = L.current.get(e);
7303
+ let r = I.current.get(e);
7303
7304
  if (!r?.getEditHandleAt || !r.deleteVertex) continue;
7304
7305
  let i = r.getEditHandleAt(t, n);
7305
7306
  if (i && i.type === "vertex") {
@@ -7311,57 +7312,57 @@ const Mapbox = forwardRef((e, c) => {
7311
7312
  }
7312
7313
  if (kn.current !== "edit") return;
7313
7314
  if (jn.current) {
7314
- V(null), H(null), Y();
7315
+ B(null), V(null), Y();
7315
7316
  return;
7316
7317
  }
7317
7318
  let t = Mn.current;
7318
7319
  if (t === "rectangle") {
7319
- if (Nn.current) ct(null), Lt();
7320
+ if (Nn.current) lt(null), Lt();
7320
7321
  else {
7321
- H(null);
7322
- let e = I.current;
7322
+ V(null);
7323
+ let e = F.current;
7323
7324
  e && (e.getCanvas().style.cursor = "");
7324
7325
  }
7325
7326
  return;
7326
7327
  }
7327
7328
  if (t === "circle") {
7328
- if (ut.current) ut.current = null, Ht();
7329
+ if (dt.current) dt.current = null, Ht();
7329
7330
  else {
7330
- H(null);
7331
- let e = I.current;
7331
+ V(null);
7332
+ let e = F.current;
7332
7333
  e && (e.getCanvas().style.cursor = "");
7333
7334
  }
7334
7335
  return;
7335
7336
  }
7336
7337
  if (t === "polygon") {
7337
- let e = dt.current;
7338
+ let e = ft.current;
7338
7339
  if (e.length >= 3) {
7339
- let t = K.current, n = applyEntityConfig({
7340
+ let t = G.current, n = applyEntityConfig({
7340
7341
  ...t,
7341
7342
  id: t?.id ?? Mt(),
7342
7343
  type: "polygon",
7343
7344
  coordinates: [...e]
7344
- }, D);
7345
+ }, E);
7345
7346
  Kt();
7346
- let r = I.current;
7347
- if (r && !L.current.has(n.id)) {
7348
- let e = new PolygonRenderer(r, n, O, k, A, M);
7349
- L.current.set(n.id, e);
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);
7350
7351
  }
7351
- Q.current.onPolygonAdd?.(n), dt.current = [], K.current = null, U.current && (U.current = !1, H(null), r && (r.getCanvas().style.cursor = ""));
7352
- } else if (e.length > 0) dt.current = [], Kt();
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();
7353
7354
  else {
7354
- H(null);
7355
- let e = I.current;
7355
+ V(null);
7356
+ let e = F.current;
7356
7357
  e && (e.getCanvas().style.cursor = "");
7357
7358
  }
7358
7359
  return;
7359
7360
  }
7360
7361
  if (t === "square") {
7361
- if (ft.current) ft.current = null, Zt();
7362
+ if (pt.current) pt.current = null, Zt();
7362
7363
  else {
7363
- H(null);
7364
- let e = I.current;
7364
+ V(null);
7365
+ let e = F.current;
7365
7366
  e && (e.getCanvas().style.cursor = "");
7366
7367
  }
7367
7368
  return;
@@ -7369,23 +7370,23 @@ const Mapbox = forwardRef((e, c) => {
7369
7370
  if (t === "polyline") {
7370
7371
  let e = mt.current;
7371
7372
  if (e.length >= 2) {
7372
- let t = pt.current, n = applyEntityConfig({
7373
+ let t = q.current, n = applyEntityConfig({
7373
7374
  ...t,
7374
7375
  id: t?.id ?? Mt(),
7375
7376
  type: "polyline",
7376
7377
  coordinates: [...e]
7377
- }, D);
7378
+ }, E);
7378
7379
  tn();
7379
- let r = I.current;
7380
- if (r && !L.current.has(n.id)) {
7381
- let e = new PolylineRenderer(r, n, O, k, M);
7382
- L.current.set(n.id, e);
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);
7383
7384
  }
7384
- Q.current.onPolylineAdd?.(n), mt.current = [], pt.current = null, U.current && (U.current = !1, H(null), r && (r.getCanvas().style.cursor = ""));
7385
+ Q.current.onPolylineAdd?.(n), mt.current = [], q.current = null, H.current && (H.current = !1, V(null), r && (r.getCanvas().style.cursor = ""));
7385
7386
  } else if (e.length > 0) mt.current = [], tn();
7386
7387
  else {
7387
- H(null);
7388
- let e = I.current;
7388
+ V(null);
7389
+ let e = F.current;
7389
7390
  e && (e.getCanvas().style.cursor = "");
7390
7391
  }
7391
7392
  return;
@@ -7401,9 +7402,9 @@ const Mapbox = forwardRef((e, c) => {
7401
7402
  return;
7402
7403
  }
7403
7404
  }
7404
- for (let [t, a] of L.current) {
7405
+ for (let [t, a] of I.current) {
7405
7406
  let o = a.getLabelLayerId();
7406
- if (o && I.current?.getLayer(o) && I.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
7407
+ if (o && F.current?.getLayer(o) && F.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
7407
7408
  let e = i.find((e) => e.id === t);
7408
7409
  if (e) {
7409
7410
  wn(e, r, n);
@@ -7411,7 +7412,7 @@ const Mapbox = forwardRef((e, c) => {
7411
7412
  }
7412
7413
  }
7413
7414
  }
7414
- for (let [e, t] of L.current) if (t.isPointInEntity(n)) {
7415
+ for (let [e, t] of I.current) if (t.isPointInEntity(n)) {
7415
7416
  let t = i.find((t) => t.id === e);
7416
7417
  if (t) {
7417
7418
  wn(t, r, n);
@@ -7427,11 +7428,11 @@ const Mapbox = forwardRef((e, c) => {
7427
7428
  Zt,
7428
7429
  tn
7429
7430
  ]), wn = useCallback((e, t, n) => {
7430
- let r = He.current?.getBoundingClientRect(), i = r ? {
7431
+ let r = Ue.current?.getBoundingClientRect(), i = r ? {
7431
7432
  x: t.x + r.left,
7432
7433
  y: t.y + r.top
7433
7434
  } : t;
7434
- Xe({
7435
+ Ze({
7435
7436
  position: i,
7436
7437
  lngLat: n,
7437
7438
  items: [{
@@ -7452,7 +7453,7 @@ const Mapbox = forwardRef((e, c) => {
7452
7453
  }]
7453
7454
  });
7454
7455
  }, []), Tn = useCallback(() => {
7455
- Xe(null);
7456
+ Ze(null);
7456
7457
  }, []);
7457
7458
  useEffect(() => {
7458
7459
  let e = document.createElement("div");
@@ -7463,11 +7464,11 @@ const Mapbox = forwardRef((e, c) => {
7463
7464
  width: 100%;
7464
7465
  pointer-events: none;
7465
7466
  height: 100%;
7466
- z-index: ${F?.zIndex ?? 1e3};
7467
- `, document.body.appendChild(e), Ke.current = e, () => {
7467
+ z-index: ${P?.zIndex ?? 1e3};
7468
+ `, document.body.appendChild(e), qe.current = e, () => {
7468
7469
  document.body.contains(e) && document.body.removeChild(e);
7469
7470
  };
7470
- }, [F?.zIndex]), useEffect(() => {
7471
+ }, [P?.zIndex]), useEffect(() => {
7471
7472
  let e = document.createElement("div");
7472
7473
  return e.id = `mapbox-context-menu-container-${Date.now()}`, e.style.cssText = `
7473
7474
  position: fixed;
@@ -7476,65 +7477,65 @@ const Mapbox = forwardRef((e, c) => {
7476
7477
  width: 100%;
7477
7478
  pointer-events: none;
7478
7479
  height: 100%;
7479
- z-index: ${(F?.zIndex ?? 1e3) + 100};
7480
- `, document.body.appendChild(e), Ze.current = e, () => {
7480
+ z-index: ${(P?.zIndex ?? 1e3) + 100};
7481
+ `, document.body.appendChild(e), Qe.current = e, () => {
7481
7482
  document.body.contains(e) && document.body.removeChild(e);
7482
7483
  };
7483
- }, [F?.zIndex]);
7484
- let En = useRef(T);
7485
- En.current = T;
7486
- let Dn = useRef(Le);
7487
- Dn.current = Le;
7484
+ }, [P?.zIndex]);
7485
+ let En = useRef(w);
7486
+ En.current = w;
7487
+ let Dn = useRef(Re);
7488
+ Dn.current = Re;
7488
7489
  let On = useRef(wt);
7489
7490
  On.current = wt;
7490
- let kn = useRef(et);
7491
- kn.current = et;
7492
- let An = useRef(b);
7493
- An.current = b;
7494
- let jn = useRef(at);
7495
- jn.current = at;
7496
- let Mn = useRef(ot);
7497
- Mn.current = ot;
7498
- let Nn = useRef(st);
7499
- Nn.current = st;
7500
- let Q = useRef(v);
7501
- Q.current = v;
7502
- let Pn = useRef(D);
7503
- Pn.current = D, useEffect(() => {
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(() => {
7504
7505
  let e = (e) => {
7505
7506
  if (e.key === "Escape" && J.current) {
7506
- L.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7507
+ I.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7507
7508
  return;
7508
7509
  }
7509
- if (e.key === "Escape" && et === "edit") {
7510
- if (at && (V(null), H(null), Y()), ot === "rectangle") if (st) ct(null), Lt();
7510
+ if (e.key === "Escape" && tt === "edit") {
7511
+ if (ot && (B(null), V(null), Y()), st === "rectangle") if (ct) lt(null), Lt();
7511
7512
  else {
7512
- H(null);
7513
- let e = I.current;
7513
+ V(null);
7514
+ let e = F.current;
7514
7515
  e && (e.getCanvas().style.cursor = "");
7515
7516
  }
7516
- if (ot === "circle") if (ut.current) ut.current = null, Ht();
7517
+ if (st === "circle") if (dt.current) dt.current = null, Ht();
7517
7518
  else {
7518
- H(null);
7519
- let e = I.current;
7519
+ V(null);
7520
+ let e = F.current;
7520
7521
  e && (e.getCanvas().style.cursor = "");
7521
7522
  }
7522
- if (ot === "polygon") if (dt.current.length > 0) dt.current = [], Kt();
7523
+ if (st === "polygon") if (ft.current.length > 0) ft.current = [], Kt();
7523
7524
  else {
7524
- H(null);
7525
- let e = I.current;
7525
+ V(null);
7526
+ let e = F.current;
7526
7527
  e && (e.getCanvas().style.cursor = "");
7527
7528
  }
7528
- if (ot === "square") if (ft.current) ft.current = null, Zt();
7529
+ if (st === "square") if (pt.current) pt.current = null, Zt();
7529
7530
  else {
7530
- H(null);
7531
- let e = I.current;
7531
+ V(null);
7532
+ let e = F.current;
7532
7533
  e && (e.getCanvas().style.cursor = "");
7533
7534
  }
7534
- if (ot === "polyline") if (mt.current.length > 0) mt.current = [], tn();
7535
+ if (st === "polyline") if (mt.current.length > 0) mt.current = [], tn();
7535
7536
  else {
7536
- H(null);
7537
- let e = I.current;
7537
+ V(null);
7538
+ let e = F.current;
7538
7539
  e && (e.getCanvas().style.cursor = "");
7539
7540
  }
7540
7541
  }
@@ -7543,10 +7544,10 @@ const Mapbox = forwardRef((e, c) => {
7543
7544
  document.removeEventListener("keydown", e);
7544
7545
  };
7545
7546
  }, [
7546
- et,
7547
- at,
7547
+ tt,
7548
7548
  ot,
7549
7549
  st,
7550
+ ct,
7550
7551
  Y,
7551
7552
  Lt,
7552
7553
  Ht,
@@ -7554,51 +7555,51 @@ const Mapbox = forwardRef((e, c) => {
7554
7555
  Zt,
7555
7556
  tn
7556
7557
  ]), useEffect(() => {
7557
- let e = I.current;
7558
- if (!e || !z) return;
7559
- let t = z.entityId, n = z.config, r = () => {
7558
+ let e = F.current;
7559
+ if (!e || !R) return;
7560
+ let t = R.entityId, n = R.config, r = () => {
7560
7561
  let r = En.current.find((e) => e.id === t);
7561
7562
  if (!r) {
7562
7563
  Et();
7563
7564
  return;
7564
7565
  }
7565
- let { position: i } = calculatePopupPosition(r, n, e, void 0, qe.current);
7566
- qe.current && (qe.current.style.left = `${i.x}px`, qe.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`);
7567
7568
  }, i = setTimeout(() => {
7568
7569
  r();
7569
7570
  }, 50);
7570
7571
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
7571
7572
  clearTimeout(i), e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
7572
7573
  };
7573
- }, [z?.entityId, Et]), useEffect(() => {
7574
- let e = I.current, t = He.current;
7575
- if (!e || !Ye || !t) return;
7576
- let n = Ye.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 = () => {
7577
7578
  let r = e.project(n), i = t.clientWidth, a = t.clientHeight;
7578
7579
  if (r.x < 0 || r.x > i || r.y < 0 || r.y > a) {
7579
7580
  Tn();
7580
7581
  return;
7581
7582
  }
7582
7583
  let o = t.getBoundingClientRect(), s = r.x + o.left, c = r.y + o.top;
7583
- Qe.current && (Qe.current.style.left = `${s}px`, Qe.current.style.top = `${c}px`);
7584
+ $e.current && ($e.current.style.left = `${s}px`, $e.current.style.top = `${c}px`);
7584
7585
  };
7585
7586
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
7586
7587
  e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
7587
7588
  };
7588
- }, [Ye?.lngLat, Tn]), useEffect(() => {
7589
- if (!He.current) return;
7589
+ }, [Xe?.lngLat, Tn]), useEffect(() => {
7590
+ if (!Ue.current) return;
7590
7591
  let e = {
7591
7592
  version: 8,
7592
7593
  sources: {},
7593
7594
  layers: []
7594
- }, { 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({
7595
- container: He.current,
7596
- 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,
7597
7598
  center: l,
7598
7599
  zoom: u,
7599
7600
  pitch: d,
7600
7601
  bearing: f,
7601
- maxBounds: g,
7602
+ maxBounds: h,
7602
7603
  dragPan: t,
7603
7604
  scrollZoom: n,
7604
7605
  doubleClickZoom: r,
@@ -7607,7 +7608,7 @@ const Mapbox = forwardRef((e, c) => {
7607
7608
  dragRotate: o,
7608
7609
  pitchWithRotate: c,
7609
7610
  touchPitch: p,
7610
- boxZoom: m,
7611
+ boxZoom: ve,
7611
7612
  transformRequest: (e, t) => {
7612
7613
  if (t === "Glyphs") {
7613
7614
  let t = e.match(/\/fonts\/([^/]+)\/(\d+-\d+)\.pbf/);
@@ -7619,54 +7620,54 @@ const Mapbox = forwardRef((e, c) => {
7619
7620
  return { url: e };
7620
7621
  }
7621
7622
  });
7622
- return I.current = _, _.on("load", () => {
7623
- if (!_.getStyle().glyphs) {
7624
- 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";
7625
7626
  e.glyphs = t, e.stylesheet && (e.stylesheet.glyphs = t);
7626
7627
  }
7627
- R.current.clear(), T.forEach((e) => {
7628
- R.current.set(e.id, e);
7629
- }), yn(S), dn(), Ft(), Rt(), Wt(), Jt(), $t(), $e(_), Ie?.(_);
7630
- }), _.on("click", xn), _.on("mousemove", Sn), _.on("contextmenu", Cn), () => {
7631
- _.off("click", xn), _.off("mousemove", Sn), _.off("contextmenu", Cn), fn(), jt(), Y(), X(), Z(), _.remove(), I.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;
7632
7633
  };
7633
7634
  }, []), useEffect(() => {
7634
- if (I.current) {
7635
- if (!I.current.isStyleLoaded()) {
7636
- I.current.once("load", () => {
7637
- R.current.clear(), T.forEach((e) => {
7638
- R.current.set(e.id, e);
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);
7639
7640
  }), dn();
7640
7641
  });
7641
7642
  return;
7642
7643
  }
7643
- R.current.clear(), T.forEach((e) => {
7644
- R.current.set(e.id, e);
7644
+ L.current.clear(), w.forEach((e) => {
7645
+ L.current.set(e.id, e);
7645
7646
  }), dn();
7646
7647
  }
7647
- }, [T, dn]), useEffect(() => {
7648
- !I.current || !I.current.isStyleLoaded() || (fn(), dn());
7648
+ }, [w, dn]), useEffect(() => {
7649
+ !F.current || !F.current.isStyleLoaded() || (fn(), dn());
7649
7650
  }, [
7651
+ D,
7650
7652
  O,
7651
7653
  k,
7652
7654
  A,
7653
7655
  j,
7654
- M,
7655
7656
  fn,
7656
7657
  dn
7657
7658
  ]), useEffect(() => {
7658
- if (I.current) {
7659
- if (!I.current.isStyleLoaded()) {
7660
- I.current.once("load", () => {
7661
- yn(S);
7659
+ if (F.current) {
7660
+ if (!F.current.isStyleLoaded()) {
7661
+ F.current.once("load", () => {
7662
+ yn(x);
7662
7663
  });
7663
7664
  return;
7664
7665
  }
7665
- yn(S);
7666
+ yn(x);
7666
7667
  }
7667
- }, [S, yn]);
7668
- let Fn = useRef(void 0), In = useRef(!0), Ln = useRef(S);
7669
- Ln.current = S;
7668
+ }, [x, yn]);
7669
+ let Fn = useRef(void 0), In = useRef(!0), Ln = useRef(x);
7670
+ Ln.current = x;
7670
7671
  let Rn = useRef(yn);
7671
7672
  Rn.current = yn;
7672
7673
  let zn = useRef(fn);
@@ -7683,31 +7684,31 @@ const Mapbox = forwardRef((e, c) => {
7683
7684
  Wn.current = Jt;
7684
7685
  let Gn = useRef($t);
7685
7686
  Gn.current = $t, useEffect(() => {
7686
- let e = I.current;
7687
+ let e = F.current;
7687
7688
  if (!e) return;
7688
- let t = h || {
7689
+ let t = m || {
7689
7690
  version: 8,
7690
7691
  sources: {},
7691
7692
  layers: []
7692
7693
  };
7693
7694
  if (In.current) {
7694
- In.current = !1, Fn.current = h;
7695
+ In.current = !1, Fn.current = m;
7695
7696
  return;
7696
7697
  }
7697
- Fn.current !== h && (Fn.current = h, e.setStyle(t), e.once("style.load", () => {
7698
+ Fn.current !== m && (Fn.current = m, e.setStyle(t), e.once("style.load", () => {
7698
7699
  if (!e.getStyle().glyphs) {
7699
7700
  let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
7700
7701
  t.glyphs = n, t.stylesheet && (t.stylesheet.glyphs = n);
7701
7702
  }
7702
- We.current.clear(), Rn.current(Ln.current), zn.current(), Bn.current(), Vn.current(), Hn.current(), Un.current(), Wn.current(), Gn.current();
7703
+ Ge.current.clear(), Rn.current(Ln.current), zn.current(), Bn.current(), Vn.current(), Hn.current(), Un.current(), Wn.current(), Gn.current();
7703
7704
  }));
7704
- }, [h]), useEffect(() => {
7705
- let e = new Set(E.map(String));
7706
- for (let [t, n] of L.current) n.setSelected(e.has(String(t)));
7707
- }, [E]);
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]);
7708
7709
  let Kn = useRef({});
7709
7710
  useEffect(() => {
7710
- let e = I.current;
7711
+ let e = F.current;
7711
7712
  if (!e) return;
7712
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;
7713
7714
  !n && !r && !i && !a || (Kn.current = {
@@ -7727,13 +7728,13 @@ const Mapbox = forwardRef((e, c) => {
7727
7728
  d,
7728
7729
  f
7729
7730
  ]);
7730
- let qn = (() => we === !1 ? null : we === !0 ? { enabled: !0 } : we)(), Jn = (() => N === !1 ? null : N === !0 ? { enabled: !0 } : N)(), Yn = (() => Te === !1 ? null : Te === !0 ? { enabled: !0 } : Te)(), $ = (() => {
7731
- if (Ee === !1) return null;
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;
7732
7733
  let e, t, n;
7733
- if (S && S.length > 0) {
7734
- let r = S.find((e) => e.hasRoadNetwork === !0) || S[0];
7734
+ if (x && x.length > 0) {
7735
+ let r = x.find((e) => e.hasRoadNetwork === !0) || x[0];
7735
7736
  if (r.type === "style") {
7736
- let t = I.current?.getStyle();
7737
+ let t = F.current?.getStyle();
7737
7738
  if (t?.sources) {
7738
7739
  let n = `base-layer-source-${r.id}-`, i = Object.keys(t.sources).find((e) => e.startsWith(n));
7739
7740
  i && (e = i);
@@ -7741,63 +7742,63 @@ const Mapbox = forwardRef((e, c) => {
7741
7742
  } else e = `base-layer-source-${r.id}`;
7742
7743
  t = r.roadNetworkSourceLayer || "road", n = r.roadNetworkClassField;
7743
7744
  }
7744
- return Ee === !0 ? {
7745
+ return De === !0 ? {
7745
7746
  enabled: !0,
7746
7747
  source: e,
7747
7748
  sourceLayer: t,
7748
7749
  classField: n
7749
7750
  } : {
7750
- ...Ee,
7751
- source: Ee.source || e,
7752
- sourceLayer: Ee.sourceLayer || t,
7753
- classField: Ee.classField || n
7751
+ ...De,
7752
+ source: De.source || e,
7753
+ sourceLayer: De.sourceLayer || t,
7754
+ classField: De.classField || n
7754
7755
  };
7755
- })(), Xn = (() => De ? De === !0 ? { enabled: !0 } : De : null)(), Zn = (() => je ? je === !0 ? { enabled: !0 } : je : null)(), Qn = (() => Me || 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(() => {
7756
7757
  let e = [];
7757
- for (let t of S) if (t.applyRasterPaint) if (t.type === "style") {
7758
- let n = I.current;
7758
+ for (let t of x) if (t.applyRasterPaint) if (t.type === "style") {
7759
+ let n = F.current;
7759
7760
  if (n) {
7760
7761
  let r = `base-layer-${t.id}-`, i = n.getStyle();
7761
7762
  if (i?.layers) for (let t of i.layers) t.id.startsWith(r) && t.type === "raster" && e.push(t.id);
7762
7763
  }
7763
7764
  } else e.push(`base-layer-${t.id}`);
7764
7765
  return e;
7765
- }, [S, B]);
7766
+ }, [x, z]);
7766
7767
  return /* @__PURE__ */ jsxs("div", {
7767
- className: `comp-mapbox ${et === "picker" ? "comp-mapbox--picker-mode" : ""} ${Be}`,
7768
- style: Ve,
7768
+ className: `comp-mapbox ${tt === "picker" ? "comp-mapbox--picker-mode" : ""} ${Ve}`,
7769
+ style: He,
7769
7770
  children: [
7770
7771
  /* @__PURE__ */ jsx("div", {
7771
- ref: He,
7772
+ ref: Ue,
7772
7773
  className: "comp-mapbox__map"
7773
7774
  }),
7774
- et === "picker" && y.showCrosshair === !0 && /* @__PURE__ */ jsxs("div", {
7775
+ tt === "picker" && v.showCrosshair === !0 && /* @__PURE__ */ jsxs("div", {
7775
7776
  className: "comp-mapbox__crosshair",
7776
7777
  children: [/* @__PURE__ */ jsx("div", {
7777
7778
  className: "comp-mapbox__crosshair-h",
7778
- style: y.crosshairColor ? { backgroundColor: y.crosshairColor } : void 0
7779
+ style: v.crosshairColor ? { backgroundColor: v.crosshairColor } : void 0
7779
7780
  }), /* @__PURE__ */ jsx("div", {
7780
7781
  className: "comp-mapbox__crosshair-v",
7781
- style: y.crosshairColor ? { backgroundColor: y.crosshairColor } : void 0
7782
+ style: v.crosshairColor ? { backgroundColor: v.crosshairColor } : void 0
7782
7783
  })]
7783
7784
  }),
7784
- et === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) || $ && $.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", {
7785
7786
  className: "comp-mapbox__edit-controls",
7786
7787
  children: [
7787
- et === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
7788
- markerTemplates: v.markerTemplates || [],
7789
- selectedTemplate: at,
7788
+ tt === "edit" && _.showEditTools !== !1 && (_.markerTemplates && _.markerTemplates.length > 0 || _.showRectangleTool || _.showCircleTool || _.showPolygonTool || _.showSquareTool || _.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
7789
+ markerTemplates: _.markerTemplates || [],
7790
+ selectedTemplate: ot,
7790
7791
  onTemplateSelect: nn,
7791
- drawMode: ot,
7792
+ drawMode: st,
7792
7793
  onDrawModeChange: rn,
7793
- showRectangleTool: v.showRectangleTool,
7794
- showCircleTool: v.showCircleTool,
7795
- showPolygonTool: v.showPolygonTool,
7796
- showSquareTool: v.showSquareTool,
7797
- showPolylineTool: v.showPolylineTool
7794
+ showRectangleTool: _.showRectangleTool,
7795
+ showCircleTool: _.showCircleTool,
7796
+ showPolygonTool: _.showPolygonTool,
7797
+ showSquareTool: _.showSquareTool,
7798
+ showPolylineTool: _.showPolylineTool
7798
7799
  }),
7799
7800
  $ && $.enabled !== !1 && /* @__PURE__ */ jsx(RoadHighlightControl, {
7800
- map: B,
7801
+ map: z,
7801
7802
  highlightWidth: $.highlightWidth,
7802
7803
  defaultRoadTypes: $.defaultRoadTypes,
7803
7804
  defaultMinWidth: $.defaultMinWidth,
@@ -7808,8 +7809,8 @@ const Mapbox = forwardRef((e, c) => {
7808
7809
  style: $.style
7809
7810
  }),
7810
7811
  Qn && Qn.enabled !== !1 && /* @__PURE__ */ jsx(RoutePlanningControl, {
7811
- ref: Ue,
7812
- map: B,
7812
+ ref: We,
7813
+ map: z,
7813
7814
  pointCount: Qn.pointCount,
7814
7815
  showPointCountInput: Qn.showPointCountInput,
7815
7816
  visualType: Qn.visualType,
@@ -7821,21 +7822,21 @@ const Mapbox = forwardRef((e, c) => {
7821
7822
  className: "comp-mapbox__controls",
7822
7823
  children: [
7823
7824
  qn && qn.enabled !== !1 && /* @__PURE__ */ jsx(CoordinateDisplay, {
7824
- map: B,
7825
+ map: z,
7825
7826
  precision: qn.precision,
7826
7827
  className: qn.className,
7827
7828
  style: qn.style
7828
7829
  }),
7829
7830
  Jn && Jn.enabled !== !1 && /* @__PURE__ */ jsx(ScaleControl, {
7830
- map: B,
7831
+ map: z,
7831
7832
  maxWidth: Jn.maxWidth,
7832
7833
  unit: Jn.unit,
7833
7834
  className: Jn.className,
7834
7835
  style: Jn.style
7835
7836
  }),
7836
7837
  Xn && Xn.enabled !== !1 && /* @__PURE__ */ jsx(MeasureControl, {
7837
- map: B,
7838
- entityConfig: D,
7838
+ map: z,
7839
+ entityConfig: E,
7839
7840
  onDrawModeChange: (e) => {
7840
7841
  gt.current = e;
7841
7842
  },
@@ -7843,15 +7844,15 @@ const Mapbox = forwardRef((e, c) => {
7843
7844
  style: Xn.style
7844
7845
  }),
7845
7846
  Zn && Zn.enabled !== !1 && /* @__PURE__ */ jsx(RasterPaintControl, {
7846
- map: B,
7847
- value: w,
7848
- onChange: Ne,
7847
+ map: z,
7848
+ value: C,
7849
+ onChange: Pe,
7849
7850
  rasterPaintLayerIds: $n,
7850
7851
  className: Zn.className,
7851
7852
  style: Zn.style
7852
7853
  }),
7853
7854
  Yn && Yn.enabled !== !1 && /* @__PURE__ */ jsx(ResetViewControl, {
7854
- map: B,
7855
+ map: z,
7855
7856
  initialCenter: l,
7856
7857
  initialZoom: u,
7857
7858
  initialPitch: d,
@@ -7863,21 +7864,21 @@ const Mapbox = forwardRef((e, c) => {
7863
7864
  ]
7864
7865
  }),
7865
7866
  !(Qn && Qn.enabled !== !1) && /* @__PURE__ */ jsx(RoutePlanningControl, {
7866
- ref: Ue,
7867
- map: B,
7867
+ ref: We,
7868
+ map: z,
7868
7869
  showButton: !1
7869
7870
  }),
7870
- z && Ke.current && /* @__PURE__ */ jsx(EntityPopup, {
7871
- popupState: z,
7872
- onClose: () => Tt(z.entityId),
7873
- portalContainer: Ke.current,
7874
- popupRef: qe
7871
+ R && qe.current && /* @__PURE__ */ jsx(EntityPopup, {
7872
+ popupState: R,
7873
+ onClose: () => Tt(R.entityId),
7874
+ portalContainer: qe.current,
7875
+ popupRef: Je
7875
7876
  }),
7876
- Ye && Ze.current && /* @__PURE__ */ jsx(ContextMenu, {
7877
- menuState: Ye,
7877
+ Xe && Qe.current && /* @__PURE__ */ jsx(ContextMenu, {
7878
+ menuState: Xe,
7878
7879
  onClose: Tn,
7879
- portalContainer: Ze.current,
7880
- menuRef: Qe
7880
+ portalContainer: Qe.current,
7881
+ menuRef: $e
7881
7882
  })
7882
7883
  ]
7883
7884
  });