zhihao-ui 1.3.4-5.-alpha.1 → 1.3.4-5.-alpha.2

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.
@@ -10,8 +10,8 @@ const oo = { id: "scale-line-container" }, no = /* @__PURE__ */ Ue({
10
10
  a || (a = "metric");
11
11
  const o = new Yt({
12
12
  units: a
13
- }), f = document.getElementById("scale-line-container");
14
- f && (o.setTarget(f), s.addControl(o));
13
+ }), w = document.getElementById("scale-line-container");
14
+ w && (o.setTarget(w), s.addControl(o));
15
15
  }
16
16
  }), (s, a) => (Ie(), et("div", oo));
17
17
  }
@@ -28,13 +28,13 @@ const oo = { id: "scale-line-container" }, no = /* @__PURE__ */ Ue({
28
28
  console.log("props", l);
29
29
  const n = () => {
30
30
  console.log("props");
31
- const { setZoom: a, getZoom: o, getInstall: f } = l.mapInstance.methods;
32
- if (!f()) return;
31
+ const { setZoom: a, getZoom: o, getInstall: w } = l.mapInstance.methods;
32
+ if (!w()) return;
33
33
  const t = o();
34
34
  t && a(t + 1);
35
35
  }, s = () => {
36
- const { setZoom: a, getZoom: o, getInstall: f } = l.mapInstance.methods;
37
- if (!f()) return;
36
+ const { setZoom: a, getZoom: o, getInstall: w } = l.mapInstance.methods;
37
+ if (!w()) return;
38
38
  const t = o();
39
39
  t && a(t - 1);
40
40
  };
@@ -81,11 +81,11 @@ function ao() {
81
81
  }, o = (g, k) => {
82
82
  var $;
83
83
  ($ = n()) == null || $.setCenter(ie([g, k]));
84
- }, f = () => {
84
+ }, w = () => {
85
85
  var k;
86
86
  const g = (k = n()) == null ? void 0 : k.getCenter();
87
87
  return Xt(g);
88
- }, x = () => {
88
+ }, h = () => {
89
89
  var g;
90
90
  return (g = l()) == null ? void 0 : g.getSize();
91
91
  }, t = new it(), r = (g, k) => {
@@ -152,8 +152,8 @@ function ao() {
152
152
  getZoom: s,
153
153
  setZoom: a,
154
154
  setCenter: o,
155
- getCenter: f,
156
- getSize: x,
155
+ getCenter: w,
156
+ getSize: h,
157
157
  initMap: r,
158
158
  setBaseLayerMap: y
159
159
  };
@@ -268,8 +268,8 @@ const yo = (e) => {
268
268
  let s = null;
269
269
  const a = "--";
270
270
  let o = null;
271
- const f = document.createElement("div"), x = new pe({
272
- element: f,
271
+ const w = document.createElement("div"), h = new pe({
272
+ element: w,
273
273
  positioning: "top-left",
274
274
  className: "track-label-popup"
275
275
  });
@@ -277,8 +277,8 @@ const yo = (e) => {
277
277
  const b = 8, V = [], X = (c) => {
278
278
  var u;
279
279
  for (V.unshift(c); V.length > b; ) {
280
- const h = V.pop(), p = l.get(h);
281
- p && ((u = p.getSource()) == null || u.clear(), e == null || e.removeLayer(p), l.delete(h), delete n[h]);
280
+ const f = V.pop(), p = l.get(f);
281
+ p && ((u = p.getSource()) == null || u.clear(), e == null || e.removeLayer(p), l.delete(f), delete n[f]);
282
282
  }
283
283
  };
284
284
  let G = "";
@@ -289,25 +289,25 @@ const yo = (e) => {
289
289
  ce(s, c);
290
290
  }
291
291
  }, 100), N = () => s && n[s] && l.get(s).getVisible(), M = (c, u) => {
292
- let h = [];
292
+ let f = [];
293
293
  const p = Math.max(1, Math.floor(u.length / P));
294
- return h = u.filter((R, S) => S % p === 0).map((R, S) => {
294
+ return f = u.filter((R, S) => S % p === 0).map((R, S) => {
295
295
  if (Number(R.lon) > 180 || Number(R.lat) > 180) {
296
296
  const [A, Y] = nt(R.lon, R.lat);
297
297
  R.lon = A, R.lat = Y;
298
298
  }
299
299
  return R.center = [R.lon, R.lat], R.centerPoint = fo(R.center), R.time = ht(R.createdAt).format("YYYY-MM-DD HH:mm:ss"), R.id = c, R.index = S, R;
300
- }), h.filter(
300
+ }), f.filter(
301
301
  (R, S, A) => S === A.findIndex(
302
302
  (Y) => Math.abs(Y.lon - R.lon) < 1e-6 && Math.abs(Y.lat - R.lat) < 1e-6
303
303
  )
304
304
  );
305
- }, i = async (c, u, h, p = "ship", v = 200) => {
306
- if (!e || JSON.stringify(n[c]) === JSON.stringify(u) && s === c || (u = u == null ? void 0 : u.reverse(), x && p === "ship" && (e != null && e.getOverlays().getArray().includes(x) || e.addOverlay(x)), (u == null ? void 0 : u.length) < 2))
305
+ }, i = async (c, u, f, p = "ship", v = 200) => {
306
+ if (!e || JSON.stringify(n[c]) === JSON.stringify(u) && s === c || (u = u == null ? void 0 : u.reverse(), h && p === "ship" && (e != null && e.getOverlays().getArray().includes(h) || e.addOverlay(h)), (u == null ? void 0 : u.length) < 2))
307
307
  return;
308
308
  X(c), s = c, n[c] = u, P = v;
309
309
  const D = Object.keys(n).findIndex((R) => R === c) || 0;
310
- G = h || q[D > 10 ? 10 : D], await L(), await rt(s);
310
+ G = f || q[D > 10 ? 10 : D], await L(), await rt(s);
311
311
  }, T = (c) => {
312
312
  const u = new ue();
313
313
  return new he({
@@ -319,10 +319,10 @@ const yo = (e) => {
319
319
  properties: { layerType: ee.TRACK },
320
320
  zIndex: 10
321
321
  });
322
- }, w = (c) => {
323
- l.forEach((u, h) => {
322
+ }, x = (c) => {
323
+ l.forEach((u, f) => {
324
324
  var v;
325
- const p = h === c;
325
+ const p = f === c;
326
326
  u.getVisible() !== p && (u.setVisible(p), e.getLayers().getArray().includes(u) || e.addLayer(u), p || (v = u.getSource()) == null || v.clear());
327
327
  }), s = c;
328
328
  }, L = async () => {
@@ -331,20 +331,20 @@ const yo = (e) => {
331
331
  const D = T(c);
332
332
  l.set(c, D);
333
333
  }
334
- await w(c);
335
- const u = G || "", h = n[c] || [];
336
- if (!(h && h.length > 1)) return [];
334
+ await x(c);
335
+ const u = G || "", f = n[c] || [];
336
+ if (!(f && f.length > 1)) return [];
337
337
  let p = [];
338
- p = M(c, h);
338
+ p = M(c, f);
339
339
  const v = p.map((D) => D.centerPoint);
340
340
  p.length >= 2 && await F(c, v, u);
341
- }, F = (c, u, h) => {
341
+ }, F = (c, u, f) => {
342
342
  const p = new Ge(u), v = l.get(c).getSource(), D = v.getFeatureById(c);
343
343
  if (D)
344
- D.setGeometry(p), D.setId(c), D.setStyle(Z(h)), m = D;
344
+ D.setGeometry(p), D.setId(c), D.setStyle(Z(f)), m = D;
345
345
  else {
346
346
  const R = new le({ geometry: p });
347
- R.setId(c), R.set("type", "line"), R.setStyle(Z(h)), v.addFeature(R), m = R;
347
+ R.setId(c), R.set("type", "line"), R.setStyle(Z(f)), v.addFeature(R), m = R;
348
348
  }
349
349
  return m;
350
350
  }, Z = (c) => new _({
@@ -352,15 +352,15 @@ const yo = (e) => {
352
352
  color: c,
353
353
  width: 2
354
354
  })
355
- }), W = (c, u, h) => {
355
+ }), W = (c, u, f) => {
356
356
  try {
357
357
  const p = c == null ? void 0 : c.get("data");
358
358
  if (c && p && u === "hover") {
359
359
  e.getTargetElement().style.cursor = p ? "pointer" : "";
360
- const v = H(p), D = h == null ? void 0 : h.coordinate;
361
- D && (f.querySelector(".popup-content"), f.innerHTML = v, x == null || x.setPosition(D));
360
+ const v = H(p), D = f == null ? void 0 : f.coordinate;
361
+ D && (w.querySelector(".popup-content"), w.innerHTML = v, h == null || h.setPosition(D));
362
362
  } else
363
- x && x.setPosition(void 0);
363
+ h && h.setPosition(void 0);
364
364
  } catch (p) {
365
365
  console.error("handleTrackMapEvent", p);
366
366
  }
@@ -405,7 +405,7 @@ const yo = (e) => {
405
405
  ${u ?? u}
406
406
  </div>`;
407
407
  }, O = (c) => {
408
- const h = c.map((S) => {
408
+ const f = c.map((S) => {
409
409
  const A = e.getPixelFromCoordinate(ie(S.center));
410
410
  return {
411
411
  ...S,
@@ -416,13 +416,13 @@ const yo = (e) => {
416
416
  };
417
417
  });
418
418
  let p = 0;
419
- h[0].distance = 0;
420
- for (let S = 1; S < h.length; S++) {
421
- const A = h[S - 1].pixel, Y = h[S].pixel, J = Y[0] - A[0], E = Y[1] - A[1];
422
- p += Math.sqrt(J * J + E * E), h[S].distance = p;
419
+ f[0].distance = 0;
420
+ for (let S = 1; S < f.length; S++) {
421
+ const A = f[S - 1].pixel, Y = f[S].pixel, J = Y[0] - A[0], E = Y[1] - A[1];
422
+ p += Math.sqrt(J * J + E * E), f[S].distance = p;
423
423
  }
424
- const v = h.filter(
425
- (S, A) => A === 0 || A === h.length - 1
424
+ const v = f.filter(
425
+ (S, A) => A === 0 || A === f.length - 1
426
426
  ), D = [];
427
427
  for (let S = 0; S < v.length; S++) {
428
428
  const A = v[S];
@@ -432,7 +432,7 @@ const yo = (e) => {
432
432
  const j = A.distance + B * 100;
433
433
  if (j >= Y.distance) break;
434
434
  const Q = re(
435
- h,
435
+ f,
436
436
  j
437
437
  );
438
438
  Q && D.push(Q);
@@ -453,8 +453,8 @@ const yo = (e) => {
453
453
  }));
454
454
  };
455
455
  function re(c, u) {
456
- for (let h = 1; h < c.length; h++) {
457
- const p = c[h - 1], v = c[h];
456
+ for (let f = 1; f < c.length; f++) {
457
+ const p = c[f - 1], v = c[f];
458
458
  if (u >= p.distance && u <= v.distance) {
459
459
  const D = (u - p.distance) / (v.distance - p.distance), R = p.pixel[0] + D * (v.pixel[0] - p.pixel[0]), S = p.pixel[1] + D * (v.pixel[1] - p.pixel[1]), A = e == null ? void 0 : e.getCoordinateFromPixel([R, S]);
460
460
  return {
@@ -471,9 +471,9 @@ const yo = (e) => {
471
471
  return null;
472
472
  }
473
473
  const ce = async (c, u) => {
474
- const h = O(u);
475
- console.log("simplifiedPoints", h.length, "list", u.length);
476
- const p = h.map((S) => de(S)), v = h.map((S) => Mt(S, G)), D = Pt(c, h, u, G);
474
+ const f = O(u);
475
+ console.log("simplifiedPoints", f.length, "list", u.length);
476
+ const p = f.map((S) => de(S)), v = f.map((S) => Mt(S, G)), D = Pt(c, f, u, G);
477
477
  l.get(c).getSource().addFeatures([...p, ...v, ...D]);
478
478
  }, de = (c) => {
479
479
  const u = new le({
@@ -481,16 +481,16 @@ const yo = (e) => {
481
481
  data: c
482
482
  });
483
483
  u.set("type", "track_point"), u.set("trackId", c.id), u.set("data", c);
484
- let h = [
484
+ let f = [
485
485
  ...Tt(c, G)
486
486
  ];
487
- return (c.index === 0 || c.index === n[c.id].length - 1) && (h = [...Ft(c)], u.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (h = [...Et(c)], u.set("type", "track_icon")), u.setStyle(h), u;
487
+ return (c.index === 0 || c.index === n[c.id].length - 1) && (f = [...Ft(c)], u.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (f = [...Et(c)], u.set("type", "track_icon")), u.setStyle(f), u;
488
488
  }, Be = window.devicePixelRatio || 1, Me = /* @__PURE__ */ new Map();
489
489
  let ge = null, Xe = null;
490
490
  function Ct(c, u) {
491
- const h = `${c}`;
492
- if (Me.has(h))
493
- return Me.get(h);
491
+ const f = `${c}`;
492
+ if (Me.has(f))
493
+ return Me.get(f);
494
494
  if (!ge) {
495
495
  ge = document.createElement("canvas");
496
496
  try {
@@ -512,17 +512,17 @@ const yo = (e) => {
512
512
  const Oe = Te + D / 2 + j / 2;
513
513
  v.strokeStyle = "#ffffff", v.lineWidth = 1, v.strokeText(c, we + R, Oe), v.fillStyle = "#000000", v.fillText(c, we + R, Oe);
514
514
  const De = p.toDataURL("image/png");
515
- return Me.set(h, De), De;
515
+ return Me.set(f, De), De;
516
516
  }
517
517
  const Mt = (c, u) => {
518
- const h = Ct(c.time, u), p = new le({
518
+ const f = Ct(c.time, u), p = new le({
519
519
  geometry: new te(c.centerPoint),
520
520
  data: c
521
521
  });
522
522
  p.set("type", "track_point_label");
523
523
  const v = new _({
524
524
  image: new Ce({
525
- src: h,
525
+ src: f,
526
526
  anchor: [1, 0],
527
527
  displacement: [0, 0],
528
528
  scale: 1 / Be,
@@ -534,8 +534,8 @@ const yo = (e) => {
534
534
  return p.setStyle(v), p;
535
535
  }, Lt = (c) => {
536
536
  const u = l.get(c).getSource();
537
- u.forEachFeature((h) => {
538
- h.get("type") !== "line" && u.removeFeature(h);
537
+ u.forEachFeature((f) => {
538
+ f.get("type") !== "line" && u.removeFeature(f);
539
539
  });
540
540
  }, Tt = (c, u) => [
541
541
  new _({
@@ -555,29 +555,29 @@ const yo = (e) => {
555
555
  })
556
556
  // textStyle,
557
557
  ], Et = (c) => {
558
- const u = "#E31818", h = "#1890FF", p = "&#xe6d2", v = new _({
558
+ const u = "#E31818", f = "#1890FF", p = "&#xe6d2", v = new _({
559
559
  text: new Se({
560
560
  font: "Normal 22px map-iconfont",
561
561
  text: be(p),
562
562
  offsetY: -10,
563
563
  fill: new oe({
564
- color: Number(c.state) === 0 ? u : Number(c.state) === 1 ? h : ""
564
+ color: Number(c.state) === 0 ? u : Number(c.state) === 1 ? f : ""
565
565
  })
566
566
  }),
567
567
  zIndex: 99
568
568
  }), R = dt("&#xe6e2;"), A = dt("&#xe703;"), Y = [];
569
569
  return Number(c.state) === 0 ? Y.push(R) : Number(c.state) === 1 && Y.push(A), Y.push(v), Y;
570
- }, Pt = (c, u, h, p) => {
570
+ }, Pt = (c, u, f, p) => {
571
571
  const v = u || [], D = u.length;
572
- D || (v.push(h[0]), v.push(h[h.length - 1]));
572
+ D || (v.push(f[0]), v.push(f[f.length - 1]));
573
573
  const R = new Set(u.map((A) => `${A.centerPoint[0]},${A.centerPoint[1]}`)), S = [];
574
574
  for (let A = 0; A < D - 1; A++) {
575
575
  let Y;
576
576
  const J = u[A], E = (u[A + 1].index + J.index) / 2;
577
577
  if (E % 2 === 0)
578
- Y = h[E].centerPoint;
578
+ Y = f[E].centerPoint;
579
579
  else {
580
- const B = h[Math.floor(E)], j = h[Math.ceil(E)];
580
+ const B = f[Math.floor(E)], j = f[Math.ceil(E)];
581
581
  if (B && j) {
582
582
  const [Q, fe] = B.centerPoint, [ye, me] = j.centerPoint;
583
583
  Y = [(Q + ye) / 2, (fe + me) / 2];
@@ -608,7 +608,7 @@ const yo = (e) => {
608
608
  return S;
609
609
  }, rt = (c) => {
610
610
  var D, R;
611
- const u = e.getView(), h = (D = l == null ? void 0 : l.get(c)) == null ? void 0 : D.getSource(), p = m || (c ? h == null ? void 0 : h.getFeatureById(c) : null);
611
+ const u = e.getView(), f = (D = l == null ? void 0 : l.get(c)) == null ? void 0 : D.getSource(), p = m || (c ? f == null ? void 0 : f.getFeatureById(c) : null);
612
612
  if (!p) return;
613
613
  const v = (R = p == null ? void 0 : p.getGeometry()) == null ? void 0 : R.getExtent();
614
614
  if (!v || v[0] === v[2] || v[1] === v[3]) {
@@ -643,32 +643,32 @@ const yo = (e) => {
643
643
  })];
644
644
  }, St = () => {
645
645
  console.log("清除所有的轨迹-----"), ze(), l.forEach((u) => {
646
- var h;
647
- (h = u.getSource()) == null || h.clear(), e == null || e.removeLayer(u);
646
+ var f;
647
+ (f = u.getSource()) == null || f.clear(), e == null || e.removeLayer(u);
648
648
  }), Object.keys(n).forEach((u) => {
649
649
  l.delete(u), delete n[u];
650
650
  });
651
651
  }, Nt = (c) => {
652
652
  const u = l.get(c || s);
653
653
  u == null || u.setVisible(!1);
654
- const h = e.getOverlays().getArray();
655
- for (let p = 0; p < h.length; ) {
656
- const v = h[p];
654
+ const f = e.getOverlays().getArray();
655
+ for (let p = 0; p < f.length; ) {
656
+ const v = f[p];
657
657
  v.get("class") === "track-label-overlay" ? (v.setPosition(void 0), v.dispose()) : p++;
658
658
  }
659
659
  ze();
660
660
  }, Rt = (c, u = Ne.NM) => {
661
- const h = {
661
+ const f = {
662
662
  id: c,
663
663
  length: "--"
664
664
  }, v = (n[c] || []).map(
665
665
  (R) => Ve([R.lon, R.lat], I.data, I.mercator)
666
666
  ), D = new Ge(v);
667
- return h.length = go(D, u) || "--", h;
667
+ return f.length = go(D, u) || "--", f;
668
668
  }, $t = (c, u) => {
669
669
  Vt(String(c), u);
670
670
  }, Vt = (c, u) => {
671
- const h = n[String(c)], p = h == null ? void 0 : h.map((v) => [v.lon, v.lat]);
671
+ const f = n[String(c)], p = f == null ? void 0 : f.map((v) => [v.lon, v.lat]);
672
672
  p && Dt(p, u);
673
673
  }, qe = new _({
674
674
  text: new Se({
@@ -680,8 +680,8 @@ const yo = (e) => {
680
680
  })
681
681
  }), zt = (c, u) => {
682
682
  var E, B;
683
- const h = Number(50 * u), p = ((E = c.frameState) == null ? void 0 : E.time) ?? Date.now(), v = p - C;
684
- if (d = (d + h * v / 1e6) % 2, C = p, d >= 1) {
683
+ const f = Number(50 * u), p = ((E = c.frameState) == null ? void 0 : E.time) ?? Date.now(), v = p - C;
684
+ if (d = (d + f * v / 1e6) % 2, C = p, d >= 1) {
685
685
  ze();
686
686
  return;
687
687
  }
@@ -715,8 +715,8 @@ const yo = (e) => {
715
715
  type: "icon",
716
716
  geometry: new te(r.getFirstCoordinate())
717
717
  });
718
- const h = y.getGeometry();
719
- g = h ? h.clone() : new te([0, 0]), k = new le({
718
+ const f = y.getGeometry();
719
+ g = f ? f.clone() : new te([0, 0]), k = new le({
720
720
  type: "geoMarker",
721
721
  style: qe,
722
722
  geometry: g
@@ -725,7 +725,7 @@ const yo = (e) => {
725
725
  features: [k]
726
726
  })
727
727
  }), e == null || e.addLayer(z), o = (p) => zt(p, u), Ot();
728
- }, lt = (c, u, h) => {
728
+ }, lt = (c, u, f) => {
729
729
  function p(E) {
730
730
  return 180 * (E % (2 * Math.PI)) / Math.PI;
731
731
  }
@@ -770,7 +770,7 @@ const yo = (e) => {
770
770
  };
771
771
  return j.id !== void 0 && (Q.id = j.id), j.bbox && (Q.bbox = j.bbox), Q.properties = B, Q.geometry = E, Q;
772
772
  }
773
- const J = R(A(c), A(u), h);
773
+ const J = R(A(c), A(u), f);
774
774
  return J < 0 ? 360 + J : J;
775
775
  };
776
776
  return {
@@ -796,7 +796,7 @@ function mo(e) {
796
796
  position: "relative",
797
797
  "pointer-events": "none"
798
798
  })), s = Ze(() => {
799
- var f;
799
+ var w;
800
800
  return {
801
801
  position: "relative",
802
802
  "border-radius": "1px",
@@ -813,7 +813,7 @@ function mo(e) {
813
813
  "z-index": "1",
814
814
  display: "flex",
815
815
  "align-items": "center",
816
- animation: e.selected ? e.colors && ((f = e.colors) == null ? void 0 : f.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
816
+ animation: e.selected ? e.colors && ((w = e.colors) == null ? void 0 : w.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
817
817
  // "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
818
818
  };
819
819
  }), a = Ze(() => ({
@@ -911,18 +911,18 @@ const wo = (e) => {
911
911
  return l && l <= U.shipModelMax && l >= U.shipTriggleMin ? "ship" : "triangle";
912
912
  }, bt = (e, l, n) => {
913
913
  if (n === "ship") {
914
- const { len: s, wid: a } = l, o = 97, f = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = s * t / o, y = a * t / f, g = Math.min(r, y);
914
+ const { len: s, wid: a } = l, o = 97, w = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = s * t / o, y = a * t / w, g = Math.min(r, y);
915
915
  return g < 0.2 ? 0.2 : g > 2 ? 2 : g;
916
916
  }
917
917
  return U.scaleNum;
918
918
  }, xo = (e, l, n) => {
919
- const { color: s, direct: a, isHighlight: o, shipData: f } = e.getProperties(), x = ((f == null ? void 0 : f.cog) - 90 + 360) % 360;
919
+ const { color: s, direct: a, isHighlight: o, shipData: w } = e.getProperties(), h = ((w == null ? void 0 : w.cog) - 90 + 360) % 360;
920
920
  return new _({
921
921
  image: new Ce({
922
922
  src: t(),
923
923
  scale: l || U.scaleNum,
924
924
  anchor: [0.5, 0.5],
925
- rotation: x * Math.PI / 180,
925
+ rotation: h * Math.PI / 180,
926
926
  rotateWithView: !1
927
927
  })
928
928
  });
@@ -992,12 +992,12 @@ const po = (e, l) => {
992
992
  }, kt = (e) => {
993
993
  const l = document.createElement("div");
994
994
  l.className = "ship-overlay-box", l.style.position = "relative";
995
- const { lon: n, lat: s, blinking: a, blinkingColors: o, name: f } = e, x = Qe({
995
+ const { lon: n, lat: s, blinking: a, blinkingColors: o, name: w } = e, h = Qe({
996
996
  setup() {
997
997
  return mo({
998
998
  position: [n + 2e-3, s + 2e-3],
999
999
  selected: a,
1000
- name: f,
1000
+ name: w,
1001
1001
  colors: o || [],
1002
1002
  existDevice: e == null ? void 0 : e.existDevice,
1003
1003
  existMobile: e == null ? void 0 : e.existMobile,
@@ -1005,7 +1005,7 @@ const po = (e, l) => {
1005
1005
  });
1006
1006
  }
1007
1007
  });
1008
- return Zt(x, l), l;
1008
+ return Zt(h, l), l;
1009
1009
  }, gt = (e) => {
1010
1010
  const l = [];
1011
1011
  return e.existDevice && l.push("&#xe687;"), e.existMobile && l.push("&#xe688;"), e.existWaterGauge && l.push("&#xe686;"), l;
@@ -1037,14 +1037,14 @@ function Lo(e, l, n = "left-bottom", s = 10) {
1037
1037
  console.log("e", Z), Ke = $e.getContext("2d");
1038
1038
  }
1039
1039
  }
1040
- const o = $e, f = Ke;
1041
- if (!f) return "";
1040
+ const o = $e, w = Ke;
1041
+ if (!w) return "";
1042
1042
  o.width = 0, o.height = 0;
1043
- const x = 2, t = 4, r = 16, y = window.devicePixelRatio || 1, g = "500 12px Arial", k = "12px map-iconfont";
1044
- f.font = g;
1045
- const C = f.measureText(e).width;
1046
- f.font = k;
1047
- const z = l.map((Z) => ({ width: f.measureText(be(Z)).width, height: 14 })), d = z.reduce((Z, W) => Z + W.width, 0), m = l.length * s, P = t + C + d + m + t, b = x + 14 + x * 2;
1043
+ const h = 2, t = 4, r = 16, y = window.devicePixelRatio || 1, g = "500 12px Arial", k = "12px map-iconfont";
1044
+ w.font = g;
1045
+ const C = w.measureText(e).width;
1046
+ w.font = k;
1047
+ const z = l.map((Z) => ({ width: w.measureText(be(Z)).width, height: 14 })), d = z.reduce((Z, W) => Z + W.width, 0), m = l.length * s, P = t + C + d + m + t, b = h + 14 + h * 2;
1048
1048
  let V, X, G = 0, q = 0, K = 0, N = 0, M = 0, i = 0;
1049
1049
  switch (V = r + P, n) {
1050
1050
  case "right-top":
@@ -1066,49 +1066,50 @@ function Lo(e, l, n = "left-bottom", s = 10) {
1066
1066
  X = r + b, G = P, q = b, K = P + r, N = 0, M = 0, i = r;
1067
1067
  break;
1068
1068
  }
1069
- X = X + x, o.width = Math.round(V * y), o.height = Math.round(X * y), f.scale(y, y), f.clearRect(0, 0, V, X), f.beginPath(), f.moveTo(G, q), f.lineTo(K, N), f.strokeStyle = "#FFF", f.lineWidth = 1, f.stroke(), f.fillStyle = "#FFF", f.fillRect(M, i, P, b), f.font = g, f.textBaseline = "middle";
1070
- const T = i + x / 2 + b / 2;
1071
- f.strokeStyle = "#ffffff", f.lineWidth = 1, f.strokeText(e, M + t, T), f.fillStyle = "#000000", f.fillText(e, M + t, T), f.font = k, f.fillStyle = "#3370ff";
1072
- let w = M + t + C + s;
1069
+ X = X + h, o.width = Math.round(V * y), o.height = Math.round(X * y), w.scale(y, y), w.clearRect(0, 0, V, X), w.beginPath(), w.moveTo(G, q), w.lineTo(K, N), w.strokeStyle = "#FFF", w.lineWidth = 1, w.stroke(), w.fillStyle = "#FFF", w.fillRect(M, i, P, b), w.font = g, w.textBaseline = "middle";
1070
+ const T = i + h / 2 + b / 2;
1071
+ w.strokeStyle = "#ffffff", w.lineWidth = 1, w.strokeText(e, M + t, T), w.fillStyle = "#000000", w.fillText(e, M + t, T), w.font = k, w.fillStyle = "#3370ff";
1072
+ let x = M + t + C + s;
1073
1073
  const L = i + b / 2;
1074
1074
  l.length > 0 && l.forEach((Z, W) => {
1075
- f.fillText(be(Z), w, L), w += z[W].width + s;
1075
+ w.fillText(be(Z), x, L), x += z[W].width + s;
1076
1076
  });
1077
1077
  const F = o.toDataURL("image/png");
1078
1078
  return je.set(a, F), F;
1079
1079
  }
1080
1080
  const ft = (e, l) => {
1081
- const { name: n, rightIcons: s } = e.getProperties(), a = l !== 1 ? Co() : "right-top", o = Lo(n, s, a);
1082
- let f = [0, 0];
1083
- switch (a) {
1081
+ const { name: n, rightIcons: s, selected: a } = e.getProperties(), o = l !== 1 ? Co() : "right-top", w = Lo(n, s, o);
1082
+ let h = [0, 0];
1083
+ switch (o) {
1084
1084
  case "right-top":
1085
- f = [0, 1];
1085
+ h = [0, 1];
1086
1086
  break;
1087
1087
  case "right-middle":
1088
- f = [0, 0.5];
1088
+ h = [0, 0.5];
1089
1089
  break;
1090
1090
  case "right-bottom":
1091
- f = [0, 0];
1091
+ h = [0, 0];
1092
1092
  break;
1093
1093
  case "left-top":
1094
- f = [1, 1];
1094
+ h = [1, 1];
1095
1095
  break;
1096
1096
  case "left-middle":
1097
- f = [1, 0.5];
1097
+ h = [1, 0.5];
1098
1098
  break;
1099
1099
  case "left-bottom":
1100
- f = [1, 0];
1100
+ h = [1, 0];
1101
1101
  break;
1102
1102
  }
1103
1103
  return new _({
1104
1104
  image: new Ce({
1105
- src: o,
1106
- anchor: f,
1105
+ src: w,
1106
+ anchor: h,
1107
1107
  displacement: [0, 0],
1108
1108
  scale: 1 / Mo,
1109
1109
  anchorXUnits: "fraction",
1110
1110
  anchorYUnits: "fraction"
1111
- })
1111
+ }),
1112
+ zIndex: a ? 100 : 10
1112
1113
  });
1113
1114
  }, To = (e) => {
1114
1115
  let l = null, n = null;
@@ -1118,32 +1119,32 @@ const ft = (e, l) => {
1118
1119
  renderBuffer: 300,
1119
1120
  zIndex: 101,
1120
1121
  properties: { layerType: ee.SHIP }
1121
- }), o = new ue(), f = new he({
1122
+ }), o = new ue(), w = new he({
1122
1123
  source: o,
1123
1124
  className: "zh-map--ship-label-layer",
1124
1125
  zIndex: 102,
1125
1126
  updateWhileInteracting: !1,
1126
1127
  updateWhileAnimating: !1,
1127
1128
  declutter: !0
1128
- }), x = new ue(), t = new he({
1129
- source: x,
1129
+ }), h = new ue(), t = new he({
1130
+ source: h,
1130
1131
  className: "zh-map--ship-selected-layer",
1131
1132
  zIndex: 999
1132
1133
  });
1133
- e == null || e.addLayer(a), e == null || e.addLayer(f), e == null || e.addLayer(t);
1134
+ e == null || e.addLayer(a), e == null || e.addLayer(w), e == null || e.addLayer(t);
1134
1135
  let r = null, y = "", g = {}, k = {};
1135
1136
  const $ = (i) => {
1136
1137
  if (!i || !e) return;
1137
1138
  const T = (n == null ? void 0 : n.id) || (l == null ? void 0 : l.get("id"));
1138
1139
  if (n) {
1139
- const w = i.filter((L) => L.id === T);
1140
- w.length === 0 ? i.push(n) : n = w[0];
1140
+ const x = i.filter((L) => L.id === T);
1141
+ x.length === 0 ? i.push(n) : n = x[0];
1141
1142
  }
1142
1143
  m(), M(i), z();
1143
1144
  }, C = (i) => {
1144
1145
  var O;
1145
- const T = (n == null ? void 0 : n.id) || (l == null ? void 0 : l.get("id")), w = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = ((O = k[i.id]) == null ? void 0 : O.blinkColors) || [], Z = L[L.length - 1] || i.fill || "#04C900", W = wo(i), H = new le({
1146
- geometry: new te(w),
1146
+ const T = (n == null ? void 0 : n.id) || (l == null ? void 0 : l.get("id")), x = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = ((O = k[i.id]) == null ? void 0 : O.blinkColors) || [], Z = L[L.length - 1] || i.fill || "#04C900", W = wo(i), H = new le({
1147
+ geometry: new te(x),
1147
1148
  // 船舶数据
1148
1149
  shipData: i,
1149
1150
  id: i.id,
@@ -1158,25 +1159,25 @@ const ft = (e, l) => {
1158
1159
  // 高亮
1159
1160
  isHighlight: !1
1160
1161
  });
1161
- return H.set("clickGeometry", new Jt(w)), H;
1162
+ return H.set("clickGeometry", new Jt(x)), H;
1162
1163
  }, z = () => {
1163
1164
  if (n && e && n) {
1164
- x.getFeatures().length > 0 && x.clear();
1165
+ h.getFeatures().length > 0 && h.clear();
1165
1166
  const i = ie([n == null ? void 0 : n.lon, n == null ? void 0 : n.lat]), T = new le({
1166
1167
  geometry: new te(i),
1167
1168
  id: n.id
1168
1169
  });
1169
- T.setStyle(bo(e, n)), x.addFeature(T);
1170
+ T.setStyle(bo(e, n)), h.addFeature(T);
1170
1171
  }
1171
1172
  }, d = (i) => {
1172
1173
  if (i === "start") {
1173
1174
  const T = () => {
1174
- const w = x.getFeatures();
1175
+ const x = h.getFeatures();
1175
1176
  s.getFeatures().forEach((L) => {
1176
1177
  var Z, W;
1177
1178
  const F = Ee(e, L);
1178
- if (L.setStyle(F), L.get("id") === (n == null ? void 0 : n.id) && w && w[0]) {
1179
- const H = w[0], O = H == null ? void 0 : H.getStyle();
1179
+ if (L.setStyle(F), L.get("id") === (n == null ? void 0 : n.id) && x && x[0]) {
1180
+ const H = x[0], O = H == null ? void 0 : H.getStyle();
1180
1181
  if (O && (O != null && O.getImage())) {
1181
1182
  const re = (Z = F.getImage()) == null ? void 0 : Z.getScale();
1182
1183
  re && ((W = O.getImage()) == null || W.setScale(re));
@@ -1188,21 +1189,21 @@ const ft = (e, l) => {
1188
1189
  }
1189
1190
  i === "end" && r && (cancelAnimationFrame(r), r = null);
1190
1191
  }, m = () => {
1191
- e && s && (P(), s.clear(), o.clear(), x.clear(), d("end"));
1192
+ e && s && (P(), s.clear(), o.clear(), h.clear(), d("end"));
1192
1193
  }, P = (i) => {
1193
- const T = e.getOverlays().getArray().filter((w) => w.get("class") == "zh-map-ship-overlay");
1194
+ const T = e.getOverlays().getArray().filter((x) => x.get("class") == "zh-map-ship-overlay");
1194
1195
  if (T && T.length > 0) {
1195
- for (let w = 0; w < T.length; w++)
1196
- if (T[w].get("class") !== "ship-overlay-selected") {
1197
- const L = T[w];
1196
+ for (let x = 0; x < T.length; x++)
1197
+ if (T[x].get("class") !== "ship-overlay-selected") {
1198
+ const L = T[x];
1198
1199
  console.log("overlay---", L), L.setPosition(void 0), e.removeOverlay(L), L.dispose();
1199
1200
  }
1200
1201
  }
1201
1202
  }, b = (i, T) => {
1202
1203
  g = i, k = T;
1203
- const w = e.getOverlays().getArray(), L = s.getFeatures();
1204
+ const x = e.getOverlays().getArray(), L = s.getFeatures();
1204
1205
  for (const F in g) {
1205
- const Z = g[F], W = w.find((O) => (O == null ? void 0 : O.getId()) === "label-" + F), H = L.find((O) => F === O.get("id"));
1206
+ const Z = g[F], W = x.find((O) => (O == null ? void 0 : O.getId()) === "label-" + F), H = L.find((O) => F === O.get("id"));
1206
1207
  if (W && H) {
1207
1208
  const O = T[F].blinkColors || [], { shipData: re, name: ce, color: de } = H.getProperties();
1208
1209
  H.set("blinking", Z), O[(O == null ? void 0 : O.length) - 1] && de !== O[(O == null ? void 0 : O.length) - 1] && (H.set("color", O[(O == null ? void 0 : O.length) - 1] || ""), H.setStyle(Ee(e, H)));
@@ -1217,7 +1218,7 @@ const ft = (e, l) => {
1217
1218
  }
1218
1219
  }, V = (i) => {
1219
1220
  if (!e) return;
1220
- const T = s.getFeatures(), w = o.getFeatures(), L = l ? l.get("id") : "", F = T.filter((O) => O.get("id") !== L), Z = w == null ? void 0 : w.filter((O) => O.get("id") !== L), W = /* @__PURE__ */ new Map();
1221
+ const T = s.getFeatures(), x = o.getFeatures(), L = l ? l.get("id") : "", F = T.filter((O) => O.get("id") !== L), Z = x == null ? void 0 : x.filter((O) => O.get("id") !== L), W = /* @__PURE__ */ new Map();
1221
1222
  i.forEach((O) => {
1222
1223
  W.set(O.id, !0);
1223
1224
  });
@@ -1244,15 +1245,15 @@ const ft = (e, l) => {
1244
1245
  }, X = (i) => {
1245
1246
  if (i) {
1246
1247
  console.log("选中", i);
1247
- const T = s.getFeatures().find((L) => L.get("id") === i.id), w = o.getFeatures().find((L) => L.get("id") === i.id);
1248
- T && (l = T), w && w.set("selected", !0), n = i, z();
1248
+ const T = s.getFeatures().find((L) => L.get("id") === i.id), x = o.getFeatures().find((L) => L.get("id") === i.id);
1249
+ T && (l = T), x && x.set("selected", !0), n = i, z();
1249
1250
  } else
1250
1251
  console.log("取消选中"), n = null, l = null, K();
1251
- }, G = Qt((i, T, w) => {
1252
+ }, G = Qt((i, T, x) => {
1252
1253
  try {
1253
1254
  if (i) {
1254
1255
  const L = i.get("shipData"), F = i.get("id");
1255
- if (e.getTargetElement().style.cursor = F ? "pointer" : "", T === "click" && (X(L), w && w(F)), T === "hover") {
1256
+ if (e.getTargetElement().style.cursor = F ? "pointer" : "", T === "click" && (X(L), x && x(F)), T === "hover") {
1256
1257
  y && y !== F && q(), y = F;
1257
1258
  const Z = s.getFeatures().find((W) => W.get("id") === y);
1258
1259
  Z == null || Z.set("isHighlight", !0), Z == null || Z.setStyle(Ee(e, Z));
@@ -1267,13 +1268,13 @@ const ft = (e, l) => {
1267
1268
  y = null, i == null || i.set("isHighlight", !1), i == null || i.setStyle(Ee(e, i));
1268
1269
  }, K = () => {
1269
1270
  try {
1270
- x.clear();
1271
+ h.clear();
1271
1272
  } catch (i) {
1272
1273
  console.log(i);
1273
1274
  }
1274
1275
  }, N = (i, T) => {
1275
- const w = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = new le({
1276
- geometry: new te(w),
1276
+ const x = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = new le({
1277
+ geometry: new te(x),
1277
1278
  name: i.cnname || i.enname || i.name || i.id || "未命名船舶",
1278
1279
  // 图标
1279
1280
  rightIcons: gt(i),
@@ -1285,21 +1286,21 @@ const ft = (e, l) => {
1285
1286
  return L.setStyle(F), L;
1286
1287
  }, M = (i) => {
1287
1288
  const T = e.getView().getZoom();
1288
- i.forEach((w) => {
1289
- const L = C(w);
1290
- if (L.setStyle(Ee(e, L)), s.addFeature(L), (n == null ? void 0 : n.id) == w.id || T && T >= U.shipModelMin)
1291
- if (g[w.id]) {
1292
- if (w.id && k[w == null ? void 0 : w.id]) {
1293
- const F = k[w == null ? void 0 : w.id] || {}, Z = (F == null ? void 0 : F.blinkColors) || [], W = (F == null ? void 0 : F.shipState) || "", H = (w.cnname || w.enname || w.name || w.id || "未命名船舶") + "(" + W + ")", O = {
1294
- ...w,
1289
+ i.forEach((x) => {
1290
+ const L = C(x);
1291
+ if (L.setStyle(Ee(e, L)), s.addFeature(L), (n == null ? void 0 : n.id) == x.id || T && T >= U.shipModelMin)
1292
+ if (g[x.id]) {
1293
+ if (x.id && k[x == null ? void 0 : x.id]) {
1294
+ const F = k[x == null ? void 0 : x.id] || {}, Z = (F == null ? void 0 : F.blinkColors) || [], W = (F == null ? void 0 : F.shipState) || "", H = (x.cnname || x.enname || x.name || x.id || "未命名船舶") + "(" + W + ")", O = {
1295
+ ...x,
1295
1296
  name: H,
1296
- blinking: g[w.id],
1297
+ blinking: g[x.id],
1297
1298
  blinkingColors: Z || []
1298
1299
  };
1299
1300
  po(e, O);
1300
1301
  }
1301
1302
  } else {
1302
- const F = N(w, i.length);
1303
+ const F = N(x, i.length);
1303
1304
  o.addFeature(F);
1304
1305
  }
1305
1306
  });
@@ -1358,21 +1359,21 @@ const ft = (e, l) => {
1358
1359
  }, Fo = (e) => {
1359
1360
  const l = "zh-map-location-layer";
1360
1361
  let n, s, a = null, o = null;
1361
- const f = (C) => {
1362
+ const w = (C) => {
1362
1363
  if (!(!C || C.length === 0)) {
1363
1364
  if (s || (s = new ue()), s.clear(), o) {
1364
1365
  const z = C.find((d) => d.id === o.id);
1365
1366
  z ? o = z : C.push(o);
1366
1367
  }
1367
1368
  C.forEach((z) => {
1368
- x(z);
1369
+ h(z);
1369
1370
  }), n || (n = new he({
1370
1371
  className: l,
1371
1372
  source: s,
1372
1373
  zIndex: 100
1373
1374
  }), e == null || e.addLayer(n));
1374
1375
  }
1375
- }, x = (C) => {
1376
+ }, h = (C) => {
1376
1377
  const z = e == null ? void 0 : e.getView().getZoom(), [d, m] = C.latLon.split(","), P = new le({
1377
1378
  geometry: new te(ie([Number(d), Number(m)]))
1378
1379
  });
@@ -1422,7 +1423,7 @@ const ft = (e, l) => {
1422
1423
  o = C, a = z.find((d) => d.get("loactionData").id === C.id);
1423
1424
  };
1424
1425
  return {
1425
- render: f,
1426
+ render: w,
1426
1427
  selected: g,
1427
1428
  clearSelected: y,
1428
1429
  clear: r
@@ -1443,10 +1444,10 @@ const ft = (e, l) => {
1443
1444
  s.value = N;
1444
1445
  };
1445
1446
  let o;
1446
- const f = ne(!1), x = () => {
1447
+ const w = ne(!1), h = () => {
1447
1448
  ve(e, "crosshair"), y(), So(e), e.on("pointermove", $), e.getViewport().addEventListener("mouseout", () => {
1448
1449
  o && o.classList.add("hidden");
1449
- }), z(), f.value = !0;
1450
+ }), z(), w.value = !0;
1450
1451
  };
1451
1452
  let t, r;
1452
1453
  const y = () => {
@@ -1501,20 +1502,20 @@ const ft = (e, l) => {
1501
1502
  var T;
1502
1503
  g = M.feature, g.set("randomId", d());
1503
1504
  let i;
1504
- N = (T = g.getGeometry()) == null ? void 0 : T.on("change", function(w) {
1505
- const L = w.target, F = pt(L, s.value);
1505
+ N = (T = g.getGeometry()) == null ? void 0 : T.on("change", function(x) {
1506
+ const L = x.target, F = pt(L, s.value);
1506
1507
  i = L.getLastCoordinate(), m && F && (m.innerHTML = F), P.setPosition(i);
1507
1508
  });
1508
1509
  }), C.on("drawend", function() {
1509
1510
  var M, i, T;
1510
1511
  if (m && (m.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), m != null && m.innerHTML) {
1511
- const w = (g == null ? void 0 : g.get("randomId")) || d();
1512
- n.value.push({ id: w, value: m == null ? void 0 : m.innerHTML }), m.innerHTML = `${m.innerHTML}<div class="ol-tooltip-delete-button" data-id="${w}"><i class="map-iconfont icon-delete"></i></div>`;
1512
+ const x = (g == null ? void 0 : g.get("randomId")) || d();
1513
+ n.value.push({ id: x, value: m == null ? void 0 : m.innerHTML }), m.innerHTML = `${m.innerHTML}<div class="ol-tooltip-delete-button" data-id="${x}"><i class="map-iconfont icon-delete"></i></div>`;
1513
1514
  }
1514
- (M = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || M.addEventListener("click", (w) => {
1515
+ (M = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || M.addEventListener("click", (x) => {
1515
1516
  var F;
1516
- w.preventDefault(), w.stopPropagation();
1517
- const L = (F = w.target) == null ? void 0 : F.getAttribute("data-id");
1517
+ x.preventDefault(), x.stopPropagation();
1518
+ const L = (F = x.target) == null ? void 0 : F.getAttribute("data-id");
1518
1519
  L && G(L);
1519
1520
  }), P.setOffset([0, -7]), g = null, m = null, b(), N && Je(N), (T = (i = l.getProps()) == null ? void 0 : i.lineDrawEnd) == null || T.call(i, n.value);
1520
1521
  });
@@ -1536,14 +1537,14 @@ const ft = (e, l) => {
1536
1537
  }), e == null || e.addOverlay(k);
1537
1538
  }, X = () => {
1538
1539
  n.value.forEach((N, M) => {
1539
- var w, L;
1540
+ var x, L;
1540
1541
  const i = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1541
- i[M] && ((L = (w = i[M]) == null ? void 0 : w.parentNode) == null || L.removeChild(i[M]));
1542
+ i[M] && ((L = (x = i[M]) == null ? void 0 : x.parentNode) == null || L.removeChild(i[M]));
1542
1543
  const T = t.getFeatures();
1543
1544
  T[M] && t.removeFeature(T[M]);
1544
- }), q(), No(e), f.value = !1, ve(e, "grab");
1545
+ }), q(), No(e), w.value = !1, ve(e, "grab");
1545
1546
  }, G = (N) => {
1546
- var i, T, w, L;
1547
+ var i, T, x, L;
1547
1548
  const M = n.value.findIndex((F) => F.id === N);
1548
1549
  if (M !== -1) {
1549
1550
  n.value.splice(M, 1);
@@ -1552,7 +1553,7 @@ const ft = (e, l) => {
1552
1553
  const Z = t.getFeatures();
1553
1554
  Z[M] && t.removeFeature(Z[M]);
1554
1555
  }
1555
- (L = (w = l.getProps()) == null ? void 0 : w.lineDrawEnd) == null || L.call(w, n.value);
1556
+ (L = (x = l.getProps()) == null ? void 0 : x.lineDrawEnd) == null || L.call(x, n.value);
1556
1557
  }, q = () => {
1557
1558
  if (n.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((N) => {
1558
1559
  var M;
@@ -1564,11 +1565,11 @@ const ft = (e, l) => {
1564
1565
  e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), m != null && m.parentNode && m.parentNode.removeChild(m);
1565
1566
  };
1566
1567
  return {
1567
- open: x,
1568
+ open: h,
1568
1569
  close: X,
1569
1570
  deleteLine: G,
1570
1571
  setUnit: a,
1571
- getState: () => f.value
1572
+ getState: () => w.value
1572
1573
  };
1573
1574
  }, pt = (e, l) => {
1574
1575
  const s = tt(e);
@@ -1588,13 +1589,13 @@ const ft = (e, l) => {
1588
1589
  }, $o = (e, l) => {
1589
1590
  let n, s, a = "close";
1590
1591
  const o = () => {
1591
- q(), a = "open", f(), ve(e, "crosshair");
1592
- }, f = () => {
1592
+ q(), a = "open", w(), ve(e, "crosshair");
1593
+ }, w = () => {
1593
1594
  r(), P(), X(), C();
1594
1595
  };
1595
- let x = null, t = null;
1596
+ let h = null, t = null;
1596
1597
  const r = () => {
1597
- if (x && t) return;
1598
+ if (h && t) return;
1598
1599
  const N = new ue(), M = new he({
1599
1600
  source: N,
1600
1601
  style: new _({
@@ -1605,7 +1606,7 @@ const ft = (e, l) => {
1605
1606
  }),
1606
1607
  zIndex: 1e3
1607
1608
  });
1608
- x = M, t = N, e.on("pointermove", g), e.addLayer(M), e.on(["dblclick"], function(i) {
1609
+ h = M, t = N, e.on("pointermove", g), e.addLayer(M), e.on(["dblclick"], function(i) {
1609
1610
  k && (i.stopPropagation(), i.preventDefault());
1610
1611
  });
1611
1612
  };
@@ -1626,8 +1627,8 @@ const ft = (e, l) => {
1626
1627
  <span class="text">面积:${M}${$ ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1627
1628
  `), d && (d.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
1628
1629
  const i = N.getCoordinates(), T = i[0][i[0].length - 2];
1629
- if (m.setPosition(T), x) {
1630
- const L = x.getSource();
1630
+ if (m.setPosition(T), h) {
1631
+ const L = h.getSource();
1631
1632
  L && n && (L.clear(), L.addFeature(n));
1632
1633
  }
1633
1634
  setTimeout(() => {
@@ -1637,8 +1638,8 @@ const ft = (e, l) => {
1637
1638
  console.log("delete"), G(), (Z = (F = l.getProps()) == null ? void 0 : F.areaDrawEnd) == null || Z.call(F, []);
1638
1639
  });
1639
1640
  }, 0);
1640
- const w = It(n.getGeometry().getExtent());
1641
- e == null || e.getView().setCenter(w);
1641
+ const x = It(n.getGeometry().getExtent());
1642
+ e == null || e.getView().setCenter(x);
1642
1643
  return;
1643
1644
  }
1644
1645
  k = new We({
@@ -1669,17 +1670,17 @@ const ft = (e, l) => {
1669
1670
  }), e == null || e.addInteraction(k), k.on("drawstart", (N) => {
1670
1671
  var M;
1671
1672
  y = N.feature, s = (M = y.getGeometry()) == null ? void 0 : M.on("change", (i) => {
1672
- const T = i.target, w = z(T, "nm"), F = T.getCoordinates()[0], Z = new Ge([F[F.length - 2], F[F.length - 1]]), W = pt(Z, "nm");
1673
- if ($ = Number(tt(Z) / 1e3) > 150, !w) return;
1673
+ const T = i.target, x = z(T, "nm"), F = T.getCoordinates()[0], Z = new Ge([F[F.length - 2], F[F.length - 1]]), W = pt(Z, "nm");
1674
+ if ($ = Number(tt(Z) / 1e3) > 150, !x) return;
1674
1675
  const H = '<span class="error pl-4">超出可以绘画的距离</span>';
1675
1676
  d && (d.innerHTML = `
1676
1677
  <div class="text">
1677
- 面积:${w}
1678
+ 面积:${x}
1678
1679
  ${$ ? H : ""}
1679
1680
  </div>
1680
1681
  `), b && (b.innerHTML = `
1681
1682
  <div class="text">
1682
- 面积:${w}
1683
+ 面积:${x}
1683
1684
  </div>
1684
1685
  <div class="text ${$ ? "error" : ""}">
1685
1686
  线段 ${F.length - 2}: ${W}
@@ -1692,11 +1693,11 @@ const ft = (e, l) => {
1692
1693
  `);
1693
1694
  });
1694
1695
  }), k.on("drawend", (N) => {
1695
- var w, L, F, Z;
1696
+ var x, L, F, Z;
1696
1697
  if (!N.feature.getGeometry()) return;
1697
1698
  d && !n && (d.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), n = N.feature, m.setOffset([10, 0]);
1698
1699
  const i = N.feature.getGeometry().getCoordinates(), T = i[0][i[0].length - 2];
1699
- if (m.setPosition(T), b != null && b.parentNode && b.parentNode.removeChild(b), (w = l.getProps()) != null && w.areaDrawEnd) {
1700
+ if (m.setPosition(T), b != null && b.parentNode && b.parentNode.removeChild(b), (x = l.getProps()) != null && x.areaDrawEnd) {
1700
1701
  const W = i[0].map((H) => Ve(H, I.mercator, I.data));
1701
1702
  (F = (L = l.getProps()) == null ? void 0 : L.areaDrawEnd) == null || F.call(L, W);
1702
1703
  }
@@ -1738,7 +1739,7 @@ const ft = (e, l) => {
1738
1739
  }, q = () => {
1739
1740
  a = "close", e.un("pointermove", g), y = null, k && (k.abortDrawing(), console.log("abortDrawing"), k.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((M) => {
1740
1741
  M instanceof We && (M.setActive(!1), e == null || e.removeInteraction(M));
1741
- }), k = null), s && Je(s), s = void 0, t == null || t.clear(), t = null, x && e.getAllLayers().includes(x) && (e.removeLayer(x), x = null), b != null && b.parentElement && (b.innerHTML = "", b.parentElement.removeChild(b), b = null), d != null && d.parentElement && (d.innerHTML = "", d.parentElement.removeChild(d), d = null), V && e.removeOverlay(V), m && e.removeOverlay(m), ve(e, "grab");
1742
+ }), k = null), s && Je(s), s = void 0, t == null || t.clear(), t = null, h && e.getAllLayers().includes(h) && (e.removeLayer(h), h = null), b != null && b.parentElement && (b.innerHTML = "", b.parentElement.removeChild(b), b = null), d != null && d.parentElement && (d.innerHTML = "", d.parentElement.removeChild(d), d = null), V && e.removeOverlay(V), m && e.removeOverlay(m), ve(e, "grab");
1742
1743
  };
1743
1744
  return {
1744
1745
  open: o,
@@ -1775,23 +1776,23 @@ const ft = (e, l) => {
1775
1776
  G.setStyle(q), P.push(G);
1776
1777
  }), l.addFeatures(P);
1777
1778
  };
1778
- let f = null, x = null;
1779
+ let w = null, h = null;
1779
1780
  const t = /* @__PURE__ */ new Map(), r = (d, m) => {
1780
- f || (f = document.createElement("canvas"), x = f.getContext("2d", {
1781
+ w || (w = document.createElement("canvas"), h = w.getContext("2d", {
1781
1782
  willReadFrequently: !0
1782
1783
  }));
1783
1784
  const P = `${d}-${m}`;
1784
1785
  if (t.has(P))
1785
1786
  return t.get(P);
1786
- const b = f, V = x;
1787
+ const b = w, V = h;
1787
1788
  if (!V) return "";
1788
1789
  b.width = 0, b.height = 0;
1789
1790
  const X = 2, G = 8, q = window.devicePixelRatio || 1, K = "12px sans-serif";
1790
1791
  V.font = K;
1791
1792
  const M = V.measureText(d).width, i = G + M + G, T = X + 12 + X * 2;
1792
1793
  b.width = Math.round(i * q), b.height = Math.round(T * q), V.scale(q, q), V.clearRect(0, 0, i, T), V.fillStyle = m ? "#F32D2D" : "#FFF", V.beginPath(), V.roundRect(0, 0, i, T, 4), V.fill(), V.font = K, V.textBaseline = "middle";
1793
- const w = T / 2;
1794
- V.strokeStyle = m ? "#000" : "#ffffff", V.lineWidth = 1, V.strokeText(d, G, w), V.fillStyle = m ? "#FFF" : "#000000", V.fillText(d, G, w);
1794
+ const x = T / 2;
1795
+ V.strokeStyle = m ? "#000" : "#ffffff", V.lineWidth = 1, V.strokeText(d, G, x), V.fillStyle = m ? "#FFF" : "#000000", V.fillText(d, G, x);
1795
1796
  const L = b.toDataURL("image/png");
1796
1797
  return t.set(P, L), L;
1797
1798
  }, y = (d) => {
@@ -1870,9 +1871,9 @@ const ft = (e, l) => {
1870
1871
  d && d.get("portData") ? ve(e, "pointer") : ve(e, "grab");
1871
1872
  }
1872
1873
  };
1873
- }, Oo = (e, l, n, s, a, o, f) => {
1874
- const x = e.getInstall();
1875
- x.on("moveend", () => {
1874
+ }, Oo = (e, l, n, s, a, o, w) => {
1875
+ const h = e.getInstall();
1876
+ h.on("moveend", () => {
1876
1877
  var g, k;
1877
1878
  try {
1878
1879
  const $ = e.getZoom();
@@ -1886,7 +1887,7 @@ const ft = (e, l) => {
1886
1887
  [ee.SHIP]: null,
1887
1888
  [ee.TRACK]: null
1888
1889
  }, r = (g, k, $) => {
1889
- switch (ve(x, "pointer"), g) {
1890
+ switch (ve(h, "pointer"), g) {
1890
1891
  case ee.SHIP:
1891
1892
  s == null || s.handleShipMapEvent(k, "hover");
1892
1893
  break;
@@ -1897,7 +1898,7 @@ const ft = (e, l) => {
1897
1898
  break;
1898
1899
  }
1899
1900
  }, y = (g) => {
1900
- switch (ve(x, "grab"), g) {
1901
+ switch (ve(h, "grab"), g) {
1901
1902
  case ee.PORT:
1902
1903
  break;
1903
1904
  case ee.SHIP:
@@ -1908,14 +1909,14 @@ const ft = (e, l) => {
1908
1909
  break;
1909
1910
  }
1910
1911
  };
1911
- x.on("pointermove", (g) => {
1912
- if (!x.getView().getAnimating())
1912
+ h.on("pointermove", (g) => {
1913
+ if (!h.getView().getAnimating())
1913
1914
  try {
1914
1915
  let k = !1;
1915
- const $ = x.getLayers().getArray().filter((C) => C.get("layerType"));
1916
+ const $ = h.getLayers().getArray().filter((C) => C.get("layerType"));
1916
1917
  $ && $.length > 0 && $.forEach((C) => {
1917
1918
  if (k) return;
1918
- const z = x == null ? void 0 : x.getEventPixel(g.originalEvent), d = C == null ? void 0 : C.get("layerType"), m = x == null ? void 0 : x.forEachFeatureAtPixel(z, (P) => P, {
1919
+ const z = h == null ? void 0 : h.getEventPixel(g.originalEvent), d = C == null ? void 0 : C.get("layerType"), m = h == null ? void 0 : h.forEachFeatureAtPixel(z, (P) => P, {
1919
1920
  layerFilter: (P) => P === C,
1920
1921
  // 严格图层过滤
1921
1922
  hitTolerance: 5
@@ -1925,22 +1926,22 @@ const ft = (e, l) => {
1925
1926
  } catch (k) {
1926
1927
  console.log("pointermove----", k);
1927
1928
  }
1928
- }), x.on("movestart", () => {
1929
+ }), h.on("movestart", () => {
1929
1930
  try {
1930
- const g = x == null ? void 0 : x.getView().getZoom();
1931
+ const g = h == null ? void 0 : h.getView().getZoom();
1931
1932
  g && g <= U.shipModelMax && g >= U.shipTriggleMin && s.changeShipScale("start");
1932
1933
  } catch (g) {
1933
1934
  console.log("movestart---catch", g);
1934
1935
  }
1935
- }), x.on("click", vt((g) => {
1936
- if (f.getState() !== "open" && !x.getView().getAnimating())
1936
+ }), h.on("click", vt((g) => {
1937
+ if (w.getState() !== "open" && !h.getView().getAnimating())
1937
1938
  try {
1938
1939
  let k = !1;
1939
- const $ = x.getLayers().getArray().filter((C) => C.get("layerType"));
1940
+ const $ = h.getLayers().getArray().filter((C) => C.get("layerType"));
1940
1941
  $ && $.length > 0 && $.forEach((C) => {
1941
1942
  var m, P, b;
1942
1943
  if (k) return;
1943
- const z = x == null ? void 0 : x.getEventPixel(g.originalEvent), d = x == null ? void 0 : x.forEachFeatureAtPixel(z, (V) => {
1944
+ const z = h == null ? void 0 : h.getEventPixel(g.originalEvent), d = h == null ? void 0 : h.forEachFeatureAtPixel(z, (V) => {
1944
1945
  if (V.get("shipData") || V.get("portData"))
1945
1946
  return V;
1946
1947
  }, {
@@ -1968,12 +1969,12 @@ const ft = (e, l) => {
1968
1969
  createInstance: (s, a) => {
1969
1970
  const o = ao();
1970
1971
  o.initMap(s, a);
1971
- const f = o.getInstall(), x = Eo(f), t = Po();
1972
- t.setProps(a), x.setShowLayerType(a.layerType), x.setGreenTileVisible(a.showGreenLayer);
1973
- const r = yo(f), y = vo(f, r), g = To(f), k = Fo(f), $ = Ro(f, t), C = $o(f, t), z = zo(f);
1972
+ const w = o.getInstall(), h = Eo(w), t = Po();
1973
+ t.setProps(a), h.setShowLayerType(a.layerType), h.setGreenTileVisible(a.showGreenLayer);
1974
+ const r = yo(w), y = vo(w, r), g = To(w), k = Fo(w), $ = Ro(w, t), C = $o(w, t), z = zo(w);
1974
1975
  Oo(o, t, r, g, z, $, C);
1975
1976
  const d = () => {
1976
- const P = f.getView().calculateExtent(o.getSize()), b = Ve([P[0], P[1]], I.mercator, I.data), V = Ve([P[2], P[3]], I.mercator, I.data);
1977
+ const P = w.getView().calculateExtent(o.getSize()), b = Ve([P[0], P[1]], I.mercator, I.data), V = Ve([P[2], P[3]], I.mercator, I.data);
1977
1978
  return [b[0], b[1], V[0], V[1]];
1978
1979
  }, m = {
1979
1980
  id: Symbol("map-instance"),
@@ -1984,7 +1985,7 @@ const ft = (e, l) => {
1984
1985
  },
1985
1986
  methods: {
1986
1987
  ...o,
1987
- layer: x,
1988
+ layer: h,
1988
1989
  ship: g,
1989
1990
  track: r,
1990
1991
  carTrack: y,
@@ -2035,13 +2036,13 @@ const ft = (e, l) => {
2035
2036
  } }
2036
2037
  },
2037
2038
  setup(e, { expose: l }) {
2038
- const n = ne(), s = ne(), a = Do(), o = ne(), f = e, x = ne({
2039
+ const n = ne(), s = ne(), a = Do(), o = ne(), w = e, h = ne({
2039
2040
  getInstall() {
2040
2041
  }
2041
2042
  });
2042
2043
  return Gt(() => {
2043
2044
  var t;
2044
- o.value = a.createInstance(n.value, f), x.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, f.scaleLineUnit);
2045
+ o.value = a.createInstance(n.value, w), h.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, w.scaleLineUnit);
2045
2046
  }), Wt(() => {
2046
2047
  var t, r;
2047
2048
  a.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (r = o.value) == null || r.destroy();
package/dist/es/index.js CHANGED
@@ -17,7 +17,7 @@ import { Z as B } from "./BaseInfo-Cu3ME-K_.js";
17
17
  import { Z as g } from "./DetailHeader-DTHE-pQa.js";
18
18
  import { Z as x } from "./DiyDataTable-BQaaClFf.js";
19
19
  import { D as V } from "./DiyDataTable-BQaaClFf.js";
20
- import { Z as G } from "./Map-DwI7JnW8.js";
20
+ import { Z as G } from "./Map-BsyX-AAm.js";
21
21
  import { Z as M } from "./Table-CzNjEPnP.js";
22
22
  import { Z as $ } from "./BaseItem-Co7KlYD6.js";
23
23
  const A = [
@@ -189,7 +189,7 @@ ye.version="2.30.1",JB(Dt),ye.fn=le,ye.min=$V,ye.max=zV,ye.now=WV,ye.utc=_i,ye.u
189
189
  <path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
190
190
  <path fill-rule="evenodd" clip-rule="evenodd" d="M19.9998 0.5V3.5L3.49976 3.5V20H0.499756V0.500002L19.9998 0.5ZM45.4998 3.5H28.9998V0.5H48.4998V20H45.4998V3.5ZM48.4998 29L48.4998 48.5H28.9998V45.5H45.4998L45.4998 29H48.4998ZM3.49976 45.5L3.49976 29H0.499756L0.499758 48.5L19.9998 48.5V45.5L3.49976 45.5Z" fill="#FF2424"/>
191
191
  </svg>
192
- `;return new _t({image:new ni({src:`data:image/svg+xml;utf8,${encodeURIComponent(s)}`,scale:r,anchorXUnits:"fraction",anchorYUnits:"fraction"})})};function M7(t,e,n,r){if(e){const o=new Os({element:n,positioning:"top-left",id:"label-"+(r==null?void 0:r.id),offset:[20,-20],autoPan:!1,position:e,className:r!=null&&r.blinking?"ship-label-overlay-blinking":"ship-label-overlay"});o.set("class","zh-map-ship-overlay"),t.addOverlay(o)}}const D7=(t,e)=>{const{lon:n,lat:r,blinking:o}=e,s=z2(e);n&&r&&M7(t,Jr([n,r]),s,{...e,blinking:o})},z2=t=>{const e=document.createElement("div");e.className="ship-overlay-box",e.style.position="relative";const{lon:n,lat:r,blinking:o,blinkingColors:s,name:a}=t,l=i.createVNode({setup(){return x7({position:[n+.002,r+.002],selected:o,name:a,colors:s||[],existDevice:t==null?void 0:t.existDevice,existMobile:t==null?void 0:t.existMobile,existWaterGauge:t==null?void 0:t.existWaterGauge})}});return i.render(l,e),e},W2=t=>{const e=[];return t.existDevice&&e.push("&#xe687;"),t.existMobile&&e.push("&#xe688;"),t.existWaterGauge&&e.push("&#xe686;"),e};function I7(){const t=["left-top","left-middle","left-bottom","right-top","right-middle","right-bottom"];return t[Math.floor(Math.random()*t.length)]}const P7=window.devicePixelRatio||1,C0=new Map;let zc=null,E0=null;function O7(t,e,n="left-bottom",r=10){const o=`${t}-${e.join(",")}-${n}-${r}`;if(C0.has(o))return C0.get(o);if(!zc){zc=document.createElement("canvas");try{E0=zc.getContext("2d",{willReadFrequently:!0})}catch(D){console.log("e",D),E0=zc.getContext("2d")}}const s=zc,a=E0;if(!a)return"";s.width=0,s.height=0;const l=2,c=4,d=16,u=window.devicePixelRatio||1,f="500 12px Arial",p="12px map-iconfont";a.font=f;const h=a.measureText(t).width;a.font=p;const y=e.map(D=>({width:a.measureText(Ls(D)).width,height:14})),g=y.reduce((D,P)=>D+P.width,0),b=e.length*r,w=c+h+g+b+c,C=l+14+l*2;let _,E,S=0,v=0,x=0,k=0,M=0,T=0;switch(_=d+w,n){case"right-top":E=d+C,S=0,v=d+C,x=d,k=0,M=d,T=0;break;case"right-middle":E=C,S=0,v=C/2,x=d,k=C/2,M=d,T=0;break;case"right-bottom":E=d+C,S=0,v=0,x=d,k=d,M=d,T=d;break;case"left-top":E=d+C,S=w,v=d,x=w+d,k=C+d,M=0,T=0;break;case"left-middle":E=C,S=w,v=C/2,x=w+d,k=C/2,M=0,T=0;break;case"left-bottom":E=d+C,S=w,v=C,x=w+d,k=0,M=0,T=d;break}E=E+l,s.width=Math.round(_*u),s.height=Math.round(E*u),a.scale(u,u),a.clearRect(0,0,_,E),a.beginPath(),a.moveTo(S,v),a.lineTo(x,k),a.strokeStyle="#FFF",a.lineWidth=1,a.stroke(),a.fillStyle="#FFF",a.fillRect(M,T,w,C),a.font=f,a.textBaseline="middle";const L=T+l/2+C/2;a.strokeStyle="#ffffff",a.lineWidth=1,a.strokeText(t,M+c,L),a.fillStyle="#000000",a.fillText(t,M+c,L),a.font=p,a.fillStyle="#3370ff";let O=M+c+h+r;const F=T+C/2;e.length>0&&e.forEach((D,P)=>{a.fillText(Ls(D),O,F),O+=y[P].width+r});const I=s.toDataURL("image/png");return C0.set(o,I),I}const Y2=(t,e)=>{const{name:n,rightIcons:r}=t.getProperties(),o=e!==1?I7():"right-top",s=O7(n,r,o);let a=[0,0];switch(o){case"right-top":a=[0,1];break;case"right-middle":a=[0,.5];break;case"right-bottom":a=[0,0];break;case"left-top":a=[1,1];break;case"left-middle":a=[1,.5];break;case"left-bottom":a=[1,0];break}return new _t({image:new ni({src:s,anchor:a,displacement:[0,0],scale:1/P7,anchorXUnits:"fraction",anchorYUnits:"fraction"})})},N7=t=>{let e=null,n=null;const r=new Di,o=new v7({source:r,className:"zh-map--ship-layer",renderBuffer:300,zIndex:101,properties:{layerType:or.SHIP}}),s=new Di,a=new go({source:s,className:"zh-map--ship-label-layer",zIndex:102,updateWhileInteracting:!1,updateWhileAnimating:!1,declutter:!0}),l=new Di,c=new go({source:l,className:"zh-map--ship-selected-layer",zIndex:999});t==null||t.addLayer(o),t==null||t.addLayer(a),t==null||t.addLayer(c);let d=null,u="",f={},p={};const m=T=>{if(!T||!t)return;const L=(n==null?void 0:n.id)||(e==null?void 0:e.get("id"));if(n){const O=T.filter(F=>F.id===L);O.length===0?T.push(n):n=O[0]}b(),M(T),y()},h=T=>{var R;const L=(n==null?void 0:n.id)||(e==null?void 0:e.get("id")),O=Jr([T==null?void 0:T.lon,T==null?void 0:T.lat]),F=((R=p[T.id])==null?void 0:R.blinkColors)||[],D=F[F.length-1]||T.fill||"#04C900",P=k7(T),N=new Kt({geometry:new Xt(O),shipData:T,id:T.id,name:T.cnname||T.enname||T.name||T.id||"未命名船舶",selected:T.id===L,rightIcons:W2(T),color:D,direct:P,isHighlight:!1});return N.set("clickGeometry",new Lc(O)),N},y=()=>{if(n&&t&&n){l.getFeatures().length>0&&l.clear();const T=Jr([n==null?void 0:n.lon,n==null?void 0:n.lat]),L=new Kt({geometry:new Xt(T),id:n.id});L.setStyle(R7(t,n)),l.addFeature(L)}},g=T=>{if(T==="start"){const L=()=>{const O=l.getFeatures();r.getFeatures().forEach(F=>{var D,P;const I=il(t,F);if(F.setStyle(I),F.get("id")===(n==null?void 0:n.id)&&O&&O[0]){const N=O[0],R=N==null?void 0:N.getStyle();if(R&&(R!=null&&R.getImage())){const A=(D=I.getImage())==null?void 0:D.getScale();A&&((P=R.getImage())==null||P.setScale(A))}}}),d=requestAnimationFrame(L)};L()}T==="end"&&d&&(cancelAnimationFrame(d),d=null)},b=()=>{t&&r&&(w(),r.clear(),s.clear(),l.clear(),g("end"))},w=T=>{const L=t.getOverlays().getArray().filter(O=>O.get("class")=="zh-map-ship-overlay");if(L&&L.length>0){for(let O=0;O<L.length;O++)if(L[O].get("class")!=="ship-overlay-selected"){const F=L[O];console.log("overlay---",F),F.setPosition(void 0),t.removeOverlay(F),F.dispose()}}},C=(T,L)=>{f=T,p=L;const O=t.getOverlays().getArray(),F=r.getFeatures();for(const I in f){const D=f[I],P=O.find(R=>(R==null?void 0:R.getId())==="label-"+I),N=F.find(R=>I===R.get("id"));if(P&&N){const R=L[I].blinkColors||[],{shipData:A,name:B,color:Y}=N.getProperties();N.set("blinking",D),R[(R==null?void 0:R.length)-1]&&Y!==R[(R==null?void 0:R.length)-1]&&(N.set("color",R[(R==null?void 0:R.length)-1]||""),N.setStyle(il(t,N)));const z={...A,blinking:D,blinkingColors:R||[],name:B+"("+L[I].shipState+")"},W=P.getElement(),Z=z2(z);W&&W!==Z&&P.setElement(Z)}}},_=T=>{if(!t)return;const L=r.getFeatures(),O=s.getFeatures(),F=e?e.get("id"):"",I=L.filter(R=>R.get("id")!==F),D=O==null?void 0:O.filter(R=>R.get("id")!==F),P=new Map;T.forEach(R=>{P.set(R.id,!0)});const N=t.getOverlays().getArray();I.forEach(R=>{const A=R.get("id");if(!P.has(A))R.setStyle([]);else{const Y=R.getStyle();(Y==null?void 0:Y.length)==0&&R.setStyle(il(t,R))}const B=N.find(Y=>Y.getId()==="label-"+A);B&&B.setPosition(void 0)}),D.forEach(R=>{const A=R.get("id");if(!P.has(A))R.setStyle([]);else{const B=R.getStyle();(B==null?void 0:B.length)==0&&R.setStyle(Y2(R,T.length))}})},E=T=>{if(T){console.log("选中",T);const L=r.getFeatures().find(F=>F.get("id")===T.id),O=s.getFeatures().find(F=>F.get("id")===T.id);L&&(e=L),O&&O.set("selected",!0),n=T,y()}else console.log("取消选中"),n=null,e=null,x()},S=Li((T,L,O)=>{try{if(T){const F=T.get("shipData"),I=T.get("id");if(t.getTargetElement().style.cursor=I?"pointer":"",L==="click"&&(E(F),O&&O(I)),L==="hover"){u&&u!==I&&v(),u=I;const D=r.getFeatures().find(P=>P.get("id")===u);D==null||D.set("isHighlight",!0),D==null||D.setStyle(il(t,D))}}else t.getTargetElement().style.cursor="",v()}catch(F){console.log("handleShipMapEvent",F)}},10),v=()=>{const T=u?r.getFeatures().find(L=>L.get("id")===u):null;u=null,T==null||T.set("isHighlight",!1),T==null||T.setStyle(il(t,T))},x=()=>{try{l.clear()}catch(T){console.log(T)}},k=(T,L)=>{const O=Jr([T==null?void 0:T.lon,T==null?void 0:T.lat]),F=new Kt({geometry:new Xt(O),name:T.cnname||T.enname||T.name||T.id||"未命名船舶",rightIcons:W2(T),selected:(T==null?void 0:T.id)===(n==null?void 0:n.id),shipData:T});F.set("id",T.id);const I=Y2(F,L);return F.setStyle(I),F},M=T=>{const L=t.getView().getZoom();T.forEach(O=>{const F=h(O);if(F.setStyle(il(t,F)),r.addFeature(F),(n==null?void 0:n.id)==O.id||L&&L>=In.shipModelMin)if(f[O.id]){if(O.id&&p[O==null?void 0:O.id]){const I=p[O==null?void 0:O.id]||{},D=(I==null?void 0:I.blinkColors)||[],P=(I==null?void 0:I.shipState)||"",N=(O.cnname||O.enname||O.name||O.id||"未命名船舶")+"("+P+")",R={...O,name:N,blinking:f[O.id],blinkingColors:D||[]};D7(t,R)}}else{const I=k(O,T.length);s.addFeature(I)}})};return{render:m,selected:E,filter:_,blinking:C,clear:b,handleShipMapEvent:S,changeShipScale:g}},L7=t=>{const e=()=>t==null?void 0:t.getLayers(),n=i.ref("vector"),r=()=>n.value,o=c=>{n.value=c;const d=e();d&&(d==null||d.getArray().forEach(u=>{(u.className_==="vector"||u.className_==="satellite")&&u.setVisible(u.className_===c)}))},s=i.ref(!1);return{getLayers:e,getGreenTileVisible:()=>s.value,setGreenTileVisible:c=>{if(c!==s.value){if(c){const d=e();if(!d.getArray().find(f=>f.className_==="greenTile")){const f=new el({source:new rl({url:Ns.greenTile}),visible:c,zIndex:2,className:"greenTile"});d.push(f)}}else{const d=e(),u=d.getArray().find(f=>f.className_==="greenTile");u&&d.remove(u)}s.value=c}},getShowLayerType:r,setShowLayerType:o}},A7=()=>{const t=i.ref();return{setProps:r=>{t.value=r},getProps:()=>t.value}},F7=t=>{const e="zh-map-location-layer";let n,r,o=null,s=null;const a=h=>{if(!(!h||h.length===0)){if(r||(r=new Di),r.clear(),s){const y=h.find(g=>g.id===s.id);y?s=y:h.push(s)}h.forEach(y=>{l(y)}),n||(n=new go({className:e,source:r,zIndex:100}),t==null||t.addLayer(n))}},l=h=>{const y=t==null?void 0:t.getView().getZoom(),[g,b]=h.latLon.split(","),w=new Kt({geometry:new Xt(Jr([Number(g),Number(b)]))});w.setStyle(c(h,y,h.id===(s==null?void 0:s.id))),w.set("loactionData",h),r.addFeature(w)},c=(h,y,g)=>{const b={image:new ni({src:g&&h.selectedPath||h.defaultPath,scale:.5*y/10})};return h.name&&(b.text=new uo({text:h.name,font:"12px sans-serif",fill:new rn({color:"#000000"}),backgroundFill:new rn({color:"#FFFFFF"}),offsetY:30})),new _t(b)},d=()=>{if(o){const h=o.get("loactionData").id;r.getFeatures().forEach(y=>{y.get("loactionData").id!==h&&r.removeFeature(y)})}else r.clear()},u=()=>{var b;const h=o.get("loactionData"),y=(b=t==null?void 0:t.getView())==null?void 0:b.getZoom();r.getFeatures().forEach(w=>{w.get("loactionData").id===h.id&&(w==null||w.setStyle(c(h,y,!1)))}),s=null,o=null},f=h=>{h?(p(),m(h)):clearSelectedPort()},p=()=>{var h;if(o){const y=o.get("loactionData"),g=(h=t==null?void 0:t.getView())==null?void 0:h.getZoom();o.setStyle(c(y,g,!1))}},m=h=>{const y=r.getFeatures();s=h,o=y.find(g=>g.get("loactionData").id===h.id)};return{render:a,selected:f,clearSelected:u,clear:d}},Ef={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Sf extends Ei{constructor(e,n){super(e),this.feature=n}}function B7(t,e){const n=[];for(let r=0;r<e.length;++r){const s=e[r].getGeometry();G2(t,s,n)}return n}function vf(t,e){return no(t[0],t[1],e[0],e[1])}function ol(t,e){const n=t.length;return e<0?t[e+n]:e>=n?t[e-n]:t[e]}function xf(t,e,n){let r,o;e<n?(r=e,o=n):(r=n,o=e);const s=Math.ceil(r),a=Math.floor(o);if(s>a){const c=sl(t,r),d=sl(t,o);return vf(c,d)}let l=0;if(r<s){const c=sl(t,r),d=ol(t,s);l+=vf(c,d)}if(a<o){const c=ol(t,a),d=sl(t,o);l+=vf(c,d)}for(let c=s;c<a-1;++c){const d=ol(t,c),u=ol(t,c+1);l+=vf(d,u)}return l}function G2(t,e,n){if(e instanceof $n){kf(t,e.getCoordinates(),!1,n);return}if(e instanceof Ac){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)kf(t,r[o],!1,n);return}if(e instanceof oo){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)kf(t,r[o],!0,n);return}if(e instanceof Bc){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o){const a=r[o];for(let l=0,c=a.length;l<c;++l)kf(t,a[l],!0,n)}return}if(e instanceof hf){const r=e.getGeometries();for(let o=0;o<r.length;++o)G2(t,r[o],n);return}}const S0={index:-1,endIndex:NaN};function V7(t,e,n,r){const o=t[0],s=t[1];let a=1/0,l=-1,c=NaN;for(let f=0;f<e.targets.length;++f){const p=e.targets[f],m=p.coordinates;let h=1/0,y;for(let g=0;g<m.length-1;++g){const b=m[g],w=m[g+1],C=j2(o,s,b,w);C.squaredDistance<h&&(h=C.squaredDistance,y=g+C.along)}h<a&&(a=h,p.ring&&e.targetIndex===f&&(p.endIndex>p.startIndex?y<p.startIndex&&(y+=m.length):p.endIndex<p.startIndex&&y>p.startIndex&&(y-=m.length)),c=y,l=f)}const d=e.targets[l];let u=d.ring;if(e.targetIndex===l&&u){const f=sl(d.coordinates,c),p=n.getPixelFromCoordinate(f);EE(p,e.startPx)>r&&(u=!1)}if(u){const f=d.coordinates,p=f.length,m=d.startIndex,h=c;if(m<h){const y=xf(f,m,h);xf(f,m,h-p)<y&&(c-=p)}else{const y=xf(f,m,h);xf(f,m,h+p)<y&&(c+=p)}}return S0.index=l,S0.endIndex=c,S0}function kf(t,e,n,r){const o=t[0],s=t[1];for(let a=0,l=e.length-1;a<l;++a){const c=e[a],d=e[a+1],u=j2(o,s,c,d);if(u.squaredDistance===0){const f=a+u.along;r.push({coordinates:e,ring:n,startIndex:f,endIndex:f});return}}}const v0={along:0,squaredDistance:0};function j2(t,e,n,r){const o=n[0],s=n[1],a=r[0],l=r[1],c=a-o,d=l-s;let u=0,f=o,p=s;return(c!==0||d!==0)&&(u=Lt(((t-o)*c+(e-s)*d)/(c*c+d*d),0,1),f+=c*u,p+=d*u),v0.along=u,v0.squaredDistance=Pu(no(t,e,f,p),10),v0}function sl(t,e){const n=t.length;let r=Math.floor(e);const o=e-r;r>=n?r-=n:r<0&&(r+=n);let s=r+1;s>=n&&(s-=n);const a=t[r],l=a[0],c=a[1],d=t[s],u=d[0]-l,f=d[1]-c;return[l+u*o,c+f*o]}class Tf extends Xa{constructor(e){const n=e;n.stopDown||(n.stopDown=xa),super(n),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=z7(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:va,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let r=e.geometryFunction;if(!r){const o=this.mode_;if(o==="Circle")r=(s,a,l)=>{const c=a||new Lc([NaN,NaN]),d=Qr(s[0]),u=CE(d,Qr(s[s.length-1]));return c.setCenterAndRadius(d,Math.sqrt(u),this.geometryLayout_),c};else{let s;o==="Point"?s=Xt:o==="LineString"?s=$n:o==="Polygon"&&(s=oo),r=(a,l,c)=>(l?o==="Polygon"?a[0].length?l.setCoordinates([a[0].concat([a[0][0]])],this.geometryLayout_):l.setCoordinates([],this.geometryLayout_):l.setCoordinates(a,this.geometryLayout_):l=new s(a,this.geometryLayout_),l)}}this.geometryFunction_=r,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new go({source:new Di({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:$7(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:s0,this.freehandCondition_,e.freehand?this.freehandCondition_=o0:this.freehandCondition_=e.freehandCondition?e.freehandCondition:p2,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(e0.ACTIVE,this.updateState_)}setTrace(e){let n;e?e===!0?n=o0:n=e:n=HY,this.traceCondition_=n}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===Ve.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let n=e.type===bt.POINTERMOVE,r=!0;return!this.freehand_&&this.lastDragTime_&&e.type===bt.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,n=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===bt.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),r=!1):this.freehand_&&e.type===bt.POINTERDOWN?r=!1:n&&this.getPointerCount()<2?(r=e.type===bt.POINTERMOVE,r&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===bt.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===bt.DBLCLICK&&(r=!1),super.handleEvent(e)&&r}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new yo(bt.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const n=this.getMap(),r=n.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),o=n.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),s=Am([r,o]),a=this.traceSource_.getFeaturesInExtent(s);if(a.length===0)return;const l=B7(e.coordinate,a);l.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:l,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,n){const r=e.startIndex<=e.endIndex,o=e.startIndex<=n;r===o?r&&n>e.endIndex||!r&&n<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,n):(r&&n<e.endIndex||!r&&n>e.endIndex)&&this.removeTracedCoordinates_(n,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,n))}removeTracedCoordinates_(e,n){if(e===n)return;let r=0;if(e<n){const o=Math.ceil(e);let s=Math.floor(n);s===n&&(s-=1),r=s-o+1}else{const o=Math.floor(e);let s=Math.ceil(n);s===n&&(s+=1),r=o-s+1}r>0&&this.removeLastPoints_(r)}addTracedCoordinates_(e,n,r){if(n===r)return;const o=[];if(n<r){const s=Math.ceil(n);let a=Math.floor(r);a===r&&(a-=1);for(let l=s;l<=a;++l)o.push(ol(e.coordinates,l))}else{const s=Math.floor(n);let a=Math.ceil(r);a===r&&(a+=1);for(let l=s;l>=a;--l)o.push(ol(e.coordinates,l))}o.length&&this.appendCoordinates(o)}updateTrace_(e){const n=this.traceState_;if(!n.active||n.targetIndex===-1&&EE(n.startPx,e.pixel)<this.snapTolerance_)return;const r=V7(e.coordinate,n,this.getMap(),this.snapTolerance_);if(n.targetIndex!==r.index){if(n.targetIndex!==-1){const c=n.targets[n.targetIndex];this.removeTracedCoordinates_(c.startIndex,c.endIndex)}const l=n.targets[r.index];this.addTracedCoordinates_(l,l.startIndex,r.endIndex)}else{const l=n.targets[n.targetIndex];this.addOrRemoveTracedCoordinates_(l,r.endIndex)}n.targetIndex=r.index;const o=n.targets[n.targetIndex];o.endIndex=r.endIndex;const s=sl(o.coordinates,o.endIndex),a=this.getMap().getPixelFromCoordinate(s);e.coordinate=s,e.pixel=[Math.round(a[0]),Math.round(a[1])]}handleUpEvent(e){let n=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(e);const r=this.traceState_.active;if(this.toggleTraceState_(e),this.shouldHandle_){const o=!this.finishCoordinate_;o&&this.startDrawing_(e.coordinate),!o&&this.freehand_?this.finishDrawing():!this.freehand_&&(!o||this.mode_==="Point")&&(this.atFinish_(e.pixel,r)?this.finishCondition_(e)&&this.finishDrawing():this.addToDrawing_(e.coordinate)),n=!1}else this.freehand_&&this.abortDrawing()}return!n&&this.stopClick_&&e.preventDefault(),n}handlePointerMove_(e){if(this.pointerType_=e.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const n=this.downPx_,r=e.pixel,o=n[0]-r[0],s=n[1]-r[1],a=o*o+s*s;if(this.shouldHandle_=this.freehand_?a>this.squaredClickTolerance_:a<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,n){let r=!1;if(this.sketchFeature_){let o=!1,s=[this.finishCoordinate_];const a=this.mode_;if(a==="Point")r=!0;else if(a==="Circle")r=this.sketchCoords_.length===2;else if(a==="LineString")o=!n&&this.sketchCoords_.length>this.minPoints_;else if(a==="Polygon"){const l=this.sketchCoords_;o=l[0].length>this.minPoints_,s=[l[0][0],l[0][l[0].length-2]],n?s=[l[0][0]]:s=[l[0][0],l[0][l[0].length-2]]}if(o){const l=this.getMap();for(let c=0,d=s.length;c<d;c++){const u=s[c],f=l.getPixelFromCoordinate(u),p=e[0]-f[0],m=e[1]-f[1],h=this.freehand_?1:this.snapTolerance_;if(r=Math.sqrt(p*p+m*m)<=h,r){this.finishCoordinate_=u;break}}}}return r}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Kt(new Xt(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Kt);const n=e.getLinearRing(0);let r=this.sketchLine_.getGeometry();r?(r.setFlatCoordinates(n.getLayout(),n.getFlatCoordinates()),r.changed()):(r=new $n(n.getFlatCoordinates(),n.getLayout()),this.sketchLine_.setGeometry(r))}startDrawing_(e){const n=this.getMap().getView().getProjection(),r=pc(this.geometryLayout_);for(;e.length<r;)e.push(0);this.finishCoordinate_=e,this.mode_==="Point"?this.sketchCoords_=e.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new Kt(new $n(this.sketchLineCoords_)));const o=this.geometryFunction_(this.sketchCoords_,void 0,n);this.sketchFeature_=new Kt,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(o),this.updateSketchFeatures_(),this.dispatchEvent(new Sf(Ef.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const n=this.getMap(),r=this.sketchFeature_.getGeometry(),o=n.getView().getProjection(),s=pc(this.geometryLayout_);let a,l;for(;e.length<s;)e.push(0);this.mode_==="Point"?l=this.sketchCoords_:this.mode_==="Polygon"?(a=this.sketchCoords_[0],l=a[a.length-1],this.atFinish_(n.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(a=this.sketchCoords_,l=a[a.length-1]),l[0]=e[0],l[1]=e[1],this.geometryFunction_(this.sketchCoords_,r,o),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(e),r.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(r):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(e){const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection();let o,s;const a=this.mode_;return a==="LineString"||a==="Circle"?(this.finishCoordinate_=e.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),this.geometryFunction_(s,n,r)):a==="Polygon"&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),o&&(this.finishCoordinate_=s[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),o?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),o=this.mode_;for(let s=0;s<e;++s){let a;if(o==="LineString"||o==="Circle"){if(a=this.sketchCoords_,a.splice(-2,1),a.length>=2){this.finishCoordinate_=a[a.length-2].slice();const l=this.finishCoordinate_.slice();a[a.length-1]=l,this.createOrUpdateSketchPoint_(l)}this.geometryFunction_(a,n,r),n.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(n)}else if(o==="Polygon"){a=this.sketchCoords_[0],a.splice(-2,1);const l=this.sketchLine_.getGeometry();if(a.length>=2){const c=a[a.length-2].slice();a[a.length-1]=c,this.createOrUpdateSketchPoint_(c)}l.setCoordinates(a),this.geometryFunction_(this.sketchCoords_,n,r)}if(a.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return null;let n=this.sketchCoords_;const r=e.getGeometry(),o=this.getMap().getView().getProjection();return this.mode_==="LineString"?(n.pop(),this.geometryFunction_(n,r,o)):this.mode_==="Polygon"&&(n[0].pop(),this.geometryFunction_(n,r,o),n=r.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new Fc([n])):this.type_==="MultiLineString"?e.setGeometry(new Ac([n])):this.type_==="MultiPolygon"&&e.setGeometry(new Bc([n])),this.dispatchEvent(new Sf(Ef.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e),e}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new Sf(Ef.DRAWABORT,e))}appendCoordinates(e){const n=this.mode_,r=!this.sketchFeature_;r&&this.startDrawing_(e[0]);let o;if(n==="LineString"||n==="Circle")o=this.sketchCoords_;else if(n==="Polygon")o=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;r&&o.shift(),o.pop();for(let a=0;a<e.length;a++)this.addToDrawing_(e[a]);const s=e[e.length-1];this.sketchFeature_=this.addToDrawing_(s),this.modifyDrawing_(s)}extend(e){const r=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=r.getCoordinates();const o=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=o.slice(),this.sketchCoords_.push(o.slice()),this.sketchPoint_=new Kt(new Xt(o)),this.updateSketchFeatures_(),this.dispatchEvent(new Sf(Ef.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const e=[];this.sketchFeature_&&e.push(this.sketchFeature_),this.sketchLine_&&e.push(this.sketchLine_),this.sketchPoint_&&e.push(this.sketchPoint_);const n=this.overlay_.getSource();n.clear(!0),n.addFeatures(e)}updateState_(){const e=this.getMap(),n=this.getActive();(!e||!n)&&this.abortDrawing(),this.overlay_.setMap(n?e:null)}}function $7(){const t=H9();return function(e,n){return t[e.getGeometry().getType()]}}function z7(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}const W7=t=>{t.getInteractions().forEach(e=>{e instanceof n0&&e.setActive(!1)})},Y7=t=>{t.getInteractions().forEach(e=>{e instanceof n0&&e.setActive(!0)})},Xo=(t,e)=>{const n=t.getViewport();n&&(n.style.cursor=e)},G7=(t,e)=>{const n=i.ref([]),r=i.ref("km"),o=k=>{r.value=k};let s;const a=i.ref(!1),l=()=>{Xo(t,"crosshair"),u(),W7(t),t.on("pointermove",m),t.getViewport().addEventListener("mouseout",()=>{s&&s.classList.add("hidden")}),y(),a.value=!0};let c,d;const u=()=>{c=new Di,d=new go({source:c,zIndex:1e3,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),t==null||t.addLayer(d)};let f,p;const m=k=>{if(k.dragging)return;let M="点击选择起点";f&&(M="单击继续,双击结束"),s&&(s.innerHTML=M,p.setPosition(k.coordinate),s.classList.remove("hidden"))};let h;const y=()=>{h=new Tf({source:c,type:"LineString",style:new _t({fill:new rn({color:"rgba(255, 255, 255, 0.2)"}),stroke:new zn({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new co({radius:5,stroke:new zn({color:"rgba(0, 0, 0, 0.7)"}),fill:new rn({color:"rgba(255, 255, 255, 0.2)"})})}),condition:M=>M.originalEvent.target.tagName!=="DIV"}),t==null||t.addInteraction(h),C(),_();let k;h.on("drawstart",function(M){var L;f=M.feature,f.set("randomId",g());let T;k=(L=f.getGeometry())==null?void 0:L.on("change",function(O){const F=O.target,I=H2(F,r.value);T=F.getLastCoordinate(),b&&I&&(b.innerHTML=I),w.setPosition(T)})}),h.on("drawend",function(){var M,T,L;if(b&&(b.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),b!=null&&b.innerHTML){const O=(f==null?void 0:f.get("randomId"))||g();n.value.push({id:O,value:b==null?void 0:b.innerHTML}),b.innerHTML=`${b.innerHTML}<div class="ol-tooltip-delete-button" data-id="${O}"><i class="map-iconfont icon-delete"></i></div>`}(M=document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button"))==null||M.addEventListener("click",O=>{var I;O.preventDefault(),O.stopPropagation();const F=(I=O.target)==null?void 0:I.getAttribute("data-id");F&&S(F)}),w.setOffset([0,-7]),f=null,b=null,C(),k&&vu(k),(L=(T=e.getProps())==null?void 0:T.lineDrawEnd)==null||L.call(T,n.value)})},g=()=>Math.random().toString(36).substring(2,9);let b,w;const C=()=>{b!=null&&b.parentNode&&b.parentNode.removeChild(b),b=document.createElement("div"),b.className="ol-tooltip ol-tooltip-measure",w=new Os({element:b,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),t==null||t.addOverlay(w)},_=()=>{s!=null&&s.parentNode&&s.parentNode.removeChild(s),s=document.createElement("div"),s.className="ol-tooltip hidden",p=new Os({element:s,offset:[15,0],positioning:"center-left"}),t==null||t.addOverlay(p)},E=()=>{n.value.forEach((k,M)=>{var O,F;const T=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");T[M]&&((F=(O=T[M])==null?void 0:O.parentNode)==null||F.removeChild(T[M]));const L=c.getFeatures();L[M]&&c.removeFeature(L[M])}),v(),Y7(t),a.value=!1,Xo(t,"grab")},S=k=>{var T,L,O,F;const M=n.value.findIndex(I=>I.id===k);if(M!==-1){n.value.splice(M,1);const I=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");I[M]&&((L=(T=I[M])==null?void 0:T.parentNode)==null||L.removeChild(I[M]));const D=c.getFeatures();D[M]&&c.removeFeature(D[M])}(F=(O=e.getProps())==null?void 0:O.lineDrawEnd)==null||F.call(O,n.value)},v=()=>{if(n.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach(k=>{var M;(M=k==null?void 0:k.parentNode)==null||M.removeChild(k)}),c==null||c.clear(),h){const k=t.getInteractions().getArray().find(M=>ut(M)===ut(h));k&&t.removeInteraction(k)}t.removeLayer(d),s!=null&&s.parentNode&&s.parentNode.removeChild(s),b!=null&&b.parentNode&&b.parentNode.removeChild(b)};return{open:l,close:E,deleteLine:S,setUnit:o,getState:()=>a.value}},H2=(t,e)=>{const r=Au(t);let o="";switch(e){case"m":o=`${Math.round(r*100)/100} m`;break;case"km":o=`${Math.round(r/1e3*100)/100} km`;break;case"nm":o=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return o},j7=(t,e)=>{let n,r,o="close";const s=()=>{v(),o="open",a(),Xo(t,"crosshair")},a=()=>{d(),w(),E(),h()};let l=null,c=null;const d=()=>{if(l&&c)return;const k=new Di,M=new go({source:k,style:new _t({stroke:new zn({color:"#fbcc33",width:2})}),zIndex:1e3});l=M,c=k,t.on("pointermove",f),t.addLayer(M),t.on(["dblclick"],function(T){p&&(T.stopPropagation(),T.preventDefault())})};let u;const f=k=>{if(k.dragging)return;const M=u?"单击继续,双击结束":"点击选择起点";C&&(C.innerHTML=M,_.setPosition(k.coordinate))};let p,m=!1;const h=()=>{if(n){C!=null&&C.parentNode&&C.parentNode.removeChild(C);const k=n.getGeometry();if(!k)return;const M=y(k,"nm");g&&(g.innerHTML=`
192
+ `;return new _t({image:new ni({src:`data:image/svg+xml;utf8,${encodeURIComponent(s)}`,scale:r,anchorXUnits:"fraction",anchorYUnits:"fraction"})})};function M7(t,e,n,r){if(e){const o=new Os({element:n,positioning:"top-left",id:"label-"+(r==null?void 0:r.id),offset:[20,-20],autoPan:!1,position:e,className:r!=null&&r.blinking?"ship-label-overlay-blinking":"ship-label-overlay"});o.set("class","zh-map-ship-overlay"),t.addOverlay(o)}}const D7=(t,e)=>{const{lon:n,lat:r,blinking:o}=e,s=z2(e);n&&r&&M7(t,Jr([n,r]),s,{...e,blinking:o})},z2=t=>{const e=document.createElement("div");e.className="ship-overlay-box",e.style.position="relative";const{lon:n,lat:r,blinking:o,blinkingColors:s,name:a}=t,l=i.createVNode({setup(){return x7({position:[n+.002,r+.002],selected:o,name:a,colors:s||[],existDevice:t==null?void 0:t.existDevice,existMobile:t==null?void 0:t.existMobile,existWaterGauge:t==null?void 0:t.existWaterGauge})}});return i.render(l,e),e},W2=t=>{const e=[];return t.existDevice&&e.push("&#xe687;"),t.existMobile&&e.push("&#xe688;"),t.existWaterGauge&&e.push("&#xe686;"),e};function I7(){const t=["left-top","left-middle","left-bottom","right-top","right-middle","right-bottom"];return t[Math.floor(Math.random()*t.length)]}const P7=window.devicePixelRatio||1,C0=new Map;let zc=null,E0=null;function O7(t,e,n="left-bottom",r=10){const o=`${t}-${e.join(",")}-${n}-${r}`;if(C0.has(o))return C0.get(o);if(!zc){zc=document.createElement("canvas");try{E0=zc.getContext("2d",{willReadFrequently:!0})}catch(D){console.log("e",D),E0=zc.getContext("2d")}}const s=zc,a=E0;if(!a)return"";s.width=0,s.height=0;const l=2,c=4,d=16,u=window.devicePixelRatio||1,f="500 12px Arial",p="12px map-iconfont";a.font=f;const h=a.measureText(t).width;a.font=p;const y=e.map(D=>({width:a.measureText(Ls(D)).width,height:14})),g=y.reduce((D,P)=>D+P.width,0),b=e.length*r,w=c+h+g+b+c,C=l+14+l*2;let _,E,S=0,v=0,x=0,k=0,M=0,T=0;switch(_=d+w,n){case"right-top":E=d+C,S=0,v=d+C,x=d,k=0,M=d,T=0;break;case"right-middle":E=C,S=0,v=C/2,x=d,k=C/2,M=d,T=0;break;case"right-bottom":E=d+C,S=0,v=0,x=d,k=d,M=d,T=d;break;case"left-top":E=d+C,S=w,v=d,x=w+d,k=C+d,M=0,T=0;break;case"left-middle":E=C,S=w,v=C/2,x=w+d,k=C/2,M=0,T=0;break;case"left-bottom":E=d+C,S=w,v=C,x=w+d,k=0,M=0,T=d;break}E=E+l,s.width=Math.round(_*u),s.height=Math.round(E*u),a.scale(u,u),a.clearRect(0,0,_,E),a.beginPath(),a.moveTo(S,v),a.lineTo(x,k),a.strokeStyle="#FFF",a.lineWidth=1,a.stroke(),a.fillStyle="#FFF",a.fillRect(M,T,w,C),a.font=f,a.textBaseline="middle";const L=T+l/2+C/2;a.strokeStyle="#ffffff",a.lineWidth=1,a.strokeText(t,M+c,L),a.fillStyle="#000000",a.fillText(t,M+c,L),a.font=p,a.fillStyle="#3370ff";let O=M+c+h+r;const F=T+C/2;e.length>0&&e.forEach((D,P)=>{a.fillText(Ls(D),O,F),O+=y[P].width+r});const I=s.toDataURL("image/png");return C0.set(o,I),I}const Y2=(t,e)=>{const{name:n,rightIcons:r,selected:o}=t.getProperties(),s=e!==1?I7():"right-top",a=O7(n,r,s);let l=[0,0];switch(s){case"right-top":l=[0,1];break;case"right-middle":l=[0,.5];break;case"right-bottom":l=[0,0];break;case"left-top":l=[1,1];break;case"left-middle":l=[1,.5];break;case"left-bottom":l=[1,0];break}return new _t({image:new ni({src:a,anchor:l,displacement:[0,0],scale:1/P7,anchorXUnits:"fraction",anchorYUnits:"fraction"}),zIndex:o?100:10})},N7=t=>{let e=null,n=null;const r=new Di,o=new v7({source:r,className:"zh-map--ship-layer",renderBuffer:300,zIndex:101,properties:{layerType:or.SHIP}}),s=new Di,a=new go({source:s,className:"zh-map--ship-label-layer",zIndex:102,updateWhileInteracting:!1,updateWhileAnimating:!1,declutter:!0}),l=new Di,c=new go({source:l,className:"zh-map--ship-selected-layer",zIndex:999});t==null||t.addLayer(o),t==null||t.addLayer(a),t==null||t.addLayer(c);let d=null,u="",f={},p={};const m=T=>{if(!T||!t)return;const L=(n==null?void 0:n.id)||(e==null?void 0:e.get("id"));if(n){const O=T.filter(F=>F.id===L);O.length===0?T.push(n):n=O[0]}b(),M(T),y()},h=T=>{var R;const L=(n==null?void 0:n.id)||(e==null?void 0:e.get("id")),O=Jr([T==null?void 0:T.lon,T==null?void 0:T.lat]),F=((R=p[T.id])==null?void 0:R.blinkColors)||[],D=F[F.length-1]||T.fill||"#04C900",P=k7(T),N=new Kt({geometry:new Xt(O),shipData:T,id:T.id,name:T.cnname||T.enname||T.name||T.id||"未命名船舶",selected:T.id===L,rightIcons:W2(T),color:D,direct:P,isHighlight:!1});return N.set("clickGeometry",new Lc(O)),N},y=()=>{if(n&&t&&n){l.getFeatures().length>0&&l.clear();const T=Jr([n==null?void 0:n.lon,n==null?void 0:n.lat]),L=new Kt({geometry:new Xt(T),id:n.id});L.setStyle(R7(t,n)),l.addFeature(L)}},g=T=>{if(T==="start"){const L=()=>{const O=l.getFeatures();r.getFeatures().forEach(F=>{var D,P;const I=il(t,F);if(F.setStyle(I),F.get("id")===(n==null?void 0:n.id)&&O&&O[0]){const N=O[0],R=N==null?void 0:N.getStyle();if(R&&(R!=null&&R.getImage())){const A=(D=I.getImage())==null?void 0:D.getScale();A&&((P=R.getImage())==null||P.setScale(A))}}}),d=requestAnimationFrame(L)};L()}T==="end"&&d&&(cancelAnimationFrame(d),d=null)},b=()=>{t&&r&&(w(),r.clear(),s.clear(),l.clear(),g("end"))},w=T=>{const L=t.getOverlays().getArray().filter(O=>O.get("class")=="zh-map-ship-overlay");if(L&&L.length>0){for(let O=0;O<L.length;O++)if(L[O].get("class")!=="ship-overlay-selected"){const F=L[O];console.log("overlay---",F),F.setPosition(void 0),t.removeOverlay(F),F.dispose()}}},C=(T,L)=>{f=T,p=L;const O=t.getOverlays().getArray(),F=r.getFeatures();for(const I in f){const D=f[I],P=O.find(R=>(R==null?void 0:R.getId())==="label-"+I),N=F.find(R=>I===R.get("id"));if(P&&N){const R=L[I].blinkColors||[],{shipData:A,name:B,color:Y}=N.getProperties();N.set("blinking",D),R[(R==null?void 0:R.length)-1]&&Y!==R[(R==null?void 0:R.length)-1]&&(N.set("color",R[(R==null?void 0:R.length)-1]||""),N.setStyle(il(t,N)));const z={...A,blinking:D,blinkingColors:R||[],name:B+"("+L[I].shipState+")"},W=P.getElement(),Z=z2(z);W&&W!==Z&&P.setElement(Z)}}},_=T=>{if(!t)return;const L=r.getFeatures(),O=s.getFeatures(),F=e?e.get("id"):"",I=L.filter(R=>R.get("id")!==F),D=O==null?void 0:O.filter(R=>R.get("id")!==F),P=new Map;T.forEach(R=>{P.set(R.id,!0)});const N=t.getOverlays().getArray();I.forEach(R=>{const A=R.get("id");if(!P.has(A))R.setStyle([]);else{const Y=R.getStyle();(Y==null?void 0:Y.length)==0&&R.setStyle(il(t,R))}const B=N.find(Y=>Y.getId()==="label-"+A);B&&B.setPosition(void 0)}),D.forEach(R=>{const A=R.get("id");if(!P.has(A))R.setStyle([]);else{const B=R.getStyle();(B==null?void 0:B.length)==0&&R.setStyle(Y2(R,T.length))}})},E=T=>{if(T){console.log("选中",T);const L=r.getFeatures().find(F=>F.get("id")===T.id),O=s.getFeatures().find(F=>F.get("id")===T.id);L&&(e=L),O&&O.set("selected",!0),n=T,y()}else console.log("取消选中"),n=null,e=null,x()},S=Li((T,L,O)=>{try{if(T){const F=T.get("shipData"),I=T.get("id");if(t.getTargetElement().style.cursor=I?"pointer":"",L==="click"&&(E(F),O&&O(I)),L==="hover"){u&&u!==I&&v(),u=I;const D=r.getFeatures().find(P=>P.get("id")===u);D==null||D.set("isHighlight",!0),D==null||D.setStyle(il(t,D))}}else t.getTargetElement().style.cursor="",v()}catch(F){console.log("handleShipMapEvent",F)}},10),v=()=>{const T=u?r.getFeatures().find(L=>L.get("id")===u):null;u=null,T==null||T.set("isHighlight",!1),T==null||T.setStyle(il(t,T))},x=()=>{try{l.clear()}catch(T){console.log(T)}},k=(T,L)=>{const O=Jr([T==null?void 0:T.lon,T==null?void 0:T.lat]),F=new Kt({geometry:new Xt(O),name:T.cnname||T.enname||T.name||T.id||"未命名船舶",rightIcons:W2(T),selected:(T==null?void 0:T.id)===(n==null?void 0:n.id),shipData:T});F.set("id",T.id);const I=Y2(F,L);return F.setStyle(I),F},M=T=>{const L=t.getView().getZoom();T.forEach(O=>{const F=h(O);if(F.setStyle(il(t,F)),r.addFeature(F),(n==null?void 0:n.id)==O.id||L&&L>=In.shipModelMin)if(f[O.id]){if(O.id&&p[O==null?void 0:O.id]){const I=p[O==null?void 0:O.id]||{},D=(I==null?void 0:I.blinkColors)||[],P=(I==null?void 0:I.shipState)||"",N=(O.cnname||O.enname||O.name||O.id||"未命名船舶")+"("+P+")",R={...O,name:N,blinking:f[O.id],blinkingColors:D||[]};D7(t,R)}}else{const I=k(O,T.length);s.addFeature(I)}})};return{render:m,selected:E,filter:_,blinking:C,clear:b,handleShipMapEvent:S,changeShipScale:g}},L7=t=>{const e=()=>t==null?void 0:t.getLayers(),n=i.ref("vector"),r=()=>n.value,o=c=>{n.value=c;const d=e();d&&(d==null||d.getArray().forEach(u=>{(u.className_==="vector"||u.className_==="satellite")&&u.setVisible(u.className_===c)}))},s=i.ref(!1);return{getLayers:e,getGreenTileVisible:()=>s.value,setGreenTileVisible:c=>{if(c!==s.value){if(c){const d=e();if(!d.getArray().find(f=>f.className_==="greenTile")){const f=new el({source:new rl({url:Ns.greenTile}),visible:c,zIndex:2,className:"greenTile"});d.push(f)}}else{const d=e(),u=d.getArray().find(f=>f.className_==="greenTile");u&&d.remove(u)}s.value=c}},getShowLayerType:r,setShowLayerType:o}},A7=()=>{const t=i.ref();return{setProps:r=>{t.value=r},getProps:()=>t.value}},F7=t=>{const e="zh-map-location-layer";let n,r,o=null,s=null;const a=h=>{if(!(!h||h.length===0)){if(r||(r=new Di),r.clear(),s){const y=h.find(g=>g.id===s.id);y?s=y:h.push(s)}h.forEach(y=>{l(y)}),n||(n=new go({className:e,source:r,zIndex:100}),t==null||t.addLayer(n))}},l=h=>{const y=t==null?void 0:t.getView().getZoom(),[g,b]=h.latLon.split(","),w=new Kt({geometry:new Xt(Jr([Number(g),Number(b)]))});w.setStyle(c(h,y,h.id===(s==null?void 0:s.id))),w.set("loactionData",h),r.addFeature(w)},c=(h,y,g)=>{const b={image:new ni({src:g&&h.selectedPath||h.defaultPath,scale:.5*y/10})};return h.name&&(b.text=new uo({text:h.name,font:"12px sans-serif",fill:new rn({color:"#000000"}),backgroundFill:new rn({color:"#FFFFFF"}),offsetY:30})),new _t(b)},d=()=>{if(o){const h=o.get("loactionData").id;r.getFeatures().forEach(y=>{y.get("loactionData").id!==h&&r.removeFeature(y)})}else r.clear()},u=()=>{var b;const h=o.get("loactionData"),y=(b=t==null?void 0:t.getView())==null?void 0:b.getZoom();r.getFeatures().forEach(w=>{w.get("loactionData").id===h.id&&(w==null||w.setStyle(c(h,y,!1)))}),s=null,o=null},f=h=>{h?(p(),m(h)):clearSelectedPort()},p=()=>{var h;if(o){const y=o.get("loactionData"),g=(h=t==null?void 0:t.getView())==null?void 0:h.getZoom();o.setStyle(c(y,g,!1))}},m=h=>{const y=r.getFeatures();s=h,o=y.find(g=>g.get("loactionData").id===h.id)};return{render:a,selected:f,clearSelected:u,clear:d}},Ef={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Sf extends Ei{constructor(e,n){super(e),this.feature=n}}function B7(t,e){const n=[];for(let r=0;r<e.length;++r){const s=e[r].getGeometry();G2(t,s,n)}return n}function vf(t,e){return no(t[0],t[1],e[0],e[1])}function ol(t,e){const n=t.length;return e<0?t[e+n]:e>=n?t[e-n]:t[e]}function xf(t,e,n){let r,o;e<n?(r=e,o=n):(r=n,o=e);const s=Math.ceil(r),a=Math.floor(o);if(s>a){const c=sl(t,r),d=sl(t,o);return vf(c,d)}let l=0;if(r<s){const c=sl(t,r),d=ol(t,s);l+=vf(c,d)}if(a<o){const c=ol(t,a),d=sl(t,o);l+=vf(c,d)}for(let c=s;c<a-1;++c){const d=ol(t,c),u=ol(t,c+1);l+=vf(d,u)}return l}function G2(t,e,n){if(e instanceof $n){kf(t,e.getCoordinates(),!1,n);return}if(e instanceof Ac){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)kf(t,r[o],!1,n);return}if(e instanceof oo){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)kf(t,r[o],!0,n);return}if(e instanceof Bc){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o){const a=r[o];for(let l=0,c=a.length;l<c;++l)kf(t,a[l],!0,n)}return}if(e instanceof hf){const r=e.getGeometries();for(let o=0;o<r.length;++o)G2(t,r[o],n);return}}const S0={index:-1,endIndex:NaN};function V7(t,e,n,r){const o=t[0],s=t[1];let a=1/0,l=-1,c=NaN;for(let f=0;f<e.targets.length;++f){const p=e.targets[f],m=p.coordinates;let h=1/0,y;for(let g=0;g<m.length-1;++g){const b=m[g],w=m[g+1],C=j2(o,s,b,w);C.squaredDistance<h&&(h=C.squaredDistance,y=g+C.along)}h<a&&(a=h,p.ring&&e.targetIndex===f&&(p.endIndex>p.startIndex?y<p.startIndex&&(y+=m.length):p.endIndex<p.startIndex&&y>p.startIndex&&(y-=m.length)),c=y,l=f)}const d=e.targets[l];let u=d.ring;if(e.targetIndex===l&&u){const f=sl(d.coordinates,c),p=n.getPixelFromCoordinate(f);EE(p,e.startPx)>r&&(u=!1)}if(u){const f=d.coordinates,p=f.length,m=d.startIndex,h=c;if(m<h){const y=xf(f,m,h);xf(f,m,h-p)<y&&(c-=p)}else{const y=xf(f,m,h);xf(f,m,h+p)<y&&(c+=p)}}return S0.index=l,S0.endIndex=c,S0}function kf(t,e,n,r){const o=t[0],s=t[1];for(let a=0,l=e.length-1;a<l;++a){const c=e[a],d=e[a+1],u=j2(o,s,c,d);if(u.squaredDistance===0){const f=a+u.along;r.push({coordinates:e,ring:n,startIndex:f,endIndex:f});return}}}const v0={along:0,squaredDistance:0};function j2(t,e,n,r){const o=n[0],s=n[1],a=r[0],l=r[1],c=a-o,d=l-s;let u=0,f=o,p=s;return(c!==0||d!==0)&&(u=Lt(((t-o)*c+(e-s)*d)/(c*c+d*d),0,1),f+=c*u,p+=d*u),v0.along=u,v0.squaredDistance=Pu(no(t,e,f,p),10),v0}function sl(t,e){const n=t.length;let r=Math.floor(e);const o=e-r;r>=n?r-=n:r<0&&(r+=n);let s=r+1;s>=n&&(s-=n);const a=t[r],l=a[0],c=a[1],d=t[s],u=d[0]-l,f=d[1]-c;return[l+u*o,c+f*o]}class Tf extends Xa{constructor(e){const n=e;n.stopDown||(n.stopDown=xa),super(n),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=z7(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:va,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let r=e.geometryFunction;if(!r){const o=this.mode_;if(o==="Circle")r=(s,a,l)=>{const c=a||new Lc([NaN,NaN]),d=Qr(s[0]),u=CE(d,Qr(s[s.length-1]));return c.setCenterAndRadius(d,Math.sqrt(u),this.geometryLayout_),c};else{let s;o==="Point"?s=Xt:o==="LineString"?s=$n:o==="Polygon"&&(s=oo),r=(a,l,c)=>(l?o==="Polygon"?a[0].length?l.setCoordinates([a[0].concat([a[0][0]])],this.geometryLayout_):l.setCoordinates([],this.geometryLayout_):l.setCoordinates(a,this.geometryLayout_):l=new s(a,this.geometryLayout_),l)}}this.geometryFunction_=r,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new go({source:new Di({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:$7(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:s0,this.freehandCondition_,e.freehand?this.freehandCondition_=o0:this.freehandCondition_=e.freehandCondition?e.freehandCondition:p2,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(e0.ACTIVE,this.updateState_)}setTrace(e){let n;e?e===!0?n=o0:n=e:n=HY,this.traceCondition_=n}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===Ve.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let n=e.type===bt.POINTERMOVE,r=!0;return!this.freehand_&&this.lastDragTime_&&e.type===bt.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,n=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===bt.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),r=!1):this.freehand_&&e.type===bt.POINTERDOWN?r=!1:n&&this.getPointerCount()<2?(r=e.type===bt.POINTERMOVE,r&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===bt.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===bt.DBLCLICK&&(r=!1),super.handleEvent(e)&&r}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new yo(bt.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const n=this.getMap(),r=n.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),o=n.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),s=Am([r,o]),a=this.traceSource_.getFeaturesInExtent(s);if(a.length===0)return;const l=B7(e.coordinate,a);l.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:l,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,n){const r=e.startIndex<=e.endIndex,o=e.startIndex<=n;r===o?r&&n>e.endIndex||!r&&n<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,n):(r&&n<e.endIndex||!r&&n>e.endIndex)&&this.removeTracedCoordinates_(n,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,n))}removeTracedCoordinates_(e,n){if(e===n)return;let r=0;if(e<n){const o=Math.ceil(e);let s=Math.floor(n);s===n&&(s-=1),r=s-o+1}else{const o=Math.floor(e);let s=Math.ceil(n);s===n&&(s+=1),r=o-s+1}r>0&&this.removeLastPoints_(r)}addTracedCoordinates_(e,n,r){if(n===r)return;const o=[];if(n<r){const s=Math.ceil(n);let a=Math.floor(r);a===r&&(a-=1);for(let l=s;l<=a;++l)o.push(ol(e.coordinates,l))}else{const s=Math.floor(n);let a=Math.ceil(r);a===r&&(a+=1);for(let l=s;l>=a;--l)o.push(ol(e.coordinates,l))}o.length&&this.appendCoordinates(o)}updateTrace_(e){const n=this.traceState_;if(!n.active||n.targetIndex===-1&&EE(n.startPx,e.pixel)<this.snapTolerance_)return;const r=V7(e.coordinate,n,this.getMap(),this.snapTolerance_);if(n.targetIndex!==r.index){if(n.targetIndex!==-1){const c=n.targets[n.targetIndex];this.removeTracedCoordinates_(c.startIndex,c.endIndex)}const l=n.targets[r.index];this.addTracedCoordinates_(l,l.startIndex,r.endIndex)}else{const l=n.targets[n.targetIndex];this.addOrRemoveTracedCoordinates_(l,r.endIndex)}n.targetIndex=r.index;const o=n.targets[n.targetIndex];o.endIndex=r.endIndex;const s=sl(o.coordinates,o.endIndex),a=this.getMap().getPixelFromCoordinate(s);e.coordinate=s,e.pixel=[Math.round(a[0]),Math.round(a[1])]}handleUpEvent(e){let n=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(e);const r=this.traceState_.active;if(this.toggleTraceState_(e),this.shouldHandle_){const o=!this.finishCoordinate_;o&&this.startDrawing_(e.coordinate),!o&&this.freehand_?this.finishDrawing():!this.freehand_&&(!o||this.mode_==="Point")&&(this.atFinish_(e.pixel,r)?this.finishCondition_(e)&&this.finishDrawing():this.addToDrawing_(e.coordinate)),n=!1}else this.freehand_&&this.abortDrawing()}return!n&&this.stopClick_&&e.preventDefault(),n}handlePointerMove_(e){if(this.pointerType_=e.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const n=this.downPx_,r=e.pixel,o=n[0]-r[0],s=n[1]-r[1],a=o*o+s*s;if(this.shouldHandle_=this.freehand_?a>this.squaredClickTolerance_:a<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,n){let r=!1;if(this.sketchFeature_){let o=!1,s=[this.finishCoordinate_];const a=this.mode_;if(a==="Point")r=!0;else if(a==="Circle")r=this.sketchCoords_.length===2;else if(a==="LineString")o=!n&&this.sketchCoords_.length>this.minPoints_;else if(a==="Polygon"){const l=this.sketchCoords_;o=l[0].length>this.minPoints_,s=[l[0][0],l[0][l[0].length-2]],n?s=[l[0][0]]:s=[l[0][0],l[0][l[0].length-2]]}if(o){const l=this.getMap();for(let c=0,d=s.length;c<d;c++){const u=s[c],f=l.getPixelFromCoordinate(u),p=e[0]-f[0],m=e[1]-f[1],h=this.freehand_?1:this.snapTolerance_;if(r=Math.sqrt(p*p+m*m)<=h,r){this.finishCoordinate_=u;break}}}}return r}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Kt(new Xt(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Kt);const n=e.getLinearRing(0);let r=this.sketchLine_.getGeometry();r?(r.setFlatCoordinates(n.getLayout(),n.getFlatCoordinates()),r.changed()):(r=new $n(n.getFlatCoordinates(),n.getLayout()),this.sketchLine_.setGeometry(r))}startDrawing_(e){const n=this.getMap().getView().getProjection(),r=pc(this.geometryLayout_);for(;e.length<r;)e.push(0);this.finishCoordinate_=e,this.mode_==="Point"?this.sketchCoords_=e.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new Kt(new $n(this.sketchLineCoords_)));const o=this.geometryFunction_(this.sketchCoords_,void 0,n);this.sketchFeature_=new Kt,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(o),this.updateSketchFeatures_(),this.dispatchEvent(new Sf(Ef.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const n=this.getMap(),r=this.sketchFeature_.getGeometry(),o=n.getView().getProjection(),s=pc(this.geometryLayout_);let a,l;for(;e.length<s;)e.push(0);this.mode_==="Point"?l=this.sketchCoords_:this.mode_==="Polygon"?(a=this.sketchCoords_[0],l=a[a.length-1],this.atFinish_(n.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(a=this.sketchCoords_,l=a[a.length-1]),l[0]=e[0],l[1]=e[1],this.geometryFunction_(this.sketchCoords_,r,o),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(e),r.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(r):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(e){const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection();let o,s;const a=this.mode_;return a==="LineString"||a==="Circle"?(this.finishCoordinate_=e.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),this.geometryFunction_(s,n,r)):a==="Polygon"&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),o&&(this.finishCoordinate_=s[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),o?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),o=this.mode_;for(let s=0;s<e;++s){let a;if(o==="LineString"||o==="Circle"){if(a=this.sketchCoords_,a.splice(-2,1),a.length>=2){this.finishCoordinate_=a[a.length-2].slice();const l=this.finishCoordinate_.slice();a[a.length-1]=l,this.createOrUpdateSketchPoint_(l)}this.geometryFunction_(a,n,r),n.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(n)}else if(o==="Polygon"){a=this.sketchCoords_[0],a.splice(-2,1);const l=this.sketchLine_.getGeometry();if(a.length>=2){const c=a[a.length-2].slice();a[a.length-1]=c,this.createOrUpdateSketchPoint_(c)}l.setCoordinates(a),this.geometryFunction_(this.sketchCoords_,n,r)}if(a.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return null;let n=this.sketchCoords_;const r=e.getGeometry(),o=this.getMap().getView().getProjection();return this.mode_==="LineString"?(n.pop(),this.geometryFunction_(n,r,o)):this.mode_==="Polygon"&&(n[0].pop(),this.geometryFunction_(n,r,o),n=r.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new Fc([n])):this.type_==="MultiLineString"?e.setGeometry(new Ac([n])):this.type_==="MultiPolygon"&&e.setGeometry(new Bc([n])),this.dispatchEvent(new Sf(Ef.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e),e}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new Sf(Ef.DRAWABORT,e))}appendCoordinates(e){const n=this.mode_,r=!this.sketchFeature_;r&&this.startDrawing_(e[0]);let o;if(n==="LineString"||n==="Circle")o=this.sketchCoords_;else if(n==="Polygon")o=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;r&&o.shift(),o.pop();for(let a=0;a<e.length;a++)this.addToDrawing_(e[a]);const s=e[e.length-1];this.sketchFeature_=this.addToDrawing_(s),this.modifyDrawing_(s)}extend(e){const r=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=r.getCoordinates();const o=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=o.slice(),this.sketchCoords_.push(o.slice()),this.sketchPoint_=new Kt(new Xt(o)),this.updateSketchFeatures_(),this.dispatchEvent(new Sf(Ef.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const e=[];this.sketchFeature_&&e.push(this.sketchFeature_),this.sketchLine_&&e.push(this.sketchLine_),this.sketchPoint_&&e.push(this.sketchPoint_);const n=this.overlay_.getSource();n.clear(!0),n.addFeatures(e)}updateState_(){const e=this.getMap(),n=this.getActive();(!e||!n)&&this.abortDrawing(),this.overlay_.setMap(n?e:null)}}function $7(){const t=H9();return function(e,n){return t[e.getGeometry().getType()]}}function z7(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}const W7=t=>{t.getInteractions().forEach(e=>{e instanceof n0&&e.setActive(!1)})},Y7=t=>{t.getInteractions().forEach(e=>{e instanceof n0&&e.setActive(!0)})},Xo=(t,e)=>{const n=t.getViewport();n&&(n.style.cursor=e)},G7=(t,e)=>{const n=i.ref([]),r=i.ref("km"),o=k=>{r.value=k};let s;const a=i.ref(!1),l=()=>{Xo(t,"crosshair"),u(),W7(t),t.on("pointermove",m),t.getViewport().addEventListener("mouseout",()=>{s&&s.classList.add("hidden")}),y(),a.value=!0};let c,d;const u=()=>{c=new Di,d=new go({source:c,zIndex:1e3,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),t==null||t.addLayer(d)};let f,p;const m=k=>{if(k.dragging)return;let M="点击选择起点";f&&(M="单击继续,双击结束"),s&&(s.innerHTML=M,p.setPosition(k.coordinate),s.classList.remove("hidden"))};let h;const y=()=>{h=new Tf({source:c,type:"LineString",style:new _t({fill:new rn({color:"rgba(255, 255, 255, 0.2)"}),stroke:new zn({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new co({radius:5,stroke:new zn({color:"rgba(0, 0, 0, 0.7)"}),fill:new rn({color:"rgba(255, 255, 255, 0.2)"})})}),condition:M=>M.originalEvent.target.tagName!=="DIV"}),t==null||t.addInteraction(h),C(),_();let k;h.on("drawstart",function(M){var L;f=M.feature,f.set("randomId",g());let T;k=(L=f.getGeometry())==null?void 0:L.on("change",function(O){const F=O.target,I=H2(F,r.value);T=F.getLastCoordinate(),b&&I&&(b.innerHTML=I),w.setPosition(T)})}),h.on("drawend",function(){var M,T,L;if(b&&(b.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),b!=null&&b.innerHTML){const O=(f==null?void 0:f.get("randomId"))||g();n.value.push({id:O,value:b==null?void 0:b.innerHTML}),b.innerHTML=`${b.innerHTML}<div class="ol-tooltip-delete-button" data-id="${O}"><i class="map-iconfont icon-delete"></i></div>`}(M=document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button"))==null||M.addEventListener("click",O=>{var I;O.preventDefault(),O.stopPropagation();const F=(I=O.target)==null?void 0:I.getAttribute("data-id");F&&S(F)}),w.setOffset([0,-7]),f=null,b=null,C(),k&&vu(k),(L=(T=e.getProps())==null?void 0:T.lineDrawEnd)==null||L.call(T,n.value)})},g=()=>Math.random().toString(36).substring(2,9);let b,w;const C=()=>{b!=null&&b.parentNode&&b.parentNode.removeChild(b),b=document.createElement("div"),b.className="ol-tooltip ol-tooltip-measure",w=new Os({element:b,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),t==null||t.addOverlay(w)},_=()=>{s!=null&&s.parentNode&&s.parentNode.removeChild(s),s=document.createElement("div"),s.className="ol-tooltip hidden",p=new Os({element:s,offset:[15,0],positioning:"center-left"}),t==null||t.addOverlay(p)},E=()=>{n.value.forEach((k,M)=>{var O,F;const T=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");T[M]&&((F=(O=T[M])==null?void 0:O.parentNode)==null||F.removeChild(T[M]));const L=c.getFeatures();L[M]&&c.removeFeature(L[M])}),v(),Y7(t),a.value=!1,Xo(t,"grab")},S=k=>{var T,L,O,F;const M=n.value.findIndex(I=>I.id===k);if(M!==-1){n.value.splice(M,1);const I=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");I[M]&&((L=(T=I[M])==null?void 0:T.parentNode)==null||L.removeChild(I[M]));const D=c.getFeatures();D[M]&&c.removeFeature(D[M])}(F=(O=e.getProps())==null?void 0:O.lineDrawEnd)==null||F.call(O,n.value)},v=()=>{if(n.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach(k=>{var M;(M=k==null?void 0:k.parentNode)==null||M.removeChild(k)}),c==null||c.clear(),h){const k=t.getInteractions().getArray().find(M=>ut(M)===ut(h));k&&t.removeInteraction(k)}t.removeLayer(d),s!=null&&s.parentNode&&s.parentNode.removeChild(s),b!=null&&b.parentNode&&b.parentNode.removeChild(b)};return{open:l,close:E,deleteLine:S,setUnit:o,getState:()=>a.value}},H2=(t,e)=>{const r=Au(t);let o="";switch(e){case"m":o=`${Math.round(r*100)/100} m`;break;case"km":o=`${Math.round(r/1e3*100)/100} km`;break;case"nm":o=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return o},j7=(t,e)=>{let n,r,o="close";const s=()=>{v(),o="open",a(),Xo(t,"crosshair")},a=()=>{d(),w(),E(),h()};let l=null,c=null;const d=()=>{if(l&&c)return;const k=new Di,M=new go({source:k,style:new _t({stroke:new zn({color:"#fbcc33",width:2})}),zIndex:1e3});l=M,c=k,t.on("pointermove",f),t.addLayer(M),t.on(["dblclick"],function(T){p&&(T.stopPropagation(),T.preventDefault())})};let u;const f=k=>{if(k.dragging)return;const M=u?"单击继续,双击结束":"点击选择起点";C&&(C.innerHTML=M,_.setPosition(k.coordinate))};let p,m=!1;const h=()=>{if(n){C!=null&&C.parentNode&&C.parentNode.removeChild(C);const k=n.getGeometry();if(!k)return;const M=y(k,"nm");g&&(g.innerHTML=`
193
193
  <span class="text">面积:${M}${m?'<span class="error pl-12">超出可以绘画的距离</span>':""}</span>
194
194
  `),g&&(g.innerHTML+='<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');const T=k.getCoordinates(),L=T[0][T[0].length-2];if(b.setPosition(L),l){const F=l.getSource();F&&n&&(F.clear(),F.addFeature(n))}setTimeout(()=>{var F;(F=document.querySelector(".delete-icon"))==null||F.addEventListener("click",()=>{var I,D;console.log("delete"),S(),(D=(I=e.getProps())==null?void 0:I.areaDrawEnd)==null||D.call(I,[])})},0);const O=eo(n.getGeometry().getExtent());t==null||t.getView().setCenter(O);return}p=new Tf({type:"Polygon",source:c,trace:!0,style:[new _t({stroke:new zn({color:"rgba(255, 255, 255, 1)",width:1.5,lineDash:[10,10]}),fill:new rn({color:"rgba(255, 255, 255, 0.25)"})}),new _t({image:new co({radius:5,fill:new rn({color:"rgb(51,112,255, 1)"})}),geometry:function(k){const M=k.getGeometry().getCoordinates();return new Fc(M)}})]}),t==null||t.addInteraction(p),p.on("drawstart",k=>{var M;u=k.feature,r=(M=u.getGeometry())==null?void 0:M.on("change",T=>{const L=T.target,O=y(L,"nm"),I=L.getCoordinates()[0],D=new $n([I[I.length-2],I[I.length-1]]),P=H2(D,"nm");if(m=Number(Au(D)/1e3)>150,!O)return;const N='<span class="error pl-4">超出可以绘画的距离</span>';g&&(g.innerHTML=`
195
195
  <div class="text">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhihao-ui",
3
- "version": "1.3.45.-alpha.1",
3
+ "version": "1.3.45.-alpha.2",
4
4
  "description": "components",
5
5
  "type": "module",
6
6
  "main": "./dist/umd/index.umd.cjs",