zhihao-ui 1.2.40 → 1.2.41
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.
|
@@ -8,7 +8,7 @@ import { g as getForegroundColor } from "./DatePicker-Dh8sksac.js";
|
|
|
8
8
|
import { w as withInstall } from "./utils-BSQSj8Ii.js";
|
|
9
9
|
var BaseMapType = /* @__PURE__ */ ((e) => (e[e.vector = 0] = "vector", e[e.satellite = 1] = "satellite", e))(BaseMapType || {}), SEARCH_TYPE = /* @__PURE__ */ ((e) => (e[e.SEARCH_SHIP = 0] = "SEARCH_SHIP", e[e.SEARCH_PORT = 1] = "SEARCH_PORT", e[e.SEARCH_CUSTOM = 2] = "SEARCH_CUSTOM", e))(SEARCH_TYPE || {}), COPY_RIGHT_TYPE = /* @__PURE__ */ ((e) => (e[e.HORIZONTAL = 0] = "HORIZONTAL", e[e.VERTICAL = 1] = "VERTICAL", e))(COPY_RIGHT_TYPE || {}), CAR_COLOR = /* @__PURE__ */ ((e) => (e[e.BLUE = 1] = "BLUE", e[e.YELLOW = 2] = "YELLOW", e[e.Y_GREEN = 3] = "Y_GREEN", e))(CAR_COLOR || {}), DEVICE_TYPE = /* @__PURE__ */ ((e) => (e[e.HOST = 1] = "HOST", e[e.TALK = 2] = "TALK", e[e.STORAGE = 3] = "STORAGE", e[e.INTERNET = 4] = "INTERNET", e[e.CAMERA = 5] = "CAMERA", e[e.LOAD = 6] = "LOAD", e))(DEVICE_TYPE || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {}), SWITCH_BTN = /* @__PURE__ */ ((e) => (e.Camera = "camera", e.Mobile = "mobile", e.WaterGauge = "waterGauge", e))(SWITCH_BTN || {}), SHIP_SAIL_STATUS = /* @__PURE__ */ ((e) => (e[e.发动机使用中 = 0] = "发动机使用中", e[e.锚泊 = 1] = "锚泊", e[e.未操作 = 2] = "未操作", e[e.操纵能力受限 = 3] = "操纵能力受限", e[e.吃水受限 = 4] = "吃水受限", e[e.系泊 = 5] = "系泊", e[e.搁浅 = 6] = "搁浅", e[e.从事捕捞 = 7] = "从事捕捞", e[e.航行中 = 8] = "航行中", e[e.留作将来修正导航状态 = 9] = "留作将来修正导航状态", e[e.高速船留用 = 10] = "高速船留用", e[e.机动船尾推作业 = 11] = "机动船尾推作业", e[e.机动船顶推或侧推作业 = 12] = "机动船顶推或侧推作业", e[e.飞翼船留用 = 13] = "飞翼船留用", e[e.现行的 = 14] = "现行的", e[e.未定义 = 15] = "未定义", e))(SHIP_SAIL_STATUS || {});
|
|
10
10
|
class ShipMapData {
|
|
11
|
-
constructor(t, n, o, i, r, l, c, s, m, d, u, f, p, y, h, g, k, T, I,
|
|
11
|
+
constructor(t, n, o, i, r, l, c, s, m, d, u, f, p, y, h, g, k, T, I, F, V, P, v, L) {
|
|
12
12
|
b(this, "id");
|
|
13
13
|
// mmsi
|
|
14
14
|
b(this, "mmsi");
|
|
@@ -50,7 +50,7 @@ class ShipMapData {
|
|
|
50
50
|
b(this, "existWaterGauge");
|
|
51
51
|
b(this, "selected");
|
|
52
52
|
b(this, "blinkColors");
|
|
53
|
-
this.id = t, this.mmsi = n, this.fill = o, this.shipType = i, this.name = r, this.length = l, this.breadth = c, this.lon = s, this.lat = m, this.createdAt = d, this.speed = u, this.from = f, this.sailStatus = p, this.hdg = y, this.cog = h, this.posType = g, this.type = k, this.angle = T, this.leftIconColor = I, this.existDevice =
|
|
53
|
+
this.id = t, this.mmsi = n, this.fill = o, this.shipType = i, this.name = r, this.length = l, this.breadth = c, this.lon = s, this.lat = m, this.createdAt = d, this.speed = u, this.from = f, this.sailStatus = p, this.hdg = y, this.cog = h, this.posType = g, this.type = k, this.angle = T, this.leftIconColor = I, this.existDevice = F, this.existMobile = V, this.existWaterGauge = P, this.selected = v, this.blinkColors = L;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
const formatLength = function(e, t) {
|
|
@@ -173,7 +173,7 @@ const formatLength = function(e, t) {
|
|
|
173
173
|
})
|
|
174
174
|
})
|
|
175
175
|
});
|
|
176
|
-
function
|
|
176
|
+
function F() {
|
|
177
177
|
var S, M;
|
|
178
178
|
if (o != null && o.value) {
|
|
179
179
|
if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((C) => {
|
|
@@ -186,9 +186,9 @@ const formatLength = function(e, t) {
|
|
|
186
186
|
(M = o.value) == null || M.removeLayer(h), u != null && u.parentNode && u.parentNode.removeChild(u), p != null && p.parentNode && p.parentNode.removeChild(p);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function V() {
|
|
190
190
|
var M, C;
|
|
191
|
-
|
|
191
|
+
F(), (M = o == null ? void 0 : o.value) == null || M.addLayer(h), T = new Draw({
|
|
192
192
|
source: m,
|
|
193
193
|
type: "LineString",
|
|
194
194
|
style: function() {
|
|
@@ -203,15 +203,15 @@ const formatLength = function(e, t) {
|
|
|
203
203
|
T.on("drawstart", function(E) {
|
|
204
204
|
var N;
|
|
205
205
|
d = E.feature;
|
|
206
|
-
let
|
|
206
|
+
let x;
|
|
207
207
|
S = (N = d.getGeometry()) == null ? void 0 : N.on("change", function(A) {
|
|
208
208
|
const $ = A.target;
|
|
209
209
|
let R = formatUtils.formatLength($, Number(l.value));
|
|
210
|
-
|
|
210
|
+
x = $.getLastCoordinate(), p && R && (p.innerHTML = R), y.setPosition(x);
|
|
211
211
|
});
|
|
212
212
|
}), T.on("drawend", function() {
|
|
213
|
-
var E,
|
|
214
|
-
p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (c.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((E = c.value) == null ? void 0 : E.length) - 1}"><i class="map-iconfont icon-delete"></i></div>`), (
|
|
213
|
+
var E, x;
|
|
214
|
+
p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (c.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((E = c.value) == null ? void 0 : E.length) - 1}"><i class="map-iconfont icon-delete"></i></div>`), (x = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || x.addEventListener("click", (N) => {
|
|
215
215
|
var $;
|
|
216
216
|
N.preventDefault(), N.stopPropagation();
|
|
217
217
|
const A = ($ = N.target) == null ? void 0 : $.getAttribute("data-index");
|
|
@@ -238,20 +238,20 @@ const formatLength = function(e, t) {
|
|
|
238
238
|
}), (S = o == null ? void 0 : o.value) == null || S.addOverlay(y);
|
|
239
239
|
}
|
|
240
240
|
const L = (S) => {
|
|
241
|
-
var E,
|
|
241
|
+
var E, x;
|
|
242
242
|
c.value[S] && c.value.splice(S, 1);
|
|
243
243
|
const M = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
244
|
-
M[S] && ((
|
|
244
|
+
M[S] && ((x = (E = M[S]) == null ? void 0 : E.parentNode) == null || x.removeChild(M[S]));
|
|
245
245
|
const C = m.getFeatures();
|
|
246
246
|
C[S] && m.removeFeature(C[S]);
|
|
247
247
|
}, w = () => {
|
|
248
248
|
i("close");
|
|
249
249
|
};
|
|
250
250
|
return watch(() => r, () => {
|
|
251
|
-
r.value && !s.value && (k(),
|
|
251
|
+
r.value && !s.value && (k(), V());
|
|
252
252
|
}, { deep: !0, immediate: !0 }), t({
|
|
253
|
-
addInteraction:
|
|
254
|
-
removeInteraction:
|
|
253
|
+
addInteraction: V,
|
|
254
|
+
removeInteraction: F
|
|
255
255
|
}), (S, M) => r.value && S.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
256
256
|
createElementVNode("div", { class: "header" }, [
|
|
257
257
|
M[1] || (M[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
|
|
@@ -296,7 +296,7 @@ const formatLength = function(e, t) {
|
|
|
296
296
|
]),
|
|
297
297
|
createElementVNode("div", {
|
|
298
298
|
class: "delete-button",
|
|
299
|
-
onClick: (
|
|
299
|
+
onClick: (x) => L(E)
|
|
300
300
|
}, M[4] || (M[4] = [
|
|
301
301
|
createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
|
|
302
302
|
]), 8, _hoisted_7)
|
|
@@ -454,8 +454,8 @@ const multiplyPixelRatio = (e) => {
|
|
|
454
454
|
return function(P, v) {
|
|
455
455
|
return (l(v, P) + 180) % 360;
|
|
456
456
|
}(u, f);
|
|
457
|
-
const y = r(u), h = r(f), g = i(y[0]), k = i(h[0]), T = i(y[1]), I = i(h[1]),
|
|
458
|
-
return o(Math.atan2(
|
|
457
|
+
const y = r(u), h = r(f), g = i(y[0]), k = i(h[0]), T = i(y[1]), I = i(h[1]), F = Math.sin(k - g) * Math.cos(I), V = Math.cos(T) * Math.sin(I) - Math.sin(T) * Math.cos(I) * Math.cos(k - g);
|
|
458
|
+
return o(Math.atan2(F, V));
|
|
459
459
|
}
|
|
460
460
|
function c(u) {
|
|
461
461
|
return !isNaN(u) && u !== null && !Array.isArray(u);
|
|
@@ -545,7 +545,9 @@ const multiplyPixelRatio = (e) => {
|
|
|
545
545
|
o.feature.get("index") === 0 && (shipLabels.value = []);
|
|
546
546
|
try {
|
|
547
547
|
const c = drawShipBody(i, r, n, t);
|
|
548
|
-
c && (drawHeading(i, r, c, t), r.selected = e, e &&
|
|
548
|
+
c && (drawHeading(i, r, c, t), r.selected = e, e && setTimeout(() => {
|
|
549
|
+
drawSelectBounds(i, c);
|
|
550
|
+
}, 1)), drawShipLabel(i, r, n);
|
|
549
551
|
} catch {
|
|
550
552
|
return !1;
|
|
551
553
|
}
|
|
@@ -965,13 +967,13 @@ function drawLabelBody(e, t, n) {
|
|
|
965
967
|
p = calculateBounds(l, k, f, g, d);
|
|
966
968
|
let T = !1;
|
|
967
969
|
for (let I = 0; I < t.length; ++I) {
|
|
968
|
-
let
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
970
|
+
let F = t[I].bounds, V = [
|
|
971
|
+
F[0] - y,
|
|
972
|
+
F[1] - y,
|
|
973
|
+
F[2] + y,
|
|
974
|
+
F[3] + y
|
|
973
975
|
];
|
|
974
|
-
if (p && isOverlapping(p,
|
|
976
|
+
if (p && isOverlapping(p, V)) {
|
|
975
977
|
T = !0;
|
|
976
978
|
break;
|
|
977
979
|
}
|
|
@@ -1050,9 +1052,9 @@ const drawText = (e, t) => {
|
|
|
1050
1052
|
(u = t.blinkColors) != null && u.length && t.fill && (c = t.fill, l = getForegroundColor(t.fill));
|
|
1051
1053
|
const I = drawLabelBody(e, n, T);
|
|
1052
1054
|
if (I) {
|
|
1053
|
-
const { x, bounds:
|
|
1055
|
+
const { x: F, bounds: V, l: P } = I, v = [getTopLeftPoint(V), getBottomLeftPoint(V), getBottomRightPoint(V), getTopRighttPoint(V)];
|
|
1054
1056
|
n.find((E) => E.name === i) || n.push(I), drawPolygon(e, {
|
|
1055
|
-
points: [o,
|
|
1057
|
+
points: [o, F],
|
|
1056
1058
|
strokeColor: r,
|
|
1057
1059
|
fillColor: "#000",
|
|
1058
1060
|
shouldClosePath: !0,
|
|
@@ -1061,8 +1063,8 @@ const drawText = (e, t) => {
|
|
|
1061
1063
|
rotationCenter: void 0,
|
|
1062
1064
|
scale: void 0,
|
|
1063
1065
|
globalAlpha: labelAlpha
|
|
1064
|
-
}), m != null && m.length && m.forEach((
|
|
1065
|
-
v[1][0] +=
|
|
1066
|
+
}), m != null && m.length && m.forEach(() => {
|
|
1067
|
+
v[1][0] += pixelRatio === 1 ? 18 : 36, v[2][0] += pixelRatio === 1 ? 18 : 36;
|
|
1066
1068
|
});
|
|
1067
1069
|
const w = {
|
|
1068
1070
|
points: v,
|
|
@@ -1078,7 +1080,7 @@ const drawText = (e, t) => {
|
|
|
1078
1080
|
blinkColors: t.blinkColors
|
|
1079
1081
|
};
|
|
1080
1082
|
if (drawPolygon(e, w), drawText(e, C), t != null && t.blinkColors && t.blinkColors.length > 0) {
|
|
1081
|
-
let E = Date.now(),
|
|
1083
|
+
let E = Date.now(), x = 0;
|
|
1082
1084
|
const N = t.blinkColors;
|
|
1083
1085
|
!!!((y = (p = (f = selectShipsLayer.value) == null ? void 0 : f.getSource()) == null ? void 0 : p.getFeatures()) != null && y.find(($) => {
|
|
1084
1086
|
var R;
|
|
@@ -1089,7 +1091,7 @@ const drawText = (e, t) => {
|
|
|
1089
1091
|
})) || hiddenOrther.value ? (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, i)) : (intervalIds[t.id] && clearInterval(intervalIds[t.id]), intervalIds[t.id] = window.setInterval(() => {
|
|
1090
1092
|
var D, G, _;
|
|
1091
1093
|
const $ = Date.now();
|
|
1092
|
-
$ - E >= 500 && (
|
|
1094
|
+
$ - E >= 500 && (x = (x + 1) % N.length, E = $, w.fillColor = N[x], drawPolygon(e, w), C.textColor = getForegroundColor(w.fillColor), drawText(e, C));
|
|
1093
1095
|
const R = shipsMarkerList == null ? void 0 : shipsMarkerList.some((O) => {
|
|
1094
1096
|
var B;
|
|
1095
1097
|
return ((B = O.ship) == null ? void 0 : B.id) === t.id;
|
|
@@ -1100,7 +1102,7 @@ const drawText = (e, t) => {
|
|
|
1100
1102
|
!R && !Z && (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, i));
|
|
1101
1103
|
}, 10));
|
|
1102
1104
|
} else
|
|
1103
|
-
shipLabels.value.find((
|
|
1105
|
+
shipLabels.value.find((x) => x.name === i) && (clearInterval(intervalIds[t.id]), drawPolygon(e, w), drawText(e, C));
|
|
1104
1106
|
}
|
|
1105
1107
|
}
|
|
1106
1108
|
return null;
|
|
@@ -1456,8 +1458,8 @@ const moveFeature = (e, t) => {
|
|
|
1456
1458
|
}), document.addEventListener("mousemove", function(k) {
|
|
1457
1459
|
var T;
|
|
1458
1460
|
if (f) {
|
|
1459
|
-
const I = (T = mapInstance$4.value) == null ? void 0 : T.getCoordinateFromPixel([k.clientX - y[0], k.clientY - y[1]]),
|
|
1460
|
-
l.setPosition([p[0] +
|
|
1461
|
+
const I = (T = mapInstance$4.value) == null ? void 0 : T.getCoordinateFromPixel([k.clientX - y[0], k.clientY - y[1]]), F = I[0] - p[0], V = I[1] - p[1];
|
|
1462
|
+
l.setPosition([p[0] + F, p[1] + V]);
|
|
1461
1463
|
}
|
|
1462
1464
|
}), document.addEventListener("mouseup", function() {
|
|
1463
1465
|
f = !1;
|
|
@@ -1799,14 +1801,14 @@ const setTruckStyle = (e, t, n, o) => new Style({
|
|
|
1799
1801
|
n === CAR_COLOR.YELLOW ? (h = 176, k = "#FFC81E", T = "rgba(0,0,0,0.88)") : n === CAR_COLOR.Y_GREEN && (f = 200, h = 196, k = "#8FED7C", T = "rgba(0,0,0,0.88)"), o != null && o.length && (f += o.length * 56), fillRectRadius(l, d, u, f, p, y), fillRectRadius(l, d + 2, u + 2, h, g, k), n === CAR_COLOR.Y_GREEN && fillRectRadius(l, d + 2, u + 2, 68, g, "#FFC81E"), l.save(), l.restore(), l.fillStyle = T, l.font = "bold 28px Arial", l.textAlign = "left", l.textBaseline = "middle";
|
|
1800
1802
|
const I = `${t.slice(0, 2) + " · " + t.slice(2)}`;
|
|
1801
1803
|
if (l.fillText(I, d + 12, u + 32), l.save(), l.restore(), o != null && o.length) {
|
|
1802
|
-
const
|
|
1804
|
+
const V = l.measureText(I).width + 12;
|
|
1803
1805
|
let P = 0;
|
|
1804
1806
|
o.forEach((v) => {
|
|
1805
|
-
v === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, s - 54 +
|
|
1807
|
+
v === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, s - 54 + V + P * 56, m - 64, 50, 50), ++P), v === DEVICE_TYPE.LOAD && (l.drawImage(loadImage, s - 54 + V + P * 56, m - 64, 50, 50), ++P);
|
|
1806
1808
|
});
|
|
1807
1809
|
}
|
|
1808
|
-
const
|
|
1809
|
-
l.drawImage(
|
|
1810
|
+
const F = dotImage$1;
|
|
1811
|
+
l.drawImage(F, s + f / 2 - 90, m, 50 / c, 50 / c), l.restore();
|
|
1810
1812
|
}
|
|
1811
1813
|
}), mapInstance$2 = ref(), renderDashboardSetInstance = (e) => mapInstance$2.value = e;
|
|
1812
1814
|
ref([]);
|
|
@@ -2253,15 +2255,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2253
2255
|
});
|
|
2254
2256
|
}, I = () => {
|
|
2255
2257
|
const v = o.value.getView(), L = v.getZoom();
|
|
2256
|
-
L &&
|
|
2258
|
+
L && F(L);
|
|
2257
2259
|
const w = v.calculateExtent(o.value.getSize());
|
|
2258
|
-
w && L &&
|
|
2259
|
-
},
|
|
2260
|
-
var S, M, C, E,
|
|
2260
|
+
w && L && V(w, L);
|
|
2261
|
+
}, F = (v) => {
|
|
2262
|
+
var S, M, C, E, x;
|
|
2261
2263
|
m.value = v, g(v < mapZoom.shipGreenDotMax);
|
|
2262
2264
|
const L = (S = o.value) == null ? void 0 : S.getLayers(), w = s.vehicleMode === "ship" ? L == null ? void 0 : L.getArray().find((N) => getUid(N) === getUid(p.greenMark)) : void 0;
|
|
2263
|
-
showTrackLayer.value ? (f.value = !1, w == null || w.setVisible(!1), (M = shipsLayer.value) == null || M.setVisible(!1), (C = largeAmountShipsLayer.value) == null || C.setVisible(!1)) : !d.value && u.value && v <= mapZoom.shipGreenDotMax ? (f.value = !0, w == null || w.setVisible(!0), (E = shipsLayer.value) == null || E.setVisible(!1), (
|
|
2264
|
-
},
|
|
2265
|
+
showTrackLayer.value ? (f.value = !1, w == null || w.setVisible(!1), (M = shipsLayer.value) == null || M.setVisible(!1), (C = largeAmountShipsLayer.value) == null || C.setVisible(!1)) : !d.value && u.value && v <= mapZoom.shipGreenDotMax ? (f.value = !0, w == null || w.setVisible(!0), (E = shipsLayer.value) == null || E.setVisible(!1), (x = largeAmountShipsLayer.value) == null || x.setVisible(!1)) : (f.value = !1, w == null || w.setVisible(!1)), c("zoomChanged", v);
|
|
2266
|
+
}, V = (v, L) => {
|
|
2265
2267
|
const w = transform([v[0], v[1]], projection.mercator, projection.data), S = transform([v[2], v[3]], projection.mercator, projection.data);
|
|
2266
2268
|
c("extentChanged", { extent: [w, S], zoom: L });
|
|
2267
2269
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -17,8 +17,8 @@ import { Z as A } from "./BaseInfo-VzgiaCKn.js";
|
|
|
17
17
|
import { Z as E } from "./DetailHeader-CSC9DAQc.js";
|
|
18
18
|
import { Z as c } from "./DiyDataTable-B8z44XT3.js";
|
|
19
19
|
import { D as Q } from "./DiyDataTable-B8z44XT3.js";
|
|
20
|
-
import { Z as B } from "./Map-
|
|
21
|
-
import { B as $, C as aa, c as oa, D as ra, L as ma, S as sa, b as ta, a as Za, m as ea, p as ia, r as pa, t as fa, z as ha } from "./Map-
|
|
20
|
+
import { Z as B } from "./Map-DcXPse85.js";
|
|
21
|
+
import { B as $, C as aa, c as oa, D as ra, L as ma, S as sa, b as ta, a as Za, m as ea, p as ia, r as pa, t as fa, z as ha } from "./Map-DcXPse85.js";
|
|
22
22
|
import { Z as L } from "./Table-BoMGydAp.js";
|
|
23
23
|
import { Z as la } from "./BaseItem-D1xoWSGo.js";
|
|
24
24
|
const M = [
|
package/dist/umd/index.umd.cjs
CHANGED
|
@@ -652,7 +652,7 @@ void main(void) {
|
|
|
652
652
|
samplePos = clamp(samplePos, vec2(0.5), sampleSize - vec2(0.5));
|
|
653
653
|
samplePos.y = sampleSize.y - samplePos.y; // invert y axis so that images appear upright
|
|
654
654
|
return texture2D(texture, (samplePos + textureOffset) / textureSize);
|
|
655
|
-
}`;const $=`u_texture${g}`;let V="1.";"fill-color"in t&&(V=e.getFillColorExpression()),e.setFillColorExpression(`${V} * sampleFillPattern(${$}, ${y}, ${L}, ${k}, pxOrigin, pxPos)`)}}function parseLiteralStyle(t,e){const n=newCompilationContext(),r={...newCompilationContext(),inFragmentShader:!0,variables:n.variables},i=new ShaderBuilder,g={};if("icon-src"in t?parseIconProperties(t,i,g,n,r):"shape-points"in t?parseShapeProperties(t,i,g,n,r):"circle-radius"in t&&parseCircleProperties(t,i,g,n,r),parseStrokeProperties(t,i,g,n,r),parseFillProperties(t,i,g,n,r),t.filter){const L=expressionToGlsl(r,t.filter,BooleanType);i.setFragmentDiscardExpression(`!${L}`)}for(const L in r.variables){const $=r.variables[L],V=uniformNameForVariable($.name);let z=getGlslTypeFromType($.type);$.type===ColorType&&(z="vec4"),i.addUniform(`${z} ${V}`),g[V]=()=>{const j=e[$.name];return typeof j=="number"?j:typeof j=="boolean"?j?1:0:$.type===ColorType?asArray(j||"#eee"):typeof j=="string"?getStringNumberEquivalent(j):j}}for(const L in r.properties){const $=r.properties[L];n.properties[L]||(n.properties[L]=$);let V=getGlslTypeFromType($.type),z=`a_prop_${$.name}`;$.type===ColorType&&(V="vec4",z=`unpackColor(${z})`,i.addVertexShaderFunction(UNPACK_COLOR_FN)),i.addVarying(`v_prop_${$.name}`,V,z)}for(const L in n.properties){const $=n.properties[L];i.addAttribute(`${getGlslTypeFromType($.type)} a_prop_${$.name}`)}for(const L in n.functions)i.addVertexShaderFunction(n.functions[L]);for(const L in r.functions)i.addFragmentShaderFunction(r.functions[L]);const y={};for(const L in n.properties){const $=n.properties[L],V=z=>{const j=z.get($.name);return $.type===ColorType?packColor([...asArray(j||"#eee")]):typeof j=="string"?getStringNumberEquivalent(j):typeof j=="boolean"?j?1:0:j};y[`prop_${$.name}`]={size:getGlslSizeFromType($.type),callback:V}}function k(L,$,V,z){const j=n[L],oe=r[L];if(!j&&!oe)return;const re=getGlslTypeFromType(V),ie=getGlslSizeFromType(V);i.addAttribute(`${re} a_${$}`),oe&&i.addVarying(`v_${$}`,re,`a_${$}`),y[$]={size:ie,callback:z}}return k("geometryType",GEOMETRY_TYPE_PROPERTY_NAME,StringType,L=>getStringNumberEquivalent(computeGeometryType(L.getGeometry()))),k("featureId",FEATURE_ID_PROPERTY_NAME,StringType|NumberType,L=>{const $=L.getId()??null;return typeof $=="string"?getStringNumberEquivalent($):$}),{builder:i,attributes:y,uniforms:g}}class WebGLPointsLayer extends Layer{constructor(e){const n=Object.assign({},e);super(n),this.styleVariables_=e.variables||{},this.parseResult_=parseLiteralStyle(e.style,this.styleVariables_),this.hitDetectionDisabled_=!!e.disableHitDetection}createRenderer(){const e=Object.keys(this.parseResult_.attributes).map(n=>({name:n,...this.parseResult_.attributes[n]}));return new WebGLPointsLayerRenderer(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitDetectionEnabled:!this.hitDetectionDisabled_,uniforms:this.parseResult_.uniforms,attributes:e})}updateStyleVariables(e){Object.assign(this.styleVariables_,e),this.changed()}}var CAR_COLOR=(t=>(t[t.BLUE=1]="BLUE",t[t.YELLOW=2]="YELLOW",t[t.Y_GREEN=3]="Y_GREEN",t))(CAR_COLOR||{}),DEVICE_TYPE=(t=>(t[t.HOST=1]="HOST",t[t.TALK=2]="TALK",t[t.STORAGE=3]="STORAGE",t[t.INTERNET=4]="INTERNET",t[t.CAMERA=5]="CAMERA",t[t.LOAD=6]="LOAD",t))(DEVICE_TYPE||{}),LENGTH_UNIT=(t=>(t[t.M=1]="M",t[t.KM=2]="KM",t[t.NM=3]="NM",t))(LENGTH_UNIT||{}),SWITCH_BTN=(t=>(t.Camera="camera",t.Mobile="mobile",t.WaterGauge="waterGauge",t))(SWITCH_BTN||{}),SHIP_SAIL_STATUS=(t=>(t[t.发动机使用中=0]="发动机使用中",t[t.锚泊=1]="锚泊",t[t.未操作=2]="未操作",t[t.操纵能力受限=3]="操纵能力受限",t[t.吃水受限=4]="吃水受限",t[t.系泊=5]="系泊",t[t.搁浅=6]="搁浅",t[t.从事捕捞=7]="从事捕捞",t[t.航行中=8]="航行中",t[t.留作将来修正导航状态=9]="留作将来修正导航状态",t[t.高速船留用=10]="高速船留用",t[t.机动船尾推作业=11]="机动船尾推作业",t[t.机动船顶推或侧推作业=12]="机动船顶推或侧推作业",t[t.飞翼船留用=13]="飞翼船留用",t[t.现行的=14]="现行的",t[t.未定义=15]="未定义",t))(SHIP_SAIL_STATUS||{});class ShipMapData{constructor(e,n,r,i,g,y,k,L,$,V,z,j,oe,re,ie,ae,le,de,pe,ue,he,Ce,_e,xe){qn(this,"id");qn(this,"mmsi");qn(this,"fill");qn(this,"shipType");qn(this,"name");qn(this,"length");qn(this,"breadth");qn(this,"lon");qn(this,"lat");qn(this,"createdAt");qn(this,"speed");qn(this,"from");qn(this,"sailStatus");qn(this,"hdg");qn(this,"cog");qn(this,"posType");qn(this,"type");qn(this,"angle");qn(this,"leftIconColor");qn(this,"existDevice");qn(this,"existMobile");qn(this,"existWaterGauge");qn(this,"selected");qn(this,"blinkColors");this.id=e,this.mmsi=n,this.fill=r,this.shipType=i,this.name=g,this.length=y,this.breadth=k,this.lon=L,this.lat=$,this.createdAt=V,this.speed=z,this.from=j,this.sailStatus=oe,this.hdg=re,this.cog=ie,this.posType=ae,this.type=le,this.angle=de,this.leftIconColor=pe,this.existDevice=ue,this.existMobile=he,this.existWaterGauge=Ce,this.selected=_e,this.blinkColors=xe}}const formatLength=function(t,e){const r=getLength(t);let i="";switch(e){case LENGTH_UNIT.M:i=Math.round(r*100)/100+" m";break;case LENGTH_UNIT.KM:i=Math.round(r/1e3*100)/100+" km";break;case LENGTH_UNIT.NM:i=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return i},convertSixHundredThousandToLatLng=function(t,e){const n=Number(e)/6e5;return[Number(t)/6e5,n]},formatArea=(t,e)=>{const r=getArea(t);let i;switch(e){case LENGTH_UNIT.KM:r>1e4?i=Math.round(r/1e6*100)/100+" km<sup>2</sup>":i=Math.round(r*100)/100+" m<sup>2</sup>";break;case LENGTH_UNIT.NM:const g=Math.pow(1.852,2);r>1e4?i=Math.round(r/1e6/g*100)/100+" nm<sup>2</sup>":i=Math.round(r*100)/100+" m<sup>2</sup>";break}return i},convertShipMapData=t=>{const e=n=>new ShipMapData(n.id,n.id,n.fill||"#04C900","70",(n.cnname||n.enname||n.name||n.id)+`${n.existName?n.existName:""}`,n.len||n.length,n.wid||n.breadth,n.lon,n.lat,new Date().getTime(),n.spd,n.from,n.status,Number(n.hdg),n.cog,Number(n.postype),"other",n.cog,n.leftIconColor,n.existDevice,n.existMobile,n.existWaterGauge,n.selected,n.blinkColors);return Array.isArray(t)?t.map(n=>e(n)):e(t)},formatUtils={formatLength,convertSixHundredThousandToLatLng,formatArea},_hoisted_1$a={key:0,class:"measure-panel"},_hoisted_2$6={class:"d-flex justify-content-between align-content-start w-100"},_hoisted_3$5={class:"measure-history-list"},_hoisted_4$2={class:"left-panel"},_hoisted_5$2={class:"text index"},_hoisted_6$2={class:"text"},_hoisted_7$2=["onClick"],_sfc_main$c=vue.defineComponent({__name:"measure",props:vue.mergeModels({viewMode:{}},{visible:{type:Boolean},visibleModifiers:{}}),emits:vue.mergeModels(["close"],["update:visible"]),setup(t,{expose:e,emit:n}){const r=vue.inject("mapInstance"),i=n,g=vue.useModel(t,"visible"),y=vue.ref("3"),k=vue.ref([]),L=vue.ref(!1),$=new VectorSource;let V,z,j,oe,re;const ie=new VectorLayer({source:$,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),ae=function(Oe){if(Oe.dragging)return;let $e="点击选择起点";V&&($e="单击继续,双击结束"),z&&(z.innerHTML=$e,j.setPosition(Oe.coordinate),z.classList.remove("hidden"))},le=()=>{var Oe,$e;r!=null&&r.value&&((Oe=r==null?void 0:r.value)==null||Oe.on("pointermove",ae),($e=r==null?void 0:r.value)==null||$e.getViewport().addEventListener("mouseout",function(){var qe;(qe=z==null?void 0:z.classList)==null||qe.add("hidden")}),L.value=!0)};let de;const pe=new Style({fill:new Fill({color:"rgba(255, 255, 255, 0.2)"}),stroke:new Stroke({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new CircleStyle({radius:5,stroke:new Stroke({color:"rgba(0, 0, 0, 0.7)"}),fill:new Fill({color:"rgba(255, 255, 255, 0.2)"})})});function ue(){var Oe,$e;if(r!=null&&r.value){if(k.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach(qe=>{var kt;(kt=qe==null?void 0:qe.parentNode)==null||kt.removeChild(qe)}),$.clear(),de){const qe=r.value.getInteractions().getArray().find(kt=>getUid(kt)===getUid(de));qe&&((Oe=r.value)==null||Oe.removeInteraction(qe))}($e=r.value)==null||$e.removeLayer(ie),z!=null&&z.parentNode&&z.parentNode.removeChild(z),oe!=null&&oe.parentNode&&oe.parentNode.removeChild(oe)}}function he(){var $e,qe;ue(),($e=r==null?void 0:r.value)==null||$e.addLayer(ie),de=new Draw({source:$,type:"LineString",style:function(){return pe},condition:function(kt){return kt.originalEvent.target.tagName!=="DIV"}}),(qe=r==null?void 0:r.value)==null||qe.addInteraction(de),_e(),Ce();let Oe;de.on("drawstart",function(kt){var Ve;V=kt.feature;let Dt;Oe=(Ve=V.getGeometry())==null?void 0:Ve.on("change",function(Fe){const ze=Fe.target;let Ue=formatUtils.formatLength(ze,Number(y.value));Dt=ze.getLastCoordinate(),oe&&Ue&&(oe.innerHTML=Ue),re.setPosition(Dt)})}),de.on("drawend",function(){var kt,Dt;oe&&(oe.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),oe!=null&&oe.innerHTML&&(k.value.push(oe==null?void 0:oe.innerHTML),oe.innerHTML=`${oe.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((kt=k.value)==null?void 0:kt.length)-1}"><i class="map-iconfont icon-delete"></i></div>`),(Dt=document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button"))==null||Dt.addEventListener("click",Ve=>{var ze;Ve.preventDefault(),Ve.stopPropagation();const Fe=(ze=Ve.target)==null?void 0:ze.getAttribute("data-index");Fe&&xe(Number(Fe))}),re.setOffset([0,-7]),V=null,oe=null,_e(),Oe&&unByKey(Oe)})}function Ce(){var Oe;z!=null&&z.parentNode&&z.parentNode.removeChild(z),z=document.createElement("div"),z.className="ol-tooltip hidden",j=new Overlay({element:z,offset:[15,0],positioning:"center-left"}),(Oe=r==null?void 0:r.value)==null||Oe.addOverlay(j)}function _e(){var Oe;oe!=null&&oe.parentNode&&oe.parentNode.removeChild(oe),oe=document.createElement("div"),oe.className="ol-tooltip ol-tooltip-measure",re=new Overlay({element:oe,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),(Oe=r==null?void 0:r.value)==null||Oe.addOverlay(re)}const xe=Oe=>{var kt,Dt;k.value[Oe]&&k.value.splice(Oe,1);const $e=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");$e[Oe]&&((Dt=(kt=$e[Oe])==null?void 0:kt.parentNode)==null||Dt.removeChild($e[Oe]));const qe=$.getFeatures();qe[Oe]&&$.removeFeature(qe[Oe])},Ie=()=>{i("close")};return vue.watch(()=>g,()=>{g.value&&!L.value&&(le(),he())},{deep:!0,immediate:!0}),e({addInteraction:he,removeInteraction:ue}),(Oe,$e)=>g.value&&Oe.viewMode!=="WxMiniprogram"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$a,[vue.createElementVNode("div",{class:"header"},[$e[1]||($e[1]=vue.createElementVNode("div",{class:"title"},"测量",-1)),vue.createElementVNode("i",{onClick:Ie,class:"map-iconfont icon-close"})]),vue.createElementVNode("div",_hoisted_2$6,[$e[2]||($e[2]=vue.createElementVNode("div",{class:"tips"},"在地图上点击多个点测量距离,距离单位",-1)),vue.createVNode(vue.unref(ElSelect),{class:"select-length-unit",modelValue:y.value,"onUpdate:modelValue":$e[0]||($e[0]=qe=>y.value=qe)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{label:"m",value:"1"}),vue.createVNode(vue.unref(ElOption),{label:"km",value:"2"}),vue.createVNode(vue.unref(ElOption),{label:"nm",value:"3"})]),_:1},8,["modelValue"])]),vue.createElementVNode("div",_hoisted_3$5,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(k.value,(qe,kt)=>(vue.openBlock(),vue.createElementBlock("div",{class:"measure-history-item",key:kt},[vue.createElementVNode("div",_hoisted_4$2,[$e[3]||($e[3]=vue.createElementVNode("i",{class:"map-iconfont icon-line"},null,-1)),vue.createElementVNode("span",_hoisted_5$2,"线段"+vue.toDisplayString(kt+1),1),vue.createElementVNode("span",_hoisted_6$2,vue.toDisplayString(qe),1)]),vue.createElementVNode("div",{class:"delete-button",onClick:Dt=>xe(kt)},$e[4]||($e[4]=[vue.createElementVNode("i",{class:"map-iconfont icon-delete"},null,-1)]),8,_hoisted_7$2)]))),128))])])):vue.createCommentVNode("",!0)}}),Measure=_export_sfc(_sfc_main$c,[["__scopeId","data-v-9b1d2f55"]]),mapInstance$8=vue.ref(),renderMarkerSetInstance=t=>mapInstance$8.value=t,markerPosition=vue.ref(""),marker=vue.ref(),createIconStyle=t=>new Style({image:new Icon({src:CDN_URL+"map/poi-marker-default.png",anchor:[.5,1]}),text:new Text({text:t,offsetY:-90,font:"12px",fill:new Fill({color:"#000"}),stroke:new Stroke({color:"#fff",width:2}),backgroundFill:new Fill({color:"#fff"}),backgroundStroke:new Stroke({color:"#000",width:1}),padding:[2,2,2,2]})}),renderMarker=(t,e=!0,n=!0)=>{var V;if(!mapInstance$8.value||!t||t.split(",").length!==2)return;const[r,i]=t.split(",").map(Number);marker.value=new Feature({geometry:new Point(fromLonLat([r,i]))});const g=n?`${r}, ${i}`:"";(V=marker.value)==null||V.setStyle(createIconStyle(g));const y=new VectorSource({features:[marker.value]}),k=new VectorLayer({source:y}),L=mapInstance$8.value.getView();if(mapInstance$8.value.addLayer(k),e){const z=new Translate({layers:[k]});z.on("translating",function(j){var ie;const oe=j.features.item(0).getGeometry().getCoordinates(),re=toLonLat(oe);markerPosition.value=`${re[0].toFixed(6)}, ${re[1].toFixed(6)}`,(ie=marker.value)==null||ie.setStyle(createIconStyle(markerPosition.value))}),mapInstance$8.value.addInteraction(z)}const $=new Point([r,i]);L.setCenter(transform($.getCoordinates(),projection.data,projection.mercator)),L.setZoom(mapZoom.findShip)},setMarkerPosition=t=>{var i,g;if(!mapInstance$8.value)return;const e=mapInstance$8.value.getView(),n=t.split(",").map(Number);(g=(i=marker.value)==null?void 0:i.getGeometry())==null||g.setCoordinates(fromLonLat([n[0],n[1]]));const r=new Point([n[0],n[1]]);e.setCenter(transform(r.getCoordinates(),projection.data,projection.mercator)),e.setZoom(mapZoom.markerPosition)},CDN_URL="https://static.zhihaoscm.cn/",tiandituKey="a6e8f78974f2581f2ca00485b40c948f",zhongkeKey="15c81cc0a191a232e0a0ca1a51c3ca81",baseMap={tiandituTile:`https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,tiandituTileMark:`https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,tiandituImgTile:`https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,tiandituImgTileMark:`https://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,greenTile:`${CDN_URL}/map/tile/{z}/{x}/{y}.png`},mapZoom={default:6,min:3,max:18,findShipMin:10,findShip:13,findTruck:14,shipGreenDotMax:11,truckDefault:14,truckStatistics:8,shipModelMin:13,shipModelMax:18,markerPosition:14},renderShipsLimit=200,mapDefaultCenter=[114.84,30.52],projection={data:"EPSG:4326",mercator:"EPSG:3857"},LOG_DATE_FORMAT="YYYY-MM-DD HH:mm:ss",DEFAULT_VALUE="--";vue.ref();const shipsLayer=vue.ref(),largeAmountShipsLayer=vue.ref(),selectShipsLayer=vue.ref(),allShips=vue.ref([]),selectSingleShipData=vue.ref();vue.ref();const trucksLayer=vue.ref(),shipTrackLineFeatures=vue.ref([]),trackLineVectorSource=vue.ref(),shipTrackVectorLayer=vue.ref();vue.ref(),vue.ref();const shipLabels=vue.ref([]),trackLabels=vue.ref([]),showTrackLayer=vue.ref(!1),allTracks=vue.ref([]),currentTrackId=vue.ref(""),showTrackAnimatMarker=vue.ref(!1),hiddenOrther=vue.ref(!1),showMeasure=vue.ref(!1),getShowMeasure=()=>showMeasure.value;function getIconFont(unicode=""){return unicode.indexOf("&")!==-1&&(unicode=unicode.replace("&","&")),unicode.indexOf("&")!==-1&&(unicode=unicode.replace("&","&")),eval('("'+unicode.replace("&#x","\\u").replace(";","")+'")')}const multiplyPixelRatio=t=>{const e=window.devicePixelRatio||1;return t.map(n=>n.map(r=>r*e))},adjustBounds=(t,e)=>e.length===2?[t[0]-e[0],t[1]-e[1],t[2]+e[0],t[3]+e[1]]:[t[0]+e[0],t[1]+e[1],t[2]+e[2],t[3]+e[3]],isOverlapping=(t,e)=>t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1],getIconStyle=t=>new Style({text:new Text({font:"Normal 14px map-iconfont",text:getIconFont(t),fill:new Fill({color:"#fff"}),offsetY:-14}),zIndex:100}),getRotation=(t,e,n)=>{function r(z){return 180*(z%(2*Math.PI))/Math.PI}function i(z){return z%360*Math.PI/180}function g(z){if(!z)throw new Error("Coordinate is required");if(!Array.isArray(z)){if(z.type==="Feature"&&z.geometry!==null&&z.geometry.type==="Point")return z.geometry.coordinates;if(z.type==="Point")return z.coordinates}if(Array.isArray(z)&&z.length>=2&&!Array.isArray(z[0])&&!Array.isArray(z[1]))return z;throw new Error("Coordinate must be GeoJSON Point or an Array of numbers")}function y(z,j,oe={}){if(oe.final)return function(Ce,_e){return(y(_e,Ce)+180)%360}(z,j);const re=g(z),ie=g(j),ae=i(re[0]),le=i(ie[0]),de=i(re[1]),pe=i(ie[1]),ue=Math.sin(le-ae)*Math.cos(pe),he=Math.cos(de)*Math.sin(pe)-Math.sin(de)*Math.cos(pe)*Math.cos(le-ae);return r(Math.atan2(ue,he))}function k(z){return!isNaN(z)&&z!==null&&!Array.isArray(z)}function L(z,j={},oe={}){return z||console.log("Coordinates are required"),Array.isArray(z)||console.log("Coordinates must be an Array"),z.length<2&&console.log("Coordinates must be at least 2 numbers long"),(!k(z[0])||!k(z[1]))&&console.log("Coordinates must contain numbers"),$({type:"Point",coordinates:z},j,oe)}function $(z,j={},oe={}){const re={type:"Feature"};return oe.id!==void 0&&(re.id=oe.id),oe.bbox&&(re.bbox=oe.bbox),re.properties=j||{},re.geometry=z,re}const V=y(L(t),L(e),n);return V<0?360+V:V},triangleModel=multiplyPixelRatio([[0,-8],[5,8],[-5,8]]),shipShapeModel=multiplyPixelRatio([[0,-4.545],[-.56,-3.909],[-1,-2.727],[-1,3.636],[-.8,4.545],[.8,4.545],[1,3.636],[1,-2.727],[.56,-3.909],[0,-4.545]]),shipDirectPath={left:{0:[[0,0],[0,-8],[-4,-8]],1:[[0,0],[0,-16],[-6,-16]],2:[[0,0],[0,-24],[-8,-24]]},right:{0:[[0,0],[0,-8],[-4,-8]],1:[[0,0],[0,-16],[-6,-16]],2:[[0,0],[0,-24],[-8,-24]]},front:{0:[[0,0],[0,-8]],1:[[0,0],[0,-16]],2:[[0,0],[0,-24]]}},setBlankStyle=()=>new Style({image:new CircleStyle({radius:0})}),mapInstance$7=vue.ref(),renderShipStyleSetInstance=t=>mapInstance$7.value=t,speedCondition=[[1,10],[10,20],[20,1/0]],drawShipModelByZoom={14:[200,30],15:[115,15],16:[55,8],17:[25,5],18:[1,1]},setShipStyle=(t,e=!1)=>new Style({renderer:(n,r)=>{n=n;const i=r.context,g=r.feature.get("data");if(!g)return;r.feature.get("index")===0&&(shipLabels.value=[]);try{const k=drawShipBody(i,g,n,e);k&&(drawHeading(i,g,k,e),g.selected=t,t&&drawSelectBounds(i,k)),drawShipLabel(i,g,n)}catch{return!1}}}),drawShipBody=(t,e,n,r)=>{if(!mapInstance$7.value)return;const i=Math.round(Number(mapInstance$7.value.getView().getZoom()));if(!i)return;let g=[];const[y,k]=drawShipModelByZoom[i]||[0,0],[L,$]=n;if(i<=mapZoom.shipModelMax&&i>mapZoom.shipModelMin&&e.length>=y&&e.breadth>=k)g=rotateShapeModel(drawCurrentShipShapeModel(e,i),e.angle).map(z=>{const[j,oe]=z;return[L+j,$+oe]});else{const V=rotateShapeModel(triangleModel,e.angle);n.length===2&&(g=V.map(z=>{const[j,oe]=z;return[L+j,$+oe]}))}if(!(g.length>2))return!1;if(e!=null&&e.length){const V=g.length===3?30:e.length*.4;t.beginPath(),t.arc(n[0],n[1],V,0,2*Math.PI),t.fillStyle="rgba(255, 255, 255, 0.001)",t.fill()}t.save(),t.beginPath(),t.moveTo(g[0][0],g[0][1]);for(let V=1;V<g.length;V++)t.lineTo(g[V][0],g[V][1]);return t.closePath(),t.strokeStyle=r?"#ff0000":"#000",t.lineWidth=r?2:1,t.stroke(),t.fillStyle=e.fill,t.fill(),t.restore(),g},drawHeading=(t,e,n,r)=>{const[i,g]=n[0],y=getShipDirectPath(e);if(y){const k=y.map(function(L){const[$,V]=L;return[$+i,V+g]});if(t.save(),t.beginPath(),e.angle>0){t.translate(i,g);const L=e.angle*Math.PI/180;t.rotate(L),t.translate(-i,-g)}t.moveTo(i,g);for(let L=1;L<k.length;L++){const[$,V]=k[L];t.lineTo($,V)}t.strokeStyle=r?"#ff0000":"#000",t.lineWidth=r?2:1,t.stroke(),t.restore()}},drawSelectBounds=(t,e)=>{let[n,r,i,g]=getPixelFromCoordinate(e);const y=window.devicePixelRatio||1,k=4;n-=k,r-=k,i+=k,g+=k,t.save(),t.strokeStyle="#ff0000",t.lineWidth=4*y;const L=8*y;t.beginPath(),t.moveTo(n+L,g),t.lineTo(n,g),t.lineTo(n,g-L),t.moveTo(n,r+L),t.lineTo(n,r),t.lineTo(n+L,r),t.moveTo(i-L,r),t.lineTo(i,r),t.lineTo(i,r+L),t.moveTo(i,g-L),t.lineTo(i,g),t.lineTo(i-L,g),t.stroke(),t.restore()},drawShipLabel=(t,e,n)=>{if(!e.selected&&shipLabels.value.find(z=>z.name===e.name))return;const[r,i]=n,g=r,y=i,k=e.name;let L;e.leftIconColor&&(L={color:e.leftIconColor,icon:""});const $=getShipCustomIcon(e),V={id:e.id,center:[g,y],text:k,fill:e.fill,color:"#fff",textColor:"#000",bgColor:"#fff",leftIcon:L,rightIcons:$,selected:e.selected,blinkColors:e.blinkColors,type:"ShipName"};drawLabel(t,V,shipLabels.value)},drawCurrentShipShapeModel=(t,e)=>{let n=0;e<=14?n=.058:e===15?n=.12:e===16?n=.22:e===17?n=.435:e===18&&(n=.857);const r=t.length/4*n,i=t.breadth*n;let g=cloneDeep(shipShapeModel);return g=g.map(([y,k])=>[y*i,k*r]),g},getShipDirectPath=t=>{const{speed:e,hdg:n,cog:r}=t;let i="",g=null;if(e&&e>1&&(n!==null&&n!=511&&r!==null?r-n>=3?i="left":r-n<=-3?i="right":i="front":i="front",i&&e))for(let y=0;y<speedCondition.length;y++){const k=speedCondition[y];if(e>=k[0]&&e<k[1]){g=shipDirectPath[i][y];break}}return g},getShipCustomIcon=t=>{const e=[];return t.existDevice&&e.push(""),t.existMobile&&e.push(""),t.existWaterGauge&&e.push(""),e||[]};class FeatureFormat{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Feature,this.supportedMediaTypes=null}getReadOptions(e,n){if(n){let r=n.dataProjection?get$1(n.dataProjection):this.readProjection(e);n.extent&&r&&r.getUnits()==="tile-pixels"&&(r=get$1(r),r.setWorldExtent(n.extent)),n={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(n)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return abstract()}readFeature(e,n){return abstract()}readFeatures(e,n){return abstract()}readGeometry(e,n){return abstract()}readProjection(e){return abstract()}writeFeature(e,n){return abstract()}writeFeatures(e,n){return abstract()}writeGeometry(e,n){return abstract()}}function transformGeometryWithOptions(t,e,n){const r=n?get$1(n.featureProjection):null,i=n?get$1(n.dataProjection):null;let g=t;if(r&&i&&!equivalent(r,i)){e&&(g=t.clone());const y=e?r:i,k=e?i:r;y.getUnits()==="tile-pixels"?g.transform(y,k):g.applyTransform(getTransform(y,k))}if(e&&n&&n.decimals!==void 0){const y=Math.pow(10,n.decimals),k=function(L){for(let $=0,V=L.length;$<V;++$)L[$]=Math.round(L[$]*y)/y;return L};g===t&&(g=t.clone()),g.applyTransform(k)}return g}const GeometryConstructor={Point,LineString,Polygon,MultiPoint,MultiLineString,MultiPolygon};function orientFlatCoordinates(t,e,n){return Array.isArray(e[0])?(linearRingssAreOriented(t,0,e,n)||(t=t.slice(),orientLinearRingsArray(t,0,e,n)),t):(linearRingsAreOriented(t,0,e,n)||(t=t.slice(),orientLinearRings(t,0,e,n)),t)}function createRenderFeature(t,e){var g;const n=t.geometry;if(!n)return[];if(Array.isArray(n))return n.map(y=>createRenderFeature({...t,geometry:y})).flat();const r=n.type==="MultiPolygon"?"Polygon":n.type;if(r==="GeometryCollection"||r==="Circle")throw new Error("Unsupported geometry type: "+r);const i=n.layout.length;return transformGeometryWithOptions(new RenderFeature(r,r==="Polygon"?orientFlatCoordinates(n.flatCoordinates,n.ends,i):n.flatCoordinates,(g=n.ends)==null?void 0:g.flat(),i,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function createGeometry(t,e){if(!t)return null;if(Array.isArray(t)){const r=t.map(i=>createGeometry(i,e));return new GeometryCollection(r)}const n=GeometryConstructor[t.type];return transformGeometryWithOptions(new n(t.flatCoordinates,t.layout,t.ends),!1,e)}class JSONFeature extends FeatureFormat{constructor(){super()}getType(){return"json"}readFeature(e,n){return this.readFeatureFromObject(getObject(e),this.getReadOptions(e,n))}readFeatures(e,n){return this.readFeaturesFromObject(getObject(e),this.getReadOptions(e,n))}readFeatureFromObject(e,n){return abstract()}readFeaturesFromObject(e,n){return abstract()}readGeometry(e,n){return this.readGeometryFromObject(getObject(e),this.getReadOptions(e,n))}readGeometryFromObject(e,n){return abstract()}readProjection(e){return this.readProjectionFromObject(getObject(e))}readProjectionFromObject(e){return abstract()}writeFeature(e,n){return JSON.stringify(this.writeFeatureObject(e,n))}writeFeatureObject(e,n){return abstract()}writeFeatures(e,n){return JSON.stringify(this.writeFeaturesObject(e,n))}writeFeaturesObject(e,n){return abstract()}writeGeometry(e,n){return JSON.stringify(this.writeGeometryObject(e,n))}writeGeometryObject(e,n){return abstract()}}function getObject(t){if(typeof t=="string"){const e=JSON.parse(t);return e||null}return t!==null?t:null}class GeoJSON extends JSONFeature{constructor(e){e=e||{},super(),this.dataProjection=get$1(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=get$1(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,n){let r=null;e.type==="Feature"?r=e:r={type:"Feature",geometry:e,properties:null};const i=readGeometryInternal(r.geometry);if(this.featureClass===RenderFeature)return createRenderFeature({geometry:i,id:r.id,properties:r.properties},n);const g=new Feature;return this.geometryName_?g.setGeometryName(this.geometryName_):this.extractGeometryName_&&r.geometry_name&&g.setGeometryName(r.geometry_name),g.setGeometry(createGeometry(i,n)),"id"in r&&g.setId(r.id),r.properties&&g.setProperties(r.properties,!0),g}readFeaturesFromObject(e,n){const r=e;let i=null;if(r.type==="FeatureCollection"){const g=e;i=[];const y=g.features;for(let k=0,L=y.length;k<L;++k){const $=this.readFeatureFromObject(y[k],n);$&&i.push($)}}else i=[this.readFeatureFromObject(e,n)];return i.flat()}readGeometryFromObject(e,n){return readGeometry(e,n)}readProjectionFromObject(e){const n=e.crs;let r;if(n)if(n.type=="name")r=get$1(n.properties.name);else if(n.type==="EPSG")r=get$1("EPSG:"+n.properties.code);else throw new Error("Unknown SRS type");else r=this.dataProjection;return r}writeFeatureObject(e,n){n=this.adaptOptions(n);const r={type:"Feature",geometry:null,properties:null},i=e.getId();if(i!==void 0&&(r.id=i),!e.hasProperties())return r;const g=e.getProperties(),y=e.getGeometry();return y&&(r.geometry=writeGeometry(y,n),delete g[e.getGeometryName()]),isEmpty$1(g)||(r.properties=g),r}writeFeaturesObject(e,n){n=this.adaptOptions(n);const r=[];for(let i=0,g=e.length;i<g;++i)r.push(this.writeFeatureObject(e[i],n));return{type:"FeatureCollection",features:r}}writeGeometryObject(e,n){return writeGeometry(e,this.adaptOptions(n))}}function readGeometryInternal(t,e){if(!t)return null;let n;switch(t.type){case"Point":{n=readPointGeometry(t);break}case"LineString":{n=readLineStringGeometry(t);break}case"Polygon":{n=readPolygonGeometry(t);break}case"MultiPoint":{n=readMultiPointGeometry(t);break}case"MultiLineString":{n=readMultiLineStringGeometry(t);break}case"MultiPolygon":{n=readMultiPolygonGeometry(t);break}case"GeometryCollection":{n=readGeometryCollectionGeometry(t);break}default:throw new Error("Unsupported GeoJSON type: "+t.type)}return n}function readGeometry(t,e){const n=readGeometryInternal(t);return createGeometry(n,e)}function readGeometryCollectionGeometry(t,e){return t.geometries.map(function(r){return readGeometryInternal(r)})}function readPointGeometry(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:getLayoutForStride(e.length)}}function readLineStringGeometry(t){var r;const e=t.coordinates,n=e.flat();return{type:"LineString",flatCoordinates:n,ends:[n.length],layout:getLayoutForStride(((r=e[0])==null?void 0:r.length)||2)}}function readMultiLineStringGeometry(t){var g,y;const e=t.coordinates,n=((y=(g=e[0])==null?void 0:g[0])==null?void 0:y.length)||2,r=[],i=deflateCoordinatesArray(r,0,e,n);return{type:"MultiLineString",flatCoordinates:r,ends:i,layout:getLayoutForStride(n)}}function readMultiPointGeometry(t){var n;const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:getLayoutForStride(((n=e[0])==null?void 0:n.length)||2)}}function readMultiPolygonGeometry(t){var g,y;const e=t.coordinates,n=[],r=((y=(g=e[0])==null?void 0:g[0])==null?void 0:y[0].length)||2,i=deflateMultiCoordinatesArray(n,0,e,r);return{type:"MultiPolygon",flatCoordinates:n,ends:i,layout:getLayoutForStride(r)}}function readPolygonGeometry(t){var g,y;const e=t.coordinates,n=[],r=(y=(g=e[0])==null?void 0:g[0])==null?void 0:y.length,i=deflateCoordinatesArray(n,0,e,r);return{type:"Polygon",flatCoordinates:n,ends:i,layout:getLayoutForStride(r)}}function writeGeometry(t,e){t=transformGeometryWithOptions(t,!0,e);const n=t.getType();let r;switch(n){case"Point":{r=writePointGeometry(t);break}case"LineString":{r=writeLineStringGeometry(t);break}case"Polygon":{r=writePolygonGeometry(t,e);break}case"MultiPoint":{r=writeMultiPointGeometry(t);break}case"MultiLineString":{r=writeMultiLineStringGeometry(t);break}case"MultiPolygon":{r=writeMultiPolygonGeometry(t,e);break}case"GeometryCollection":{r=writeGeometryCollectionGeometry(t,e);break}case"Circle":{r={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return r}function writeGeometryCollectionGeometry(t,e){return e=Object.assign({},e),delete e.featureProjection,{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(r){return writeGeometry(r,e)})}}function writeLineStringGeometry(t,e){return{type:"LineString",coordinates:t.getCoordinates()}}function writeMultiLineStringGeometry(t,e){return{type:"MultiLineString",coordinates:t.getCoordinates()}}function writeMultiPointGeometry(t,e){return{type:"MultiPoint",coordinates:t.getCoordinates()}}function writeMultiPolygonGeometry(t,e){let n;return e&&(n=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(n)}}function writePointGeometry(t,e){return{type:"Point",coordinates:t.getCoordinates()}}function writePolygonGeometry(t,e){let n;return e&&(n=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(n)}}class TextFeature extends FeatureFormat{constructor(){super()}getType(){return"text"}readFeature(e,n){return this.readFeatureFromText(getText(e),this.adaptOptions(n))}readFeatureFromText(e,n){return abstract()}readFeatures(e,n){return this.readFeaturesFromText(getText(e),this.adaptOptions(n))}readFeaturesFromText(e,n){return abstract()}readGeometry(e,n){return this.readGeometryFromText(getText(e),this.adaptOptions(n))}readGeometryFromText(e,n){return abstract()}readProjection(e){return this.readProjectionFromText(getText(e))}readProjectionFromText(e){return this.dataProjection}writeFeature(e,n){return this.writeFeatureText(e,this.adaptOptions(n))}writeFeatureText(e,n){return abstract()}writeFeatures(e,n){return this.writeFeaturesText(e,this.adaptOptions(n))}writeFeaturesText(e,n){return abstract()}writeGeometry(e,n){return this.writeGeometryText(e,this.adaptOptions(n))}writeGeometryText(e,n){return abstract()}}function getText(t){return typeof t=="string"?t:""}function flipXY(t,e,n,r,i,g){i!==void 0?(i=i,g=g!==void 0?g:0):(i=[],g=0);let y=e;for(;y<n;){const k=t[y++];i[g++]=t[y++],i[g++]=k;for(let L=2;L<r;++L)i[g++]=t[y++]}return i.length=g,i}class Polyline extends TextFeature{constructor(e){super(),e=e||{},this.dataProjection=get$1("EPSG:4326"),this.factor_=e.factor?e.factor:1e5,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY"}readFeatureFromText(e,n){const r=this.readGeometryFromText(e,n);return new Feature(r)}readFeaturesFromText(e,n){return[this.readFeatureFromText(e,n)]}readGeometryFromText(e,n){const r=getStrideForLayout(this.geometryLayout_),i=decodeDeltas(e,r,this.factor_);flipXY(i,0,i.length,r,i);const g=inflateCoordinates(i,0,i.length,r),y=new LineString(g,this.geometryLayout_);return transformGeometryWithOptions(y,!1,this.adaptOptions(n))}writeFeatureText(e,n){const r=e.getGeometry();if(r)return this.writeGeometryText(r,n);throw new Error("Expected `feature` to have a geometry")}writeFeaturesText(e,n){return this.writeFeatureText(e[0],n)}writeGeometryText(e,n){e=transformGeometryWithOptions(e,!0,this.adaptOptions(n));const r=e.getFlatCoordinates(),i=e.getStride();return flipXY(r,0,r.length,i,r),encodeDeltas(r,i,this.factor_)}}function encodeDeltas(t,e,n){n=n||1e5;let r;const i=new Array(e);for(r=0;r<e;++r)i[r]=0;for(let g=0,y=t.length;g<y;)for(r=0;r<e;++r,++g){const k=t[g],L=k-i[r];i[r]=k,t[g]=L}return encodeFloats(t,n)}function decodeDeltas(t,e,n){n=n||1e5;let r;const i=new Array(e);for(r=0;r<e;++r)i[r]=0;const g=decodeFloats(t,n);for(let y=0,k=g.length;y<k;)for(r=0;r<e;++r,++y)i[r]+=g[y],g[y]=i[r];return g}function encodeFloats(t,e){e=e||1e5;for(let n=0,r=t.length;n<r;++n)t[n]=Math.round(t[n]*e);return encodeSignedIntegers(t)}function decodeFloats(t,e){e=e||1e5;const n=decodeSignedIntegers(t);for(let r=0,i=n.length;r<i;++r)n[r]/=e;return n}function encodeSignedIntegers(t){for(let e=0,n=t.length;e<n;++e){const r=t[e];t[e]=r<0?~(r<<1):r<<1}return encodeUnsignedIntegers(t)}function decodeSignedIntegers(t){const e=decodeUnsignedIntegers(t);for(let n=0,r=e.length;n<r;++n){const i=e[n];e[n]=i&1?~(i>>1):i>>1}return e}function encodeUnsignedIntegers(t){let e="";for(let n=0,r=t.length;n<r;++n)e+=encodeUnsignedInteger(t[n]);return e}function decodeUnsignedIntegers(t){const e=[];let n=0,r=0;for(let i=0,g=t.length;i<g;++i){const y=t.charCodeAt(i)-63;n|=(y&31)<<r,y<32?(e.push(n),n=0,r=0):r+=5}return e}function encodeUnsignedInteger(t){let e,n="";for(;t>=32;)e=(32|t&31)+63,n+=String.fromCharCode(e),t>>=5;return e=t+63,n+=String.fromCharCode(e),n}const mapInstance$6=vue.ref(),renderShipSetInstance=t=>mapInstance$6.value=t;let shipsMarkerList=[],shipsVectorSource,largeAmountShipsSource;const selectedShipData=vue.ref(null),selectedShips=vue.ref([]);let selectShipsVectorSource;const renderShips=t=>{var n,r,i,g;if(!mapInstance$6.value||showTrackLayer.value)return;const e=Math.round(Number(mapInstance$6.value.getView().getZoom()));if(selectedShipData.value&&vue.nextTick(()=>{selectSingleShipMarker(selectedShipData.value)}).then(y=>{}),!(!e||e<mapZoom.shipGreenDotMax)&&(allShips.value=[...t,...selectedShips.value],!hiddenOrther.value))return e>=mapZoom.shipGreenDotMax&&e<mapZoom.shipModelMin?((n=shipsLayer.value)==null||n.setVisible(!1),(r=largeAmountShipsLayer.value)==null||r.setVisible(!0),renderLargeAmountShips(allShips.value)):((i=largeAmountShipsLayer.value)==null||i.setVisible(!1),(g=shipsLayer.value)==null||g.setVisible(!0),renderShipsMarker(allShips.value))},renderLargeAmountShips=t=>{if(!mapInstance$6.value)return;const e=t.map(n=>({type:"Feature",geometry:{type:"Point",coordinates:[n.lon,n.lat]},properties:n}));return largeAmountShipsSource==null||largeAmountShipsSource.clear(),largeAmountShipsSource=new VectorSource({features:new GeoJSON().readFeatures({type:"FeatureCollection",features:e},{featureProjection:projection.mercator})}),largeAmountShipsLayer.value=new WebGLPointsLayer({source:largeAmountShipsSource,style:{"shape-points":3,"shape-radius":9,"shape-fill-color":["case",["==",["get","fill"],"#D9001C"],"#D9001C",["==",["get","fill"],"#04C900"],"#04C900","#04C900"],"shape-rotate-with-view":!1,"shape-rotation":["+",["get","cog"],180],"shape-scale":[.8,1.2],"shape-stroke-color":"#000000","shape-stroke-width":.5}}),mapInstance$6.value.addLayer(largeAmountShipsLayer.value),largeAmountShipsLayer.value},renderShipsMarker=t=>{var n;if(!mapInstance$6.value)return;deleteAllShipMarkers();let e=convertShipMapData(t);if(e=customFilterShips(e),!!(e!=null&&e.length))return e.forEach((r,i)=>{const g=[r.lon,r.lat],y=new Feature({geometry:new Point(fromLonLat(g))}),k=1;y.set("clickGeometry",new Circle(fromLonLat(g),k)),y.set("data",r),y.set("index",i),y.setStyle(setShipStyle(!1)),shipsMarkerList.push({ship:r,lonlat:g,feature:y})}),shipsVectorSource=new VectorSource({features:shipsMarkerList.map(r=>r.feature)}),shipsLayer.value=new VectorLayer({source:shipsVectorSource,zIndex:100}),(n=mapInstance$6.value)==null||n.addLayer(shipsLayer.value),shipsLayer.value},onShipsMarkerHover=()=>{var r;let t=null,e=0;const n=100;(r=mapInstance$6.value)==null||r.on("pointermove",function(i){var L,$,V,z;const g=Date.now();if(g-e<n)return;e=g;const y=(L=mapInstance$6.value)==null?void 0:L.forEachFeatureAtPixel(i.pixel,j=>j),k=($=mapInstance$6.value)==null?void 0:$.getTargetElement();if(k&&(k.style.cursor=y?"pointer":""),t!==y){if(t){const j=t.get("data");if(!(j!=null&&j.mmsi))return;t.setStyle(setShipStyle(((V=selectedShipData.value)==null?void 0:V.id)===j.id,!1))}if(y){const j=y.get("data");if(!(j!=null&&j.mmsi))return;t=y,y.setStyle(setShipStyle(((z=selectedShipData.value)==null?void 0:z.id)===j.id,!0))}else t=null}})},customFilterShips=t=>{let e=cloneDeep(t);return e=e.filter(n=>{var i;const r=getFilterItem(n).every(({btnShow:g,value:y})=>g?!!y:!0);return(switchBtnShow.value.camera||switchBtnShow.value.mobile||switchBtnShow.value.waterGauge)&&((i=selectedShipData.value)==null?void 0:i.id)===n.id&&clearSelectFeature(),r}),e},getFilterItem=t=>[{btnShow:switchBtnShow.value.camera,value:t==null?void 0:t.existDevice},{btnShow:switchBtnShow.value.mobile,value:t==null?void 0:t.existMobile},{btnShow:switchBtnShow.value.waterGauge,value:t==null?void 0:t.existWaterGauge}],deleteAllShipMarkers=()=>{shipsMarkerList.forEach(t=>{t.feature&&(shipsVectorSource==null||shipsVectorSource.removeFeature(t.feature))}),clearAllInterval(),shipsMarkerList=[]},selectSingleShipMarker=t=>{var g;if(!mapInstance$6.value)return;const e=cloneDeep(selectSingleShipData.value);selectSingleShipData.value=convertShipMapData(t);const n=[selectSingleShipData.value.lon,selectSingleShipData.value.lat],r=new Feature({geometry:new Point(fromLonLat(n))});r.set("data",selectSingleShipData.value),r.setStyle(setShipStyle(!0)),shipsMarkerList.push({ship:selectSingleShipData.value,lonlat:n,feature:r}),selectShipsVectorSource==null||selectShipsVectorSource.clear(),selectShipsVectorSource=new VectorSource({features:[r]}),selectShipsLayer.value=new VectorLayer({source:selectShipsVectorSource}),shipsVectorSource&&setVisibleFeatureById(shipsVectorSource,selectSingleShipData.value.id,!0);const i=(g=shipsLayer.value)==null?void 0:g.getSource();return i&&(e&&setVisibleFeatureById(i,e.id,!0),setVisibleFeatureById(i,selectSingleShipData.value.id,!1)),mapInstance$6.value.addLayer(selectShipsLayer.value),selectShipsLayer.value.setVisible(!0),selectShipsLayer.value},setVisibleFeatureById=(t,e,n)=>{t&&t.forEachFeature(r=>{const i=r.get("data");i&&i.id===e&&r.setStyle(n?setShipStyle(!1,i.id):setBlankStyle())})},findShip=(t,e,n=!0)=>{var i,g,y,k,L;if(!t||!mapInstance$6.value)return;const r=(y=(g=(i=shipsLayer.value)==null?void 0:i.getSource())==null?void 0:g.getFeatures())==null?void 0:y.find($=>{var V;return((V=$.get("data"))==null?void 0:V.id)===t});if(r)selectedShipData.value=r.get("data");else if(e)selectedShipData.value=e;else{console.error("找不到船舶");return}if(selectedShips.value.some($=>{var V;return $.id===((V=selectedShipData.value)==null?void 0:V.id)})||selectedShips.value.push(selectedShipData.value),n&&((k=selectedShipData.value)!=null&&k.lon)&&((L=selectedShipData.value)!=null&&L.lat)){const $=mapInstance$6.value.getView(),V=new Point([selectedShipData.value.lon,selectedShipData.value.lat]);$.setCenter(transform(V.getCoordinates(),projection.data,projection.mercator));const z=$.getZoom(),j=z<mapZoom.findShipMin?mapZoom.findShip:z;$.setZoom(j)}return setTimeout(()=>{e&&selectSingleShipMarker(e)},50),r},clearSelectFeature=()=>{var t;if(selectedShipData.value&&shipsVectorSource&&selectSingleShipData.value){setVisibleFeatureById(shipsVectorSource,selectSingleShipData.value.id,!1);const e=(t=shipsLayer.value)==null?void 0:t.getSource();e&&setVisibleFeatureById(e,selectSingleShipData.value.id,!0)}selectedShipData.value=null,mapInstance$6.value&&(selectShipsVectorSource==null||selectShipsVectorSource.clear(),selectShipsLayer.value=new VectorLayer({source:selectShipsVectorSource}),mapInstance$6.value.addLayer(selectShipsLayer.value),selectShipsLayer.value.setVisible(!1))},hiddenAllShips=()=>{var t,e;(t=shipsLayer.value)==null||t.setVisible(!1),(e=largeAmountShipsLayer.value)==null||e.setVisible(!1)},switchBtnShow=vue.ref({[SWITCH_BTN.Camera]:!1,[SWITCH_BTN.Mobile]:!1,[SWITCH_BTN.WaterGauge]:!1}),switchFilterItem=(t,e)=>{switchBtnShow.value[t]=e,renderShips(allShips.value)},rerenderShip=()=>{renderShips(allShips.value)},labelAlpha=.8,pixelRatio=window.devicePixelRatio||1,labelFont=`500 ${12*pixelRatio}px Arial`,labelOutSize=2*pixelRatio,labelHeight=10*pixelRatio,fillRectRadius=(t,e,n,r,i,g,y=4)=>{t.beginPath(),t.moveTo(e+y,n),t.arcTo(e+r,n,e+r,n+y,y),t.arcTo(e+r,n+i,e+r-y,n+i,y),t.arcTo(e,n+i,e,n+i-y,y),t.arcTo(e,n,e+y,n,y),t.closePath(),t.fillStyle=g,t.fill()},getPixelFromCoordinate=t=>{if(!t||t.length===0)throw new Error("Points array is empty or invalid.");let e=1/0,n=1/0,r=-1/0,i=-1/0;for(const[g,y]of t)g<e&&(e=g),y<n&&(n=y),g>r&&(r=g),y>i&&(i=y);return[e,n,r,i]},calculatePolygonCentroid=t=>{if(!Array.isArray(t)||t.length<3)throw new Error("A polygon must have at least 3 coordinates.");let e=0,n=0,r=0;const i=t.length;for(let k=0;k<i-1;k++){const[L,$]=t[k],[V,z]=t[k+1],j=L*z-V*$;r+=j,e+=(L+V)*j,n+=($+z)*j}if(r*=.5,r===0)throw new Error("多边形面积为零");const g=e/(6*r),y=n/(6*r);return[g,y]},rotateShapeModel=(t,e)=>{const[n,r]=calculatePolygonCentroid(t),i=e*Math.PI/180,g=Math.cos(i),y=Math.sin(i);return t.map(([k,L])=>{const $=k-n,V=L-r,z=$*g-V*y+n,j=$*y+V*g+r;return[z,j]})},getTopLeftPoint=t=>[t[0],t[3]],getBottomLeftPoint=t=>[t[2],t[3]],getBottomRightPoint=t=>[t[2],t[1]],getTopRighttPoint=t=>[t[0],t[1]];function calculateBounds(t,e,n,r,i){let g,y,k,L;const $=t[0],V=t[1];switch(e){case 0:g=$+i,y=g+n,L=V-i,k=L-r;break;case 1:g=$+i,y=g+n,L=V+r/2,k=L-r;break;case 2:g=$+i,y=g+n,L=V+i+r,k=L-r;break;case 3:g=$-n/2,y=g+n,L=V+i+r,k=L-r;break;case 4:y=$,g=y-n,L=V+i+r,k=L-r;break;case 5:y=$-i,g=y-n,L=V+r/2,k=L-r;break;case 6:y=$,g=y-n,L=V-i,k=L-r;break;case 7:g=$-n/2,y=g+n,L=V-i,k=L-r}if(!(!g||!k||!y||!L))return[Math.min(g,y),Math.min(k,L),Math.max(g,y),Math.max(k,L)+1]}function calculateAnchorPoint(t,e,n=70,r=20,i=20){const g=[0,0];switch(e){case 0:g[0]=t[0]+i,g[1]=t[1]-i-r/2;break;case 1:g[0]=t[0]+i,g[1]=t[1];break;case 2:g[0]=t[0]+i,g[1]=t[1]+i+r/2;break;case 3:g[0]=t[0],g[1]=t[1]+i+r/4;break;case 4:g[0]=Math.max(t[0]-i,t[0]-n/2),g[1]=t[1]+i+r/4;break;case 5:g[0]=t[0]-i,g[1]=t[1];break;case 6:g[0]=Math.max(t[0]-i,t[0]-n/2),g[1]=t[1]-i-r/4;break;case 7:g[0]=t[0],g[1]=t[1]-i-r/4}return g}function drawLabelBody(t,e,n){if(!t)return;const{font:r,labelOutSize:i=2,labelHeight:g,center:y,text:k,leftIcon:L,shipColor:$,lineLength:V=20,selected:z}=n;t.save(),r&&(t.font=r);let j=t.measureText(k).width+4*i;(L||$)&&(j+=g+6*i),t.restore();let oe,re=20,ie=-1,ae=g+3*i;if(V)for(let le=0;le<8;le++){oe=calculateBounds(y,le,j,ae,V);let de=!1;for(let pe=0;pe<e.length;++pe){let ue=e[pe].bounds,he=[ue[0]-re,ue[1]-re,ue[2]+re,ue[3]+re];if(oe&&isOverlapping(oe,he)){de=!0;break}}if(!de){ie=le;break}}else ie=0,oe=calculateBounds(y,ie,j,ae,V);if(z&&ie===-1&&(ie=0),oe&&ie>-1){let le=getBottomLeftPoint(oe),de=getTopRighttPoint(oe);return{center:y,x:calculateAnchorPoint(y,ie,j,ae,V),l:de,r:le,bounds:oe,position:ie,name:k}}else return null}const drawText=(t,e)=>{if(!t)return;const{center:n,text:r,textColor:i,leftIcon:g,rightIcons:y,font:k}=e;t.save(),t.setTransform(1,0,0,1,0,0);let[L,$]=n;if(g){t.font=`${18*pixelRatio}px map-iconfont`;let V=getIconFont(g.icon);t.fillStyle=g.color,t.fillText(V,L+labelOutSize-3*pixelRatio,$+2.6*pixelRatio),L+=23*pixelRatio}if(y!=null&&y.length){t.font=`${12*pixelRatio}px map-iconfont`,t.fillStyle="#3370ff";const V=t.measureText(r).width+6*pixelRatio;y.forEach((z,j)=>{const oe=getIconFont(z),re=20*pixelRatio*j;t.fillText(oe,L+V+re,$)})}t.font=k||labelFont,t.fillStyle=i,t.fillText(r,L+2,$),t.restore()},drawPolygon=(t,e)=>{let{points:n,strokeColor:r,fillColor:i,shouldClosePath:g,translation:y,rotation:k,rotationCenter:L,scale:$,globalAlpha:V}=e;if(V||(V=1),n&&t){t.save(),t.beginPath(),k&&k!==0&&L==null&&t.rotate(k),y&&t.translate(y[0],y[1]),k&&(L!=null&&L.length)&&t.rotate(k),$&&t.scale($,$),t.moveTo(n[0][0],n[0][1]);for(let z=1;z<n.length;z++)t.lineTo(n[z][0],n[z][1]);g&&t.closePath(),r&&(t.strokeStyle=r,t.stroke()),i&&g&&(V&&(t.globalAlpha=V),t.fillStyle=i,t.fill()),t.restore()}},intervalIds={},drawLabel=(t,e,n)=>{var z,j,oe,re,ie,ae,le;let{center:r,text:i,color:g,textColor:y,bgColor:k,leftIcon:L,rightIcons:$,type:V}=e;if(r&&i){const de={font:labelFont,labelOutSize,labelHeight,center:r,text:i,leftIcon:L,selected:e.selected};(z=e.blinkColors)!=null&&z.length&&e.fill&&(k=e.fill,y=getForegroundColor(e.fill));const pe=drawLabelBody(t,n,de);if(pe){const{x:ue,bounds:he,l:Ce}=pe,_e=[getTopLeftPoint(he),getBottomLeftPoint(he),getBottomRightPoint(he),getTopRighttPoint(he)];n.find(kt=>kt.name===i)||n.push(pe),drawPolygon(t,{points:[r,ue],strokeColor:g,fillColor:"#000",shouldClosePath:!0,translation:void 0,rotation:void 0,rotationCenter:void 0,scale:void 0,globalAlpha:labelAlpha}),$!=null&&$.length&&$.forEach((kt,Dt)=>{_e[1][0]+=28+Dt*pixelRatio,_e[2][0]+=28+Dt*pixelRatio});const Ie={points:_e,strokeColor:g,fillColor:k,shouldClosePath:!0},[Oe,$e]=Ce,qe={center:[Oe,$e+labelOutSize+labelHeight+1],text:i,textColor:y,leftIcon:L,rightIcons:$,blinkColors:e.blinkColors};if(drawPolygon(t,Ie),drawText(t,qe),e!=null&&e.blinkColors&&e.blinkColors.length>0){let kt=Date.now(),Dt=0;const Ve=e.blinkColors;!!!((re=(oe=(j=selectShipsLayer.value)==null?void 0:j.getSource())==null?void 0:oe.getFeatures())!=null&&re.find(ze=>{var Ue;return((Ue=ze.get("data"))==null?void 0:Ue.id)===e.id})||(le=(ae=(ie=shipsLayer.value)==null?void 0:ie.getSource())==null?void 0:ae.getFeatures())!=null&&le.find(ze=>{var Ue;return((Ue=ze.get("data"))==null?void 0:Ue.id)===e.id}))||hiddenOrther.value?(clearInterval(intervalIds[e.id]),deleteLabelFromArray(n,i)):(intervalIds[e.id]&&clearInterval(intervalIds[e.id]),intervalIds[e.id]=window.setInterval(()=>{var Et,Pt,hn;const ze=Date.now();ze-kt>=500&&(Dt=(Dt+1)%Ve.length,kt=ze,Ie.fillColor=Ve[Dt],drawPolygon(t,Ie),qe.textColor=getForegroundColor(Ie.fillColor),drawText(t,qe));const Ue=shipsMarkerList==null?void 0:shipsMarkerList.some(Lt=>{var jt;return((jt=Lt.ship)==null?void 0:jt.id)===e.id}),Ne=(hn=(Pt=(Et=shipsLayer.value)==null?void 0:Et.getSource())==null?void 0:Pt.getFeatures())==null?void 0:hn.some(Lt=>{const jt=Lt.get("data");return(jt==null?void 0:jt.id)===e.id});!Ue&&!Ne&&(clearInterval(intervalIds[e.id]),deleteLabelFromArray(n,i))},10))}else shipLabels.value.find(Dt=>Dt.name===i)&&(clearInterval(intervalIds[e.id]),drawPolygon(t,Ie),drawText(t,qe))}}return null},clearAllInterval=()=>{Object.keys(intervalIds).forEach(t=>{clearInterval(t)})},deleteLabelFromArray=(t,e)=>{const n=t.findIndex(r=>r.name===e);n!==-1&&t.splice(n,1)},PI=Math.PI,a=6378245,ee=.006693421622965943;function transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*PI)+20*Math.sin(2*t*PI))*2/3,n+=(20*Math.sin(e*PI)+40*Math.sin(e/3*PI))*2/3,n+=(160*Math.sin(e/12*PI)+320*Math.sin(e*PI/30))*2/3,n}function transformLng(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*PI)+20*Math.sin(2*t*PI))*2/3,n+=(20*Math.sin(t*PI)+40*Math.sin(t/3*PI))*2/3,n+=(150*Math.sin(t/12*PI)+300*Math.sin(t/30*PI))*2/3,n}function outOfChina(t,e){return!(t>73.66&&t<135.05&&e>3.86&&e<53.55)}function gcj02ToWgs84(t){const[e,n]=t.split(",").map(Number);if(outOfChina(e,n))return`${e.toFixed(6)}, ${n.toFixed(6)}`;{let r=transformLat(e-105,n-35),i=transformLng(e-105,n-35);const g=n/180*PI;let y=Math.sin(g);y=1-ee*y*y;const k=Math.sqrt(y);r=r*180/(a*(1-ee)/(y*k)*PI),i=i*180/(a/k*Math.cos(g)*PI);const L=n+r,$=e+i;return`${(e*2-$).toFixed(6)}, ${(n*2-L).toFixed(6)}`}}function calculateCirclePoints(t,e){const n=fromLonLat(t),r=e*1e3,i=[n[0]-r,n[1]-r,n[0]+r,n[1]+r],g=transformExtent(i,projection.mercator,projection.data);return{leftTopPoint:{lng:g[0],lat:g[3]},rightTopPoint:{lng:g[2],lat:g[3]},rightBottomPoint:{lng:g[2],lat:g[1]},leftBottomPoint:{lng:g[0],lat:g[1]}}}const equatorialCircumference=2003750834e-2;function lonLatToMercator(t){const e=t[0]*equatorialCircumference/180;let n=Math.log(Math.tan((90+t[1])*Math.PI/360))/(Math.PI/180);return n=n*equatorialCircumference/180,[e,n]}function mercatorToLonLat(t,e="lonlat"){const n={lon:0,lat:0},r=t[0]/equatorialCircumference*180;let i=t[1]/equatorialCircumference*180;return i=180/Math.PI*(2*Math.atan(Math.exp(i*Math.PI/180))-Math.PI/2),n.lon=r,n.lat=i,e==="lonlat"?n:[r,i]}function calculateBoundingBox(t){let e=1/0,n=-1/0,r=1/0,i=-1/0;t.forEach(ie=>{const[ae,le]=ie;e=Math.min(e,le),n=Math.max(n,le),r=Math.min(r,ae),i=Math.max(i,ae)});const g=i-r,y=n-e,k=Math.max(g,y),L=(r+i)/2,$=(e+n)/2,V=k/2,z=L-V,j=L+V,oe=$-V,re=$+V;return[j,oe,z,re]}const transformUtils={gcj02ToWgs84,calculateCirclePoints,lonLatToMercator,mercatorToLonLat,calculateBoundingBox},mapInstance$5=vue.ref(),renderTrackStyleSetInstance=t=>mapInstance$5.value=t,stopIcon="",stopColor="#E31818",slowIcon="",slowColor="#1890FF",dropletsIcon="",trackList$1=vue.ref([]);let animationFeature;const renderTrackLine=(t,e,n)=>{var g,y,k;const r=t[e];if(!r)return;allTracks.value[e]=r,trackList$1.value=[],trackList$1.value=r.map((L,$)=>(L.center=[L.lon,L.lat],L.centerPoint=transformUtils.lonLatToMercator(L.center),L.id=e,L.index=$,L.time=hooks(L.createdAt).format("YYYY-MM-DD HH:mm:ss"),L));const i=trackList$1.value.map(L=>L.centerPoint);if(i.length>=2){const L=new LineString(i),$=new Feature({geometry:L});$.setStyle(new Style({stroke:new Stroke({color:n,width:2})})),$.setId(e),$.set("type","line"),(y=(g=shipTrackVectorLayer.value)==null?void 0:g.getSource())==null||y.clear(),shipTrackLineFeatures.value=[];const V=shipTrackLineFeatures.value.findIndex(j=>j.getId()===e);V>=0?shipTrackLineFeatures.value[V]=$:shipTrackLineFeatures.value.push($);const z=createAnimatedIconFeature(n,i);trackLineVectorSource.value=new VectorSource({features:[...shipTrackLineFeatures.value]}),animationFeature=z,console.log(animationFeature),shipTrackVectorLayer.value=new VectorLayer({source:trackLineVectorSource.value,zIndex:102}),renderPoint(n),(k=mapInstance$5.value)==null||k.addLayer(shipTrackVectorLayer.value)}},handlePlay=(t,e)=>{const n=allTracks.value[String(t)];playAnimation(n.map(r=>[r.lon,r.lat]),e)},removeShipTrackLineFeatureByIndex=(t,e)=>{t>=0&&t<shipTrackLineFeatures.value.length&&(shipTrackLineFeatures.value.splice(t,1),delete allTracks.value[e]),trackLineVectorSource.value=new VectorSource({features:[...shipTrackLineFeatures.value]}),shipTrackVectorLayer.value&&shipTrackVectorLayer.value.setSource(trackLineVectorSource.value)},createAnimatedIconFeature=(t,e)=>{const n=new Feature({geometry:new Point(fromLonLat([e[0][0],e[0][1]]))}),r=new Style({text:new Text({font:"700 14px map-iconfont",text:getIconFont(""),fill:new Fill({color:t})})});return n.setStyle(r),n},geoMarkerStyle=new Style({text:new Text({font:"700 20px map-iconfont",text:getIconFont(""),fill:new Fill({color:"#ff0000"}),rotation:0})});let polyline,linePath,startMarker,position,geoMarker,vectorLayer;const trackAnimating=vue.ref(!1);let distance=0,lastTime=Date.now(),moveFeatureHandler=null;const moveFeature=(t,e)=>{var z,j,oe;const n=Number(50*e),r=((z=t.frameState)==null?void 0:z.time)??Date.now(),i=r-lastTime;if(distance=(distance+n*i/1e6)%2,lastTime=r,distance>=1){stopAnimation();return}const g=linePath.getCoordinateAt(distance>1?2-distance:distance),y=linePath.getCoordinateAt(distance>1?distance-.01:distance),k=linePath.getCoordinateAt(distance>1?2-distance:distance+.01),$=getRotation(transformUtils.mercatorToLonLat(y,"array"),transformUtils.mercatorToLonLat(k,"array"))*Math.PI/180;(j=geoMarkerStyle.getText())==null||j.setRotation($),position.setCoordinates(g);const V=getVectorContext(t);V.context_.save(),V.setStyle(geoMarkerStyle),V.drawGeometry(position),V.context_.restore(),(oe=mapInstance$5.value)==null||oe.render()},startAnimation=()=>{var t;trackAnimating.value=!0,showTrackAnimatMarker.value=!0,lastTime=Date.now(),distance=0,position=((t=startMarker.getGeometry())==null?void 0:t.clone())||new Point([0,0]),moveFeatureHandler&&(vectorLayer==null||vectorLayer.on("postrender",moveFeatureHandler)),geoMarker==null||geoMarker.setGeometry(void 0)},stopAnimation=()=>{var t;trackAnimating.value&&(trackAnimating.value=!1,geoMarker==null||geoMarker.setGeometry(void 0),moveFeatureHandler&&vectorLayer&&vectorLayer.un("postrender",moveFeatureHandler),vectorLayer&&((t=mapInstance$5.value)==null||t.removeLayer(vectorLayer)),vectorLayer=null,geoMarker=null)},playAnimation=(t,e)=>{var r;trackAnimating.value&&stopAnimation(),polyline=new Polyline({factor:1e6}).writeGeometry(new LineString(t)),linePath=new Polyline({factor:1e6}).readGeometry(polyline,{dataProjection:projection.data,featureProjection:projection.mercator}),startMarker=new Feature({type:"icon",geometry:new Point(linePath.getFirstCoordinate())});const n=startMarker.getGeometry();position=n?n.clone():new Point([0,0]),geoMarker=new Feature({type:"geoMarker",style:geoMarkerStyle,geometry:position}),vectorLayer=new VectorLayer({source:new VectorSource({features:[geoMarker]})}),(r=mapInstance$5.value)==null||r.addLayer(vectorLayer),moveFeatureHandler=i=>moveFeature(i,e),startAnimation()},renderPoint=t=>{if(!mapInstance$5.value)return;const e=trackList$1.value||[];if(!(e&&e.length>1))return[];const n={16:24,17:15,default:4},r=[],i=e.length;for(let k=0;k<i;k++){e[k].index=k;const L=mapInstance$5.value.getPixelFromCoordinate(e[k].centerPoint);if(L){let $=L.concat(L);$=adjustBounds($,[20,20]);const V=mapInstance$5.value.getView().getZoom();if(!V)return;if(V>15){const j=n[V]||n.default;$=adjustBounds($,[j,j])}let z=!0;if(e[k].state!=="0"){for(let j=0;j<r.length;j++)if(isOverlapping($,r[j].bounds)){z=!1;break}}z&&(e[k].bounds=$,r.push(e[k]))}}const g=getIconStyle(stopIcon),y=getIconStyle(slowIcon);r.forEach((k,L)=>{var z,j;const $=new Feature({geometry:new Point(k.centerPoint)});$.set("type","track_point"),$.set("data",k),$.setStyle([new Style({image:new CircleStyle({stroke:new Stroke({color:"rgba(0, 0, 0, 0.01)",width:20}),radius:3})}),new Style({image:new CircleStyle({fill:new Fill({color:t}),stroke:new Stroke({color:"#fff",width:2}),radius:3})})]),trackLineVectorSource.value.addFeature($);const V=new Feature({geometry:new Point(fromLonLat(k.center))});if(V.set("type","track_label"),V.set("track_label_index",L),V.setStyle(setTrackLabelStyle(k,t)),trackLineVectorSource.value.addFeature(V),typeof k=="object"&&k.hasOwnProperty("state")){const oe=new Feature({geometry:new Point(k.centerPoint)});oe.set("type","track_icon");const re=new Style({text:new Text({font:"Normal 22px map-iconfont",text:getIconFont(dropletsIcon),offsetY:-10}),zIndex:99}),ie=[];Number(k.state)===0?((z=re.getText())==null||z.setFill(new Fill({color:stopColor})),ie.push(g)):Number(k.state)===1&&((j=re.getText())==null||j.setFill(new Fill({color:slowColor})),ie.push(y)),ie.push(re),oe.setStyle(ie),trackLineVectorSource.value.addFeature(oe)}}),renderArrow(r,t),renderIconPoint()},renderArrow=(t,e)=>{const n=t.length;n||(t.push(trackList$1.value[0]),t.push(trackList$1.value[trackList$1.value.length-1]));for(let r=0;r<n-1;r++){let i;const g=t[r],y=(t[r+1].index+g.index)/2;if(y%2===0)i=trackList$1.value[y].centerPoint;else{const k=trackList$1.value[Math.floor(y)],L=trackList$1.value[Math.ceil(y)];if(k&&L){const[$,V]=k.centerPoint,[z,j]=L.centerPoint;i=[($+z)/2,(V+j)/2]}}if(i){const k=new Feature({geometry:new Point(i)});k.set("type","track_arrow"),k.setStyle(new Style({text:new Text({font:"700 14px map-iconfont",text:getIconFont(""),fill:new Fill({color:e}),rotation:getRotation(t[r].center,t[r+1].center)*(Math.PI/180)})})),trackLineVectorSource.value.addFeature(k)}}},renderIconPoint=()=>{const t="",e="#fcdc3f",n="#ff0000";(trackList$1.value.length<2?[trackList$1.value[0]]:[trackList$1.value[0],trackList$1.value[trackList$1.value.length-1]]).forEach(i=>{const g=new Feature({geometry:new Point(i.centerPoint)});g.set("type","track_begin"),g.set("data",i);const y=i.index===0&&trackList$1.value.length>=2?e:n;g.setStyle(new Style({text:new Text({font:"Normal 14px map-iconfont",text:getIconFont(t),fill:new Fill({color:y})}),zIndex:101})),trackLineVectorSource.value.addFeature(g)})},setTrackLabelStyle=(t,e)=>new Style({renderer:(n,r)=>{const i=r.context,k={id:t.id||"",center:n,text:t.time,color:e,textColor:"#000",bgColor:"rgba(255,255,255,.8)",selected:!0,type:"TrackTime"};drawLabel(i,k,trackLabels.value)}}),mapInstance$4=vue.ref(),renderCustomOverlaySetInstance=t=>mapInstance$4.value=t,drawCustomContent=(t,e,n,r="top-left",i=!1)=>{var V,z;if(!e||!mapInstance$4.value)return;document.querySelectorAll(".truck-custom-content").forEach(j=>{var oe;return(oe=j.parentNode)==null?void 0:oe.removeChild(j)});const g=document.createElement("div");g.innerHTML=n;const y=new Overlay({element:g,position:e,positioning:r,stopEvent:i});if(i){let j=!1,oe=[0,0],re=[0,0],ie=0,ae=0;g.addEventListener("mousedown",function(le){var pe;j=!0,ie=le.clientX,ae=le.clientY;const de=(pe=mapInstance$4.value)==null?void 0:pe.getCoordinateFromPixel([le.clientX-200,le.clientY-200]);de&&(oe=de),re=[le.clientX-g.getBoundingClientRect().left+160,le.clientY-g.getBoundingClientRect().top+84],le.preventDefault(),console.log(t,ie,ae)}),document.addEventListener("mousemove",function(le){var de;if(j){const pe=(de=mapInstance$4.value)==null?void 0:de.getCoordinateFromPixel([le.clientX-re[0],le.clientY-re[1]]),ue=pe[0]-oe[0],he=pe[1]-oe[1];y.setPosition([oe[0]+ue,oe[1]+he])}}),document.addEventListener("mouseup",function(){j=!1})}(V=mapInstance$4.value)==null||V.addOverlay(y);const k=g.querySelector(".close-button");k&&k.addEventListener("click",()=>{var j,oe;(j=mapInstance$4.value)==null||j.removeOverlay(y),(oe=g.parentNode)==null||oe.removeChild(g)});const L=JSON.parse(JSON.stringify(e)),$=(z=mapInstance$4.value)==null?void 0:z.getCoordinateFromPixel(L);return y.setPosition($),y},mapInstance$3=vue.ref(),renderTrackSetInstance=t=>mapInstance$3.value=t,showTracks=vue.ref([]),trackList=vue.ref([]);vue.ref(null);const trackId=vue.ref(""),cursor=vue.ref(0),renderTrack=(t,e,n,r,i="ship")=>{var V;if(console.log(i),vue.nextTick(()=>{hiddenAllShips()}).then(z=>{}),(e==null?void 0:e.length)<2){((V=showTracks.value)==null?void 0:V.findIndex(z=>z.id===t))<0&&showTracks.value.push({id:t,length:""});return}const g={};e.forEach(z=>{z.state?z.state=Number(z.state):delete z.state}),trackId.value=t,g[t]=e,trackList.value=e;const y=["#ff0000","#00ff00","#0079ff","#ffa500","#800080","#008080","#ffc0cb","#800000","#000080","#808000"],k=g[t].map(z=>transform([z.lon,z.lat],projection.data,projection.mercator)),L=new LineString(k),$=formatUtils.formatLength(L,r)||"--";vue.nextTick(()=>{var j,oe;const z=(j=showTracks.value)==null?void 0:j.findIndex(re=>re.id===t);z<0?showTracks.value.push({id:t,length:$}):showTracks.value[z].length=$,++cursor.value,cursor.value>y.length&&(cursor.value=0),renderTrackLine(g,t,n),vue.nextTick(()=>{resetTrackView(t)}).then(()=>{}),(oe=mapInstance$3.value)==null||oe.on("moveend",()=>{showTrackLayer.value&&(trackLabels.value=[],renderTrackLine(g,t,n))}),renderTrackPointPopup()}).then(()=>{})},renderTrackPointPopup=()=>{var e;const t=vue.ref(null);(e=mapInstance$3.value)==null||e.on("pointermove",n=>{var i,g,y,k;t.value&&((i=mapInstance$3.value)==null||i.removeOverlay(t.value));const r=(g=mapInstance$3.value)==null?void 0:g.forEachFeatureAtPixel(n.pixel,L=>L);if(r){const L=r.get("data");if(!(L!=null&&L.time))return;let $="";L!=null&&L.stayTime&&($=`
|
|
655
|
+
}`;const $=`u_texture${g}`;let V="1.";"fill-color"in t&&(V=e.getFillColorExpression()),e.setFillColorExpression(`${V} * sampleFillPattern(${$}, ${y}, ${L}, ${k}, pxOrigin, pxPos)`)}}function parseLiteralStyle(t,e){const n=newCompilationContext(),r={...newCompilationContext(),inFragmentShader:!0,variables:n.variables},i=new ShaderBuilder,g={};if("icon-src"in t?parseIconProperties(t,i,g,n,r):"shape-points"in t?parseShapeProperties(t,i,g,n,r):"circle-radius"in t&&parseCircleProperties(t,i,g,n,r),parseStrokeProperties(t,i,g,n,r),parseFillProperties(t,i,g,n,r),t.filter){const L=expressionToGlsl(r,t.filter,BooleanType);i.setFragmentDiscardExpression(`!${L}`)}for(const L in r.variables){const $=r.variables[L],V=uniformNameForVariable($.name);let z=getGlslTypeFromType($.type);$.type===ColorType&&(z="vec4"),i.addUniform(`${z} ${V}`),g[V]=()=>{const j=e[$.name];return typeof j=="number"?j:typeof j=="boolean"?j?1:0:$.type===ColorType?asArray(j||"#eee"):typeof j=="string"?getStringNumberEquivalent(j):j}}for(const L in r.properties){const $=r.properties[L];n.properties[L]||(n.properties[L]=$);let V=getGlslTypeFromType($.type),z=`a_prop_${$.name}`;$.type===ColorType&&(V="vec4",z=`unpackColor(${z})`,i.addVertexShaderFunction(UNPACK_COLOR_FN)),i.addVarying(`v_prop_${$.name}`,V,z)}for(const L in n.properties){const $=n.properties[L];i.addAttribute(`${getGlslTypeFromType($.type)} a_prop_${$.name}`)}for(const L in n.functions)i.addVertexShaderFunction(n.functions[L]);for(const L in r.functions)i.addFragmentShaderFunction(r.functions[L]);const y={};for(const L in n.properties){const $=n.properties[L],V=z=>{const j=z.get($.name);return $.type===ColorType?packColor([...asArray(j||"#eee")]):typeof j=="string"?getStringNumberEquivalent(j):typeof j=="boolean"?j?1:0:j};y[`prop_${$.name}`]={size:getGlslSizeFromType($.type),callback:V}}function k(L,$,V,z){const j=n[L],oe=r[L];if(!j&&!oe)return;const re=getGlslTypeFromType(V),ie=getGlslSizeFromType(V);i.addAttribute(`${re} a_${$}`),oe&&i.addVarying(`v_${$}`,re,`a_${$}`),y[$]={size:ie,callback:z}}return k("geometryType",GEOMETRY_TYPE_PROPERTY_NAME,StringType,L=>getStringNumberEquivalent(computeGeometryType(L.getGeometry()))),k("featureId",FEATURE_ID_PROPERTY_NAME,StringType|NumberType,L=>{const $=L.getId()??null;return typeof $=="string"?getStringNumberEquivalent($):$}),{builder:i,attributes:y,uniforms:g}}class WebGLPointsLayer extends Layer{constructor(e){const n=Object.assign({},e);super(n),this.styleVariables_=e.variables||{},this.parseResult_=parseLiteralStyle(e.style,this.styleVariables_),this.hitDetectionDisabled_=!!e.disableHitDetection}createRenderer(){const e=Object.keys(this.parseResult_.attributes).map(n=>({name:n,...this.parseResult_.attributes[n]}));return new WebGLPointsLayerRenderer(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitDetectionEnabled:!this.hitDetectionDisabled_,uniforms:this.parseResult_.uniforms,attributes:e})}updateStyleVariables(e){Object.assign(this.styleVariables_,e),this.changed()}}var CAR_COLOR=(t=>(t[t.BLUE=1]="BLUE",t[t.YELLOW=2]="YELLOW",t[t.Y_GREEN=3]="Y_GREEN",t))(CAR_COLOR||{}),DEVICE_TYPE=(t=>(t[t.HOST=1]="HOST",t[t.TALK=2]="TALK",t[t.STORAGE=3]="STORAGE",t[t.INTERNET=4]="INTERNET",t[t.CAMERA=5]="CAMERA",t[t.LOAD=6]="LOAD",t))(DEVICE_TYPE||{}),LENGTH_UNIT=(t=>(t[t.M=1]="M",t[t.KM=2]="KM",t[t.NM=3]="NM",t))(LENGTH_UNIT||{}),SWITCH_BTN=(t=>(t.Camera="camera",t.Mobile="mobile",t.WaterGauge="waterGauge",t))(SWITCH_BTN||{}),SHIP_SAIL_STATUS=(t=>(t[t.发动机使用中=0]="发动机使用中",t[t.锚泊=1]="锚泊",t[t.未操作=2]="未操作",t[t.操纵能力受限=3]="操纵能力受限",t[t.吃水受限=4]="吃水受限",t[t.系泊=5]="系泊",t[t.搁浅=6]="搁浅",t[t.从事捕捞=7]="从事捕捞",t[t.航行中=8]="航行中",t[t.留作将来修正导航状态=9]="留作将来修正导航状态",t[t.高速船留用=10]="高速船留用",t[t.机动船尾推作业=11]="机动船尾推作业",t[t.机动船顶推或侧推作业=12]="机动船顶推或侧推作业",t[t.飞翼船留用=13]="飞翼船留用",t[t.现行的=14]="现行的",t[t.未定义=15]="未定义",t))(SHIP_SAIL_STATUS||{});class ShipMapData{constructor(e,n,r,i,g,y,k,L,$,V,z,j,oe,re,ie,ae,le,de,pe,ue,he,Ce,_e,xe){qn(this,"id");qn(this,"mmsi");qn(this,"fill");qn(this,"shipType");qn(this,"name");qn(this,"length");qn(this,"breadth");qn(this,"lon");qn(this,"lat");qn(this,"createdAt");qn(this,"speed");qn(this,"from");qn(this,"sailStatus");qn(this,"hdg");qn(this,"cog");qn(this,"posType");qn(this,"type");qn(this,"angle");qn(this,"leftIconColor");qn(this,"existDevice");qn(this,"existMobile");qn(this,"existWaterGauge");qn(this,"selected");qn(this,"blinkColors");this.id=e,this.mmsi=n,this.fill=r,this.shipType=i,this.name=g,this.length=y,this.breadth=k,this.lon=L,this.lat=$,this.createdAt=V,this.speed=z,this.from=j,this.sailStatus=oe,this.hdg=re,this.cog=ie,this.posType=ae,this.type=le,this.angle=de,this.leftIconColor=pe,this.existDevice=ue,this.existMobile=he,this.existWaterGauge=Ce,this.selected=_e,this.blinkColors=xe}}const formatLength=function(t,e){const r=getLength(t);let i="";switch(e){case LENGTH_UNIT.M:i=Math.round(r*100)/100+" m";break;case LENGTH_UNIT.KM:i=Math.round(r/1e3*100)/100+" km";break;case LENGTH_UNIT.NM:i=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return i},convertSixHundredThousandToLatLng=function(t,e){const n=Number(e)/6e5;return[Number(t)/6e5,n]},formatArea=(t,e)=>{const r=getArea(t);let i;switch(e){case LENGTH_UNIT.KM:r>1e4?i=Math.round(r/1e6*100)/100+" km<sup>2</sup>":i=Math.round(r*100)/100+" m<sup>2</sup>";break;case LENGTH_UNIT.NM:const g=Math.pow(1.852,2);r>1e4?i=Math.round(r/1e6/g*100)/100+" nm<sup>2</sup>":i=Math.round(r*100)/100+" m<sup>2</sup>";break}return i},convertShipMapData=t=>{const e=n=>new ShipMapData(n.id,n.id,n.fill||"#04C900","70",(n.cnname||n.enname||n.name||n.id)+`${n.existName?n.existName:""}`,n.len||n.length,n.wid||n.breadth,n.lon,n.lat,new Date().getTime(),n.spd,n.from,n.status,Number(n.hdg),n.cog,Number(n.postype),"other",n.cog,n.leftIconColor,n.existDevice,n.existMobile,n.existWaterGauge,n.selected,n.blinkColors);return Array.isArray(t)?t.map(n=>e(n)):e(t)},formatUtils={formatLength,convertSixHundredThousandToLatLng,formatArea},_hoisted_1$a={key:0,class:"measure-panel"},_hoisted_2$6={class:"d-flex justify-content-between align-content-start w-100"},_hoisted_3$5={class:"measure-history-list"},_hoisted_4$2={class:"left-panel"},_hoisted_5$2={class:"text index"},_hoisted_6$2={class:"text"},_hoisted_7$2=["onClick"],_sfc_main$c=vue.defineComponent({__name:"measure",props:vue.mergeModels({viewMode:{}},{visible:{type:Boolean},visibleModifiers:{}}),emits:vue.mergeModels(["close"],["update:visible"]),setup(t,{expose:e,emit:n}){const r=vue.inject("mapInstance"),i=n,g=vue.useModel(t,"visible"),y=vue.ref("3"),k=vue.ref([]),L=vue.ref(!1),$=new VectorSource;let V,z,j,oe,re;const ie=new VectorLayer({source:$,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),ae=function(Oe){if(Oe.dragging)return;let $e="点击选择起点";V&&($e="单击继续,双击结束"),z&&(z.innerHTML=$e,j.setPosition(Oe.coordinate),z.classList.remove("hidden"))},le=()=>{var Oe,$e;r!=null&&r.value&&((Oe=r==null?void 0:r.value)==null||Oe.on("pointermove",ae),($e=r==null?void 0:r.value)==null||$e.getViewport().addEventListener("mouseout",function(){var qe;(qe=z==null?void 0:z.classList)==null||qe.add("hidden")}),L.value=!0)};let de;const pe=new Style({fill:new Fill({color:"rgba(255, 255, 255, 0.2)"}),stroke:new Stroke({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new CircleStyle({radius:5,stroke:new Stroke({color:"rgba(0, 0, 0, 0.7)"}),fill:new Fill({color:"rgba(255, 255, 255, 0.2)"})})});function ue(){var Oe,$e;if(r!=null&&r.value){if(k.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach(qe=>{var kt;(kt=qe==null?void 0:qe.parentNode)==null||kt.removeChild(qe)}),$.clear(),de){const qe=r.value.getInteractions().getArray().find(kt=>getUid(kt)===getUid(de));qe&&((Oe=r.value)==null||Oe.removeInteraction(qe))}($e=r.value)==null||$e.removeLayer(ie),z!=null&&z.parentNode&&z.parentNode.removeChild(z),oe!=null&&oe.parentNode&&oe.parentNode.removeChild(oe)}}function he(){var $e,qe;ue(),($e=r==null?void 0:r.value)==null||$e.addLayer(ie),de=new Draw({source:$,type:"LineString",style:function(){return pe},condition:function(kt){return kt.originalEvent.target.tagName!=="DIV"}}),(qe=r==null?void 0:r.value)==null||qe.addInteraction(de),_e(),Ce();let Oe;de.on("drawstart",function(kt){var Ve;V=kt.feature;let Dt;Oe=(Ve=V.getGeometry())==null?void 0:Ve.on("change",function(Fe){const ze=Fe.target;let Ue=formatUtils.formatLength(ze,Number(y.value));Dt=ze.getLastCoordinate(),oe&&Ue&&(oe.innerHTML=Ue),re.setPosition(Dt)})}),de.on("drawend",function(){var kt,Dt;oe&&(oe.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),oe!=null&&oe.innerHTML&&(k.value.push(oe==null?void 0:oe.innerHTML),oe.innerHTML=`${oe.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((kt=k.value)==null?void 0:kt.length)-1}"><i class="map-iconfont icon-delete"></i></div>`),(Dt=document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button"))==null||Dt.addEventListener("click",Ve=>{var ze;Ve.preventDefault(),Ve.stopPropagation();const Fe=(ze=Ve.target)==null?void 0:ze.getAttribute("data-index");Fe&&xe(Number(Fe))}),re.setOffset([0,-7]),V=null,oe=null,_e(),Oe&&unByKey(Oe)})}function Ce(){var Oe;z!=null&&z.parentNode&&z.parentNode.removeChild(z),z=document.createElement("div"),z.className="ol-tooltip hidden",j=new Overlay({element:z,offset:[15,0],positioning:"center-left"}),(Oe=r==null?void 0:r.value)==null||Oe.addOverlay(j)}function _e(){var Oe;oe!=null&&oe.parentNode&&oe.parentNode.removeChild(oe),oe=document.createElement("div"),oe.className="ol-tooltip ol-tooltip-measure",re=new Overlay({element:oe,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),(Oe=r==null?void 0:r.value)==null||Oe.addOverlay(re)}const xe=Oe=>{var kt,Dt;k.value[Oe]&&k.value.splice(Oe,1);const $e=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");$e[Oe]&&((Dt=(kt=$e[Oe])==null?void 0:kt.parentNode)==null||Dt.removeChild($e[Oe]));const qe=$.getFeatures();qe[Oe]&&$.removeFeature(qe[Oe])},Ie=()=>{i("close")};return vue.watch(()=>g,()=>{g.value&&!L.value&&(le(),he())},{deep:!0,immediate:!0}),e({addInteraction:he,removeInteraction:ue}),(Oe,$e)=>g.value&&Oe.viewMode!=="WxMiniprogram"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$a,[vue.createElementVNode("div",{class:"header"},[$e[1]||($e[1]=vue.createElementVNode("div",{class:"title"},"测量",-1)),vue.createElementVNode("i",{onClick:Ie,class:"map-iconfont icon-close"})]),vue.createElementVNode("div",_hoisted_2$6,[$e[2]||($e[2]=vue.createElementVNode("div",{class:"tips"},"在地图上点击多个点测量距离,距离单位",-1)),vue.createVNode(vue.unref(ElSelect),{class:"select-length-unit",modelValue:y.value,"onUpdate:modelValue":$e[0]||($e[0]=qe=>y.value=qe)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{label:"m",value:"1"}),vue.createVNode(vue.unref(ElOption),{label:"km",value:"2"}),vue.createVNode(vue.unref(ElOption),{label:"nm",value:"3"})]),_:1},8,["modelValue"])]),vue.createElementVNode("div",_hoisted_3$5,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(k.value,(qe,kt)=>(vue.openBlock(),vue.createElementBlock("div",{class:"measure-history-item",key:kt},[vue.createElementVNode("div",_hoisted_4$2,[$e[3]||($e[3]=vue.createElementVNode("i",{class:"map-iconfont icon-line"},null,-1)),vue.createElementVNode("span",_hoisted_5$2,"线段"+vue.toDisplayString(kt+1),1),vue.createElementVNode("span",_hoisted_6$2,vue.toDisplayString(qe),1)]),vue.createElementVNode("div",{class:"delete-button",onClick:Dt=>xe(kt)},$e[4]||($e[4]=[vue.createElementVNode("i",{class:"map-iconfont icon-delete"},null,-1)]),8,_hoisted_7$2)]))),128))])])):vue.createCommentVNode("",!0)}}),Measure=_export_sfc(_sfc_main$c,[["__scopeId","data-v-9b1d2f55"]]),mapInstance$8=vue.ref(),renderMarkerSetInstance=t=>mapInstance$8.value=t,markerPosition=vue.ref(""),marker=vue.ref(),createIconStyle=t=>new Style({image:new Icon({src:CDN_URL+"map/poi-marker-default.png",anchor:[.5,1]}),text:new Text({text:t,offsetY:-90,font:"12px",fill:new Fill({color:"#000"}),stroke:new Stroke({color:"#fff",width:2}),backgroundFill:new Fill({color:"#fff"}),backgroundStroke:new Stroke({color:"#000",width:1}),padding:[2,2,2,2]})}),renderMarker=(t,e=!0,n=!0)=>{var V;if(!mapInstance$8.value||!t||t.split(",").length!==2)return;const[r,i]=t.split(",").map(Number);marker.value=new Feature({geometry:new Point(fromLonLat([r,i]))});const g=n?`${r}, ${i}`:"";(V=marker.value)==null||V.setStyle(createIconStyle(g));const y=new VectorSource({features:[marker.value]}),k=new VectorLayer({source:y}),L=mapInstance$8.value.getView();if(mapInstance$8.value.addLayer(k),e){const z=new Translate({layers:[k]});z.on("translating",function(j){var ie;const oe=j.features.item(0).getGeometry().getCoordinates(),re=toLonLat(oe);markerPosition.value=`${re[0].toFixed(6)}, ${re[1].toFixed(6)}`,(ie=marker.value)==null||ie.setStyle(createIconStyle(markerPosition.value))}),mapInstance$8.value.addInteraction(z)}const $=new Point([r,i]);L.setCenter(transform($.getCoordinates(),projection.data,projection.mercator)),L.setZoom(mapZoom.findShip)},setMarkerPosition=t=>{var i,g;if(!mapInstance$8.value)return;const e=mapInstance$8.value.getView(),n=t.split(",").map(Number);(g=(i=marker.value)==null?void 0:i.getGeometry())==null||g.setCoordinates(fromLonLat([n[0],n[1]]));const r=new Point([n[0],n[1]]);e.setCenter(transform(r.getCoordinates(),projection.data,projection.mercator)),e.setZoom(mapZoom.markerPosition)},CDN_URL="https://static.zhihaoscm.cn/",tiandituKey="a6e8f78974f2581f2ca00485b40c948f",zhongkeKey="15c81cc0a191a232e0a0ca1a51c3ca81",baseMap={tiandituTile:`https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,tiandituTileMark:`https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,tiandituImgTile:`https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,tiandituImgTileMark:`https://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,greenTile:`${CDN_URL}/map/tile/{z}/{x}/{y}.png`},mapZoom={default:6,min:3,max:18,findShipMin:10,findShip:13,findTruck:14,shipGreenDotMax:11,truckDefault:14,truckStatistics:8,shipModelMin:13,shipModelMax:18,markerPosition:14},renderShipsLimit=200,mapDefaultCenter=[114.84,30.52],projection={data:"EPSG:4326",mercator:"EPSG:3857"},LOG_DATE_FORMAT="YYYY-MM-DD HH:mm:ss",DEFAULT_VALUE="--";vue.ref();const shipsLayer=vue.ref(),largeAmountShipsLayer=vue.ref(),selectShipsLayer=vue.ref(),allShips=vue.ref([]),selectSingleShipData=vue.ref();vue.ref();const trucksLayer=vue.ref(),shipTrackLineFeatures=vue.ref([]),trackLineVectorSource=vue.ref(),shipTrackVectorLayer=vue.ref();vue.ref(),vue.ref();const shipLabels=vue.ref([]),trackLabels=vue.ref([]),showTrackLayer=vue.ref(!1),allTracks=vue.ref([]),currentTrackId=vue.ref(""),showTrackAnimatMarker=vue.ref(!1),hiddenOrther=vue.ref(!1),showMeasure=vue.ref(!1),getShowMeasure=()=>showMeasure.value;function getIconFont(unicode=""){return unicode.indexOf("&")!==-1&&(unicode=unicode.replace("&","&")),unicode.indexOf("&")!==-1&&(unicode=unicode.replace("&","&")),eval('("'+unicode.replace("&#x","\\u").replace(";","")+'")')}const multiplyPixelRatio=t=>{const e=window.devicePixelRatio||1;return t.map(n=>n.map(r=>r*e))},adjustBounds=(t,e)=>e.length===2?[t[0]-e[0],t[1]-e[1],t[2]+e[0],t[3]+e[1]]:[t[0]+e[0],t[1]+e[1],t[2]+e[2],t[3]+e[3]],isOverlapping=(t,e)=>t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1],getIconStyle=t=>new Style({text:new Text({font:"Normal 14px map-iconfont",text:getIconFont(t),fill:new Fill({color:"#fff"}),offsetY:-14}),zIndex:100}),getRotation=(t,e,n)=>{function r(z){return 180*(z%(2*Math.PI))/Math.PI}function i(z){return z%360*Math.PI/180}function g(z){if(!z)throw new Error("Coordinate is required");if(!Array.isArray(z)){if(z.type==="Feature"&&z.geometry!==null&&z.geometry.type==="Point")return z.geometry.coordinates;if(z.type==="Point")return z.coordinates}if(Array.isArray(z)&&z.length>=2&&!Array.isArray(z[0])&&!Array.isArray(z[1]))return z;throw new Error("Coordinate must be GeoJSON Point or an Array of numbers")}function y(z,j,oe={}){if(oe.final)return function(Ce,_e){return(y(_e,Ce)+180)%360}(z,j);const re=g(z),ie=g(j),ae=i(re[0]),le=i(ie[0]),de=i(re[1]),pe=i(ie[1]),ue=Math.sin(le-ae)*Math.cos(pe),he=Math.cos(de)*Math.sin(pe)-Math.sin(de)*Math.cos(pe)*Math.cos(le-ae);return r(Math.atan2(ue,he))}function k(z){return!isNaN(z)&&z!==null&&!Array.isArray(z)}function L(z,j={},oe={}){return z||console.log("Coordinates are required"),Array.isArray(z)||console.log("Coordinates must be an Array"),z.length<2&&console.log("Coordinates must be at least 2 numbers long"),(!k(z[0])||!k(z[1]))&&console.log("Coordinates must contain numbers"),$({type:"Point",coordinates:z},j,oe)}function $(z,j={},oe={}){const re={type:"Feature"};return oe.id!==void 0&&(re.id=oe.id),oe.bbox&&(re.bbox=oe.bbox),re.properties=j||{},re.geometry=z,re}const V=y(L(t),L(e),n);return V<0?360+V:V},triangleModel=multiplyPixelRatio([[0,-8],[5,8],[-5,8]]),shipShapeModel=multiplyPixelRatio([[0,-4.545],[-.56,-3.909],[-1,-2.727],[-1,3.636],[-.8,4.545],[.8,4.545],[1,3.636],[1,-2.727],[.56,-3.909],[0,-4.545]]),shipDirectPath={left:{0:[[0,0],[0,-8],[-4,-8]],1:[[0,0],[0,-16],[-6,-16]],2:[[0,0],[0,-24],[-8,-24]]},right:{0:[[0,0],[0,-8],[-4,-8]],1:[[0,0],[0,-16],[-6,-16]],2:[[0,0],[0,-24],[-8,-24]]},front:{0:[[0,0],[0,-8]],1:[[0,0],[0,-16]],2:[[0,0],[0,-24]]}},setBlankStyle=()=>new Style({image:new CircleStyle({radius:0})}),mapInstance$7=vue.ref(),renderShipStyleSetInstance=t=>mapInstance$7.value=t,speedCondition=[[1,10],[10,20],[20,1/0]],drawShipModelByZoom={14:[200,30],15:[115,15],16:[55,8],17:[25,5],18:[1,1]},setShipStyle=(t,e=!1)=>new Style({renderer:(n,r)=>{n=n;const i=r.context,g=r.feature.get("data");if(!g)return;r.feature.get("index")===0&&(shipLabels.value=[]);try{const k=drawShipBody(i,g,n,e);k&&(drawHeading(i,g,k,e),g.selected=t,t&&setTimeout(()=>{drawSelectBounds(i,k)},1)),drawShipLabel(i,g,n)}catch{return!1}}}),drawShipBody=(t,e,n,r)=>{if(!mapInstance$7.value)return;const i=Math.round(Number(mapInstance$7.value.getView().getZoom()));if(!i)return;let g=[];const[y,k]=drawShipModelByZoom[i]||[0,0],[L,$]=n;if(i<=mapZoom.shipModelMax&&i>mapZoom.shipModelMin&&e.length>=y&&e.breadth>=k)g=rotateShapeModel(drawCurrentShipShapeModel(e,i),e.angle).map(z=>{const[j,oe]=z;return[L+j,$+oe]});else{const V=rotateShapeModel(triangleModel,e.angle);n.length===2&&(g=V.map(z=>{const[j,oe]=z;return[L+j,$+oe]}))}if(!(g.length>2))return!1;if(e!=null&&e.length){const V=g.length===3?30:e.length*.4;t.beginPath(),t.arc(n[0],n[1],V,0,2*Math.PI),t.fillStyle="rgba(255, 255, 255, 0.001)",t.fill()}t.save(),t.beginPath(),t.moveTo(g[0][0],g[0][1]);for(let V=1;V<g.length;V++)t.lineTo(g[V][0],g[V][1]);return t.closePath(),t.strokeStyle=r?"#ff0000":"#000",t.lineWidth=r?2:1,t.stroke(),t.fillStyle=e.fill,t.fill(),t.restore(),g},drawHeading=(t,e,n,r)=>{const[i,g]=n[0],y=getShipDirectPath(e);if(y){const k=y.map(function(L){const[$,V]=L;return[$+i,V+g]});if(t.save(),t.beginPath(),e.angle>0){t.translate(i,g);const L=e.angle*Math.PI/180;t.rotate(L),t.translate(-i,-g)}t.moveTo(i,g);for(let L=1;L<k.length;L++){const[$,V]=k[L];t.lineTo($,V)}t.strokeStyle=r?"#ff0000":"#000",t.lineWidth=r?2:1,t.stroke(),t.restore()}},drawSelectBounds=(t,e)=>{let[n,r,i,g]=getPixelFromCoordinate(e);const y=window.devicePixelRatio||1,k=4;n-=k,r-=k,i+=k,g+=k,t.save(),t.strokeStyle="#ff0000",t.lineWidth=4*y;const L=8*y;t.beginPath(),t.moveTo(n+L,g),t.lineTo(n,g),t.lineTo(n,g-L),t.moveTo(n,r+L),t.lineTo(n,r),t.lineTo(n+L,r),t.moveTo(i-L,r),t.lineTo(i,r),t.lineTo(i,r+L),t.moveTo(i,g-L),t.lineTo(i,g),t.lineTo(i-L,g),t.stroke(),t.restore()},drawShipLabel=(t,e,n)=>{if(!e.selected&&shipLabels.value.find(z=>z.name===e.name))return;const[r,i]=n,g=r,y=i,k=e.name;let L;e.leftIconColor&&(L={color:e.leftIconColor,icon:""});const $=getShipCustomIcon(e),V={id:e.id,center:[g,y],text:k,fill:e.fill,color:"#fff",textColor:"#000",bgColor:"#fff",leftIcon:L,rightIcons:$,selected:e.selected,blinkColors:e.blinkColors,type:"ShipName"};drawLabel(t,V,shipLabels.value)},drawCurrentShipShapeModel=(t,e)=>{let n=0;e<=14?n=.058:e===15?n=.12:e===16?n=.22:e===17?n=.435:e===18&&(n=.857);const r=t.length/4*n,i=t.breadth*n;let g=cloneDeep(shipShapeModel);return g=g.map(([y,k])=>[y*i,k*r]),g},getShipDirectPath=t=>{const{speed:e,hdg:n,cog:r}=t;let i="",g=null;if(e&&e>1&&(n!==null&&n!=511&&r!==null?r-n>=3?i="left":r-n<=-3?i="right":i="front":i="front",i&&e))for(let y=0;y<speedCondition.length;y++){const k=speedCondition[y];if(e>=k[0]&&e<k[1]){g=shipDirectPath[i][y];break}}return g},getShipCustomIcon=t=>{const e=[];return t.existDevice&&e.push(""),t.existMobile&&e.push(""),t.existWaterGauge&&e.push(""),e||[]};class FeatureFormat{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Feature,this.supportedMediaTypes=null}getReadOptions(e,n){if(n){let r=n.dataProjection?get$1(n.dataProjection):this.readProjection(e);n.extent&&r&&r.getUnits()==="tile-pixels"&&(r=get$1(r),r.setWorldExtent(n.extent)),n={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(n)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return abstract()}readFeature(e,n){return abstract()}readFeatures(e,n){return abstract()}readGeometry(e,n){return abstract()}readProjection(e){return abstract()}writeFeature(e,n){return abstract()}writeFeatures(e,n){return abstract()}writeGeometry(e,n){return abstract()}}function transformGeometryWithOptions(t,e,n){const r=n?get$1(n.featureProjection):null,i=n?get$1(n.dataProjection):null;let g=t;if(r&&i&&!equivalent(r,i)){e&&(g=t.clone());const y=e?r:i,k=e?i:r;y.getUnits()==="tile-pixels"?g.transform(y,k):g.applyTransform(getTransform(y,k))}if(e&&n&&n.decimals!==void 0){const y=Math.pow(10,n.decimals),k=function(L){for(let $=0,V=L.length;$<V;++$)L[$]=Math.round(L[$]*y)/y;return L};g===t&&(g=t.clone()),g.applyTransform(k)}return g}const GeometryConstructor={Point,LineString,Polygon,MultiPoint,MultiLineString,MultiPolygon};function orientFlatCoordinates(t,e,n){return Array.isArray(e[0])?(linearRingssAreOriented(t,0,e,n)||(t=t.slice(),orientLinearRingsArray(t,0,e,n)),t):(linearRingsAreOriented(t,0,e,n)||(t=t.slice(),orientLinearRings(t,0,e,n)),t)}function createRenderFeature(t,e){var g;const n=t.geometry;if(!n)return[];if(Array.isArray(n))return n.map(y=>createRenderFeature({...t,geometry:y})).flat();const r=n.type==="MultiPolygon"?"Polygon":n.type;if(r==="GeometryCollection"||r==="Circle")throw new Error("Unsupported geometry type: "+r);const i=n.layout.length;return transformGeometryWithOptions(new RenderFeature(r,r==="Polygon"?orientFlatCoordinates(n.flatCoordinates,n.ends,i):n.flatCoordinates,(g=n.ends)==null?void 0:g.flat(),i,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function createGeometry(t,e){if(!t)return null;if(Array.isArray(t)){const r=t.map(i=>createGeometry(i,e));return new GeometryCollection(r)}const n=GeometryConstructor[t.type];return transformGeometryWithOptions(new n(t.flatCoordinates,t.layout,t.ends),!1,e)}class JSONFeature extends FeatureFormat{constructor(){super()}getType(){return"json"}readFeature(e,n){return this.readFeatureFromObject(getObject(e),this.getReadOptions(e,n))}readFeatures(e,n){return this.readFeaturesFromObject(getObject(e),this.getReadOptions(e,n))}readFeatureFromObject(e,n){return abstract()}readFeaturesFromObject(e,n){return abstract()}readGeometry(e,n){return this.readGeometryFromObject(getObject(e),this.getReadOptions(e,n))}readGeometryFromObject(e,n){return abstract()}readProjection(e){return this.readProjectionFromObject(getObject(e))}readProjectionFromObject(e){return abstract()}writeFeature(e,n){return JSON.stringify(this.writeFeatureObject(e,n))}writeFeatureObject(e,n){return abstract()}writeFeatures(e,n){return JSON.stringify(this.writeFeaturesObject(e,n))}writeFeaturesObject(e,n){return abstract()}writeGeometry(e,n){return JSON.stringify(this.writeGeometryObject(e,n))}writeGeometryObject(e,n){return abstract()}}function getObject(t){if(typeof t=="string"){const e=JSON.parse(t);return e||null}return t!==null?t:null}class GeoJSON extends JSONFeature{constructor(e){e=e||{},super(),this.dataProjection=get$1(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=get$1(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,n){let r=null;e.type==="Feature"?r=e:r={type:"Feature",geometry:e,properties:null};const i=readGeometryInternal(r.geometry);if(this.featureClass===RenderFeature)return createRenderFeature({geometry:i,id:r.id,properties:r.properties},n);const g=new Feature;return this.geometryName_?g.setGeometryName(this.geometryName_):this.extractGeometryName_&&r.geometry_name&&g.setGeometryName(r.geometry_name),g.setGeometry(createGeometry(i,n)),"id"in r&&g.setId(r.id),r.properties&&g.setProperties(r.properties,!0),g}readFeaturesFromObject(e,n){const r=e;let i=null;if(r.type==="FeatureCollection"){const g=e;i=[];const y=g.features;for(let k=0,L=y.length;k<L;++k){const $=this.readFeatureFromObject(y[k],n);$&&i.push($)}}else i=[this.readFeatureFromObject(e,n)];return i.flat()}readGeometryFromObject(e,n){return readGeometry(e,n)}readProjectionFromObject(e){const n=e.crs;let r;if(n)if(n.type=="name")r=get$1(n.properties.name);else if(n.type==="EPSG")r=get$1("EPSG:"+n.properties.code);else throw new Error("Unknown SRS type");else r=this.dataProjection;return r}writeFeatureObject(e,n){n=this.adaptOptions(n);const r={type:"Feature",geometry:null,properties:null},i=e.getId();if(i!==void 0&&(r.id=i),!e.hasProperties())return r;const g=e.getProperties(),y=e.getGeometry();return y&&(r.geometry=writeGeometry(y,n),delete g[e.getGeometryName()]),isEmpty$1(g)||(r.properties=g),r}writeFeaturesObject(e,n){n=this.adaptOptions(n);const r=[];for(let i=0,g=e.length;i<g;++i)r.push(this.writeFeatureObject(e[i],n));return{type:"FeatureCollection",features:r}}writeGeometryObject(e,n){return writeGeometry(e,this.adaptOptions(n))}}function readGeometryInternal(t,e){if(!t)return null;let n;switch(t.type){case"Point":{n=readPointGeometry(t);break}case"LineString":{n=readLineStringGeometry(t);break}case"Polygon":{n=readPolygonGeometry(t);break}case"MultiPoint":{n=readMultiPointGeometry(t);break}case"MultiLineString":{n=readMultiLineStringGeometry(t);break}case"MultiPolygon":{n=readMultiPolygonGeometry(t);break}case"GeometryCollection":{n=readGeometryCollectionGeometry(t);break}default:throw new Error("Unsupported GeoJSON type: "+t.type)}return n}function readGeometry(t,e){const n=readGeometryInternal(t);return createGeometry(n,e)}function readGeometryCollectionGeometry(t,e){return t.geometries.map(function(r){return readGeometryInternal(r)})}function readPointGeometry(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:getLayoutForStride(e.length)}}function readLineStringGeometry(t){var r;const e=t.coordinates,n=e.flat();return{type:"LineString",flatCoordinates:n,ends:[n.length],layout:getLayoutForStride(((r=e[0])==null?void 0:r.length)||2)}}function readMultiLineStringGeometry(t){var g,y;const e=t.coordinates,n=((y=(g=e[0])==null?void 0:g[0])==null?void 0:y.length)||2,r=[],i=deflateCoordinatesArray(r,0,e,n);return{type:"MultiLineString",flatCoordinates:r,ends:i,layout:getLayoutForStride(n)}}function readMultiPointGeometry(t){var n;const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:getLayoutForStride(((n=e[0])==null?void 0:n.length)||2)}}function readMultiPolygonGeometry(t){var g,y;const e=t.coordinates,n=[],r=((y=(g=e[0])==null?void 0:g[0])==null?void 0:y[0].length)||2,i=deflateMultiCoordinatesArray(n,0,e,r);return{type:"MultiPolygon",flatCoordinates:n,ends:i,layout:getLayoutForStride(r)}}function readPolygonGeometry(t){var g,y;const e=t.coordinates,n=[],r=(y=(g=e[0])==null?void 0:g[0])==null?void 0:y.length,i=deflateCoordinatesArray(n,0,e,r);return{type:"Polygon",flatCoordinates:n,ends:i,layout:getLayoutForStride(r)}}function writeGeometry(t,e){t=transformGeometryWithOptions(t,!0,e);const n=t.getType();let r;switch(n){case"Point":{r=writePointGeometry(t);break}case"LineString":{r=writeLineStringGeometry(t);break}case"Polygon":{r=writePolygonGeometry(t,e);break}case"MultiPoint":{r=writeMultiPointGeometry(t);break}case"MultiLineString":{r=writeMultiLineStringGeometry(t);break}case"MultiPolygon":{r=writeMultiPolygonGeometry(t,e);break}case"GeometryCollection":{r=writeGeometryCollectionGeometry(t,e);break}case"Circle":{r={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return r}function writeGeometryCollectionGeometry(t,e){return e=Object.assign({},e),delete e.featureProjection,{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(r){return writeGeometry(r,e)})}}function writeLineStringGeometry(t,e){return{type:"LineString",coordinates:t.getCoordinates()}}function writeMultiLineStringGeometry(t,e){return{type:"MultiLineString",coordinates:t.getCoordinates()}}function writeMultiPointGeometry(t,e){return{type:"MultiPoint",coordinates:t.getCoordinates()}}function writeMultiPolygonGeometry(t,e){let n;return e&&(n=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(n)}}function writePointGeometry(t,e){return{type:"Point",coordinates:t.getCoordinates()}}function writePolygonGeometry(t,e){let n;return e&&(n=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(n)}}class TextFeature extends FeatureFormat{constructor(){super()}getType(){return"text"}readFeature(e,n){return this.readFeatureFromText(getText(e),this.adaptOptions(n))}readFeatureFromText(e,n){return abstract()}readFeatures(e,n){return this.readFeaturesFromText(getText(e),this.adaptOptions(n))}readFeaturesFromText(e,n){return abstract()}readGeometry(e,n){return this.readGeometryFromText(getText(e),this.adaptOptions(n))}readGeometryFromText(e,n){return abstract()}readProjection(e){return this.readProjectionFromText(getText(e))}readProjectionFromText(e){return this.dataProjection}writeFeature(e,n){return this.writeFeatureText(e,this.adaptOptions(n))}writeFeatureText(e,n){return abstract()}writeFeatures(e,n){return this.writeFeaturesText(e,this.adaptOptions(n))}writeFeaturesText(e,n){return abstract()}writeGeometry(e,n){return this.writeGeometryText(e,this.adaptOptions(n))}writeGeometryText(e,n){return abstract()}}function getText(t){return typeof t=="string"?t:""}function flipXY(t,e,n,r,i,g){i!==void 0?(i=i,g=g!==void 0?g:0):(i=[],g=0);let y=e;for(;y<n;){const k=t[y++];i[g++]=t[y++],i[g++]=k;for(let L=2;L<r;++L)i[g++]=t[y++]}return i.length=g,i}class Polyline extends TextFeature{constructor(e){super(),e=e||{},this.dataProjection=get$1("EPSG:4326"),this.factor_=e.factor?e.factor:1e5,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY"}readFeatureFromText(e,n){const r=this.readGeometryFromText(e,n);return new Feature(r)}readFeaturesFromText(e,n){return[this.readFeatureFromText(e,n)]}readGeometryFromText(e,n){const r=getStrideForLayout(this.geometryLayout_),i=decodeDeltas(e,r,this.factor_);flipXY(i,0,i.length,r,i);const g=inflateCoordinates(i,0,i.length,r),y=new LineString(g,this.geometryLayout_);return transformGeometryWithOptions(y,!1,this.adaptOptions(n))}writeFeatureText(e,n){const r=e.getGeometry();if(r)return this.writeGeometryText(r,n);throw new Error("Expected `feature` to have a geometry")}writeFeaturesText(e,n){return this.writeFeatureText(e[0],n)}writeGeometryText(e,n){e=transformGeometryWithOptions(e,!0,this.adaptOptions(n));const r=e.getFlatCoordinates(),i=e.getStride();return flipXY(r,0,r.length,i,r),encodeDeltas(r,i,this.factor_)}}function encodeDeltas(t,e,n){n=n||1e5;let r;const i=new Array(e);for(r=0;r<e;++r)i[r]=0;for(let g=0,y=t.length;g<y;)for(r=0;r<e;++r,++g){const k=t[g],L=k-i[r];i[r]=k,t[g]=L}return encodeFloats(t,n)}function decodeDeltas(t,e,n){n=n||1e5;let r;const i=new Array(e);for(r=0;r<e;++r)i[r]=0;const g=decodeFloats(t,n);for(let y=0,k=g.length;y<k;)for(r=0;r<e;++r,++y)i[r]+=g[y],g[y]=i[r];return g}function encodeFloats(t,e){e=e||1e5;for(let n=0,r=t.length;n<r;++n)t[n]=Math.round(t[n]*e);return encodeSignedIntegers(t)}function decodeFloats(t,e){e=e||1e5;const n=decodeSignedIntegers(t);for(let r=0,i=n.length;r<i;++r)n[r]/=e;return n}function encodeSignedIntegers(t){for(let e=0,n=t.length;e<n;++e){const r=t[e];t[e]=r<0?~(r<<1):r<<1}return encodeUnsignedIntegers(t)}function decodeSignedIntegers(t){const e=decodeUnsignedIntegers(t);for(let n=0,r=e.length;n<r;++n){const i=e[n];e[n]=i&1?~(i>>1):i>>1}return e}function encodeUnsignedIntegers(t){let e="";for(let n=0,r=t.length;n<r;++n)e+=encodeUnsignedInteger(t[n]);return e}function decodeUnsignedIntegers(t){const e=[];let n=0,r=0;for(let i=0,g=t.length;i<g;++i){const y=t.charCodeAt(i)-63;n|=(y&31)<<r,y<32?(e.push(n),n=0,r=0):r+=5}return e}function encodeUnsignedInteger(t){let e,n="";for(;t>=32;)e=(32|t&31)+63,n+=String.fromCharCode(e),t>>=5;return e=t+63,n+=String.fromCharCode(e),n}const mapInstance$6=vue.ref(),renderShipSetInstance=t=>mapInstance$6.value=t;let shipsMarkerList=[],shipsVectorSource,largeAmountShipsSource;const selectedShipData=vue.ref(null),selectedShips=vue.ref([]);let selectShipsVectorSource;const renderShips=t=>{var n,r,i,g;if(!mapInstance$6.value||showTrackLayer.value)return;const e=Math.round(Number(mapInstance$6.value.getView().getZoom()));if(selectedShipData.value&&vue.nextTick(()=>{selectSingleShipMarker(selectedShipData.value)}).then(y=>{}),!(!e||e<mapZoom.shipGreenDotMax)&&(allShips.value=[...t,...selectedShips.value],!hiddenOrther.value))return e>=mapZoom.shipGreenDotMax&&e<mapZoom.shipModelMin?((n=shipsLayer.value)==null||n.setVisible(!1),(r=largeAmountShipsLayer.value)==null||r.setVisible(!0),renderLargeAmountShips(allShips.value)):((i=largeAmountShipsLayer.value)==null||i.setVisible(!1),(g=shipsLayer.value)==null||g.setVisible(!0),renderShipsMarker(allShips.value))},renderLargeAmountShips=t=>{if(!mapInstance$6.value)return;const e=t.map(n=>({type:"Feature",geometry:{type:"Point",coordinates:[n.lon,n.lat]},properties:n}));return largeAmountShipsSource==null||largeAmountShipsSource.clear(),largeAmountShipsSource=new VectorSource({features:new GeoJSON().readFeatures({type:"FeatureCollection",features:e},{featureProjection:projection.mercator})}),largeAmountShipsLayer.value=new WebGLPointsLayer({source:largeAmountShipsSource,style:{"shape-points":3,"shape-radius":9,"shape-fill-color":["case",["==",["get","fill"],"#D9001C"],"#D9001C",["==",["get","fill"],"#04C900"],"#04C900","#04C900"],"shape-rotate-with-view":!1,"shape-rotation":["+",["get","cog"],180],"shape-scale":[.8,1.2],"shape-stroke-color":"#000000","shape-stroke-width":.5}}),mapInstance$6.value.addLayer(largeAmountShipsLayer.value),largeAmountShipsLayer.value},renderShipsMarker=t=>{var n;if(!mapInstance$6.value)return;deleteAllShipMarkers();let e=convertShipMapData(t);if(e=customFilterShips(e),!!(e!=null&&e.length))return e.forEach((r,i)=>{const g=[r.lon,r.lat],y=new Feature({geometry:new Point(fromLonLat(g))}),k=1;y.set("clickGeometry",new Circle(fromLonLat(g),k)),y.set("data",r),y.set("index",i),y.setStyle(setShipStyle(!1)),shipsMarkerList.push({ship:r,lonlat:g,feature:y})}),shipsVectorSource=new VectorSource({features:shipsMarkerList.map(r=>r.feature)}),shipsLayer.value=new VectorLayer({source:shipsVectorSource,zIndex:100}),(n=mapInstance$6.value)==null||n.addLayer(shipsLayer.value),shipsLayer.value},onShipsMarkerHover=()=>{var r;let t=null,e=0;const n=100;(r=mapInstance$6.value)==null||r.on("pointermove",function(i){var L,$,V,z;const g=Date.now();if(g-e<n)return;e=g;const y=(L=mapInstance$6.value)==null?void 0:L.forEachFeatureAtPixel(i.pixel,j=>j),k=($=mapInstance$6.value)==null?void 0:$.getTargetElement();if(k&&(k.style.cursor=y?"pointer":""),t!==y){if(t){const j=t.get("data");if(!(j!=null&&j.mmsi))return;t.setStyle(setShipStyle(((V=selectedShipData.value)==null?void 0:V.id)===j.id,!1))}if(y){const j=y.get("data");if(!(j!=null&&j.mmsi))return;t=y,y.setStyle(setShipStyle(((z=selectedShipData.value)==null?void 0:z.id)===j.id,!0))}else t=null}})},customFilterShips=t=>{let e=cloneDeep(t);return e=e.filter(n=>{var i;const r=getFilterItem(n).every(({btnShow:g,value:y})=>g?!!y:!0);return(switchBtnShow.value.camera||switchBtnShow.value.mobile||switchBtnShow.value.waterGauge)&&((i=selectedShipData.value)==null?void 0:i.id)===n.id&&clearSelectFeature(),r}),e},getFilterItem=t=>[{btnShow:switchBtnShow.value.camera,value:t==null?void 0:t.existDevice},{btnShow:switchBtnShow.value.mobile,value:t==null?void 0:t.existMobile},{btnShow:switchBtnShow.value.waterGauge,value:t==null?void 0:t.existWaterGauge}],deleteAllShipMarkers=()=>{shipsMarkerList.forEach(t=>{t.feature&&(shipsVectorSource==null||shipsVectorSource.removeFeature(t.feature))}),clearAllInterval(),shipsMarkerList=[]},selectSingleShipMarker=t=>{var g;if(!mapInstance$6.value)return;const e=cloneDeep(selectSingleShipData.value);selectSingleShipData.value=convertShipMapData(t);const n=[selectSingleShipData.value.lon,selectSingleShipData.value.lat],r=new Feature({geometry:new Point(fromLonLat(n))});r.set("data",selectSingleShipData.value),r.setStyle(setShipStyle(!0)),shipsMarkerList.push({ship:selectSingleShipData.value,lonlat:n,feature:r}),selectShipsVectorSource==null||selectShipsVectorSource.clear(),selectShipsVectorSource=new VectorSource({features:[r]}),selectShipsLayer.value=new VectorLayer({source:selectShipsVectorSource}),shipsVectorSource&&setVisibleFeatureById(shipsVectorSource,selectSingleShipData.value.id,!0);const i=(g=shipsLayer.value)==null?void 0:g.getSource();return i&&(e&&setVisibleFeatureById(i,e.id,!0),setVisibleFeatureById(i,selectSingleShipData.value.id,!1)),mapInstance$6.value.addLayer(selectShipsLayer.value),selectShipsLayer.value.setVisible(!0),selectShipsLayer.value},setVisibleFeatureById=(t,e,n)=>{t&&t.forEachFeature(r=>{const i=r.get("data");i&&i.id===e&&r.setStyle(n?setShipStyle(!1,i.id):setBlankStyle())})},findShip=(t,e,n=!0)=>{var i,g,y,k,L;if(!t||!mapInstance$6.value)return;const r=(y=(g=(i=shipsLayer.value)==null?void 0:i.getSource())==null?void 0:g.getFeatures())==null?void 0:y.find($=>{var V;return((V=$.get("data"))==null?void 0:V.id)===t});if(r)selectedShipData.value=r.get("data");else if(e)selectedShipData.value=e;else{console.error("找不到船舶");return}if(selectedShips.value.some($=>{var V;return $.id===((V=selectedShipData.value)==null?void 0:V.id)})||selectedShips.value.push(selectedShipData.value),n&&((k=selectedShipData.value)!=null&&k.lon)&&((L=selectedShipData.value)!=null&&L.lat)){const $=mapInstance$6.value.getView(),V=new Point([selectedShipData.value.lon,selectedShipData.value.lat]);$.setCenter(transform(V.getCoordinates(),projection.data,projection.mercator));const z=$.getZoom(),j=z<mapZoom.findShipMin?mapZoom.findShip:z;$.setZoom(j)}return setTimeout(()=>{e&&selectSingleShipMarker(e)},50),r},clearSelectFeature=()=>{var t;if(selectedShipData.value&&shipsVectorSource&&selectSingleShipData.value){setVisibleFeatureById(shipsVectorSource,selectSingleShipData.value.id,!1);const e=(t=shipsLayer.value)==null?void 0:t.getSource();e&&setVisibleFeatureById(e,selectSingleShipData.value.id,!0)}selectedShipData.value=null,mapInstance$6.value&&(selectShipsVectorSource==null||selectShipsVectorSource.clear(),selectShipsLayer.value=new VectorLayer({source:selectShipsVectorSource}),mapInstance$6.value.addLayer(selectShipsLayer.value),selectShipsLayer.value.setVisible(!1))},hiddenAllShips=()=>{var t,e;(t=shipsLayer.value)==null||t.setVisible(!1),(e=largeAmountShipsLayer.value)==null||e.setVisible(!1)},switchBtnShow=vue.ref({[SWITCH_BTN.Camera]:!1,[SWITCH_BTN.Mobile]:!1,[SWITCH_BTN.WaterGauge]:!1}),switchFilterItem=(t,e)=>{switchBtnShow.value[t]=e,renderShips(allShips.value)},rerenderShip=()=>{renderShips(allShips.value)},labelAlpha=.8,pixelRatio=window.devicePixelRatio||1,labelFont=`500 ${12*pixelRatio}px Arial`,labelOutSize=2*pixelRatio,labelHeight=10*pixelRatio,fillRectRadius=(t,e,n,r,i,g,y=4)=>{t.beginPath(),t.moveTo(e+y,n),t.arcTo(e+r,n,e+r,n+y,y),t.arcTo(e+r,n+i,e+r-y,n+i,y),t.arcTo(e,n+i,e,n+i-y,y),t.arcTo(e,n,e+y,n,y),t.closePath(),t.fillStyle=g,t.fill()},getPixelFromCoordinate=t=>{if(!t||t.length===0)throw new Error("Points array is empty or invalid.");let e=1/0,n=1/0,r=-1/0,i=-1/0;for(const[g,y]of t)g<e&&(e=g),y<n&&(n=y),g>r&&(r=g),y>i&&(i=y);return[e,n,r,i]},calculatePolygonCentroid=t=>{if(!Array.isArray(t)||t.length<3)throw new Error("A polygon must have at least 3 coordinates.");let e=0,n=0,r=0;const i=t.length;for(let k=0;k<i-1;k++){const[L,$]=t[k],[V,z]=t[k+1],j=L*z-V*$;r+=j,e+=(L+V)*j,n+=($+z)*j}if(r*=.5,r===0)throw new Error("多边形面积为零");const g=e/(6*r),y=n/(6*r);return[g,y]},rotateShapeModel=(t,e)=>{const[n,r]=calculatePolygonCentroid(t),i=e*Math.PI/180,g=Math.cos(i),y=Math.sin(i);return t.map(([k,L])=>{const $=k-n,V=L-r,z=$*g-V*y+n,j=$*y+V*g+r;return[z,j]})},getTopLeftPoint=t=>[t[0],t[3]],getBottomLeftPoint=t=>[t[2],t[3]],getBottomRightPoint=t=>[t[2],t[1]],getTopRighttPoint=t=>[t[0],t[1]];function calculateBounds(t,e,n,r,i){let g,y,k,L;const $=t[0],V=t[1];switch(e){case 0:g=$+i,y=g+n,L=V-i,k=L-r;break;case 1:g=$+i,y=g+n,L=V+r/2,k=L-r;break;case 2:g=$+i,y=g+n,L=V+i+r,k=L-r;break;case 3:g=$-n/2,y=g+n,L=V+i+r,k=L-r;break;case 4:y=$,g=y-n,L=V+i+r,k=L-r;break;case 5:y=$-i,g=y-n,L=V+r/2,k=L-r;break;case 6:y=$,g=y-n,L=V-i,k=L-r;break;case 7:g=$-n/2,y=g+n,L=V-i,k=L-r}if(!(!g||!k||!y||!L))return[Math.min(g,y),Math.min(k,L),Math.max(g,y),Math.max(k,L)+1]}function calculateAnchorPoint(t,e,n=70,r=20,i=20){const g=[0,0];switch(e){case 0:g[0]=t[0]+i,g[1]=t[1]-i-r/2;break;case 1:g[0]=t[0]+i,g[1]=t[1];break;case 2:g[0]=t[0]+i,g[1]=t[1]+i+r/2;break;case 3:g[0]=t[0],g[1]=t[1]+i+r/4;break;case 4:g[0]=Math.max(t[0]-i,t[0]-n/2),g[1]=t[1]+i+r/4;break;case 5:g[0]=t[0]-i,g[1]=t[1];break;case 6:g[0]=Math.max(t[0]-i,t[0]-n/2),g[1]=t[1]-i-r/4;break;case 7:g[0]=t[0],g[1]=t[1]-i-r/4}return g}function drawLabelBody(t,e,n){if(!t)return;const{font:r,labelOutSize:i=2,labelHeight:g,center:y,text:k,leftIcon:L,shipColor:$,lineLength:V=20,selected:z}=n;t.save(),r&&(t.font=r);let j=t.measureText(k).width+4*i;(L||$)&&(j+=g+6*i),t.restore();let oe,re=20,ie=-1,ae=g+3*i;if(V)for(let le=0;le<8;le++){oe=calculateBounds(y,le,j,ae,V);let de=!1;for(let pe=0;pe<e.length;++pe){let ue=e[pe].bounds,he=[ue[0]-re,ue[1]-re,ue[2]+re,ue[3]+re];if(oe&&isOverlapping(oe,he)){de=!0;break}}if(!de){ie=le;break}}else ie=0,oe=calculateBounds(y,ie,j,ae,V);if(z&&ie===-1&&(ie=0),oe&&ie>-1){let le=getBottomLeftPoint(oe),de=getTopRighttPoint(oe);return{center:y,x:calculateAnchorPoint(y,ie,j,ae,V),l:de,r:le,bounds:oe,position:ie,name:k}}else return null}const drawText=(t,e)=>{if(!t)return;const{center:n,text:r,textColor:i,leftIcon:g,rightIcons:y,font:k}=e;t.save(),t.setTransform(1,0,0,1,0,0);let[L,$]=n;if(g){t.font=`${18*pixelRatio}px map-iconfont`;let V=getIconFont(g.icon);t.fillStyle=g.color,t.fillText(V,L+labelOutSize-3*pixelRatio,$+2.6*pixelRatio),L+=23*pixelRatio}if(y!=null&&y.length){t.font=`${12*pixelRatio}px map-iconfont`,t.fillStyle="#3370ff";const V=t.measureText(r).width+6*pixelRatio;y.forEach((z,j)=>{const oe=getIconFont(z),re=20*pixelRatio*j;t.fillText(oe,L+V+re,$)})}t.font=k||labelFont,t.fillStyle=i,t.fillText(r,L+2,$),t.restore()},drawPolygon=(t,e)=>{let{points:n,strokeColor:r,fillColor:i,shouldClosePath:g,translation:y,rotation:k,rotationCenter:L,scale:$,globalAlpha:V}=e;if(V||(V=1),n&&t){t.save(),t.beginPath(),k&&k!==0&&L==null&&t.rotate(k),y&&t.translate(y[0],y[1]),k&&(L!=null&&L.length)&&t.rotate(k),$&&t.scale($,$),t.moveTo(n[0][0],n[0][1]);for(let z=1;z<n.length;z++)t.lineTo(n[z][0],n[z][1]);g&&t.closePath(),r&&(t.strokeStyle=r,t.stroke()),i&&g&&(V&&(t.globalAlpha=V),t.fillStyle=i,t.fill()),t.restore()}},intervalIds={},drawLabel=(t,e,n)=>{var z,j,oe,re,ie,ae,le;let{center:r,text:i,color:g,textColor:y,bgColor:k,leftIcon:L,rightIcons:$,type:V}=e;if(r&&i){const de={font:labelFont,labelOutSize,labelHeight,center:r,text:i,leftIcon:L,selected:e.selected};(z=e.blinkColors)!=null&&z.length&&e.fill&&(k=e.fill,y=getForegroundColor(e.fill));const pe=drawLabelBody(t,n,de);if(pe){const{x:ue,bounds:he,l:Ce}=pe,_e=[getTopLeftPoint(he),getBottomLeftPoint(he),getBottomRightPoint(he),getTopRighttPoint(he)];n.find(kt=>kt.name===i)||n.push(pe),drawPolygon(t,{points:[r,ue],strokeColor:g,fillColor:"#000",shouldClosePath:!0,translation:void 0,rotation:void 0,rotationCenter:void 0,scale:void 0,globalAlpha:labelAlpha}),$!=null&&$.length&&$.forEach(()=>{_e[1][0]+=pixelRatio===1?18:36,_e[2][0]+=pixelRatio===1?18:36});const Ie={points:_e,strokeColor:g,fillColor:k,shouldClosePath:!0},[Oe,$e]=Ce,qe={center:[Oe,$e+labelOutSize+labelHeight+1],text:i,textColor:y,leftIcon:L,rightIcons:$,blinkColors:e.blinkColors};if(drawPolygon(t,Ie),drawText(t,qe),e!=null&&e.blinkColors&&e.blinkColors.length>0){let kt=Date.now(),Dt=0;const Ve=e.blinkColors;!!!((re=(oe=(j=selectShipsLayer.value)==null?void 0:j.getSource())==null?void 0:oe.getFeatures())!=null&&re.find(ze=>{var Ue;return((Ue=ze.get("data"))==null?void 0:Ue.id)===e.id})||(le=(ae=(ie=shipsLayer.value)==null?void 0:ie.getSource())==null?void 0:ae.getFeatures())!=null&&le.find(ze=>{var Ue;return((Ue=ze.get("data"))==null?void 0:Ue.id)===e.id}))||hiddenOrther.value?(clearInterval(intervalIds[e.id]),deleteLabelFromArray(n,i)):(intervalIds[e.id]&&clearInterval(intervalIds[e.id]),intervalIds[e.id]=window.setInterval(()=>{var Et,Pt,hn;const ze=Date.now();ze-kt>=500&&(Dt=(Dt+1)%Ve.length,kt=ze,Ie.fillColor=Ve[Dt],drawPolygon(t,Ie),qe.textColor=getForegroundColor(Ie.fillColor),drawText(t,qe));const Ue=shipsMarkerList==null?void 0:shipsMarkerList.some(Lt=>{var jt;return((jt=Lt.ship)==null?void 0:jt.id)===e.id}),Ne=(hn=(Pt=(Et=shipsLayer.value)==null?void 0:Et.getSource())==null?void 0:Pt.getFeatures())==null?void 0:hn.some(Lt=>{const jt=Lt.get("data");return(jt==null?void 0:jt.id)===e.id});!Ue&&!Ne&&(clearInterval(intervalIds[e.id]),deleteLabelFromArray(n,i))},10))}else shipLabels.value.find(Dt=>Dt.name===i)&&(clearInterval(intervalIds[e.id]),drawPolygon(t,Ie),drawText(t,qe))}}return null},clearAllInterval=()=>{Object.keys(intervalIds).forEach(t=>{clearInterval(t)})},deleteLabelFromArray=(t,e)=>{const n=t.findIndex(r=>r.name===e);n!==-1&&t.splice(n,1)},PI=Math.PI,a=6378245,ee=.006693421622965943;function transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*PI)+20*Math.sin(2*t*PI))*2/3,n+=(20*Math.sin(e*PI)+40*Math.sin(e/3*PI))*2/3,n+=(160*Math.sin(e/12*PI)+320*Math.sin(e*PI/30))*2/3,n}function transformLng(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*PI)+20*Math.sin(2*t*PI))*2/3,n+=(20*Math.sin(t*PI)+40*Math.sin(t/3*PI))*2/3,n+=(150*Math.sin(t/12*PI)+300*Math.sin(t/30*PI))*2/3,n}function outOfChina(t,e){return!(t>73.66&&t<135.05&&e>3.86&&e<53.55)}function gcj02ToWgs84(t){const[e,n]=t.split(",").map(Number);if(outOfChina(e,n))return`${e.toFixed(6)}, ${n.toFixed(6)}`;{let r=transformLat(e-105,n-35),i=transformLng(e-105,n-35);const g=n/180*PI;let y=Math.sin(g);y=1-ee*y*y;const k=Math.sqrt(y);r=r*180/(a*(1-ee)/(y*k)*PI),i=i*180/(a/k*Math.cos(g)*PI);const L=n+r,$=e+i;return`${(e*2-$).toFixed(6)}, ${(n*2-L).toFixed(6)}`}}function calculateCirclePoints(t,e){const n=fromLonLat(t),r=e*1e3,i=[n[0]-r,n[1]-r,n[0]+r,n[1]+r],g=transformExtent(i,projection.mercator,projection.data);return{leftTopPoint:{lng:g[0],lat:g[3]},rightTopPoint:{lng:g[2],lat:g[3]},rightBottomPoint:{lng:g[2],lat:g[1]},leftBottomPoint:{lng:g[0],lat:g[1]}}}const equatorialCircumference=2003750834e-2;function lonLatToMercator(t){const e=t[0]*equatorialCircumference/180;let n=Math.log(Math.tan((90+t[1])*Math.PI/360))/(Math.PI/180);return n=n*equatorialCircumference/180,[e,n]}function mercatorToLonLat(t,e="lonlat"){const n={lon:0,lat:0},r=t[0]/equatorialCircumference*180;let i=t[1]/equatorialCircumference*180;return i=180/Math.PI*(2*Math.atan(Math.exp(i*Math.PI/180))-Math.PI/2),n.lon=r,n.lat=i,e==="lonlat"?n:[r,i]}function calculateBoundingBox(t){let e=1/0,n=-1/0,r=1/0,i=-1/0;t.forEach(ie=>{const[ae,le]=ie;e=Math.min(e,le),n=Math.max(n,le),r=Math.min(r,ae),i=Math.max(i,ae)});const g=i-r,y=n-e,k=Math.max(g,y),L=(r+i)/2,$=(e+n)/2,V=k/2,z=L-V,j=L+V,oe=$-V,re=$+V;return[j,oe,z,re]}const transformUtils={gcj02ToWgs84,calculateCirclePoints,lonLatToMercator,mercatorToLonLat,calculateBoundingBox},mapInstance$5=vue.ref(),renderTrackStyleSetInstance=t=>mapInstance$5.value=t,stopIcon="",stopColor="#E31818",slowIcon="",slowColor="#1890FF",dropletsIcon="",trackList$1=vue.ref([]);let animationFeature;const renderTrackLine=(t,e,n)=>{var g,y,k;const r=t[e];if(!r)return;allTracks.value[e]=r,trackList$1.value=[],trackList$1.value=r.map((L,$)=>(L.center=[L.lon,L.lat],L.centerPoint=transformUtils.lonLatToMercator(L.center),L.id=e,L.index=$,L.time=hooks(L.createdAt).format("YYYY-MM-DD HH:mm:ss"),L));const i=trackList$1.value.map(L=>L.centerPoint);if(i.length>=2){const L=new LineString(i),$=new Feature({geometry:L});$.setStyle(new Style({stroke:new Stroke({color:n,width:2})})),$.setId(e),$.set("type","line"),(y=(g=shipTrackVectorLayer.value)==null?void 0:g.getSource())==null||y.clear(),shipTrackLineFeatures.value=[];const V=shipTrackLineFeatures.value.findIndex(j=>j.getId()===e);V>=0?shipTrackLineFeatures.value[V]=$:shipTrackLineFeatures.value.push($);const z=createAnimatedIconFeature(n,i);trackLineVectorSource.value=new VectorSource({features:[...shipTrackLineFeatures.value]}),animationFeature=z,console.log(animationFeature),shipTrackVectorLayer.value=new VectorLayer({source:trackLineVectorSource.value,zIndex:102}),renderPoint(n),(k=mapInstance$5.value)==null||k.addLayer(shipTrackVectorLayer.value)}},handlePlay=(t,e)=>{const n=allTracks.value[String(t)];playAnimation(n.map(r=>[r.lon,r.lat]),e)},removeShipTrackLineFeatureByIndex=(t,e)=>{t>=0&&t<shipTrackLineFeatures.value.length&&(shipTrackLineFeatures.value.splice(t,1),delete allTracks.value[e]),trackLineVectorSource.value=new VectorSource({features:[...shipTrackLineFeatures.value]}),shipTrackVectorLayer.value&&shipTrackVectorLayer.value.setSource(trackLineVectorSource.value)},createAnimatedIconFeature=(t,e)=>{const n=new Feature({geometry:new Point(fromLonLat([e[0][0],e[0][1]]))}),r=new Style({text:new Text({font:"700 14px map-iconfont",text:getIconFont(""),fill:new Fill({color:t})})});return n.setStyle(r),n},geoMarkerStyle=new Style({text:new Text({font:"700 20px map-iconfont",text:getIconFont(""),fill:new Fill({color:"#ff0000"}),rotation:0})});let polyline,linePath,startMarker,position,geoMarker,vectorLayer;const trackAnimating=vue.ref(!1);let distance=0,lastTime=Date.now(),moveFeatureHandler=null;const moveFeature=(t,e)=>{var z,j,oe;const n=Number(50*e),r=((z=t.frameState)==null?void 0:z.time)??Date.now(),i=r-lastTime;if(distance=(distance+n*i/1e6)%2,lastTime=r,distance>=1){stopAnimation();return}const g=linePath.getCoordinateAt(distance>1?2-distance:distance),y=linePath.getCoordinateAt(distance>1?distance-.01:distance),k=linePath.getCoordinateAt(distance>1?2-distance:distance+.01),$=getRotation(transformUtils.mercatorToLonLat(y,"array"),transformUtils.mercatorToLonLat(k,"array"))*Math.PI/180;(j=geoMarkerStyle.getText())==null||j.setRotation($),position.setCoordinates(g);const V=getVectorContext(t);V.context_.save(),V.setStyle(geoMarkerStyle),V.drawGeometry(position),V.context_.restore(),(oe=mapInstance$5.value)==null||oe.render()},startAnimation=()=>{var t;trackAnimating.value=!0,showTrackAnimatMarker.value=!0,lastTime=Date.now(),distance=0,position=((t=startMarker.getGeometry())==null?void 0:t.clone())||new Point([0,0]),moveFeatureHandler&&(vectorLayer==null||vectorLayer.on("postrender",moveFeatureHandler)),geoMarker==null||geoMarker.setGeometry(void 0)},stopAnimation=()=>{var t;trackAnimating.value&&(trackAnimating.value=!1,geoMarker==null||geoMarker.setGeometry(void 0),moveFeatureHandler&&vectorLayer&&vectorLayer.un("postrender",moveFeatureHandler),vectorLayer&&((t=mapInstance$5.value)==null||t.removeLayer(vectorLayer)),vectorLayer=null,geoMarker=null)},playAnimation=(t,e)=>{var r;trackAnimating.value&&stopAnimation(),polyline=new Polyline({factor:1e6}).writeGeometry(new LineString(t)),linePath=new Polyline({factor:1e6}).readGeometry(polyline,{dataProjection:projection.data,featureProjection:projection.mercator}),startMarker=new Feature({type:"icon",geometry:new Point(linePath.getFirstCoordinate())});const n=startMarker.getGeometry();position=n?n.clone():new Point([0,0]),geoMarker=new Feature({type:"geoMarker",style:geoMarkerStyle,geometry:position}),vectorLayer=new VectorLayer({source:new VectorSource({features:[geoMarker]})}),(r=mapInstance$5.value)==null||r.addLayer(vectorLayer),moveFeatureHandler=i=>moveFeature(i,e),startAnimation()},renderPoint=t=>{if(!mapInstance$5.value)return;const e=trackList$1.value||[];if(!(e&&e.length>1))return[];const n={16:24,17:15,default:4},r=[],i=e.length;for(let k=0;k<i;k++){e[k].index=k;const L=mapInstance$5.value.getPixelFromCoordinate(e[k].centerPoint);if(L){let $=L.concat(L);$=adjustBounds($,[20,20]);const V=mapInstance$5.value.getView().getZoom();if(!V)return;if(V>15){const j=n[V]||n.default;$=adjustBounds($,[j,j])}let z=!0;if(e[k].state!=="0"){for(let j=0;j<r.length;j++)if(isOverlapping($,r[j].bounds)){z=!1;break}}z&&(e[k].bounds=$,r.push(e[k]))}}const g=getIconStyle(stopIcon),y=getIconStyle(slowIcon);r.forEach((k,L)=>{var z,j;const $=new Feature({geometry:new Point(k.centerPoint)});$.set("type","track_point"),$.set("data",k),$.setStyle([new Style({image:new CircleStyle({stroke:new Stroke({color:"rgba(0, 0, 0, 0.01)",width:20}),radius:3})}),new Style({image:new CircleStyle({fill:new Fill({color:t}),stroke:new Stroke({color:"#fff",width:2}),radius:3})})]),trackLineVectorSource.value.addFeature($);const V=new Feature({geometry:new Point(fromLonLat(k.center))});if(V.set("type","track_label"),V.set("track_label_index",L),V.setStyle(setTrackLabelStyle(k,t)),trackLineVectorSource.value.addFeature(V),typeof k=="object"&&k.hasOwnProperty("state")){const oe=new Feature({geometry:new Point(k.centerPoint)});oe.set("type","track_icon");const re=new Style({text:new Text({font:"Normal 22px map-iconfont",text:getIconFont(dropletsIcon),offsetY:-10}),zIndex:99}),ie=[];Number(k.state)===0?((z=re.getText())==null||z.setFill(new Fill({color:stopColor})),ie.push(g)):Number(k.state)===1&&((j=re.getText())==null||j.setFill(new Fill({color:slowColor})),ie.push(y)),ie.push(re),oe.setStyle(ie),trackLineVectorSource.value.addFeature(oe)}}),renderArrow(r,t),renderIconPoint()},renderArrow=(t,e)=>{const n=t.length;n||(t.push(trackList$1.value[0]),t.push(trackList$1.value[trackList$1.value.length-1]));for(let r=0;r<n-1;r++){let i;const g=t[r],y=(t[r+1].index+g.index)/2;if(y%2===0)i=trackList$1.value[y].centerPoint;else{const k=trackList$1.value[Math.floor(y)],L=trackList$1.value[Math.ceil(y)];if(k&&L){const[$,V]=k.centerPoint,[z,j]=L.centerPoint;i=[($+z)/2,(V+j)/2]}}if(i){const k=new Feature({geometry:new Point(i)});k.set("type","track_arrow"),k.setStyle(new Style({text:new Text({font:"700 14px map-iconfont",text:getIconFont(""),fill:new Fill({color:e}),rotation:getRotation(t[r].center,t[r+1].center)*(Math.PI/180)})})),trackLineVectorSource.value.addFeature(k)}}},renderIconPoint=()=>{const t="",e="#fcdc3f",n="#ff0000";(trackList$1.value.length<2?[trackList$1.value[0]]:[trackList$1.value[0],trackList$1.value[trackList$1.value.length-1]]).forEach(i=>{const g=new Feature({geometry:new Point(i.centerPoint)});g.set("type","track_begin"),g.set("data",i);const y=i.index===0&&trackList$1.value.length>=2?e:n;g.setStyle(new Style({text:new Text({font:"Normal 14px map-iconfont",text:getIconFont(t),fill:new Fill({color:y})}),zIndex:101})),trackLineVectorSource.value.addFeature(g)})},setTrackLabelStyle=(t,e)=>new Style({renderer:(n,r)=>{const i=r.context,k={id:t.id||"",center:n,text:t.time,color:e,textColor:"#000",bgColor:"rgba(255,255,255,.8)",selected:!0,type:"TrackTime"};drawLabel(i,k,trackLabels.value)}}),mapInstance$4=vue.ref(),renderCustomOverlaySetInstance=t=>mapInstance$4.value=t,drawCustomContent=(t,e,n,r="top-left",i=!1)=>{var V,z;if(!e||!mapInstance$4.value)return;document.querySelectorAll(".truck-custom-content").forEach(j=>{var oe;return(oe=j.parentNode)==null?void 0:oe.removeChild(j)});const g=document.createElement("div");g.innerHTML=n;const y=new Overlay({element:g,position:e,positioning:r,stopEvent:i});if(i){let j=!1,oe=[0,0],re=[0,0],ie=0,ae=0;g.addEventListener("mousedown",function(le){var pe;j=!0,ie=le.clientX,ae=le.clientY;const de=(pe=mapInstance$4.value)==null?void 0:pe.getCoordinateFromPixel([le.clientX-200,le.clientY-200]);de&&(oe=de),re=[le.clientX-g.getBoundingClientRect().left+160,le.clientY-g.getBoundingClientRect().top+84],le.preventDefault(),console.log(t,ie,ae)}),document.addEventListener("mousemove",function(le){var de;if(j){const pe=(de=mapInstance$4.value)==null?void 0:de.getCoordinateFromPixel([le.clientX-re[0],le.clientY-re[1]]),ue=pe[0]-oe[0],he=pe[1]-oe[1];y.setPosition([oe[0]+ue,oe[1]+he])}}),document.addEventListener("mouseup",function(){j=!1})}(V=mapInstance$4.value)==null||V.addOverlay(y);const k=g.querySelector(".close-button");k&&k.addEventListener("click",()=>{var j,oe;(j=mapInstance$4.value)==null||j.removeOverlay(y),(oe=g.parentNode)==null||oe.removeChild(g)});const L=JSON.parse(JSON.stringify(e)),$=(z=mapInstance$4.value)==null?void 0:z.getCoordinateFromPixel(L);return y.setPosition($),y},mapInstance$3=vue.ref(),renderTrackSetInstance=t=>mapInstance$3.value=t,showTracks=vue.ref([]),trackList=vue.ref([]);vue.ref(null);const trackId=vue.ref(""),cursor=vue.ref(0),renderTrack=(t,e,n,r,i="ship")=>{var V;if(console.log(i),vue.nextTick(()=>{hiddenAllShips()}).then(z=>{}),(e==null?void 0:e.length)<2){((V=showTracks.value)==null?void 0:V.findIndex(z=>z.id===t))<0&&showTracks.value.push({id:t,length:""});return}const g={};e.forEach(z=>{z.state?z.state=Number(z.state):delete z.state}),trackId.value=t,g[t]=e,trackList.value=e;const y=["#ff0000","#00ff00","#0079ff","#ffa500","#800080","#008080","#ffc0cb","#800000","#000080","#808000"],k=g[t].map(z=>transform([z.lon,z.lat],projection.data,projection.mercator)),L=new LineString(k),$=formatUtils.formatLength(L,r)||"--";vue.nextTick(()=>{var j,oe;const z=(j=showTracks.value)==null?void 0:j.findIndex(re=>re.id===t);z<0?showTracks.value.push({id:t,length:$}):showTracks.value[z].length=$,++cursor.value,cursor.value>y.length&&(cursor.value=0),renderTrackLine(g,t,n),vue.nextTick(()=>{resetTrackView(t)}).then(()=>{}),(oe=mapInstance$3.value)==null||oe.on("moveend",()=>{showTrackLayer.value&&(trackLabels.value=[],renderTrackLine(g,t,n))}),renderTrackPointPopup()}).then(()=>{})},renderTrackPointPopup=()=>{var e;const t=vue.ref(null);(e=mapInstance$3.value)==null||e.on("pointermove",n=>{var i,g,y,k;t.value&&((i=mapInstance$3.value)==null||i.removeOverlay(t.value));const r=(g=mapInstance$3.value)==null?void 0:g.forEachFeatureAtPixel(n.pixel,L=>L);if(r){const L=r.get("data");if(!(L!=null&&L.time))return;let $="";L!=null&&L.stayTime&&($=`
|
|
656
656
|
<div class="item w-100">
|
|
657
657
|
<div class="item-label">停泊时间约</div>
|
|
658
658
|
<div class="item-item">${formatMinutesToDDHHMM(Number(L.stayTime))}</div>
|