bbl-mapbox-react 0.0.22 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3932,8 +3932,8 @@ 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, p] = useState(!1), h = useRef(e.position), g = useRef(!1), _ = s || c;
3936
- g.current || (h.current = e.position), useEffect(() => {
3935
+ let c = useRef(null), [l, u] = useState("entering"), [d, p] = useState(!1), g = useRef(e.position), _ = useRef(!1), v = s || c;
3936
+ _.current || (g.current = e.position), useEffect(() => {
3937
3937
  let e = setTimeout(() => {
3938
3938
  p(!0);
3939
3939
  }, 60);
@@ -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 v = useCallback(() => {
3948
- e.config.animation === "none" ? r() : (g.current = !0, u("exiting"), setTimeout(() => r(), 200));
3947
+ let y = useCallback(() => {
3948
+ e.config.animation === "none" ? r() : (_.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" && v();
3953
+ e.key === "Escape" && y();
3954
3954
  };
3955
3955
  return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
3956
- }, [e.config.closeOnEscape, v]), useEffect(() => {
3956
+ }, [e.config.closeOnEscape, y]), useEffect(() => {
3957
3957
  if (!e.config.closeOnClickOutside) return;
3958
3958
  let t = (e) => {
3959
- _.current && !_.current.contains(e.target) && v();
3959
+ v.current && !v.current.contains(e.target) && y();
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
- v,
3969
- _
3968
+ y,
3969
+ v
3970
3970
  ]);
3971
- let y = () => {
3971
+ let b = () => {
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
- }, b = h.current, x = /* @__PURE__ */ jsxs("div", {
3981
- ref: _,
3980
+ }, x = g.current, S = /* @__PURE__ */ jsxs("div", {
3981
+ ref: v,
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: `${b.x}px`,
3986
- top: `${b.y}px`,
3985
+ left: `${x.x}px`,
3986
+ top: `${x.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: y(),
3991
+ transformOrigin: b(),
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: v,
3998
+ onClick: y,
3999
3999
  "aria-label": "Close popup",
4000
4000
  children: "×"
4001
4001
  }), /* @__PURE__ */ jsx("div", {
@@ -4003,24 +4003,24 @@ const EntityPopup = ({ popupState: e, onClose: r, portalContainer: i, popupRef:
4003
4003
  children: e.config.content
4004
4004
  })]
4005
4005
  });
4006
- return createPortal(x, i);
4006
+ return createPortal(S, 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: s }) {
4010
- let [c, l] = useState(null), [u, d] = useState(!1), f = useRef(void 0), h = useCallback((e) => {
4010
+ let [c, l] = useState(null), [u, d] = useState(!1), f = useRef(void 0), g = useCallback((e) => {
4011
4011
  l({
4012
4012
  lng: Number(e.lngLat.lng.toFixed(r)),
4013
4013
  lat: Number(e.lngLat.lat.toFixed(r))
4014
4014
  });
4015
4015
  }, [r]);
4016
4016
  useEffect(() => {
4017
- if (e) return e.on("mousemove", h), () => {
4018
- e.off("mousemove", h);
4017
+ if (e) return e.on("mousemove", g), () => {
4018
+ e.off("mousemove", g);
4019
4019
  };
4020
- }, [e, h]), useEffect(() => () => {
4020
+ }, [e, g]), useEffect(() => () => {
4021
4021
  f.current && clearTimeout(f.current);
4022
4022
  }, []);
4023
- let g = useCallback(() => {
4023
+ let _ = useCallback(() => {
4024
4024
  if (!c) return;
4025
4025
  let e = `${c.lng},${c.lat}`;
4026
4026
  navigator.clipboard.writeText(e).then(() => {
@@ -4030,7 +4030,7 @@ function CoordinateDisplay({ map: e, precision: r = 6, className: i = "", style:
4030
4030
  return c ? /* @__PURE__ */ jsxs("div", {
4031
4031
  className: `mapbox-coordinate-display ${u ? "mapbox-coordinate-display--copied" : ""} ${i}`,
4032
4032
  style: s,
4033
- onClick: g,
4033
+ onClick: _,
4034
4034
  title: "点击复制坐标",
4035
4035
  children: [/* @__PURE__ */ jsx("img", {
4036
4036
  src: location_default,
@@ -4155,7 +4155,7 @@ function ResetViewControl({ map: e, initialCenter: t, initialZoom: n, initialPit
4155
4155
  }), /* @__PURE__ */ jsx("span", { children: "复位" })]
4156
4156
  });
4157
4157
  }
4158
- var road_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='1769487141027'%20class='icon'%20viewBox='0%200%201517%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='2644'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='189.625'%20height='128'%3e%3cpath%20d='M1.68121071-242.12320149h1508.24640296v1508.24640298h-1508.24640296z'%20fill='%23ffffff'%20fill-opacity='0'%20p-id='2645'%3e%3c/path%3e%3cpath%20d='M437.30078846%20170.6624h682.66239999v682.6624H437.30078846z'%20fill='%23ffffff'%20fill-opacity='0'%20p-id='2646'%3e%3c/path%3e%3cpath%20d='M1151.68343834%2040.66710748H373.42829443A81.76345149%2081.76345149%200%200%200%20292.90207634%20121.49379654v784.42363608c0%2040.42218191%2036.92257893%2077.41545989%2080.5262181%2077.4154599h781.6133488a81.76345149%2081.76345149%200%200%200%2080.52621814-80.82668906V121.49379654C1232.08593315%2077.76643404%201195.25172802%2040.66710748%201151.6657636%2040.66710748z%20m-325.39237822%20616.14222197H618.29445458V451.37556451h53.66057906c6.71640976%200%2013.41514477-3.35820487%2020.11387975-6.73408452l97.28189301-100.99359314h134.18679716v208.72127078c-46.96184405%2013.50351858-87.22495312%2053.90802574-97.28189299%20104.4048223z%20m130.7932427-20.23760311c23.50743418%200%2043.65666346%2020.21992834%2043.65666349%2043.76271204a44.50505206%2044.50505206%200%200%201-43.62131391%2043.7803868%2044.50505206%2044.50505206%200%200%201-43.6036392-43.7803868c0-23.54278369%2020.096205-43.76271203%2043.6036392-43.76271204h-0.05302433zM564.63387554%20926.10201142H373.42829443a22.87114272%2022.87114272%200%200%201-16.79102442-6.71640975%2023.04789036%2023.04789036%200%200%201-6.71640975-16.82637394V714.02253578h214.73069002v212.07947564z%20m0-269.31035673H349.92086026V118.13559167c0-10.1453137%2010.05693988-20.2376031%2023.50743417-20.23760309h553.4321645v188.53669194h-147.54891766c-6.69873499%200-13.39747001%203.35820487-20.096205%206.71640977l-97.28189297%2097.653063H460.61789801a26.44144475%2026.44144475%200%200%200-19.08874355%207.79457028%2026.63586714%2026.63586714%200%200%200-7.72387123%2019.1594426c0%2016.80869917%2013.39747001%2026.90098858%2026.81261478%2026.90098857h104.03365227v212.13249995z%20m610.48629795%20245.71454877c0.17674763%206.29221547-2.24469484%2012.37233377-6.68106024%2016.84404869s-10.49880895%206.89315739-16.77334965%206.75175927h-533.42433329v-212.0971504H829.63159021c13.39747001%2057.24855586%2067.07572382%2097.65306301%20127.48806219%2097.653063a128.67227125%20128.67227125%200%200%200%2093.05762473-37.87701612%20129.60903367%20129.60903367%200%200%200%2037.73561801-93.39344522c0-64.00031515-46.96184405-117.8553166-103.98062799-128.00063029v-208.73894554h194.56378599v558.91134088h-3.35820489v-0.05302427z%20m0-616.07152294H980.57406228V97.89798858h171.10937607c13.39747001%200%2023.45440988%2010.07461465%2023.4544099%2023.59580796v164.94088398z'%20fill='%23ffffff'%20p-id='2647'%3e%3c/path%3e%3c/svg%3e", LAYER_ID_PREFIX = "road-highlight-", KNOWN_SOURCES = [
4158
+ var LAYER_ID_PREFIX = "road-highlight-", KNOWN_SOURCES = [
4159
4159
  {
4160
4160
  source: "composite",
4161
4161
  sourceLayer: "road"
@@ -4182,10 +4182,10 @@ function detectVectorSource(e) {
4182
4182
  };
4183
4183
  return null;
4184
4184
  }
4185
- function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes: i = [], defaultMinWidth: c = 0, source: l, sourceLayer: u, classField: d = "class", className: f = "", style: p }) {
4186
- 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) => {
4185
+ const RoadHighlightControl = forwardRef(({ map: e, highlightWidth: i = 3, defaultRoadTypes: c = [], defaultMinWidth: l = 0, source: u, sourceLayer: d, classField: _ = "class", className: v = "", style: y, showButton: b = !0 }, x) => {
4186
+ let [S, C] = useState(!1), [w, ve] = useState(c), [T, E] = useState(!1), [D, ye] = useState(null), be = useRef(!1), k = useRef(null), A = useRef(null), j = useRef(null), xe = useCallback((e, t, n) => {
4187
4187
  if (!e.isStyleLoaded() || !e.getSource(t)) return !1;
4188
- let i = !0;
4188
+ let r = !0;
4189
4189
  return ROAD_TYPE_OPTIONS.forEach((a) => {
4190
4190
  let o = `${LAYER_ID_PREFIX}${a.class}`;
4191
4191
  if (!e.getLayer(o)) try {
@@ -4196,50 +4196,50 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4196
4196
  "source-layer": n,
4197
4197
  filter: [
4198
4198
  "==",
4199
- ["get", d],
4199
+ ["get", _],
4200
4200
  a.class
4201
4201
  ],
4202
4202
  paint: {
4203
4203
  "line-color": a.color,
4204
- "line-width": r,
4204
+ "line-width": i,
4205
4205
  "line-opacity": .8
4206
4206
  },
4207
4207
  layout: { visibility: "none" }
4208
4208
  }), console.log(`Added road highlight layer: ${o} (source: ${t}, source-layer: ${n})`);
4209
4209
  } catch (e) {
4210
- console.error(`Failed to add road highlight layer for ${a.class}:`, e), i = !1;
4210
+ console.error(`Failed to add road highlight layer for ${a.class}:`, e), r = !1;
4211
4211
  }
4212
- }), i;
4213
- }, [r, d]);
4212
+ }), r;
4213
+ }, [i, _]);
4214
4214
  useEffect(() => {
4215
4215
  if (!e) return;
4216
4216
  let t = () => {
4217
- let t = l, n = u;
4217
+ let t = u, n = d;
4218
4218
  if (!t || !n) {
4219
4219
  let r = detectVectorSource(e);
4220
4220
  r && (console.log("Auto-detected vector source:", r), t ||= r.source, n ||= r.sourceLayer);
4221
4221
  }
4222
- t && n ? T(e, t, n) && (S.current = !0, x(!0)) : console.warn("No vector source found for road highlighting");
4222
+ t && n ? xe(e, t, n) && (be.current = !0, E(!0)) : console.warn("No vector source found for road highlighting");
4223
4223
  };
4224
4224
  e.isStyleLoaded() ? t() : e.once("load", t);
4225
4225
  let n = () => {
4226
4226
  e.isStyleLoaded() && t();
4227
4227
  }, r = () => {
4228
- S.current || t();
4228
+ be.current || t();
4229
4229
  };
4230
4230
  return e.on("styledata", n), e.on("sourcedata", r), () => {
4231
4231
  e.off("styledata", n), e.off("sourcedata", r);
4232
4232
  };
4233
4233
  }, [
4234
4234
  e,
4235
- l,
4236
4235
  u,
4237
- T
4236
+ d,
4237
+ xe
4238
4238
  ]), useEffect(() => {
4239
- !e || !b || ROAD_TYPE_OPTIONS.forEach((t) => {
4239
+ !e || !T || ROAD_TYPE_OPTIONS.forEach((t) => {
4240
4240
  let n = `${LAYER_ID_PREFIX}${t.class}`;
4241
4241
  if (e.getLayer(n)) try {
4242
- let r = v.includes(t.class);
4242
+ let r = w.includes(t.class);
4243
4243
  e.setLayoutProperty(n, "visibility", r ? "visible" : "none");
4244
4244
  } catch (e) {
4245
4245
  console.error(`Failed to update layer ${n}:`, e);
@@ -4247,38 +4247,38 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4247
4247
  });
4248
4248
  }, [
4249
4249
  e,
4250
- b,
4251
- v
4250
+ T,
4251
+ w
4252
4252
  ]), useEffect(() => {
4253
- if (!g) return;
4253
+ if (!S) return;
4254
4254
  let e = (e) => {
4255
- ye.current && !ye.current.contains(e.target) && C.current && !C.current.contains(e.target) && _(!1);
4255
+ k.current && !k.current.contains(e.target) && A.current && !A.current.contains(e.target) && C(!1);
4256
4256
  }, t = setTimeout(() => {
4257
4257
  document.addEventListener("mousedown", e);
4258
4258
  }, 0);
4259
4259
  return () => {
4260
4260
  clearTimeout(t), document.removeEventListener("mousedown", e);
4261
4261
  };
4262
- }, [g]), useEffect(() => () => {
4262
+ }, [S]), useEffect(() => () => {
4263
4263
  e && e.getStyle() && ROAD_TYPE_OPTIONS.forEach((t) => {
4264
4264
  let n = `${LAYER_ID_PREFIX}${t.class}`;
4265
4265
  if (e.getLayer(n)) try {
4266
4266
  e.removeLayer(n);
4267
4267
  } catch {}
4268
- }), w.current &&= (w.current.remove(), null);
4268
+ }), j.current &&= (j.current.remove(), null);
4269
4269
  }, [e]);
4270
- let E = useCallback((e) => ROAD_TYPE_OPTIONS.find((t) => t.class === e)?.label || e, []), be = useCallback((t) => {
4271
- if (!e || v.length === 0) {
4272
- w.current && w.current.remove(), e?.getCanvas().style.cursor && (e.getCanvas().style.cursor = "");
4270
+ let M = useCallback((e) => ROAD_TYPE_OPTIONS.find((t) => t.class === e)?.label || e, []), N = useCallback((t) => {
4271
+ if (!e || w.length === 0) {
4272
+ j.current && j.current.remove(), e?.getCanvas().style.cursor && (e.getCanvas().style.cursor = "");
4273
4273
  return;
4274
4274
  }
4275
- 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)) });
4275
+ let n = w.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)) });
4276
4276
  if (i.length > 0) {
4277
- 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 || "", m = n.iso_3166_2 || "", ve = (e) => !(e == null || e === "" || typeof e == "string" && e.toLowerCase() === "none"), h = [];
4278
- ve(o) && h.push(`
4277
+ let n = i[0].properties || {}, r = t.lngLat, a = n.name || n.name_en || n.name_local || "", o = n[_] || "", 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 = [];
4278
+ m(o) && h.push(`
4279
4279
  <div class="road-highlight-popup__row">
4280
4280
  <span>道路类型:</span>
4281
- <span class="road-highlight-popup__value">${E(o)}</span>
4281
+ <span class="road-highlight-popup__value">${M(o)}</span>
4282
4282
  </div>
4283
4283
  `), h.push(`
4284
4284
  <div class="road-highlight-popup__row">
@@ -4290,12 +4290,12 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4290
4290
  <span>纬度:</span>
4291
4291
  <span class="road-highlight-popup__value">${r.lat.toFixed(6)}</span>
4292
4292
  </div>
4293
- `), ve(c) && h.push(`
4293
+ `), m(c) && h.push(`
4294
4294
  <div class="road-highlight-popup__row">
4295
4295
  <span>类别:</span>
4296
4296
  <span class="road-highlight-popup__value">${c}</span>
4297
4297
  </div>
4298
- `), ve(l) && h.push(`
4298
+ `), m(l) && h.push(`
4299
4299
  <div class="road-highlight-popup__row">
4300
4300
  <span>结构:</span>
4301
4301
  <span class="road-highlight-popup__value">${l}</span>
@@ -4305,20 +4305,20 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4305
4305
  <span>单行道:</span>
4306
4306
  <span class="road-highlight-popup__value">${u ? "是" : "否"}</span>
4307
4307
  </div>
4308
- `), ve(f) && h.push(`
4308
+ `), m(d) && h.push(`
4309
4309
  <div class="road-highlight-popup__row">
4310
4310
  <span>层级:</span>
4311
- <span class="road-highlight-popup__value">${f}</span>
4311
+ <span class="road-highlight-popup__value">${d}</span>
4312
4312
  </div>
4313
- `), ve(p) && h.push(`
4313
+ `), m(f) && h.push(`
4314
4314
  <div class="road-highlight-popup__row">
4315
4315
  <span>国家代码:</span>
4316
- <span class="road-highlight-popup__value">${p}</span>
4316
+ <span class="road-highlight-popup__value">${f}</span>
4317
4317
  </div>
4318
- `), ve(m) && h.push(`
4318
+ `), m(p) && h.push(`
4319
4319
  <div class="road-highlight-popup__row">
4320
4320
  <span>地区代码:</span>
4321
- <span class="road-highlight-popup__value">${m}</span>
4321
+ <span class="road-highlight-popup__value">${p}</span>
4322
4322
  </div>
4323
4323
  `);
4324
4324
  let g = `
@@ -4327,112 +4327,113 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4327
4327
  <div class="road-highlight-popup__info">${h.join("")}</div>
4328
4328
  </div>
4329
4329
  `;
4330
- w.current ||= new mapboxgl.Popup({
4330
+ j.current ||= new mapboxgl.Popup({
4331
4331
  closeButton: !1,
4332
4332
  closeOnClick: !1,
4333
4333
  offset: 15,
4334
4334
  className: "road-highlight-popup"
4335
- }), w.current.setLngLat(r).setHTML(g).addTo(e), e.getCanvas().style.cursor = "pointer";
4336
- } else w.current && w.current.remove(), e.getCanvas().style.cursor = "";
4335
+ }), j.current.setLngLat(r).setHTML(g).addTo(e), e.getCanvas().style.cursor = "pointer";
4336
+ } else j.current && j.current.remove(), e.getCanvas().style.cursor = "";
4337
4337
  }, [
4338
4338
  e,
4339
- v,
4340
- E,
4341
- d
4339
+ w,
4340
+ M,
4341
+ _
4342
4342
  ]);
4343
4343
  useEffect(() => {
4344
- if (!(!e || !b)) return e.on("mousemove", be), () => {
4345
- e.off("mousemove", be), w.current && w.current.remove(), e.getCanvas().style.cursor = "";
4344
+ if (!(!e || !T)) return e.on("mousemove", N), () => {
4345
+ e.off("mousemove", N), j.current && j.current.remove(), e.getCanvas().style.cursor = "";
4346
4346
  };
4347
4347
  }, [
4348
4348
  e,
4349
- b,
4350
- be
4349
+ T,
4350
+ N
4351
4351
  ]);
4352
- let xe = (e, t) => {
4353
- y((n) => t ? [...n, e] : n.filter((t) => t !== e));
4354
- }, O = (e) => {
4355
- y(e ? ROAD_TYPE_OPTIONS.map((e) => e.class) : []);
4356
- }, Se = v.length > 0;
4357
- return /* @__PURE__ */ jsxs("div", {
4358
- className: `mapbox-road-highlight-control ${f}`,
4359
- style: p,
4352
+ let P = (e, t) => {
4353
+ ve((n) => t ? [...n, e] : n.filter((t) => t !== e));
4354
+ }, Se = (e) => {
4355
+ ve(e ? ROAD_TYPE_OPTIONS.map((e) => e.class) : []);
4356
+ }, F = w.length > 0, Ce = () => /* @__PURE__ */ jsxs(Fragment, { children: [
4357
+ /* @__PURE__ */ jsxs("div", {
4358
+ className: "mapbox-road-highlight-control__panel-header",
4359
+ children: [/* @__PURE__ */ jsx("span", {
4360
+ className: "mapbox-road-highlight-control__panel-title",
4361
+ children: "道路类型"
4362
+ }), /* @__PURE__ */ jsx(Checkbox, {
4363
+ checked: w.length === ROAD_TYPE_OPTIONS.length,
4364
+ indeterminate: w.length > 0 && w.length < ROAD_TYPE_OPTIONS.length,
4365
+ onChange: Se,
4366
+ style: {
4367
+ "--color-text-1": "#fff",
4368
+ "--color-border-2": "rgba(255, 255, 255, 0.3)"
4369
+ },
4370
+ children: /* @__PURE__ */ jsx("span", {
4371
+ className: "mapbox-road-highlight-control__type-label",
4372
+ children: "全选"
4373
+ })
4374
+ })]
4375
+ }),
4376
+ /* @__PURE__ */ jsx("div", {
4377
+ className: "mapbox-road-highlight-control__scroll",
4378
+ children: /* @__PURE__ */ jsx("div", {
4379
+ className: "mapbox-road-highlight-control__type-list",
4380
+ children: ROAD_TYPE_OPTIONS.map((e) => /* @__PURE__ */ jsxs("div", {
4381
+ className: "mapbox-road-highlight-control__type-item",
4382
+ onClick: () => P(e.class, !w.includes(e.class)),
4383
+ children: [
4384
+ /* @__PURE__ */ jsx(Checkbox, {
4385
+ checked: w.includes(e.class),
4386
+ onChange: (t) => P(e.class, t),
4387
+ onClick: (e) => e.stopPropagation(),
4388
+ style: {
4389
+ "--color-text-1": "#fff",
4390
+ "--color-border-2": "rgba(255, 255, 255, 0.3)",
4391
+ marginRight: 0,
4392
+ flexShrink: 0
4393
+ }
4394
+ }),
4395
+ /* @__PURE__ */ jsx("span", {
4396
+ className: "mapbox-road-highlight-control__color-indicator",
4397
+ style: { backgroundColor: e.color }
4398
+ }),
4399
+ /* @__PURE__ */ jsx("span", {
4400
+ className: "mapbox-road-highlight-control__type-label",
4401
+ children: e.label
4402
+ })
4403
+ ]
4404
+ }, e.class))
4405
+ })
4406
+ }),
4407
+ /* @__PURE__ */ jsx("div", {
4408
+ className: "mapbox-road-highlight-control__tip",
4409
+ children: "选中道路类型后立即显示高亮"
4410
+ }),
4411
+ !T && /* @__PURE__ */ jsx("div", {
4412
+ className: "mapbox-road-highlight-control__warning",
4413
+ children: "正在初始化图层..."
4414
+ })
4415
+ ] });
4416
+ return useImperativeHandle(x, () => ({ setPortalContainer: ye })), /* @__PURE__ */ jsxs(Fragment, { children: [b && /* @__PURE__ */ jsxs("div", {
4417
+ className: `mapbox-road-highlight-control ${v}`,
4418
+ style: y,
4360
4419
  children: [/* @__PURE__ */ jsxs("button", {
4361
- ref: C,
4362
- className: `mapbox-control-btn mapbox-road-highlight-control__btn ${Se ? "mapbox-road-highlight-control__btn--active" : ""}`,
4363
- onClick: () => _(!g),
4364
- title: `路网高亮${v.length > 0 ? ` (已选 ${v.length})` : ""}`,
4420
+ ref: A,
4421
+ className: `mapbox-control-btn mapbox-road-highlight-control__btn ${F ? "mapbox-road-highlight-control__btn--active" : ""}`,
4422
+ onClick: () => C(!S),
4423
+ title: `路网高亮${w.length > 0 ? ` (已选 ${w.length})` : ""}`,
4365
4424
  children: [/* @__PURE__ */ jsx("img", {
4366
- src: road_default,
4425
+ 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='1769487141027'%20class='icon'%20viewBox='0%200%201517%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='2644'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='189.625'%20height='128'%3e%3cpath%20d='M1.68121071-242.12320149h1508.24640296v1508.24640298h-1508.24640296z'%20fill='%23ffffff'%20fill-opacity='0'%20p-id='2645'%3e%3c/path%3e%3cpath%20d='M437.30078846%20170.6624h682.66239999v682.6624H437.30078846z'%20fill='%23ffffff'%20fill-opacity='0'%20p-id='2646'%3e%3c/path%3e%3cpath%20d='M1151.68343834%2040.66710748H373.42829443A81.76345149%2081.76345149%200%200%200%20292.90207634%20121.49379654v784.42363608c0%2040.42218191%2036.92257893%2077.41545989%2080.5262181%2077.4154599h781.6133488a81.76345149%2081.76345149%200%200%200%2080.52621814-80.82668906V121.49379654C1232.08593315%2077.76643404%201195.25172802%2040.66710748%201151.6657636%2040.66710748z%20m-325.39237822%20616.14222197H618.29445458V451.37556451h53.66057906c6.71640976%200%2013.41514477-3.35820487%2020.11387975-6.73408452l97.28189301-100.99359314h134.18679716v208.72127078c-46.96184405%2013.50351858-87.22495312%2053.90802574-97.28189299%20104.4048223z%20m130.7932427-20.23760311c23.50743418%200%2043.65666346%2020.21992834%2043.65666349%2043.76271204a44.50505206%2044.50505206%200%200%201-43.62131391%2043.7803868%2044.50505206%2044.50505206%200%200%201-43.6036392-43.7803868c0-23.54278369%2020.096205-43.76271203%2043.6036392-43.76271204h-0.05302433zM564.63387554%20926.10201142H373.42829443a22.87114272%2022.87114272%200%200%201-16.79102442-6.71640975%2023.04789036%2023.04789036%200%200%201-6.71640975-16.82637394V714.02253578h214.73069002v212.07947564z%20m0-269.31035673H349.92086026V118.13559167c0-10.1453137%2010.05693988-20.2376031%2023.50743417-20.23760309h553.4321645v188.53669194h-147.54891766c-6.69873499%200-13.39747001%203.35820487-20.096205%206.71640977l-97.28189297%2097.653063H460.61789801a26.44144475%2026.44144475%200%200%200-19.08874355%207.79457028%2026.63586714%2026.63586714%200%200%200-7.72387123%2019.1594426c0%2016.80869917%2013.39747001%2026.90098858%2026.81261478%2026.90098857h104.03365227v212.13249995z%20m610.48629795%20245.71454877c0.17674763%206.29221547-2.24469484%2012.37233377-6.68106024%2016.84404869s-10.49880895%206.89315739-16.77334965%206.75175927h-533.42433329v-212.0971504H829.63159021c13.39747001%2057.24855586%2067.07572382%2097.65306301%20127.48806219%2097.653063a128.67227125%20128.67227125%200%200%200%2093.05762473-37.87701612%20129.60903367%20129.60903367%200%200%200%2037.73561801-93.39344522c0-64.00031515-46.96184405-117.8553166-103.98062799-128.00063029v-208.73894554h194.56378599v558.91134088h-3.35820489v-0.05302427z%20m0-616.07152294H980.57406228V97.89798858h171.10937607c13.39747001%200%2023.45440988%2010.07461465%2023.4544099%2023.59580796v164.94088398z'%20fill='%23ffffff'%20p-id='2647'%3e%3c/path%3e%3c/svg%3e",
4367
4426
  alt: "road",
4368
4427
  className: "mapbox-road-highlight-control__btn-icon"
4369
- }), /* @__PURE__ */ jsxs("span", { children: ["路网", v.length > 0 ? ` (${v.length})` : ""] })]
4370
- }), g && /* @__PURE__ */ jsxs("div", {
4371
- ref: ye,
4428
+ }), /* @__PURE__ */ jsxs("span", { children: ["路网", w.length > 0 ? ` (${w.length})` : ""] })]
4429
+ }), S && /* @__PURE__ */ jsx("div", {
4430
+ ref: k,
4372
4431
  className: "mapbox-road-highlight-control__panel",
4373
- children: [
4374
- /* @__PURE__ */ jsxs("div", {
4375
- className: "mapbox-road-highlight-control__panel-header",
4376
- children: [/* @__PURE__ */ jsx("span", {
4377
- className: "mapbox-road-highlight-control__panel-title",
4378
- children: "道路类型"
4379
- }), /* @__PURE__ */ jsx(Checkbox, {
4380
- checked: v.length === ROAD_TYPE_OPTIONS.length,
4381
- indeterminate: v.length > 0 && v.length < ROAD_TYPE_OPTIONS.length,
4382
- onChange: O,
4383
- style: {
4384
- "--color-text-1": "#fff",
4385
- "--color-border-2": "rgba(255, 255, 255, 0.3)"
4386
- },
4387
- children: /* @__PURE__ */ jsx("span", {
4388
- className: "mapbox-road-highlight-control__type-label",
4389
- children: "全选"
4390
- })
4391
- })]
4392
- }),
4393
- /* @__PURE__ */ jsx("div", {
4394
- className: "mapbox-road-highlight-control__scroll",
4395
- children: /* @__PURE__ */ jsx("div", {
4396
- className: "mapbox-road-highlight-control__type-list",
4397
- children: ROAD_TYPE_OPTIONS.map((e) => /* @__PURE__ */ jsxs("div", {
4398
- className: "mapbox-road-highlight-control__type-item",
4399
- onClick: () => xe(e.class, !v.includes(e.class)),
4400
- children: [
4401
- /* @__PURE__ */ jsx(Checkbox, {
4402
- checked: v.includes(e.class),
4403
- onChange: (t) => xe(e.class, t),
4404
- onClick: (e) => e.stopPropagation(),
4405
- style: {
4406
- "--color-text-1": "#fff",
4407
- "--color-border-2": "rgba(255, 255, 255, 0.3)",
4408
- marginRight: 0,
4409
- flexShrink: 0
4410
- }
4411
- }),
4412
- /* @__PURE__ */ jsx("span", {
4413
- className: "mapbox-road-highlight-control__color-indicator",
4414
- style: { backgroundColor: e.color }
4415
- }),
4416
- /* @__PURE__ */ jsx("span", {
4417
- className: "mapbox-road-highlight-control__type-label",
4418
- children: e.label
4419
- })
4420
- ]
4421
- }, e.class))
4422
- })
4423
- }),
4424
- /* @__PURE__ */ jsx("div", {
4425
- className: "mapbox-road-highlight-control__tip",
4426
- children: "💡 选中道路类型后立即显示高亮"
4427
- }),
4428
- !b && /* @__PURE__ */ jsx("div", {
4429
- className: "mapbox-road-highlight-control__warning",
4430
- children: "⚠️ 正在初始化图层..."
4431
- })
4432
- ]
4432
+ children: Ce()
4433
4433
  })]
4434
- });
4435
- }
4434
+ }), D && createPortal(Ce(), D)] });
4435
+ });
4436
+ RoadHighlightControl.displayName = "RoadHighlightControl";
4436
4437
  var measure_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='1773733446763'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1802'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='128'%20height='128'%3e%3cpath%20d='M110.34624%20352.01024a30.72%2030.72%200%201%200%2061.44%200v-38.46144h680.42752v38.5024a30.72%2030.72%200%200%200%2061.44%200V213.72928a30.72%2030.72%200%200%200-61.44%200v38.33856H171.78624v-38.33856a30.72%2030.72%200%200%200-61.44%200v138.28096z%20m34.816%20127.22176a34.816%2034.816%200%200%200-34.816%2034.816v312.60672c0%2019.2512%2015.5648%2034.816%2034.816%2034.816h733.5936c19.2512%200%2034.816-15.5648%2034.816-34.816V514.048a34.816%2034.816%200%200%200-34.816-34.816H145.2032z%20m26.624%20320.79872V540.672h680.3456v259.35872H171.8272z'%20fill='white'%20p-id='1804'%3e%3c/path%3e%3c/svg%3e", square_default = "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", rectangle_default = "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", circle_default = "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", polygon_default = "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", polyline_default = "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", delete_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='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", SHAPE_LABELS = {
4437
4438
  square: "正方形",
4438
4439
  rectangle: "矩形",
@@ -4674,64 +4675,64 @@ function clearAllPreviewSources(e) {
4674
4675
  ]) clearPreviewSource(e, `${PREVIEW_PREFIX}${t}`);
4675
4676
  }
4676
4677
  function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDrawModeChange: s, className: c = "", style: l }) {
4677
- let [u, d] = useState(!1), [f, p] = useState(null), [g, _] = useState({
4678
+ let [u, d] = useState(!1), [f, p] = useState(null), [_, v] = useState({
4678
4679
  showArea: !0,
4679
4680
  showLength: !0,
4680
4681
  showRadius: !0
4681
- }), v = r !== void 0, y = v ? {
4682
+ }), y = r !== void 0, b = y ? {
4682
4683
  showArea: r.showArea ?? !0,
4683
4684
  showLength: r.showLength ?? !0,
4684
4685
  showRadius: r.showRadius ?? !0
4685
- } : g, [b, x] = useState([]), S = useRef(/* @__PURE__ */ new Map()), ye = useRef(0), w = useRef(null), T = useRef(null), E = useRef(null), D = useRef(null), O = useRef(null), k = useRef([]), A = useRef([]), j = useRef(y);
4686
- j.current = y;
4687
- let Te = useRef(f);
4688
- Te.current = f;
4689
- let M = useCallback(() => `measure-${++ye.current}`, []);
4686
+ } : _, [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), M = useRef([]), N = useRef([]), P = useRef(b);
4687
+ P.current = b;
4688
+ let Se = useRef(f);
4689
+ Se.current = f;
4690
+ let F = useCallback(() => `measure-${++w.current}`, []);
4690
4691
  useEffect(() => {
4691
4692
  s?.(f !== null);
4692
4693
  }, [f, s]);
4693
- let Ee = useRef(!1), De = useCallback(() => {
4694
- !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), Ee.current = !0);
4694
+ let Ce = useRef(!1), we = useCallback(() => {
4695
+ !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), Ce.current = !0);
4695
4696
  }, [e]);
4696
4697
  useEffect(() => {
4697
4698
  if (!e) return;
4698
4699
  let t = () => {
4699
- initAllPreviewLayers(e), Ee.current = !0;
4700
+ initAllPreviewLayers(e), Ce.current = !0;
4700
4701
  };
4701
4702
  e.isStyleLoaded() ? t() : e.once("load", t);
4702
4703
  let n = () => {
4703
- Ee.current = !1;
4704
+ Ce.current = !1;
4704
4705
  };
4705
4706
  return e.on("style.load", n), () => {
4706
4707
  e.off("style.load", n);
4707
4708
  };
4708
4709
  }, [e]), useEffect(() => {
4709
4710
  let e = (e) => {
4710
- w.current && !w.current.contains(e.target) && T.current && !T.current.contains(e.target) && d(!1);
4711
+ T.current && !T.current.contains(e.target) && E.current && !E.current.contains(e.target) && d(!1);
4711
4712
  };
4712
4713
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
4713
4714
  }, []);
4714
- let N = useCallback((t) => {
4715
+ let I = useCallback((t) => {
4715
4716
  if (!e) return;
4716
- let n = applyEntityConfig(t, j.current), r = null;
4717
+ let n = applyEntityConfig(t, P.current), r = null;
4717
4718
  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) {
4718
- S.current.set(n.id, r);
4719
+ C.current.set(n.id, r);
4719
4720
  let e = {
4720
4721
  entity: n,
4721
4722
  shapeLabel: SHAPE_LABELS[n.type] || n.type,
4722
4723
  area: computeEntityArea(n),
4723
4724
  lengthOrRadius: computeEntityLengthOrRadius(n)
4724
4725
  };
4725
- x((t) => [...t, e]);
4726
- }
4727
- }, [e]), Oe = useCallback((e) => {
4728
- let t = S.current.get(e);
4729
- t && (t.destroy(), S.current.delete(e)), x((t) => t.filter((t) => t.entity.id !== e));
4730
- }, []), ke = useCallback(() => {
4731
- S.current.forEach((e) => e.destroy()), S.current.clear(), x([]);
4732
- }, []), Ae = useCallback((t) => {
4726
+ S((t) => [...t, e]);
4727
+ }
4728
+ }, [e]), Te = useCallback((e) => {
4729
+ let t = C.current.get(e);
4730
+ t && (t.destroy(), C.current.delete(e)), S((t) => t.filter((t) => t.entity.id !== e));
4731
+ }, []), Ee = useCallback(() => {
4732
+ C.current.forEach((e) => e.destroy()), C.current.clear(), S([]);
4733
+ }, []), De = useCallback((t) => {
4733
4734
  if (!e) return;
4734
- let n = S.current.get(t);
4735
+ let n = C.current.get(t);
4735
4736
  if (!n) return;
4736
4737
  let r = n.getBounds();
4737
4738
  e.fitBounds(r, {
@@ -4739,21 +4740,21 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4739
4740
  maxZoom: 18,
4740
4741
  duration: 1e3
4741
4742
  });
4742
- }, [e]), je = useCallback((e, t) => {
4743
+ }, [e]), Oe = useCallback((e, t) => {
4743
4744
  let n = {
4744
- ...j.current,
4745
+ ...P.current,
4745
4746
  [e]: t
4746
4747
  };
4747
- v ? i?.({ ...n }) : _(n), x((t) => t.map((t) => {
4748
+ y ? i?.({ ...n }) : v(n), S((t) => t.map((t) => {
4748
4749
  let r = { ...t.entity };
4749
4750
  r[e] = void 0;
4750
- let i = applyEntityConfig(r, n), a = S.current.get(t.entity.id);
4751
+ let i = applyEntityConfig(r, n), a = C.current.get(t.entity.id);
4751
4752
  return a && a.update(i), {
4752
4753
  ...t,
4753
4754
  entity: i
4754
4755
  };
4755
4756
  }));
4756
- }, [v, i]), Me = useCallback((t, n) => {
4757
+ }, [y, i]), ke = useCallback((t, n) => {
4757
4758
  if (!e) return;
4758
4759
  let [r, i] = t, [a, o] = n, s = [
4759
4760
  [Math.min(r, a), Math.max(i, o)],
@@ -4772,7 +4773,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4772
4773
  });
4773
4774
  let l = e.getSource(`${PREVIEW_PREFIX}rect-preview-measure-source`);
4774
4775
  if (l) {
4775
- let e = j.current, t = [], n = s[0], r = s[1], i = s[2];
4776
+ let e = P.current, t = [], n = s[0], r = s[1], i = s[2];
4776
4777
  if (e?.showArea) {
4777
4778
  let e = distance(n, r), a = distance(r, i);
4778
4779
  t.push({
@@ -4803,7 +4804,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4803
4804
  features: t
4804
4805
  });
4805
4806
  }
4806
- }, [e]), Ne = useCallback((t, n) => {
4807
+ }, [e]), Ae = useCallback((t, n) => {
4807
4808
  if (!e) return;
4808
4809
  let r = calculateDistance(t, n), i = createCirclePolygon(t, r), a = e.getSource(`${PREVIEW_PREFIX}circle-preview-source`);
4809
4810
  a && a.setData({
@@ -4814,7 +4815,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4814
4815
  },
4815
4816
  properties: {}
4816
4817
  });
4817
- let o = j.current, s = [], c = [];
4818
+ let o = P.current, s = [], c = [];
4818
4819
  if (o?.showArea && s.push({
4819
4820
  type: "Feature",
4820
4821
  geometry: {
@@ -4850,7 +4851,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4850
4851
  type: "FeatureCollection",
4851
4852
  features: c
4852
4853
  });
4853
- }, [e]), Pe = useCallback((t, n) => {
4854
+ }, [e]), je = useCallback((t, n) => {
4854
4855
  if (!e) return;
4855
4856
  let r = calculateDistance(t, n) * 2, i = createSquareCoords(t, r), a = e.getSource(`${PREVIEW_PREFIX}square-preview-source`);
4856
4857
  a && a.setData({
@@ -4863,7 +4864,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4863
4864
  });
4864
4865
  let o = e.getSource(`${PREVIEW_PREFIX}square-preview-measure-source`);
4865
4866
  if (o) {
4866
- let e = j.current, n = [];
4867
+ let e = P.current, n = [];
4867
4868
  if (e?.showArea && n.push({
4868
4869
  type: "Feature",
4869
4870
  geometry: {
@@ -4887,7 +4888,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4887
4888
  features: n
4888
4889
  });
4889
4890
  }
4890
- }, [e]), P = useCallback((t, n) => {
4891
+ }, [e]), L = useCallback((t, n) => {
4891
4892
  if (!e) return;
4892
4893
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polygon-preview-source`);
4893
4894
  i && (r.length >= 3 ? i.setData({
@@ -4922,7 +4923,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4922
4923
  });
4923
4924
  let o = e.getSource(`${PREVIEW_PREFIX}polygon-preview-measure-source`);
4924
4925
  if (o) {
4925
- let e = j.current, t = [];
4926
+ let e = P.current, t = [];
4926
4927
  if (e?.showArea && r.length >= 3) {
4927
4928
  let e = polygonArea([...r, r[0]]), n = 0, i = 0;
4928
4929
  for (let e of r) n += e[0], i += e[1];
@@ -4964,7 +4965,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4964
4965
  features: t
4965
4966
  });
4966
4967
  }
4967
- }, [e]), Fe = useCallback((t, n) => {
4968
+ }, [e]), Me = useCallback((t, n) => {
4968
4969
  if (!e) return;
4969
4970
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polyline-preview-source`);
4970
4971
  i && (r.length >= 2 ? i.setData({
@@ -4992,7 +4993,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4992
4993
  });
4993
4994
  let o = e.getSource(`${PREVIEW_PREFIX}polyline-preview-measure-source`);
4994
4995
  if (o) {
4995
- let e = j.current, t = [];
4996
+ let e = P.current, t = [];
4996
4997
  if (e?.showLength && r.length >= 2) for (let e = 0; e < r.length - 1; e++) {
4997
4998
  let n = r[e], i = r[e + 1];
4998
4999
  t.push({
@@ -5012,117 +5013,117 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5012
5013
  }, [e]);
5013
5014
  useEffect(() => {
5014
5015
  if (!e || !f) return;
5015
- De(), e.getCanvas().style.cursor = "crosshair";
5016
+ we(), e.getCanvas().style.cursor = "crosshair";
5016
5017
  let t = (t) => {
5017
- let n = [t.lngLat.lng, t.lngLat.lat], r = Te.current;
5018
+ let n = [t.lngLat.lng, t.lngLat.lat], r = Se.current;
5018
5019
  if (r === "rectangle") {
5019
- let t = E.current;
5020
- if (!t) E.current = n;
5020
+ let t = D.current;
5021
+ if (!t) D.current = n;
5021
5022
  else {
5022
5023
  let r = {
5023
- id: M(),
5024
+ id: F(),
5024
5025
  type: "rectangle",
5025
5026
  bounds: [t, n]
5026
5027
  };
5027
- N(r), E.current = null, clearAllPreviewSources(e), p(null);
5028
+ I(r), D.current = null, clearAllPreviewSources(e), p(null);
5028
5029
  }
5029
5030
  } else if (r === "circle") {
5030
- let t = D.current;
5031
- if (!t) D.current = { center: n };
5031
+ let t = O.current;
5032
+ if (!t) O.current = { center: n };
5032
5033
  else {
5033
5034
  let r = calculateDistance(t.center, n), i = {
5034
- id: M(),
5035
+ id: F(),
5035
5036
  type: "circle",
5036
5037
  center: t.center,
5037
5038
  radius: r
5038
5039
  };
5039
- N(i), D.current = null, clearAllPreviewSources(e), p(null);
5040
+ I(i), O.current = null, clearAllPreviewSources(e), p(null);
5040
5041
  }
5041
5042
  } else if (r === "square") {
5042
- let t = O.current;
5043
- if (!t) O.current = { center: n };
5043
+ let t = k.current;
5044
+ if (!t) k.current = { center: n };
5044
5045
  else {
5045
5046
  let r = calculateDistance(t.center, n) * 2, i = {
5046
- id: M(),
5047
+ id: F(),
5047
5048
  type: "square",
5048
5049
  center: t.center,
5049
5050
  length: r
5050
5051
  };
5051
- N(i), O.current = null, clearAllPreviewSources(e), p(null);
5052
+ I(i), k.current = null, clearAllPreviewSources(e), p(null);
5052
5053
  }
5053
5054
  } else if (r === "polygon") {
5054
- let t = k.current;
5055
+ let t = M.current;
5055
5056
  if (t.length >= 3 && calculateDistance(t[0], n) < 20) {
5056
5057
  let n = {
5057
- id: M(),
5058
+ id: F(),
5058
5059
  type: "polygon",
5059
5060
  coordinates: [...t]
5060
5061
  };
5061
- N(n), k.current = [], clearAllPreviewSources(e), p(null);
5062
+ I(n), M.current = [], clearAllPreviewSources(e), p(null);
5062
5063
  return;
5063
5064
  }
5064
- k.current = [...t, n];
5065
- } else r === "polyline" && (A.current = [...A.current, n]);
5065
+ M.current = [...t, n];
5066
+ } else r === "polyline" && (N.current = [...N.current, n]);
5066
5067
  }, n = (e) => {
5067
- let t = [e.lngLat.lng, e.lngLat.lat], n = Te.current;
5068
- if (n === "rectangle" && E.current) Me(E.current, t);
5069
- else if (n === "circle" && D.current) Ne(D.current.center, t);
5070
- else if (n === "square" && O.current) Pe(O.current.center, t);
5068
+ let t = [e.lngLat.lng, e.lngLat.lat], n = Se.current;
5069
+ if (n === "rectangle" && D.current) ke(D.current, t);
5070
+ else if (n === "circle" && O.current) Ae(O.current.center, t);
5071
+ else if (n === "square" && k.current) je(k.current.center, t);
5071
5072
  else if (n === "polygon") {
5072
- let e = k.current;
5073
- e.length > 0 && P(e, t);
5073
+ let e = M.current;
5074
+ e.length > 0 && L(e, t);
5074
5075
  } else if (n === "polyline") {
5075
- let e = A.current;
5076
- e.length > 0 && Fe(e, t);
5076
+ let e = N.current;
5077
+ e.length > 0 && Me(e, t);
5077
5078
  }
5078
5079
  }, r = (t) => {
5079
5080
  t.preventDefault();
5080
- let n = Te.current;
5081
+ let n = Se.current;
5081
5082
  if (n === "polygon") {
5082
- let t = k.current;
5083
+ let t = M.current;
5083
5084
  if (t.length >= 3) {
5084
5085
  let n = {
5085
- id: M(),
5086
+ id: F(),
5086
5087
  type: "polygon",
5087
5088
  coordinates: [...t]
5088
5089
  };
5089
- N(n), k.current = [], clearAllPreviewSources(e), p(null);
5090
- } else k.current = [], clearAllPreviewSources(e);
5090
+ I(n), M.current = [], clearAllPreviewSources(e), p(null);
5091
+ } else M.current = [], clearAllPreviewSources(e);
5091
5092
  } else if (n === "polyline") {
5092
- let t = A.current;
5093
+ let t = N.current;
5093
5094
  if (t.length >= 2) {
5094
5095
  let n = {
5095
- id: M(),
5096
+ id: F(),
5096
5097
  type: "polyline",
5097
5098
  coordinates: [...t]
5098
5099
  };
5099
- N(n), A.current = [], clearAllPreviewSources(e), p(null);
5100
- } else A.current = [], clearAllPreviewSources(e);
5100
+ I(n), N.current = [], clearAllPreviewSources(e), p(null);
5101
+ } else N.current = [], clearAllPreviewSources(e);
5101
5102
  }
5102
5103
  }, i = (t) => {
5103
- t.key === "Escape" && (E.current = null, D.current = null, O.current = null, k.current = [], A.current = [], clearAllPreviewSources(e), p(null));
5104
+ t.key === "Escape" && (D.current = null, O.current = null, k.current = null, M.current = [], N.current = [], clearAllPreviewSources(e), p(null));
5104
5105
  }, a = (t) => {
5105
5106
  t.preventDefault();
5106
- let n = Te.current;
5107
+ let n = Se.current;
5107
5108
  if (n === "polygon") {
5108
- let t = k.current;
5109
+ let t = M.current;
5109
5110
  if (t.length >= 3) {
5110
5111
  let n = {
5111
- id: M(),
5112
+ id: F(),
5112
5113
  type: "polygon",
5113
5114
  coordinates: [...t]
5114
5115
  };
5115
- N(n), k.current = [], clearAllPreviewSources(e), p(null);
5116
+ I(n), M.current = [], clearAllPreviewSources(e), p(null);
5116
5117
  }
5117
5118
  } else if (n === "polyline") {
5118
- let t = A.current;
5119
+ let t = N.current;
5119
5120
  if (t.length >= 2) {
5120
5121
  let n = {
5121
- id: M(),
5122
+ id: F(),
5122
5123
  type: "polyline",
5123
5124
  coordinates: [...t]
5124
5125
  };
5125
- N(n), A.current = [], clearAllPreviewSources(e), p(null);
5126
+ I(n), N.current = [], clearAllPreviewSources(e), p(null);
5126
5127
  }
5127
5128
  }
5128
5129
  };
@@ -5132,25 +5133,25 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5132
5133
  }, [
5133
5134
  e,
5134
5135
  f,
5135
- M,
5136
- N,
5137
- De,
5138
- Me,
5139
- Ne,
5140
- Pe,
5141
- P,
5142
- Fe
5136
+ F,
5137
+ I,
5138
+ we,
5139
+ ke,
5140
+ Ae,
5141
+ je,
5142
+ L,
5143
+ Me
5143
5144
  ]), useEffect(() => () => {
5144
- S.current.forEach((e) => e.destroy()), S.current.clear();
5145
+ C.current.forEach((e) => e.destroy()), C.current.clear();
5145
5146
  }, []);
5146
- let Ie = useCallback((t) => {
5147
- p((e) => e === t ? null : t), E.current = null, D.current = null, O.current = null, k.current = [], A.current = [], e && clearAllPreviewSources(e);
5147
+ let Ne = useCallback((t) => {
5148
+ p((e) => e === t ? null : t), D.current = null, O.current = null, k.current = null, M.current = [], N.current = [], e && clearAllPreviewSources(e);
5148
5149
  }, [e]);
5149
5150
  return e ? /* @__PURE__ */ jsxs("div", {
5150
5151
  className: `mapbox-measure-control ${c}`,
5151
5152
  style: l,
5152
5153
  children: [/* @__PURE__ */ jsxs("button", {
5153
- ref: T,
5154
+ ref: E,
5154
5155
  className: `mapbox-control-btn mapbox-measure-control__btn ${u ? "mapbox-measure-control__btn--active" : ""}`,
5155
5156
  onClick: () => d(!u),
5156
5157
  title: "测量",
@@ -5161,14 +5162,14 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5161
5162
  className: "mapbox-measure-control__btn-icon"
5162
5163
  }),
5163
5164
  /* @__PURE__ */ jsx("span", { children: "测量" }),
5164
- b.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
5165
+ x.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
5165
5166
  "(",
5166
- b.length,
5167
+ x.length,
5167
5168
  ")"
5168
5169
  ] })
5169
5170
  ]
5170
5171
  }), u && /* @__PURE__ */ jsxs("div", {
5171
- ref: w,
5172
+ ref: T,
5172
5173
  className: "mapbox-measure-control__panel",
5173
5174
  children: [
5174
5175
  /* @__PURE__ */ jsx("div", {
@@ -5179,18 +5180,18 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5179
5180
  className: "mapbox-measure-control__settings",
5180
5181
  children: [
5181
5182
  /* @__PURE__ */ jsx(Checkbox, {
5182
- checked: y.showArea,
5183
- onChange: (e) => je("showArea", e),
5183
+ checked: b.showArea,
5184
+ onChange: (e) => Oe("showArea", e),
5184
5185
  children: "面积"
5185
5186
  }),
5186
5187
  /* @__PURE__ */ jsx(Checkbox, {
5187
- checked: y.showLength,
5188
- onChange: (e) => je("showLength", e),
5188
+ checked: b.showLength,
5189
+ onChange: (e) => Oe("showLength", e),
5189
5190
  children: "长度"
5190
5191
  }),
5191
5192
  /* @__PURE__ */ jsx(Checkbox, {
5192
- checked: y.showRadius,
5193
- onChange: (e) => je("showRadius", e),
5193
+ checked: b.showRadius,
5194
+ onChange: (e) => Oe("showRadius", e),
5194
5195
  children: "半径"
5195
5196
  })
5196
5197
  ]
@@ -5203,15 +5204,15 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5203
5204
  className: "mapbox-measure-control__tools",
5204
5205
  children: [DRAW_TOOLS.map((e) => /* @__PURE__ */ jsx("button", {
5205
5206
  className: `mapbox-measure-control__tool-btn ${f === e.mode ? "mapbox-measure-control__tool-btn--active" : ""}`,
5206
- onClick: () => Ie(e.mode),
5207
+ onClick: () => Ne(e.mode),
5207
5208
  title: e.label,
5208
5209
  children: /* @__PURE__ */ jsx("img", {
5209
5210
  src: e.icon,
5210
5211
  alt: e.label
5211
5212
  })
5212
- }, e.mode)), b.length > 0 && /* @__PURE__ */ jsx("button", {
5213
+ }, e.mode)), x.length > 0 && /* @__PURE__ */ jsx("button", {
5213
5214
  className: "mapbox-measure-control__tool-btn mapbox-measure-control__tool-btn--danger",
5214
- onClick: ke,
5215
+ onClick: Ee,
5215
5216
  title: "清除全部",
5216
5217
  children: /* @__PURE__ */ jsx("img", {
5217
5218
  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",
@@ -5219,7 +5220,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5219
5220
  })
5220
5221
  })]
5221
5222
  }),
5222
- b.length > 0 ? /* @__PURE__ */ jsx("div", {
5223
+ x.length > 0 ? /* @__PURE__ */ jsx("div", {
5223
5224
  className: "mapbox-measure-control__list",
5224
5225
  children: /* @__PURE__ */ jsxs("table", {
5225
5226
  className: "mapbox-measure-control__table",
@@ -5229,9 +5230,9 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5229
5230
  /* @__PURE__ */ jsx("th", { children: "面积" }),
5230
5231
  /* @__PURE__ */ jsx("th", { children: "长度/半径" }),
5231
5232
  /* @__PURE__ */ jsx("th", {})
5232
- ] }) }), /* @__PURE__ */ jsx("tbody", { children: b.map((e) => /* @__PURE__ */ jsxs("tr", {
5233
+ ] }) }), /* @__PURE__ */ jsx("tbody", { children: x.map((e) => /* @__PURE__ */ jsxs("tr", {
5233
5234
  className: "mapbox-measure-control__table-row",
5234
- onClick: () => Ae(e.entity.id),
5235
+ onClick: () => De(e.entity.id),
5235
5236
  children: [
5236
5237
  /* @__PURE__ */ jsx("td", { children: e.shapeLabel }),
5237
5238
  /* @__PURE__ */ jsx("td", { children: String(e.entity.id) }),
@@ -5240,7 +5241,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5240
5241
  /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", {
5241
5242
  className: "mapbox-measure-control__delete-btn",
5242
5243
  onClick: (t) => {
5243
- t.stopPropagation(), Oe(e.entity.id);
5244
+ t.stopPropagation(), Te(e.entity.id);
5244
5245
  },
5245
5246
  title: "删除",
5246
5247
  children: /* @__PURE__ */ jsx("img", {
@@ -5295,31 +5296,31 @@ var raster_paint_default = "data:image/svg+xml,%3c?xml%20version='1.0'%20standal
5295
5296
  }
5296
5297
  ];
5297
5298
  function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds: c = [], className: l, style: u }) {
5298
- let [d, f] = useState(!1), [p, h] = useState({ ...DEFAULT_CONFIG }), _ = useRef(null), v = useRef(null), y = r !== void 0;
5299
+ let [d, f] = useState(!1), [p, g] = useState({ ...DEFAULT_CONFIG }), v = useRef(null), y = useRef(null), b = r !== void 0;
5299
5300
  useEffect(() => {
5300
5301
  let e = (e) => {
5301
- _.current && !_.current.contains(e.target) && v.current && !v.current.contains(e.target) && f(!1);
5302
+ v.current && !v.current.contains(e.target) && y.current && !y.current.contains(e.target) && f(!1);
5302
5303
  };
5303
5304
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
5304
5305
  }, []);
5305
- let b = useMemo(() => y ? {
5306
+ let x = useMemo(() => b ? {
5306
5307
  brightness: r.brightness ?? DEFAULT_CONFIG.brightness,
5307
5308
  saturation: r.saturation ?? DEFAULT_CONFIG.saturation,
5308
5309
  contrast: r.contrast ?? DEFAULT_CONFIG.contrast,
5309
5310
  hueRotate: r.hueRotate ?? DEFAULT_CONFIG.hueRotate
5310
5311
  } : p, [
5311
- y,
5312
+ b,
5312
5313
  r,
5313
5314
  p
5314
- ]), x = useRef(y);
5315
+ ]), S = useRef(b);
5315
5316
  useEffect(() => {
5316
- y && !x.current && h({ ...b }), x.current = y;
5317
- }, [y, b]);
5318
- let S = useCallback((t) => {
5317
+ b && !S.current && g({ ...x }), S.current = b;
5318
+ }, [b, x]);
5319
+ let C = useCallback((t) => {
5319
5320
  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));
5320
- }, [e, c]), ye = useCallback((e, t) => {
5321
- if (y) s?.({
5322
- ...b,
5321
+ }, [e, c]), w = useCallback((e, t) => {
5322
+ if (b) s?.({
5323
+ ...x,
5323
5324
  [e]: t
5324
5325
  });
5325
5326
  else {
@@ -5327,35 +5328,35 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5327
5328
  ...p,
5328
5329
  [e]: t
5329
5330
  };
5330
- h(n), S(n);
5331
+ g(n), C(n);
5331
5332
  }
5332
5333
  }, [
5333
- y,
5334
- s,
5335
5334
  b,
5335
+ s,
5336
+ x,
5336
5337
  p,
5337
- S
5338
- ]), C = useCallback(() => {
5339
- y ? s?.({ ...DEFAULT_CONFIG }) : (h({ ...DEFAULT_CONFIG }), S({ ...DEFAULT_CONFIG }));
5338
+ C
5339
+ ]), ve = useCallback(() => {
5340
+ b ? s?.({ ...DEFAULT_CONFIG }) : (g({ ...DEFAULT_CONFIG }), C({ ...DEFAULT_CONFIG }));
5340
5341
  }, [
5341
- y,
5342
+ b,
5342
5343
  s,
5343
- S
5344
+ C
5344
5345
  ]);
5345
5346
  useEffect(() => {
5346
- !y && c.length > 0 && S(p);
5347
+ !b && c.length > 0 && C(p);
5347
5348
  }, [
5348
5349
  c,
5349
- y,
5350
- S,
5350
+ b,
5351
+ C,
5351
5352
  p
5352
5353
  ]);
5353
- let w = (e, t) => e === "hueRotate" ? `${Math.round(t)}°` : t.toFixed(2);
5354
+ let T = (e, t) => e === "hueRotate" ? `${Math.round(t)}°` : t.toFixed(2);
5354
5355
  return /* @__PURE__ */ jsxs("div", {
5355
5356
  className: `mapbox-raster-paint-control${l ? ` ${l}` : ""}`,
5356
5357
  style: u,
5357
5358
  children: [/* @__PURE__ */ jsxs("button", {
5358
- ref: v,
5359
+ ref: y,
5359
5360
  className: `mapbox-control-btn mapbox-raster-paint-control__btn${d ? " mapbox-raster-paint-control__btn--active" : ""}`,
5360
5361
  onClick: () => f(!d),
5361
5362
  title: "栅格渲染调节",
@@ -5365,7 +5366,7 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5365
5366
  alt: "raster paint"
5366
5367
  }), /* @__PURE__ */ jsx("span", { children: "渲染" })]
5367
5368
  }), d && /* @__PURE__ */ jsxs("div", {
5368
- ref: _,
5369
+ ref: v,
5369
5370
  className: "mapbox-raster-paint-control__panel",
5370
5371
  children: [SLIDER_CONFIG.map(({ key: e, label: t, min: n, max: r, step: i }) => /* @__PURE__ */ jsxs("div", {
5371
5372
  className: "mapbox-raster-paint-control__slider-row",
@@ -5379,18 +5380,18 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5379
5380
  min: n,
5380
5381
  max: r,
5381
5382
  step: i,
5382
- value: b[e],
5383
- onChange: (t) => ye(e, t),
5383
+ value: x[e],
5384
+ onChange: (t) => w(e, t),
5384
5385
  tooltipVisible: !1
5385
5386
  }),
5386
5387
  /* @__PURE__ */ jsx("span", {
5387
5388
  className: "mapbox-raster-paint-control__value",
5388
- children: w(e, b[e])
5389
+ children: T(e, x[e])
5389
5390
  })
5390
5391
  ]
5391
5392
  }, e)), /* @__PURE__ */ jsx("button", {
5392
5393
  className: "mapbox-raster-paint-control__reset",
5393
- onClick: C,
5394
+ onClick: ve,
5394
5395
  children: "重置"
5395
5396
  })]
5396
5397
  })]
@@ -5398,43 +5399,43 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5398
5399
  }
5399
5400
  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";
5400
5401
  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 }) => {
5401
- let [p, h] = useState(!1), g = useRef(null);
5402
+ let [p, g] = useState(!1), _ = useRef(null);
5402
5403
  useEffect(() => {
5403
5404
  let e = (e) => {
5404
- g.current && !g.current.contains(e.target) && h(!1);
5405
+ _.current && !_.current.contains(e.target) && g(!1);
5405
5406
  };
5406
5407
  if (p) return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
5407
5408
  }, [p]);
5408
- let _ = (e) => {
5409
- t?.id === e.id ? (r(null), s(null)) : (r(e), s("marker")), h(!1);
5410
- }, v = () => {
5411
- i === "rectangle" ? s(null) : (r(null), s("rectangle"));
5409
+ let v = (e) => {
5410
+ t?.id === e.id ? (r(null), s(null)) : (r(e), s("marker")), g(!1);
5412
5411
  }, y = () => {
5413
- i === "circle" ? s(null) : (r(null), s("circle"));
5412
+ i === "rectangle" ? s(null) : (r(null), s("rectangle"));
5414
5413
  }, b = () => {
5415
- i === "polygon" ? s(null) : (r(null), s("polygon"));
5414
+ i === "circle" ? s(null) : (r(null), s("circle"));
5416
5415
  }, x = () => {
5417
- i === "square" ? s(null) : (r(null), s("square"));
5416
+ i === "polygon" ? s(null) : (r(null), s("polygon"));
5418
5417
  }, S = () => {
5418
+ i === "square" ? s(null) : (r(null), s("square"));
5419
+ }, C = () => {
5419
5420
  i === "polyline" ? s(null) : (r(null), s("polyline"));
5420
- }, ye = () => {
5421
- (i === "rectangle" || i === "circle" || i === "polygon" || i === "square" || i === "polyline") && s(null), h(!p);
5422
- }, C = (e) => e.size ? {
5421
+ }, w = () => {
5422
+ (i === "rectangle" || i === "circle" || i === "polygon" || i === "square" || i === "polyline") && s(null), g(!p);
5423
+ }, ve = (e) => e.size ? {
5423
5424
  width: e.size,
5424
5425
  height: e.size
5425
5426
  } : {
5426
5427
  width: e.width || 32,
5427
5428
  height: e.height || 32
5428
- }, w = p || t, T = i === "rectangle", E = i === "circle", D = i === "polygon", be = i === "square", xe = i === "polyline";
5429
+ }, T = p || t, E = i === "rectangle", D = i === "circle", O = i === "polygon", ye = i === "square", be = i === "polyline";
5429
5430
  return /* @__PURE__ */ jsxs("div", {
5430
- ref: g,
5431
+ ref: _,
5431
5432
  className: "mapbox-edit-control",
5432
5433
  children: [/* @__PURE__ */ jsxs("div", {
5433
5434
  className: "mapbox-edit-control__btn-group",
5434
5435
  children: [
5435
5436
  /* @__PURE__ */ jsxs("button", {
5436
- className: `mapbox-control-btn ${w ? "mapbox-control-btn--active" : ""}`,
5437
- onClick: ye,
5437
+ className: `mapbox-control-btn ${T ? "mapbox-control-btn--active" : ""}`,
5438
+ onClick: w,
5438
5439
  title: "Marker",
5439
5440
  children: [t ? /* @__PURE__ */ jsx("img", {
5440
5441
  src: t.icon,
@@ -5447,8 +5448,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5447
5448
  }), /* @__PURE__ */ jsx("span", { children: t ? t.name : "Marker" })]
5448
5449
  }),
5449
5450
  d && /* @__PURE__ */ jsxs("button", {
5450
- className: `mapbox-control-btn ${be ? "mapbox-control-btn--active" : ""}`,
5451
- onClick: x,
5451
+ className: `mapbox-control-btn ${ye ? "mapbox-control-btn--active" : ""}`,
5452
+ onClick: S,
5452
5453
  title: "绘制正方形",
5453
5454
  children: [/* @__PURE__ */ jsx("img", {
5454
5455
  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",
@@ -5457,8 +5458,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5457
5458
  }), /* @__PURE__ */ jsx("span", { children: "正方形" })]
5458
5459
  }),
5459
5460
  c && /* @__PURE__ */ jsxs("button", {
5460
- className: `mapbox-control-btn ${T ? "mapbox-control-btn--active" : ""}`,
5461
- onClick: v,
5461
+ className: `mapbox-control-btn ${E ? "mapbox-control-btn--active" : ""}`,
5462
+ onClick: y,
5462
5463
  title: "绘制矩形",
5463
5464
  children: [/* @__PURE__ */ jsx("img", {
5464
5465
  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",
@@ -5467,8 +5468,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5467
5468
  }), /* @__PURE__ */ jsx("span", { children: "矩形" })]
5468
5469
  }),
5469
5470
  l && /* @__PURE__ */ jsxs("button", {
5470
- className: `mapbox-control-btn ${E ? "mapbox-control-btn--active" : ""}`,
5471
- onClick: y,
5471
+ className: `mapbox-control-btn ${D ? "mapbox-control-btn--active" : ""}`,
5472
+ onClick: b,
5472
5473
  title: "绘制圆形",
5473
5474
  children: [/* @__PURE__ */ jsx("img", {
5474
5475
  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",
@@ -5477,8 +5478,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5477
5478
  }), /* @__PURE__ */ jsx("span", { children: "圆形" })]
5478
5479
  }),
5479
5480
  u && /* @__PURE__ */ jsxs("button", {
5480
- className: `mapbox-control-btn ${D ? "mapbox-control-btn--active" : ""}`,
5481
- onClick: b,
5481
+ className: `mapbox-control-btn ${O ? "mapbox-control-btn--active" : ""}`,
5482
+ onClick: x,
5482
5483
  title: "绘制多边形",
5483
5484
  children: [/* @__PURE__ */ jsx("img", {
5484
5485
  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",
@@ -5487,8 +5488,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5487
5488
  }), /* @__PURE__ */ jsx("span", { children: "多边形" })]
5488
5489
  }),
5489
5490
  f && /* @__PURE__ */ jsxs("button", {
5490
- className: `mapbox-control-btn ${xe ? "mapbox-control-btn--active" : ""}`,
5491
- onClick: S,
5491
+ className: `mapbox-control-btn ${be ? "mapbox-control-btn--active" : ""}`,
5492
+ onClick: C,
5492
5493
  title: "绘制折线",
5493
5494
  children: [/* @__PURE__ */ jsx("img", {
5494
5495
  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",
@@ -5505,10 +5506,10 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5505
5506
  }), /* @__PURE__ */ jsx("div", {
5506
5507
  className: "mapbox-edit-control__template-list",
5507
5508
  children: e.map((e) => {
5508
- let n = C(e), r = t?.id === e.id;
5509
+ let n = ve(e), r = t?.id === e.id;
5509
5510
  return /* @__PURE__ */ jsxs("div", {
5510
5511
  className: `mapbox-edit-control__template-item ${r ? "mapbox-edit-control__template-item--selected" : ""}`,
5511
- onClick: () => _(e),
5512
+ onClick: () => v(e),
5512
5513
  title: e.name,
5513
5514
  children: [/* @__PURE__ */ jsx("img", {
5514
5515
  src: e.icon,
@@ -5577,28 +5578,28 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5577
5578
  };
5578
5579
  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";
5579
5580
  const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointCountInput: c = !1, visualType: l = "marker", onSelectFinished: u, showButton: d = !0 }, f) => {
5580
- let [p, 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), D = useRef("");
5581
+ let [p, g] = useState("idle"), [_, v] = useState(0), [y, b] = useState(i), [x, S] = useState(!1), C = useRef(null), w = useRef(null), ve = useRef([]), T = useRef([]), E = useRef("idle"), D = useRef(null), O = useRef("");
5581
5582
  useEffect(() => {
5582
- T.current = p;
5583
+ E.current = p;
5583
5584
  }, [p]), useEffect(() => {
5584
- y(i);
5585
+ b(i);
5585
5586
  }, [i]), useEffect(() => {
5586
- if (!b) return;
5587
+ if (!x) return;
5587
5588
  let e = (e) => {
5588
- ye.current && !ye.current.contains(e.target) && S.current && !S.current.contains(e.target) && x(!1);
5589
+ w.current && !w.current.contains(e.target) && C.current && !C.current.contains(e.target) && S(!1);
5589
5590
  }, t = setTimeout(() => {
5590
5591
  document.addEventListener("mousedown", e);
5591
5592
  }, 0);
5592
5593
  return () => {
5593
5594
  clearTimeout(t), document.removeEventListener("mousedown", e);
5594
5595
  };
5595
- }, [b]);
5596
- let be = useCallback(() => {
5597
- for (let e of w.current) e.remove();
5598
- 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));
5599
- }, [e]), xe = useCallback(() => {
5596
+ }, [x]);
5597
+ let ye = useCallback(() => {
5598
+ for (let e of T.current) e.remove();
5599
+ 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));
5600
+ }, [e]), be = useCallback(() => {
5600
5601
  if (!e) return;
5601
- let t = C.current, n = {
5602
+ let t = ve.current, n = {
5602
5603
  type: "FeatureCollection",
5603
5604
  features: [{
5604
5605
  type: "Feature",
@@ -5649,104 +5650,104 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5649
5650
  "circle-stroke-color": "#fff"
5650
5651
  }
5651
5652
  }));
5652
- }, [e]), O = useCallback((t) => {
5653
- if (!e || !E.current) return;
5654
- let { visualType: n } = E.current;
5653
+ }, [e]), k = useCallback((t) => {
5654
+ if (!e || !D.current) return;
5655
+ let { visualType: n } = D.current;
5655
5656
  if (n === "marker") {
5656
5657
  let n = document.createElement("div");
5657
- n.className = "route-planning-temp-marker", n.textContent = String(C.current.length);
5658
+ n.className = "route-planning-temp-marker", n.textContent = String(ve.current.length);
5658
5659
  let r = new mapboxgl.Marker({ element: n }).setLngLat(t).addTo(e);
5659
- w.current.push(r);
5660
- } else xe();
5661
- }, [e, xe]), Se = useCallback(() => {
5662
- be(), C.current = [], E.current = null, _(0), h("idle"), e && (e.getCanvas().style.cursor = D.current);
5663
- }, [be, e]), Ce = useCallback(async () => {
5664
- let e = E.current, t = [...C.current];
5660
+ T.current.push(r);
5661
+ } else be();
5662
+ }, [e, be]), A = useCallback(() => {
5663
+ ye(), ve.current = [], D.current = null, v(0), g("idle"), e && (e.getCanvas().style.cursor = O.current);
5664
+ }, [ye, e]), j = useCallback(async () => {
5665
+ let e = D.current, t = [...ve.current];
5665
5666
  if (!e || t.length < 2) {
5666
- Se();
5667
+ A();
5667
5668
  return;
5668
5669
  }
5669
- h("planning");
5670
+ g("planning");
5670
5671
  try {
5671
5672
  await e.onSelectFinished(t);
5672
5673
  } catch (e) {
5673
5674
  console.error("Route planning onSelectFinished failed:", e);
5674
5675
  } finally {
5675
- Se();
5676
+ A();
5676
5677
  }
5677
- }, [Se]), we = useCallback((e) => {
5678
- if (T.current !== "selecting" || !E.current) return;
5678
+ }, [A]), xe = useCallback((e) => {
5679
+ if (E.current !== "selecting" || !D.current) return;
5679
5680
  let t = [e.lngLat.lng, e.lngLat.lat];
5680
- C.current.push(t);
5681
- let n = C.current.length;
5682
- _(n), O(t), n >= E.current.pointCount && Ce();
5683
- }, [O, Ce]), k = useCallback((e) => {
5684
- T.current === "selecting" && (e.preventDefault(), Se());
5685
- }, [Se]);
5681
+ ve.current.push(t);
5682
+ let n = ve.current.length;
5683
+ v(n), k(t), n >= D.current.pointCount && j();
5684
+ }, [k, j]), M = useCallback((e) => {
5685
+ E.current === "selecting" && (e.preventDefault(), A());
5686
+ }, [A]);
5686
5687
  useEffect(() => {
5687
- if (e && p === "selecting") return e.on("click", we), e.on("contextmenu", k), () => {
5688
- e.off("click", we), e.off("contextmenu", k);
5688
+ if (e && p === "selecting") return e.on("click", xe), e.on("contextmenu", M), () => {
5689
+ e.off("click", xe), e.off("contextmenu", M);
5689
5690
  };
5690
5691
  }, [
5691
5692
  e,
5692
5693
  p,
5693
- we,
5694
- k
5694
+ xe,
5695
+ M
5695
5696
  ]);
5696
- let A = useCallback((t) => {
5697
+ let N = useCallback((t) => {
5697
5698
  if (!e) return;
5698
- T.current !== "idle" && Se();
5699
+ E.current !== "idle" && A();
5699
5700
  let n = Math.max(2, t.pointCount ?? i), r = t.visualType ?? l;
5700
- E.current = {
5701
+ D.current = {
5701
5702
  pointCount: n,
5702
5703
  visualType: r,
5703
5704
  onSelectFinished: t.onSelectFinished
5704
- }, C.current = [], _(0), y(n), x(!1), D.current = e.getCanvas().style.cursor, e.getCanvas().style.cursor = "crosshair", h("selecting");
5705
+ }, ve.current = [], v(0), b(n), S(!1), O.current = e.getCanvas().style.cursor, e.getCanvas().style.cursor = "crosshair", g("selecting");
5705
5706
  }, [
5706
5707
  e,
5707
5708
  i,
5708
5709
  l,
5709
- Se
5710
+ A
5710
5711
  ]);
5711
- useImperativeHandle(f, () => ({ startPlanning: A }), [A]);
5712
- let j = () => {
5713
- p === "idle" ? x((e) => !e) : p === "selecting" && Se();
5714
- }, Te = () => {
5715
- u && A({
5716
- pointCount: Math.max(2, v),
5712
+ useImperativeHandle(f, () => ({ startPlanning: N }), [N]);
5713
+ let P = () => {
5714
+ p === "idle" ? S((e) => !e) : p === "selecting" && A();
5715
+ }, Se = () => {
5716
+ u && N({
5717
+ pointCount: Math.max(2, y),
5717
5718
  visualType: l,
5718
5719
  onSelectFinished: u
5719
5720
  });
5720
- }, M = (e) => {
5721
+ }, F = (e) => {
5721
5722
  let t = parseInt(e.target.value, 10);
5722
- !isNaN(t) && t >= 2 ? y(t) : e.target.value === "" && y(2);
5723
- }, Ee = () => {
5723
+ !isNaN(t) && t >= 2 ? b(t) : e.target.value === "" && b(2);
5724
+ }, Ce = () => {
5724
5725
  if (p === "planning") return /* @__PURE__ */ jsx("span", { children: "规划中..." });
5725
5726
  if (p === "selecting") {
5726
- let e = E.current?.pointCount ?? v;
5727
+ let e = D.current?.pointCount ?? y;
5727
5728
  return /* @__PURE__ */ jsxs("span", { children: [
5728
- g,
5729
+ _,
5729
5730
  "/",
5730
5731
  e
5731
5732
  ] });
5732
5733
  }
5733
5734
  return "路径规划";
5734
- }, De = p === "selecting", N = p === "planning";
5735
+ }, we = p === "selecting", I = p === "planning";
5735
5736
  return !d && p === "idle" ? null : /* @__PURE__ */ jsxs("div", {
5736
5737
  className: `mapbox-route-planning-control${d ? "" : " mapbox-route-planning-control--floating"}`,
5737
5738
  children: [/* @__PURE__ */ jsxs("button", {
5738
- ref: S,
5739
- 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" : ""}`,
5740
- onClick: j,
5741
- disabled: N,
5739
+ ref: C,
5740
+ className: `mapbox-control-btn mapbox-route-planning-control__btn${we ? " mapbox-route-planning-control__btn--active" : ""}${I ? " mapbox-route-planning-control__btn--planning" : ""}${x ? " mapbox-route-planning-control__btn--active" : ""}`,
5741
+ onClick: P,
5742
+ disabled: I,
5742
5743
  title: p === "idle" ? "路径规划" : p === "selecting" ? "取消选点" : "规划中...",
5743
5744
  children: [/* @__PURE__ */ jsx("img", {
5744
5745
  src: route_planning_default,
5745
5746
  alt: "route",
5746
5747
  className: "mapbox-route-planning-control__btn-icon"
5747
- }), Ee()]
5748
- }), b && p === "idle" && /* @__PURE__ */ jsxs("div", {
5749
- ref: ye,
5748
+ }), Ce()]
5749
+ }), x && p === "idle" && /* @__PURE__ */ jsxs("div", {
5750
+ ref: w,
5750
5751
  className: "mapbox-route-planning-control__panel",
5751
5752
  children: [/* @__PURE__ */ jsx("div", {
5752
5753
  className: "mapbox-route-planning-control__panel-header",
@@ -5765,12 +5766,12 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5765
5766
  }), c ? /* @__PURE__ */ jsx("input", {
5766
5767
  type: "number",
5767
5768
  className: "mapbox-route-planning-control__panel-input",
5768
- value: v,
5769
+ value: y,
5769
5770
  min: 2,
5770
- onChange: M
5771
+ onChange: F
5771
5772
  }) : /* @__PURE__ */ jsx("span", {
5772
5773
  className: "mapbox-route-planning-control__panel-value",
5773
- children: v
5774
+ children: y
5774
5775
  })]
5775
5776
  }),
5776
5777
  /* @__PURE__ */ jsx("div", {
@@ -5779,7 +5780,7 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5779
5780
  }),
5780
5781
  /* @__PURE__ */ jsx("button", {
5781
5782
  className: "mapbox-route-planning-control__panel-start",
5782
- onClick: Te,
5783
+ onClick: Se,
5783
5784
  disabled: !u,
5784
5785
  children: "开始规划"
5785
5786
  })
@@ -5936,53 +5937,53 @@ function adjustPopupForBounds(e, t) {
5936
5937
  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;
5937
5938
  }
5938
5939
  const Mapbox = forwardRef((e, c) => {
5939
- let { center: l = [116.4074, 39.9042], zoom: u = 12, pitch: d = 0, bearing: f = 0, style: p = "mapbox://styles/mapbox/dark-v11", maxBounds: h, mode: g = "display", editConfig: _ = {}, pickerConfig: v = {}, onPick: y, interactive: b = {}, layers: x = [], rasterPaint: S, 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: N = !1, showRasterPaint: ke = !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([]);
5940
- yt.current = _t;
5940
+ let { center: l = [116.4074, 39.9042], zoom: u = 12, pitch: d = 0, bearing: f = 0, style: p = "mapbox://styles/mapbox/dark-v11", maxBounds: g, mode: _ = "display", editConfig: v = {}, pickerConfig: y = {}, onPick: b, interactive: x = {}, layers: S = [], rasterPaint: C, entities: T = [], selectedIds: E = [], entityConfig: D, nameConfig: O, selectNameConfig: k, areaConfig: M, circleConfig: N, lengthConfig: P, showCoordinates: Se = !0, showScale: F = !0, showResetView: Ce = !0, showRoadHighlight: we = !1, showMeasure: I = !1, showRasterPaint: Ee = !1, showRoutePlanning: Ae, onRasterPaintChange: je, popupDefaults: L, renderPopup: Ne, onMapLoad: Pe, onEntityClick: Fe, onPopupOpen: Ie, onPopupClose: Le, className: Re = "", containerStyle: ze } = e, Be = useRef(null), Ve = useRef(null), He = useRef(null), R = useRef(null), z = useRef(/* @__PURE__ */ new Map()), B = useRef(/* @__PURE__ */ new Map()), Ue = useRef(/* @__PURE__ */ new Set()), [V, We] = useState(null), Ge = useRef(null), Ke = useRef(null), qe = useRef(null), [Je, Ye] = useState(null), Xe = useRef(null), Ze = useRef(null), [H, Qe] = useState(null), [$e, et] = useState(_), [tt, nt] = useState(null), rt = useRef(null), [it, U] = useState(null), [at, W] = useState(null), [ot, st] = useState(null), G = useRef(!1), ct = useRef(null), lt = useRef(null), K = useRef(null), ut = useRef(null), q = useRef(null), dt = useRef([]), ft = useRef(null), pt = useRef(null), mt = useRef(null), ht = useRef([]), gt = useRef(null), _t = useRef(!1), [vt, yt] = useState([]), bt = useRef([]);
5941
+ bt.current = vt;
5941
5942
  let J = useRef(null);
5942
5943
  useEffect(() => {
5943
- nt(g);
5944
- }, [g]);
5945
- let bt = useCallback((e) => {
5946
- let t = I.current.get(e), n = L.current.get(e);
5944
+ et(_);
5945
+ }, [_]);
5946
+ let xt = useCallback((e) => {
5947
+ let t = z.current.get(e), n = B.current.get(e);
5947
5948
  if (t && n) {
5948
5949
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
5949
5950
  let r = {
5950
5951
  ...n,
5951
5952
  isAnimating: !0
5952
5953
  };
5953
- L.current.set(e, r), t.startAnimation();
5954
+ B.current.set(e, r), t.startAnimation();
5954
5955
  } else if (n.type === "circle" && t instanceof CanvasCircleRenderer) {
5955
5956
  let r = {
5956
5957
  ...n,
5957
5958
  isAnimating: !0
5958
5959
  };
5959
- L.current.set(e, r), t.startAnimation();
5960
+ B.current.set(e, r), t.startAnimation();
5960
5961
  }
5961
5962
  }
5962
- }, []), xt = useCallback((e) => {
5963
- let t = I.current.get(e), n = L.current.get(e);
5963
+ }, []), St = useCallback((e) => {
5964
+ let t = z.current.get(e), n = B.current.get(e);
5964
5965
  if (t && n) {
5965
5966
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
5966
5967
  let r = {
5967
5968
  ...n,
5968
5969
  isAnimating: !1
5969
5970
  };
5970
- L.current.set(e, r), t.stopAnimation();
5971
+ B.current.set(e, r), t.stopAnimation();
5971
5972
  } else if (n.type === "circle" && t instanceof CanvasCircleRenderer) {
5972
5973
  let r = {
5973
5974
  ...n,
5974
5975
  isAnimating: !1
5975
5976
  };
5976
- L.current.set(e, r), t.stopAnimation();
5977
+ B.current.set(e, r), t.stopAnimation();
5977
5978
  }
5978
5979
  }
5979
- }, []), St = useCallback((e) => {
5980
- let t = L.current.get(e);
5981
- t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? xt(e) : bt(e));
5982
- }, [bt, xt]), Ct = useCallback((e) => {
5980
+ }, []), Ct = useCallback((e) => {
5981
+ let t = B.current.get(e);
5982
+ t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? St(e) : xt(e));
5983
+ }, [xt, St]), wt = useCallback((e) => {
5983
5984
  if (e === void 0) {
5984
5985
  let e = !1;
5985
- for (let [, t] of I.current) if (t instanceof UnitRenderer) {
5986
+ for (let [, t] of z.current) if (t instanceof UnitRenderer) {
5986
5987
  let n = t.getShowTrajectory();
5987
5988
  if (n === "all" || typeof n == "number" && n > 0) {
5988
5989
  e = !0;
@@ -5990,46 +5991,46 @@ const Mapbox = forwardRef((e, c) => {
5990
5991
  }
5991
5992
  }
5992
5993
  let t = e ? 0 : "all";
5993
- for (let [, e] of I.current) e instanceof UnitRenderer && e.setShowTrajectory(t);
5994
+ for (let [, e] of z.current) e instanceof UnitRenderer && e.setShowTrajectory(t);
5994
5995
  } else {
5995
5996
  let t = new Set(e.map(String));
5996
- for (let [e, n] of I.current) n instanceof UnitRenderer && n.setShowTrajectory(t.has(String(e)) ? "all" : 0);
5997
+ for (let [e, n] of z.current) n instanceof UnitRenderer && n.setShowTrajectory(t.has(String(e)) ? "all" : 0);
5997
5998
  }
5998
- }, []), wt = useCallback((e, t, n) => {
5999
- let r = w.find((t) => String(t.id) === String(e));
6000
- if (!r?.popup || !F.current) return;
6001
- let i = r.popup.content ?? Ie?.(r);
5999
+ }, []), Tt = useCallback((e, t, n) => {
6000
+ let r = T.find((t) => String(t.id) === String(e));
6001
+ if (!r?.popup || !R.current) return;
6002
+ let i = r.popup.content ?? Ne?.(r);
6002
6003
  if (!i) return;
6003
- let a = mergePopupConfig(r.popup, P, i), { position: o, actualPosition: s } = calculatePopupPosition(r, a, F.current, n);
6004
- Ke({
6004
+ let a = mergePopupConfig(r.popup, L, i), { position: o, actualPosition: s } = calculatePopupPosition(r, a, R.current, n);
6005
+ We({
6005
6006
  entityId: e,
6006
6007
  position: o,
6007
6008
  config: a,
6008
6009
  openedBy: t,
6009
6010
  actualPosition: s
6010
- }), ze?.(e);
6011
+ }), Ie?.(e);
6011
6012
  }, [
6012
- w,
6013
- P,
6014
- Ie,
6015
- ze
6016
- ]), Tt = useCallback((e) => {
6017
- R?.entityId === e && (Ke(null), Be?.(e));
6018
- }, [R, Be]), Et = useCallback(() => {
6019
- Ke((e) => (e && Be?.(e.entityId), null));
6020
- }, [Be]), Dt = useCallback((e) => R?.entityId === e, [R]), Ot = useCallback((e, t, n) => {
6021
- let r = F.current;
6013
+ T,
6014
+ L,
6015
+ Ne,
6016
+ Ie
6017
+ ]), Et = useCallback((e) => {
6018
+ V?.entityId === e && (We(null), Le?.(e));
6019
+ }, [V, Le]), Dt = useCallback(() => {
6020
+ We((e) => (e && Le?.(e.entityId), null));
6021
+ }, [Le]), Ot = useCallback((e) => V?.entityId === e, [V]), kt = useCallback((e, t, n) => {
6022
+ let r = R.current;
6022
6023
  r && r.flyTo({
6023
6024
  center: e,
6024
6025
  zoom: t ?? r.getZoom(),
6025
6026
  ...n
6026
6027
  });
6027
- }, []), kt = useCallback((e, t, n) => {
6028
- let r = F.current;
6028
+ }, []), At = useCallback((e, t, n) => {
6029
+ let r = R.current;
6029
6030
  if (!r || e.length === 0) return;
6030
6031
  let i = [];
6031
6032
  for (let t of e) {
6032
- let e = I.current.get(t);
6033
+ let e = z.current.get(t);
6033
6034
  e && i.push(e.getBounds());
6034
6035
  }
6035
6036
  if (i.length === 0) return;
@@ -6051,19 +6052,19 @@ const Mapbox = forwardRef((e, c) => {
6051
6052
  pitch: n?.pitch ?? r.getPitch()
6052
6053
  };
6053
6054
  t !== void 0 && (p.maxZoom = t), n?.essential !== void 0 && (p.essential = n.essential), r.fitBounds(f, p);
6054
- }, []), At = useCallback((e) => {
6055
- let t = F.current;
6055
+ }, []), jt = useCallback((e) => {
6056
+ let t = R.current;
6056
6057
  if (!t || !t.getContainer()) return;
6057
- let { showMarker: n = !0, markerColor: r = "#3388ff", name: i, nameConfig: a } = v;
6058
+ let { showMarker: n = !0, markerColor: r = "#3388ff", name: i, nameConfig: a } = y;
6058
6059
  if (!n) {
6059
- at.current &&= (at.current.remove(), null);
6060
+ rt.current &&= (rt.current.remove(), null);
6060
6061
  return;
6061
6062
  }
6062
- if (at.current) {
6063
- at.current.setLngLat(e);
6064
- let t = at.current.getElement(), n = t.querySelector(".marker-label");
6063
+ if (rt.current) {
6064
+ rt.current.setLngLat(e);
6065
+ let t = rt.current.getElement(), n = t.querySelector(".marker-label");
6065
6066
  if (i) {
6066
- let e = resolveNameConfig(a, D);
6067
+ let e = resolveNameConfig(a, O);
6067
6068
  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`;
6068
6069
  else {
6069
6070
  let n = document.createElement("div");
@@ -6075,41 +6076,41 @@ const Mapbox = forwardRef((e, c) => {
6075
6076
  n.className = "mapbox-picker-marker";
6076
6077
  let o = document.createElement("div");
6077
6078
  if (o.className = "marker-inner", o.style.background = r, n.appendChild(o), i) {
6078
- let e = resolveNameConfig(a, D), t = document.createElement("div");
6079
+ let e = resolveNameConfig(a, O), t = document.createElement("div");
6079
6080
  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);
6080
6081
  }
6081
- at.current = new mapboxgl.Marker({
6082
+ rt.current = new mapboxgl.Marker({
6082
6083
  element: n,
6083
6084
  anchor: "bottom"
6084
6085
  }).setLngLat(e).addTo(t);
6085
6086
  }
6086
- }, [v, D]), jt = useCallback(() => {
6087
- at.current &&= (at.current.remove(), null);
6088
- }, []), Mt = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), Nt = useCallback((e) => {
6089
- let t = F.current;
6090
- if (Ue.current) if (ht.current &&= (ht.current.remove(), null), e && t) {
6087
+ }, [y, O]), Mt = useCallback(() => {
6088
+ rt.current &&= (rt.current.remove(), null);
6089
+ }, []), Nt = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), Pt = useCallback((e) => {
6090
+ let t = R.current;
6091
+ if (Be.current) if (gt.current &&= (gt.current.remove(), null), e && t) {
6091
6092
  t.getCanvas().style.cursor = "none";
6092
6093
  let n = document.createElement("div");
6093
6094
  n.className = "mapbox-custom-cursor";
6094
6095
  let r = e.size || e.width || 32;
6095
6096
  n.style.cssText = "\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n transform: translate(-50%, -50%);\n opacity: 0.8;\n ";
6096
6097
  let i = document.createElement("img");
6097
- i.src = e.icon, i.style.width = `${r}px`, i.style.height = `${e.size || e.height || r}px`, i.style.objectFit = "contain", n.appendChild(i), document.body.appendChild(n), ht.current = n;
6098
+ i.src = e.icon, i.style.width = `${r}px`, i.style.height = `${e.size || e.height || r}px`, i.style.objectFit = "contain", n.appendChild(i), document.body.appendChild(n), gt.current = n;
6098
6099
  let a = (e) => {
6099
- ht.current && (ht.current.style.left = `${e.clientX}px`, ht.current.style.top = `${e.clientY}px`);
6100
+ gt.current && (gt.current.style.left = `${e.clientX}px`, gt.current.style.top = `${e.clientY}px`);
6100
6101
  };
6101
6102
  document.addEventListener("mousemove", a), n.dataset.cleanup = "true", n._cleanup = () => {
6102
6103
  document.removeEventListener("mousemove", a);
6103
6104
  };
6104
6105
  } else t && (t.getCanvas().style.cursor = "");
6105
6106
  }, []), Y = useCallback(() => {
6106
- if (ht.current) {
6107
- let e = ht.current._cleanup;
6108
- e && e(), ht.current.remove(), ht.current = null;
6107
+ if (gt.current) {
6108
+ let e = gt.current._cleanup;
6109
+ e && e(), gt.current.remove(), gt.current = null;
6109
6110
  }
6110
- let e = F.current;
6111
+ let e = R.current;
6111
6112
  e && (e.getCanvas().style.cursor = "");
6112
- }, []), Pt = useCallback((e, t, n) => {
6113
+ }, []), Ft = useCallback((e, t, n) => {
6113
6114
  if (!e.getSource(t)) {
6114
6115
  if (!e.getStyle().glyphs) {
6115
6116
  let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
@@ -6145,8 +6146,8 @@ const Mapbox = forwardRef((e, c) => {
6145
6146
  }
6146
6147
  });
6147
6148
  }
6148
- }, []), Ft = useCallback(() => {
6149
- let e = F.current;
6149
+ }, []), It = useCallback(() => {
6150
+ let e = R.current;
6150
6151
  e && (e.getSource("rect-preview-source") || (e.addSource("rect-preview-source", {
6151
6152
  type: "geojson",
6152
6153
  data: {
@@ -6170,9 +6171,9 @@ const Mapbox = forwardRef((e, c) => {
6170
6171
  "line-width": 2,
6171
6172
  "line-dasharray": [4, 4]
6172
6173
  }
6173
- }), Pt(e, "rect-preview-measure-source", "rect-preview-measure-label")));
6174
- }, [Pt]), It = useCallback((e, t) => {
6175
- let n = F.current;
6174
+ }), Ft(e, "rect-preview-measure-source", "rect-preview-measure-label")));
6175
+ }, [Ft]), Lt = useCallback((e, t) => {
6176
+ let n = R.current;
6176
6177
  if (!n) return;
6177
6178
  let r = n.getSource("rect-preview-source");
6178
6179
  if (!r) return;
@@ -6191,11 +6192,11 @@ const Mapbox = forwardRef((e, c) => {
6191
6192
  },
6192
6193
  properties: {}
6193
6194
  });
6194
- let l = U.current, u = l?.strokeColor ?? "#3388ff", d = l?.strokeWidth ?? 2, f = l?.fillColor ?? "#3388ff", p = l?.fillOpacity ?? .1;
6195
+ let l = ct.current, u = l?.strokeColor ?? "#3388ff", d = l?.strokeWidth ?? 2, f = l?.fillColor ?? "#3388ff", p = l?.fillOpacity ?? .1;
6195
6196
  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));
6196
6197
  let m = n.getSource("rect-preview-measure-source");
6197
6198
  if (m) {
6198
- let e = Pn.current, t = [], n = c[0], r = c[1], i = c[2];
6199
+ let e = Fn.current, t = [], n = c[0], r = c[1], i = c[2];
6199
6200
  if (e?.showArea) {
6200
6201
  let e = [(n[0] + i[0]) / 2, (n[1] + i[1]) / 2], a = distance(n, r), o = distance(r, i);
6201
6202
  t.push({
@@ -6232,8 +6233,8 @@ const Mapbox = forwardRef((e, c) => {
6232
6233
  features: t
6233
6234
  });
6234
6235
  }
6235
- }, []), Lt = useCallback(() => {
6236
- let e = F.current;
6236
+ }, []), Rt = useCallback(() => {
6237
+ let e = R.current;
6237
6238
  if (!e) return;
6238
6239
  let t = e.getSource("rect-preview-source");
6239
6240
  t && t.setData({
@@ -6246,9 +6247,9 @@ const Mapbox = forwardRef((e, c) => {
6246
6247
  features: []
6247
6248
  });
6248
6249
  }, []), X = useCallback(() => {
6249
- lt(null), Lt();
6250
- }, [Lt]), Rt = useCallback(() => {
6251
- let e = F.current;
6250
+ st(null), Rt();
6251
+ }, [Rt]), zt = useCallback(() => {
6252
+ let e = R.current;
6252
6253
  e && (e.getSource("circle-preview-source") || (e.addSource("circle-preview-source", {
6253
6254
  type: "geojson",
6254
6255
  data: {
@@ -6272,7 +6273,7 @@ const Mapbox = forwardRef((e, c) => {
6272
6273
  "line-width": 2,
6273
6274
  "line-dasharray": [4, 4]
6274
6275
  }
6275
- }), Pt(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
6276
+ }), Ft(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
6276
6277
  type: "geojson",
6277
6278
  data: {
6278
6279
  type: "FeatureCollection",
@@ -6289,22 +6290,22 @@ const Mapbox = forwardRef((e, c) => {
6289
6290
  "line-dasharray": [4, 4]
6290
6291
  }
6291
6292
  }))));
6292
- }, [Pt]), zt = useCallback((e, t, n = 64) => {
6293
+ }, [Ft]), Bt = useCallback((e, t, n = 64) => {
6293
6294
  let [r, i] = e, a = [], o = t / 6371e3, s = i * Math.PI / 180;
6294
6295
  for (let e = 0; e <= n; e++) {
6295
6296
  let t = e / n * 2 * Math.PI, c = o * Math.cos(t), l = o * Math.sin(t) / Math.cos(s), u = i + c * 180 / Math.PI, d = r + l * 180 / Math.PI;
6296
6297
  a.push([d, u]);
6297
6298
  }
6298
6299
  return a;
6299
- }, []), Bt = useCallback((e, t) => {
6300
+ }, []), Vt = useCallback((e, t) => {
6300
6301
  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);
6301
6302
  return 6371e3 * (2 * Math.atan2(Math.sqrt(c), Math.sqrt(1 - c)));
6302
- }, []), Vt = useCallback((e, t) => {
6303
- let n = F.current;
6303
+ }, []), Ht = useCallback((e, t) => {
6304
+ let n = R.current;
6304
6305
  if (!n) return;
6305
6306
  let r = n.getSource("circle-preview-source");
6306
6307
  if (!r) return;
6307
- let i = Bt(e, t), a = zt(e, i);
6308
+ let i = Vt(e, t), a = Bt(e, i);
6308
6309
  r.setData({
6309
6310
  type: "Feature",
6310
6311
  geometry: {
@@ -6313,9 +6314,9 @@ const Mapbox = forwardRef((e, c) => {
6313
6314
  },
6314
6315
  properties: {}
6315
6316
  });
6316
- let o = W.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6317
+ let o = K.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6317
6318
  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));
6318
- let d = Pn.current, f = [], p = [];
6319
+ let d = Fn.current, f = [], p = [];
6319
6320
  if (d?.showArea) {
6320
6321
  let t = Math.PI * i * i;
6321
6322
  f.push({
@@ -6328,7 +6329,7 @@ const Mapbox = forwardRef((e, c) => {
6328
6329
  });
6329
6330
  }
6330
6331
  if (d?.showRadius) {
6331
- let t = W.current?.radiusAngle ?? 90, n = destinationPoint(e, i, t), r = [(e[0] + n[0]) / 2, (e[1] + n[1]) / 2];
6332
+ let t = K.current?.radiusAngle ?? 90, n = destinationPoint(e, i, t), r = [(e[0] + n[0]) / 2, (e[1] + n[1]) / 2];
6332
6333
  p.push({
6333
6334
  type: "Feature",
6334
6335
  geometry: {
@@ -6350,13 +6351,13 @@ const Mapbox = forwardRef((e, c) => {
6350
6351
  type: "FeatureCollection",
6351
6352
  features: f
6352
6353
  });
6353
- let ve = n.getSource("circle-preview-radius-source");
6354
- ve && ve.setData({
6354
+ let h = n.getSource("circle-preview-radius-source");
6355
+ h && h.setData({
6355
6356
  type: "FeatureCollection",
6356
6357
  features: p
6357
6358
  });
6358
- }, [Bt, zt]), Ht = useCallback(() => {
6359
- let e = F.current;
6359
+ }, [Vt, Bt]), Ut = useCallback(() => {
6360
+ let e = R.current;
6360
6361
  if (!e) return;
6361
6362
  let t = e.getSource("circle-preview-source");
6362
6363
  t && t.setData({
@@ -6373,10 +6374,10 @@ const Mapbox = forwardRef((e, c) => {
6373
6374
  type: "FeatureCollection",
6374
6375
  features: []
6375
6376
  });
6376
- }, []), Ut = useCallback(() => {
6377
- dt.current = null, Ht();
6378
- }, [Ht]), Wt = useCallback(() => {
6379
- let e = F.current;
6377
+ }, []), Wt = useCallback(() => {
6378
+ ut.current = null, Ut();
6379
+ }, [Ut]), Gt = useCallback(() => {
6380
+ let e = R.current;
6380
6381
  e && (e.getSource("polygon-preview-source") || (e.addSource("polygon-preview-source", {
6381
6382
  type: "geojson",
6382
6383
  data: {
@@ -6416,9 +6417,9 @@ const Mapbox = forwardRef((e, c) => {
6416
6417
  "circle-stroke-color": "#ffffff",
6417
6418
  "circle-stroke-width": 2
6418
6419
  }
6419
- }), Pt(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
6420
- }, [Pt]), Gt = useCallback((e, t) => {
6421
- let n = F.current;
6420
+ }), Ft(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
6421
+ }, [Ft]), Kt = useCallback((e, t) => {
6422
+ let n = R.current;
6422
6423
  if (!n) return;
6423
6424
  let r = n.getSource("polygon-preview-source"), i = n.getSource("polygon-vertices-source");
6424
6425
  if (!r || !i) return;
@@ -6455,11 +6456,11 @@ const Mapbox = forwardRef((e, c) => {
6455
6456
  properties: {}
6456
6457
  }))
6457
6458
  });
6458
- let o = G.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6459
+ let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6459
6460
  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);
6460
6461
  let d = n.getSource("polygon-preview-measure-source");
6461
6462
  if (d) {
6462
- let e = Pn.current, t = [];
6463
+ let e = Fn.current, t = [];
6463
6464
  if (e?.showArea && a.length >= 3) {
6464
6465
  let e = [...a, a[0]], n = polygonArea(e), r = 0, i = 0;
6465
6466
  for (let e of a) r += e[0], i += e[1];
@@ -6501,8 +6502,8 @@ const Mapbox = forwardRef((e, c) => {
6501
6502
  features: t
6502
6503
  });
6503
6504
  }
6504
- }, []), Kt = useCallback(() => {
6505
- let e = F.current;
6505
+ }, []), qt = useCallback(() => {
6506
+ let e = R.current;
6506
6507
  if (!e) return;
6507
6508
  let t = e.getSource("polygon-preview-source");
6508
6509
  t && t.setData({
@@ -6519,10 +6520,10 @@ const Mapbox = forwardRef((e, c) => {
6519
6520
  type: "FeatureCollection",
6520
6521
  features: []
6521
6522
  });
6522
- }, []), qt = useCallback(() => {
6523
- ft.current = [], Kt();
6524
- }, [Kt]), Jt = useCallback(() => {
6525
- let e = F.current;
6523
+ }, []), Jt = useCallback(() => {
6524
+ dt.current = [], qt();
6525
+ }, [qt]), Yt = useCallback(() => {
6526
+ let e = R.current;
6526
6527
  e && (e.getSource("square-preview-source") || (e.addSource("square-preview-source", {
6527
6528
  type: "geojson",
6528
6529
  data: {
@@ -6546,8 +6547,8 @@ const Mapbox = forwardRef((e, c) => {
6546
6547
  "line-width": 2,
6547
6548
  "line-dasharray": [4, 4]
6548
6549
  }
6549
- }), Pt(e, "square-preview-measure-source", "square-preview-measure-label")));
6550
- }, [Pt]), Yt = useCallback((e, t) => {
6550
+ }), Ft(e, "square-preview-measure-source", "square-preview-measure-label")));
6551
+ }, [Ft]), Xt = useCallback((e, t) => {
6551
6552
  let [n, r] = e, i = t / 2 / 6371e3, a = r * Math.PI / 180, o = i * 180 / Math.PI, s = i * 180 / Math.PI / Math.cos(a);
6552
6553
  return [
6553
6554
  [n - s, r + o],
@@ -6556,12 +6557,12 @@ const Mapbox = forwardRef((e, c) => {
6556
6557
  [n - s, r - o],
6557
6558
  [n - s, r + o]
6558
6559
  ];
6559
- }, []), Xt = useCallback((e, t) => {
6560
- let n = F.current;
6560
+ }, []), Zt = useCallback((e, t) => {
6561
+ let n = R.current;
6561
6562
  if (!n) return;
6562
6563
  let r = n.getSource("square-preview-source");
6563
6564
  if (!r) return;
6564
- let i = Bt(e, t) * 2, a = Yt(e, i);
6565
+ let i = Vt(e, t) * 2, a = Xt(e, i);
6565
6566
  r.setData({
6566
6567
  type: "Feature",
6567
6568
  geometry: {
@@ -6570,11 +6571,11 @@ const Mapbox = forwardRef((e, c) => {
6570
6571
  },
6571
6572
  properties: {}
6572
6573
  });
6573
- let o = K.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6574
+ let o = ft.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6574
6575
  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));
6575
6576
  let d = n.getSource("square-preview-measure-source");
6576
6577
  if (d) {
6577
- let t = Pn.current, n = [];
6578
+ let t = Fn.current, n = [];
6578
6579
  if (t?.showArea && n.push({
6579
6580
  type: "Feature",
6580
6581
  geometry: {
@@ -6598,8 +6599,8 @@ const Mapbox = forwardRef((e, c) => {
6598
6599
  features: n
6599
6600
  });
6600
6601
  }
6601
- }, [Bt, Yt]), Zt = useCallback(() => {
6602
- let e = F.current;
6602
+ }, [Vt, Xt]), Qt = useCallback(() => {
6603
+ let e = R.current;
6603
6604
  if (!e) return;
6604
6605
  let t = e.getSource("square-preview-source");
6605
6606
  t && t.setData({
@@ -6611,10 +6612,10 @@ const Mapbox = forwardRef((e, c) => {
6611
6612
  type: "FeatureCollection",
6612
6613
  features: []
6613
6614
  });
6614
- }, []), Qt = useCallback(() => {
6615
- pt.current = null, Zt();
6616
- }, [Zt]), $t = useCallback(() => {
6617
- let e = F.current;
6615
+ }, []), $t = useCallback(() => {
6616
+ pt.current = null, Qt();
6617
+ }, [Qt]), en = useCallback(() => {
6618
+ let e = R.current;
6618
6619
  e && (e.getSource("polyline-preview-source") || (e.addSource("polyline-preview-source", {
6619
6620
  type: "geojson",
6620
6621
  data: {
@@ -6646,9 +6647,9 @@ const Mapbox = forwardRef((e, c) => {
6646
6647
  "circle-stroke-color": "#ffffff",
6647
6648
  "circle-stroke-width": 2
6648
6649
  }
6649
- }), Pt(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
6650
- }, [Pt]), en = useCallback((e, t) => {
6651
- let n = F.current;
6650
+ }), Ft(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
6651
+ }, [Ft]), tn = useCallback((e, t) => {
6652
+ let n = R.current;
6652
6653
  if (!n) return;
6653
6654
  let r = n.getSource("polyline-preview-source"), i = n.getSource("polyline-vertices-source");
6654
6655
  if (!r || !i) return;
@@ -6674,11 +6675,11 @@ const Mapbox = forwardRef((e, c) => {
6674
6675
  properties: {}
6675
6676
  }))
6676
6677
  });
6677
- let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
6678
+ let o = mt.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
6678
6679
  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);
6679
6680
  let l = n.getSource("polyline-preview-measure-source");
6680
6681
  if (l) {
6681
- let e = Pn.current, t = [];
6682
+ let e = Fn.current, t = [];
6682
6683
  if (e?.showLength && a.length >= 2) for (let e = 0; e < a.length - 1; e++) {
6683
6684
  let n = a[e], r = a[e + 1], i = [(n[0] + r[0]) / 2, (n[1] + r[1]) / 2];
6684
6685
  t.push({
@@ -6695,8 +6696,8 @@ const Mapbox = forwardRef((e, c) => {
6695
6696
  features: t
6696
6697
  });
6697
6698
  }
6698
- }, []), tn = useCallback(() => {
6699
- let e = F.current;
6699
+ }, []), nn = useCallback(() => {
6700
+ let e = R.current;
6700
6701
  if (!e) return;
6701
6702
  let t = e.getSource("polyline-preview-source");
6702
6703
  t && t.setData({
@@ -6714,158 +6715,159 @@ const Mapbox = forwardRef((e, c) => {
6714
6715
  features: []
6715
6716
  });
6716
6717
  }, []), Z = useCallback(() => {
6717
- mt.current = [], tn();
6718
- }, [tn]), nn = useCallback((e) => {
6719
- B(e), Nt(e), e ? (V("marker"), X(), Ut(), qt(), Qt(), Z()) : V(null);
6718
+ ht.current = [], nn();
6719
+ }, [nn]), rn = useCallback((e) => {
6720
+ U(e), Pt(e), e ? (W("marker"), X(), Wt(), Jt(), $t(), Z()) : W(null);
6720
6721
  }, [
6721
- Nt,
6722
+ Pt,
6722
6723
  X,
6723
- Ut,
6724
- qt,
6725
- Qt,
6724
+ Wt,
6725
+ Jt,
6726
+ $t,
6726
6727
  Z
6727
- ]), rn = useCallback((e) => {
6728
- if (V(e), e === "rectangle") {
6729
- B(null), Y(), Ut(), qt(), Qt(), Z();
6730
- let e = F.current;
6728
+ ]), an = useCallback((e) => {
6729
+ if (W(e), e === "rectangle") {
6730
+ U(null), Y(), Wt(), Jt(), $t(), Z();
6731
+ let e = R.current;
6731
6732
  e && (e.getCanvas().style.cursor = "crosshair");
6732
6733
  } else if (e === "circle") {
6733
- B(null), Y(), X(), qt(), Qt(), Z();
6734
- let e = F.current;
6734
+ U(null), Y(), X(), Jt(), $t(), Z();
6735
+ let e = R.current;
6735
6736
  e && (e.getCanvas().style.cursor = "crosshair");
6736
6737
  } else if (e === "polygon") {
6737
- B(null), Y(), X(), Ut(), Qt(), Z();
6738
- let e = F.current;
6738
+ U(null), Y(), X(), Wt(), $t(), Z();
6739
+ let e = R.current;
6739
6740
  e && (e.getCanvas().style.cursor = "crosshair");
6740
6741
  } else if (e === "square") {
6741
- B(null), Y(), X(), Ut(), qt(), Z();
6742
- let e = F.current;
6742
+ U(null), Y(), X(), Wt(), Jt(), Z();
6743
+ let e = R.current;
6743
6744
  e && (e.getCanvas().style.cursor = "crosshair");
6744
6745
  } else if (e === "polyline") {
6745
- B(null), Y(), X(), Ut(), qt(), Qt();
6746
- let e = F.current;
6746
+ U(null), Y(), X(), Wt(), Jt(), $t();
6747
+ let e = R.current;
6747
6748
  e && (e.getCanvas().style.cursor = "crosshair");
6748
- } else e === "marker" ? (X(), Ut(), qt(), Qt(), Z()) : (B(null), Y(), X(), Ut(), qt(), Qt(), Z());
6749
+ } else e === "marker" ? (X(), Wt(), Jt(), $t(), Z()) : (U(null), Y(), X(), Wt(), Jt(), $t(), Z());
6749
6750
  }, [
6750
6751
  Y,
6751
6752
  X,
6752
- Ut,
6753
- qt,
6754
- Qt,
6753
+ Wt,
6754
+ Jt,
6755
+ $t,
6755
6756
  Z
6756
- ]), an = useCallback((e) => {
6757
+ ]), on = useCallback((e) => {
6757
6758
  if (e !== "picker") {
6758
- let e = v.value && isFinite(v.value.lng) && isFinite(v.value.lat), t = v.showMarker !== !1;
6759
- (!e || !t) && jt(), it(null);
6759
+ let e = y.value && isFinite(y.value.lng) && isFinite(y.value.lat), t = y.showMarker !== !1;
6760
+ (!e || !t) && Mt(), nt(null);
6760
6761
  }
6761
- e !== "edit" && (B(null), V(null), X(), Z(), Y()), nt(e);
6762
+ e !== "edit" && (U(null), W(null), X(), Z(), Y()), et(e);
6762
6763
  }, [
6763
- jt,
6764
+ Mt,
6764
6765
  Y,
6765
6766
  X,
6766
6767
  Z
6767
- ]), on = useCallback(() => tt, [tt]), sn = useCallback(() => rt, [rt]), cn = useCallback(() => {
6768
- jt(), it(null);
6769
- }, [jt]);
6768
+ ]), sn = useCallback(() => $e, [$e]), cn = useCallback(() => tt, [tt]), ln = useCallback(() => {
6769
+ Mt(), nt(null);
6770
+ }, [Mt]);
6770
6771
  useEffect(() => {
6771
- if (!z) return;
6772
- let e = v.value;
6772
+ if (!H) return;
6773
+ let e = y.value;
6773
6774
  if (e && isFinite(e.lng) && isFinite(e.lat)) {
6774
6775
  let t = [e.lng, e.lat];
6775
- it(e), At(t);
6776
+ nt(e), jt(t);
6776
6777
  }
6777
6778
  }, [
6778
- v.value,
6779
- At,
6780
- z
6779
+ y.value,
6780
+ jt,
6781
+ H
6781
6782
  ]);
6782
- let ln = (e) => "mode" in e, un = useCallback((e) => {
6783
- if (nt("edit"), jt(), it(null), H.current = !0, ln(e)) {
6784
- 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({
6783
+ let un = (e) => "mode" in e, dn = useCallback((e) => {
6784
+ if (et("edit"), Mt(), nt(null), G.current = !0, un(e)) {
6785
+ if (e.mode === "marker") e.markerStyle ? (lt.current = e.markerStyle, ct.current = null, K.current = null, q.current = null, ft.current = null, mt.current = null, U(null), W("marker"), e.markerStyle.src && e.markerStyle.width ? Pt({
6785
6786
  id: "custom",
6786
6787
  name: e.markerStyle.name || "Marker",
6787
6788
  icon: e.markerStyle.src,
6788
6789
  width: e.markerStyle.width
6789
- }) : 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));
6790
+ }) : Y()) : e.template && (lt.current = null, ct.current = null, K.current = null, q.current = null, ft.current = null, mt.current = null, U(e.template), W("marker"), Pt(e.template));
6790
6791
  else if (e.mode === "rectangle") {
6791
- 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();
6792
- let t = F.current;
6792
+ ct.current = e.rectangleStyle || null, lt.current = null, K.current = null, q.current = null, ft.current = null, mt.current = null, U(null), W("rectangle"), Y();
6793
+ let t = R.current;
6793
6794
  t && (t.getCanvas().style.cursor = "crosshair");
6794
6795
  } else if (e.mode === "circle") {
6795
- 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();
6796
- let t = F.current;
6796
+ K.current = e.circleStyle || null, ct.current = null, lt.current = null, q.current = null, ft.current = null, mt.current = null, U(null), W("circle"), Y();
6797
+ let t = R.current;
6797
6798
  t && (t.getCanvas().style.cursor = "crosshair");
6798
6799
  } else if (e.mode === "polygon") {
6799
- 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();
6800
- let t = F.current;
6800
+ q.current = e.polygonStyle || null, ct.current = null, lt.current = null, K.current = null, ft.current = null, mt.current = null, U(null), W("polygon"), Y();
6801
+ let t = R.current;
6801
6802
  t && (t.getCanvas().style.cursor = "crosshair");
6802
6803
  } else if (e.mode === "square") {
6803
- 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();
6804
- let t = F.current;
6804
+ ft.current = e.squareStyle || null, ct.current = null, lt.current = null, K.current = null, q.current = null, mt.current = null, U(null), W("square"), Y();
6805
+ let t = R.current;
6805
6806
  t && (t.getCanvas().style.cursor = "crosshair");
6806
6807
  } else if (e.mode === "polyline") {
6807
- 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();
6808
- let t = F.current;
6808
+ mt.current = e.polylineStyle || null, ct.current = null, lt.current = null, K.current = null, q.current = null, ft.current = null, U(null), W("polyline"), Y();
6809
+ let t = R.current;
6809
6810
  t && (t.getCanvas().style.cursor = "crosshair");
6810
6811
  }
6811
- } 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;
6812
+ } else U(e), W("marker"), Pt(e), ct.current = null, lt.current = null, K.current = null, q.current = null, ft.current = null, mt.current = null;
6812
6813
  }, [
6813
- jt,
6814
- Nt,
6814
+ Mt,
6815
+ Pt,
6815
6816
  Y
6816
6817
  ]);
6817
6818
  useImperativeHandle(c, () => ({
6818
- startAnimation: bt,
6819
- stopAnimation: xt,
6820
- toggleAnimation: St,
6821
- getMap: () => F.current,
6822
- openPopup: (e) => wt(e, "programmatic"),
6823
- closePopup: Tt,
6824
- closeAllPopups: Et,
6825
- isPopupOpen: Dt,
6826
- toggleUnitTrajectory: Ct,
6827
- flyTo: Ot,
6828
- flyToEntities: kt,
6829
- getMode: on,
6830
- setMode: an,
6831
- getPickedLocation: sn,
6832
- clearPickedLocation: cn,
6833
- startDrawing: un,
6834
- getRenderer: (e) => I.current.get(e),
6819
+ startAnimation: xt,
6820
+ stopAnimation: St,
6821
+ toggleAnimation: Ct,
6822
+ getMap: () => R.current,
6823
+ openPopup: (e) => Tt(e, "programmatic"),
6824
+ closePopup: Et,
6825
+ closeAllPopups: Dt,
6826
+ isPopupOpen: Ot,
6827
+ toggleUnitTrajectory: wt,
6828
+ flyTo: kt,
6829
+ flyToEntities: At,
6830
+ getMode: sn,
6831
+ setMode: on,
6832
+ getPickedLocation: cn,
6833
+ clearPickedLocation: ln,
6834
+ startDrawing: dn,
6835
+ getRenderer: (e) => z.current.get(e),
6835
6836
  setEditingEntities: (e) => {
6836
- for (let t of yt.current) e.map(String).includes(String(t)) || I.current.get(t)?.setEditing?.(!1);
6837
- for (let t of e) I.current.get(t)?.setEditing?.(!0);
6838
- J.current &&= (I.current.get(J.current.entityId)?.cancelEditPreview?.(), null), vt(e);
6837
+ for (let t of bt.current) e.map(String).includes(String(t)) || z.current.get(t)?.setEditing?.(!1);
6838
+ for (let t of e) z.current.get(t)?.setEditing?.(!0);
6839
+ J.current &&= (z.current.get(J.current.entityId)?.cancelEditPreview?.(), null), yt(e);
6839
6840
  },
6840
- getEditingEntities: () => yt.current,
6841
+ getEditingEntities: () => bt.current,
6841
6842
  startRoutePlanning: (e) => {
6842
- We.current?.startPlanning(e);
6843
- }
6843
+ Ve.current?.startPlanning(e);
6844
+ },
6845
+ getRoadHighlightControl: () => He.current
6844
6846
  }), [
6845
- bt,
6846
6847
  xt,
6847
6848
  St,
6848
- wt,
6849
+ Ct,
6849
6850
  Tt,
6850
6851
  Et,
6851
6852
  Dt,
6852
- Ct,
6853
6853
  Ot,
6854
+ wt,
6854
6855
  kt,
6855
- on,
6856
- an,
6856
+ At,
6857
6857
  sn,
6858
+ on,
6858
6859
  cn,
6859
- un
6860
+ ln,
6861
+ dn
6860
6862
  ]);
6861
- let dn = useCallback(() => {
6862
- let e = F.current;
6863
+ let fn = useCallback(() => {
6864
+ let e = R.current;
6863
6865
  if (!e) return;
6864
- let t = new Set(w.map((e) => e.id)), n = new Set(I.current.keys());
6865
- for (let e of n) t.has(e) || (I.current.get(e)?.destroy(), I.current.delete(e));
6866
- let r = new Set(T.map(String));
6867
- for (let t of w) {
6868
- let n = applyEntityConfig(t, E), i = I.current.get(n.id);
6866
+ let t = new Set(T.map((e) => e.id)), n = new Set(z.current.keys());
6867
+ for (let e of n) t.has(e) || (z.current.get(e)?.destroy(), z.current.delete(e));
6868
+ let r = new Set(E.map(String));
6869
+ for (let t of T) {
6870
+ let n = applyEntityConfig(t, D), i = z.current.get(n.id);
6869
6871
  if (i) if (n.type === "radar" && i instanceof CanvasRadarRenderer) i.update(n);
6870
6872
  else if (n.type === "image" && i instanceof CanvasImageRenderer) i.update(n);
6871
6873
  else if (n.type === "marker" && i instanceof MarkerRenderer) i.update(n);
@@ -6874,38 +6876,38 @@ const Mapbox = forwardRef((e, c) => {
6874
6876
  else if (n.type === "circle") if (n.fillType === "radial-gradient") if (i instanceof CanvasCircleRenderer) i.update(n);
6875
6877
  else {
6876
6878
  i.destroy();
6877
- let t = new CanvasCircleRenderer(e, n, D, O, k, A);
6878
- I.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6879
+ let t = new CanvasCircleRenderer(e, n, O, k, M, N);
6880
+ z.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6879
6881
  }
6880
6882
  else if (i instanceof CircleRenderer) i.update(n);
6881
6883
  else {
6882
6884
  i.destroy();
6883
- let t = new CircleRenderer(e, n, D, O, k, A);
6884
- I.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6885
+ let t = new CircleRenderer(e, n, O, k, M, N);
6886
+ z.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6885
6887
  }
6886
6888
  else (n.type === "square" && i instanceof SquareRenderer || n.type === "rectangle" && i instanceof RectangleRenderer || n.type === "polyline" && i instanceof PolylineRenderer) && i.update(n);
6887
6889
  else {
6888
6890
  let t = null;
6889
- 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));
6891
+ 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, M, P) : n.type === "circle" ? t = n.fillType === "radial-gradient" ? new CanvasCircleRenderer(e, n, O, k, M, N) : new CircleRenderer(e, n, O, k, M, N) : n.type === "square" ? t = new SquareRenderer(e, n, O, k, M, P) : n.type === "rectangle" ? t = new RectangleRenderer(e, n, O, k, M, P) : n.type === "polyline" && (t = new PolylineRenderer(e, n, O, k, P)), t && (z.current.set(n.id, t), t.setSelected(r.has(String(n.id))), bt.current.map(String).includes(String(n.id)) && t.setEditing?.(!0));
6890
6892
  }
6891
6893
  }
6892
- for (let e of yt.current) {
6893
- let t = I.current.get(e);
6894
+ for (let e of bt.current) {
6895
+ let t = z.current.get(e);
6894
6896
  t && t.setEditing?.(!0);
6895
6897
  }
6896
6898
  }, [
6897
- w,
6898
6899
  T,
6899
6900
  E,
6900
6901
  D,
6901
6902
  O,
6902
6903
  k,
6903
- A,
6904
- j
6905
- ]), fn = useCallback(() => {
6906
- for (let e of I.current.values()) e.destroy();
6907
- I.current.clear();
6908
- }, []), pn = useCallback((e) => {
6904
+ M,
6905
+ N,
6906
+ P
6907
+ ]), pn = useCallback(() => {
6908
+ for (let e of z.current.values()) e.destroy();
6909
+ z.current.clear();
6910
+ }, []), mn = useCallback((e) => {
6909
6911
  let t = e.getStyle();
6910
6912
  if (!t?.layers) return;
6911
6913
  let n = [
@@ -6920,10 +6922,10 @@ const Mapbox = forwardRef((e, c) => {
6920
6922
  "marker-"
6921
6923
  ];
6922
6924
  for (let e of t.layers) if (n.some((t) => e.id.startsWith(t))) return e.id;
6923
- }, []), mn = useCallback((e) => {
6924
- let t = S, 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;
6925
+ }, []), hn = useCallback((e) => {
6926
+ 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;
6925
6927
  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;
6926
- }, [S]), hn = useCallback((e, t) => {
6928
+ }, [C]), gn = useCallback((e, t) => {
6927
6929
  let n = `base-layer-source-${t.id}`, r = `base-layer-${t.id}`, i = {
6928
6930
  type: "raster",
6929
6931
  tiles: [t.url],
@@ -6933,19 +6935,19 @@ const Mapbox = forwardRef((e, c) => {
6933
6935
  scheme: t.scheme ?? "xyz"
6934
6936
  };
6935
6937
  t.bounds && (i.bounds = t.bounds), t.attribution && (i.attribution = t.attribution), e.addSource(n, i);
6936
- let a = pn(e);
6938
+ let a = mn(e);
6937
6939
  e.addLayer({
6938
6940
  id: r,
6939
6941
  type: "raster",
6940
6942
  source: n,
6941
- paint: mn(t),
6943
+ paint: hn(t),
6942
6944
  layout: { visibility: t.visible === !1 ? "none" : "visible" }
6943
6945
  }, a);
6944
- }, [pn, mn]), gn = useCallback(async (e, t) => {
6946
+ }, [mn, hn]), _n = useCallback(async (e, t) => {
6945
6947
  try {
6946
6948
  let n = await (await fetch(t.url)).json(), r = `base-layer-source-${t.id}`, i = `base-layer-${t.id}`;
6947
- if (!Ge.current.has(t.id)) return;
6948
- let a = n.format === "pbf" || n.vector_layers, o = pn(e);
6949
+ if (!Ue.current.has(t.id)) return;
6950
+ let a = n.format === "pbf" || n.vector_layers, o = mn(e);
6949
6951
  if (a) {
6950
6952
  let t = {
6951
6953
  type: "vector",
@@ -6966,21 +6968,21 @@ const Mapbox = forwardRef((e, c) => {
6966
6968
  id: i,
6967
6969
  type: "raster",
6968
6970
  source: r,
6969
- paint: mn(t),
6971
+ paint: hn(t),
6970
6972
  layout: { visibility: t.visible === !1 ? "none" : "visible" }
6971
6973
  }, o);
6972
6974
  } catch (e) {
6973
6975
  console.error(`Failed to load TileJSON from ${t.url}:`, e);
6974
6976
  }
6975
- }, [pn, mn]), _n = useCallback(async (e, t) => {
6977
+ }, [mn, hn]), vn = useCallback(async (e, t) => {
6976
6978
  try {
6977
6979
  let n = await (await fetch(t.url)).json();
6978
- if (!Ge.current.has(t.id)) return;
6980
+ if (!Ue.current.has(t.id)) return;
6979
6981
  if (n.sources) for (let [r, i] of Object.entries(n.sources)) {
6980
6982
  let n = `base-layer-source-${t.id}-${r}`;
6981
6983
  e.getSource(n) || e.addSource(n, i);
6982
6984
  }
6983
- let r = pn(e);
6985
+ let r = mn(e);
6984
6986
  if (n.layers) for (let i of n.layers) {
6985
6987
  let n = `base-layer-${t.id}-${i.id}`;
6986
6988
  if (e.getLayer(n)) continue;
@@ -6991,7 +6993,7 @@ const Mapbox = forwardRef((e, c) => {
6991
6993
  };
6992
6994
  i.type === "raster" && (a.paint = {
6993
6995
  ...a.paint,
6994
- ...mn(t)
6996
+ ...hn(t)
6995
6997
  }), t.visible === !1 && (a.layout = {
6996
6998
  ...a.layout,
6997
6999
  visibility: "none"
@@ -7004,50 +7006,50 @@ const Mapbox = forwardRef((e, c) => {
7004
7006
  } catch (e) {
7005
7007
  console.error(`Failed to load Style JSON from ${t.url}:`, e);
7006
7008
  }
7007
- }, [pn, mn]), vn = useCallback((e, t) => {
7009
+ }, [mn, hn]), yn = useCallback((e, t) => {
7008
7010
  let n = e.getStyle();
7009
7011
  if (!n) return;
7010
7012
  let r = `base-layer-${t}`, i = n.layers?.filter((e) => e.id.startsWith(r)) ?? [];
7011
7013
  for (let t of i) e.getLayer(t.id) && e.removeLayer(t.id);
7012
7014
  let a = `base-layer-source-${t}`, o = n.sources ?? {};
7013
7015
  for (let t of Object.keys(o)) t.startsWith(a) && e.getSource(t) && e.removeSource(t);
7014
- }, []), yn = useCallback((e) => {
7015
- let t = F.current;
7016
+ }, []), bn = useCallback((e) => {
7017
+ let t = R.current;
7016
7018
  if (!t) return;
7017
- let n = new Set(e.map((e) => e.id)), r = Ge.current;
7018
- for (let e of r) n.has(e) || (vn(t, e), r.delete(e));
7019
+ let n = new Set(e.map((e) => e.id)), r = Ue.current;
7020
+ for (let e of r) n.has(e) || (yn(t, e), r.delete(e));
7019
7021
  for (let n of e) if (r.has(n.id)) {
7020
7022
  let e = `base-layer-${n.id}`;
7021
7023
  if (t.getLayer(e)) {
7022
- let r = mn(n);
7024
+ let r = hn(n);
7023
7025
  for (let [n, i] of Object.entries(r)) t.setPaintProperty(e, n, i);
7024
7026
  t.setLayoutProperty(e, "visibility", n.visible === !1 ? "none" : "visible");
7025
7027
  }
7026
7028
  } else switch (r.add(n.id), n.type) {
7027
7029
  case "raster":
7028
- hn(t, n);
7030
+ gn(t, n);
7029
7031
  break;
7030
7032
  case "tilejson":
7031
- gn(t, n);
7033
+ _n(t, n);
7032
7034
  break;
7033
7035
  case "style":
7034
- _n(t, n);
7036
+ vn(t, n);
7035
7037
  break;
7036
7038
  default: {
7037
7039
  let e = n;
7038
- e.url && hn(t, {
7040
+ e.url && gn(t, {
7039
7041
  ...e,
7040
7042
  type: "raster"
7041
7043
  });
7042
7044
  }
7043
7045
  }
7044
7046
  }, [
7045
- hn,
7046
7047
  gn,
7047
7048
  _n,
7048
7049
  vn,
7049
- mn
7050
- ]), bn = useCallback((e) => {
7050
+ yn,
7051
+ hn
7052
+ ]), xn = useCallback((e) => {
7051
7053
  let t = e;
7052
7054
  for (; t;) {
7053
7055
  let e = t.getAttribute?.("data-entity-id");
@@ -7055,143 +7057,143 @@ const Mapbox = forwardRef((e, c) => {
7055
7057
  t = t.parentElement;
7056
7058
  }
7057
7059
  return null;
7058
- }, []), xn = useCallback((e) => {
7060
+ }, []), Sn = useCallback((e) => {
7059
7061
  let t = [e.lngLat.lng, e.lngLat.lat], n = {
7060
7062
  x: e.point.x,
7061
7063
  y: e.point.y
7062
- }, r = kn.current;
7064
+ }, r = An.current;
7063
7065
  if (r === "picker") {
7064
7066
  let e = {
7065
7067
  lng: t[0],
7066
7068
  lat: t[1]
7067
7069
  };
7068
- it(e), At(t), An.current?.(e);
7070
+ nt(e), jt(t), jn.current?.(e);
7069
7071
  return;
7070
7072
  }
7071
- if (gt.current) return;
7073
+ if (_t.current) return;
7072
7074
  if (r === "edit") {
7073
- let e = Mn.current;
7075
+ let e = Nn.current;
7074
7076
  if (e === "rectangle") {
7075
- let e = Nn.current;
7076
- if (!e) lt(t);
7077
+ let e = Pn.current;
7078
+ if (!e) st(t);
7077
7079
  else {
7078
- let n = U.current, r = applyEntityConfig({
7080
+ let n = ct.current, r = applyEntityConfig({
7079
7081
  ...n,
7080
- id: n?.id ?? Mt(),
7082
+ id: n?.id ?? Nt(),
7081
7083
  type: "rectangle",
7082
7084
  bounds: [e, t]
7083
- }, E);
7084
- Lt();
7085
- let i = F.current;
7086
- if (i && !I.current.has(r.id)) {
7087
- let e = new RectangleRenderer(i, r, D, O, k, j);
7088
- I.current.set(r.id, e);
7085
+ }, D);
7086
+ Rt();
7087
+ let i = R.current;
7088
+ if (i && !z.current.has(r.id)) {
7089
+ let e = new RectangleRenderer(i, r, O, k, M, P);
7090
+ z.current.set(r.id, e);
7089
7091
  }
7090
- Q.current.onRectangleAdd?.(r), lt(null), U.current = null, H.current && (H.current = !1, V(null), i && (i.getCanvas().style.cursor = ""));
7092
+ Q.current.onRectangleAdd?.(r), st(null), ct.current = null, G.current && (G.current = !1, W(null), i && (i.getCanvas().style.cursor = ""));
7091
7093
  }
7092
7094
  return;
7093
7095
  }
7094
7096
  if (e === "circle") {
7095
- let e = dt.current;
7096
- if (!e) dt.current = { center: t };
7097
+ let e = ut.current;
7098
+ if (!e) ut.current = { center: t };
7097
7099
  else {
7098
- let n = Bt(e.center, t), r = W.current, i = applyEntityConfig({
7100
+ let n = Vt(e.center, t), r = K.current, i = applyEntityConfig({
7099
7101
  ...r,
7100
- id: r?.id ?? Mt(),
7102
+ id: r?.id ?? Nt(),
7101
7103
  type: "circle",
7102
7104
  center: e.center,
7103
7105
  radius: n
7104
- }, E);
7105
- Ht();
7106
- let a = F.current;
7107
- if (a && !I.current.has(i.id)) {
7108
- let e = new CircleRenderer(a, i, D, O, k, A);
7109
- I.current.set(i.id, e);
7106
+ }, D);
7107
+ Ut();
7108
+ let a = R.current;
7109
+ if (a && !z.current.has(i.id)) {
7110
+ let e = new CircleRenderer(a, i, O, k, M, N);
7111
+ z.current.set(i.id, e);
7110
7112
  }
7111
- Q.current.onCircleAdd?.(i), dt.current = null, W.current = null, H.current && (H.current = !1, V(null), a && (a.getCanvas().style.cursor = ""));
7113
+ Q.current.onCircleAdd?.(i), ut.current = null, K.current = null, G.current && (G.current = !1, W(null), a && (a.getCanvas().style.cursor = ""));
7112
7114
  }
7113
7115
  return;
7114
7116
  }
7115
7117
  if (e === "polygon") {
7116
- let e = ft.current;
7118
+ let e = dt.current;
7117
7119
  if (e.length >= 3) {
7118
7120
  let n = e[0];
7119
- if (Bt(n, t) < 20) {
7120
- let t = G.current, n = applyEntityConfig({
7121
+ if (Vt(n, t) < 20) {
7122
+ let t = q.current, n = applyEntityConfig({
7121
7123
  ...t,
7122
- id: t?.id ?? Mt(),
7124
+ id: t?.id ?? Nt(),
7123
7125
  type: "polygon",
7124
7126
  coordinates: [...e]
7125
- }, E);
7126
- Kt();
7127
- let r = F.current;
7128
- if (r && !I.current.has(n.id)) {
7129
- let e = new PolygonRenderer(r, n, D, O, k, j);
7130
- I.current.set(n.id, e);
7127
+ }, D);
7128
+ qt();
7129
+ let r = R.current;
7130
+ if (r && !z.current.has(n.id)) {
7131
+ let e = new PolygonRenderer(r, n, O, k, M, P);
7132
+ z.current.set(n.id, e);
7131
7133
  }
7132
- Q.current.onPolygonAdd?.(n), ft.current = [], G.current = null, H.current && (H.current = !1, V(null), r && (r.getCanvas().style.cursor = ""));
7134
+ Q.current.onPolygonAdd?.(n), dt.current = [], q.current = null, G.current && (G.current = !1, W(null), r && (r.getCanvas().style.cursor = ""));
7133
7135
  return;
7134
7136
  }
7135
7137
  }
7136
- ft.current = [...e, t];
7138
+ dt.current = [...e, t];
7137
7139
  return;
7138
7140
  }
7139
7141
  if (e === "square") {
7140
7142
  let e = pt.current;
7141
7143
  if (!e) pt.current = { center: t };
7142
7144
  else {
7143
- let n = Bt(e.center, t) * 2, r = K.current, i = applyEntityConfig({
7145
+ let n = Vt(e.center, t) * 2, r = ft.current, i = applyEntityConfig({
7144
7146
  ...r,
7145
- id: r?.id ?? Mt(),
7147
+ id: r?.id ?? Nt(),
7146
7148
  type: "square",
7147
7149
  center: e.center,
7148
7150
  length: n
7149
- }, E);
7150
- Zt();
7151
- let a = F.current;
7152
- if (a && !I.current.has(i.id)) {
7153
- let e = new SquareRenderer(a, i, D, O, k, j);
7154
- I.current.set(i.id, e);
7151
+ }, D);
7152
+ Qt();
7153
+ let a = R.current;
7154
+ if (a && !z.current.has(i.id)) {
7155
+ let e = new SquareRenderer(a, i, O, k, M, P);
7156
+ z.current.set(i.id, e);
7155
7157
  }
7156
- Q.current.onSquareAdd?.(i), pt.current = null, K.current = null, H.current && (H.current = !1, V(null), a && (a.getCanvas().style.cursor = ""));
7158
+ Q.current.onSquareAdd?.(i), pt.current = null, ft.current = null, G.current && (G.current = !1, W(null), a && (a.getCanvas().style.cursor = ""));
7157
7159
  }
7158
7160
  return;
7159
7161
  }
7160
7162
  if (e === "polyline") {
7161
- mt.current = [...mt.current, t];
7163
+ ht.current = [...ht.current, t];
7162
7164
  return;
7163
7165
  }
7164
- let n = ut.current;
7166
+ let n = lt.current;
7165
7167
  if (n && n.src && n.width) {
7166
7168
  let e = {
7167
7169
  ...n,
7168
- id: n.id ?? Mt(),
7170
+ id: n.id ?? Nt(),
7169
7171
  type: "marker",
7170
7172
  center: t,
7171
7173
  src: n.src,
7172
7174
  width: n.width
7173
7175
  };
7174
- Q.current.onMarkerAdd?.(e), B(null), V(null), Y(), ut.current = null, H.current = !1;
7176
+ Q.current.onMarkerAdd?.(e), U(null), W(null), Y(), lt.current = null, G.current = !1;
7175
7177
  return;
7176
7178
  }
7177
- let r = jn.current;
7179
+ let r = Mn.current;
7178
7180
  if (r) {
7179
7181
  let e = {
7180
- id: Mt(),
7182
+ id: Nt(),
7181
7183
  type: "marker",
7182
7184
  name: r.name,
7183
7185
  center: t,
7184
7186
  src: r.icon,
7185
7187
  width: r.size || r.width || 32
7186
7188
  };
7187
- r.customData !== void 0 && (e.customData = r.customData), Q.current.onMarkerAdd?.(e), B(null), V(null), Y(), H.current = !1;
7189
+ r.customData !== void 0 && (e.customData = r.customData), Q.current.onMarkerAdd?.(e), U(null), W(null), Y(), G.current = !1;
7188
7190
  return;
7189
7191
  }
7190
7192
  }
7191
- if (yt.current.length > 0) {
7192
- let e = F.current?.getZoom() ?? 12;
7193
+ if (bt.current.length > 0) {
7194
+ let e = R.current?.getZoom() ?? 12;
7193
7195
  if (J.current) {
7194
- let { entityId: e, activeHandle: n } = J.current, r = I.current.get(e);
7196
+ let { entityId: e, activeHandle: n } = J.current, r = z.current.get(e);
7195
7197
  if (r?.applyHandleMove) {
7196
7198
  let e = r.applyHandleMove(n, t);
7197
7199
  Q.current.onEntityEdit?.(e);
@@ -7199,8 +7201,8 @@ const Mapbox = forwardRef((e, c) => {
7199
7201
  J.current = null;
7200
7202
  return;
7201
7203
  }
7202
- for (let n of yt.current) {
7203
- let r = I.current.get(n);
7204
+ for (let n of bt.current) {
7205
+ let r = z.current.get(n);
7204
7206
  if (!r?.getEditHandleAt) continue;
7205
7207
  let i = r.getEditHandleAt(t, e);
7206
7208
  if (i) {
@@ -7222,100 +7224,100 @@ const Mapbox = forwardRef((e, c) => {
7222
7224
  }
7223
7225
  }
7224
7226
  }
7225
- let i = En.current, a = Dn.current, o = On.current, s = bn(e.originalEvent.target);
7227
+ let i = Dn.current, a = On.current, o = kn.current, s = xn(e.originalEvent.target);
7226
7228
  if (s) {
7227
7229
  let e = i.find((e) => String(e.id) === s);
7228
7230
  if (e) {
7229
7231
  if (a?.(e), e.popup) {
7230
- let t = e.popup.content ?? Ie?.(e);
7231
- t && mergePopupConfig(e.popup, P, t).trigger === "click" && o(s, "click", n);
7232
+ let t = e.popup.content ?? Ne?.(e);
7233
+ t && mergePopupConfig(e.popup, L, t).trigger === "click" && o(s, "click", n);
7232
7234
  }
7233
7235
  return;
7234
7236
  }
7235
7237
  }
7236
- for (let [t, r] of I.current) {
7238
+ for (let [t, r] of z.current) {
7237
7239
  let s = r.getLabelLayerId();
7238
- if (s && F.current?.getLayer(s) && F.current.queryRenderedFeatures(e.point, { layers: [s] }).length > 0) {
7240
+ if (s && R.current?.getLayer(s) && R.current.queryRenderedFeatures(e.point, { layers: [s] }).length > 0) {
7239
7241
  let e = i.find((e) => e.id === t);
7240
7242
  if (e) {
7241
7243
  if (a?.(e), e.popup) {
7242
- let r = e.popup.content ?? Ie?.(e);
7243
- r && mergePopupConfig(e.popup, P, r).trigger === "click" && o(t, "click", n);
7244
+ let r = e.popup.content ?? Ne?.(e);
7245
+ r && mergePopupConfig(e.popup, L, r).trigger === "click" && o(t, "click", n);
7244
7246
  }
7245
7247
  return;
7246
7248
  }
7247
7249
  }
7248
7250
  }
7249
- for (let [e, r] of I.current) if (r.isPointInEntity(t)) {
7251
+ for (let [e, r] of z.current) if (r.isPointInEntity(t)) {
7250
7252
  let t = i.find((t) => t.id === e);
7251
7253
  if (t) {
7252
7254
  if (a?.(t), t.popup) {
7253
- let r = t.popup.content ?? Ie?.(t);
7254
- r && mergePopupConfig(t.popup, P, r).trigger === "click" && o(e, "click", n);
7255
+ let r = t.popup.content ?? Ne?.(t);
7256
+ r && mergePopupConfig(t.popup, L, r).trigger === "click" && o(e, "click", n);
7255
7257
  }
7256
7258
  return;
7257
7259
  }
7258
7260
  }
7259
7261
  }, [
7260
- P,
7261
- Ie,
7262
- bn
7263
- ]), Sn = useCallback((e) => {
7262
+ L,
7263
+ Ne,
7264
+ xn
7265
+ ]), Cn = useCallback((e) => {
7264
7266
  let t = [e.lngLat.lng, e.lngLat.lat];
7265
7267
  if (J.current) {
7266
7268
  let { entityId: e, activeHandle: n } = J.current;
7267
- I.current.get(e)?.updateEditPreview?.(n, t);
7269
+ z.current.get(e)?.updateEditPreview?.(n, t);
7268
7270
  return;
7269
7271
  }
7270
- let n = Mn.current, r = Nn.current;
7271
- n === "rectangle" && r && It(r, t);
7272
- let i = dt.current;
7273
- n === "circle" && i && Vt(i.center, t);
7274
- let a = ft.current;
7275
- n === "polygon" && a.length > 0 && Gt(a, t);
7272
+ let n = Nn.current, r = Pn.current;
7273
+ n === "rectangle" && r && Lt(r, t);
7274
+ let i = ut.current;
7275
+ n === "circle" && i && Ht(i.center, t);
7276
+ let a = dt.current;
7277
+ n === "polygon" && a.length > 0 && Kt(a, t);
7276
7278
  let o = pt.current;
7277
- n === "square" && o && Xt(o.center, t);
7278
- let s = mt.current;
7279
- n === "polyline" && s.length > 0 && en(s, t);
7280
- let c = En.current, l = On.current;
7281
- for (let [e, n] of I.current) if (n.isPointInEntity(t)) {
7279
+ n === "square" && o && Zt(o.center, t);
7280
+ let s = ht.current;
7281
+ n === "polyline" && s.length > 0 && tn(s, t);
7282
+ let c = Dn.current, l = kn.current;
7283
+ for (let [e, n] of z.current) if (n.isPointInEntity(t)) {
7282
7284
  let t = c.find((t) => t.id === e);
7283
7285
  if (!t?.popup) continue;
7284
- let n = t.popup.content ?? Ie?.(t);
7286
+ let n = t.popup.content ?? Ne?.(t);
7285
7287
  if (!n) continue;
7286
- let r = mergePopupConfig(t.popup, P, n);
7288
+ let r = mergePopupConfig(t.popup, L, n);
7287
7289
  if (r.trigger === "hover") {
7288
- Ye.current && clearTimeout(Ye.current), Ye.current = window.setTimeout(() => {
7290
+ qe.current && clearTimeout(qe.current), qe.current = window.setTimeout(() => {
7289
7291
  l(e, "hover");
7290
7292
  }, r.hoverDelay);
7291
7293
  return;
7292
7294
  }
7293
7295
  }
7294
- if (Ye.current &&= (clearTimeout(Ye.current), null), R?.openedBy === "hover") {
7295
- let e = I.current.get(R.entityId);
7296
- e && !e.isPointInEntity(t) && Tt(R.entityId);
7296
+ if (qe.current &&= (clearTimeout(qe.current), null), V?.openedBy === "hover") {
7297
+ let e = z.current.get(V.entityId);
7298
+ e && !e.isPointInEntity(t) && Et(V.entityId);
7297
7299
  }
7298
7300
  }, [
7299
- P,
7300
- Ie,
7301
- R,
7302
- Tt,
7303
- It,
7304
- Vt,
7305
- Gt,
7306
- Xt,
7307
- en
7308
- ]), Cn = useCallback((e) => {
7309
- if (e.preventDefault(), gt.current) return;
7310
- if (yt.current.length > 0) {
7301
+ L,
7302
+ Ne,
7303
+ V,
7304
+ Et,
7305
+ Lt,
7306
+ Ht,
7307
+ Kt,
7308
+ Zt,
7309
+ tn
7310
+ ]), wn = useCallback((e) => {
7311
+ if (e.preventDefault(), _t.current) return;
7312
+ if (bt.current.length > 0) {
7311
7313
  let t = [e.lngLat.lng, e.lngLat.lat];
7312
7314
  if (J.current) {
7313
- I.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7315
+ z.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7314
7316
  return;
7315
7317
  }
7316
- let n = F.current?.getZoom() ?? 12;
7317
- for (let e of yt.current) {
7318
- let r = I.current.get(e);
7318
+ let n = R.current?.getZoom() ?? 12;
7319
+ for (let e of bt.current) {
7320
+ let r = z.current.get(e);
7319
7321
  if (!r?.getEditHandleAt || !r.deleteVertex) continue;
7320
7322
  let i = r.getEditHandleAt(t, n);
7321
7323
  if (i && i.type === "vertex") {
@@ -7325,83 +7327,83 @@ const Mapbox = forwardRef((e, c) => {
7325
7327
  }
7326
7328
  }
7327
7329
  }
7328
- if (kn.current !== "edit") return;
7329
- if (jn.current) {
7330
- B(null), V(null), Y();
7330
+ if (An.current !== "edit") return;
7331
+ if (Mn.current) {
7332
+ U(null), W(null), Y();
7331
7333
  return;
7332
7334
  }
7333
- let t = Mn.current;
7335
+ let t = Nn.current;
7334
7336
  if (t === "rectangle") {
7335
- if (Nn.current) lt(null), Lt();
7337
+ if (Pn.current) st(null), Rt();
7336
7338
  else {
7337
- V(null);
7338
- let e = F.current;
7339
+ W(null);
7340
+ let e = R.current;
7339
7341
  e && (e.getCanvas().style.cursor = "");
7340
7342
  }
7341
7343
  return;
7342
7344
  }
7343
7345
  if (t === "circle") {
7344
- if (dt.current) dt.current = null, Ht();
7346
+ if (ut.current) ut.current = null, Ut();
7345
7347
  else {
7346
- V(null);
7347
- let e = F.current;
7348
+ W(null);
7349
+ let e = R.current;
7348
7350
  e && (e.getCanvas().style.cursor = "");
7349
7351
  }
7350
7352
  return;
7351
7353
  }
7352
7354
  if (t === "polygon") {
7353
- let e = ft.current;
7355
+ let e = dt.current;
7354
7356
  if (e.length >= 3) {
7355
- let t = G.current, n = applyEntityConfig({
7357
+ let t = q.current, n = applyEntityConfig({
7356
7358
  ...t,
7357
- id: t?.id ?? Mt(),
7359
+ id: t?.id ?? Nt(),
7358
7360
  type: "polygon",
7359
7361
  coordinates: [...e]
7360
- }, E);
7361
- Kt();
7362
- let r = F.current;
7363
- if (r && !I.current.has(n.id)) {
7364
- let e = new PolygonRenderer(r, n, D, O, k, j);
7365
- I.current.set(n.id, e);
7362
+ }, D);
7363
+ qt();
7364
+ let r = R.current;
7365
+ if (r && !z.current.has(n.id)) {
7366
+ let e = new PolygonRenderer(r, n, O, k, M, P);
7367
+ z.current.set(n.id, e);
7366
7368
  }
7367
- Q.current.onPolygonAdd?.(n), ft.current = [], G.current = null, H.current && (H.current = !1, V(null), r && (r.getCanvas().style.cursor = ""));
7368
- } else if (e.length > 0) ft.current = [], Kt();
7369
+ Q.current.onPolygonAdd?.(n), dt.current = [], q.current = null, G.current && (G.current = !1, W(null), r && (r.getCanvas().style.cursor = ""));
7370
+ } else if (e.length > 0) dt.current = [], qt();
7369
7371
  else {
7370
- V(null);
7371
- let e = F.current;
7372
+ W(null);
7373
+ let e = R.current;
7372
7374
  e && (e.getCanvas().style.cursor = "");
7373
7375
  }
7374
7376
  return;
7375
7377
  }
7376
7378
  if (t === "square") {
7377
- if (pt.current) pt.current = null, Zt();
7379
+ if (pt.current) pt.current = null, Qt();
7378
7380
  else {
7379
- V(null);
7380
- let e = F.current;
7381
+ W(null);
7382
+ let e = R.current;
7381
7383
  e && (e.getCanvas().style.cursor = "");
7382
7384
  }
7383
7385
  return;
7384
7386
  }
7385
7387
  if (t === "polyline") {
7386
- let e = mt.current;
7388
+ let e = ht.current;
7387
7389
  if (e.length >= 2) {
7388
- let t = q.current, n = applyEntityConfig({
7390
+ let t = mt.current, n = applyEntityConfig({
7389
7391
  ...t,
7390
- id: t?.id ?? Mt(),
7392
+ id: t?.id ?? Nt(),
7391
7393
  type: "polyline",
7392
7394
  coordinates: [...e]
7393
- }, E);
7394
- tn();
7395
- let r = F.current;
7396
- if (r && !I.current.has(n.id)) {
7397
- let e = new PolylineRenderer(r, n, D, O, j);
7398
- I.current.set(n.id, e);
7395
+ }, D);
7396
+ nn();
7397
+ let r = R.current;
7398
+ if (r && !z.current.has(n.id)) {
7399
+ let e = new PolylineRenderer(r, n, O, k, P);
7400
+ z.current.set(n.id, e);
7399
7401
  }
7400
- Q.current.onPolylineAdd?.(n), mt.current = [], q.current = null, H.current && (H.current = !1, V(null), r && (r.getCanvas().style.cursor = ""));
7401
- } else if (e.length > 0) mt.current = [], tn();
7402
+ Q.current.onPolylineAdd?.(n), ht.current = [], mt.current = null, G.current && (G.current = !1, W(null), r && (r.getCanvas().style.cursor = ""));
7403
+ } else if (e.length > 0) ht.current = [], nn();
7402
7404
  else {
7403
- V(null);
7404
- let e = F.current;
7405
+ W(null);
7406
+ let e = R.current;
7405
7407
  e && (e.getCanvas().style.cursor = "");
7406
7408
  }
7407
7409
  return;
@@ -7409,45 +7411,45 @@ const Mapbox = forwardRef((e, c) => {
7409
7411
  let n = [e.lngLat.lng, e.lngLat.lat], r = {
7410
7412
  x: e.point.x,
7411
7413
  y: e.point.y
7412
- }, i = En.current, a = bn(e.originalEvent.target);
7414
+ }, i = Dn.current, a = xn(e.originalEvent.target);
7413
7415
  if (a) {
7414
7416
  let e = i.find((e) => String(e.id) === a);
7415
7417
  if (e) {
7416
- wn(e, r, n);
7418
+ Tn(e, r, n);
7417
7419
  return;
7418
7420
  }
7419
7421
  }
7420
- for (let [t, a] of I.current) {
7422
+ for (let [t, a] of z.current) {
7421
7423
  let o = a.getLabelLayerId();
7422
- if (o && F.current?.getLayer(o) && F.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
7424
+ if (o && R.current?.getLayer(o) && R.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
7423
7425
  let e = i.find((e) => e.id === t);
7424
7426
  if (e) {
7425
- wn(e, r, n);
7427
+ Tn(e, r, n);
7426
7428
  return;
7427
7429
  }
7428
7430
  }
7429
7431
  }
7430
- for (let [e, t] of I.current) if (t.isPointInEntity(n)) {
7432
+ for (let [e, t] of z.current) if (t.isPointInEntity(n)) {
7431
7433
  let t = i.find((t) => t.id === e);
7432
7434
  if (t) {
7433
- wn(t, r, n);
7435
+ Tn(t, r, n);
7434
7436
  return;
7435
7437
  }
7436
7438
  }
7437
7439
  }, [
7438
- bn,
7440
+ xn,
7439
7441
  Y,
7440
- Lt,
7441
- Ht,
7442
- Kt,
7443
- Zt,
7444
- tn
7445
- ]), wn = useCallback((e, t, n) => {
7446
- let r = Ue.current?.getBoundingClientRect(), i = r ? {
7442
+ Rt,
7443
+ Ut,
7444
+ qt,
7445
+ Qt,
7446
+ nn
7447
+ ]), Tn = useCallback((e, t, n) => {
7448
+ let r = Be.current?.getBoundingClientRect(), i = r ? {
7447
7449
  x: t.x + r.left,
7448
7450
  y: t.y + r.top
7449
7451
  } : t;
7450
- Ze({
7452
+ Ye({
7451
7453
  position: i,
7452
7454
  lngLat: n,
7453
7455
  items: [{
@@ -7467,8 +7469,8 @@ const Mapbox = forwardRef((e, c) => {
7467
7469
  }
7468
7470
  }]
7469
7471
  });
7470
- }, []), Tn = useCallback(() => {
7471
- Ze(null);
7472
+ }, []), En = useCallback(() => {
7473
+ Ye(null);
7472
7474
  }, []);
7473
7475
  useEffect(() => {
7474
7476
  let e = document.createElement("div");
@@ -7479,11 +7481,11 @@ const Mapbox = forwardRef((e, c) => {
7479
7481
  width: 100%;
7480
7482
  pointer-events: none;
7481
7483
  height: 100%;
7482
- z-index: ${P?.zIndex ?? 1e3};
7483
- `, document.body.appendChild(e), qe.current = e, () => {
7484
+ z-index: ${L?.zIndex ?? 1e3};
7485
+ `, document.body.appendChild(e), Ge.current = e, () => {
7484
7486
  document.body.contains(e) && document.body.removeChild(e);
7485
7487
  };
7486
- }, [P?.zIndex]), useEffect(() => {
7488
+ }, [L?.zIndex]), useEffect(() => {
7487
7489
  let e = document.createElement("div");
7488
7490
  return e.id = `mapbox-context-menu-container-${Date.now()}`, e.style.cssText = `
7489
7491
  position: fixed;
@@ -7492,65 +7494,65 @@ const Mapbox = forwardRef((e, c) => {
7492
7494
  width: 100%;
7493
7495
  pointer-events: none;
7494
7496
  height: 100%;
7495
- z-index: ${(P?.zIndex ?? 1e3) + 100};
7496
- `, document.body.appendChild(e), Qe.current = e, () => {
7497
+ z-index: ${(L?.zIndex ?? 1e3) + 100};
7498
+ `, document.body.appendChild(e), Xe.current = e, () => {
7497
7499
  document.body.contains(e) && document.body.removeChild(e);
7498
7500
  };
7499
- }, [P?.zIndex]);
7500
- let En = useRef(w);
7501
- En.current = w;
7502
- let Dn = useRef(Re);
7503
- Dn.current = Re;
7504
- let On = useRef(wt);
7505
- On.current = wt;
7506
- let kn = useRef(tt);
7507
- kn.current = tt;
7508
- let An = useRef(y);
7509
- An.current = y;
7510
- let jn = useRef(ot);
7511
- jn.current = ot;
7512
- let Mn = useRef(st);
7513
- Mn.current = st;
7514
- let Nn = useRef(ct);
7515
- Nn.current = ct;
7516
- let Q = useRef(_);
7517
- Q.current = _;
7518
- let Pn = useRef(E);
7519
- Pn.current = E, useEffect(() => {
7501
+ }, [L?.zIndex]);
7502
+ let Dn = useRef(T);
7503
+ Dn.current = T;
7504
+ let On = useRef(Fe);
7505
+ On.current = Fe;
7506
+ let kn = useRef(Tt);
7507
+ kn.current = Tt;
7508
+ let An = useRef($e);
7509
+ An.current = $e;
7510
+ let jn = useRef(b);
7511
+ jn.current = b;
7512
+ let Mn = useRef(it);
7513
+ Mn.current = it;
7514
+ let Nn = useRef(at);
7515
+ Nn.current = at;
7516
+ let Pn = useRef(ot);
7517
+ Pn.current = ot;
7518
+ let Q = useRef(v);
7519
+ Q.current = v;
7520
+ let Fn = useRef(D);
7521
+ Fn.current = D, useEffect(() => {
7520
7522
  let e = (e) => {
7521
7523
  if (e.key === "Escape" && J.current) {
7522
- I.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7524
+ z.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7523
7525
  return;
7524
7526
  }
7525
- if (e.key === "Escape" && tt === "edit") {
7526
- if (ot && (B(null), V(null), Y()), st === "rectangle") if (ct) lt(null), Lt();
7527
+ if (e.key === "Escape" && $e === "edit") {
7528
+ if (it && (U(null), W(null), Y()), at === "rectangle") if (ot) st(null), Rt();
7527
7529
  else {
7528
- V(null);
7529
- let e = F.current;
7530
+ W(null);
7531
+ let e = R.current;
7530
7532
  e && (e.getCanvas().style.cursor = "");
7531
7533
  }
7532
- if (st === "circle") if (dt.current) dt.current = null, Ht();
7534
+ if (at === "circle") if (ut.current) ut.current = null, Ut();
7533
7535
  else {
7534
- V(null);
7535
- let e = F.current;
7536
+ W(null);
7537
+ let e = R.current;
7536
7538
  e && (e.getCanvas().style.cursor = "");
7537
7539
  }
7538
- if (st === "polygon") if (ft.current.length > 0) ft.current = [], Kt();
7540
+ if (at === "polygon") if (dt.current.length > 0) dt.current = [], qt();
7539
7541
  else {
7540
- V(null);
7541
- let e = F.current;
7542
+ W(null);
7543
+ let e = R.current;
7542
7544
  e && (e.getCanvas().style.cursor = "");
7543
7545
  }
7544
- if (st === "square") if (pt.current) pt.current = null, Zt();
7546
+ if (at === "square") if (pt.current) pt.current = null, Qt();
7545
7547
  else {
7546
- V(null);
7547
- let e = F.current;
7548
+ W(null);
7549
+ let e = R.current;
7548
7550
  e && (e.getCanvas().style.cursor = "");
7549
7551
  }
7550
- if (st === "polyline") if (mt.current.length > 0) mt.current = [], tn();
7552
+ if (at === "polyline") if (ht.current.length > 0) ht.current = [], nn();
7551
7553
  else {
7552
- V(null);
7553
- let e = F.current;
7554
+ W(null);
7555
+ let e = R.current;
7554
7556
  e && (e.getCanvas().style.cursor = "");
7555
7557
  }
7556
7558
  }
@@ -7559,62 +7561,62 @@ const Mapbox = forwardRef((e, c) => {
7559
7561
  document.removeEventListener("keydown", e);
7560
7562
  };
7561
7563
  }, [
7562
- tt,
7564
+ $e,
7565
+ it,
7566
+ at,
7563
7567
  ot,
7564
- st,
7565
- ct,
7566
7568
  Y,
7567
- Lt,
7568
- Ht,
7569
- Kt,
7570
- Zt,
7571
- tn
7569
+ Rt,
7570
+ Ut,
7571
+ qt,
7572
+ Qt,
7573
+ nn
7572
7574
  ]), useEffect(() => {
7573
- let e = F.current;
7574
- if (!e || !R) return;
7575
- let t = R.entityId, n = R.config, r = () => {
7576
- let r = En.current.find((e) => e.id === t);
7575
+ let e = R.current;
7576
+ if (!e || !V) return;
7577
+ let t = V.entityId, n = V.config, r = () => {
7578
+ let r = Dn.current.find((e) => e.id === t);
7577
7579
  if (!r) {
7578
- Et();
7580
+ Dt();
7579
7581
  return;
7580
7582
  }
7581
- let { position: i } = calculatePopupPosition(r, n, e, void 0, Je.current);
7582
- Je.current && (Je.current.style.left = `${i.x}px`, Je.current.style.top = `${i.y}px`);
7583
+ let { position: i } = calculatePopupPosition(r, n, e, void 0, Ke.current);
7584
+ Ke.current && (Ke.current.style.left = `${i.x}px`, Ke.current.style.top = `${i.y}px`);
7583
7585
  }, i = setTimeout(() => {
7584
7586
  r();
7585
7587
  }, 50);
7586
7588
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
7587
7589
  clearTimeout(i), e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
7588
7590
  };
7589
- }, [R?.entityId, Et]), useEffect(() => {
7590
- let e = F.current, t = Ue.current;
7591
- if (!e || !Xe || !t) return;
7592
- let n = Xe.lngLat, r = () => {
7591
+ }, [V?.entityId, Dt]), useEffect(() => {
7592
+ let e = R.current, t = Be.current;
7593
+ if (!e || !Je || !t) return;
7594
+ let n = Je.lngLat, r = () => {
7593
7595
  let r = e.project(n), i = t.clientWidth, a = t.clientHeight;
7594
7596
  if (r.x < 0 || r.x > i || r.y < 0 || r.y > a) {
7595
- Tn();
7597
+ En();
7596
7598
  return;
7597
7599
  }
7598
7600
  let o = t.getBoundingClientRect(), s = r.x + o.left, c = r.y + o.top;
7599
- $e.current && ($e.current.style.left = `${s}px`, $e.current.style.top = `${c}px`);
7601
+ Ze.current && (Ze.current.style.left = `${s}px`, Ze.current.style.top = `${c}px`);
7600
7602
  };
7601
7603
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
7602
7604
  e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
7603
7605
  };
7604
- }, [Xe?.lngLat, Tn]), useEffect(() => {
7605
- if (!Ue.current) return;
7606
+ }, [Je?.lngLat, En]), useEffect(() => {
7607
+ if (!Be.current) return;
7606
7608
  let e = {
7607
7609
  version: 8,
7608
7610
  sources: {},
7609
7611
  layers: []
7610
- }, { dragPan: t = !0, scrollZoom: n = !0, doubleClickZoom: r = !0, touchZoomRotate: i = !0, keyboard: a = !0, dragRotate: o = !0, pitchWithRotate: c = !0, touchPitch: m = !0, boxZoom: ve = !0 } = b, g = new mapboxgl.Map({
7611
- container: Ue.current,
7612
+ }, { dragPan: t = !0, scrollZoom: n = !0, doubleClickZoom: r = !0, touchZoomRotate: i = !0, keyboard: a = !0, dragRotate: o = !0, pitchWithRotate: c = !0, touchPitch: m = !0, boxZoom: h = !0 } = x, _ = new mapboxgl.Map({
7613
+ container: Be.current,
7612
7614
  style: p || e,
7613
7615
  center: l,
7614
7616
  zoom: u,
7615
7617
  pitch: d,
7616
7618
  bearing: f,
7617
- maxBounds: h,
7619
+ maxBounds: g,
7618
7620
  dragPan: t,
7619
7621
  scrollZoom: n,
7620
7622
  doubleClickZoom: r,
@@ -7623,7 +7625,7 @@ const Mapbox = forwardRef((e, c) => {
7623
7625
  dragRotate: o,
7624
7626
  pitchWithRotate: c,
7625
7627
  touchPitch: m,
7626
- boxZoom: ve,
7628
+ boxZoom: h,
7627
7629
  transformRequest: (e, t) => {
7628
7630
  if (t === "Glyphs") {
7629
7631
  let t = e.match(/\/fonts\/([^/]+)\/(\d+-\d+)\.pbf/);
@@ -7635,98 +7637,98 @@ const Mapbox = forwardRef((e, c) => {
7635
7637
  return { url: e };
7636
7638
  }
7637
7639
  });
7638
- return F.current = g, g.on("load", () => {
7639
- if (!g.getStyle().glyphs) {
7640
- let e = g.style, t = "/gis-fonts/{fontstack}/{range}.pbf";
7640
+ return R.current = _, _.on("load", () => {
7641
+ if (!_.getStyle().glyphs) {
7642
+ let e = _.style, t = "/gis-fonts/{fontstack}/{range}.pbf";
7641
7643
  e.glyphs = t, e.stylesheet && (e.stylesheet.glyphs = t);
7642
7644
  }
7643
- L.current.clear(), w.forEach((e) => {
7644
- L.current.set(e.id, e);
7645
- }), yn(x), dn(), Ft(), Rt(), Wt(), Jt(), $t(), et(g), Le?.(g);
7646
- }), g.on("click", xn), g.on("mousemove", Sn), g.on("contextmenu", Cn), () => {
7647
- g.off("click", xn), g.off("mousemove", Sn), g.off("contextmenu", Cn), fn(), jt(), Y(), X(), Z(), g.remove(), F.current = null;
7645
+ B.current.clear(), T.forEach((e) => {
7646
+ B.current.set(e.id, e);
7647
+ }), bn(S), fn(), It(), zt(), Gt(), Yt(), en(), Qe(_), Pe?.(_);
7648
+ }), _.on("click", Sn), _.on("mousemove", Cn), _.on("contextmenu", wn), () => {
7649
+ _.off("click", Sn), _.off("mousemove", Cn), _.off("contextmenu", wn), pn(), Mt(), Y(), X(), Z(), _.remove(), R.current = null;
7648
7650
  };
7649
7651
  }, []), useEffect(() => {
7650
- if (F.current) {
7651
- if (!F.current.isStyleLoaded()) {
7652
- F.current.once("load", () => {
7653
- L.current.clear(), w.forEach((e) => {
7654
- L.current.set(e.id, e);
7655
- }), dn();
7652
+ if (R.current) {
7653
+ if (!R.current.isStyleLoaded()) {
7654
+ R.current.once("load", () => {
7655
+ B.current.clear(), T.forEach((e) => {
7656
+ B.current.set(e.id, e);
7657
+ }), fn();
7656
7658
  });
7657
7659
  return;
7658
7660
  }
7659
- L.current.clear(), w.forEach((e) => {
7660
- L.current.set(e.id, e);
7661
- }), dn();
7661
+ B.current.clear(), T.forEach((e) => {
7662
+ B.current.set(e.id, e);
7663
+ }), fn();
7662
7664
  }
7663
- }, [w, dn]), useEffect(() => {
7664
- !F.current || !F.current.isStyleLoaded() || (fn(), dn());
7665
+ }, [T, fn]), useEffect(() => {
7666
+ !R.current || !R.current.isStyleLoaded() || (pn(), fn());
7665
7667
  }, [
7666
- D,
7667
7668
  O,
7668
7669
  k,
7669
- A,
7670
- j,
7671
- fn,
7672
- dn
7670
+ M,
7671
+ N,
7672
+ P,
7673
+ pn,
7674
+ fn
7673
7675
  ]), useEffect(() => {
7674
- if (F.current) {
7675
- if (!F.current.isStyleLoaded()) {
7676
- F.current.once("load", () => {
7677
- yn(x);
7676
+ if (R.current) {
7677
+ if (!R.current.isStyleLoaded()) {
7678
+ R.current.once("load", () => {
7679
+ bn(S);
7678
7680
  });
7679
7681
  return;
7680
7682
  }
7681
- yn(x);
7682
- }
7683
- }, [x, yn]);
7684
- let Fn = useRef(void 0), In = useRef(!0), Ln = useRef(x);
7685
- Ln.current = x;
7686
- let Rn = useRef(yn);
7687
- Rn.current = yn;
7688
- let zn = useRef(fn);
7689
- zn.current = fn;
7690
- let Bn = useRef(dn);
7691
- Bn.current = dn;
7692
- let Vn = useRef(Ft);
7693
- Vn.current = Ft;
7694
- let Hn = useRef(Rt);
7695
- Hn.current = Rt;
7696
- let Un = useRef(Wt);
7697
- Un.current = Wt;
7698
- let Wn = useRef(Jt);
7699
- Wn.current = Jt;
7700
- let Gn = useRef($t);
7701
- Gn.current = $t, useEffect(() => {
7702
- let e = F.current;
7683
+ bn(S);
7684
+ }
7685
+ }, [S, bn]);
7686
+ let In = useRef(void 0), Ln = useRef(!0), Rn = useRef(S);
7687
+ Rn.current = S;
7688
+ let zn = useRef(bn);
7689
+ zn.current = bn;
7690
+ let Bn = useRef(pn);
7691
+ Bn.current = pn;
7692
+ let Vn = useRef(fn);
7693
+ Vn.current = fn;
7694
+ let Hn = useRef(It);
7695
+ Hn.current = It;
7696
+ let Un = useRef(zt);
7697
+ Un.current = zt;
7698
+ let Wn = useRef(Gt);
7699
+ Wn.current = Gt;
7700
+ let Gn = useRef(Yt);
7701
+ Gn.current = Yt;
7702
+ let Kn = useRef(en);
7703
+ Kn.current = en, useEffect(() => {
7704
+ let e = R.current;
7703
7705
  if (!e) return;
7704
7706
  let t = p || {
7705
7707
  version: 8,
7706
7708
  sources: {},
7707
7709
  layers: []
7708
7710
  };
7709
- if (In.current) {
7710
- In.current = !1, Fn.current = p;
7711
+ if (Ln.current) {
7712
+ Ln.current = !1, In.current = p;
7711
7713
  return;
7712
7714
  }
7713
- Fn.current !== p && (Fn.current = p, e.setStyle(t), e.once("style.load", () => {
7715
+ In.current !== p && (In.current = p, e.setStyle(t), e.once("style.load", () => {
7714
7716
  if (!e.getStyle().glyphs) {
7715
7717
  let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
7716
7718
  t.glyphs = n, t.stylesheet && (t.stylesheet.glyphs = n);
7717
7719
  }
7718
- Ge.current.clear(), Rn.current(Ln.current), zn.current(), Bn.current(), Vn.current(), Hn.current(), Un.current(), Wn.current(), Gn.current();
7720
+ Ue.current.clear(), zn.current(Rn.current), Bn.current(), Vn.current(), Hn.current(), Un.current(), Wn.current(), Gn.current(), Kn.current();
7719
7721
  }));
7720
7722
  }, [p]), useEffect(() => {
7721
- let e = new Set(T.map(String));
7722
- for (let [t, n] of I.current) n.setSelected(e.has(String(t)));
7723
- }, [T]);
7724
- let Kn = useRef({});
7723
+ let e = new Set(E.map(String));
7724
+ for (let [t, n] of z.current) n.setSelected(e.has(String(t)));
7725
+ }, [E]);
7726
+ let qn = useRef({});
7725
7727
  useEffect(() => {
7726
- let e = F.current;
7728
+ let e = R.current;
7727
7729
  if (!e) return;
7728
- 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;
7729
- !n && !r && !i && !a || (Kn.current = {
7730
+ let t = qn.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;
7731
+ !n && !r && !i && !a || (qn.current = {
7730
7732
  center: l,
7731
7733
  zoom: u,
7732
7734
  pitch: d,
@@ -7743,13 +7745,13 @@ const Mapbox = forwardRef((e, c) => {
7743
7745
  d,
7744
7746
  f
7745
7747
  ]);
7746
- 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)(), $ = (() => {
7747
- if (De === !1) return null;
7748
+ let Jn = (() => Se === !1 ? null : Se === !0 ? { enabled: !0 } : Se)(), Yn = (() => F === !1 ? null : F === !0 ? { enabled: !0 } : F)(), Xn = (() => Ce === !1 ? null : Ce === !0 ? { enabled: !0 } : Ce)(), $ = (() => {
7749
+ if (we === !1) return null;
7748
7750
  let e, t, n;
7749
- if (x && x.length > 0) {
7750
- let r = x.find((e) => e.hasRoadNetwork === !0) || x[0];
7751
+ if (S && S.length > 0) {
7752
+ let r = S.find((e) => e.hasRoadNetwork === !0) || S[0];
7751
7753
  if (r.type === "style") {
7752
- let t = F.current?.getStyle();
7754
+ let t = R.current?.getStyle();
7753
7755
  if (t?.sources) {
7754
7756
  let n = `base-layer-source-${r.id}-`, i = Object.keys(t.sources).find((e) => e.startsWith(n));
7755
7757
  i && (e = i);
@@ -7757,143 +7759,145 @@ const Mapbox = forwardRef((e, c) => {
7757
7759
  } else e = `base-layer-source-${r.id}`;
7758
7760
  t = r.roadNetworkSourceLayer || "road", n = r.roadNetworkClassField;
7759
7761
  }
7760
- return De === !0 ? {
7762
+ return we === !0 ? {
7761
7763
  enabled: !0,
7762
7764
  source: e,
7763
7765
  sourceLayer: t,
7764
7766
  classField: n
7765
7767
  } : {
7766
- ...De,
7767
- source: De.source || e,
7768
- sourceLayer: De.sourceLayer || t,
7769
- classField: De.classField || n
7768
+ ...we,
7769
+ source: we.source || e,
7770
+ sourceLayer: we.sourceLayer || t,
7771
+ classField: we.classField || n
7770
7772
  };
7771
- })(), Xn = (() => N ? N === !0 ? { enabled: !0 } : N : null)(), Zn = (() => ke ? ke === !0 ? { enabled: !0 } : ke : null)(), Qn = (() => Ne || null)(), $n = useMemo(() => {
7773
+ })(), Zn = (() => I ? I === !0 ? { enabled: !0 } : I : null)(), Qn = (() => Ee ? Ee === !0 ? { enabled: !0 } : Ee : null)(), $n = (() => Ae || null)(), er = useMemo(() => {
7772
7774
  let e = [];
7773
- for (let t of x) if (t.applyRasterPaint) if (t.type === "style") {
7774
- let n = F.current;
7775
+ for (let t of S) if (t.applyRasterPaint) if (t.type === "style") {
7776
+ let n = R.current;
7775
7777
  if (n) {
7776
7778
  let r = `base-layer-${t.id}-`, i = n.getStyle();
7777
7779
  if (i?.layers) for (let t of i.layers) t.id.startsWith(r) && t.type === "raster" && e.push(t.id);
7778
7780
  }
7779
7781
  } else e.push(`base-layer-${t.id}`);
7780
7782
  return e;
7781
- }, [x, z]);
7783
+ }, [S, H]);
7782
7784
  return /* @__PURE__ */ jsxs("div", {
7783
- className: `comp-mapbox ${tt === "picker" ? "comp-mapbox--picker-mode" : ""} ${Ve}`,
7784
- style: He,
7785
+ className: `comp-mapbox ${$e === "picker" ? "comp-mapbox--picker-mode" : ""} ${Re}`,
7786
+ style: ze,
7785
7787
  children: [
7786
7788
  /* @__PURE__ */ jsx("div", {
7787
- ref: Ue,
7789
+ ref: Be,
7788
7790
  className: "comp-mapbox__map"
7789
7791
  }),
7790
- tt === "picker" && v.showCrosshair === !0 && /* @__PURE__ */ jsxs("div", {
7792
+ $e === "picker" && y.showCrosshair === !0 && /* @__PURE__ */ jsxs("div", {
7791
7793
  className: "comp-mapbox__crosshair",
7792
7794
  children: [/* @__PURE__ */ jsx("div", {
7793
7795
  className: "comp-mapbox__crosshair-h",
7794
- style: v.crosshairColor ? { backgroundColor: v.crosshairColor } : void 0
7796
+ style: y.crosshairColor ? { backgroundColor: y.crosshairColor } : void 0
7795
7797
  }), /* @__PURE__ */ jsx("div", {
7796
7798
  className: "comp-mapbox__crosshair-v",
7797
- style: v.crosshairColor ? { backgroundColor: v.crosshairColor } : void 0
7799
+ style: y.crosshairColor ? { backgroundColor: y.crosshairColor } : void 0
7798
7800
  })]
7799
7801
  }),
7800
- tt === "edit" && _.showEditTools !== !1 && (_.markerTemplates && _.markerTemplates.length > 0 || _.showRectangleTool || _.showCircleTool || _.showPolygonTool || _.showSquareTool || _.showPolylineTool) || $ && $.enabled !== !1 || Qn && Qn.enabled !== !1 ? /* @__PURE__ */ jsxs("div", {
7802
+ $e === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) || $ && $.enabled !== !1 || $n && $n.enabled !== !1 ? /* @__PURE__ */ jsxs("div", {
7801
7803
  className: "comp-mapbox__edit-controls",
7802
7804
  children: [
7803
- tt === "edit" && _.showEditTools !== !1 && (_.markerTemplates && _.markerTemplates.length > 0 || _.showRectangleTool || _.showCircleTool || _.showPolygonTool || _.showSquareTool || _.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
7804
- markerTemplates: _.markerTemplates || [],
7805
- selectedTemplate: ot,
7806
- onTemplateSelect: nn,
7807
- drawMode: st,
7808
- onDrawModeChange: rn,
7809
- showRectangleTool: _.showRectangleTool,
7810
- showCircleTool: _.showCircleTool,
7811
- showPolygonTool: _.showPolygonTool,
7812
- showSquareTool: _.showSquareTool,
7813
- showPolylineTool: _.showPolylineTool
7805
+ $e === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
7806
+ markerTemplates: v.markerTemplates || [],
7807
+ selectedTemplate: it,
7808
+ onTemplateSelect: rn,
7809
+ drawMode: at,
7810
+ onDrawModeChange: an,
7811
+ showRectangleTool: v.showRectangleTool,
7812
+ showCircleTool: v.showCircleTool,
7813
+ showPolygonTool: v.showPolygonTool,
7814
+ showSquareTool: v.showSquareTool,
7815
+ showPolylineTool: v.showPolylineTool
7814
7816
  }),
7815
- $ && $.enabled !== !1 && /* @__PURE__ */ jsx(RoadHighlightControl, {
7816
- map: z,
7817
- highlightWidth: $.highlightWidth,
7818
- defaultRoadTypes: $.defaultRoadTypes,
7819
- defaultMinWidth: $.defaultMinWidth,
7820
- source: $.source,
7821
- sourceLayer: $.sourceLayer,
7822
- classField: $.classField,
7823
- className: $.className,
7824
- style: $.style
7817
+ /* @__PURE__ */ jsx(RoadHighlightControl, {
7818
+ ref: He,
7819
+ map: H,
7820
+ showButton: !!($ && $.enabled !== !1),
7821
+ highlightWidth: $?.highlightWidth,
7822
+ defaultRoadTypes: $?.defaultRoadTypes,
7823
+ defaultMinWidth: $?.defaultMinWidth,
7824
+ source: $?.source,
7825
+ sourceLayer: $?.sourceLayer,
7826
+ classField: $?.classField,
7827
+ className: $?.className,
7828
+ style: $?.style
7825
7829
  }),
7826
- Qn && Qn.enabled !== !1 && /* @__PURE__ */ jsx(RoutePlanningControl, {
7827
- ref: We,
7828
- map: z,
7829
- pointCount: Qn.pointCount,
7830
- showPointCountInput: Qn.showPointCountInput,
7831
- visualType: Qn.visualType,
7832
- onSelectFinished: Qn.onSelectFinished
7830
+ $n && $n.enabled !== !1 && /* @__PURE__ */ jsx(RoutePlanningControl, {
7831
+ ref: Ve,
7832
+ map: H,
7833
+ pointCount: $n.pointCount,
7834
+ showPointCountInput: $n.showPointCountInput,
7835
+ visualType: $n.visualType,
7836
+ onSelectFinished: $n.onSelectFinished
7833
7837
  })
7834
7838
  ]
7835
7839
  }) : null,
7836
- (qn?.enabled !== !1 || Jn?.enabled !== !1 || Yn?.enabled !== !1 || Xn && Xn.enabled !== !1 || Zn && Zn.enabled !== !1) && /* @__PURE__ */ jsxs("div", {
7840
+ (Jn?.enabled !== !1 || Yn?.enabled !== !1 || Xn?.enabled !== !1 || Zn && Zn.enabled !== !1 || Qn && Qn.enabled !== !1) && /* @__PURE__ */ jsxs("div", {
7837
7841
  className: "comp-mapbox__controls",
7838
7842
  children: [
7839
- qn && qn.enabled !== !1 && /* @__PURE__ */ jsx(CoordinateDisplay, {
7840
- map: z,
7841
- precision: qn.precision,
7842
- className: qn.className,
7843
- style: qn.style
7844
- }),
7845
- Jn && Jn.enabled !== !1 && /* @__PURE__ */ jsx(ScaleControl, {
7846
- map: z,
7847
- maxWidth: Jn.maxWidth,
7848
- unit: Jn.unit,
7843
+ Jn && Jn.enabled !== !1 && /* @__PURE__ */ jsx(CoordinateDisplay, {
7844
+ map: H,
7845
+ precision: Jn.precision,
7849
7846
  className: Jn.className,
7850
7847
  style: Jn.style
7851
7848
  }),
7852
- Xn && Xn.enabled !== !1 && /* @__PURE__ */ jsx(MeasureControl, {
7853
- map: z,
7854
- entityConfig: E,
7849
+ Yn && Yn.enabled !== !1 && /* @__PURE__ */ jsx(ScaleControl, {
7850
+ map: H,
7851
+ maxWidth: Yn.maxWidth,
7852
+ unit: Yn.unit,
7853
+ className: Yn.className,
7854
+ style: Yn.style
7855
+ }),
7856
+ Zn && Zn.enabled !== !1 && /* @__PURE__ */ jsx(MeasureControl, {
7857
+ map: H,
7858
+ entityConfig: D,
7855
7859
  onDrawModeChange: (e) => {
7856
- gt.current = e;
7860
+ _t.current = e;
7857
7861
  },
7858
- className: Xn.className,
7859
- style: Xn.style
7860
- }),
7861
- Zn && Zn.enabled !== !1 && /* @__PURE__ */ jsx(RasterPaintControl, {
7862
- map: z,
7863
- value: S,
7864
- onChange: Pe,
7865
- rasterPaintLayerIds: $n,
7866
7862
  className: Zn.className,
7867
7863
  style: Zn.style
7868
7864
  }),
7869
- Yn && Yn.enabled !== !1 && /* @__PURE__ */ jsx(ResetViewControl, {
7870
- map: z,
7865
+ Qn && Qn.enabled !== !1 && /* @__PURE__ */ jsx(RasterPaintControl, {
7866
+ map: H,
7867
+ value: C,
7868
+ onChange: je,
7869
+ rasterPaintLayerIds: er,
7870
+ className: Qn.className,
7871
+ style: Qn.style
7872
+ }),
7873
+ Xn && Xn.enabled !== !1 && /* @__PURE__ */ jsx(ResetViewControl, {
7874
+ map: H,
7871
7875
  initialCenter: l,
7872
7876
  initialZoom: u,
7873
7877
  initialPitch: d,
7874
7878
  initialBearing: f,
7875
- duration: Yn.duration,
7876
- className: Yn.className,
7877
- style: Yn.style
7879
+ duration: Xn.duration,
7880
+ className: Xn.className,
7881
+ style: Xn.style
7878
7882
  })
7879
7883
  ]
7880
7884
  }),
7881
- !(Qn && Qn.enabled !== !1) && /* @__PURE__ */ jsx(RoutePlanningControl, {
7882
- ref: We,
7883
- map: z,
7885
+ !($n && $n.enabled !== !1) && /* @__PURE__ */ jsx(RoutePlanningControl, {
7886
+ ref: Ve,
7887
+ map: H,
7884
7888
  showButton: !1
7885
7889
  }),
7886
- R && qe.current && /* @__PURE__ */ jsx(EntityPopup, {
7887
- popupState: R,
7888
- onClose: () => Tt(R.entityId),
7889
- portalContainer: qe.current,
7890
- popupRef: Je
7890
+ V && Ge.current && /* @__PURE__ */ jsx(EntityPopup, {
7891
+ popupState: V,
7892
+ onClose: () => Et(V.entityId),
7893
+ portalContainer: Ge.current,
7894
+ popupRef: Ke
7891
7895
  }),
7892
- Xe && Qe.current && /* @__PURE__ */ jsx(ContextMenu, {
7893
- menuState: Xe,
7894
- onClose: Tn,
7895
- portalContainer: Qe.current,
7896
- menuRef: $e
7896
+ Je && Xe.current && /* @__PURE__ */ jsx(ContextMenu, {
7897
+ menuState: Je,
7898
+ onClose: En,
7899
+ portalContainer: Xe.current,
7900
+ menuRef: Ze
7897
7901
  })
7898
7902
  ]
7899
7903
  });