/* global window, React */
// ============================================================
// Route Map — simplified US outline with pickup/swap/delivery
// pins, route line, and metadata panel. Used in:
// - Routing feasibility tab (single trip line)
// - Edit drawer · Orders & drops tab (preview move impact)
// ============================================================
// Highly simplified US continental outline as an SVG path (Lng/Lat-like).
// Coordinates are baked in a -130..-65 lng × 24..50 lat box.
const US_OUTLINE_PATH = "M -124.7 48.4 L -124.4 42.0 L -124.2 40.4 L -124.0 38.0 L -122.5 37.5 L -120.6 34.5 L -117.3 32.5 L -114.7 32.7 L -111.0 31.3 L -108.2 31.8 L -106.5 31.8 L -103.3 28.9 L -99.0 26.2 L -97.4 25.9 L -97.1 27.5 L -94.0 29.7 L -89.2 30.0 L -88.0 30.4 L -85.0 29.7 L -83.5 28.0 L -81.1 25.2 L -80.1 25.8 L -80.5 27.9 L -81.5 30.7 L -81.3 31.9 L -80.8 32.7 L -78.9 33.7 L -77.0 35.0 L -75.5 35.5 L -75.5 37.5 L -76.0 38.5 L -76.5 39.0 L -75.0 39.5 L -74.0 40.5 L -74.0 41.5 L -71.0 41.6 L -71.0 42.0 L -70.6 41.7 L -70.0 41.9 L -70.6 42.6 L -70.7 43.6 L -69.0 44.2 L -67.0 44.5 L -67.0 45.2 L -68.0 47.0 L -69.0 47.5 L -71.0 45.0 L -75.0 45.0 L -76.0 44.0 L -78.0 43.6 L -79.5 43.3 L -83.0 41.7 L -83.5 41.7 L -83.0 42.3 L -82.5 43.0 L -82.4 44.0 L -82.1 45.0 L -83.5 45.8 L -83.6 46.0 L -84.4 45.9 L -84.7 46.0 L -85.0 46.0 L -86.8 41.7 L -87.5 41.7 L -88.0 47.2 L -90.2 46.7 L -90.4 47.7 L -94.7 49.4 L -95.2 49.0 L -96.0 49.0 L -123.3 49.0 L -124.7 48.4 Z";
function lngLatToSvg(lng, lat, w, h) {
// bounding box: lng -125 to -66 (59 deg), lat 24 to 50 (26 deg)
const padX = 30, padY = 18;
const x = padX + ((lng + 125) / 59) * (w - padX * 2);
// svg y grows down; lat 50 → top
const y = padY + ((50 - lat) / 26) * (h - padY * 2);
return { x, y };
}
function RouteMap({ trip, width = 720, height = 360, showLegend = true, extraTrips = null, highlightDropId = null }) {
const W = width, H = height;
const from = (window.CITY_COORDS || {})[trip.route.from];
const to = (window.CITY_COORDS || {})[trip.route.to];
const wpKey = `${trip.route.from}|${trip.route.to}`;
const waypoints = (window.ROUTE_WAYPOINTS || {})[wpKey] || [];
if (!from || !to) {
return
No route coordinates for {trip.route.from} → {trip.route.to}