@zendir/ui 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +118 -84
- package/dist/react/astro/UnifiedTimeline.js +25 -2
- package/dist/react/astro/UnifiedTimeline.js.map +1 -1
- package/dist/react/charts/GroundTrackMap.d.ts +3 -1
- package/dist/react/charts/GroundTrackMap.js +35 -0
- package/dist/react/charts/GroundTrackMap.js.map +1 -1
- package/dist/react/charts/GroundTrackMapLeaflet.d.ts +3 -1
- package/dist/react/charts/GroundTrackMapLeaflet.js +167 -57
- package/dist/react/charts/GroundTrackMapLeaflet.js.map +1 -1
- package/dist/react/charts/groundTrackMapLeafletTiles.d.ts +10 -8
- package/dist/react/charts/groundTrackMapLeafletTiles.js +10 -3
- package/dist/react/charts/groundTrackMapLeafletTiles.js.map +1 -1
- package/dist/react/charts/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import L from "leaflet";
|
|
|
4
4
|
import "leaflet/dist/leaflet.css";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { geodesicCirclePoints, splitRingAtAntimeridian, segmentsWithWorldCopies, splitPolylineAtAntimeridian } from "./groundTrackMapLeafletUtils.js";
|
|
7
|
-
import {
|
|
7
|
+
import { CARTO_ATTRIBUTION, OSM_ATTRIBUTION, TILE_PRESETS, FALLBACK_TILE } from "./groundTrackMapLeafletTiles.js";
|
|
8
8
|
import { useTheme } from "../theme/ThemeProvider.js";
|
|
9
9
|
const STATUS_COLOR_MAP = {
|
|
10
10
|
normal: "#56f000",
|
|
@@ -143,13 +143,14 @@ function GroundTrackMapLeaflet({
|
|
|
143
143
|
showLegend = true,
|
|
144
144
|
showEquator = false,
|
|
145
145
|
showRecenterButton = true,
|
|
146
|
+
showMapStyleToggle = true,
|
|
146
147
|
defaultCenter = [20, 0],
|
|
147
148
|
defaultZoom = 2,
|
|
148
149
|
height = "100%",
|
|
149
150
|
width = "100%",
|
|
150
151
|
minHeight = "400px",
|
|
151
152
|
emptyMessage = "No orbital data available",
|
|
152
|
-
tileUrl
|
|
153
|
+
tileUrl,
|
|
153
154
|
nightTileUrl,
|
|
154
155
|
lightSources,
|
|
155
156
|
className = "",
|
|
@@ -169,6 +170,9 @@ function GroundTrackMapLeaflet({
|
|
|
169
170
|
const controlsRef = useRef([]);
|
|
170
171
|
const pinsGroupRef = useRef(null);
|
|
171
172
|
const [ready, setReady] = useState(false);
|
|
173
|
+
const [tileStyle, setTileStyle] = useState("dark");
|
|
174
|
+
const isExplicitTileUrl = tileUrl !== void 0;
|
|
175
|
+
const effectiveTileUrl = isExplicitTileUrl ? tileUrl : TILE_PRESETS[tileStyle];
|
|
172
176
|
const clearLayers = useCallback(() => {
|
|
173
177
|
var _a;
|
|
174
178
|
const map = mapRef.current;
|
|
@@ -202,38 +206,6 @@ function GroundTrackMapLeaflet({
|
|
|
202
206
|
});
|
|
203
207
|
L.control.zoom({ position: "topright" }).addTo(map);
|
|
204
208
|
map.attributionControl.setPrefix("");
|
|
205
|
-
const isCartoTiles = tileUrl.includes("cartocdn");
|
|
206
|
-
if (isCartoTiles) {
|
|
207
|
-
map.attributionControl.addAttribution(CARTO_ATTRIBUTION);
|
|
208
|
-
}
|
|
209
|
-
const tileOptions = {
|
|
210
|
-
maxZoom: 19,
|
|
211
|
-
subdomains: isCartoTiles ? "abcd" : "abc",
|
|
212
|
-
// crossOrigin avoids tainted-canvas errors when Leaflet tries to read tile pixels
|
|
213
|
-
crossOrigin: true
|
|
214
|
-
};
|
|
215
|
-
const tile = L.tileLayer(tileUrl, tileOptions);
|
|
216
|
-
tile.addTo(map);
|
|
217
|
-
tileLayerRef.current = tile;
|
|
218
|
-
let hasSwitchedToFallback = false;
|
|
219
|
-
const onTileError = () => {
|
|
220
|
-
if (hasSwitchedToFallback) return;
|
|
221
|
-
hasSwitchedToFallback = true;
|
|
222
|
-
tile.off("tileerror", onTileError);
|
|
223
|
-
tile.remove();
|
|
224
|
-
if (isCartoTiles) {
|
|
225
|
-
map.attributionControl.removeAttribution(CARTO_ATTRIBUTION);
|
|
226
|
-
map.attributionControl.addAttribution(OSM_ATTRIBUTION);
|
|
227
|
-
}
|
|
228
|
-
const fallback = L.tileLayer(FALLBACK_TILE, {
|
|
229
|
-
maxZoom: 19,
|
|
230
|
-
subdomains: "abc",
|
|
231
|
-
crossOrigin: true
|
|
232
|
-
});
|
|
233
|
-
fallback.addTo(map);
|
|
234
|
-
tileLayerRef.current = fallback;
|
|
235
|
-
};
|
|
236
|
-
tile.on("tileerror", onTileError);
|
|
237
209
|
const overlayGroup = L.layerGroup();
|
|
238
210
|
overlayGroup.addTo(map);
|
|
239
211
|
overlayGroupRef.current = overlayGroup;
|
|
@@ -261,7 +233,48 @@ function GroundTrackMapLeaflet({
|
|
|
261
233
|
mapRef.current = null;
|
|
262
234
|
overlayGroupRef.current = null;
|
|
263
235
|
};
|
|
264
|
-
}, [
|
|
236
|
+
}, [clearLayers]);
|
|
237
|
+
useEffect(() => {
|
|
238
|
+
const map = mapRef.current;
|
|
239
|
+
if (!map || !ready) return;
|
|
240
|
+
if (tileLayerRef.current) {
|
|
241
|
+
tileLayerRef.current.remove();
|
|
242
|
+
tileLayerRef.current = null;
|
|
243
|
+
}
|
|
244
|
+
try {
|
|
245
|
+
map.attributionControl.removeAttribution(CARTO_ATTRIBUTION);
|
|
246
|
+
map.attributionControl.removeAttribution(OSM_ATTRIBUTION);
|
|
247
|
+
} catch {
|
|
248
|
+
}
|
|
249
|
+
const isCartoTiles = effectiveTileUrl.includes("cartocdn");
|
|
250
|
+
if (isCartoTiles) {
|
|
251
|
+
map.attributionControl.addAttribution(CARTO_ATTRIBUTION);
|
|
252
|
+
}
|
|
253
|
+
const tile = L.tileLayer(effectiveTileUrl, {
|
|
254
|
+
maxZoom: 19,
|
|
255
|
+
subdomains: isCartoTiles ? "abcd" : "abc",
|
|
256
|
+
crossOrigin: true
|
|
257
|
+
});
|
|
258
|
+
tile.addTo(map);
|
|
259
|
+
tile.bringToBack();
|
|
260
|
+
tileLayerRef.current = tile;
|
|
261
|
+
let hasSwitchedToFallback = false;
|
|
262
|
+
const onTileError = () => {
|
|
263
|
+
if (hasSwitchedToFallback) return;
|
|
264
|
+
hasSwitchedToFallback = true;
|
|
265
|
+
tile.off("tileerror", onTileError);
|
|
266
|
+
tile.remove();
|
|
267
|
+
const fallback = L.tileLayer(FALLBACK_TILE, {
|
|
268
|
+
maxZoom: 19,
|
|
269
|
+
subdomains: "abc",
|
|
270
|
+
crossOrigin: true
|
|
271
|
+
});
|
|
272
|
+
fallback.addTo(map);
|
|
273
|
+
fallback.bringToBack();
|
|
274
|
+
tileLayerRef.current = fallback;
|
|
275
|
+
};
|
|
276
|
+
tile.on("tileerror", onTileError);
|
|
277
|
+
}, [effectiveTileUrl, ready]);
|
|
265
278
|
useEffect(() => {
|
|
266
279
|
if (!ready || !mapRef.current) return;
|
|
267
280
|
const map = mapRef.current;
|
|
@@ -308,6 +321,29 @@ function GroundTrackMapLeaflet({
|
|
|
308
321
|
});
|
|
309
322
|
prevOpacity = b.opacity;
|
|
310
323
|
}
|
|
324
|
+
const terminatorEdge = calculateTerminatorContinuous(now, 0);
|
|
325
|
+
if (terminatorEdge.sunset.length > 2) {
|
|
326
|
+
const sunsetLine = terminatorEdge.sunset.map(([lat, lon]) => [lat, lon]);
|
|
327
|
+
const sunriseLine = terminatorEdge.sunrise.map(([lat, lon]) => [lat, lon]);
|
|
328
|
+
[0, 360, -360].forEach((offset) => {
|
|
329
|
+
addLayer(L.polyline(
|
|
330
|
+
sunsetLine.map(([lat, lon]) => [lat, lon + offset]),
|
|
331
|
+
{ color: "#5a8ec8", weight: 4, opacity: 0.12, interactive: false, smoothFactor: 1.5 }
|
|
332
|
+
));
|
|
333
|
+
addLayer(L.polyline(
|
|
334
|
+
sunriseLine.map(([lat, lon]) => [lat, lon + offset]),
|
|
335
|
+
{ color: "#5a8ec8", weight: 4, opacity: 0.12, interactive: false, smoothFactor: 1.5 }
|
|
336
|
+
));
|
|
337
|
+
addLayer(L.polyline(
|
|
338
|
+
sunsetLine.map(([lat, lon]) => [lat, lon + offset]),
|
|
339
|
+
{ color: "#7aa4d4", weight: 1, opacity: 0.5, interactive: false, smoothFactor: 1.5 }
|
|
340
|
+
));
|
|
341
|
+
addLayer(L.polyline(
|
|
342
|
+
sunriseLine.map(([lat, lon]) => [lat, lon + offset]),
|
|
343
|
+
{ color: "#7aa4d4", weight: 1, opacity: 0.5, interactive: false, smoothFactor: 1.5 }
|
|
344
|
+
));
|
|
345
|
+
});
|
|
346
|
+
}
|
|
311
347
|
}
|
|
312
348
|
if (lightSources && lightSources.length > 0 && showTerminator) {
|
|
313
349
|
const now = terminatorTime ?? /* @__PURE__ */ new Date();
|
|
@@ -689,35 +725,109 @@ function GroundTrackMapLeaflet({
|
|
|
689
725
|
children: emptyMessage
|
|
690
726
|
}
|
|
691
727
|
),
|
|
692
|
-
showRecenterButton && /* @__PURE__ */ jsxs(
|
|
693
|
-
"
|
|
728
|
+
(showRecenterButton || showMapStyleToggle && !isExplicitTileUrl) && /* @__PURE__ */ jsxs(
|
|
729
|
+
"div",
|
|
694
730
|
{
|
|
695
|
-
|
|
696
|
-
onClick: handleRecenter,
|
|
697
|
-
title: "Recenter map",
|
|
698
|
-
"aria-label": "Recenter map",
|
|
731
|
+
className: "zendir-map-controls",
|
|
699
732
|
style: {
|
|
700
733
|
position: "absolute",
|
|
701
|
-
|
|
702
|
-
|
|
734
|
+
bottom: 28,
|
|
735
|
+
left: 10,
|
|
703
736
|
zIndex: 1e3,
|
|
704
|
-
background: "rgba(24, 29, 46, 0.9)",
|
|
705
|
-
border: "1px solid rgba(157, 112, 255, 0.25)",
|
|
706
|
-
borderRadius: 6,
|
|
707
|
-
color: "#e4e0f0",
|
|
708
|
-
cursor: "pointer",
|
|
709
|
-
padding: "6px 10px",
|
|
710
|
-
fontSize: 12,
|
|
711
737
|
display: "flex",
|
|
712
|
-
|
|
713
|
-
gap:
|
|
738
|
+
flexDirection: "row",
|
|
739
|
+
gap: 6,
|
|
740
|
+
alignItems: "flex-end"
|
|
714
741
|
},
|
|
715
742
|
children: [
|
|
716
|
-
/* @__PURE__ */ jsxs(
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
743
|
+
showRecenterButton && /* @__PURE__ */ jsxs(
|
|
744
|
+
"button",
|
|
745
|
+
{
|
|
746
|
+
type: "button",
|
|
747
|
+
onClick: handleRecenter,
|
|
748
|
+
title: "Recenter map to fit all assets and ground stations",
|
|
749
|
+
"aria-label": "Recenter map",
|
|
750
|
+
style: {
|
|
751
|
+
background: "rgba(20, 24, 38, 0.92)",
|
|
752
|
+
backdropFilter: "blur(8px)",
|
|
753
|
+
WebkitBackdropFilter: "blur(8px)",
|
|
754
|
+
border: "1px solid rgba(120, 100, 180, 0.2)",
|
|
755
|
+
borderRadius: 4,
|
|
756
|
+
color: "#c8c0d8",
|
|
757
|
+
cursor: "pointer",
|
|
758
|
+
padding: "6px 10px",
|
|
759
|
+
fontSize: 11,
|
|
760
|
+
fontWeight: 500,
|
|
761
|
+
display: "flex",
|
|
762
|
+
alignItems: "center",
|
|
763
|
+
gap: 5,
|
|
764
|
+
transition: "background 0.15s, border-color 0.15s",
|
|
765
|
+
letterSpacing: "0.02em"
|
|
766
|
+
},
|
|
767
|
+
onMouseEnter: (e) => {
|
|
768
|
+
e.currentTarget.style.background = "rgba(30, 34, 52, 0.95)";
|
|
769
|
+
e.currentTarget.style.borderColor = "rgba(157, 112, 255, 0.4)";
|
|
770
|
+
},
|
|
771
|
+
onMouseLeave: (e) => {
|
|
772
|
+
e.currentTarget.style.background = "rgba(20, 24, 38, 0.92)";
|
|
773
|
+
e.currentTarget.style.borderColor = "rgba(120, 100, 180, 0.2)";
|
|
774
|
+
},
|
|
775
|
+
children: [
|
|
776
|
+
/* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
777
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" }),
|
|
778
|
+
/* @__PURE__ */ jsx("path", { d: "M12 2v4M12 18v4M2 12h4M18 12h4" })
|
|
779
|
+
] }),
|
|
780
|
+
"Recenter"
|
|
781
|
+
]
|
|
782
|
+
}
|
|
783
|
+
),
|
|
784
|
+
showMapStyleToggle && !isExplicitTileUrl && /* @__PURE__ */ jsx(
|
|
785
|
+
"div",
|
|
786
|
+
{
|
|
787
|
+
style: {
|
|
788
|
+
background: "rgba(20, 24, 38, 0.92)",
|
|
789
|
+
backdropFilter: "blur(8px)",
|
|
790
|
+
WebkitBackdropFilter: "blur(8px)",
|
|
791
|
+
border: "1px solid rgba(120, 100, 180, 0.2)",
|
|
792
|
+
borderRadius: 4,
|
|
793
|
+
display: "flex",
|
|
794
|
+
overflow: "hidden"
|
|
795
|
+
},
|
|
796
|
+
children: ["dark", "satellite"].map((style) => /* @__PURE__ */ jsxs(
|
|
797
|
+
"button",
|
|
798
|
+
{
|
|
799
|
+
type: "button",
|
|
800
|
+
onClick: () => setTileStyle(style),
|
|
801
|
+
title: style === "dark" ? "Dark ops map" : "Satellite imagery",
|
|
802
|
+
"aria-label": style === "dark" ? "Dark map style" : "Satellite imagery",
|
|
803
|
+
"aria-pressed": tileStyle === style,
|
|
804
|
+
style: {
|
|
805
|
+
background: tileStyle === style ? "rgba(157, 112, 255, 0.22)" : "transparent",
|
|
806
|
+
border: "none",
|
|
807
|
+
borderRight: style === "dark" ? "1px solid rgba(120, 100, 180, 0.15)" : "none",
|
|
808
|
+
color: tileStyle === style ? "#d0c4ee" : "#7a748e",
|
|
809
|
+
cursor: "pointer",
|
|
810
|
+
padding: "5px 8px",
|
|
811
|
+
fontSize: 10,
|
|
812
|
+
fontWeight: tileStyle === style ? 600 : 400,
|
|
813
|
+
display: "flex",
|
|
814
|
+
alignItems: "center",
|
|
815
|
+
gap: 4,
|
|
816
|
+
transition: "all 0.15s ease",
|
|
817
|
+
letterSpacing: "0.02em"
|
|
818
|
+
},
|
|
819
|
+
children: [
|
|
820
|
+
style === "dark" ? /* @__PURE__ */ jsx("svg", { width: "11", height: "11", viewBox: "0 0 24 24", fill: "currentColor", stroke: "none", children: /* @__PURE__ */ jsx("path", { d: "M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z" }) }) : /* @__PURE__ */ jsxs("svg", { width: "11", height: "11", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
821
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
822
|
+
/* @__PURE__ */ jsx("path", { d: "M2 12h20M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z" })
|
|
823
|
+
] }),
|
|
824
|
+
style === "dark" ? "Dark" : "Satellite"
|
|
825
|
+
]
|
|
826
|
+
},
|
|
827
|
+
style
|
|
828
|
+
))
|
|
829
|
+
}
|
|
830
|
+
)
|
|
721
831
|
]
|
|
722
832
|
}
|
|
723
833
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroundTrackMapLeaflet.js","sources":["../../../src/react/charts/GroundTrackMapLeaflet.tsx"],"sourcesContent":["/**\r\n * @zendir/ui - GroundTrackMap Leaflet Provider\r\n *\r\n * Leaflet-based 2D world map for ground tracks, stations, and terminator.\r\n * Uses Zendir hybrid theme; all interactions enabled (zoom, scroll, drag, etc.).\r\n * Import leaflet-zendir.css when using this component.\r\n */\r\n\r\nimport React, { useRef, useEffect, useCallback, useMemo, useState } from 'react';\r\nimport { useTheme } from '../theme';\r\nimport type { GroundStation } from '../types';\r\nimport type { SatelliteTrack, GroundStationEnhanced, SROGroundStation, MapPin, LightSource } from './GroundTrackMap';\r\n\r\n// Optional Leaflet — consumer must install leaflet when using mapProvider=\"leaflet\"\r\nimport L from 'leaflet';\r\nimport 'leaflet/dist/leaflet.css';\r\nimport './leaflet-zendir.css';\r\nimport {\r\n splitPolylineAtAntimeridian,\r\n segmentsWithWorldCopies,\r\n geodesicCirclePoints,\r\n splitRingAtAntimeridian,\r\n} from './groundTrackMapLeafletUtils';\r\nimport {\r\n DEFAULT_TILE,\r\n FALLBACK_TILE,\r\n TILE_ERROR_THRESHOLD,\r\n CARTO_ATTRIBUTION,\r\n OSM_ATTRIBUTION,\r\n} from './groundTrackMapLeafletTiles';\r\n\r\nconst STATUS_COLOR_MAP: Record<string, string> = {\r\n normal: '#56f000',\r\n standby: '#2dccff',\r\n caution: '#fce83a',\r\n serious: '#ffb302',\r\n critical: '#ff3838',\r\n off: '#a4abb6',\r\n};\r\n\r\nconst DEFAULT_TRACK_COLORS = [\r\n '#2dccff', '#3E3CFF', '#9D70FF', '#56f000', '#fce83a', '#ff7849', '#2dd4bf', '#ff3838',\r\n];\r\n\r\n// =============================================================================\r\n// Icon helpers — produce L.DivIcon with inline SVG (no external assets needed)\r\n// =============================================================================\r\n\r\n/** Satellite spacecraft icon with solar panels, matching Astro UXDS style. */\r\nfunction createSatDivIcon(statusColor: string, trackColor: string): L.DivIcon {\r\n // Status badge shape (Astro UXDS spec)\r\n const badge = statusColor === '#56f000'\r\n ? `<circle cx=\"7\" cy=\"7\" r=\"3\" fill=\"${statusColor}\"/>` // normal: filled dot\r\n : statusColor === '#2dccff'\r\n ? `<circle cx=\"7\" cy=\"7\" r=\"2.5\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.5\"/>` // standby: ring\r\n : statusColor === '#fce83a'\r\n ? `<rect x=\"4.5\" y=\"4.5\" width=\"5\" height=\"5\" fill=\"${statusColor}\"/>` // caution: square\r\n : statusColor === '#ffb302'\r\n ? `<polygon points=\"7,3.5 10.5,7 7,10.5 3.5,7\" fill=\"${statusColor}\"/>` // serious: diamond (Astro UXDS)\r\n : statusColor === '#ff3838'\r\n ? `<polygon points=\"7,10 4,4 10,4\" fill=\"${statusColor}\"/>` // critical: triangle down\r\n : `<circle cx=\"7\" cy=\"7\" r=\"2\" fill=\"${statusColor}\"/>`; // off: small dot\r\n\r\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"34\" height=\"34\" viewBox=\"0 0 34 34\">\r\n <!-- Glow ring -->\r\n <circle cx=\"17\" cy=\"17\" r=\"15\" fill=\"${statusColor}\" fill-opacity=\"0.12\"/>\r\n <!-- Main body circle -->\r\n <circle cx=\"17\" cy=\"17\" r=\"11\" fill=\"#0d1323\" stroke=\"${trackColor}\" stroke-width=\"1.5\"/>\r\n <!-- Left solar panel -->\r\n <rect x=\"2\" y=\"15\" width=\"9\" height=\"4\" rx=\"0.5\" fill=\"${trackColor}\" fill-opacity=\"0.75\"/>\r\n <line x1=\"5.5\" y1=\"15\" x2=\"5.5\" y2=\"19\" stroke=\"${trackColor}\" stroke-width=\"0.5\" stroke-opacity=\"0.45\"/>\r\n <!-- Connector left -->\r\n <line x1=\"11\" y1=\"17\" x2=\"13\" y2=\"17\" stroke=\"${trackColor}\" stroke-width=\"1.2\"/>\r\n <!-- Satellite bus body -->\r\n <rect x=\"13\" y=\"14.5\" width=\"8\" height=\"5\" rx=\"1\" fill=\"${statusColor}\"/>\r\n <!-- Connector right -->\r\n <line x1=\"21\" y1=\"17\" x2=\"23\" y2=\"17\" stroke=\"${trackColor}\" stroke-width=\"1.2\"/>\r\n <!-- Right solar panel -->\r\n <rect x=\"23\" y=\"15\" width=\"9\" height=\"4\" rx=\"0.5\" fill=\"${trackColor}\" fill-opacity=\"0.75\"/>\r\n <line x1=\"26.5\" y1=\"15\" x2=\"26.5\" y2=\"19\" stroke=\"${trackColor}\" stroke-width=\"0.5\" stroke-opacity=\"0.45\"/>\r\n <!-- Status badge (top-left) -->\r\n <circle cx=\"7\" cy=\"7\" r=\"5.5\" fill=\"#0d1323\"/>\r\n ${badge}\r\n </svg>`;\r\n\r\n return L.divIcon({\r\n html: svg,\r\n className: 'zendir-sat-icon',\r\n iconSize: [34, 34] as unknown as L.PointExpression,\r\n iconAnchor: [17, 17] as unknown as L.PointExpression,\r\n tooltipAnchor: [0, -18] as unknown as L.PointExpression,\r\n });\r\n}\r\n\r\n/** Ground station icon — dish/antenna shape, matching Astro UXDS style. */\r\nfunction createStationDivIcon(statusColor: string, type: string, status: string): L.DivIcon {\r\n // Status badge\r\n const badge = status === 'normal'\r\n ? `<circle cx=\"5\" cy=\"5\" r=\"2.5\" fill=\"${statusColor}\"/>`\r\n : status === 'standby'\r\n ? `<circle cx=\"5\" cy=\"5\" r=\"2\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>`\r\n : status === 'caution'\r\n ? `<rect x=\"3\" y=\"3\" width=\"4\" height=\"4\" fill=\"${statusColor}\"/>`\r\n : status === 'serious'\r\n ? `<polygon points=\"5,2.5 7.5,5 5,7.5 2.5,5\" fill=\"${statusColor}\"/>`\r\n : status === 'critical'\r\n ? `<polygon points=\"5,7.5 2.5,2.5 7.5,2.5\" fill=\"${statusColor}\"/>`\r\n : `<circle cx=\"5\" cy=\"5\" r=\"1.5\" fill=\"${statusColor}\"/>`;\r\n\r\n let iconInner = '';\r\n if (type === 'phased-array') {\r\n // Grid pattern (phased array)\r\n iconInner = `\r\n <rect x=\"9\" y=\"7\" width=\"10\" height=\"8\" rx=\"0.5\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>\r\n <line x1=\"12\" y1=\"7\" x2=\"12\" y2=\"15\" stroke=\"${statusColor}\" stroke-width=\"0.7\"/>\r\n <line x1=\"15\" y1=\"7\" x2=\"15\" y2=\"15\" stroke=\"${statusColor}\" stroke-width=\"0.7\"/>\r\n <line x1=\"9\" y1=\"10\" x2=\"19\" y2=\"10\" stroke=\"${statusColor}\" stroke-width=\"0.7\"/>\r\n <line x1=\"9\" y1=\"13\" x2=\"19\" y2=\"13\" stroke=\"${statusColor}\" stroke-width=\"0.7\"/>\r\n <line x1=\"14\" y1=\"15\" x2=\"14\" y2=\"20\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>\r\n <line x1=\"11\" y1=\"20\" x2=\"17\" y2=\"20\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>`;\r\n } else if (type === 'relay') {\r\n // Relay dish with signal arcs\r\n iconInner = `\r\n <path d=\"M 8 16 a 7 7 0 0 1 7 -7\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\r\n <path d=\"M 8 16 m 2 -2 a 5 5 0 0 1 5 -5\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.2\" stroke-linecap=\"round\"/>\r\n <line x1=\"14\" y1=\"16\" x2=\"14\" y2=\"21\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>\r\n <line x1=\"11\" y1=\"21\" x2=\"17\" y2=\"21\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>\r\n <path d=\"M 16 8 a 3 3 0 0 1 0 4\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.2\" stroke-linecap=\"round\"/>\r\n <path d=\"M 17.5 6.5 a 5 5 0 0 1 0 7\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1\" stroke-linecap=\"round\"/>`;\r\n } else {\r\n // Default: dish antenna with concentric arcs (Astro UXDS antenna pattern)\r\n iconInner = `\r\n <path d=\"M 14 14 m -7 0 a 7 7 0 0 1 7 -7\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\r\n <path d=\"M 14 14 m -5 0 a 5 5 0 0 1 5 -5\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\r\n <path d=\"M 14 14 m -3 0 a 3 3 0 0 1 3 -3\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\r\n <circle cx=\"14\" cy=\"14\" r=\"1.5\" fill=\"${statusColor}\"/>\r\n <line x1=\"14\" y1=\"15\" x2=\"14\" y2=\"21\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>\r\n <line x1=\"11\" y1=\"21\" x2=\"17\" y2=\"21\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>`;\r\n }\r\n\r\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"28\" height=\"28\" viewBox=\"0 0 28 28\">\r\n <!-- Glow ring -->\r\n <circle cx=\"14\" cy=\"14\" r=\"13\" fill=\"${statusColor}\" fill-opacity=\"0.1\"/>\r\n <!-- Background -->\r\n <circle cx=\"14\" cy=\"14\" r=\"11\" fill=\"#0d1323\" stroke=\"${statusColor}\" stroke-width=\"1.2\" stroke-opacity=\"0.7\"/>\r\n ${iconInner}\r\n <!-- Status badge (top-left) -->\r\n <circle cx=\"5\" cy=\"5\" r=\"5\" fill=\"#0d1323\"/>\r\n ${badge}\r\n </svg>`;\r\n\r\n return L.divIcon({\r\n html: svg,\r\n className: 'zendir-station-icon',\r\n iconSize: [28, 28] as unknown as L.PointExpression,\r\n iconAnchor: [14, 14] as unknown as L.PointExpression,\r\n tooltipAnchor: [0, -14] as unknown as L.PointExpression,\r\n });\r\n}\r\n\r\n/**\r\n * Compute a terminator line with CONTINUOUS (unwrapped) longitudes.\r\n *\r\n * `depressionDeg` offsets the solar zenith angle to produce twilight\r\n * boundaries instead of the geometric sunset line:\r\n * - 0° = geometric sunset/sunrise (day/night boundary)\r\n * - 6° = civil twilight (horizon still visible, outdoor activities possible)\r\n * - 12° = nautical twilight (horizon barely visible, stars appearing)\r\n * - 18° = astronomical twilight (sky fully dark for observation)\r\n *\r\n * These thresholds follow IAU/USNO standard definitions used in celestial\r\n * navigation, Astro UX space ops dashboards, and STK/GMAT mission tools.\r\n */\r\nfunction calculateTerminatorContinuous(\r\n date: Date,\r\n depressionDeg: number = 0,\r\n numPoints: number = 360,\r\n): { sunset: Array<[number, number]>, sunrise: Array<[number, number]> } {\r\n const dayOfYear = Math.floor((date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000);\r\n const declination = -23.44 * Math.cos((2 * Math.PI / 365) * (dayOfYear + 10));\r\n const decRad = (declination * Math.PI) / 180;\r\n const hourAngle = ((date.getUTCHours() + date.getUTCMinutes() / 60) / 24) * 360 - 180;\r\n const depRad = (depressionDeg * Math.PI) / 180;\r\n\r\n const sunset: Array<[number, number]> = [];\r\n const sunrise: Array<[number, number]> = [];\r\n\r\n for (let i = 0; i <= numPoints; i++) {\r\n // Avoid exact +/- 90 to prevent longitude singularities at the poles\r\n const lat = -89.999 + (i / numPoints) * 179.998;\r\n const latRad = lat * (Math.PI / 180);\r\n const cosH = -(Math.sin(depRad) + Math.sin(latRad) * Math.sin(decRad))\r\n / (Math.cos(latRad) * Math.cos(decRad));\r\n \r\n if (cosH < -1) {\r\n // All day. No points.\r\n } else if (cosH > 1) {\r\n // All night. Covers all longitudes.\r\n // We map the night as the 360-degree span starting at hourAngle.\r\n sunset.push([lat, hourAngle]);\r\n sunrise.push([lat, hourAngle + 360]);\r\n } else {\r\n // Normal twilight\r\n const H = (Math.acos(cosH) * 180) / Math.PI;\r\n sunset.push([lat, hourAngle + H]);\r\n // Sunrise is 360 - H degrees East of the sun (which is equivalent to West of the sun,\r\n // but keeping it > sunset ensures the night polygon is continuous Eastward).\r\n sunrise.push([lat, hourAngle + 360 - H]);\r\n }\r\n }\r\n \r\n return { sunset, sunrise };\r\n}\r\n\r\n/**\r\n * Build the full night polygon, properly closing the loops around the poles.\r\n * Ensures longitudes are strictly continuous so the map projection doesn't\r\n * draw antimeridian lines across the day side.\r\n */\r\nfunction buildNightPolygon(\r\n terminator: { sunset: Array<[number, number]>, sunrise: Array<[number, number]> }\r\n): [number, number][] {\r\n const { sunset, sunrise } = terminator;\r\n if (!sunset.length || !sunrise.length) return [];\r\n\r\n const poly: [number, number][] = [];\r\n\r\n // Left edge of night (sunset): South to North\r\n poly.push(...sunset);\r\n\r\n // Right edge of night (sunrise): North to South\r\n poly.push(...[...sunrise].reverse());\r\n\r\n // Leaflet will automatically close the polygon by connecting the last point \r\n // (South end of sunrise) back to the first point (South end of sunset).\r\n // Because longitudes are continuous and bounded (sunrise.lon - sunset.lon <= 360),\r\n // this closing line will simply span the bottom or top of the map, perfectly\r\n // enclosing the night area without crossing the day side!\r\n\r\n return poly;\r\n}\r\n\r\nexport type GroundStationMapItem = GroundStation | GroundStationEnhanced | SROGroundStation;\r\n\r\nexport interface GroundTrackMapLeafletProps {\r\n allSatellites: SatelliteTrack[];\r\n groundStations: GroundStationMapItem[];\r\n showTerminator?: boolean;\r\n /** Override the time used for the terminator calculation (defaults to wall-clock now). */\r\n terminatorTime?: Date;\r\n showGrid?: boolean;\r\n showLegend?: boolean;\r\n showEquator?: boolean;\r\n showRecenterButton?: boolean;\r\n defaultCenter?: [number, number];\r\n defaultZoom?: number;\r\n height?: number | string;\r\n width?: number | string;\r\n minHeight?: string;\r\n emptyMessage?: string;\r\n tileUrl?: string;\r\n /**\r\n * URL template for a \"night\" tile layer (e.g. NASA Black Marble, VIIRS city lights).\r\n * Rendered beneath the terminator overlay so it only appears on the dark side.\r\n * Requires `showTerminator`. Falls back to dark overlay when not provided.\r\n */\r\n nightTileUrl?: string;\r\n /**\r\n * Point light sources rendered on the night side (masked by the terminator).\r\n * Each light fades in through twilight and reaches full brightness at night.\r\n */\r\n lightSources?: LightSource[];\r\n className?: string;\r\n onSatelliteClick?: (id: string) => void;\r\n onStationClick?: (id: string) => void;\r\n /** Points-of-interest pins */\r\n pins?: MapPin[];\r\n /** Allow adding/editing pins via map clicks */\r\n pinsEditable?: boolean;\r\n onPinAdd?: (pin: Omit<MapPin, 'id'>) => void;\r\n onPinUpdate?: (pin: MapPin) => void;\r\n onPinRemove?: (pinId: string) => void;\r\n}\r\n\r\nexport function GroundTrackMapLeaflet({\r\n allSatellites,\r\n groundStations,\r\n showTerminator = true,\r\n terminatorTime,\r\n showGrid = false,\r\n showLegend = true,\r\n showEquator = false,\r\n showRecenterButton = true,\r\n defaultCenter = [20, 0],\r\n defaultZoom = 2,\r\n height = '100%',\r\n width = '100%',\r\n minHeight = '400px',\r\n emptyMessage = 'No orbital data available',\r\n tileUrl = DEFAULT_TILE,\r\n nightTileUrl,\r\n lightSources,\r\n className = '',\r\n onSatelliteClick,\r\n onStationClick,\r\n pins,\r\n pinsEditable = false,\r\n onPinAdd,\r\n onPinUpdate,\r\n onPinRemove,\r\n}: GroundTrackMapLeafletProps): React.ReactElement {\r\n const { tokens } = useTheme();\r\n const containerRef = useRef<HTMLDivElement>(null);\r\n const mapRef = useRef<L.Map | null>(null);\r\n const tileLayerRef = useRef<L.TileLayer | null>(null);\r\n const overlayGroupRef = useRef<L.LayerGroup | null>(null);\r\n const controlsRef = useRef<L.Control[]>([]);\r\n /** Separate layer group so pin updates don't clear satellite/station layers */\r\n const pinsGroupRef = useRef<L.LayerGroup | null>(null);\r\n const [ready, setReady] = useState(false);\r\n\r\n const clearLayers = useCallback(() => {\r\n const map = mapRef.current;\r\n if (!map) return;\r\n overlayGroupRef.current?.clearLayers();\r\n controlsRef.current.forEach((ctrl) => map.removeControl(ctrl));\r\n controlsRef.current = [];\r\n }, []);\r\n\r\n const addLayer = useCallback((layer: L.Layer) => {\r\n overlayGroupRef.current?.addLayer(layer);\r\n }, []);\r\n\r\n // Create map once on mount (or when tileUrl changes). Intentionally not depending on\r\n // defaultCenter/defaultZoom so animated updates do not recreate the map (no flicker/zoom reset).\r\n useEffect(() => {\r\n // eslint-disable-next-line react-hooks/exhaustive-deps -- defaultCenter/defaultZoom used only for initial view\r\n const el = containerRef.current;\r\n if (!el) return;\r\n\r\n const center: L.LatLngExpression = defaultCenter ?? [20, 0];\r\n const zoom = defaultZoom ?? 2;\r\n\r\n const map = L.map(el, {\r\n center,\r\n zoom,\r\n zoomControl: false,\r\n scrollWheelZoom: true,\r\n doubleClickZoom: true,\r\n touchZoom: true,\r\n boxZoom: true,\r\n keyboard: true,\r\n dragging: true,\r\n attributionControl: true,\r\n maxBounds: [[-90, -540], [90, 540]],\r\n maxBoundsViscosity: 1.0,\r\n });\r\n\r\n L.control.zoom({ position: 'topright' }).addTo(map);\r\n\r\n map.attributionControl.setPrefix('');\r\n\r\n const isCartoTiles = tileUrl.includes('cartocdn');\r\n if (isCartoTiles) {\r\n map.attributionControl.addAttribution(CARTO_ATTRIBUTION);\r\n }\r\n\r\n const tileOptions: L.TileLayerOptions = {\r\n maxZoom: 19,\r\n subdomains: isCartoTiles ? 'abcd' : 'abc',\r\n // crossOrigin avoids tainted-canvas errors when Leaflet tries to read tile pixels\r\n crossOrigin: true,\r\n };\r\n\r\n const tile = L.tileLayer(tileUrl, tileOptions);\r\n tile.addTo(map);\r\n tileLayerRef.current = tile;\r\n\r\n // When primary tiles fail (network, CORS, rate limit), switch to fallback immediately.\r\n // TILE_ERROR_THRESHOLD = 1 so the first error triggers the switch — no visible black period.\r\n let hasSwitchedToFallback = false;\r\n const onTileError = () => {\r\n if (hasSwitchedToFallback) return;\r\n hasSwitchedToFallback = true;\r\n tile.off('tileerror', onTileError);\r\n tile.remove();\r\n if (isCartoTiles) {\r\n map.attributionControl.removeAttribution(CARTO_ATTRIBUTION);\r\n map.attributionControl.addAttribution(OSM_ATTRIBUTION);\r\n }\r\n const fallback = L.tileLayer(FALLBACK_TILE, {\r\n maxZoom: 19,\r\n subdomains: 'abc',\r\n crossOrigin: true,\r\n });\r\n fallback.addTo(map);\r\n tileLayerRef.current = fallback;\r\n };\r\n tile.on('tileerror', onTileError);\r\n\r\n const overlayGroup = L.layerGroup();\r\n overlayGroup.addTo(map);\r\n overlayGroupRef.current = overlayGroup;\r\n\r\n const pinsGroup = L.layerGroup();\r\n pinsGroup.addTo(map);\r\n pinsGroupRef.current = pinsGroup;\r\n\r\n mapRef.current = map;\r\n setReady(true);\r\n\r\n const onSize = () => {\r\n map.invalidateSize({ animate: false });\r\n };\r\n // Immediate RAF + two deferred calls cover: first paint, CSS transitions, flex layout settle\r\n const raf = requestAnimationFrame(onSize);\r\n const t1 = setTimeout(onSize, 150);\r\n const t2 = setTimeout(onSize, 500);\r\n\r\n return () => {\r\n clearTimeout(t1);\r\n clearTimeout(t2);\r\n cancelAnimationFrame(raf);\r\n clearLayers();\r\n pinsGroupRef.current?.clearLayers();\r\n pinsGroupRef.current = null;\r\n tileLayerRef.current = null;\r\n map.remove();\r\n mapRef.current = null;\r\n overlayGroupRef.current = null;\r\n };\r\n }, [tileUrl, clearLayers]);\r\n\r\n useEffect(() => {\r\n if (!ready || !mapRef.current) return;\r\n const map = mapRef.current;\r\n clearLayers();\r\n\r\n // === Night Tile Layer (placed beneath terminator so night imagery appears on dark side) ===\r\n if (nightTileUrl && showTerminator) {\r\n const nightTile = L.tileLayer(nightTileUrl, {\r\n maxZoom: 19,\r\n crossOrigin: true,\r\n opacity: 0.7,\r\n className: 'zendir-night-tiles',\r\n });\r\n addLayer(nightTile);\r\n }\r\n\r\n if (showTerminator) {\r\n const now = terminatorTime ?? new Date();\r\n\r\n // Build a smooth graduated terminator using many thin bands (every 2°)\r\n // instead of hard-edged zones, creating a seamless day→night fade.\r\n // Depression angles: 0° (geometric sunset) through 24° (deep night).\r\n const BAND_STEP = 2;\r\n const MAX_DEP = 24;\r\n const NIGHT_OPACITY = 0.55;\r\n const bandSteps: Array<{ depression: number; opacity: number }> = [];\r\n for (let d = 0; d <= MAX_DEP; d += BAND_STEP) {\r\n // Smooth quadratic ramp: 0° → 0.0, 18° → ~0.45, 24° → 0.55\r\n const t = Math.min(d / 18, 1);\r\n const opacity = t * t * (NIGHT_OPACITY * 0.82) + (d > 18 ? (d - 18) / 6 * (NIGHT_OPACITY * 0.18) : 0);\r\n bandSteps.push({ depression: d, opacity: Math.min(opacity, NIGHT_OPACITY) });\r\n }\r\n // Final deep-night fill for everything beyond the last band\r\n bandSteps.push({ depression: 90, opacity: NIGHT_OPACITY });\r\n\r\n let prevOpacity = 0;\r\n\r\n // Draw each band as a cumulative overlay — each adds incremental darkening\r\n // By stacking full night polygons with small opacities, we avoid drawing\r\n // complex band-difference polygons, which is much more robust at the poles.\r\n for (const b of bandSteps) {\r\n const terminator = calculateTerminatorContinuous(now, Math.min(b.depression, 89));\r\n const bandOpacity = b.opacity - prevOpacity;\r\n if (bandOpacity < 0.002 || terminator.sunset.length === 0) {\r\n prevOpacity = b.opacity;\r\n continue;\r\n }\r\n\r\n const poly = buildNightPolygon(terminator);\r\n if (poly.length < 3) continue;\r\n\r\n [0, 360, -360].forEach((offset) => {\r\n const shifted = poly.map(([lat, lon]) => [lat, lon + offset] as [number, number]);\r\n addLayer(L.polygon(shifted, {\r\n color: 'transparent',\r\n fillColor: '#000a20',\r\n fillOpacity: bandOpacity,\r\n interactive: false,\r\n }));\r\n });\r\n \r\n prevOpacity = b.opacity;\r\n }\r\n }\r\n\r\n // === Light Sources (rendered as glowing markers on the night side) ===\r\n if (lightSources && lightSources.length > 0 && showTerminator) {\r\n const now = terminatorTime ?? new Date();\r\n const dayOfYear = Math.floor((now.getTime() - new Date(now.getFullYear(), 0, 0).getTime()) / 86400000);\r\n const declination = -23.44 * Math.cos((2 * Math.PI / 365) * (dayOfYear + 10));\r\n const decRad = (declination * Math.PI) / 180;\r\n const hourAngle = ((now.getUTCHours() + now.getUTCMinutes() / 60) / 24) * 360 - 180;\r\n\r\n for (const light of lightSources) {\r\n const latRad = (light.latitude * Math.PI) / 180;\r\n const sinAlt = Math.sin(latRad) * Math.sin(decRad) +\r\n Math.cos(latRad) * Math.cos(decRad) *\r\n Math.cos(((light.longitude - hourAngle) * Math.PI) / 180);\r\n const solarAltDeg = (Math.asin(sinAlt) * 180) / Math.PI;\r\n\r\n let nightFactor: number;\r\n if (solarAltDeg >= 0) nightFactor = 0;\r\n else if (solarAltDeg <= -18) nightFactor = 1;\r\n else nightFactor = Math.min(1, -solarAltDeg / 18);\r\n\r\n if (nightFactor < 0.01) continue;\r\n\r\n const r = light.radius ?? 4;\r\n const intensity = light.intensity ?? 0.8;\r\n const color = light.color ?? '#ffeedd';\r\n const alpha = intensity * nightFactor;\r\n\r\n // Outer glow circle\r\n const glowMarker = L.circleMarker([light.latitude, light.longitude], {\r\n radius: r * 2,\r\n fillColor: color,\r\n fillOpacity: alpha * 0.4,\r\n color: color,\r\n weight: 0,\r\n interactive: !!light.label,\r\n });\r\n addLayer(glowMarker);\r\n\r\n // Bright core\r\n const coreMarker = L.circleMarker([light.latitude, light.longitude], {\r\n radius: Math.max(1, r * 0.5),\r\n fillColor: color,\r\n fillOpacity: Math.min(1, alpha * 1.2),\r\n color: 'transparent',\r\n weight: 0,\r\n interactive: false,\r\n });\r\n addLayer(coreMarker);\r\n\r\n if (light.label) {\r\n glowMarker.bindTooltip(light.label, {\r\n permanent: false,\r\n direction: 'top',\r\n className: 'zendir-leaflet-tooltip',\r\n });\r\n }\r\n }\r\n }\r\n\r\n if (showGrid) {\r\n const gridStyle = { color: 'rgba(157, 112, 255, 0.12)', weight: 0.5, interactive: false };\r\n [-360, 0, 360].forEach((offset) => {\r\n for (let lon = -180; lon <= 180; lon += 30) {\r\n const l = lon + offset;\r\n addLayer(L.polyline([[90, l], [-90, l]], gridStyle));\r\n }\r\n for (let lat = -90; lat <= 90; lat += 30) {\r\n addLayer(L.polyline([[lat, -180 + offset], [lat, 180 + offset]], gridStyle));\r\n }\r\n });\r\n }\r\n\r\n if (showEquator) {\r\n [-360, 0, 360].forEach((offset) => {\r\n addLayer(L.polyline([[0, -180 + offset], [0, 180 + offset]], {\r\n color: 'rgba(88, 166, 255, 0.25)',\r\n weight: 1,\r\n dashArray: '6, 4',\r\n interactive: false,\r\n }));\r\n });\r\n }\r\n\r\n groundStations.forEach((gs) => {\r\n const status = ('status' in gs ? gs.status : undefined) ?? 'standby';\r\n const statusColor = STATUS_COLOR_MAP[status] || STATUS_COLOR_MAP.standby;\r\n const stationType = ('type' in gs ? (gs as { type?: string }).type : undefined) ?? 'dish';\r\n const radius = 'coverageRadius' in gs ? gs.coverageRadius : undefined;\r\n const showCoverage = 'showCoverage' in gs ? gs.showCoverage : false;\r\n if (radius != null && radius > 0 && showCoverage) {\r\n const ring = geodesicCirclePoints(gs.latitude, gs.longitude, radius, 64);\r\n const rings = splitRingAtAntimeridian(ring);\r\n [0, 360, -360].forEach((offset) => {\r\n rings.forEach((r) => {\r\n const shifted = r.map(([lat, lon]) => [lat, lon + offset] as [number, number]);\r\n addLayer(L.polygon(shifted, {\r\n color: `${statusColor}55`,\r\n fillColor: statusColor,\r\n fillOpacity: 0.1,\r\n weight: 1,\r\n dashArray: '4, 3',\r\n interactive: false,\r\n }));\r\n });\r\n });\r\n }\r\n\r\n const gsIcon = createStationDivIcon(statusColor, stationType, status);\r\n const marker = L.marker([gs.latitude, gs.longitude], { icon: gsIcon });\r\n addLayer(marker);\r\n const statusLabel = status !== 'standby' ? ` · ${status}` : '';\r\n marker.bindTooltip(\r\n `<strong>${gs.name}</strong>${statusLabel}${'network' in gs && gs.network ? `<br/><span style=\"opacity:0.7\">${gs.network}</span>` : ''}`,\r\n { permanent: false, direction: 'top', className: 'zendir-leaflet-tooltip' }\r\n );\r\n marker.on('click', () => {\r\n onStationClick?.('id' in gs ? String(gs.id) : gs.name);\r\n });\r\n });\r\n\r\n allSatellites.forEach((sat, satIdx) => {\r\n const track = sat.groundTrack;\r\n if (!track || track.length === 0) return;\r\n\r\n const color = sat.color || DEFAULT_TRACK_COLORS[satIdx % DEFAULT_TRACK_COLORS.length];\r\n const futureIdx = sat.futureTrackIndex ?? track.length;\r\n\r\n const pastLatLngs = track\r\n .slice(0, futureIdx)\r\n .map((p) => [p.latitude, p.longitude] as [number, number]);\r\n segmentsWithWorldCopies(splitPolylineAtAntimeridian(pastLatLngs)).forEach((seg) => {\r\n if (seg.length >= 2) {\r\n addLayer(L.polyline(seg, { color, weight: 2.5, opacity: 1 }));\r\n }\r\n });\r\n\r\n if (futureIdx < track.length) {\r\n const futureLatLngs = track\r\n .slice(futureIdx)\r\n .map((p) => [p.latitude, p.longitude] as [number, number]);\r\n segmentsWithWorldCopies(splitPolylineAtAntimeridian(futureLatLngs)).forEach((seg) => {\r\n if (seg.length >= 2) {\r\n addLayer(L.polyline(seg, { color, weight: 1.5, opacity: 0.5, dashArray: '6, 4' }));\r\n }\r\n });\r\n }\r\n\r\n // Access mask segments (contact passes) — solid green overlay on track\r\n if (sat.accessMask && sat.accessMask.some(Boolean)) {\r\n let segment: [number, number][] = [];\r\n for (let i = 0; i < track.length; i++) {\r\n if (sat.accessMask[i]) {\r\n segment.push([track[i].latitude, track[i].longitude]);\r\n } else if (segment.length >= 2) {\r\n segmentsWithWorldCopies(splitPolylineAtAntimeridian(segment)).forEach((seg) => {\r\n if (seg.length >= 2) {\r\n addLayer(L.polyline(seg, { color: STATUS_COLOR_MAP.normal, weight: 4, opacity: 0.9 }));\r\n }\r\n });\r\n segment = [];\r\n } else {\r\n segment = [];\r\n }\r\n }\r\n if (segment.length >= 2) {\r\n segmentsWithWorldCopies(splitPolylineAtAntimeridian(segment)).forEach((seg) => {\r\n if (seg.length >= 2) {\r\n addLayer(L.polyline(seg, { color: STATUS_COLOR_MAP.normal, weight: 4, opacity: 0.9 }));\r\n }\r\n });\r\n }\r\n }\r\n\r\n if (sat.passMarkers && sat.passMarkers.length > 0) {\r\n sat.passMarkers.forEach((pm) => {\r\n const isAos = pm.type === 'aos';\r\n const pmColor = isAos ? '#56f000' : '#ff3838';\r\n const pmMarker = L.circleMarker([pm.latitude, pm.longitude], {\r\n radius: 5,\r\n fillColor: pmColor,\r\n color: `${pmColor}cc`,\r\n weight: 1.5,\r\n fillOpacity: 0.9,\r\n });\r\n addLayer(pmMarker);\r\n pmMarker.bindTooltip(`${pm.type.toUpperCase()}${pm.label ? ` – ${pm.label}` : ''}`, {\r\n permanent: false,\r\n direction: 'top',\r\n className: 'zendir-leaflet-tooltip',\r\n });\r\n });\r\n }\r\n\r\n if (sat.showFootprint && sat.footprintRadius) {\r\n const lastIdx = futureIdx > 0 ? Math.min(futureIdx - 1, track.length - 1) : track.length - 1;\r\n const last = track[lastIdx];\r\n const ring = geodesicCirclePoints(last.latitude, last.longitude, sat.footprintRadius, 64);\r\n const rings = splitRingAtAntimeridian(ring);\r\n [0, 360, -360].forEach((offset) => {\r\n rings.forEach((r) => {\r\n const shifted = r.map(([lat, lon]) => [lat, lon + offset] as [number, number]);\r\n addLayer(L.polygon(shifted, {\r\n color: `${color}70`,\r\n fillColor: color,\r\n fillOpacity: 0.1,\r\n weight: 1,\r\n dashArray: '3, 3',\r\n interactive: false,\r\n }));\r\n });\r\n });\r\n }\r\n\r\n const currentIdx = futureIdx > 0 ? Math.min(futureIdx - 1, track.length - 1) : track.length - 1;\r\n const current = track[currentIdx];\r\n const statusColor = STATUS_COLOR_MAP[sat.status || 'normal'] || STATUS_COLOR_MAP.normal;\r\n\r\n const satIcon = createSatDivIcon(statusColor, color);\r\n const satMarker = L.marker([current.latitude, current.longitude], { icon: satIcon });\r\n addLayer(satMarker);\r\n satMarker.bindTooltip(\r\n `<strong style=\"color:${color}\">${sat.name}</strong><br/>` +\r\n `Lat ${current.latitude.toFixed(3)}° Lon ${current.longitude.toFixed(3)}°` +\r\n (current.altitude != null ? `<br/>Alt ${current.altitude.toFixed(1)} km` : '') +\r\n (sat.status ? `<br/><span style=\"color:${statusColor}\">${sat.status.toUpperCase()}</span>` : ''),\r\n { permanent: false, direction: 'top', className: 'zendir-leaflet-tooltip' }\r\n );\r\n satMarker.on('click', () => onSatelliteClick?.(sat.id));\r\n });\r\n\r\n if (showLegend && (allSatellites.length > 0 || groundStations.length > 0)) {\r\n const Legend = L.Control.extend({\r\n onAdd() {\r\n const div = L.DomUtil.create('div', 'leaflet-legend-zendir');\r\n div.style.cssText = `\r\n padding: 8px 12px; background: rgba(15,21,32,0.9); border: 1px solid rgba(157,112,255,0.2);\r\n border-radius: 8px; color: #e4e0f0; font-size: 11px; font-family: Roboto, sans-serif;\r\n `;\r\n allSatellites.forEach((s, i) => {\r\n const c = s.color || DEFAULT_TRACK_COLORS[i % DEFAULT_TRACK_COLORS.length];\r\n const row = document.createElement('div');\r\n row.style.cssText = 'display: flex; align-items: center; gap: 6px; margin: 2px 0;';\r\n const swatch = document.createElement('span');\r\n swatch.style.cssText = `width:8px;height:8px;border-radius:50%;background:${c};`;\r\n const label = document.createElement('span');\r\n label.textContent = s.name;\r\n row.appendChild(swatch);\r\n row.appendChild(label);\r\n div.appendChild(row);\r\n });\r\n if (groundStations.length > 0) {\r\n const row = document.createElement('div');\r\n row.style.cssText = 'display: flex; align-items: center; gap: 6px; margin: 2px 0; margin-top: 6px;';\r\n const swatch = document.createElement('span');\r\n swatch.style.cssText = 'width:8px;height:8px;border-radius:50%;background:#2dccff;';\r\n const label = document.createElement('span');\r\n label.textContent = `${groundStations.length} Ground Station${groundStations.length > 1 ? 's' : ''}`;\r\n row.appendChild(swatch);\r\n row.appendChild(label);\r\n div.appendChild(row);\r\n }\r\n return div;\r\n },\r\n });\r\n const legend = new Legend({ position: 'topleft' });\r\n legend.addTo(map);\r\n controlsRef.current.push(legend);\r\n }\r\n\r\n }, [\r\n ready,\r\n allSatellites,\r\n groundStations,\r\n showTerminator,\r\n terminatorTime,\r\n nightTileUrl,\r\n lightSources,\r\n showGrid,\r\n showEquator,\r\n showLegend,\r\n tokens.colors.text.secondary,\r\n addLayer,\r\n clearLayers,\r\n onSatelliteClick,\r\n onStationClick,\r\n ]);\r\n\r\n // ==========================================================================\r\n // Pins layer — separate from overlayGroup so pin updates don't rebuild tracks\r\n // ==========================================================================\r\n\r\n useEffect(() => {\r\n if (!ready || !mapRef.current) return;\r\n const group = pinsGroupRef.current;\r\n if (!group) return;\r\n group.clearLayers();\r\n\r\n if (!pins || pins.length === 0) return;\r\n const accentColor = tokens.colors.accent.primary;\r\n\r\n pins.forEach((pin) => {\r\n const pinColor = pin.color || accentColor;\r\n\r\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"36\" viewBox=\"0 0 24 36\">\r\n <defs>\r\n <filter id=\"pin-shadow-${pin.id}\" x=\"-30%\" y=\"-10%\" width=\"160%\" height=\"140%\">\r\n <feDropShadow dx=\"0\" dy=\"2\" stdDeviation=\"2\" flood-color=\"#000\" flood-opacity=\"0.35\"/>\r\n </filter>\r\n </defs>\r\n <g filter=\"url(#pin-shadow-${pin.id})\">\r\n <path d=\"M12 2 C6.5 2 2 6.5 2 12 C2 19 12 34 12 34 C12 34 22 19 22 12 C22 6.5 17.5 2 12 2Z\"\r\n fill=\"${pinColor}\" stroke=\"rgba(255,255,255,0.5)\" stroke-width=\"1\"/>\r\n <circle cx=\"12\" cy=\"12\" r=\"4\" fill=\"#0d1323\" stroke=\"rgba(255,255,255,0.7)\" stroke-width=\"0.8\"/>\r\n </g>\r\n </svg>`;\r\n\r\n const icon = L.divIcon({\r\n html: svg,\r\n className: 'zendir-pin-icon',\r\n iconSize: [24, 36] as unknown as L.PointExpression,\r\n iconAnchor: [12, 36] as unknown as L.PointExpression,\r\n tooltipAnchor: [0, -36] as unknown as L.PointExpression,\r\n });\r\n\r\n const marker = L.marker([pin.latitude, pin.longitude], {\r\n icon,\r\n draggable: pinsEditable,\r\n title: pin.label ?? '',\r\n });\r\n\r\n // Rich tooltip\r\n const tooltipLines = [\r\n pin.label ? `<strong>${pin.label}</strong>` : '',\r\n pin.description ? `<div style=\"opacity:0.7;font-size:11px\">${pin.description}</div>` : '',\r\n `<div style=\"font-size:10px;opacity:0.5;font-family:monospace\">${pin.latitude.toFixed(4)}°, ${pin.longitude.toFixed(4)}°</div>`,\r\n pin.createdBy ? `<div style=\"font-size:10px;opacity:0.4;margin-top:2px\">by ${pin.createdBy}</div>` : '',\r\n ].filter(Boolean).join('');\r\n marker.bindTooltip(tooltipLines, {\r\n className: 'zendir-pin-tooltip',\r\n direction: 'top',\r\n offset: [0, -4],\r\n });\r\n\r\n if (pinsEditable) {\r\n // Drag to reposition\r\n marker.on('dragend', () => {\r\n const latlng = marker.getLatLng();\r\n onPinUpdate?.({ ...pin, latitude: latlng.lat, longitude: latlng.lng });\r\n });\r\n\r\n // Right-click to delete\r\n marker.on('contextmenu', (e: L.LeafletEvent) => {\r\n L.DomEvent.stopPropagation(e as unknown as Event);\r\n onPinRemove?.(pin.id);\r\n });\r\n }\r\n\r\n group.addLayer(marker);\r\n });\r\n }, [ready, pins, pinsEditable, onPinUpdate, onPinRemove, tokens.colors.accent.primary]);\r\n\r\n // Click-to-add: listen for clicks on the map background when pinsEditable is true\r\n useEffect(() => {\r\n if (!ready || !mapRef.current || !pinsEditable || !onPinAdd) return;\r\n const map = mapRef.current;\r\n\r\n const handleClick = (e: L.LeafletMouseEvent) => {\r\n // Only fire on map background clicks — ignore clicks that bubbled from markers\r\n if ((e.originalEvent?.target as HTMLElement)?.closest?.('.leaflet-marker-icon')) return;\r\n onPinAdd({\r\n latitude: e.latlng.lat,\r\n longitude: e.latlng.lng,\r\n label: '',\r\n color: tokens.colors.accent.primary,\r\n });\r\n };\r\n\r\n map.on('click', handleClick);\r\n return () => { map.off('click', handleClick); };\r\n }, [ready, pinsEditable, onPinAdd, tokens.colors.accent.primary]);\r\n\r\n const handleRecenter = useCallback(() => {\r\n const map = mapRef.current;\r\n if (!map) return;\r\n const points: L.LatLngExpression[] = [];\r\n allSatellites.forEach((s) => {\r\n s.groundTrack.forEach((p) => points.push([p.latitude, p.longitude]));\r\n });\r\n groundStations.forEach((gs) => points.push([gs.latitude, gs.longitude]));\r\n if (points.length > 0) {\r\n const bounds = L.latLngBounds(points);\r\n map.fitBounds(bounds, { padding: [40, 40], maxZoom: 8 });\r\n } else {\r\n map.setView(defaultCenter, defaultZoom);\r\n }\r\n }, [allSatellites, groundStations, defaultCenter, defaultZoom]);\r\n\r\n const resolvedMinHeight = minHeight || (typeof height === 'number' ? `${height}px` : '400px');\r\n\r\n const isEmpty = allSatellites.length === 0 && groundStations.length === 0 && (!pins || pins.length === 0);\r\n\r\n return (\r\n <div\r\n className={`zendir-ground-track-map zendir-ground-track-map-leaflet${pinsEditable ? ' zendir-pins-editable' : ''} ${className}`}\r\n data-map-backend=\"leaflet\"\r\n style={{\r\n width,\r\n height,\r\n minHeight: resolvedMinHeight,\r\n backgroundColor: tokens.colors.background.base,\r\n borderRadius: 8,\r\n overflow: 'hidden',\r\n position: 'relative',\r\n }}\r\n >\r\n <div\r\n ref={containerRef}\r\n style={{ width: '100%', height: '100%', minHeight: resolvedMinHeight }}\r\n />\r\n {isEmpty && (\r\n <div\r\n style={{\r\n position: 'absolute',\r\n left: '50%',\r\n top: '50%',\r\n transform: 'translate(-50%, -50%)',\r\n color: tokens.colors.text.secondary,\r\n fontSize: 14,\r\n pointerEvents: 'none',\r\n }}\r\n >\r\n {emptyMessage}\r\n </div>\r\n )}\r\n {showRecenterButton && (\r\n <button\r\n type=\"button\"\r\n onClick={handleRecenter}\r\n title=\"Recenter map\"\r\n aria-label=\"Recenter map\"\r\n style={{\r\n position: 'absolute',\r\n top: 8,\r\n right: 50,\r\n zIndex: 1000,\r\n background: 'rgba(24, 29, 46, 0.9)',\r\n border: '1px solid rgba(157, 112, 255, 0.25)',\r\n borderRadius: 6,\r\n color: '#e4e0f0',\r\n cursor: 'pointer',\r\n padding: '6px 10px',\r\n fontSize: 12,\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n }}\r\n >\r\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\r\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\r\n <path d=\"M12 2v4M12 18v4M2 12h4M18 12h4\" />\r\n </svg>\r\n Recenter\r\n </button>\r\n )}\r\n </div>\r\n );\r\n}\r\n\r\nexport default GroundTrackMapLeaflet;\r\n"],"names":[],"mappings":";;;;;;;;AA+BA,MAAM,mBAA2C;AAAA,EAC/C,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AAAA,EACV,KAAK;AACP;AAEA,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAC/E;AAOA,SAAS,iBAAiB,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UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS;AAAA,YACT,OAAM;AAAA,YACN,cAAW;AAAA,YACX,OAAO;AAAA,cACL,UAAU;AAAA,cACV,KAAK;AAAA,cACL,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,YAAY;AAAA,cACZ,QAAQ;AAAA,cACR,cAAc;AAAA,cACd,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,SAAS;AAAA,cACT,UAAU;AAAA,cACV,SAAS;AAAA,cACT,YAAY;AAAA,cACZ,KAAK;AAAA,YAAA;AAAA,YAGP,UAAA;AAAA,cAAA,qBAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,KAC5F,UAAA;AAAA,gBAAA,oBAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,KAAI;AAAA,gBAC9B,oBAAC,QAAA,EAAK,GAAE,iCAAA,CAAiC;AAAA,cAAA,GAC3C;AAAA,cAAM;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAER;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
1
|
+
{"version":3,"file":"GroundTrackMapLeaflet.js","sources":["../../../src/react/charts/GroundTrackMapLeaflet.tsx"],"sourcesContent":["/**\n * @zendir/ui - GroundTrackMap Leaflet Provider\n *\n * Leaflet-based 2D world map for ground tracks, stations, and terminator.\n * Uses Zendir hybrid theme; all interactions enabled (zoom, scroll, drag, etc.).\n * Import leaflet-zendir.css when using this component.\n */\n\nimport React, { useRef, useEffect, useCallback, useMemo, useState } from 'react';\nimport { useTheme } from '../theme';\nimport type { GroundStation } from '../types';\nimport type { SatelliteTrack, GroundStationEnhanced, SROGroundStation, MapPin, LightSource } from './GroundTrackMap';\n\n// Optional Leaflet — consumer must install leaflet when using mapProvider=\"leaflet\"\nimport L from 'leaflet';\nimport 'leaflet/dist/leaflet.css';\nimport './leaflet-zendir.css';\nimport {\n splitPolylineAtAntimeridian,\n segmentsWithWorldCopies,\n geodesicCirclePoints,\n splitRingAtAntimeridian,\n} from './groundTrackMapLeafletUtils';\nimport {\n DEFAULT_TILE,\n FALLBACK_TILE,\n TILE_ERROR_THRESHOLD,\n CARTO_ATTRIBUTION,\n OSM_ATTRIBUTION,\n TILE_PRESETS,\n} from './groundTrackMapLeafletTiles';\n\nconst STATUS_COLOR_MAP: Record<string, string> = {\n normal: '#56f000',\n standby: '#2dccff',\n caution: '#fce83a',\n serious: '#ffb302',\n critical: '#ff3838',\n off: '#a4abb6',\n};\n\nconst DEFAULT_TRACK_COLORS = [\n '#2dccff', '#3E3CFF', '#9D70FF', '#56f000', '#fce83a', '#ff7849', '#2dd4bf', '#ff3838',\n];\n\n// =============================================================================\n// Icon helpers — produce L.DivIcon with inline SVG (no external assets needed)\n// =============================================================================\n\n/** Satellite spacecraft icon with solar panels, matching Astro UXDS style. */\nfunction createSatDivIcon(statusColor: string, trackColor: string): L.DivIcon {\n // Status badge shape (Astro UXDS spec)\n const badge = statusColor === '#56f000'\n ? `<circle cx=\"7\" cy=\"7\" r=\"3\" fill=\"${statusColor}\"/>` // normal: filled dot\n : statusColor === '#2dccff'\n ? `<circle cx=\"7\" cy=\"7\" r=\"2.5\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.5\"/>` // standby: ring\n : statusColor === '#fce83a'\n ? `<rect x=\"4.5\" y=\"4.5\" width=\"5\" height=\"5\" fill=\"${statusColor}\"/>` // caution: square\n : statusColor === '#ffb302'\n ? `<polygon points=\"7,3.5 10.5,7 7,10.5 3.5,7\" fill=\"${statusColor}\"/>` // serious: diamond (Astro UXDS)\n : statusColor === '#ff3838'\n ? `<polygon points=\"7,10 4,4 10,4\" fill=\"${statusColor}\"/>` // critical: triangle down\n : `<circle cx=\"7\" cy=\"7\" r=\"2\" fill=\"${statusColor}\"/>`; // off: small dot\n\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"34\" height=\"34\" viewBox=\"0 0 34 34\">\n <!-- Glow ring -->\n <circle cx=\"17\" cy=\"17\" r=\"15\" fill=\"${statusColor}\" fill-opacity=\"0.12\"/>\n <!-- Main body circle -->\n <circle cx=\"17\" cy=\"17\" r=\"11\" fill=\"#0d1323\" stroke=\"${trackColor}\" stroke-width=\"1.5\"/>\n <!-- Left solar panel -->\n <rect x=\"2\" y=\"15\" width=\"9\" height=\"4\" rx=\"0.5\" fill=\"${trackColor}\" fill-opacity=\"0.75\"/>\n <line x1=\"5.5\" y1=\"15\" x2=\"5.5\" y2=\"19\" stroke=\"${trackColor}\" stroke-width=\"0.5\" stroke-opacity=\"0.45\"/>\n <!-- Connector left -->\n <line x1=\"11\" y1=\"17\" x2=\"13\" y2=\"17\" stroke=\"${trackColor}\" stroke-width=\"1.2\"/>\n <!-- Satellite bus body -->\n <rect x=\"13\" y=\"14.5\" width=\"8\" height=\"5\" rx=\"1\" fill=\"${statusColor}\"/>\n <!-- Connector right -->\n <line x1=\"21\" y1=\"17\" x2=\"23\" y2=\"17\" stroke=\"${trackColor}\" stroke-width=\"1.2\"/>\n <!-- Right solar panel -->\n <rect x=\"23\" y=\"15\" width=\"9\" height=\"4\" rx=\"0.5\" fill=\"${trackColor}\" fill-opacity=\"0.75\"/>\n <line x1=\"26.5\" y1=\"15\" x2=\"26.5\" y2=\"19\" stroke=\"${trackColor}\" stroke-width=\"0.5\" stroke-opacity=\"0.45\"/>\n <!-- Status badge (top-left) -->\n <circle cx=\"7\" cy=\"7\" r=\"5.5\" fill=\"#0d1323\"/>\n ${badge}\n </svg>`;\n\n return L.divIcon({\n html: svg,\n className: 'zendir-sat-icon',\n iconSize: [34, 34] as unknown as L.PointExpression,\n iconAnchor: [17, 17] as unknown as L.PointExpression,\n tooltipAnchor: [0, -18] as unknown as L.PointExpression,\n });\n}\n\n/** Ground station icon — dish/antenna shape, matching Astro UXDS style. */\nfunction createStationDivIcon(statusColor: string, type: string, status: string): L.DivIcon {\n // Status badge\n const badge = status === 'normal'\n ? `<circle cx=\"5\" cy=\"5\" r=\"2.5\" fill=\"${statusColor}\"/>`\n : status === 'standby'\n ? `<circle cx=\"5\" cy=\"5\" r=\"2\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>`\n : status === 'caution'\n ? `<rect x=\"3\" y=\"3\" width=\"4\" height=\"4\" fill=\"${statusColor}\"/>`\n : status === 'serious'\n ? `<polygon points=\"5,2.5 7.5,5 5,7.5 2.5,5\" fill=\"${statusColor}\"/>`\n : status === 'critical'\n ? `<polygon points=\"5,7.5 2.5,2.5 7.5,2.5\" fill=\"${statusColor}\"/>`\n : `<circle cx=\"5\" cy=\"5\" r=\"1.5\" fill=\"${statusColor}\"/>`;\n\n let iconInner = '';\n if (type === 'phased-array') {\n // Grid pattern (phased array)\n iconInner = `\n <rect x=\"9\" y=\"7\" width=\"10\" height=\"8\" rx=\"0.5\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>\n <line x1=\"12\" y1=\"7\" x2=\"12\" y2=\"15\" stroke=\"${statusColor}\" stroke-width=\"0.7\"/>\n <line x1=\"15\" y1=\"7\" x2=\"15\" y2=\"15\" stroke=\"${statusColor}\" stroke-width=\"0.7\"/>\n <line x1=\"9\" y1=\"10\" x2=\"19\" y2=\"10\" stroke=\"${statusColor}\" stroke-width=\"0.7\"/>\n <line x1=\"9\" y1=\"13\" x2=\"19\" y2=\"13\" stroke=\"${statusColor}\" stroke-width=\"0.7\"/>\n <line x1=\"14\" y1=\"15\" x2=\"14\" y2=\"20\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>\n <line x1=\"11\" y1=\"20\" x2=\"17\" y2=\"20\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>`;\n } else if (type === 'relay') {\n // Relay dish with signal arcs\n iconInner = `\n <path d=\"M 8 16 a 7 7 0 0 1 7 -7\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n <path d=\"M 8 16 m 2 -2 a 5 5 0 0 1 5 -5\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.2\" stroke-linecap=\"round\"/>\n <line x1=\"14\" y1=\"16\" x2=\"14\" y2=\"21\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>\n <line x1=\"11\" y1=\"21\" x2=\"17\" y2=\"21\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>\n <path d=\"M 16 8 a 3 3 0 0 1 0 4\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.2\" stroke-linecap=\"round\"/>\n <path d=\"M 17.5 6.5 a 5 5 0 0 1 0 7\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1\" stroke-linecap=\"round\"/>`;\n } else {\n // Default: dish antenna with concentric arcs (Astro UXDS antenna pattern)\n iconInner = `\n <path d=\"M 14 14 m -7 0 a 7 7 0 0 1 7 -7\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n <path d=\"M 14 14 m -5 0 a 5 5 0 0 1 5 -5\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n <path d=\"M 14 14 m -3 0 a 3 3 0 0 1 3 -3\" fill=\"none\" stroke=\"${statusColor}\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n <circle cx=\"14\" cy=\"14\" r=\"1.5\" fill=\"${statusColor}\"/>\n <line x1=\"14\" y1=\"15\" x2=\"14\" y2=\"21\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>\n <line x1=\"11\" y1=\"21\" x2=\"17\" y2=\"21\" stroke=\"${statusColor}\" stroke-width=\"1.2\"/>`;\n }\n\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"28\" height=\"28\" viewBox=\"0 0 28 28\">\n <!-- Glow ring -->\n <circle cx=\"14\" cy=\"14\" r=\"13\" fill=\"${statusColor}\" fill-opacity=\"0.1\"/>\n <!-- Background -->\n <circle cx=\"14\" cy=\"14\" r=\"11\" fill=\"#0d1323\" stroke=\"${statusColor}\" stroke-width=\"1.2\" stroke-opacity=\"0.7\"/>\n ${iconInner}\n <!-- Status badge (top-left) -->\n <circle cx=\"5\" cy=\"5\" r=\"5\" fill=\"#0d1323\"/>\n ${badge}\n </svg>`;\n\n return L.divIcon({\n html: svg,\n className: 'zendir-station-icon',\n iconSize: [28, 28] as unknown as L.PointExpression,\n iconAnchor: [14, 14] as unknown as L.PointExpression,\n tooltipAnchor: [0, -14] as unknown as L.PointExpression,\n });\n}\n\n/**\n * Compute a terminator line with CONTINUOUS (unwrapped) longitudes.\n *\n * `depressionDeg` offsets the solar zenith angle to produce twilight\n * boundaries instead of the geometric sunset line:\n * - 0° = geometric sunset/sunrise (day/night boundary)\n * - 6° = civil twilight (horizon still visible, outdoor activities possible)\n * - 12° = nautical twilight (horizon barely visible, stars appearing)\n * - 18° = astronomical twilight (sky fully dark for observation)\n *\n * These thresholds follow IAU/USNO standard definitions used in celestial\n * navigation, Astro UX space ops dashboards, and STK/GMAT mission tools.\n */\nfunction calculateTerminatorContinuous(\n date: Date,\n depressionDeg: number = 0,\n numPoints: number = 360,\n): { sunset: Array<[number, number]>, sunrise: Array<[number, number]> } {\n const dayOfYear = Math.floor((date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000);\n const declination = -23.44 * Math.cos((2 * Math.PI / 365) * (dayOfYear + 10));\n const decRad = (declination * Math.PI) / 180;\n const hourAngle = ((date.getUTCHours() + date.getUTCMinutes() / 60) / 24) * 360 - 180;\n const depRad = (depressionDeg * Math.PI) / 180;\n\n const sunset: Array<[number, number]> = [];\n const sunrise: Array<[number, number]> = [];\n\n for (let i = 0; i <= numPoints; i++) {\n // Avoid exact +/- 90 to prevent longitude singularities at the poles\n const lat = -89.999 + (i / numPoints) * 179.998;\n const latRad = lat * (Math.PI / 180);\n const cosH = -(Math.sin(depRad) + Math.sin(latRad) * Math.sin(decRad))\n / (Math.cos(latRad) * Math.cos(decRad));\n \n if (cosH < -1) {\n // All day. No points.\n } else if (cosH > 1) {\n // All night. Covers all longitudes.\n // We map the night as the 360-degree span starting at hourAngle.\n sunset.push([lat, hourAngle]);\n sunrise.push([lat, hourAngle + 360]);\n } else {\n // Normal twilight\n const H = (Math.acos(cosH) * 180) / Math.PI;\n sunset.push([lat, hourAngle + H]);\n // Sunrise is 360 - H degrees East of the sun (which is equivalent to West of the sun,\n // but keeping it > sunset ensures the night polygon is continuous Eastward).\n sunrise.push([lat, hourAngle + 360 - H]);\n }\n }\n \n return { sunset, sunrise };\n}\n\n/**\n * Build the full night polygon, properly closing the loops around the poles.\n * Ensures longitudes are strictly continuous so the map projection doesn't\n * draw antimeridian lines across the day side.\n */\nfunction buildNightPolygon(\n terminator: { sunset: Array<[number, number]>, sunrise: Array<[number, number]> }\n): [number, number][] {\n const { sunset, sunrise } = terminator;\n if (!sunset.length || !sunrise.length) return [];\n\n const poly: [number, number][] = [];\n\n // Left edge of night (sunset): South to North\n poly.push(...sunset);\n\n // Right edge of night (sunrise): North to South\n poly.push(...[...sunrise].reverse());\n\n // Leaflet will automatically close the polygon by connecting the last point \n // (South end of sunrise) back to the first point (South end of sunset).\n // Because longitudes are continuous and bounded (sunrise.lon - sunset.lon <= 360),\n // this closing line will simply span the bottom or top of the map, perfectly\n // enclosing the night area without crossing the day side!\n\n return poly;\n}\n\nexport type GroundStationMapItem = GroundStation | GroundStationEnhanced | SROGroundStation;\n\nexport interface GroundTrackMapLeafletProps {\n allSatellites: SatelliteTrack[];\n groundStations: GroundStationMapItem[];\n showTerminator?: boolean;\n /** Override the time used for the terminator calculation (defaults to wall-clock now). */\n terminatorTime?: Date;\n showGrid?: boolean;\n showLegend?: boolean;\n showEquator?: boolean;\n showRecenterButton?: boolean;\n /** Show a toggle button to switch between Dark and Satellite tile styles. Default true. */\n showMapStyleToggle?: boolean;\n defaultCenter?: [number, number];\n defaultZoom?: number;\n height?: number | string;\n width?: number | string;\n minHeight?: string;\n emptyMessage?: string;\n tileUrl?: string;\n /**\n * URL template for a \"night\" tile layer (e.g. NASA Black Marble, VIIRS city lights).\n * Rendered beneath the terminator overlay so it only appears on the dark side.\n * Requires `showTerminator`. Falls back to dark overlay when not provided.\n */\n nightTileUrl?: string;\n /**\n * Point light sources rendered on the night side (masked by the terminator).\n * Each light fades in through twilight and reaches full brightness at night.\n */\n lightSources?: LightSource[];\n className?: string;\n onSatelliteClick?: (id: string) => void;\n onStationClick?: (id: string) => void;\n /** Points-of-interest pins */\n pins?: MapPin[];\n /** Allow adding/editing pins via map clicks */\n pinsEditable?: boolean;\n onPinAdd?: (pin: Omit<MapPin, 'id'>) => void;\n onPinUpdate?: (pin: MapPin) => void;\n onPinRemove?: (pinId: string) => void;\n}\n\nexport function GroundTrackMapLeaflet({\n allSatellites,\n groundStations,\n showTerminator = true,\n terminatorTime,\n showGrid = false,\n showLegend = true,\n showEquator = false,\n showRecenterButton = true,\n showMapStyleToggle = true,\n defaultCenter = [20, 0],\n defaultZoom = 2,\n height = '100%',\n width = '100%',\n minHeight = '400px',\n emptyMessage = 'No orbital data available',\n tileUrl,\n nightTileUrl,\n lightSources,\n className = '',\n onSatelliteClick,\n onStationClick,\n pins,\n pinsEditable = false,\n onPinAdd,\n onPinUpdate,\n onPinRemove,\n}: GroundTrackMapLeafletProps): React.ReactElement {\n const { tokens } = useTheme();\n const containerRef = useRef<HTMLDivElement>(null);\n const mapRef = useRef<L.Map | null>(null);\n const tileLayerRef = useRef<L.TileLayer | null>(null);\n const overlayGroupRef = useRef<L.LayerGroup | null>(null);\n const controlsRef = useRef<L.Control[]>([]);\n /** Separate layer group so pin updates don't clear satellite/station layers */\n const pinsGroupRef = useRef<L.LayerGroup | null>(null);\n const [ready, setReady] = useState(false);\n\n /** Internal tile style toggle — only active when no explicit tileUrl prop is passed. */\n const [tileStyle, setTileStyle] = useState<'dark' | 'satellite'>('dark');\n const isExplicitTileUrl = tileUrl !== undefined;\n const effectiveTileUrl = isExplicitTileUrl ? tileUrl : TILE_PRESETS[tileStyle];\n\n const clearLayers = useCallback(() => {\n const map = mapRef.current;\n if (!map) return;\n overlayGroupRef.current?.clearLayers();\n controlsRef.current.forEach((ctrl) => map.removeControl(ctrl));\n controlsRef.current = [];\n }, []);\n\n const addLayer = useCallback((layer: L.Layer) => {\n overlayGroupRef.current?.addLayer(layer);\n }, []);\n\n // Create map once on mount (or when tileUrl changes). Intentionally not depending on\n // defaultCenter/defaultZoom so animated updates do not recreate the map (no flicker/zoom reset).\n useEffect(() => {\n // eslint-disable-next-line react-hooks/exhaustive-deps -- defaultCenter/defaultZoom used only for initial view\n const el = containerRef.current;\n if (!el) return;\n\n const center: L.LatLngExpression = defaultCenter ?? [20, 0];\n const zoom = defaultZoom ?? 2;\n\n const map = L.map(el, {\n center,\n zoom,\n zoomControl: false,\n scrollWheelZoom: true,\n doubleClickZoom: true,\n touchZoom: true,\n boxZoom: true,\n keyboard: true,\n dragging: true,\n attributionControl: true,\n maxBounds: [[-90, -540], [90, 540]],\n maxBoundsViscosity: 1.0,\n });\n\n L.control.zoom({ position: 'topright' }).addTo(map);\n\n map.attributionControl.setPrefix('');\n\n const overlayGroup = L.layerGroup();\n overlayGroup.addTo(map);\n overlayGroupRef.current = overlayGroup;\n\n const pinsGroup = L.layerGroup();\n pinsGroup.addTo(map);\n pinsGroupRef.current = pinsGroup;\n\n mapRef.current = map;\n setReady(true);\n\n const onSize = () => {\n map.invalidateSize({ animate: false });\n };\n // Immediate RAF + two deferred calls cover: first paint, CSS transitions, flex layout settle\n const raf = requestAnimationFrame(onSize);\n const t1 = setTimeout(onSize, 150);\n const t2 = setTimeout(onSize, 500);\n\n return () => {\n clearTimeout(t1);\n clearTimeout(t2);\n cancelAnimationFrame(raf);\n clearLayers();\n pinsGroupRef.current?.clearLayers();\n pinsGroupRef.current = null;\n tileLayerRef.current = null;\n map.remove();\n mapRef.current = null;\n overlayGroupRef.current = null;\n };\n // Mount-only: tile layer is swapped by a dedicated effect below.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [clearLayers]);\n\n // Swap tile layer without recreating the entire map (avoids flash on style toggle).\n useEffect(() => {\n const map = mapRef.current;\n if (!map || !ready) return;\n\n // Remove existing tile layer and its attribution\n if (tileLayerRef.current) {\n tileLayerRef.current.remove();\n tileLayerRef.current = null;\n }\n // Clear old attributions before adding new\n try {\n map.attributionControl.removeAttribution(CARTO_ATTRIBUTION);\n map.attributionControl.removeAttribution(OSM_ATTRIBUTION);\n } catch { /* ignore if not present */ }\n\n const isCartoTiles = effectiveTileUrl.includes('cartocdn');\n if (isCartoTiles) {\n map.attributionControl.addAttribution(CARTO_ATTRIBUTION);\n }\n\n const tile = L.tileLayer(effectiveTileUrl, {\n maxZoom: 19,\n subdomains: isCartoTiles ? 'abcd' : 'abc',\n crossOrigin: true,\n });\n tile.addTo(map);\n tile.bringToBack();\n tileLayerRef.current = tile;\n\n // Fallback on tile error\n let hasSwitchedToFallback = false;\n const onTileError = () => {\n if (hasSwitchedToFallback) return;\n hasSwitchedToFallback = true;\n tile.off('tileerror', onTileError);\n tile.remove();\n const fallback = L.tileLayer(FALLBACK_TILE, {\n maxZoom: 19,\n subdomains: 'abc',\n crossOrigin: true,\n });\n fallback.addTo(map);\n fallback.bringToBack();\n tileLayerRef.current = fallback;\n };\n tile.on('tileerror', onTileError);\n }, [effectiveTileUrl, ready]);\n\n useEffect(() => {\n if (!ready || !mapRef.current) return;\n const map = mapRef.current;\n clearLayers();\n\n // === Night Tile Layer (placed beneath terminator so night imagery appears on dark side) ===\n if (nightTileUrl && showTerminator) {\n const nightTile = L.tileLayer(nightTileUrl, {\n maxZoom: 19,\n crossOrigin: true,\n opacity: 0.7,\n className: 'zendir-night-tiles',\n });\n addLayer(nightTile);\n }\n\n if (showTerminator) {\n const now = terminatorTime ?? new Date();\n\n // Build a smooth graduated terminator using many thin bands (every 2°)\n // instead of hard-edged zones, creating a seamless day→night fade.\n // Depression angles: 0° (geometric sunset) through 24° (deep night).\n const BAND_STEP = 2;\n const MAX_DEP = 24;\n const NIGHT_OPACITY = 0.55;\n const bandSteps: Array<{ depression: number; opacity: number }> = [];\n for (let d = 0; d <= MAX_DEP; d += BAND_STEP) {\n // Smooth quadratic ramp: 0° → 0.0, 18° → ~0.45, 24° → 0.55\n const t = Math.min(d / 18, 1);\n const opacity = t * t * (NIGHT_OPACITY * 0.82) + (d > 18 ? (d - 18) / 6 * (NIGHT_OPACITY * 0.18) : 0);\n bandSteps.push({ depression: d, opacity: Math.min(opacity, NIGHT_OPACITY) });\n }\n // Final deep-night fill for everything beyond the last band\n bandSteps.push({ depression: 90, opacity: NIGHT_OPACITY });\n\n let prevOpacity = 0;\n\n // Draw each band as a cumulative overlay — each adds incremental darkening\n // By stacking full night polygons with small opacities, we avoid drawing\n // complex band-difference polygons, which is much more robust at the poles.\n for (const b of bandSteps) {\n const terminator = calculateTerminatorContinuous(now, Math.min(b.depression, 89));\n const bandOpacity = b.opacity - prevOpacity;\n if (bandOpacity < 0.002 || terminator.sunset.length === 0) {\n prevOpacity = b.opacity;\n continue;\n }\n\n const poly = buildNightPolygon(terminator);\n if (poly.length < 3) continue;\n\n [0, 360, -360].forEach((offset) => {\n const shifted = poly.map(([lat, lon]) => [lat, lon + offset] as [number, number]);\n addLayer(L.polygon(shifted, {\n color: 'transparent',\n fillColor: '#000a20',\n fillOpacity: bandOpacity,\n interactive: false,\n }));\n });\n \n prevOpacity = b.opacity;\n }\n\n // Draw a smooth terminator boundary line (0° depression)\n // — a thin, continuous stroke showing the day/night geometric edge.\n const terminatorEdge = calculateTerminatorContinuous(now, 0);\n if (terminatorEdge.sunset.length > 2) {\n const sunsetLine = terminatorEdge.sunset.map(([lat, lon]) => [lat, lon] as [number, number]);\n const sunriseLine = terminatorEdge.sunrise.map(([lat, lon]) => [lat, lon] as [number, number]);\n [0, 360, -360].forEach((offset) => {\n // Outer glow (wider, more transparent)\n addLayer(L.polyline(\n sunsetLine.map(([lat, lon]) => [lat, lon + offset] as [number, number]),\n { color: '#5a8ec8', weight: 4, opacity: 0.12, interactive: false, smoothFactor: 1.5 }\n ));\n addLayer(L.polyline(\n sunriseLine.map(([lat, lon]) => [lat, lon + offset] as [number, number]),\n { color: '#5a8ec8', weight: 4, opacity: 0.12, interactive: false, smoothFactor: 1.5 }\n ));\n // Core line\n addLayer(L.polyline(\n sunsetLine.map(([lat, lon]) => [lat, lon + offset] as [number, number]),\n { color: '#7aa4d4', weight: 1, opacity: 0.5, interactive: false, smoothFactor: 1.5 }\n ));\n addLayer(L.polyline(\n sunriseLine.map(([lat, lon]) => [lat, lon + offset] as [number, number]),\n { color: '#7aa4d4', weight: 1, opacity: 0.5, interactive: false, smoothFactor: 1.5 }\n ));\n });\n }\n }\n\n // === Light Sources (rendered as glowing markers on the night side) ===\n if (lightSources && lightSources.length > 0 && showTerminator) {\n const now = terminatorTime ?? new Date();\n const dayOfYear = Math.floor((now.getTime() - new Date(now.getFullYear(), 0, 0).getTime()) / 86400000);\n const declination = -23.44 * Math.cos((2 * Math.PI / 365) * (dayOfYear + 10));\n const decRad = (declination * Math.PI) / 180;\n const hourAngle = ((now.getUTCHours() + now.getUTCMinutes() / 60) / 24) * 360 - 180;\n\n for (const light of lightSources) {\n const latRad = (light.latitude * Math.PI) / 180;\n const sinAlt = Math.sin(latRad) * Math.sin(decRad) +\n Math.cos(latRad) * Math.cos(decRad) *\n Math.cos(((light.longitude - hourAngle) * Math.PI) / 180);\n const solarAltDeg = (Math.asin(sinAlt) * 180) / Math.PI;\n\n let nightFactor: number;\n if (solarAltDeg >= 0) nightFactor = 0;\n else if (solarAltDeg <= -18) nightFactor = 1;\n else nightFactor = Math.min(1, -solarAltDeg / 18);\n\n if (nightFactor < 0.01) continue;\n\n const r = light.radius ?? 4;\n const intensity = light.intensity ?? 0.8;\n const color = light.color ?? '#ffeedd';\n const alpha = intensity * nightFactor;\n\n // Outer glow circle\n const glowMarker = L.circleMarker([light.latitude, light.longitude], {\n radius: r * 2,\n fillColor: color,\n fillOpacity: alpha * 0.4,\n color: color,\n weight: 0,\n interactive: !!light.label,\n });\n addLayer(glowMarker);\n\n // Bright core\n const coreMarker = L.circleMarker([light.latitude, light.longitude], {\n radius: Math.max(1, r * 0.5),\n fillColor: color,\n fillOpacity: Math.min(1, alpha * 1.2),\n color: 'transparent',\n weight: 0,\n interactive: false,\n });\n addLayer(coreMarker);\n\n if (light.label) {\n glowMarker.bindTooltip(light.label, {\n permanent: false,\n direction: 'top',\n className: 'zendir-leaflet-tooltip',\n });\n }\n }\n }\n\n if (showGrid) {\n const gridStyle = { color: 'rgba(157, 112, 255, 0.12)', weight: 0.5, interactive: false };\n [-360, 0, 360].forEach((offset) => {\n for (let lon = -180; lon <= 180; lon += 30) {\n const l = lon + offset;\n addLayer(L.polyline([[90, l], [-90, l]], gridStyle));\n }\n for (let lat = -90; lat <= 90; lat += 30) {\n addLayer(L.polyline([[lat, -180 + offset], [lat, 180 + offset]], gridStyle));\n }\n });\n }\n\n if (showEquator) {\n [-360, 0, 360].forEach((offset) => {\n addLayer(L.polyline([[0, -180 + offset], [0, 180 + offset]], {\n color: 'rgba(88, 166, 255, 0.25)',\n weight: 1,\n dashArray: '6, 4',\n interactive: false,\n }));\n });\n }\n\n groundStations.forEach((gs) => {\n const status = ('status' in gs ? gs.status : undefined) ?? 'standby';\n const statusColor = STATUS_COLOR_MAP[status] || STATUS_COLOR_MAP.standby;\n const stationType = ('type' in gs ? (gs as { type?: string }).type : undefined) ?? 'dish';\n const radius = 'coverageRadius' in gs ? gs.coverageRadius : undefined;\n const showCoverage = 'showCoverage' in gs ? gs.showCoverage : false;\n if (radius != null && radius > 0 && showCoverage) {\n const ring = geodesicCirclePoints(gs.latitude, gs.longitude, radius, 64);\n const rings = splitRingAtAntimeridian(ring);\n [0, 360, -360].forEach((offset) => {\n rings.forEach((r) => {\n const shifted = r.map(([lat, lon]) => [lat, lon + offset] as [number, number]);\n addLayer(L.polygon(shifted, {\n color: `${statusColor}55`,\n fillColor: statusColor,\n fillOpacity: 0.1,\n weight: 1,\n dashArray: '4, 3',\n interactive: false,\n }));\n });\n });\n }\n\n const gsIcon = createStationDivIcon(statusColor, stationType, status);\n const marker = L.marker([gs.latitude, gs.longitude], { icon: gsIcon });\n addLayer(marker);\n const statusLabel = status !== 'standby' ? ` · ${status}` : '';\n marker.bindTooltip(\n `<strong>${gs.name}</strong>${statusLabel}${'network' in gs && gs.network ? `<br/><span style=\"opacity:0.7\">${gs.network}</span>` : ''}`,\n { permanent: false, direction: 'top', className: 'zendir-leaflet-tooltip' }\n );\n marker.on('click', () => {\n onStationClick?.('id' in gs ? String(gs.id) : gs.name);\n });\n });\n\n allSatellites.forEach((sat, satIdx) => {\n const track = sat.groundTrack;\n if (!track || track.length === 0) return;\n\n const color = sat.color || DEFAULT_TRACK_COLORS[satIdx % DEFAULT_TRACK_COLORS.length];\n const futureIdx = sat.futureTrackIndex ?? track.length;\n\n const pastLatLngs = track\n .slice(0, futureIdx)\n .map((p) => [p.latitude, p.longitude] as [number, number]);\n segmentsWithWorldCopies(splitPolylineAtAntimeridian(pastLatLngs)).forEach((seg) => {\n if (seg.length >= 2) {\n addLayer(L.polyline(seg, { color, weight: 2.5, opacity: 1 }));\n }\n });\n\n if (futureIdx < track.length) {\n const futureLatLngs = track\n .slice(futureIdx)\n .map((p) => [p.latitude, p.longitude] as [number, number]);\n segmentsWithWorldCopies(splitPolylineAtAntimeridian(futureLatLngs)).forEach((seg) => {\n if (seg.length >= 2) {\n addLayer(L.polyline(seg, { color, weight: 1.5, opacity: 0.5, dashArray: '6, 4' }));\n }\n });\n }\n\n // Access mask segments (contact passes) — solid green overlay on track\n if (sat.accessMask && sat.accessMask.some(Boolean)) {\n let segment: [number, number][] = [];\n for (let i = 0; i < track.length; i++) {\n if (sat.accessMask[i]) {\n segment.push([track[i].latitude, track[i].longitude]);\n } else if (segment.length >= 2) {\n segmentsWithWorldCopies(splitPolylineAtAntimeridian(segment)).forEach((seg) => {\n if (seg.length >= 2) {\n addLayer(L.polyline(seg, { color: STATUS_COLOR_MAP.normal, weight: 4, opacity: 0.9 }));\n }\n });\n segment = [];\n } else {\n segment = [];\n }\n }\n if (segment.length >= 2) {\n segmentsWithWorldCopies(splitPolylineAtAntimeridian(segment)).forEach((seg) => {\n if (seg.length >= 2) {\n addLayer(L.polyline(seg, { color: STATUS_COLOR_MAP.normal, weight: 4, opacity: 0.9 }));\n }\n });\n }\n }\n\n if (sat.passMarkers && sat.passMarkers.length > 0) {\n sat.passMarkers.forEach((pm) => {\n const isAos = pm.type === 'aos';\n const pmColor = isAos ? '#56f000' : '#ff3838';\n const pmMarker = L.circleMarker([pm.latitude, pm.longitude], {\n radius: 5,\n fillColor: pmColor,\n color: `${pmColor}cc`,\n weight: 1.5,\n fillOpacity: 0.9,\n });\n addLayer(pmMarker);\n pmMarker.bindTooltip(`${pm.type.toUpperCase()}${pm.label ? ` – ${pm.label}` : ''}`, {\n permanent: false,\n direction: 'top',\n className: 'zendir-leaflet-tooltip',\n });\n });\n }\n\n if (sat.showFootprint && sat.footprintRadius) {\n const lastIdx = futureIdx > 0 ? Math.min(futureIdx - 1, track.length - 1) : track.length - 1;\n const last = track[lastIdx];\n const ring = geodesicCirclePoints(last.latitude, last.longitude, sat.footprintRadius, 64);\n const rings = splitRingAtAntimeridian(ring);\n [0, 360, -360].forEach((offset) => {\n rings.forEach((r) => {\n const shifted = r.map(([lat, lon]) => [lat, lon + offset] as [number, number]);\n addLayer(L.polygon(shifted, {\n color: `${color}70`,\n fillColor: color,\n fillOpacity: 0.1,\n weight: 1,\n dashArray: '3, 3',\n interactive: false,\n }));\n });\n });\n }\n\n const currentIdx = futureIdx > 0 ? Math.min(futureIdx - 1, track.length - 1) : track.length - 1;\n const current = track[currentIdx];\n const statusColor = STATUS_COLOR_MAP[sat.status || 'normal'] || STATUS_COLOR_MAP.normal;\n\n const satIcon = createSatDivIcon(statusColor, color);\n const satMarker = L.marker([current.latitude, current.longitude], { icon: satIcon });\n addLayer(satMarker);\n satMarker.bindTooltip(\n `<strong style=\"color:${color}\">${sat.name}</strong><br/>` +\n `Lat ${current.latitude.toFixed(3)}° Lon ${current.longitude.toFixed(3)}°` +\n (current.altitude != null ? `<br/>Alt ${current.altitude.toFixed(1)} km` : '') +\n (sat.status ? `<br/><span style=\"color:${statusColor}\">${sat.status.toUpperCase()}</span>` : ''),\n { permanent: false, direction: 'top', className: 'zendir-leaflet-tooltip' }\n );\n satMarker.on('click', () => onSatelliteClick?.(sat.id));\n });\n\n if (showLegend && (allSatellites.length > 0 || groundStations.length > 0)) {\n const Legend = L.Control.extend({\n onAdd() {\n const div = L.DomUtil.create('div', 'leaflet-legend-zendir');\n div.style.cssText = `\n padding: 8px 12px; background: rgba(15,21,32,0.9); border: 1px solid rgba(157,112,255,0.2);\n border-radius: 8px; color: #e4e0f0; font-size: 11px; font-family: Roboto, sans-serif;\n `;\n allSatellites.forEach((s, i) => {\n const c = s.color || DEFAULT_TRACK_COLORS[i % DEFAULT_TRACK_COLORS.length];\n const row = document.createElement('div');\n row.style.cssText = 'display: flex; align-items: center; gap: 6px; margin: 2px 0;';\n const swatch = document.createElement('span');\n swatch.style.cssText = `width:8px;height:8px;border-radius:50%;background:${c};`;\n const label = document.createElement('span');\n label.textContent = s.name;\n row.appendChild(swatch);\n row.appendChild(label);\n div.appendChild(row);\n });\n if (groundStations.length > 0) {\n const row = document.createElement('div');\n row.style.cssText = 'display: flex; align-items: center; gap: 6px; margin: 2px 0; margin-top: 6px;';\n const swatch = document.createElement('span');\n swatch.style.cssText = 'width:8px;height:8px;border-radius:50%;background:#2dccff;';\n const label = document.createElement('span');\n label.textContent = `${groundStations.length} Ground Station${groundStations.length > 1 ? 's' : ''}`;\n row.appendChild(swatch);\n row.appendChild(label);\n div.appendChild(row);\n }\n return div;\n },\n });\n const legend = new Legend({ position: 'topleft' });\n legend.addTo(map);\n controlsRef.current.push(legend);\n }\n\n }, [\n ready,\n allSatellites,\n groundStations,\n showTerminator,\n terminatorTime,\n nightTileUrl,\n lightSources,\n showGrid,\n showEquator,\n showLegend,\n tokens.colors.text.secondary,\n addLayer,\n clearLayers,\n onSatelliteClick,\n onStationClick,\n ]);\n\n // ==========================================================================\n // Pins layer — separate from overlayGroup so pin updates don't rebuild tracks\n // ==========================================================================\n\n useEffect(() => {\n if (!ready || !mapRef.current) return;\n const group = pinsGroupRef.current;\n if (!group) return;\n group.clearLayers();\n\n if (!pins || pins.length === 0) return;\n const accentColor = tokens.colors.accent.primary;\n\n pins.forEach((pin) => {\n const pinColor = pin.color || accentColor;\n\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"36\" viewBox=\"0 0 24 36\">\n <defs>\n <filter id=\"pin-shadow-${pin.id}\" x=\"-30%\" y=\"-10%\" width=\"160%\" height=\"140%\">\n <feDropShadow dx=\"0\" dy=\"2\" stdDeviation=\"2\" flood-color=\"#000\" flood-opacity=\"0.35\"/>\n </filter>\n </defs>\n <g filter=\"url(#pin-shadow-${pin.id})\">\n <path d=\"M12 2 C6.5 2 2 6.5 2 12 C2 19 12 34 12 34 C12 34 22 19 22 12 C22 6.5 17.5 2 12 2Z\"\n fill=\"${pinColor}\" stroke=\"rgba(255,255,255,0.5)\" stroke-width=\"1\"/>\n <circle cx=\"12\" cy=\"12\" r=\"4\" fill=\"#0d1323\" stroke=\"rgba(255,255,255,0.7)\" stroke-width=\"0.8\"/>\n </g>\n </svg>`;\n\n const icon = L.divIcon({\n html: svg,\n className: 'zendir-pin-icon',\n iconSize: [24, 36] as unknown as L.PointExpression,\n iconAnchor: [12, 36] as unknown as L.PointExpression,\n tooltipAnchor: [0, -36] as unknown as L.PointExpression,\n });\n\n const marker = L.marker([pin.latitude, pin.longitude], {\n icon,\n draggable: pinsEditable,\n title: pin.label ?? '',\n });\n\n // Rich tooltip\n const tooltipLines = [\n pin.label ? `<strong>${pin.label}</strong>` : '',\n pin.description ? `<div style=\"opacity:0.7;font-size:11px\">${pin.description}</div>` : '',\n `<div style=\"font-size:10px;opacity:0.5;font-family:monospace\">${pin.latitude.toFixed(4)}°, ${pin.longitude.toFixed(4)}°</div>`,\n pin.createdBy ? `<div style=\"font-size:10px;opacity:0.4;margin-top:2px\">by ${pin.createdBy}</div>` : '',\n ].filter(Boolean).join('');\n marker.bindTooltip(tooltipLines, {\n className: 'zendir-pin-tooltip',\n direction: 'top',\n offset: [0, -4],\n });\n\n if (pinsEditable) {\n // Drag to reposition\n marker.on('dragend', () => {\n const latlng = marker.getLatLng();\n onPinUpdate?.({ ...pin, latitude: latlng.lat, longitude: latlng.lng });\n });\n\n // Right-click to delete\n marker.on('contextmenu', (e: L.LeafletEvent) => {\n L.DomEvent.stopPropagation(e as unknown as Event);\n onPinRemove?.(pin.id);\n });\n }\n\n group.addLayer(marker);\n });\n }, [ready, pins, pinsEditable, onPinUpdate, onPinRemove, tokens.colors.accent.primary]);\n\n // Click-to-add: listen for clicks on the map background when pinsEditable is true\n useEffect(() => {\n if (!ready || !mapRef.current || !pinsEditable || !onPinAdd) return;\n const map = mapRef.current;\n\n const handleClick = (e: L.LeafletMouseEvent) => {\n // Only fire on map background clicks — ignore clicks that bubbled from markers\n if ((e.originalEvent?.target as HTMLElement)?.closest?.('.leaflet-marker-icon')) return;\n onPinAdd({\n latitude: e.latlng.lat,\n longitude: e.latlng.lng,\n label: '',\n color: tokens.colors.accent.primary,\n });\n };\n\n map.on('click', handleClick);\n return () => { map.off('click', handleClick); };\n }, [ready, pinsEditable, onPinAdd, tokens.colors.accent.primary]);\n\n const handleRecenter = useCallback(() => {\n const map = mapRef.current;\n if (!map) return;\n const points: L.LatLngExpression[] = [];\n allSatellites.forEach((s) => {\n s.groundTrack.forEach((p) => points.push([p.latitude, p.longitude]));\n });\n groundStations.forEach((gs) => points.push([gs.latitude, gs.longitude]));\n if (points.length > 0) {\n const bounds = L.latLngBounds(points);\n map.fitBounds(bounds, { padding: [40, 40], maxZoom: 8 });\n } else {\n map.setView(defaultCenter, defaultZoom);\n }\n }, [allSatellites, groundStations, defaultCenter, defaultZoom]);\n\n const resolvedMinHeight = minHeight || (typeof height === 'number' ? `${height}px` : '400px');\n\n const isEmpty = allSatellites.length === 0 && groundStations.length === 0 && (!pins || pins.length === 0);\n\n return (\n <div\n className={`zendir-ground-track-map zendir-ground-track-map-leaflet${pinsEditable ? ' zendir-pins-editable' : ''} ${className}`}\n data-map-backend=\"leaflet\"\n style={{\n width,\n height,\n minHeight: resolvedMinHeight,\n backgroundColor: tokens.colors.background.base,\n borderRadius: 8,\n overflow: 'hidden',\n position: 'relative',\n }}\n >\n <div\n ref={containerRef}\n style={{ width: '100%', height: '100%', minHeight: resolvedMinHeight }}\n />\n {isEmpty && (\n <div\n style={{\n position: 'absolute',\n left: '50%',\n top: '50%',\n transform: 'translate(-50%, -50%)',\n color: tokens.colors.text.secondary,\n fontSize: 14,\n pointerEvents: 'none',\n }}\n >\n {emptyMessage}\n </div>\n )}\n {/* Map controls — positioned below the Leaflet zoom controls */}\n {(showRecenterButton || (showMapStyleToggle && !isExplicitTileUrl)) && (\n <div\n className=\"zendir-map-controls\"\n style={{\n position: 'absolute',\n bottom: 28,\n left: 10,\n zIndex: 1000,\n display: 'flex',\n flexDirection: 'row',\n gap: 6,\n alignItems: 'flex-end',\n }}\n >\n {showRecenterButton && (\n <button\n type=\"button\"\n onClick={handleRecenter}\n title=\"Recenter map to fit all assets and ground stations\"\n aria-label=\"Recenter map\"\n style={{\n background: 'rgba(20, 24, 38, 0.92)',\n backdropFilter: 'blur(8px)',\n WebkitBackdropFilter: 'blur(8px)',\n border: '1px solid rgba(120, 100, 180, 0.2)',\n borderRadius: 4,\n color: '#c8c0d8',\n cursor: 'pointer',\n padding: '6px 10px',\n fontSize: 11,\n fontWeight: 500,\n display: 'flex',\n alignItems: 'center',\n gap: 5,\n transition: 'background 0.15s, border-color 0.15s',\n letterSpacing: '0.02em',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.background = 'rgba(30, 34, 52, 0.95)';\n e.currentTarget.style.borderColor = 'rgba(157, 112, 255, 0.4)';\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.background = 'rgba(20, 24, 38, 0.92)';\n e.currentTarget.style.borderColor = 'rgba(120, 100, 180, 0.2)';\n }}\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n <path d=\"M12 2v4M12 18v4M2 12h4M18 12h4\" />\n </svg>\n Recenter\n </button>\n )}\n {showMapStyleToggle && !isExplicitTileUrl && (\n <div\n style={{\n background: 'rgba(20, 24, 38, 0.92)',\n backdropFilter: 'blur(8px)',\n WebkitBackdropFilter: 'blur(8px)',\n border: '1px solid rgba(120, 100, 180, 0.2)',\n borderRadius: 4,\n display: 'flex',\n overflow: 'hidden',\n }}\n >\n {(['dark', 'satellite'] as const).map((style) => (\n <button\n key={style}\n type=\"button\"\n onClick={() => setTileStyle(style)}\n title={style === 'dark' ? 'Dark ops map' : 'Satellite imagery'}\n aria-label={style === 'dark' ? 'Dark map style' : 'Satellite imagery'}\n aria-pressed={tileStyle === style}\n style={{\n background: tileStyle === style ? 'rgba(157, 112, 255, 0.22)' : 'transparent',\n border: 'none',\n borderRight: style === 'dark' ? '1px solid rgba(120, 100, 180, 0.15)' : 'none',\n color: tileStyle === style ? '#d0c4ee' : '#7a748e',\n cursor: 'pointer',\n padding: '5px 8px',\n fontSize: 10,\n fontWeight: tileStyle === style ? 600 : 400,\n display: 'flex',\n alignItems: 'center',\n gap: 4,\n transition: 'all 0.15s ease',\n letterSpacing: '0.02em',\n }}\n >\n {style === 'dark' ? (\n <svg width=\"11\" height=\"11\" viewBox=\"0 0 24 24\" fill=\"currentColor\" stroke=\"none\">\n <path d=\"M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z\" />\n </svg>\n ) : (\n <svg width=\"11\" height=\"11\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M2 12h20M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z\" />\n </svg>\n )}\n {style === 'dark' ? 'Dark' : 'Satellite'}\n </button>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n\nexport default GroundTrackMapLeaflet;\n"],"names":[],"mappings":";;;;;;;;AAgCA,MAAM,mBAA2C;AAAA,EAC/C,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AAAA,EACV,KAAK;AACP;AAEA,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAC/E;AAOA,SAAS,iBAAiB,aAAqB,YAA+B;AAE5E,QAAM,QAAQ,gBAAgB,YAC1B,qCAAqC,WAAW,QAChD,gBAAgB,YAChB,qDAAqD,WAAW,2BAChE,gBAAgB,YAChB,oDAAoD,WAAW,QAC/D,gBAAgB,YAChB,qDAAqD,WAAW,QAChE,gBAAgB,YAChB,yCAAyC,WAAW,QACpD,qCAAqC,WAAW;AAEpD,QAAM,MAAM;AAAA;AAAA,2CAE6B,WAAW;AAAA;AAAA,4DAEM,UAAU;AAAA;AAAA,6DAET,UAAU;AAAA,sDACjB,UAAU;AAAA;AAAA,oDAEZ,UAAU;AAAA;AAAA,8DAEA,WAAW;AAAA;AAAA,oDAErB,UAAU;AAAA;AAAA,8DAEA,UAAU;AAAA,wDAChB,UAAU;AAAA;AAAA;AAAA,MAG5D,KAAK;AAAA;AAGT,SAAO,EAAE,QAAQ;AAAA,IACf,MAAM;AAAA,IACN,WAAW;AAAA,IACX,UAAU,CAAC,IAAI,EAAE;AAAA,IACjB,YAAY,CAAC,IAAI,EAAE;AAAA,IACnB,eAAe,CAAC,GAAG,GAAG;AAAA,EAAA,CACvB;AACH;AAGA,SAAS,qBAAqB,aAAqB,MAAc,QAA2B;AAE1F,QAAM,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;AAAA,wBACL,YAAY,cAAc,QAAQ,8BAA8B;AAAA,wBAChE,QAAQ;AAAA,wBACR,aAAa,UAAU,SAAS,wCAAwC;AAAA,wBACxE,OAAO,cAAc,QAAQ,YAAY;AAAA,wBACzC,QAAQ;AAAA,wBACR,SAAS;AAAA,wBACT,UAAU;AAAA,wBACV,YAAY,cAAc,QAAQ,MAAM;AAAA,wBACxC,SAAS;AAAA,wBACT,YAAY;AAAA,wBACZ,KAAK;AAAA,wBACL,YAAY;AAAA,wBACZ,eAAe;AAAA,sBAAA;AAAA,sBAGhB,UAAA;AAAA,wBAAA,UAAU,SACT,oBAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,gBAAe,QAAO,QACzE,8BAAC,QAAA,EAAK,GAAE,8CAAA,CAA8C,EAAA,CACxD,IAEA,qBAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,KAC5F,UAAA;AAAA,0BAAA,oBAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,MAAK;AAAA,0BAC/B,oBAAC,QAAA,EAAK,GAAE,+FAAA,CAA+F;AAAA,wBAAA,GACzG;AAAA,wBAED,UAAU,SAAS,SAAS;AAAA,sBAAA;AAAA,oBAAA;AAAA,oBAhCxB;AAAA,kBAAA,CAkCR;AAAA,gBAAA;AAAA,cAAA;AAAA,YACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAEJ;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tile layer
|
|
3
|
-
*
|
|
4
|
-
* Primary: CARTO dark basemap (good looking, free, no key needed).
|
|
5
|
-
* - URL uses the current basemaps.cartocdn.com path (no /rastertiles/ prefix).
|
|
6
|
-
* - {r} is empty on standard displays, '@2x' on HiDPI — handled by {r} token.
|
|
7
|
-
* - subdomains: 'abcd' (four CARTO CDN shards).
|
|
8
|
-
*
|
|
9
|
-
* Fallback: OSM — always reliable, used when CARTO tiles fail.
|
|
2
|
+
* Tile layer URL presets for common map styles.
|
|
3
|
+
* Import and use as `tileUrl` to switch between map themes.
|
|
10
4
|
*/
|
|
5
|
+
export declare const TILE_PRESETS: {
|
|
6
|
+
/** CartoDB dark — default space ops aesthetic. */
|
|
7
|
+
readonly dark: "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png";
|
|
8
|
+
/** Esri World Imagery — natural satellite photos, makes the terminator dramatically visible. */
|
|
9
|
+
readonly satellite: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}";
|
|
10
|
+
/** CartoDB Voyager — light/neutral with labels. */
|
|
11
|
+
readonly light: "https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png";
|
|
12
|
+
};
|
|
11
13
|
/** Primary basemap: CARTO dark with labels. */
|
|
12
14
|
export declare const DEFAULT_TILE = "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png";
|
|
13
15
|
export declare const CARTO_ATTRIBUTION = "© <a href=\"https://carto.com/attribution\" target=\"_blank\" rel=\"noopener noreferrer\">CARTO</a>";
|