@forgeroute/ui 0.4.92 → 0.4.94

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.
@@ -1 +1 @@
1
- {"version":3,"file":"forgeroute-ui-map.mjs","names":[],"sources":["../../../projects/forgeroute-ui/map/src/geo/geo.ts","../../../projects/forgeroute-ui/map/src/geo/area.ts","../../../projects/forgeroute-ui/map/src/cluster/grid-cluster.ts","../../../projects/forgeroute-ui/map/src/draw/draw-session.ts","../../../projects/forgeroute-ui/map/src/marker-pin.ts","../../../projects/forgeroute-ui/map/src/tile-source.ts","../../../projects/forgeroute-ui/map/src/engine-loader.ts","../../../projects/forgeroute-ui/map/src/map.component.ts","../../../projects/forgeroute-ui/map/src/map-area-form.component.ts"],"sourcesContent":["/**\n * Pure geography helpers of the map entry point. No Angular, no Leaflet, no DOM: the same maths is mirrored in SQL on the backend\n * (so the list a user gets for a drawn area equals the markers the map shows for it), which is why every definition is spelled out.\n *\n * Conventions (the SQL mirror must use the same ones):\n * - Coordinates are WGS84 degrees: `lat` in [-90, 90], `lng` in [-180, 180].\n * - Distances use a sphere of radius `EARTH_RADIUS_METERS` (the IUGG mean radius, 6,371,008.8 m) and the haversine formula.\n * - `pointInPolygon` treats `lng` as x and `lat` as y on a flat plane (even-odd ray casting) and counts the boundary as inside. That is right\n * for the search areas people draw (a city, a district); it does not wrap over the antimeridian and does not enclose a pole.\n * - Bounding boxes are `{ north, south, east, west }` with `west <= east` (no antimeridian wrap).\n */\n\nexport interface LatLng { lat: number; lng: number }\n\n/** `south <= north` and `west <= east`, degrees. */\nexport interface GeoBounds { north: number; south: number; east: number; west: number }\n\n/** The IUGG mean Earth radius in metres: the radius every distance of this file (and of its SQL mirror) uses. */\nexport const EARTH_RADIUS_METERS = 6371008.8;\n\nconst toRad = (deg: number): number => (deg * Math.PI) / 180;\nconst toDeg = (rad: number): number => (rad * 180) / Math.PI;\n\n/** true for a finite latitude in [-90, 90]. */\nexport function isValidLat(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value >= -90 && value <= 90;\n}\n\n/** true for a finite longitude in [-180, 180]. */\nexport function isValidLng(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value >= -180 && value <= 180;\n}\n\n/** true when both coordinates are valid. */\nexport function isValidLatLng(value: unknown): value is LatLng {\n const v = value as Partial<LatLng> | null | undefined;\n return !!v && isValidLat(v.lat) && isValidLng(v.lng);\n}\n\n/** The latitude limited to [-90, 90] (NaN stays NaN). */\nexport function clampLat(value: number): number { return Math.min(90, Math.max(-90, value)); }\n\n/** The longitude limited to [-180, 180]. The map does not repeat the world, so a point beyond the edge is the edge. */\nexport function clampLng(value: number): number { return Math.min(180, Math.max(-180, value)); }\n\n/** Great-circle distance between two points in metres (haversine, sphere of `EARTH_RADIUS_METERS`). */\nexport function haversineMeters(a: LatLng, b: LatLng): number {\n const dLat = toRad(b.lat - a.lat);\n const dLng = toRad(b.lng - a.lng);\n const sinLat = Math.sin(dLat / 2);\n const sinLng = Math.sin(dLng / 2);\n const h = sinLat * sinLat + Math.cos(toRad(a.lat)) * Math.cos(toRad(b.lat)) * sinLng * sinLng;\n // clamp: rounding can push h a hair above 1 for antipodal points\n return 2 * EARTH_RADIUS_METERS * Math.asin(Math.min(1, Math.sqrt(h)));\n}\n\n/**\n * true when `point` lies inside `polygon` or on its boundary. `polygon` is the ring of corners in order, open or closed (a repeated\n * first point at the end is ignored). Fewer than 3 distinct corners = false.\n */\nexport function pointInPolygon(point: LatLng, polygon: readonly LatLng[]): boolean {\n const ring = openRing(polygon);\n if (ring.length < 3) return false;\n const x = point.lng;\n const y = point.lat;\n let inside = false;\n for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n const xi = ring[i].lng, yi = ring[i].lat;\n const xj = ring[j].lng, yj = ring[j].lat;\n if (onSegment(x, y, xi, yi, xj, yj)) return true;\n if ((yi > y) !== (yj > y) && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) inside = !inside;\n }\n return inside;\n}\n\n/** The ring without a duplicated closing point. */\nfunction openRing(polygon: readonly LatLng[]): readonly LatLng[] {\n if (polygon.length > 1) {\n const first = polygon[0];\n const last = polygon[polygon.length - 1];\n if (first.lat === last.lat && first.lng === last.lng) return polygon.slice(0, -1);\n }\n return polygon;\n}\n\nfunction onSegment(px: number, py: number, ax: number, ay: number, bx: number, by: number): boolean {\n const cross = (px - ax) * (by - ay) - (py - ay) * (bx - ax);\n if (Math.abs(cross) > 1e-12) return false;\n return px >= Math.min(ax, bx) && px <= Math.max(ax, bx) && py >= Math.min(ay, by) && py <= Math.max(ay, by);\n}\n\n/** The smallest box holding every point, or null for none. Points with a non-finite coordinate are ignored. */\nexport function boundsOf(points: readonly LatLng[]): GeoBounds | null {\n let north = -Infinity, south = Infinity, east = -Infinity, west = Infinity;\n for (const p of points) {\n if (!Number.isFinite(p.lat) || !Number.isFinite(p.lng)) continue;\n if (p.lat > north) north = p.lat;\n if (p.lat < south) south = p.lat;\n if (p.lng > east) east = p.lng;\n if (p.lng < west) west = p.lng;\n }\n return north === -Infinity ? null : { north, south, east, west };\n}\n\n/**\n * The box around a circle: exact on a sphere for the latitude span (`radius / R`) and for the longitude span\n * (`asin(sin(radius / R) / cos(lat))`). Where the box would pass a pole or the antimeridian it is widened to the whole longitude range\n * (a safe, never-too-small box for a SQL prefilter: it may include a few points the exact circle test then drops).\n */\nexport function circleToBounds(center: LatLng, radiusMeters: number): GeoBounds {\n const radius = Math.max(0, radiusMeters);\n const angular = radius / EARTH_RADIUS_METERS;\n const dLat = toDeg(angular);\n const north = center.lat + dLat;\n const south = center.lat - dLat;\n if (north >= 90 || south <= -90 || angular >= Math.PI / 2) {\n return { north: Math.min(90, north), south: Math.max(-90, south), east: 180, west: -180 };\n }\n const dLng = toDeg(Math.asin(Math.sin(angular) / Math.cos(toRad(center.lat))));\n const east = center.lng + dLng;\n const west = center.lng - dLng;\n if (east > 180 || west < -180) return { north, south, east: 180, west: -180 };\n return { north, south, east, west };\n}\n\n/** The four corners of a box as a closed-less polygon ring: north-west, north-east, south-east, south-west. */\nexport function boundsToPolygon(b: GeoBounds): LatLng[] {\n return [\n { lat: b.north, lng: b.west },\n { lat: b.north, lng: b.east },\n { lat: b.south, lng: b.east },\n { lat: b.south, lng: b.west },\n ];\n}\n\n/** true when the point is inside the box or on its edge. */\nexport function boundsContains(b: GeoBounds, p: LatLng): boolean {\n return p.lat <= b.north && p.lat >= b.south && p.lng <= b.east && p.lng >= b.west;\n}\n\n/** true when two boxes share any area or edge. */\nexport function boundsIntersect(a: GeoBounds, b: GeoBounds): boolean {\n return a.south <= b.north && a.north >= b.south && a.west <= b.east && a.east >= b.west;\n}\n\nconst cross = (o: LatLng, a: LatLng, b: LatLng): number => (a.lng - o.lng) * (b.lat - o.lat) - (a.lat - o.lat) * (b.lng - o.lng);\n\n/** true when the two closed segments share at least one point (touching ends and overlapping collinear parts count). */\nexport function segmentsIntersect(a: LatLng, b: LatLng, c: LatLng, d: LatLng): boolean {\n const d1 = cross(a, b, c), d2 = cross(a, b, d), d3 = cross(c, d, a), d4 = cross(c, d, b);\n if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0))) return true;\n const within = (p: LatLng, q: LatLng, r: LatLng) =>\n r.lng >= Math.min(p.lng, q.lng) && r.lng <= Math.max(p.lng, q.lng) && r.lat >= Math.min(p.lat, q.lat) && r.lat <= Math.max(p.lat, q.lat);\n return (d1 === 0 && within(a, b, c)) || (d2 === 0 && within(a, b, d)) || (d3 === 0 && within(c, d, a)) || (d4 === 0 && within(c, d, b));\n}\n\n/**\n * true when the ring is a simple polygon: at least 3 corners, no two corners on the same spot, no edge crossing or touching another edge except neighbours\n * at their shared corner (a \"bowtie\", a figure eight or a spike that doubles back on itself is not simple). A repeated closing point is ignored.\n * Both the drawing tool and `isValidArea` refuse a polygon that is not simple, because even-odd containment is ambiguous for it.\n */\nexport function isSimplePolygon(polygon: readonly LatLng[]): boolean {\n const ring = openRing(polygon);\n const n = ring.length;\n if (n < 3) return false;\n for (let i = 0; i < n; i++) for (let j = i + 1; j < n; j++) if (ring[i].lat === ring[j].lat && ring[i].lng === ring[j].lng) return false;\n for (let i = 0; i < n; i++) {\n const a = ring[i], b = ring[(i + 1) % n];\n for (let j = i + 1; j < n; j++) {\n const c = ring[j], d = ring[(j + 1) % n];\n const adjacent = j === i + 1 || (i === 0 && j === n - 1);\n if (adjacent) {\n // neighbours meet at one corner; they may not run back along each other (collinear and pointing the same way from the shared corner)\n const shared = j === i + 1 ? b : a;\n const p = j === i + 1 ? a : b;\n const q = j === i + 1 ? d : c;\n if (cross(shared, p, q) === 0 && (p.lng - shared.lng) * (q.lng - shared.lng) + (p.lat - shared.lat) * (q.lat - shared.lat) > 0) return false;\n } else if (segmentsIntersect(a, b, c, d)) return false;\n }\n }\n return true;\n}\n\n/** true when adding `next` to the open chain `points` (the last point joins it) would make the new edge cross or touch an earlier edge (not the one it continues from). */\nexport function edgeCrossesChain(points: readonly LatLng[], next: LatLng): boolean {\n const n = points.length;\n if (points.some(p => p.lat === next.lat && p.lng === next.lng)) return true;\n if (n < 2) return false;\n const last = points[n - 1];\n for (let i = 0; i < n - 2; i++) if (segmentsIntersect(points[i], points[i + 1], last, next)) return true;\n // doubling straight back along the previous edge\n const prev = points[n - 2];\n return cross(last, prev, next) === 0 && (prev.lng - last.lng) * (next.lng - last.lng) + (prev.lat - last.lat) * (next.lat - last.lat) > 0;\n}\n","import { GeoBounds, LatLng, boundsContains, boundsOf, boundsToPolygon, circleToBounds, haversineMeters, isSimplePolygon, isValidLat, isValidLng, pointInPolygon } from './geo';\nimport { UiMapArea } from '../map.types';\n\n/** The smallest box around the area (a safe prefilter for the exact `areaContains` test; widened near the poles / antimeridian for circles). */\nexport function areaBounds(area: UiMapArea): GeoBounds | null {\n switch (area.type) {\n case 'circle': return circleToBounds(area, area.radiusMeters);\n case 'bbox': return { north: area.north, south: area.south, east: area.east, west: area.west };\n case 'polygon': return boundsOf(area.points);\n }\n}\n\n/** true when the point is inside the area (the boundary counts as inside). Same rules as the backend's SQL. */\nexport function areaContains(area: UiMapArea, point: LatLng): boolean {\n switch (area.type) {\n case 'circle': return haversineMeters(area, point) <= area.radiusMeters;\n case 'bbox': return boundsContains(area, point);\n case 'polygon': return pointInPolygon(point, area.points);\n }\n}\n\n/** The area as a polygon ring (a circle has none: null). */\nexport function areaRing(area: UiMapArea): LatLng[] | null {\n switch (area.type) {\n case 'circle': return null;\n case 'bbox': return boundsToPolygon(area);\n case 'polygon': return area.points;\n }\n}\n\n/** true when the area is well formed: valid coordinates, a radius above 0, `south < north`, `west < east`, a polygon of at least 3 points that does not cross itself. */\nexport function isValidArea(area: UiMapArea | null | undefined): area is UiMapArea {\n if (!area) return false;\n switch (area.type) {\n case 'circle':\n return isValidLat(area.lat) && isValidLng(area.lng) && Number.isFinite(area.radiusMeters) && area.radiusMeters > 0;\n case 'bbox':\n return isValidLat(area.north) && isValidLat(area.south) && isValidLng(area.east) && isValidLng(area.west) && area.south < area.north && area.west < area.east;\n case 'polygon':\n return Array.isArray(area.points) && area.points.length >= 3 && area.points.every(p => isValidLat(p.lat) && isValidLng(p.lng)) && isSimplePolygon(area.points);\n default:\n return false;\n }\n}\n\n/** Two areas are the same shape with the same numbers. */\nexport function sameArea(a: UiMapArea | null | undefined, b: UiMapArea | null | undefined): boolean {\n if (!a || !b) return !a && !b;\n if (a.type !== b.type) return false;\n switch (a.type) {\n case 'circle': { const o = b as typeof a; return a.lat === o.lat && a.lng === o.lng && a.radiusMeters === o.radiusMeters; }\n case 'bbox': { const o = b as typeof a; return a.north === o.north && a.south === o.south && a.east === o.east && a.west === o.west; }\n case 'polygon': {\n const o = b as typeof a;\n return a.points.length === o.points.length && a.points.every((p, i) => p.lat === o.points[i].lat && p.lng === o.points[i].lng);\n }\n }\n}\n","import { GeoBounds, LatLng, boundsOf } from '../geo/geo';\n\n/** Edge of the Web Mercator tile the pixel maths is based on. */\nconst TILE_SIZE = 256;\n/** Latitude limit of the Web Mercator projection. */\nconst MAX_MERCATOR_LAT = 85.0511287798;\n\nexport interface GridClusterOptions {\n /** Size of a grid cell in screen pixels: markers closer than this at the given zoom are grouped. Default 60. */\n radiusPx?: number;\n /** At this zoom and above nothing is grouped. Default 16. */\n maxZoom?: number;\n}\n\n/** A marker drawn on its own. */\nexport interface SingleMapItem<T> { kind: 'marker'; item: T }\n\n/** Two or more markers drawn as one counted circle. */\nexport interface ClusterMapItem<T> {\n kind: 'cluster';\n /** Stable for the same grid cell at the same zoom: `cluster:<zoom>:<cellX>:<cellY>`. */\n id: string;\n /** Mean position of the members. */\n lat: number;\n lng: number;\n count: number;\n members: T[];\n /** The smallest box around the members (zoom to it to open the cluster). */\n bounds: GeoBounds;\n}\n\nexport type MapItem<T> = SingleMapItem<T> | ClusterMapItem<T>;\n\n/** Web Mercator pixel position of a point at a zoom level (256 px tiles). Latitude is clamped to the projection's limit. */\nexport function projectToPixels(point: LatLng, zoom: number): { x: number; y: number } {\n const scale = TILE_SIZE * Math.pow(2, zoom);\n const lat = Math.max(-MAX_MERCATOR_LAT, Math.min(MAX_MERCATOR_LAT, point.lat));\n const sin = Math.sin((lat * Math.PI) / 180);\n return {\n x: ((point.lng + 180) / 360) * scale,\n y: (0.5 - Math.log((1 + sin) / (1 - sin)) / (4 * Math.PI)) * scale,\n };\n}\n\n/**\n * Groups markers that would overlap at `zoom` with a simple grid: each marker goes into the cell of its pixel position, a cell with one marker stays a\n * marker, a cell with several becomes one cluster at their mean position. Deterministic (output follows the order of the first member of each cell),\n * no dependency, O(n). Markers with a non-finite coordinate are left out.\n */\nexport function clusterMarkers<T extends LatLng>(items: readonly T[], zoom: number, options: GridClusterOptions = {}): MapItem<T>[] {\n const radius = options.radiusPx && options.radiusPx > 0 ? options.radiusPx : 60;\n const maxZoom = options.maxZoom ?? 16;\n const valid = items.filter(i => Number.isFinite(i.lat) && Number.isFinite(i.lng));\n if (zoom >= maxZoom) return valid.map(item => ({ kind: 'marker', item }));\n const cells = new Map<string, { cx: number; cy: number; members: T[] }>();\n for (const item of valid) {\n const { x, y } = projectToPixels(item, zoom);\n const cx = Math.floor(x / radius);\n const cy = Math.floor(y / radius);\n const key = `${cx}:${cy}`;\n const cell = cells.get(key);\n if (cell) cell.members.push(item);\n else cells.set(key, { cx, cy, members: [item] });\n }\n const out: MapItem<T>[] = [];\n for (const cell of cells.values()) {\n if (cell.members.length === 1) { out.push({ kind: 'marker', item: cell.members[0] }); continue; }\n const count = cell.members.length;\n out.push({\n kind: 'cluster',\n id: `cluster:${zoom}:${cell.cx}:${cell.cy}`,\n lat: cell.members.reduce((s, m) => s + m.lat, 0) / count,\n lng: cell.members.reduce((s, m) => s + m.lng, 0) / count,\n count,\n members: cell.members,\n bounds: boundsOf(cell.members) as GeoBounds,\n });\n }\n return out;\n}\n","import { LatLng, edgeCrossesChain, haversineMeters, isSimplePolygon, isValidLat, isValidLng } from '../geo/geo';\nimport { UiMapArea, UiMapDrawShape } from '../map.types';\n\n/** Smallest radius (metres) a drawn circle may have: a second click on the same spot is not a circle. */\nexport const MIN_DRAWN_RADIUS_METERS = 1;\n\n/** Outcome of adding a point to the session. */\nexport type DrawAddResult =\n | { status: 'added'; count: number }\n /** The shape is complete (circle: second point, rectangle: second point): `area` is the result. */\n | { status: 'finished'; area: UiMapArea }\n /**\n * The point was refused. `reason` is `invalid` (not a coordinate, the same spot as the circle's centre / the rectangle's first corner, or a point after the\n * shape is complete) or `self-intersecting` (a polygon corner whose edge would cross or touch an earlier edge).\n */\n | { status: 'rejected'; reason: 'invalid' | 'self-intersecting' };\n\n/**\n * The state of one drawing: the shape, the points clicked so far and the rules for finishing. Pure (no map, no DOM), so the click / Enter / Escape\n * behaviour of the map is exactly this class:\n * - circle: first point = centre, second point = a point on the edge; the radius is the distance between them; finishes by itself.\n * - rectangle: two opposite corners; finishes by itself. The result is the box between them.\n * - polygon: any number of corners (at least 3) that never cross: a corner whose edge would cross an earlier edge is refused (`self-intersecting`), and `finish()` (Enter /\n * the Finish button) closes it unless the closing edge would cross.\n */\nexport class DrawSession {\n private readonly _points: LatLng[] = [];\n\n constructor(readonly shape: UiMapDrawShape) {}\n\n get points(): readonly LatLng[] { return this._points; }\n\n /** How many points the shape still needs before it can finish (0 = it can finish). */\n get missing(): number {\n const need = this.shape === 'polygon' ? 3 : 2;\n return Math.max(0, need - this._points.length);\n }\n\n addPoint(point: LatLng): DrawAddResult {\n if (!isValidLat(point.lat) || !isValidLng(point.lng)) return { status: 'rejected', reason: 'invalid' };\n const p: LatLng = { lat: point.lat, lng: point.lng };\n if (this.shape !== 'polygon') {\n if (this._points.length >= 2) return { status: 'rejected', reason: 'invalid' };\n const first = this._points[0];\n if (first && (haversineMeters(first, p) < MIN_DRAWN_RADIUS_METERS || (this.shape === 'rectangle' && (first.lat === p.lat || first.lng === p.lng)))) return { status: 'rejected', reason: 'invalid' };\n this._points.push(p);\n if (this._points.length === 2) return { status: 'finished', area: this.finish() as UiMapArea };\n return { status: 'added', count: this._points.length };\n }\n if (edgeCrossesChain(this._points, p)) return { status: 'rejected', reason: 'self-intersecting' };\n this._points.push(p);\n return { status: 'added', count: this._points.length };\n }\n\n /** Removes the last point. Returns false when there was none. */\n undo(): boolean {\n return this._points.pop() !== undefined;\n }\n\n /**\n * Why `finish()` returns nothing: `too-few` while points are missing, `self-intersecting` when the closing edge of a polygon (last corner back to the first)\n * would cross another edge, null when it can finish.\n */\n get problem(): 'too-few' | 'self-intersecting' | null {\n if (this.missing > 0) return 'too-few';\n return this.shape === 'polygon' && !isSimplePolygon(this._points) ? 'self-intersecting' : null;\n }\n\n /** The finished area, or null while `problem` says why it cannot be finished. */\n finish(): UiMapArea | null {\n if (this.problem !== null) return null;\n const pts = this._points;\n switch (this.shape) {\n case 'circle':\n return { type: 'circle', lat: pts[0].lat, lng: pts[0].lng, radiusMeters: Math.max(MIN_DRAWN_RADIUS_METERS, haversineMeters(pts[0], pts[1])) };\n case 'rectangle':\n return {\n type: 'bbox',\n north: Math.max(pts[0].lat, pts[1].lat), south: Math.min(pts[0].lat, pts[1].lat),\n east: Math.max(pts[0].lng, pts[1].lng), west: Math.min(pts[0].lng, pts[1].lng),\n };\n case 'polygon':\n return { type: 'polygon', points: pts.map(p => ({ ...p })) };\n }\n }\n}\n","import { UiMapMarker } from './map.types';\n\n/** The shapes a category can get. Together with the colour they make every category readable without colour. */\nexport const PIN_SHAPES = ['circle', 'square', 'diamond', 'hexagon'] as const;\nexport type PinShape = typeof PIN_SHAPES[number];\n\n/**\n * Pin colours: dark enough for white text on them (every one is at least 4.5:1 against white) and for 3:1 against the light map tiles with the\n * white outline the pin has.\n */\nexport const PIN_COLORS = ['#1d4ed8', '#047857', '#b45309', '#be123c', '#6d28d9', '#0e7490', '#a21caf', '#475569'] as const;\n\nexport interface PinStyle { shape: PinShape; color: string }\n\n/** The sorted list of distinct categories of the markers (the key of the shape / colour assignment). */\nexport function categoriesOf(markers: readonly UiMapMarker[]): string[] {\n return Array.from(new Set(markers.map(m => m.category).filter((c): c is string => !!c))).sort((a, b) => a.localeCompare(b, 'en-US'));\n}\n\n/**\n * The look of one marker: its category's position in the sorted category list picks the colour (index mod 8) and the shape (index mod 4), so up to 8\n * categories get a unique shape + colour pair, and a marker without a category is the first colour as a circle. A `color` on the marker wins over the\n * colour (the shape stays the category's).\n */\nexport function pinStyle(marker: Pick<UiMapMarker, 'category' | 'color'>, categories: readonly string[]): PinStyle {\n const index = marker.category ? Math.max(0, categories.indexOf(marker.category)) : 0;\n return { shape: PIN_SHAPES[index % PIN_SHAPES.length], color: marker.color?.trim() || PIN_COLORS[index % PIN_COLORS.length] };\n}\n\n/** The one or two characters drawn inside a pin: the marker's `icon`, else the first letter of its label (upper case). */\nexport function pinGlyph(marker: Pick<UiMapMarker, 'icon' | 'label'>): string {\n const icon = Array.from((marker.icon ?? '').trim()).slice(0, 2).join('');\n if (icon) return icon;\n return (Array.from((marker.label ?? '').trim())[0] ?? '').toUpperCase();\n}\n\n/** Pixel size of a pin (the Leaflet icon box); the hit area is enlarged to 44px on touch screens by CSS. */\nexport const PIN_SIZE = 32;\nexport const CLUSTER_SIZE = 44;\n\n/** Builds the DOM of a pin. Text goes in with `textContent` and the colour through the CSS property API, so nothing a host sends can inject markup. */\nexport function buildPin(doc: Document, style: PinStyle, glyph: string, selected: boolean): HTMLElement {\n const pin = doc.createElement('div');\n pin.className = `ui-map__pin ui-map__pin--${style.shape}${selected ? ' ui-map__pin--selected' : ''}`;\n pin.style.setProperty('--pin-color', style.color);\n const shape = doc.createElement('span');\n shape.className = 'ui-map__pin-shape';\n const text = doc.createElement('span');\n text.className = 'ui-map__pin-glyph';\n text.textContent = glyph;\n pin.append(shape, text);\n return pin;\n}\n\n/** Builds the DOM of a cluster circle showing how many places it holds. */\nexport function buildCluster(doc: Document, countText: string): HTMLElement {\n const el = doc.createElement('div');\n el.className = 'ui-map__cluster';\n const text = doc.createElement('span');\n text.className = 'ui-map__cluster-count';\n text.textContent = countText;\n el.append(text);\n return el;\n}\n","/** Why the map can or cannot draw tiles with the configuration it was given. */\nexport type TileSourceState = 'ok' | 'none' | 'invalid' | 'no-attribution';\n\n/**\n * Checks the tile source of a `ui-map`: a template (`https://tiles.example.com/{z}/{x}/{y}.png`), the attribution text the provider requires, nothing else.\n * - no template = `none` (the map is not drawn; the places are still listed);\n * - a template that is not an `http(s):` address, a protocol-relative `//host/...` address, a root-relative `/path/...` address or a `data:image/` address\n * (`javascript:` and everything else are refused) = `invalid`;\n * - a valid template with an empty attribution = `no-attribution`: map data providers require their credit to be shown, so the map is not drawn without it.\n */\nexport function tileSourceState(template: string | null | undefined, attribution: string | null | undefined): TileSourceState {\n const t = (template ?? '').trim();\n if (!t) return 'none';\n if (/[\\u0000-\\u001f\\u007f\\\\]/.test(t)) return 'invalid';\n if (!/^(https?:\\/\\/|\\/\\/|\\/(?![\\/\\\\])|data:image\\/)/i.test(t)) return 'invalid';\n if (!(attribution ?? '').trim()) return 'no-attribution';\n return 'ok';\n}\n\n/** The subdomain letters of the `{s}` placeholder: a string of letters (\"abc\"), an array of names or nothing. Empty / invalid = Leaflet's default `abc`. */\nexport function normalizeSubdomains(value: string | readonly string[] | null | undefined): string | string[] {\n if (Array.isArray(value)) {\n const list = value.map(v => String(v).trim()).filter(Boolean);\n return list.length ? list : 'abc';\n }\n const text = typeof value === 'string' ? value.trim() : '';\n return text || 'abc';\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * How `ui-map` gets Leaflet: a function returning a promise of the Leaflet module (or of `{ default: <module> }`). The default is `() => import('leaflet')`,\n * evaluated in the browser only and only when the map can be drawn. Override it to load Leaflet another way (a CDN build, a test double):\n * `{ provide: UI_MAP_ENGINE_LOADER, useValue: () => import('./my-leaflet') }`. A rejected promise shows \"Map unavailable: the map could not be loaded\"\n * and keeps the list of places (this is also what an app without `leaflet` installed ends up with).\n */\nexport const UI_MAP_ENGINE_LOADER = new InjectionToken<() => Promise<unknown>>('UI_MAP_ENGINE_LOADER', {\n providedIn: 'root',\n factory: () => () => import('leaflet'),\n});\n","import {\n ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, NgZone, PLATFORM_ID, TemplateRef, ViewEncapsulation, computed, contentChild, effect,\n inject, input, model, output, signal, untracked, viewChild,\n} from '@angular/core';\nimport { NgTemplateOutlet, isPlatformBrowser } from '@angular/common';\nimport type * as Leaflet from 'leaflet';\nimport { ButtonComponent, UiLabelsService } from '@forgeroute/ui';\nimport { GeoBounds, LatLng, boundsContains, boundsOf, clampLat, clampLng, haversineMeters, isValidLatLng } from './geo/geo';\nimport { areaBounds, sameArea } from './geo/area';\nimport { MapItem, clusterMarkers } from './cluster/grid-cluster';\nimport { DrawSession } from './draw/draw-session';\nimport { CLUSTER_SIZE, PIN_SIZE, PinStyle, buildCluster, buildPin, categoriesOf, pinGlyph, pinStyle } from './marker-pin';\nimport { normalizeSubdomains, tileSourceState } from './tile-source';\nimport { UI_MAP_ENGINE_LOADER } from './engine-loader';\nimport { UiMapArea, UiMapBounds, UiMapDrawShape, UiMapInfoContext, UiMapMarker, UiMapView } from './map.types';\n\ntype LeafletLib = typeof Leaflet;\n\n/**\n * Marks the template of the info panel that opens for the selected marker: `<ng-template [uiMapInfo]=\"markers()\" let-marker>`.\n * Bind the markers to type the template (`marker.data` then has the host's type); the bare `<ng-template uiMapInfo let-marker>` also works.\n */\n@Directive({ selector: 'ng-template[uiMapInfo]', standalone: true })\nexport class UiMapInfoDirective<T = unknown> {\n /** Only used to infer the marker type in the template; the value is never read. */\n readonly typeFrom = input<readonly UiMapMarker<T>[] | ''>('', { alias: 'uiMapInfo' });\n readonly template = inject<TemplateRef<UiMapInfoContext<T>>>(TemplateRef);\n static ngTemplateContextGuard<T>(_dir: UiMapInfoDirective<T>, _ctx: unknown): _ctx is UiMapInfoContext<T> { return true; }\n}\n\n/** Everything that belongs to a running Leaflet map. */\ninterface Engine {\n L: LeafletLib;\n map: Leaflet.Map;\n markers: Leaflet.LayerGroup;\n area: Leaflet.LayerGroup;\n draft: Leaflet.LayerGroup;\n tiles: Leaflet.TileLayer | null;\n}\n\n/** A neutral start when there is nothing to show: the middle of the contiguous United States. Hosts pass `center` / `zoom` (or markers, which are fitted). */\nconst DEFAULT_CENTER: LatLng = { lat: 39.8283, lng: -98.5795 };\nconst DEFAULT_ZOOM = 4;\nconst IDLE_EMIT_MS = 250;\nlet nextMapId = 0;\n\n/**\n * Tile map with places, grouping, a search area and a list of places, built on Leaflet (loaded only in the browser, only when the map can be drawn).\n * Lives in its own entry point (`@forgeroute/ui/map`) so apps that never show a map never ship the map engine.\n *\n * <ui-map [markers]=\"places()\" [tileUrlTemplate]=\"tiles.url\" [tileAttribution]=\"tiles.credit\" [(selectedId)]=\"selected\"\n * [drawModes]=\"['circle','rectangle','polygon']\" [(area)]=\"searchArea\" (boundsChange)=\"load($event)\" (markerClick)=\"open($event)\">\n * <ng-template [uiMapInfo]=\"places()\" let-marker> ...details of the selected place... </ng-template>\n * </ui-map>\n *\n * Provider-agnostic: there is no built-in tile vendor. Without a tile source (or with one that has no attribution text) the map shows\n * \"Map unavailable: ...\" and the places stay available as a list - never a blank box.\n *\n * Accessibility: the map is a named group with keyboard help (arrows pan, + / - zoom); every place is in a list below it (Tab into it, Up / Down /\n * Home / End to move, Enter to select) that is the keyboard and screen-reader way to every marker; pins differ by shape AND colour AND carry a\n * glyph; the zoom, fit and drawing tools are real buttons (44px on touch screens); drawing works with the pointer (click points), the keyboard\n * (Space adds a point at the crosshair in the middle of the map, Enter finishes, Backspace removes the last point, Escape cancels) and the typed\n * form (`ui-map-area-form`); every step is announced in a polite live region. Reduced motion switches the pan / zoom animations off; forced\n * colors draw real borders.\n */\n@Component({\n selector: 'ui-map',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n // Leaflet builds its DOM itself, so emulated encapsulation could not scope its rules: they are nested under `.ui-map` instead (see map.component.scss).\n encapsulation: ViewEncapsulation.None,\n imports: [NgTemplateOutlet, ButtonComponent],\n styleUrl: './map.component.scss',\n template: `\n <div class=\"ui-map\" [class.ui-map--drawing]=\"!!drawing()\" [class.ui-map--unavailable]=\"unavailable()\" [style.--ui-map-height]=\"height()\">\n <div class=\"ui-map__stage\" (keydown)=\"onStageKey($event)\">\n @if (unavailable()) {\n <div class=\"ui-map__unavailable\" role=\"status\">\n <svg width=\"28\" height=\"28\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M9 4 3 6v14l6-2 6 2 6-2V4l-6 2-6-2z\"/><path d=\"M9 4v14M15 6v14\"/></svg>\n <p class=\"ui-map__unavailable-text\">{{ unavailableText() }}</p>\n </div>\n } @else {\n <div #canvas class=\"ui-map__canvas\" role=\"group\" [attr.aria-label]=\"regionLabel()\" [attr.aria-describedby]=\"helpId\" [attr.aria-busy]=\"loading() ? 'true' : null\"></div>\n @if (drawing()) { <div class=\"ui-map__crosshair\" aria-hidden=\"true\"></div> }\n @if (!ready() && !engineFailed()) { <div class=\"ui-map__loading\" role=\"status\">{{ labels.t('map.loading') }}</div> }\n @if (tilesFailed()) { <div class=\"ui-map__notice\" role=\"status\">{{ labels.t('map.tilesFailed') }}</div> }\n <div class=\"ui-map__controls\">\n <ui-button variant=\"secondary\" size=\"sm\" [ariaLabel]=\"labels.t('map.zoomIn')\" [disabled]=\"!ready() || !canZoomIn()\" (click)=\"onZoomButton('in')\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12 5v14M5 12h14\"/></svg>\n </ui-button>\n <ui-button variant=\"secondary\" size=\"sm\" [ariaLabel]=\"labels.t('map.zoomOut')\" [disabled]=\"!ready() || !canZoomOut()\" (click)=\"onZoomButton('out')\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M5 12h14\"/></svg>\n </ui-button>\n @if (markers().length > 0) {\n <ui-button variant=\"secondary\" size=\"sm\" [ariaLabel]=\"labels.t('map.fitMarkers')\" [disabled]=\"!ready()\" (click)=\"fitMarkers()\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5\"/></svg>\n </ui-button>\n }\n </div>\n @if (drawEnabled()) {\n <div class=\"ui-map__tools\" role=\"group\" [attr.aria-label]=\"labels.t('map.drawToolbar')\">\n @if (drawing(); as shape) {\n <p class=\"ui-map__tools-note\">{{ drawInstruction() }}</p>\n <div class=\"ui-map__tools-row\">\n <ui-button variant=\"secondary\" size=\"sm\" (click)=\"addPointAtCenter()\">{{ labels.t('map.addPointAtCenter') }}</ui-button>\n @if (draftPoints().length > 0) { <ui-button variant=\"secondary\" size=\"sm\" (click)=\"undoDrawPoint()\">{{ labels.t('map.drawUndo') }}</ui-button> }\n @if (shape === 'polygon') { <ui-button variant=\"primary\" size=\"sm\" [disabled]=\"draftPoints().length < 3\" (click)=\"finishDraw()\">{{ labels.t('map.drawFinish') }}</ui-button> }\n <ui-button variant=\"ghost\" size=\"sm\" (click)=\"cancelDraw()\">{{ labels.t('map.drawCancel') }}</ui-button>\n </div>\n } @else {\n <div class=\"ui-map__tools-row\">\n @for (shape of drawModes(); track shape) {\n <ui-button variant=\"secondary\" size=\"sm\" [disabled]=\"!ready()\" (click)=\"startDraw(shape)\">{{ drawLabel(shape) }}</ui-button>\n }\n @if (area()) { <ui-button variant=\"ghost\" size=\"sm\" (click)=\"clearArea()\">{{ labels.t('map.clearArea') }}</ui-button> }\n </div>\n @if (areaText(); as summary) { <p class=\"ui-map__tools-note\">{{ labels.t('map.areaSummary', { area: summary }) }}</p> }\n }\n </div>\n }\n @if (selectedMarker(); as marker) {\n @if (info(); as tpl) {\n <div class=\"ui-map__info\" role=\"group\" [attr.aria-label]=\"labels.t('map.infoLabel', { name: marker.ariaLabel || marker.label })\">\n <div class=\"ui-map__info-body\">\n <ng-container [ngTemplateOutlet]=\"tpl.template\" [ngTemplateOutletContext]=\"{ $implicit: marker, marker: marker }\" />\n </div>\n <ui-button variant=\"icon\" size=\"sm\" [ariaLabel]=\"labels.t('map.closeInfo')\" (click)=\"closeInfo()\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M6 6l12 12M18 6 6 18\"/></svg>\n </ui-button>\n </div>\n }\n }\n <div class=\"ui-map__attribution\">\n @if (attributionUrl(); as url) {\n <a [href]=\"url\" target=\"_blank\" rel=\"noopener noreferrer\">{{ tileAttribution() }}<span class=\"ui-map__sr\"> {{ labels.t('dataTable.opensInNewTab') }}</span></a>\n } @else {\n <span>{{ tileAttribution() }}</span>\n }\n </div>\n }\n </div>\n\n @if (!unavailable()) { <p class=\"ui-map__sr\" [id]=\"helpId\">{{ labels.t('map.keyboardHelp') }}</p> }\n <div class=\"ui-map__sr\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</div>\n\n <section class=\"ui-map__list\" [class.ui-map__list--shown]=\"showList() || unavailable()\" [attr.aria-label]=\"labels.t('map.listLabel')\">\n <div class=\"ui-map__list-head\">\n <span class=\"ui-map__list-title\">{{ labels.t('map.listLabel') }}</span>\n <span class=\"ui-map__list-count\">{{ listSummary() }}</span>\n </div>\n @if (listItems().length === 0) {\n <p class=\"ui-map__list-empty\">{{ labels.t('map.listEmpty') }}</p>\n } @else {\n <ul class=\"ui-map__places\" (keydown)=\"onListKey($event)\">\n @for (m of listItems(); track m.id) {\n @let st = styleOf(m);\n <li>\n <button type=\"button\" class=\"ui-map__place\" [class.ui-map__place--selected]=\"m.id === selectedId()\"\n [attr.aria-current]=\"m.id === selectedId() ? 'true' : null\"\n [attr.data-marker-id]=\"m.id\"\n [attr.tabindex]=\"m.id === listTabId() ? 0 : -1\"\n (focus)=\"listTab.set(m.id)\"\n (click)=\"selectFromList(m)\">\n <span class=\"ui-map__pin ui-map__pin--{{ st.shape }} ui-map__pin--inline\" [style.--pin-color]=\"st.color\" aria-hidden=\"true\">\n <span class=\"ui-map__pin-shape\"></span><span class=\"ui-map__pin-glyph\">{{ glyphOf(m) }}</span>\n </span>\n <span class=\"ui-map__place-text\">\n <span class=\"ui-map__place-label\">{{ m.label }}</span>\n @if (m.category) { <span class=\"ui-map__place-category\">{{ m.category }}</span> }\n </span>\n </button>\n </li>\n }\n </ul>\n }\n </section>\n </div>\n `,\n})\nexport class MapComponent<T = unknown> {\n protected readonly labels = inject(UiLabelsService);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly loadEngine = inject(UI_MAP_ENGINE_LOADER);\n protected readonly helpId = `ui-map-help-${nextMapId++}`;\n\n // ─── Inputs ───────────────────────────────────────────────\n /** The places. Each needs a unique `id`, `lat`, `lng` and a `label`; markers with an invalid coordinate are left out. */\n readonly markers = input<readonly UiMapMarker<T>[]>([]);\n /** Id of the selected place (two-way: `[(selectedId)]`). Choosing a place from the map or the list sets it; `null` closes the info panel. */\n readonly selectedId = model<string | null>(null);\n /** Controlled centre: the map moves there when the value changes. Leave it `null` to let the user (and `fitToMarkers`) decide. */\n readonly center = input<LatLng | null>(null);\n /** Controlled zoom level (see `center`). */\n readonly zoom = input<number | null>(null);\n /** Where the map starts when it has no markers, no `center` and no `zoom`. */\n readonly initialCenter = input<LatLng>(DEFAULT_CENTER);\n readonly initialZoom = input(DEFAULT_ZOOM);\n /**\n * true = fit the places ONCE: the first time there are any (and the user has not moved the map yet). It never refits when the places change afterwards,\n * so a host that loads places for the visible area from `boundsChange` cannot start a fit / reload loop. Use `fitKey` or `fitMarkers()` to fit again.\n */\n readonly fitToMarkers = input(true);\n /**\n * Explicit \"fit now\": every time this value changes (any value; a counter or the id of a search works) the map fits the places. Unlike `fitToMarkers` it fits\n * also after the user has moved the map. Ignored while `center` / `zoom` are controlled.\n */\n readonly fitKey = input<unknown>(undefined);\n /** Padding in pixels kept around the markers by fit-to-markers. */\n readonly fitPadding = input(40);\n /** Highest zoom a fit may use (so a single marker does not zoom to street level of nothing). */\n readonly fitMaxZoom = input(16);\n /** Tile address, e.g. `https://tiles.example.com/{z}/{x}/{y}.png` (`{s}` for subdomains, `{r}` for retina). There is no built-in vendor. */\n readonly tileUrlTemplate = input('');\n /** The credit text the tile provider requires. A tile source without it is refused (the map is not drawn). */\n readonly tileAttribution = input('');\n /** Optional link of the credit (an http(s) address). */\n readonly tileAttributionUrl = input('');\n /** Letters (`'abc'`) or names for the `{s}` placeholder. */\n readonly subdomains = input<string | readonly string[]>('abc');\n readonly minZoom = input(0);\n readonly maxZoom = input(19);\n /** true = group markers that would overlap. */\n readonly clustering = input(true);\n /** Size of the grouping grid in pixels. */\n readonly clusterRadius = input(60);\n /** From this zoom on nothing is grouped. */\n readonly clusterMaxZoom = input(16);\n /** The search-area shapes the map offers a drawing tool for (none = no drawing tools). */\n readonly drawModes = input<readonly UiMapDrawShape[]>([]);\n /** The search area (two-way: `[(area)]`): drawn on the map, or set by the host / `ui-map-area-form`. `null` = none. */\n readonly area = model<UiMapArea | null>(null);\n /** true = the area cannot be drawn or cleared (a read-only user); places can still be selected. */\n readonly readOnly = input(false);\n /** true = move the map to a new `area` that did not come from drawing. */\n readonly fitToArea = input(true);\n /** Accessible name of the map. */\n readonly ariaLabel = input<string | null>(null);\n /** Height of the map (any CSS length). */\n readonly height = input('420px');\n /** true = the list of places is always visible; otherwise it is visually hidden until one of its places has the keyboard focus. */\n readonly showList = input(false);\n /** Most places the list draws (the ones in view first). */\n readonly listLimit = input(200);\n /** Marks the map busy (the host is loading places). */\n readonly loading = input(false);\n /** How long the map waits after it stops moving before it emits `boundsChange` / `viewChange`. */\n readonly idleDelay = input(IDLE_EMIT_MS);\n /** false = the mouse wheel scrolls the page instead of zooming the map (use it when the map sits inside a long page). */\n readonly scrollWheelZoom = input(true);\n\n // ─── Outputs ──────────────────────────────────────────────\n /** The visible part of the map, after the user (or the host) stopped moving it. Also once when the map is first ready. */\n readonly boundsChange = output<UiMapBounds>();\n /** The centre and zoom, at the same moments as `boundsChange`. */\n readonly viewChange = output<UiMapView>();\n /** A place was chosen on the map or in the list. */\n readonly markerClick = output<UiMapMarker<T>>();\n\n protected readonly info = contentChild(UiMapInfoDirective<T>);\n private readonly canvas = viewChild<ElementRef<HTMLElement>>('canvas');\n\n // ─── State exposed to the host ────────────────────────────\n /** The running engine (null until Leaflet is loaded, or when the map is unavailable). Private: Leaflet's types stay out of this entry's public declarations. */\n private readonly engine = signal<Engine | null>(null);\n protected readonly engineFailed = signal(false);\n protected readonly tilesFailed = signal(false);\n protected readonly announcement = signal('');\n /** The zoom level of the map (also available before the engine runs: the initial one). */\n readonly zoomLevel = signal(DEFAULT_ZOOM);\n /** The visible part of the map; null until the map has been laid out. */\n readonly bounds = signal<UiMapBounds | null>(null);\n /** The shape being drawn, or null. */\n readonly drawing = signal<UiMapDrawShape | null>(null);\n /** The points clicked so far while drawing. */\n readonly draftPoints = signal<readonly LatLng[]>([]);\n /** true once the map is created and shown. */\n readonly ready = computed(() => this.engine() !== null);\n\n protected readonly tileState = computed(() => tileSourceState(this.tileUrlTemplate(), this.tileAttribution()));\n protected readonly unavailable = computed(() => this.tileState() !== 'ok' || this.engineFailed());\n protected readonly unavailableText = computed(() => {\n if (this.engineFailed() && this.tileState() === 'ok') return this.labels.t('map.unavailableLoadFailed');\n switch (this.tileState()) {\n case 'invalid': return this.labels.t('map.unavailableInvalidTiles');\n case 'no-attribution': return this.labels.t('map.unavailableNoAttribution');\n default: return this.labels.t('map.unavailableNoTiles');\n }\n });\n protected readonly regionLabel = computed(() => this.ariaLabel() ?? this.labels.t('map.ariaLabel'));\n protected readonly attributionUrl = computed(() => {\n const u = this.tileAttributionUrl().trim();\n return /^https?:\\/\\//i.test(u) && !/[\\s\\\\]/.test(u) ? u : null;\n });\n protected readonly drawEnabled = computed(() => !this.readOnly() && this.drawModes().length > 0);\n protected readonly canZoomIn = computed(() => this.zoomLevel() < this.maxZoom());\n protected readonly canZoomOut = computed(() => this.zoomLevel() > this.minZoom());\n\n private readonly validMarkers = computed(() => this.markers().filter(m => isValidLatLng(m)));\n protected readonly selectedMarker = computed(() => {\n const id = this.selectedId();\n return id === null ? null : this.validMarkers().find(m => m.id === id) ?? null;\n });\n private readonly categories = computed(() => categoriesOf(this.validMarkers()));\n private readonly styles = computed(() => {\n const cats = this.categories();\n return new Map(this.validMarkers().map(m => [m.id, pinStyle(m, cats)] as const));\n });\n\n /** What is drawn on the map: single markers and groups. The selected marker is never grouped, so it stays visible. */\n private readonly renderItems = computed((): MapItem<UiMapMarker<T>>[] => {\n const valid = this.validMarkers();\n const selected = this.selectedId();\n const win = this.engine() ? this.renderWindow() : null;\n const all = win ? valid.filter(m => m.id === selected || boundsContains(win.outer, m)) : valid;\n if (!this.clustering()) return all.map(item => ({ kind: 'marker', item }));\n const chosen = selected === null ? undefined : all.find(m => m.id === selected);\n const rest = chosen ? all.filter(m => m !== chosen) : all;\n const items = clusterMarkers(rest, this.zoomLevel(), { radiusPx: this.clusterRadius(), maxZoom: this.dissolveZoom() });\n return chosen ? [...items, { kind: 'marker', item: chosen }] : items;\n });\n /** The zoom from which places are never grouped: the grouping limit, but never above what the map can zoom to (or groups of equal places could not be opened). */\n private readonly dissolveZoom = computed(() => Math.min(this.clusterMaxZoom(), this.maxZoom()));\n private readonly markerSignature = computed(() => this.validMarkers().map(m => `${m.id}@${m.lat},${m.lng}`).join('|'));\n\n // ─── List of places ───────────────────────────────────────\n private readonly inView = computed(() => {\n const b = this.bounds();\n const all = this.validMarkers();\n return b && !this.unavailable() && this.engine() ? all.filter(m => boundsContains(b, m)) : all;\n });\n protected readonly listItems = computed(() => {\n const limit = Math.max(0, Math.floor(this.listLimit()));\n return this.inView().slice(0, limit);\n });\n protected readonly listSummary = computed(() => {\n const shown = this.listItems().length;\n const total = this.inView().length;\n if (shown < total) return this.labels.t('map.listShowing', { shown, total });\n return this.labels.t(total === 1 ? 'map.listCount_one' : 'map.listCount_other', { count: total });\n });\n protected readonly listTab = signal<string | null>(null);\n protected readonly listTabId = computed(() => {\n const ids = this.listItems().map(m => m.id);\n const wanted = this.listTab();\n if (wanted && ids.includes(wanted)) return wanted;\n const sel = this.selectedId();\n if (sel && ids.includes(sel)) return sel;\n return ids[0] ?? null;\n });\n protected readonly areaText = computed(() => { const a = this.area(); return a ? this.describeArea(a) : ''; });\n protected readonly drawInstruction = computed(() => {\n const shape = this.drawing();\n return shape ? this.labels.t(shape === 'circle' ? 'map.draw.circle' : shape === 'rectangle' ? 'map.draw.rectangle' : 'map.draw.polygon') : '';\n });\n\n // ─── Private state ────────────────────────────────────────\n private session: DrawSession | null = null;\n private lastDrawn: UiMapArea | null = null;\n private autoFitDone = false;\n private userMoved = false;\n private lastFitKey: unknown = undefined;\n /** A `fitKey` change that found no places: the fit waits for the places (the next change of the set of places, or `loading` ending). */\n private pendingFit = false;\n private wasLoading = false;\n /** The grouping cell (px) the drawn window was built for: a change of `clustering` / `clusterRadius` rebuilds it. */\n private windowCell = -1;\n private listenersAbort: AbortController | null = null;\n /** The area (and zoom) the places are drawn for: the visible part padded by half a screen on every side. Places outside it are neither drawn nor grouped. */\n private readonly renderWindow = signal<{ outer: GeoBounds; zoom: number } | null>(null);\n /** The visible part padded by a quarter of a screen: while the view stays inside it the drawn places are kept. */\n private renderInner: GeoBounds | null = null;\n private emitTimer: ReturnType<typeof setTimeout> | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private readonly layerById = new Map<string, { layer: Leaflet.Marker; signature: string }>();\n private readonly itemById = new Map<string, MapItem<UiMapMarker<T>>>();\n private readyWaiters: ((ok: boolean) => void)[] = [];\n private cursor: LatLng | null = null;\n /** The map's own centre at the last move (Mercator: not the middle of the bounds). */\n private centerNow: LatLng = DEFAULT_CENTER;\n\n constructor() {\n // create / destroy Leaflet with the canvas element: it exists only while the map is available\n effect(onCleanup => {\n const host = this.canvas()?.nativeElement;\n if (!host || !this.isBrowser) return;\n let cancelled = false;\n onCleanup(() => { cancelled = true; this.teardown(); });\n Promise.resolve().then(() => this.loadEngine()).then(mod => {\n if (cancelled) return;\n const L = ((mod as { default?: LeafletLib }).default ?? mod) as LeafletLib;\n this.zone.runOutsideAngular(() => this.create(L, host));\n }).catch(() => {\n if (cancelled) return;\n this.engineFailed.set(true);\n this.resolveWaiters(false);\n });\n });\n effect(() => { const e = this.engine(); if (e) { this.tileState(); this.tileUrlTemplate(); this.subdomains(); this.minZoom(); this.maxZoom(); untracked(() => this.syncTiles(e)); } });\n effect(() => { const e = this.engine(); if (e) { this.renderItems(); this.styles(); untracked(() => this.syncMarkers(e)); } });\n effect(() => { const e = this.engine(); if (e) { this.area(); untracked(() => this.syncArea(e)); } });\n effect(() => { const e = this.engine(); if (e) { this.draftPoints(); this.drawing(); untracked(() => this.syncDraft(e)); } });\n effect(() => { const e = this.engine(); if (e) { this.center(); this.zoom(); untracked(() => this.applyControlledView(e)); } });\n effect(() => { const e = this.engine(); if (e) { this.markerSignature(); this.fitToMarkers(); this.center(); this.zoom(); untracked(() => this.autoFit()); } });\n effect(() => { const e = this.engine(); if (e) { const key = this.fitKey(); untracked(() => this.fitOnKey(key)); } });\n // the window's margin depends on the grouping cell: a new radius (or grouping switched on / off) needs a new window\n effect(() => {\n const e = this.engine();\n const cell = this.clustering() ? Math.max(1, this.clusterRadius()) : 0;\n if (e) untracked(() => { if (cell !== this.windowCell) this.updateRenderWindow(e.map, this.visibleBox(e.map), true); });\n });\n // places that were being loaded have arrived: a fit that was waiting for them runs now\n effect(() => {\n const e = this.engine();\n const loading = this.loading();\n if (e) untracked(() => { if (this.wasLoading && !loading && this.pendingFit) this.autoFit(); });\n this.wasLoading = loading;\n });\n effect(() => { const e = this.engine(); if (e) { this.drawing(); untracked(() => this.syncDrawMode(e)); } });\n effect(() => {\n const e = this.engine();\n if (e) { const wheel = this.scrollWheelZoom(); untracked(() => (wheel ? e.map.scrollWheelZoom.enable() : e.map.scrollWheelZoom.disable())); }\n });\n this.destroyRef.onDestroy(() => { this.teardown(); this.resolveWaiters(false); });\n }\n\n // ─── Public API ───────────────────────────────────────────\n\n /** Resolves `true` once the map is created, `false` when it cannot be (no usable tile source, or the map engine failed to load). */\n whenReady(): Promise<boolean> {\n if (this.engine()) return Promise.resolve(true);\n if (this.unavailable()) return Promise.resolve(false);\n return new Promise<boolean>(resolve => this.readyWaiters.push(resolve));\n }\n\n /** Moves the map so every place is visible (animated unless the user prefers reduced motion; `animate = false` jumps). */\n fitMarkers(animate = !this.reducedMotion()): void {\n const e = this.engine();\n if (!e) return;\n const b = boundsOf(this.validMarkers());\n if (b) this.fitBounds(b, animate);\n }\n\n /** Moves the map so the box is visible. */\n fitBounds(b: GeoBounds, animate = !this.reducedMotion(), maxZoom = this.fitMaxZoom()): void {\n const e = this.engine();\n if (!e) return;\n const pad = Math.max(0, this.fitPadding());\n e.map.fitBounds(e.L.latLngBounds([b.south, b.west], [b.north, b.east]), { padding: [pad, pad], maxZoom, animate });\n }\n\n setView(center: LatLng, zoom?: number): void {\n const e = this.engine();\n if (!e || !isValidLatLng(center)) return;\n e.map.setView([center.lat, center.lng], zoom ?? e.map.getZoom(), { animate: !this.reducedMotion() });\n }\n\n /** Zooms one level in. A move the host makes: it does not switch the automatic first fit off (the zoom buttons of the map do, see `onZoomButton`). */\n zoomIn(): void { this.engine()?.map.zoomIn(1, { animate: !this.reducedMotion() }); }\n /** Zooms one level out (a host move, like `zoomIn`). */\n zoomOut(): void { this.engine()?.map.zoomOut(1, { animate: !this.reducedMotion() }); }\n\n /** The map's own zoom buttons: the user's zoom, so it switches the automatic first fit off (and drops a waiting fit), then zooms. */\n protected onZoomButton(direction: 'in' | 'out'): void {\n this.markUserMoved();\n if (direction === 'in') this.zoomIn(); else this.zoomOut();\n }\n\n /** The user changed the view: the automatic first fit is off for good and a fit that was waiting for places is dropped (the user's view wins). */\n private markUserMoved(): void {\n this.userMoved = true;\n this.pendingFit = false;\n }\n\n /** Re-measures the map (call it after the host resized or showed the container; a ResizeObserver already does it for normal layout changes). */\n invalidateSize(): void { this.engine()?.map.invalidateSize(); }\n\n /** Starts drawing a search area of this shape (ignored when read-only, not offered by `drawModes`, or the map is not ready). */\n startDraw(shape: UiMapDrawShape): void {\n if (this.readOnly() || !this.drawModes().includes(shape) || !this.engine()) return;\n this.session = new DrawSession(shape);\n this.cursor = null;\n this.draftPoints.set([]);\n this.drawing.set(shape);\n this.selectedId.set(null);\n this.announce(this.labels.t(shape === 'circle' ? 'map.draw.circle' : shape === 'rectangle' ? 'map.draw.rectangle' : 'map.draw.polygon'));\n }\n\n /** Adds a point where the crosshair (the middle of the map) is: the keyboard way to draw. */\n addPointAtCenter(): void {\n const e = this.engine();\n if (!e || !this.session) return;\n const c = e.map.getCenter();\n this.addDrawPoint({ lat: clampLat(c.lat), lng: clampLng(c.lng) });\n }\n\n /** Finishes a polygon (the circle and the rectangle finish by themselves at their second point). */\n finishDraw(): void {\n const s = this.session;\n if (!s) return;\n const area = s.finish();\n if (!area) {\n if (s.problem === 'self-intersecting') this.announce(this.labels.t('map.draw.finishSelfIntersecting'));\n else this.announce(this.labels.t(s.missing === 1 ? 'map.draw.needMore_one' : 'map.draw.needMore_other', { count: s.missing }));\n return;\n }\n this.commitArea(area);\n }\n\n /** Removes the last point of the drawing. */\n undoDrawPoint(): void {\n const s = this.session;\n if (!s || !s.undo()) return;\n this.draftPoints.set([...s.points]);\n this.announce(this.labels.t('map.draw.pointRemoved', { count: s.points.length }));\n }\n\n /** Stops drawing without a result. */\n cancelDraw(): void {\n if (!this.session) return;\n this.endSession();\n this.announce(this.labels.t('map.draw.cancelled'));\n }\n\n /** Removes the search area. */\n clearArea(): void {\n if (this.readOnly() || !this.area()) return;\n this.lastDrawn = null;\n this.area.set(null);\n this.announce(this.labels.t('map.draw.cleared'));\n }\n\n // ─── Template helpers ─────────────────────────────────────\n\n protected styleOf(m: UiMapMarker<T>): PinStyle { return this.styles().get(m.id) ?? pinStyle(m, this.categories()); }\n protected glyphOf(m: UiMapMarker<T>): string { return pinGlyph(m); }\n protected drawLabel(shape: UiMapDrawShape): string {\n return this.labels.t(shape === 'circle' ? 'map.drawCircle' : shape === 'rectangle' ? 'map.drawRectangle' : 'map.drawPolygon');\n }\n protected closeInfo(): void { this.selectedId.set(null); }\n\n protected selectFromList(m: UiMapMarker<T>): void {\n this.selectedId.set(m.id);\n this.markerClick.emit(m);\n this.announceSelected(m);\n this.panToMarker(m);\n }\n\n /** Says which place was chosen (and that its details are open, when the host has an info template). */\n private announceSelected(m: UiMapMarker<T>): void {\n const name = m.ariaLabel || m.label;\n this.announce(this.labels.t(this.info() ? 'map.infoLabel' : 'map.placeSelected', { name }));\n }\n\n protected onListKey(event: KeyboardEvent): void {\n const keys = ['ArrowDown', 'ArrowUp', 'Home', 'End'];\n if (!keys.includes(event.key) || event.altKey || event.ctrlKey || event.metaKey) return;\n const list = event.currentTarget as HTMLElement;\n const buttons = Array.from(list.querySelectorAll<HTMLElement>('.ui-map__place'));\n const at = buttons.indexOf(event.target as HTMLElement);\n if (at < 0) return;\n event.preventDefault();\n const next = event.key === 'Home' ? 0 : event.key === 'End' ? buttons.length - 1 : Math.min(buttons.length - 1, Math.max(0, at + (event.key === 'ArrowDown' ? 1 : -1)));\n buttons[next]?.focus();\n }\n\n /** Keyboard on the map: while drawing, Space / Enter / Backspace / Escape; otherwise Escape closes the info panel. */\n protected onStageKey(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const target = event.target as HTMLElement | null;\n const onMap = !!target?.classList.contains('leaflet-container');\n if (event.key === 'Escape') {\n if (this.session) { event.preventDefault(); this.cancelDraw(); }\n else if (this.selectedId() !== null) { event.preventDefault(); this.closeInfo(); }\n return;\n }\n if (!this.session || !onMap) return;\n if (event.key === ' ') { event.preventDefault(); this.addPointAtCenter(); }\n else if (event.key === 'Enter') { event.preventDefault(); this.finishDraw(); }\n else if (event.key === 'Backspace') { event.preventDefault(); this.undoDrawPoint(); }\n }\n\n // ─── Engine ───────────────────────────────────────────────\n\n private reducedMotion(): boolean {\n return this.isBrowser && typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;\n }\n\n private create(L: LeafletLib, host: HTMLElement): void {\n const reduced = this.reducedMotion();\n const markers = this.validMarkers();\n const box = boundsOf(markers);\n const c = this.center() ?? (box ? { lat: (box.north + box.south) / 2, lng: (box.east + box.west) / 2 } : this.initialCenter());\n const z = this.zoom() ?? this.initialZoom();\n const map = L.map(host, {\n center: [c.lat, c.lng], zoom: z, minZoom: this.minZoom(), maxZoom: this.maxZoom(), zoomControl: false, attributionControl: false,\n zoomAnimation: !reduced, fadeAnimation: !reduced, markerZoomAnimation: !reduced, inertia: !reduced, keyboard: true, scrollWheelZoom: this.scrollWheelZoom(),\n // one world, no repeats: a point (and the emitted bounds) is always inside [-180, 180]\n maxBounds: [[-90, -180], [90, 180]], maxBoundsViscosity: 1,\n });\n const engine: Engine = { L, map, markers: L.layerGroup().addTo(map), area: L.layerGroup().addTo(map), draft: L.layerGroup().addTo(map), tiles: null };\n // the new zoom and the window built for it are set together: ONE rebuild of the drawn places per zoom step (not one for zoomend and one for moveend)\n map.on('zoomend', () => this.zone.run(() => {\n this.zoomLevel.set(map.getZoom());\n this.updateRenderWindow(map, this.visibleBox(map));\n }));\n map.on('moveend', () => this.onMoveEnd(map));\n // while the map is moving (a long drag, inertia, an animation) the drawn area follows as soon as the view leaves its margin, not only at the end\n map.on('move', () => this.onMove(map));\n map.on('click', (ev: Leaflet.LeafletMouseEvent) => this.zone.run(() => this.onMapClick({ lat: clampLat(ev.latlng.lat), lng: clampLng(ev.latlng.lng) })));\n map.on('mousemove', (ev: Leaflet.LeafletMouseEvent) => this.onCursor(engine, { lat: clampLat(ev.latlng.lat), lng: clampLng(ev.latlng.lng) }));\n // anything the USER does to the view switches the automatic fit off for good (a programmatic move never does)\n map.on('dragstart boxzoomend', () => this.markUserMoved());\n this.listenersAbort = new AbortController();\n const opts = { signal: this.listenersAbort.signal, passive: true } as const;\n // a wheel turn is the user's zoom only while the map takes the wheel; with scrollWheelZoom off it scrolls the page\n host.addEventListener('wheel', () => { if (this.scrollWheelZoom()) this.markUserMoved(); }, opts);\n host.addEventListener('dblclick', () => this.markUserMoved(), opts);\n host.addEventListener('touchstart', (ev: TouchEvent) => { if (ev.touches.length > 1) this.markUserMoved(); }, opts);\n // Ctrl / Meta / Alt combinations are the browser's (page zoom, Back / Forward), not the map's: Leaflet ignores them too\n host.addEventListener('keydown', (ev: KeyboardEvent) => {\n if (!ev.ctrlKey && !ev.metaKey && !ev.altKey && /^(Arrow(Up|Down|Left|Right)|[+\\-=_])$/.test(ev.key)) this.markUserMoved();\n }, opts);\n if (typeof ResizeObserver === 'function') {\n this.resizeObserver = new ResizeObserver(() => map.invalidateSize());\n this.resizeObserver.observe(host);\n }\n this.autoFitDone = false;\n this.userMoved = false;\n this.lastFitKey = this.fitKey();\n this.pendingFit = false;\n this.renderInner = null;\n this.windowCell = -1;\n this.onMoveEnd(map); // the drawn area is known before the first marker is drawn\n this.zone.run(() => {\n this.zoomLevel.set(map.getZoom());\n this.engineFailed.set(false);\n this.engine.set(engine);\n this.resolveWaiters(true);\n });\n }\n\n private teardown(): void {\n if (this.emitTimer) { clearTimeout(this.emitTimer); this.emitTimer = null; }\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.listenersAbort?.abort();\n this.listenersAbort = null;\n const e = this.engine();\n if (e) {\n this.layerById.clear();\n this.itemById.clear();\n e.map.off();\n e.map.remove();\n this.engine.set(null);\n this.bounds.set(null);\n this.renderWindow.set(null);\n this.renderInner = null;\n }\n }\n\n private resolveWaiters(ok: boolean): void {\n const waiters = this.readyWaiters;\n this.readyWaiters = [];\n for (const w of waiters) w(ok);\n }\n\n private syncTiles(e: Engine): void {\n e.tiles?.remove();\n e.tiles = null;\n this.tilesFailed.set(false);\n if (this.tileState() !== 'ok') return;\n const tiles = e.L.tileLayer(this.tileUrlTemplate().trim(), {\n subdomains: normalizeSubdomains(this.subdomains()), minZoom: this.minZoom(), maxZoom: this.maxZoom(), attribution: '', crossOrigin: false, noWrap: true,\n });\n tiles.on('tileerror', () => this.zone.run(() => this.tilesFailed.set(true)));\n tiles.on('load', () => this.zone.run(() => this.tilesFailed.set(false)));\n tiles.addTo(e.map);\n e.tiles = tiles;\n e.map.setMinZoom(this.minZoom());\n e.map.setMaxZoom(this.maxZoom());\n }\n\n /** The map stopped moving: the `bounds` signal follows at once (the list uses it), the outputs after the idle delay. */\n private onMoveEnd(map: Leaflet.Map): void {\n const b = map.getBounds();\n const c = map.getCenter();\n // the world does not repeat: a screen wider than the world still reports [-180, 180] with west < east\n const next: UiMapBounds = {\n north: clampLat(b.getNorth()), south: clampLat(b.getSouth()), east: clampLng(b.getEast()), west: clampLng(b.getWest()), zoom: map.getZoom(),\n };\n this.centerNow = { lat: clampLat(c.lat), lng: clampLng(c.lng) };\n this.zone.run(() => {\n this.bounds.set(next);\n this.updateRenderWindow(map, next);\n });\n if (this.emitTimer) { clearTimeout(this.emitTimer); this.emitTimer = null; }\n const emit = (): void => this.zone.run(() => {\n this.boundsChange.emit(next);\n this.viewChange.emit({ center: this.centerNow, zoom: next.zoom });\n });\n const delay = Math.max(0, this.idleDelay());\n // idleDelay 0 = no debounce: emit at once\n if (delay === 0) emit();\n else this.emitTimer = setTimeout(() => { this.emitTimer = null; emit(); }, delay);\n }\n\n /** The visible part of the map, clamped to the world (no events, no signals). */\n private visibleBox(map: Leaflet.Map): UiMapBounds {\n const b = map.getBounds();\n return { north: clampLat(b.getNorth()), south: clampLat(b.getSouth()), east: clampLng(b.getEast()), west: clampLng(b.getWest()), zoom: map.getZoom() };\n }\n\n /** `move` fires all through a drag or an animation: a cheap comparison with the margin, and a rebuild only once the view is past it. */\n private onMove(map: Leaflet.Map): void {\n const inner = this.renderInner;\n if (!inner) return;\n const v = this.visibleBox(map);\n if (v.north <= inner.north && v.south >= inner.south && v.east <= inner.east && v.west >= inner.west) return;\n this.zone.run(() => this.updateRenderWindow(map, v));\n }\n\n /**\n * Rebuilds the drawn area when the zoom changed or the view left the margin of the last build; panning inside the margin keeps the drawn places.\n * The margin is at least one grouping cell: a cell that touches the visible area is then drawn whole, so no group shows a count that leaves out places\n * beyond the window's edge (inner margin >= 1 cell, outer margin >= inner + 1 cell, both at least a quarter / half of the screen).\n */\n private updateRenderWindow(map: Leaflet.Map, v: UiMapBounds, force = false): void {\n const inner = this.renderInner;\n const current = this.renderWindow();\n if (!force && inner && current && current.zoom === v.zoom && v.north <= inner.north && v.south >= inner.south && v.east <= inner.east && v.west >= inner.west) return;\n const size = map.getSize();\n const cell = this.clustering() ? Math.max(1, this.clusterRadius()) : 0;\n const inX = Math.max(size.x * 0.25, cell), inY = Math.max(size.y * 0.25, cell);\n const outX = Math.max(size.x * 0.5, inX + cell), outY = Math.max(size.y * 0.5, inY + cell);\n const grow = (mx: number, my: number): GeoBounds => {\n const nw = map.containerPointToLatLng([-mx, -my]);\n const se = map.containerPointToLatLng([size.x + mx, size.y + my]);\n return { north: clampLat(nw.lat), south: clampLat(se.lat), east: clampLng(se.lng), west: clampLng(nw.lng) };\n };\n this.windowCell = cell;\n this.renderInner = grow(inX, inY);\n this.renderWindow.set({ outer: grow(outX, outY), zoom: v.zoom });\n }\n\n private syncMarkers(e: Engine): void {\n const items = this.renderItems();\n const selected = this.selectedId();\n const keep = new Set<string>();\n const doc = e.map.getContainer().ownerDocument;\n for (const item of items) {\n const id = item.kind === 'marker' ? `m:${item.item.id}` : item.id;\n keep.add(id);\n this.itemById.set(id, item);\n let signature: string;\n let latLng: [number, number];\n let build: () => Leaflet.DivIcon;\n let title: string;\n if (item.kind === 'marker') {\n const m = item.item;\n const st = this.styles().get(m.id) ?? pinStyle(m, this.categories());\n const glyph = pinGlyph(m);\n const isSelected = m.id === selected;\n signature = `${m.lat},${m.lng}|${st.shape}|${st.color}|${glyph}|${isSelected}|${m.label}`;\n latLng = [m.lat, m.lng];\n title = m.label;\n build = () => e.L.divIcon({ html: buildPin(doc, st, glyph, isSelected), className: 'ui-map__icon', iconSize: [PIN_SIZE, PIN_SIZE], iconAnchor: [PIN_SIZE / 2, PIN_SIZE / 2] });\n } else {\n title = this.labels.t('map.clusterTitle', { count: item.count });\n signature = `${item.lat},${item.lng}|c${item.count}|${title}`;\n latLng = [item.lat, item.lng];\n build = () => e.L.divIcon({ html: buildCluster(doc, this.labels.formatNumber(item.count)), className: 'ui-map__icon', iconSize: [CLUSTER_SIZE, CLUSTER_SIZE], iconAnchor: [CLUSTER_SIZE / 2, CLUSTER_SIZE / 2] });\n }\n const existing = this.layerById.get(id);\n if (existing && existing.signature === signature) continue;\n if (existing) {\n existing.layer.setLatLng(latLng);\n existing.layer.options.title = title;\n existing.layer.setZIndexOffset(item.kind === 'marker' && item.item.id === selected ? 1000 : 0);\n existing.layer.setIcon(build());\n existing.signature = signature;\n this.markIconHidden(existing.layer);\n continue;\n }\n const layer = e.L.marker(latLng, { icon: build(), keyboard: false, title, alt: '', riseOnHover: true, zIndexOffset: item.kind === 'marker' && item.item.id === selected ? 1000 : 0 });\n layer.on('click', () => this.zone.run(() => this.onItemClick(id)));\n layer.addTo(e.markers);\n this.markIconHidden(layer);\n this.layerById.set(id, { layer, signature });\n }\n for (const [id, entry] of this.layerById) {\n if (keep.has(id)) continue;\n entry.layer.remove();\n this.layerById.delete(id);\n this.itemById.delete(id);\n }\n }\n\n /** The pins are decoration for pointer users: the list is the way for screen readers and the keyboard, so the pin icons are hidden from them. */\n private markIconHidden(layer: Leaflet.Marker): void {\n layer.getElement()?.setAttribute('aria-hidden', 'true');\n }\n\n private onItemClick(id: string): void {\n const item = this.itemById.get(id);\n if (!item) return;\n if (this.session) return;\n if (item.kind === 'cluster') {\n // zoom in far enough for the group to dissolve, whatever `fitMaxZoom` says for fitting places\n this.fitBounds(item.bounds, undefined, this.dissolveZoom());\n return;\n }\n this.selectedId.set(item.item.id);\n this.markerClick.emit(item.item);\n this.announceSelected(item.item);\n }\n\n private panToMarker(m: UiMapMarker<T>): void {\n const e = this.engine();\n if (!e) return;\n if (!e.map.getBounds().contains([m.lat, m.lng])) e.map.panTo([m.lat, m.lng], { animate: !this.reducedMotion() });\n }\n\n // ─── View ─────────────────────────────────────────────────\n\n private applyControlledView(e: Engine): void {\n const c = this.center();\n const z = this.zoom();\n if (c === null && z === null) return;\n this.pendingFit = false; // the host controls the view: a fit that was waiting would fight it (and be stale once control is given back)\n const now = e.map.getCenter();\n const target = c ?? { lat: now.lat, lng: now.lng };\n const level = z ?? e.map.getZoom();\n if (!isValidLatLng(target)) return;\n // closer than half a pixel at this zoom (the map's own rounding) is the same place: a host that feeds `viewChange` back must not make it move again\n const half = 360 / (256 * Math.pow(2, level)) / 2;\n if (Math.abs(now.lat - target.lat) < half && Math.abs(now.lng - target.lng) < half && level === e.map.getZoom()) return;\n e.map.setView([target.lat, target.lng], level, { animate: false });\n }\n\n /** The one automatic fit: the first time there are places, unless the user already moved the map or the view is controlled. */\n private autoFit(): void {\n if (this.center() !== null || this.zoom() !== null) { this.pendingFit = false; return; }\n if (this.validMarkers().length === 0) return;\n // a `fitKey` change that arrived before any place: it fits now, whatever the user did (it is the host's explicit request), and uses up the waiting fit\n if (this.pendingFit) {\n // still loading: the places may change again, so only the end of the loading (see the loading effect) fits, once, on the final set\n if (this.loading()) return;\n this.pendingFit = false;\n this.autoFitDone = true;\n this.fitMarkers(false);\n return;\n }\n if (this.autoFitDone || this.userMoved || !this.fitToMarkers()) return;\n this.autoFitDone = true;\n this.fitMarkers(false);\n }\n\n /**\n * `fitKey` changed: fit now (also after the user moved the map). With no places yet (a search whose results are still loading) nothing is fitted and the\n * fit stays PENDING until the places arrive (the next change of the set of places, or `loading` going from true to false); the first-fit rule is untouched.\n */\n private fitOnKey(key: unknown): void {\n if (Object.is(key, this.lastFitKey)) return;\n this.lastFitKey = key;\n if (this.center() !== null || this.zoom() !== null) { this.pendingFit = false; return; }\n if (this.validMarkers().length === 0 || this.loading()) { this.pendingFit = true; return; }\n this.pendingFit = false;\n this.autoFitDone = true;\n this.fitMarkers(false);\n }\n\n // ─── Area and drawing ─────────────────────────────────────\n\n private describeArea(a: UiMapArea): string {\n const n = (v: number) => this.labels.formatNumber(v, { maximumFractionDigits: 5 });\n switch (a.type) {\n case 'circle': return this.labels.t('map.area.circle', { lat: n(a.lat), lng: n(a.lng), radius: this.describeRadius(a.radiusMeters) });\n case 'bbox': return this.labels.t('map.area.bbox', { north: n(a.north), south: n(a.south), east: n(a.east), west: n(a.west) });\n case 'polygon': return this.labels.t('map.area.polygon', { count: a.points.length });\n }\n }\n\n private describeRadius(meters: number): string {\n if (meters >= 1000) return this.labels.t('map.unitKilometers', { value: this.labels.formatNumber(meters / 1000, { maximumFractionDigits: 2 }) });\n return this.labels.t('map.unitMeters', { value: this.labels.formatNumber(Math.round(meters)) });\n }\n\n private announce(text: string): void {\n this.announcement.set(text === this.announcement() ? text + ' ' : text);\n }\n\n private onMapClick(p: LatLng): void {\n if (this.session) { this.addDrawPoint(p); return; }\n if (this.selectedId() !== null) this.closeInfo();\n }\n\n private addDrawPoint(p: LatLng): void {\n const s = this.session;\n if (!s) return;\n const r = s.addPoint(p);\n if (r.status === 'rejected') { this.announce(this.labels.t(r.reason === 'self-intersecting' ? 'map.draw.selfIntersecting' : 'map.draw.rejected')); return; }\n if (r.status === 'finished') { this.commitArea(r.area); return; }\n this.draftPoints.set([...s.points]);\n this.announce(this.labels.t('map.draw.pointAdded', { count: r.count }));\n }\n\n private commitArea(area: UiMapArea): void {\n this.endSession();\n this.lastDrawn = area;\n this.area.set(area);\n this.announce(this.labels.t('map.draw.finished', { area: this.describeArea(area) }));\n }\n\n private endSession(): void {\n this.session = null;\n this.cursor = null;\n this.draftPoints.set([]);\n this.drawing.set(null);\n }\n\n private syncDrawMode(e: Engine): void {\n const drawing = this.drawing() !== null;\n const container = e.map.getContainer();\n container.classList.toggle('leaflet-crosshair', drawing);\n if (drawing) e.map.doubleClickZoom.disable(); else e.map.doubleClickZoom.enable();\n }\n\n private syncArea(e: Engine): void {\n e.area.clearLayers();\n const a = this.area();\n if (!a) return;\n const opts = { className: 'ui-map__area', interactive: false } as const;\n if (a.type === 'circle') e.L.circle([a.lat, a.lng], { ...opts, radius: a.radiusMeters }).addTo(e.area);\n else if (a.type === 'bbox') e.L.rectangle([[a.south, a.west], [a.north, a.east]], opts).addTo(e.area);\n else e.L.polygon(a.points.map(p => [p.lat, p.lng] as [number, number]), opts).addTo(e.area);\n // an area that was typed or loaded (not drawn here) is brought into view\n if (this.fitToArea() && !sameArea(a, this.lastDrawn) && this.center() === null && this.zoom() === null) {\n const b = areaBounds(a);\n if (b) this.fitBounds(b, false);\n }\n }\n\n private onCursor(e: Engine, p: LatLng): void {\n if (!this.session || this.session.points.length === 0) return;\n this.cursor = p;\n this.drawDraft(e);\n }\n\n private syncDraft(e: Engine): void { this.drawDraft(e); }\n\n /** Draws the points clicked so far and, while the pointer moves, the shape they would make with the pointer's position. */\n private drawDraft(e: Engine): void {\n e.draft.clearLayers();\n const s = this.session;\n const shape = this.drawing();\n if (!s || !shape) return;\n const pts = s.points;\n const style = { className: 'ui-map__draft', interactive: false } as const;\n const dot = { className: 'ui-map__draft-point', interactive: false, radius: 6 } as const;\n for (const p of pts) e.L.circleMarker([p.lat, p.lng], dot).addTo(e.draft);\n const cur = this.cursor;\n if (shape === 'polygon') {\n const line = pts.map(p => [p.lat, p.lng] as [number, number]);\n if (cur) line.push([cur.lat, cur.lng]);\n if (line.length > 1) (line.length > 2 ? e.L.polygon(line, style) : e.L.polyline(line, style)).addTo(e.draft);\n } else if (pts.length === 1 && cur) {\n if (shape === 'circle') {\n // the same distance the committed circle uses (DrawSession), so the preview shows the radius that will be saved\n const radius = haversineMeters(pts[0], cur);\n if (radius > 0) e.L.circle([pts[0].lat, pts[0].lng], { ...style, radius }).addTo(e.draft);\n } else {\n e.L.rectangle([[pts[0].lat, pts[0].lng], [cur.lat, cur.lng]], style).addTo(e.draft);\n }\n }\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, effect, inject, input, model, signal, untracked } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { ButtonComponent, FormRowComponent, FormSectionComponent, SelectComponent, TextInputComponent, UiLabelsService } from '@forgeroute/ui';\nimport { LatLng, isSimplePolygon, isValidLat, isValidLng } from './geo/geo';\nimport { isValidArea, sameArea } from './geo/area';\nimport { UiMapArea, UiMapDrawShape } from './map.types';\n\nexport type UiMapRadiusUnit = 'm' | 'km' | 'mi';\n\n/** Metres in one of each unit. */\nconst UNIT_METERS: Record<UiMapRadiusUnit, number> = { m: 1, km: 1000, mi: 1609.344 };\n\nconst asNumber = (value: unknown): number | null => (typeof value === 'number' && Number.isFinite(value) ? value : null);\n\n/**\n * The typed way to set a search area: the keyboard- and screen-reader-friendly twin of drawing on the map. Place it next to a `ui-map` and share\n * the area signal: `<ui-map [(area)]=\"area\" /> <ui-map-area-form [(area)]=\"area\" />`. Circle (centre latitude / longitude + radius with a unit),\n * rectangle (north / south / east / west) and polygon (add points one by one, remove any, at least 3) are supported; every field shows its own\n * message and Apply stays blocked while one is wrong. A new `area` from outside (drawn on the map, loaded from a saved search) fills the form.\n */\n@Component({\n selector: 'ui-map-area-form',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, ButtonComponent, FormRowComponent, FormSectionComponent, SelectComponent, TextInputComponent],\n styles: [`\n :host { display: block; }\n .maf-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: #0f172a; text-transform: uppercase; letter-spacing: .04em; }\n .maf-points { list-style: none; margin: 0; padding: 0; border: 1px solid #e2e8f0; border-radius: 8px; }\n .maf-points > li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 12px; font-size: 13px; color: #0f172a; }\n .maf-points > li + li { border-top: 1px solid #e2e8f0; }\n .maf-empty { margin: 0; font-size: 13px; color: #475569; }\n .maf-error { margin: 0; font-size: 12px; color: #b91c1c; }\n .maf-actions { display: flex; flex-wrap: wrap; gap: 8px; }\n .maf-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }\n @media (forced-colors: active) { .maf-points { border: 1px solid CanvasText; } .maf-error { color: CanvasText; } }\n `],\n template: `\n <ui-form-section>\n <p class=\"maf-title\">{{ labels.t('map.form.title') }}</p>\n <ui-select [label]=\"labels.t('map.form.shape')\" [options]=\"shapeOptions()\" [ngModel]=\"shape()\" (ngModelChange)=\"setShape($event)\" [disabled]=\"readOnly()\" />\n\n @switch (shape()) {\n @case ('circle') {\n <ui-form-row>\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.centerLat')\" [required]=\"true\"\n [ngModel]=\"lat()\" (ngModelChange)=\"lat.set(num($event))\" [error]=\"errors().lat\" [disabled]=\"readOnly()\" inputTestId=\"maf-lat\" />\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.centerLng')\" [required]=\"true\"\n [ngModel]=\"lng()\" (ngModelChange)=\"lng.set(num($event))\" [error]=\"errors().lng\" [disabled]=\"readOnly()\" inputTestId=\"maf-lng\" />\n </ui-form-row>\n <ui-form-row>\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.radius')\" [required]=\"true\"\n [ngModel]=\"radius()\" (ngModelChange)=\"onRadius(num($event))\" [error]=\"errors().radius\" [disabled]=\"readOnly()\" inputTestId=\"maf-radius\" />\n <ui-select [label]=\"labels.t('map.form.radiusUnit')\" [options]=\"unitOptions()\" [ngModel]=\"unit()\" (ngModelChange)=\"setUnit($event)\" [disabled]=\"readOnly()\" />\n </ui-form-row>\n }\n @case ('rectangle') {\n <ui-form-row>\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.north')\" [required]=\"true\"\n [ngModel]=\"north()\" (ngModelChange)=\"north.set(num($event))\" [error]=\"errors().north\" [disabled]=\"readOnly()\" inputTestId=\"maf-north\" />\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.south')\" [required]=\"true\"\n [ngModel]=\"south()\" (ngModelChange)=\"south.set(num($event))\" [error]=\"errors().south\" [disabled]=\"readOnly()\" inputTestId=\"maf-south\" />\n </ui-form-row>\n <ui-form-row>\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.west')\" [required]=\"true\"\n [ngModel]=\"west()\" (ngModelChange)=\"west.set(num($event))\" [error]=\"errors().west\" [disabled]=\"readOnly()\" inputTestId=\"maf-west\" />\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.east')\" [required]=\"true\"\n [ngModel]=\"east()\" (ngModelChange)=\"east.set(num($event))\" [error]=\"errors().east\" [disabled]=\"readOnly()\" inputTestId=\"maf-east\" />\n </ui-form-row>\n }\n @case ('polygon') {\n <ui-form-row>\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.pointLat')\"\n [ngModel]=\"pointLat()\" (ngModelChange)=\"pointLat.set(num($event))\" [error]=\"errors().pointLat\" [disabled]=\"readOnly()\" inputTestId=\"maf-point-lat\" />\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.pointLng')\"\n [ngModel]=\"pointLng()\" (ngModelChange)=\"pointLng.set(num($event))\" [error]=\"errors().pointLng\" [disabled]=\"readOnly()\" inputTestId=\"maf-point-lng\" />\n </ui-form-row>\n <div class=\"maf-actions\">\n <ui-button variant=\"secondary\" size=\"sm\" [disabled]=\"readOnly()\" (click)=\"addPoint()\">{{ labels.t('map.form.addPoint') }}</ui-button>\n </div>\n <div role=\"group\" [attr.aria-label]=\"labels.t('map.form.pointsLabel')\">\n @if (points().length === 0) {\n <p class=\"maf-empty\">{{ labels.t('map.form.noPoints') }}</p>\n } @else {\n <ul class=\"maf-points\">\n @for (p of points(); track $index) {\n <li>\n <span>{{ labels.t('map.form.pointItem', { n: $index + 1, lat: fmt(p.lat), lng: fmt(p.lng) }) }}</span>\n <ui-button variant=\"ghost\" size=\"sm\" [disabled]=\"readOnly()\" [ariaLabel]=\"labels.t('map.form.removePoint', { n: $index + 1 })\" (click)=\"removePoint($index)\">\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M6 6l12 12M18 6 6 18\"/></svg>\n </ui-button>\n </li>\n }\n </ul>\n }\n @if (errors().points; as message) { <p class=\"maf-error\" role=\"alert\">{{ message }}</p> }\n </div>\n }\n }\n\n <div class=\"maf-actions\">\n <ui-button variant=\"primary\" size=\"sm\" [disabled]=\"readOnly() || (touched() && hasErrors())\" (click)=\"apply()\">{{ labels.t('map.form.apply') }}</ui-button>\n <ui-button variant=\"ghost\" size=\"sm\" [disabled]=\"readOnly() || !area()\" (click)=\"clear()\">{{ labels.t('map.form.clear') }}</ui-button>\n </div>\n <div class=\"maf-sr\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</div>\n </ui-form-section>\n `,\n})\nexport class MapAreaFormComponent {\n protected readonly labels = inject(UiLabelsService);\n\n /** The search area (two-way: `[(area)]`). Apply sets it, Clear sets it to `null`; a value that arrives from outside fills the form. */\n readonly area = model<UiMapArea | null>(null);\n /** Which shapes the shape select offers. */\n readonly shapes = input<readonly UiMapDrawShape[]>(['circle', 'rectangle', 'polygon']);\n /** The unit the radius field starts in. */\n readonly defaultUnit = input<UiMapRadiusUnit>('mi');\n /** true = every field and button is disabled (a read-only user). */\n readonly readOnly = input(false);\n\n protected readonly shape = signal<UiMapDrawShape>('circle');\n protected readonly unit = signal<UiMapRadiusUnit>('mi');\n protected readonly lat = signal<number | null>(null);\n protected readonly lng = signal<number | null>(null);\n /** What the radius field SHOWS, in the chosen unit (rounded to 6 decimals for display only). */\n protected readonly radius = signal<number | null>(null);\n /** The radius in metres, exact: what Apply saves. Switching the unit only changes how it is shown, so m -> mi -> m never drifts. */\n private readonly meters = signal<number | null>(null);\n protected readonly north = signal<number | null>(null);\n protected readonly south = signal<number | null>(null);\n protected readonly east = signal<number | null>(null);\n protected readonly west = signal<number | null>(null);\n protected readonly pointLat = signal<number | null>(null);\n protected readonly pointLng = signal<number | null>(null);\n protected readonly points = signal<LatLng[]>([]);\n /** Errors show after the first Apply (or Add point), not while the user is still typing the first value. */\n protected readonly touched = signal(false);\n protected readonly pointTouched = signal(false);\n protected readonly announcement = signal('');\n\n private lastApplied: UiMapArea | null = null;\n private unitChosen = false;\n\n protected readonly shapeOptions = computed(() => this.shapes().map(value => ({\n value,\n label: this.labels.t(value === 'circle' ? 'map.form.circle' : value === 'rectangle' ? 'map.form.rectangle' : 'map.form.polygon'),\n })));\n protected readonly unitOptions = computed(() => [\n { value: 'm', label: this.labels.t('map.form.unitM') },\n { value: 'km', label: this.labels.t('map.form.unitKm') },\n { value: 'mi', label: this.labels.t('map.form.unitMi') },\n ]);\n\n /** The message of every field (an empty string = fine). */\n protected readonly errors = computed(() => {\n const show = this.touched();\n const latMsg = (v: number | null) => (v === null ? this.labels.t('map.form.errorNumber') : isValidLat(v) ? '' : this.labels.t('map.form.errorLat'));\n const lngMsg = (v: number | null) => (v === null ? this.labels.t('map.form.errorNumber') : isValidLng(v) ? '' : this.labels.t('map.form.errorLng'));\n const r = this.radius();\n const n = this.north(), s = this.south(), e = this.east(), w = this.west();\n const out = { lat: '', lng: '', radius: '', north: '', south: '', east: '', west: '', pointLat: '', pointLng: '', points: '' };\n if (show) {\n if (this.shape() === 'circle') {\n out.lat = latMsg(this.lat());\n out.lng = lngMsg(this.lng());\n out.radius = r === null ? this.labels.t('map.form.errorNumber') : r > 0 ? '' : this.labels.t('map.form.errorRadius');\n } else if (this.shape() === 'rectangle') {\n out.north = latMsg(n);\n out.south = latMsg(s);\n out.east = lngMsg(e);\n out.west = lngMsg(w);\n if (!out.north && !out.south && n! <= s!) out.north = this.labels.t('map.form.errorNorthSouth');\n if (!out.east && !out.west && e! <= w!) out.east = this.labels.t('map.form.errorEastWest');\n } else if (this.points().length < 3) {\n out.points = this.labels.t('map.form.errorPolygon');\n } else if (!isSimplePolygon(this.points())) {\n out.points = this.labels.t('map.form.errorSelfIntersecting');\n }\n }\n if (this.pointTouched()) {\n out.pointLat = latMsg(this.pointLat());\n out.pointLng = lngMsg(this.pointLng());\n }\n return out;\n });\n /**\n * Whether the SHAPE has a problem (what Apply cares about). The messages of the \"add a point\" fields belong to Add point: a half-typed point never blocks\n * Apply of a polygon that is already valid (it is simply not part of the area).\n */\n protected readonly hasErrors = computed(() => Object.entries(this.errors()).some(([field, m]) => m !== '' && field !== 'pointLat' && field !== 'pointLng'));\n\n constructor() {\n effect(() => { const unit = this.defaultUnit(); untracked(() => { if (!this.unitChosen) this.unit.set(unit); }); });\n effect(() => {\n const a = this.area();\n untracked(() => {\n if (a === null) { if (this.lastApplied !== null) this.reset(); return; }\n if (sameArea(a, this.lastApplied)) return;\n this.fillFrom(a);\n });\n });\n }\n\n // ─── Template handlers ────────────────────────────────────\n\n protected num(value: unknown): number | null { return asNumber(value); }\n\n /** The user typed a radius: it is in the unit chosen now. */\n protected onRadius(value: number | null): void {\n this.radius.set(value);\n this.meters.set(value === null ? null : value * UNIT_METERS[this.unit()]);\n }\n protected fmt(value: number): string { return this.labels.formatNumber(value, { maximumFractionDigits: 6 }); }\n\n protected setShape(value: string): void {\n if (value !== 'circle' && value !== 'rectangle' && value !== 'polygon') return;\n this.shape.set(value);\n this.touched.set(false);\n this.pointTouched.set(false);\n }\n\n /** Changing the unit keeps the length the user means: 2 miles becomes 3.218688 km, not 2 km. */\n protected setUnit(value: string): void {\n if (value !== 'm' && value !== 'km' && value !== 'mi') return;\n this.unitChosen = true;\n const m = this.meters();\n if (m !== null) this.radius.set(this.round(m / UNIT_METERS[value]));\n this.unit.set(value);\n }\n\n protected addPoint(): void {\n this.pointTouched.set(true);\n const la = this.pointLat();\n const ln = this.pointLng();\n if (la === null || ln === null || !isValidLat(la) || !isValidLng(ln)) return;\n this.points.update(list => [...list, { lat: la, lng: ln }]);\n this.pointLat.set(null);\n this.pointLng.set(null);\n this.pointTouched.set(false);\n }\n\n protected removePoint(index: number): void {\n this.points.update(list => list.filter((_, i) => i !== index));\n }\n\n protected apply(): void {\n this.touched.set(true);\n if (this.hasErrors()) return;\n const next = this.build();\n if (!next || !isValidArea(next)) return;\n this.lastApplied = next;\n this.area.set(next);\n this.announce(this.labels.t('map.form.applied'));\n }\n\n protected clear(): void {\n this.reset();\n this.lastApplied = null;\n this.area.set(null);\n this.announce(this.labels.t('map.draw.cleared'));\n }\n\n // ─── Internals ────────────────────────────────────────────\n\n private build(): UiMapArea | null {\n switch (this.shape()) {\n case 'circle': {\n const lat = this.lat(), lng = this.lng(), m = this.meters();\n if (lat === null || lng === null || m === null) return null;\n return { type: 'circle', lat, lng, radiusMeters: m };\n }\n case 'rectangle': {\n const n = this.north(), s = this.south(), e = this.east(), w = this.west();\n if (n === null || s === null || e === null || w === null) return null;\n return { type: 'bbox', north: n, south: s, east: e, west: w };\n }\n case 'polygon':\n return { type: 'polygon', points: this.points().map(p => ({ ...p })) };\n }\n }\n\n private fillFrom(a: UiMapArea): void {\n this.touched.set(false);\n this.pointTouched.set(false);\n if (a.type === 'circle') {\n this.shape.set('circle');\n this.lat.set(a.lat);\n this.lng.set(a.lng);\n this.meters.set(a.radiusMeters);\n this.radius.set(this.round(a.radiusMeters / UNIT_METERS[this.unit()]));\n } else if (a.type === 'bbox') {\n this.shape.set('rectangle');\n this.north.set(a.north);\n this.south.set(a.south);\n this.east.set(a.east);\n this.west.set(a.west);\n } else {\n this.shape.set('polygon');\n this.points.set(a.points.map(p => ({ ...p })));\n }\n }\n\n private reset(): void {\n this.touched.set(false);\n this.pointTouched.set(false);\n for (const s of [this.lat, this.lng, this.radius, this.north, this.south, this.east, this.west, this.pointLat, this.pointLng]) s.set(null);\n this.points.set([]);\n this.meters.set(null);\n }\n\n private round(v: number): number { return Math.round(v * 1e6) / 1e6; }\n\n private announce(text: string): void {\n this.announcement.set(text === this.announcement() ? text + ' ' : text);\n }\n}\n"],"mappings":";;;;;;AAkBA,MAAa,sBAAsB;AAEnC,MAAM,SAAS,QAAyB,MAAM,KAAK,KAAM;AACzD,MAAM,SAAS,QAAyB,MAAM,MAAO,KAAK;AAG1D,SAAgB,WAAW,OAAc;CACvC,OAAO,OAAO,UA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map.mjs","names":[],"sources":["../../../projects/forgeroute-ui/map/src/geo/geo.ts","../../../projects/forgeroute-ui/map/src/geo/area.ts","../../../projects/forgeroute-ui/map/src/cluster/grid-cluster.ts","../../../projects/forgeroute-ui/map/src/draw/draw-session.ts","../../../projects/forgeroute-ui/map/src/marker-pin.ts","../../../projects/forgeroute-ui/map/src/tile-source.ts","../../../projects/forgeroute-ui/map/src/engine-loader.ts","../../../projects/forgeroute-ui/map/src/map.component.ts","../../../projects/forgeroute-ui/map/src/map-area-form.component.ts"],"sourcesContent":["/**\n * Pure geography helpers of the map entry point. No Angular, no Leaflet, no DOM: the same maths is mirrored in SQL on the backend\n * (so the list a user gets for a drawn area equals the markers the map shows for it), which is why every definition is spelled out.\n *\n * Conventions (the SQL mirror must use the same ones):\n * - Coordinates are WGS84 degrees: `lat` in [-90, 90], `lng` in [-180, 180].\n * - Distances use a sphere of radius `EARTH_RADIUS_METERS` (the IUGG mean radius, 6,371,008.8 m) and the haversine formula.\n * - `pointInPolygon` treats `lng` as x and `lat` as y on a flat plane (even-odd ray casting) and counts the boundary as inside. That is right\n * for the search areas people draw (a city, a district); it does not wrap over the antimeridian and does not enclose a pole.\n * - Bounding boxes are `{ north, south, east, west }` with `west <= east` (no antimeridian wrap).\n */\n\nexport interface LatLng { lat: number; lng: number }\n\n/** `south <= north` and `west <= east`, degrees. */\nexport interface GeoBounds { north: number; south: number; east: number; west: number }\n\n/** The IUGG mean Earth radius in metres: the radius every distance of this file (and of its SQL mirror) uses. */\nexport const EARTH_RADIUS_METERS = 6371008.8;\n\nconst toRad = (deg: number): number => (deg * Math.PI) / 180;\nconst toDeg = (rad: number): number => (rad * 180) / Math.PI;\n\n/** true for a finite latitude in [-90, 90]. */\nexport function isValidLat(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value >= -90 && value <= 90;\n}\n\n/** true for a finite longitude in [-180, 180]. */\nexport function isValidLng(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value >= -180 && value <= 180;\n}\n\n/** true when both coordinates are valid. */\nexport function isValidLatLng(value: unknown): value is LatLng {\n const v = value as Partial<LatLng> | null | undefined;\n return !!v && isValidLat(v.lat) && isValidLng(v.lng);\n}\n\n/** The latitude limited to [-90, 90] (NaN stays NaN). */\nexport function clampLat(value: number): number { return Math.min(90, Math.max(-90, value)); }\n\n/** The longitude limited to [-180, 180]. The map does not repeat the world, so a point beyond the edge is the edge. */\nexport function clampLng(value: number): number { return Math.min(180, Math.max(-180, value)); }\n\n/** Great-circle distance between two points in metres (haversine, sphere of `EARTH_RADIUS_METERS`). */\nexport function haversineMeters(a: LatLng, b: LatLng): number {\n const dLat = toRad(b.lat - a.lat);\n const dLng = toRad(b.lng - a.lng);\n const sinLat = Math.sin(dLat / 2);\n const sinLng = Math.sin(dLng / 2);\n const h = sinLat * sinLat + Math.cos(toRad(a.lat)) * Math.cos(toRad(b.lat)) * sinLng * sinLng;\n // clamp: rounding can push h a hair above 1 for antipodal points\n return 2 * EARTH_RADIUS_METERS * Math.asin(Math.min(1, Math.sqrt(h)));\n}\n\n/**\n * true when `point` lies inside `polygon` or on its boundary. `polygon` is the ring of corners in order, open or closed (a repeated\n * first point at the end is ignored). Fewer than 3 distinct corners = false.\n */\nexport function pointInPolygon(point: LatLng, polygon: readonly LatLng[]): boolean {\n const ring = openRing(polygon);\n if (ring.length < 3) return false;\n const x = point.lng;\n const y = point.lat;\n let inside = false;\n for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n const xi = ring[i].lng, yi = ring[i].lat;\n const xj = ring[j].lng, yj = ring[j].lat;\n if (onSegment(x, y, xi, yi, xj, yj)) return true;\n if ((yi > y) !== (yj > y) && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) inside = !inside;\n }\n return inside;\n}\n\n/** The ring without a duplicated closing point. */\nfunction openRing(polygon: readonly LatLng[]): readonly LatLng[] {\n if (polygon.length > 1) {\n const first = polygon[0];\n const last = polygon[polygon.length - 1];\n if (first.lat === last.lat && first.lng === last.lng) return polygon.slice(0, -1);\n }\n return polygon;\n}\n\nfunction onSegment(px: number, py: number, ax: number, ay: number, bx: number, by: number): boolean {\n const cross = (px - ax) * (by - ay) - (py - ay) * (bx - ax);\n if (Math.abs(cross) > 1e-12) return false;\n return px >= Math.min(ax, bx) && px <= Math.max(ax, bx) && py >= Math.min(ay, by) && py <= Math.max(ay, by);\n}\n\n/** The smallest box holding every point, or null for none. Points with a non-finite coordinate are ignored. */\nexport function boundsOf(points: readonly LatLng[]): GeoBounds | null {\n let north = -Infinity, south = Infinity, east = -Infinity, west = Infinity;\n for (const p of points) {\n if (!Number.isFinite(p.lat) || !Number.isFinite(p.lng)) continue;\n if (p.lat > north) north = p.lat;\n if (p.lat < south) south = p.lat;\n if (p.lng > east) east = p.lng;\n if (p.lng < west) west = p.lng;\n }\n return north === -Infinity ? null : { north, south, east, west };\n}\n\n/**\n * The box around a circle: exact on a sphere for the latitude span (`radius / R`) and for the longitude span\n * (`asin(sin(radius / R) / cos(lat))`). Where the box would pass a pole or the antimeridian it is widened to the whole longitude range\n * (a safe, never-too-small box for a SQL prefilter: it may include a few points the exact circle test then drops).\n */\nexport function circleToBounds(center: LatLng, radiusMeters: number): GeoBounds {\n const radius = Math.max(0, radiusMeters);\n const angular = radius / EARTH_RADIUS_METERS;\n const dLat = toDeg(angular);\n const north = center.lat + dLat;\n const south = center.lat - dLat;\n if (north >= 90 || south <= -90 || angular >= Math.PI / 2) {\n return { north: Math.min(90, north), south: Math.max(-90, south), east: 180, west: -180 };\n }\n const dLng = toDeg(Math.asin(Math.sin(angular) / Math.cos(toRad(center.lat))));\n const east = center.lng + dLng;\n const west = center.lng - dLng;\n if (east > 180 || west < -180) return { north, south, east: 180, west: -180 };\n return { north, south, east, west };\n}\n\n/** The four corners of a box as a closed-less polygon ring: north-west, north-east, south-east, south-west. */\nexport function boundsToPolygon(b: GeoBounds): LatLng[] {\n return [\n { lat: b.north, lng: b.west },\n { lat: b.north, lng: b.east },\n { lat: b.south, lng: b.east },\n { lat: b.south, lng: b.west },\n ];\n}\n\n/** true when the point is inside the box or on its edge. */\nexport function boundsContains(b: GeoBounds, p: LatLng): boolean {\n return p.lat <= b.north && p.lat >= b.south && p.lng <= b.east && p.lng >= b.west;\n}\n\n/** true when two boxes share any area or edge. */\nexport function boundsIntersect(a: GeoBounds, b: GeoBounds): boolean {\n return a.south <= b.north && a.north >= b.south && a.west <= b.east && a.east >= b.west;\n}\n\nconst cross = (o: LatLng, a: LatLng, b: LatLng): number => (a.lng - o.lng) * (b.lat - o.lat) - (a.lat - o.lat) * (b.lng - o.lng);\n\n/** true when the two closed segments share at least one point (touching ends and overlapping collinear parts count). */\nexport function segmentsIntersect(a: LatLng, b: LatLng, c: LatLng, d: LatLng): boolean {\n const d1 = cross(a, b, c), d2 = cross(a, b, d), d3 = cross(c, d, a), d4 = cross(c, d, b);\n if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0))) return true;\n const within = (p: LatLng, q: LatLng, r: LatLng) =>\n r.lng >= Math.min(p.lng, q.lng) && r.lng <= Math.max(p.lng, q.lng) && r.lat >= Math.min(p.lat, q.lat) && r.lat <= Math.max(p.lat, q.lat);\n return (d1 === 0 && within(a, b, c)) || (d2 === 0 && within(a, b, d)) || (d3 === 0 && within(c, d, a)) || (d4 === 0 && within(c, d, b));\n}\n\n/**\n * true when the ring is a simple polygon: at least 3 corners, no two corners on the same spot, no edge crossing or touching another edge except neighbours\n * at their shared corner (a \"bowtie\", a figure eight or a spike that doubles back on itself is not simple). A repeated closing point is ignored.\n * Both the drawing tool and `isValidArea` refuse a polygon that is not simple, because even-odd containment is ambiguous for it.\n */\nexport function isSimplePolygon(polygon: readonly LatLng[]): boolean {\n const ring = openRing(polygon);\n const n = ring.length;\n if (n < 3) return false;\n for (let i = 0; i < n; i++) for (let j = i + 1; j < n; j++) if (ring[i].lat === ring[j].lat && ring[i].lng === ring[j].lng) return false;\n for (let i = 0; i < n; i++) {\n const a = ring[i], b = ring[(i + 1) % n];\n for (let j = i + 1; j < n; j++) {\n const c = ring[j], d = ring[(j + 1) % n];\n const adjacent = j === i + 1 || (i === 0 && j === n - 1);\n if (adjacent) {\n // neighbours meet at one corner; they may not run back along each other (collinear and pointing the same way from the shared corner)\n const shared = j === i + 1 ? b : a;\n const p = j === i + 1 ? a : b;\n const q = j === i + 1 ? d : c;\n if (cross(shared, p, q) === 0 && (p.lng - shared.lng) * (q.lng - shared.lng) + (p.lat - shared.lat) * (q.lat - shared.lat) > 0) return false;\n } else if (segmentsIntersect(a, b, c, d)) return false;\n }\n }\n return true;\n}\n\n/** true when adding `next` to the open chain `points` (the last point joins it) would make the new edge cross or touch an earlier edge (not the one it continues from). */\nexport function edgeCrossesChain(points: readonly LatLng[], next: LatLng): boolean {\n const n = points.length;\n if (points.some(p => p.lat === next.lat && p.lng === next.lng)) return true;\n if (n < 2) return false;\n const last = points[n - 1];\n for (let i = 0; i < n - 2; i++) if (segmentsIntersect(points[i], points[i + 1], last, next)) return true;\n // doubling straight back along the previous edge\n const prev = points[n - 2];\n return cross(last, prev, next) === 0 && (prev.lng - last.lng) * (next.lng - last.lng) + (prev.lat - last.lat) * (next.lat - last.lat) > 0;\n}\n","import { GeoBounds, LatLng, boundsContains, boundsOf, boundsToPolygon, circleToBounds, haversineMeters, isSimplePolygon, isValidLat, isValidLng, pointInPolygon } from './geo';\nimport { UiMapArea } from '../map.types';\n\n/** The smallest box around the area (a safe prefilter for the exact `areaContains` test; widened near the poles / antimeridian for circles). */\nexport function areaBounds(area: UiMapArea): GeoBounds | null {\n switch (area.type) {\n case 'circle': return circleToBounds(area, area.radiusMeters);\n case 'bbox': return { north: area.north, south: area.south, east: area.east, west: area.west };\n case 'polygon': return boundsOf(area.points);\n }\n}\n\n/** true when the point is inside the area (the boundary counts as inside). Same rules as the backend's SQL. */\nexport function areaContains(area: UiMapArea, point: LatLng): boolean {\n switch (area.type) {\n case 'circle': return haversineMeters(area, point) <= area.radiusMeters;\n case 'bbox': return boundsContains(area, point);\n case 'polygon': return pointInPolygon(point, area.points);\n }\n}\n\n/** The area as a polygon ring (a circle has none: null). */\nexport function areaRing(area: UiMapArea): LatLng[] | null {\n switch (area.type) {\n case 'circle': return null;\n case 'bbox': return boundsToPolygon(area);\n case 'polygon': return area.points;\n }\n}\n\n/** true when the area is well formed: valid coordinates, a radius above 0, `south < north`, `west < east`, a polygon of at least 3 points that does not cross itself. */\nexport function isValidArea(area: UiMapArea | null | undefined): area is UiMapArea {\n if (!area) return false;\n switch (area.type) {\n case 'circle':\n return isValidLat(area.lat) && isValidLng(area.lng) && Number.isFinite(area.radiusMeters) && area.radiusMeters > 0;\n case 'bbox':\n return isValidLat(area.north) && isValidLat(area.south) && isValidLng(area.east) && isValidLng(area.west) && area.south < area.north && area.west < area.east;\n case 'polygon':\n return Array.isArray(area.points) && area.points.length >= 3 && area.points.every(p => isValidLat(p.lat) && isValidLng(p.lng)) && isSimplePolygon(area.points);\n default:\n return false;\n }\n}\n\n/** Two areas are the same shape with the same numbers. */\nexport function sameArea(a: UiMapArea | null | undefined, b: UiMapArea | null | undefined): boolean {\n if (!a || !b) return !a && !b;\n if (a.type !== b.type) return false;\n switch (a.type) {\n case 'circle': { const o = b as typeof a; return a.lat === o.lat && a.lng === o.lng && a.radiusMeters === o.radiusMeters; }\n case 'bbox': { const o = b as typeof a; return a.north === o.north && a.south === o.south && a.east === o.east && a.west === o.west; }\n case 'polygon': {\n const o = b as typeof a;\n return a.points.length === o.points.length && a.points.every((p, i) => p.lat === o.points[i].lat && p.lng === o.points[i].lng);\n }\n }\n}\n","import { GeoBounds, LatLng, boundsOf } from '../geo/geo';\n\n/** Edge of the Web Mercator tile the pixel maths is based on. */\nconst TILE_SIZE = 256;\n/** Latitude limit of the Web Mercator projection. */\nconst MAX_MERCATOR_LAT = 85.0511287798;\n\nexport interface GridClusterOptions {\n /** Size of a grid cell in screen pixels: markers closer than this at the given zoom are grouped. Default 60. */\n radiusPx?: number;\n /** At this zoom and above nothing is grouped. Default 16. */\n maxZoom?: number;\n}\n\n/** A marker drawn on its own. */\nexport interface SingleMapItem<T> { kind: 'marker'; item: T }\n\n/** Two or more markers drawn as one counted circle. */\nexport interface ClusterMapItem<T> {\n kind: 'cluster';\n /** Stable for the same grid cell at the same zoom: `cluster:<zoom>:<cellX>:<cellY>`. */\n id: string;\n /** Mean position of the members. */\n lat: number;\n lng: number;\n count: number;\n members: T[];\n /** The smallest box around the members (zoom to it to open the cluster). */\n bounds: GeoBounds;\n}\n\nexport type MapItem<T> = SingleMapItem<T> | ClusterMapItem<T>;\n\n/** Web Mercator pixel position of a point at a zoom level (256 px tiles). Latitude is clamped to the projection's limit. */\nexport function projectToPixels(point: LatLng, zoom: number): { x: number; y: number } {\n const scale = TILE_SIZE * Math.pow(2, zoom);\n const lat = Math.max(-MAX_MERCATOR_LAT, Math.min(MAX_MERCATOR_LAT, point.lat));\n const sin = Math.sin((lat * Math.PI) / 180);\n return {\n x: ((point.lng + 180) / 360) * scale,\n y: (0.5 - Math.log((1 + sin) / (1 - sin)) / (4 * Math.PI)) * scale,\n };\n}\n\n/**\n * Groups markers that would overlap at `zoom` with a simple grid: each marker goes into the cell of its pixel position, a cell with one marker stays a\n * marker, a cell with several becomes one cluster at their mean position. Deterministic (output follows the order of the first member of each cell),\n * no dependency, O(n). Markers with a non-finite coordinate are left out.\n */\nexport function clusterMarkers<T extends LatLng>(items: readonly T[], zoom: number, options: GridClusterOptions = {}): MapItem<T>[] {\n const radius = options.radiusPx && options.radiusPx > 0 ? options.radiusPx : 60;\n const maxZoom = options.maxZoom ?? 16;\n const valid = items.filter(i => Number.isFinite(i.lat) && Number.isFinite(i.lng));\n if (zoom >= maxZoom) return valid.map(item => ({ kind: 'marker', item }));\n const cells = new Map<string, { cx: number; cy: number; members: T[] }>();\n for (const item of valid) {\n const { x, y } = projectToPixels(item, zoom);\n const cx = Math.floor(x / radius);\n const cy = Math.floor(y / radius);\n const key = `${cx}:${cy}`;\n const cell = cells.get(key);\n if (cell) cell.members.push(item);\n else cells.set(key, { cx, cy, members: [item] });\n }\n const out: MapItem<T>[] = [];\n for (const cell of cells.values()) {\n if (cell.members.length === 1) { out.push({ kind: 'marker', item: cell.members[0] }); continue; }\n const count = cell.members.length;\n out.push({\n kind: 'cluster',\n id: `cluster:${zoom}:${cell.cx}:${cell.cy}`,\n lat: cell.members.reduce((s, m) => s + m.lat, 0) / count,\n lng: cell.members.reduce((s, m) => s + m.lng, 0) / count,\n count,\n members: cell.members,\n bounds: boundsOf(cell.members) as GeoBounds,\n });\n }\n return out;\n}\n","import { LatLng, edgeCrossesChain, haversineMeters, isSimplePolygon, isValidLat, isValidLng } from '../geo/geo';\nimport { UiMapArea, UiMapDrawShape } from '../map.types';\n\n/** Smallest radius (metres) a drawn circle may have: a second click on the same spot is not a circle. */\nexport const MIN_DRAWN_RADIUS_METERS = 1;\n\n/** Outcome of adding a point to the session. */\nexport type DrawAddResult =\n | { status: 'added'; count: number }\n /** The shape is complete (circle: second point, rectangle: second point): `area` is the result. */\n | { status: 'finished'; area: UiMapArea }\n /**\n * The point was refused. `reason` is `invalid` (not a coordinate, the same spot as the circle's centre / the rectangle's first corner, or a point after the\n * shape is complete) or `self-intersecting` (a polygon corner whose edge would cross or touch an earlier edge).\n */\n | { status: 'rejected'; reason: 'invalid' | 'self-intersecting' };\n\n/**\n * The state of one drawing: the shape, the points clicked so far and the rules for finishing. Pure (no map, no DOM), so the click / Enter / Escape\n * behaviour of the map is exactly this class:\n * - circle: first point = centre, second point = a point on the edge; the radius is the distance between them; finishes by itself.\n * - rectangle: two opposite corners; finishes by itself. The result is the box between them.\n * - polygon: any number of corners (at least 3) that never cross: a corner whose edge would cross an earlier edge is refused (`self-intersecting`), and `finish()` (Enter /\n * the Finish button) closes it unless the closing edge would cross.\n */\nexport class DrawSession {\n private readonly _points: LatLng[] = [];\n\n constructor(readonly shape: UiMapDrawShape) {}\n\n get points(): readonly LatLng[] { return this._points; }\n\n /** How many points the shape still needs before it can finish (0 = it can finish). */\n get missing(): number {\n const need = this.shape === 'polygon' ? 3 : 2;\n return Math.max(0, need - this._points.length);\n }\n\n addPoint(point: LatLng): DrawAddResult {\n if (!isValidLat(point.lat) || !isValidLng(point.lng)) return { status: 'rejected', reason: 'invalid' };\n const p: LatLng = { lat: point.lat, lng: point.lng };\n if (this.shape !== 'polygon') {\n if (this._points.length >= 2) return { status: 'rejected', reason: 'invalid' };\n const first = this._points[0];\n if (first && (haversineMeters(first, p) < MIN_DRAWN_RADIUS_METERS || (this.shape === 'rectangle' && (first.lat === p.lat || first.lng === p.lng)))) return { status: 'rejected', reason: 'invalid' };\n this._points.push(p);\n if (this._points.length === 2) return { status: 'finished', area: this.finish() as UiMapArea };\n return { status: 'added', count: this._points.length };\n }\n if (edgeCrossesChain(this._points, p)) return { status: 'rejected', reason: 'self-intersecting' };\n this._points.push(p);\n return { status: 'added', count: this._points.length };\n }\n\n /** Removes the last point. Returns false when there was none. */\n undo(): boolean {\n return this._points.pop() !== undefined;\n }\n\n /**\n * Why `finish()` returns nothing: `too-few` while points are missing, `self-intersecting` when the closing edge of a polygon (last corner back to the first)\n * would cross another edge, null when it can finish.\n */\n get problem(): 'too-few' | 'self-intersecting' | null {\n if (this.missing > 0) return 'too-few';\n return this.shape === 'polygon' && !isSimplePolygon(this._points) ? 'self-intersecting' : null;\n }\n\n /** The finished area, or null while `problem` says why it cannot be finished. */\n finish(): UiMapArea | null {\n if (this.problem !== null) return null;\n const pts = this._points;\n switch (this.shape) {\n case 'circle':\n return { type: 'circle', lat: pts[0].lat, lng: pts[0].lng, radiusMeters: Math.max(MIN_DRAWN_RADIUS_METERS, haversineMeters(pts[0], pts[1])) };\n case 'rectangle':\n return {\n type: 'bbox',\n north: Math.max(pts[0].lat, pts[1].lat), south: Math.min(pts[0].lat, pts[1].lat),\n east: Math.max(pts[0].lng, pts[1].lng), west: Math.min(pts[0].lng, pts[1].lng),\n };\n case 'polygon':\n return { type: 'polygon', points: pts.map(p => ({ ...p })) };\n }\n }\n}\n","import { UiMapMarker } from './map.types';\n\n/** The shapes a category can get. Together with the colour they make every category readable without colour. */\nexport const PIN_SHAPES = ['circle', 'square', 'diamond', 'hexagon'] as const;\nexport type PinShape = typeof PIN_SHAPES[number];\n\n/**\n * Pin colours: dark enough for white text on them (every one is at least 4.5:1 against white) and for 3:1 against the light map tiles with the\n * white outline the pin has.\n */\nexport const PIN_COLORS = ['#1d4ed8', '#047857', '#b45309', '#be123c', '#6d28d9', '#0e7490', '#a21caf', '#475569'] as const;\n\nexport interface PinStyle { shape: PinShape; color: string }\n\n/** The sorted list of distinct categories of the markers (the key of the shape / colour assignment). */\nexport function categoriesOf(markers: readonly UiMapMarker[]): string[] {\n return Array.from(new Set(markers.map(m => m.category).filter((c): c is string => !!c))).sort((a, b) => a.localeCompare(b, 'en-US'));\n}\n\n/**\n * The look of one marker: its category's position in the sorted category list picks the colour (index mod 8) and the shape (index mod 4), so up to 8\n * categories get a unique shape + colour pair, and a marker without a category is the first colour as a circle. A `color` on the marker wins over the\n * colour (the shape stays the category's).\n */\nexport function pinStyle(marker: Pick<UiMapMarker, 'category' | 'color'>, categories: readonly string[]): PinStyle {\n const index = marker.category ? Math.max(0, categories.indexOf(marker.category)) : 0;\n return { shape: PIN_SHAPES[index % PIN_SHAPES.length], color: marker.color?.trim() || PIN_COLORS[index % PIN_COLORS.length] };\n}\n\n/** The one or two characters drawn inside a pin: the marker's `icon`, else the first letter of its label (upper case). */\nexport function pinGlyph(marker: Pick<UiMapMarker, 'icon' | 'label'>): string {\n const icon = Array.from((marker.icon ?? '').trim()).slice(0, 2).join('');\n if (icon) return icon;\n return (Array.from((marker.label ?? '').trim())[0] ?? '').toUpperCase();\n}\n\n/** Pixel size of a pin (the Leaflet icon box); the hit area is enlarged to 44px on touch screens by CSS. */\nexport const PIN_SIZE = 32;\nexport const CLUSTER_SIZE = 44;\n\n/** Builds the DOM of a pin. Text goes in with `textContent` and the colour through the CSS property API, so nothing a host sends can inject markup. */\nexport function buildPin(doc: Document, style: PinStyle, glyph: string, selected: boolean): HTMLElement {\n const pin = doc.createElement('div');\n pin.className = `ui-map__pin ui-map__pin--${style.shape}${selected ? ' ui-map__pin--selected' : ''}`;\n pin.style.setProperty('--pin-color', style.color);\n const shape = doc.createElement('span');\n shape.className = 'ui-map__pin-shape';\n const text = doc.createElement('span');\n text.className = 'ui-map__pin-glyph';\n text.textContent = glyph;\n pin.append(shape, text);\n return pin;\n}\n\n/** Builds the DOM of a cluster circle showing how many places it holds. */\nexport function buildCluster(doc: Document, countText: string): HTMLElement {\n const el = doc.createElement('div');\n el.className = 'ui-map__cluster';\n const text = doc.createElement('span');\n text.className = 'ui-map__cluster-count';\n text.textContent = countText;\n el.append(text);\n return el;\n}\n","/** Why the map can or cannot draw tiles with the configuration it was given. */\nexport type TileSourceState = 'ok' | 'none' | 'invalid' | 'no-attribution';\n\n/**\n * Checks the tile source of a `ui-map`: a template (`https://tiles.example.com/{z}/{x}/{y}.png`), the attribution text the provider requires, nothing else.\n * - no template = `none` (the map is not drawn; the places are still listed);\n * - a template that is not an `http(s):` address, a protocol-relative `//host/...` address, a root-relative `/path/...` address or a `data:image/` address\n * (`javascript:` and everything else are refused) = `invalid`;\n * - a valid template with an empty attribution = `no-attribution`: map data providers require their credit to be shown, so the map is not drawn without it.\n */\nexport function tileSourceState(template: string | null | undefined, attribution: string | null | undefined): TileSourceState {\n const t = (template ?? '').trim();\n if (!t) return 'none';\n if (/[\\u0000-\\u001f\\u007f\\\\]/.test(t)) return 'invalid';\n if (!/^(https?:\\/\\/|\\/\\/|\\/(?![\\/\\\\])|data:image\\/)/i.test(t)) return 'invalid';\n if (!(attribution ?? '').trim()) return 'no-attribution';\n return 'ok';\n}\n\n/** The subdomain letters of the `{s}` placeholder: a string of letters (\"abc\"), an array of names or nothing. Empty / invalid = Leaflet's default `abc`. */\nexport function normalizeSubdomains(value: string | readonly string[] | null | undefined): string | string[] {\n if (Array.isArray(value)) {\n const list = value.map(v => String(v).trim()).filter(Boolean);\n return list.length ? list : 'abc';\n }\n const text = typeof value === 'string' ? value.trim() : '';\n return text || 'abc';\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * How `ui-map` gets Leaflet: a function returning a promise of the Leaflet module (or of `{ default: <module> }`). The default is `() => import('leaflet')`,\n * evaluated in the browser only and only when the map can be drawn. Override it to load Leaflet another way (a CDN build, a test double):\n * `{ provide: UI_MAP_ENGINE_LOADER, useValue: () => import('./my-leaflet') }`. A rejected promise shows \"Map unavailable: the map could not be loaded\"\n * and keeps the list of places (this is also what an app without `leaflet` installed ends up with).\n */\nexport const UI_MAP_ENGINE_LOADER = new InjectionToken<() => Promise<unknown>>('UI_MAP_ENGINE_LOADER', {\n providedIn: 'root',\n factory: () => () => import('leaflet'),\n});\n","import {\n ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, NgZone, PLATFORM_ID, TemplateRef, ViewEncapsulation, computed, contentChild, effect,\n inject, input, model, output, signal, untracked, viewChild,\n} from '@angular/core';\nimport { NgTemplateOutlet, isPlatformBrowser } from '@angular/common';\nimport type * as Leaflet from 'leaflet';\nimport { ButtonComponent, UiLabelsService } from '@forgeroute/ui';\nimport { GeoBounds, LatLng, boundsContains, boundsOf, clampLat, clampLng, haversineMeters, isValidLatLng } from './geo/geo';\nimport { areaBounds, sameArea } from './geo/area';\nimport { MapItem, clusterMarkers } from './cluster/grid-cluster';\nimport { DrawSession } from './draw/draw-session';\nimport { CLUSTER_SIZE, PIN_SIZE, PinStyle, buildCluster, buildPin, categoriesOf, pinGlyph, pinStyle } from './marker-pin';\nimport { normalizeSubdomains, tileSourceState } from './tile-source';\nimport { UI_MAP_ENGINE_LOADER } from './engine-loader';\nimport { UiMapArea, UiMapBounds, UiMapDrawShape, UiMapInfoContext, UiMapMarker, UiMapView } from './map.types';\n\ntype LeafletLib = typeof Leaflet;\n\n/**\n * Marks the template of the info panel that opens for the selected marker: `<ng-template [uiMapInfo]=\"markers()\" let-marker>`.\n * Bind the markers to type the template (`marker.data` then has the host's type); the bare `<ng-template uiMapInfo let-marker>` also works.\n */\n@Directive({ selector: 'ng-template[uiMapInfo]', standalone: true })\nexport class UiMapInfoDirective<T = unknown> {\n /** Only used to infer the marker type in the template; the value is never read. */\n readonly typeFrom = input<readonly UiMapMarker<T>[] | ''>('', { alias: 'uiMapInfo' });\n readonly template = inject<TemplateRef<UiMapInfoContext<T>>>(TemplateRef);\n static ngTemplateContextGuard<T>(_dir: UiMapInfoDirective<T>, _ctx: unknown): _ctx is UiMapInfoContext<T> { return true; }\n}\n\n/** Everything that belongs to a running Leaflet map. */\ninterface Engine {\n L: LeafletLib;\n map: Leaflet.Map;\n markers: Leaflet.LayerGroup;\n area: Leaflet.LayerGroup;\n draft: Leaflet.LayerGroup;\n tiles: Leaflet.TileLayer | null;\n}\n\n/** A neutral start when there is nothing to show: the middle of the contiguous United States. Hosts pass `center` / `zoom` (or markers, which are fitted). */\nconst DEFAULT_CENTER: LatLng = { lat: 39.8283, lng: -98.5795 };\nconst DEFAULT_ZOOM = 4;\nconst IDLE_EMIT_MS = 250;\nlet nextMapId = 0;\n\n/**\n * Tile map with places, grouping, a search area and a list of places, built on Leaflet (loaded only in the browser, only when the map can be drawn).\n * Lives in its own entry point (`@forgeroute/ui/map`) so apps that never show a map never ship the map engine.\n *\n * <ui-map [markers]=\"places()\" [tileUrlTemplate]=\"tiles.url\" [tileAttribution]=\"tiles.credit\" [(selectedId)]=\"selected\"\n * [drawModes]=\"['circle','rectangle','polygon']\" [(area)]=\"searchArea\" (boundsChange)=\"load($event)\" (markerClick)=\"open($event)\">\n * <ng-template [uiMapInfo]=\"places()\" let-marker> ...details of the selected place... </ng-template>\n * </ui-map>\n *\n * Provider-agnostic: there is no built-in tile vendor. Without a tile source (or with one that has no attribution text) the map shows\n * \"Map unavailable: ...\" and the places stay available as a list - never a blank box.\n *\n * Accessibility: the map is a named group with keyboard help (arrows pan, + / - zoom); every place is in a list below it (Tab into it, Up / Down /\n * Home / End to move, Enter to select) that is the keyboard and screen-reader way to every marker; pins differ by shape AND colour AND carry a\n * glyph; the zoom, fit and drawing tools are real buttons (44px on touch screens); drawing works with the pointer (click points), the keyboard\n * (Space adds a point at the crosshair in the middle of the map, Enter finishes, Backspace removes the last point, Escape cancels) and the typed\n * form (`ui-map-area-form`); every step is announced in a polite live region. Reduced motion switches the pan / zoom animations off; forced\n * colors draw real borders.\n */\n@Component({\n selector: 'ui-map',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n // Leaflet builds its DOM itself, so emulated encapsulation could not scope its rules: they are nested under `.ui-map` instead (see map.component.scss).\n encapsulation: ViewEncapsulation.None,\n imports: [NgTemplateOutlet, ButtonComponent],\n styleUrl: './map.component.scss',\n template: `\n <div class=\"ui-map\" [class.ui-map--drawing]=\"!!drawing()\" [class.ui-map--unavailable]=\"unavailable()\" [style.--ui-map-height]=\"height()\">\n <div class=\"ui-map__stage\" (keydown)=\"onStageKey($event)\">\n @if (unavailable()) {\n <div class=\"ui-map__unavailable\" role=\"status\">\n <svg width=\"28\" height=\"28\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M9 4 3 6v14l6-2 6 2 6-2V4l-6 2-6-2z\"/><path d=\"M9 4v14M15 6v14\"/></svg>\n <p class=\"ui-map__unavailable-text\">{{ unavailableText() }}</p>\n </div>\n } @else {\n <div #canvas class=\"ui-map__canvas\" role=\"group\" [attr.aria-label]=\"regionLabel()\" [attr.aria-describedby]=\"helpId\" [attr.aria-busy]=\"loading() ? 'true' : null\"></div>\n @if (drawing()) { <div class=\"ui-map__crosshair\" aria-hidden=\"true\"></div> }\n @if (!ready() && !engineFailed()) { <div class=\"ui-map__loading\" role=\"status\">{{ labels.t('map.loading') }}</div> }\n @if (tilesFailed()) { <div class=\"ui-map__notice\" role=\"status\">{{ labels.t('map.tilesFailed') }}</div> }\n <div class=\"ui-map__controls\">\n <ui-button variant=\"secondary\" size=\"sm\" [ariaLabel]=\"labels.t('map.zoomIn')\" [disabled]=\"!ready() || !canZoomIn()\" (click)=\"onZoomButton('in')\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12 5v14M5 12h14\"/></svg>\n </ui-button>\n <ui-button variant=\"secondary\" size=\"sm\" [ariaLabel]=\"labels.t('map.zoomOut')\" [disabled]=\"!ready() || !canZoomOut()\" (click)=\"onZoomButton('out')\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M5 12h14\"/></svg>\n </ui-button>\n @if (markers().length > 0) {\n <ui-button variant=\"secondary\" size=\"sm\" [ariaLabel]=\"labels.t('map.fitMarkers')\" [disabled]=\"!ready()\" (click)=\"fitMarkers()\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5\"/></svg>\n </ui-button>\n }\n </div>\n @if (drawEnabled()) {\n <div class=\"ui-map__tools\" role=\"group\" [attr.aria-label]=\"labels.t('map.drawToolbar')\">\n @if (drawing(); as shape) {\n <p class=\"ui-map__tools-note\">{{ drawInstruction() }}</p>\n <div class=\"ui-map__tools-row\">\n <ui-button variant=\"secondary\" size=\"sm\" (click)=\"addPointAtCenter()\">{{ labels.t('map.addPointAtCenter') }}</ui-button>\n @if (draftPoints().length > 0) { <ui-button variant=\"secondary\" size=\"sm\" (click)=\"undoDrawPoint()\">{{ labels.t('map.drawUndo') }}</ui-button> }\n @if (shape === 'polygon') { <ui-button variant=\"primary\" size=\"sm\" [disabled]=\"draftPoints().length < 3\" (click)=\"finishDraw()\">{{ labels.t('map.drawFinish') }}</ui-button> }\n <ui-button variant=\"ghost\" size=\"sm\" (click)=\"cancelDraw()\">{{ labels.t('map.drawCancel') }}</ui-button>\n </div>\n } @else {\n <div class=\"ui-map__tools-row\">\n @for (shape of drawModes(); track shape) {\n <ui-button variant=\"secondary\" size=\"sm\" [disabled]=\"!ready()\" (click)=\"startDraw(shape)\">{{ drawLabel(shape) }}</ui-button>\n }\n @if (area()) { <ui-button variant=\"ghost\" size=\"sm\" (click)=\"clearArea()\">{{ labels.t('map.clearArea') }}</ui-button> }\n </div>\n @if (areaText(); as summary) { <p class=\"ui-map__tools-note\">{{ labels.t('map.areaSummary', { area: summary }) }}</p> }\n }\n </div>\n }\n @if (selectedMarker(); as marker) {\n @if (info(); as tpl) {\n <div class=\"ui-map__info\" role=\"group\" [attr.aria-label]=\"labels.t('map.infoLabel', { name: marker.ariaLabel || marker.label })\">\n <div class=\"ui-map__info-body\">\n <ng-container [ngTemplateOutlet]=\"tpl.template\" [ngTemplateOutletContext]=\"{ $implicit: marker, marker: marker }\" />\n </div>\n <ui-button variant=\"icon\" size=\"sm\" [ariaLabel]=\"labels.t('map.closeInfo')\" (click)=\"closeInfo()\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M6 6l12 12M18 6 6 18\"/></svg>\n </ui-button>\n </div>\n }\n }\n <div class=\"ui-map__attribution\">\n @if (attributionUrl(); as url) {\n <a [href]=\"url\" target=\"_blank\" rel=\"noopener noreferrer\">{{ tileAttribution() }}<span class=\"ui-map__sr\"> {{ labels.t('dataTable.opensInNewTab') }}</span></a>\n } @else {\n <span>{{ tileAttribution() }}</span>\n }\n </div>\n }\n </div>\n\n @if (!unavailable()) { <p class=\"ui-map__sr\" [id]=\"helpId\">{{ labels.t('map.keyboardHelp') }}</p> }\n <div class=\"ui-map__sr\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</div>\n\n <section class=\"ui-map__list\" [class.ui-map__list--shown]=\"showList() || unavailable()\" [attr.aria-label]=\"labels.t('map.listLabel')\">\n <div class=\"ui-map__list-head\">\n <span class=\"ui-map__list-title\">{{ labels.t('map.listLabel') }}</span>\n <span class=\"ui-map__list-count\">{{ listSummary() }}</span>\n </div>\n @if (listItems().length === 0) {\n <p class=\"ui-map__list-empty\">{{ labels.t('map.listEmpty') }}</p>\n } @else {\n <ul class=\"ui-map__places\" (keydown)=\"onListKey($event)\">\n @for (m of listItems(); track m.id) {\n @let st = styleOf(m);\n <li>\n <button type=\"button\" class=\"ui-map__place\" [class.ui-map__place--selected]=\"m.id === selectedId()\"\n [attr.aria-current]=\"m.id === selectedId() ? 'true' : null\"\n [attr.data-marker-id]=\"m.id\"\n [attr.tabindex]=\"m.id === listTabId() ? 0 : -1\"\n (focus)=\"listTab.set(m.id)\"\n (click)=\"selectFromList(m)\">\n <span class=\"ui-map__pin ui-map__pin--{{ st.shape }} ui-map__pin--inline\" [style.--pin-color]=\"st.color\" aria-hidden=\"true\">\n <span class=\"ui-map__pin-shape\"></span><span class=\"ui-map__pin-glyph\">{{ glyphOf(m) }}</span>\n </span>\n <span class=\"ui-map__place-text\">\n <span class=\"ui-map__place-label\">{{ m.label }}</span>\n @if (m.category) { <span class=\"ui-map__place-category\">{{ m.category }}</span> }\n </span>\n </button>\n </li>\n }\n </ul>\n }\n </section>\n </div>\n `,\n})\nexport class MapComponent<T = unknown> {\n protected readonly labels = inject(UiLabelsService);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly loadEngine = inject(UI_MAP_ENGINE_LOADER);\n protected readonly helpId = `ui-map-help-${nextMapId++}`;\n\n // ─── Inputs ───────────────────────────────────────────────\n /** The places. Each needs a unique `id`, `lat`, `lng` and a `label`; markers with an invalid coordinate are left out. */\n readonly markers = input<readonly UiMapMarker<T>[]>([]);\n /** Id of the selected place (two-way: `[(selectedId)]`). Choosing a place from the map or the list sets it; `null` closes the info panel. */\n readonly selectedId = model<string | null>(null);\n /** Controlled centre: the map moves there when the value changes. Leave it `null` to let the user (and `fitToMarkers`) decide. */\n readonly center = input<LatLng | null>(null);\n /** Controlled zoom level (see `center`). */\n readonly zoom = input<number | null>(null);\n /** Where the map starts when it has no markers, no `center` and no `zoom`. */\n readonly initialCenter = input<LatLng>(DEFAULT_CENTER);\n readonly initialZoom = input(DEFAULT_ZOOM);\n /**\n * true = fit the places ONCE: the first time there are any (and the user has not moved the map yet). It never refits when the places change afterwards,\n * so a host that loads places for the visible area from `boundsChange` cannot start a fit / reload loop. Use `fitKey` or `fitMarkers()` to fit again.\n */\n readonly fitToMarkers = input(true);\n /**\n * Explicit \"fit now\": every time this value changes (any value; a counter or the id of a search works) the map fits the places. Unlike `fitToMarkers` it fits\n * also after the user has moved the map. Ignored while `center` / `zoom` are controlled.\n */\n readonly fitKey = input<unknown>(undefined);\n /** Padding in pixels kept around the markers by fit-to-markers. */\n readonly fitPadding = input(40);\n /** Highest zoom a fit may use (so a single marker does not zoom to street level of nothing). */\n readonly fitMaxZoom = input(16);\n /** Tile address, e.g. `https://tiles.example.com/{z}/{x}/{y}.png` (`{s}` for subdomains, `{r}` for retina). There is no built-in vendor. */\n readonly tileUrlTemplate = input('');\n /** The credit text the tile provider requires. A tile source without it is refused (the map is not drawn). */\n readonly tileAttribution = input('');\n /** Optional link of the credit (an http(s) address). */\n readonly tileAttributionUrl = input('');\n /** Letters (`'abc'`) or names for the `{s}` placeholder. */\n readonly subdomains = input<string | readonly string[]>('abc');\n readonly minZoom = input(0);\n readonly maxZoom = input(19);\n /** true = group markers that would overlap. */\n readonly clustering = input(true);\n /** Size of the grouping grid in pixels. */\n readonly clusterRadius = input(60);\n /** From this zoom on nothing is grouped. */\n readonly clusterMaxZoom = input(16);\n /** The search-area shapes the map offers a drawing tool for (none = no drawing tools). */\n readonly drawModes = input<readonly UiMapDrawShape[]>([]);\n /** The search area (two-way: `[(area)]`): drawn on the map, or set by the host / `ui-map-area-form`. `null` = none. */\n readonly area = model<UiMapArea | null>(null);\n /** true = the area cannot be drawn or cleared (a read-only user); places can still be selected. */\n readonly readOnly = input(false);\n /** true = move the map to a new `area` that did not come from drawing. */\n readonly fitToArea = input(true);\n /** Accessible name of the map. */\n readonly ariaLabel = input<string | null>(null);\n /** Height of the map (any CSS length). */\n readonly height = input('420px');\n /** true = the list of places is always visible; otherwise it is visually hidden until one of its places has the keyboard focus. */\n readonly showList = input(false);\n /** Most places the list draws (the ones in view first). */\n readonly listLimit = input(200);\n /** Marks the map busy (the host is loading places). */\n readonly loading = input(false);\n /** How long the map waits after it stops moving before it emits `boundsChange` / `viewChange`. */\n readonly idleDelay = input(IDLE_EMIT_MS);\n /** false = the mouse wheel scrolls the page instead of zooming the map (use it when the map sits inside a long page). */\n readonly scrollWheelZoom = input(true);\n\n // ─── Outputs ──────────────────────────────────────────────\n /** The visible part of the map, after the user (or the host) stopped moving it. Also once when the map is first ready. */\n readonly boundsChange = output<UiMapBounds>();\n /** The centre and zoom, at the same moments as `boundsChange`. */\n readonly viewChange = output<UiMapView>();\n /** A place was chosen on the map or in the list. */\n readonly markerClick = output<UiMapMarker<T>>();\n\n protected readonly info = contentChild(UiMapInfoDirective<T>);\n private readonly canvas = viewChild<ElementRef<HTMLElement>>('canvas');\n\n // ─── State exposed to the host ────────────────────────────\n /** The running engine (null until Leaflet is loaded, or when the map is unavailable). Private: Leaflet's types stay out of this entry's public declarations. */\n private readonly engine = signal<Engine | null>(null);\n protected readonly engineFailed = signal(false);\n protected readonly tilesFailed = signal(false);\n protected readonly announcement = signal('');\n /** The zoom level of the map (also available before the engine runs: the initial one). */\n readonly zoomLevel = signal(DEFAULT_ZOOM);\n /** The visible part of the map; null until the map has been laid out. */\n readonly bounds = signal<UiMapBounds | null>(null);\n /** The shape being drawn, or null. */\n readonly drawing = signal<UiMapDrawShape | null>(null);\n /** The points clicked so far while drawing. */\n readonly draftPoints = signal<readonly LatLng[]>([]);\n /** true once the map is created and shown. */\n readonly ready = computed(() => this.engine() !== null);\n\n protected readonly tileState = computed(() => tileSourceState(this.tileUrlTemplate(), this.tileAttribution()));\n protected readonly unavailable = computed(() => this.tileState() !== 'ok' || this.engineFailed());\n protected readonly unavailableText = computed(() => {\n if (this.engineFailed() && this.tileState() === 'ok') return this.labels.t('map.unavailableLoadFailed');\n switch (this.tileState()) {\n case 'invalid': return this.labels.t('map.unavailableInvalidTiles');\n case 'no-attribution': return this.labels.t('map.unavailableNoAttribution');\n default: return this.labels.t('map.unavailableNoTiles');\n }\n });\n protected readonly regionLabel = computed(() => this.ariaLabel() ?? this.labels.t('map.ariaLabel'));\n protected readonly attributionUrl = computed(() => {\n const u = this.tileAttributionUrl().trim();\n return /^https?:\\/\\//i.test(u) && !/[\\s\\\\]/.test(u) ? u : null;\n });\n protected readonly drawEnabled = computed(() => !this.readOnly() && this.drawModes().length > 0);\n protected readonly canZoomIn = computed(() => this.zoomLevel() < this.maxZoom());\n protected readonly canZoomOut = computed(() => this.zoomLevel() > this.minZoom());\n\n private readonly validMarkers = computed(() => this.markers().filter(m => isValidLatLng(m)));\n protected readonly selectedMarker = computed(() => {\n const id = this.selectedId();\n return id === null ? null : this.validMarkers().find(m => m.id === id) ?? null;\n });\n private readonly categories = computed(() => categoriesOf(this.validMarkers()));\n private readonly styles = computed(() => {\n const cats = this.categories();\n return new Map(this.validMarkers().map(m => [m.id, pinStyle(m, cats)] as const));\n });\n\n /** What is drawn on the map: single markers and groups. The selected marker is never grouped, so it stays visible. */\n private readonly renderItems = computed((): MapItem<UiMapMarker<T>>[] => {\n const valid = this.validMarkers();\n const selected = this.selectedId();\n const win = this.engine() ? this.renderWindow() : null;\n const all = win ? valid.filter(m => m.id === selected || boundsContains(win.outer, m)) : valid;\n if (!this.clustering()) return all.map(item => ({ kind: 'marker', item }));\n const chosen = selected === null ? undefined : all.find(m => m.id === selected);\n const rest = chosen ? all.filter(m => m !== chosen) : all;\n const items = clusterMarkers(rest, this.zoomLevel(), { radiusPx: this.clusterRadius(), maxZoom: this.dissolveZoom() });\n return chosen ? [...items, { kind: 'marker', item: chosen }] : items;\n });\n /** The zoom from which places are never grouped: the grouping limit, but never above what the map can zoom to (or groups of equal places could not be opened). */\n private readonly dissolveZoom = computed(() => Math.min(this.clusterMaxZoom(), this.maxZoom()));\n private readonly markerSignature = computed(() => this.validMarkers().map(m => `${m.id}@${m.lat},${m.lng}`).join('|'));\n\n // ─── List of places ───────────────────────────────────────\n private readonly inView = computed(() => {\n const b = this.bounds();\n const all = this.validMarkers();\n return b && !this.unavailable() && this.engine() ? all.filter(m => boundsContains(b, m)) : all;\n });\n protected readonly listItems = computed(() => {\n const limit = Math.max(0, Math.floor(this.listLimit()));\n return this.inView().slice(0, limit);\n });\n protected readonly listSummary = computed(() => {\n const shown = this.listItems().length;\n const total = this.inView().length;\n if (shown < total) return this.labels.t('map.listShowing', { shown, total });\n return this.labels.t(total === 1 ? 'map.listCount_one' : 'map.listCount_other', { count: total });\n });\n protected readonly listTab = signal<string | null>(null);\n protected readonly listTabId = computed(() => {\n const ids = this.listItems().map(m => m.id);\n const wanted = this.listTab();\n if (wanted && ids.includes(wanted)) return wanted;\n const sel = this.selectedId();\n if (sel && ids.includes(sel)) return sel;\n return ids[0] ?? null;\n });\n protected readonly areaText = computed(() => { const a = this.area(); return a ? this.describeArea(a) : ''; });\n protected readonly drawInstruction = computed(() => {\n const shape = this.drawing();\n return shape ? this.labels.t(shape === 'circle' ? 'map.draw.circle' : shape === 'rectangle' ? 'map.draw.rectangle' : 'map.draw.polygon') : '';\n });\n\n // ─── Private state ────────────────────────────────────────\n private session: DrawSession | null = null;\n private lastDrawn: UiMapArea | null = null;\n private autoFitDone = false;\n private userMoved = false;\n private lastFitKey: unknown = undefined;\n /** A `fitKey` change that found no places: the fit waits for the places (the next change of the set of places, or `loading` ending). */\n private pendingFit = false;\n private wasLoading = false;\n /** The grouping cell (px) the drawn window was built for: a change of `clustering` / `clusterRadius` rebuilds it. */\n private windowCell = -1;\n private listenersAbort: AbortController | null = null;\n /** The area (and zoom) the places are drawn for: the visible part padded by half a screen on every side. Places outside it are neither drawn nor grouped. */\n private readonly renderWindow = signal<{ outer: GeoBounds; zoom: number } | null>(null);\n /** The visible part padded by a quarter of a screen: while the view stays inside it the drawn places are kept. */\n private renderInner: GeoBounds | null = null;\n private emitTimer: ReturnType<typeof setTimeout> | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private readonly layerById = new Map<string, { layer: Leaflet.Marker; signature: string }>();\n private readonly itemById = new Map<string, MapItem<UiMapMarker<T>>>();\n private readyWaiters: ((ok: boolean) => void)[] = [];\n private cursor: LatLng | null = null;\n /** The map's own centre at the last move (Mercator: not the middle of the bounds). */\n private centerNow: LatLng = DEFAULT_CENTER;\n\n constructor() {\n // create / destroy Leaflet with the canvas element: it exists only while the map is available\n effect(onCleanup => {\n const host = this.canvas()?.nativeElement;\n if (!host || !this.isBrowser) return;\n let cancelled = false;\n onCleanup(() => { cancelled = true; this.teardown(); });\n Promise.resolve().then(() => this.loadEngine()).then(mod => {\n if (cancelled) return;\n const L = ((mod as { default?: LeafletLib }).default ?? mod) as LeafletLib;\n this.zone.runOutsideAngular(() => this.create(L, host));\n }).catch(() => {\n if (cancelled) return;\n this.engineFailed.set(true);\n this.resolveWaiters(false);\n });\n });\n effect(() => { const e = this.engine(); if (e) { this.tileState(); this.tileUrlTemplate(); this.subdomains(); this.minZoom(); this.maxZoom(); untracked(() => this.syncTiles(e)); } });\n effect(() => { const e = this.engine(); if (e) { this.renderItems(); this.styles(); untracked(() => this.syncMarkers(e)); } });\n effect(() => { const e = this.engine(); if (e) { this.area(); untracked(() => this.syncArea(e)); } });\n effect(() => { const e = this.engine(); if (e) { this.draftPoints(); this.drawing(); untracked(() => this.syncDraft(e)); } });\n effect(() => { const e = this.engine(); if (e) { this.center(); this.zoom(); untracked(() => this.applyControlledView(e)); } });\n effect(() => { const e = this.engine(); if (e) { this.markerSignature(); this.fitToMarkers(); this.center(); this.zoom(); untracked(() => this.autoFit()); } });\n effect(() => { const e = this.engine(); if (e) { const key = this.fitKey(); untracked(() => this.fitOnKey(key)); } });\n // the window's margin depends on the grouping cell: a new radius (or grouping switched on / off) needs a new window\n effect(() => {\n const e = this.engine();\n const cell = this.clustering() ? Math.max(1, this.clusterRadius()) : 0;\n if (e) untracked(() => { if (cell !== this.windowCell) this.updateRenderWindow(e.map, this.visibleBox(e.map), true); });\n });\n // places that were being loaded have arrived: a fit that was waiting for them runs now\n effect(() => {\n const e = this.engine();\n const loading = this.loading();\n if (e) untracked(() => { if (this.wasLoading && !loading && this.pendingFit) this.autoFit(); });\n this.wasLoading = loading;\n });\n effect(() => { const e = this.engine(); if (e) { this.drawing(); untracked(() => this.syncDrawMode(e)); } });\n effect(() => {\n const e = this.engine();\n if (e) { const wheel = this.scrollWheelZoom(); untracked(() => (wheel ? e.map.scrollWheelZoom.enable() : e.map.scrollWheelZoom.disable())); }\n });\n this.destroyRef.onDestroy(() => { this.teardown(); this.resolveWaiters(false); });\n }\n\n // ─── Public API ───────────────────────────────────────────\n\n /** Resolves `true` once the map is created, `false` when it cannot be (no usable tile source, or the map engine failed to load). */\n whenReady(): Promise<boolean> {\n if (this.engine()) return Promise.resolve(true);\n if (this.unavailable()) return Promise.resolve(false);\n return new Promise<boolean>(resolve => this.readyWaiters.push(resolve));\n }\n\n /** Moves the map so every place is visible (animated unless the user prefers reduced motion; `animate = false` jumps). */\n fitMarkers(animate = !this.reducedMotion()): void {\n const e = this.engine();\n if (!e) return;\n const b = boundsOf(this.validMarkers());\n if (b) this.fitBounds(b, animate);\n }\n\n /** Moves the map so the box is visible. */\n fitBounds(b: GeoBounds, animate = !this.reducedMotion(), maxZoom = this.fitMaxZoom()): void {\n const e = this.engine();\n if (!e) return;\n const pad = Math.max(0, this.fitPadding());\n e.map.fitBounds(e.L.latLngBounds([b.south, b.west], [b.north, b.east]), { padding: [pad, pad], maxZoom, animate });\n }\n\n setView(center: LatLng, zoom?: number): void {\n const e = this.engine();\n if (!e || !isValidLatLng(center)) return;\n e.map.setView([center.lat, center.lng], zoom ?? e.map.getZoom(), { animate: !this.reducedMotion() });\n }\n\n /** Zooms one level in. A move the host makes: it does not switch the automatic first fit off (the zoom buttons of the map do, see `onZoomButton`). */\n zoomIn(): void { this.engine()?.map.zoomIn(1, { animate: !this.reducedMotion() }); }\n /** Zooms one level out (a host move, like `zoomIn`). */\n zoomOut(): void { this.engine()?.map.zoomOut(1, { animate: !this.reducedMotion() }); }\n\n /** The map's own zoom buttons: the user's zoom, so it switches the automatic first fit off (and drops a waiting fit), then zooms. */\n protected onZoomButton(direction: 'in' | 'out'): void {\n this.markUserMoved();\n if (direction === 'in') this.zoomIn(); else this.zoomOut();\n }\n\n /** The user changed the view: the automatic first fit is off for good and a fit that was waiting for places is dropped (the user's view wins). */\n private markUserMoved(): void {\n this.userMoved = true;\n this.pendingFit = false;\n }\n\n /** Re-measures the map (call it after the host resized or showed the container; a ResizeObserver already does it for normal layout changes). */\n invalidateSize(): void { this.engine()?.map.invalidateSize(); }\n\n /** Starts drawing a search area of this shape (ignored when read-only, not offered by `drawModes`, or the map is not ready). */\n startDraw(shape: UiMapDrawShape): void {\n if (this.readOnly() || !this.drawModes().includes(shape) || !this.engine()) return;\n this.session = new DrawSession(shape);\n this.cursor = null;\n this.draftPoints.set([]);\n this.drawing.set(shape);\n this.selectedId.set(null);\n this.announce(this.labels.t(shape === 'circle' ? 'map.draw.circle' : shape === 'rectangle' ? 'map.draw.rectangle' : 'map.draw.polygon'));\n }\n\n /** Adds a point where the crosshair (the middle of the map) is: the keyboard way to draw. */\n addPointAtCenter(): void {\n const e = this.engine();\n if (!e || !this.session) return;\n const c = e.map.getCenter();\n this.addDrawPoint({ lat: clampLat(c.lat), lng: clampLng(c.lng) });\n }\n\n /** Finishes a polygon (the circle and the rectangle finish by themselves at their second point). */\n finishDraw(): void {\n const s = this.session;\n if (!s) return;\n const area = s.finish();\n if (!area) {\n if (s.problem === 'self-intersecting') this.announce(this.labels.t('map.draw.finishSelfIntersecting'));\n else this.announce(this.labels.t(s.missing === 1 ? 'map.draw.needMore_one' : 'map.draw.needMore_other', { count: s.missing }));\n return;\n }\n this.commitArea(area);\n }\n\n /** Removes the last point of the drawing. */\n undoDrawPoint(): void {\n const s = this.session;\n if (!s || !s.undo()) return;\n this.draftPoints.set([...s.points]);\n this.announce(this.labels.t('map.draw.pointRemoved', { count: s.points.length }));\n }\n\n /** Stops drawing without a result. */\n cancelDraw(): void {\n if (!this.session) return;\n this.endSession();\n this.announce(this.labels.t('map.draw.cancelled'));\n }\n\n /** Removes the search area. */\n clearArea(): void {\n if (this.readOnly() || !this.area()) return;\n this.lastDrawn = null;\n this.area.set(null);\n this.announce(this.labels.t('map.draw.cleared'));\n }\n\n // ─── Template helpers ─────────────────────────────────────\n\n protected styleOf(m: UiMapMarker<T>): PinStyle { return this.styles().get(m.id) ?? pinStyle(m, this.categories()); }\n protected glyphOf(m: UiMapMarker<T>): string { return pinGlyph(m); }\n protected drawLabel(shape: UiMapDrawShape): string {\n return this.labels.t(shape === 'circle' ? 'map.drawCircle' : shape === 'rectangle' ? 'map.drawRectangle' : 'map.drawPolygon');\n }\n protected closeInfo(): void { this.selectedId.set(null); }\n\n protected selectFromList(m: UiMapMarker<T>): void {\n this.selectedId.set(m.id);\n this.markerClick.emit(m);\n this.announceSelected(m);\n this.panToMarker(m);\n }\n\n /** Says which place was chosen (and that its details are open, when the host has an info template). */\n private announceSelected(m: UiMapMarker<T>): void {\n const name = m.ariaLabel || m.label;\n this.announce(this.labels.t(this.info() ? 'map.infoLabel' : 'map.placeSelected', { name }));\n }\n\n protected onListKey(event: KeyboardEvent): void {\n const keys = ['ArrowDown', 'ArrowUp', 'Home', 'End'];\n if (!keys.includes(event.key) || event.altKey || event.ctrlKey || event.metaKey) return;\n const list = event.currentTarget as HTMLElement;\n const buttons = Array.from(list.querySelectorAll<HTMLElement>('.ui-map__place'));\n const at = buttons.indexOf(event.target as HTMLElement);\n if (at < 0) return;\n event.preventDefault();\n const next = event.key === 'Home' ? 0 : event.key === 'End' ? buttons.length - 1 : Math.min(buttons.length - 1, Math.max(0, at + (event.key === 'ArrowDown' ? 1 : -1)));\n buttons[next]?.focus();\n }\n\n /** Keyboard on the map: while drawing, Space / Enter / Backspace / Escape; otherwise Escape closes the info panel. */\n protected onStageKey(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const target = event.target as HTMLElement | null;\n const onMap = !!target?.classList.contains('leaflet-container');\n if (event.key === 'Escape') {\n if (this.session) { event.preventDefault(); this.cancelDraw(); }\n else if (this.selectedId() !== null) { event.preventDefault(); this.closeInfo(); }\n return;\n }\n if (!this.session || !onMap) return;\n if (event.key === ' ') { event.preventDefault(); this.addPointAtCenter(); }\n else if (event.key === 'Enter') { event.preventDefault(); this.finishDraw(); }\n else if (event.key === 'Backspace') { event.preventDefault(); this.undoDrawPoint(); }\n }\n\n // ─── Engine ───────────────────────────────────────────────\n\n private reducedMotion(): boolean {\n return this.isBrowser && typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;\n }\n\n private create(L: LeafletLib, host: HTMLElement): void {\n const reduced = this.reducedMotion();\n const markers = this.validMarkers();\n const box = boundsOf(markers);\n const c = this.center() ?? (box ? { lat: (box.north + box.south) / 2, lng: (box.east + box.west) / 2 } : this.initialCenter());\n const z = this.zoom() ?? this.initialZoom();\n const map = L.map(host, {\n center: [c.lat, c.lng], zoom: z, minZoom: this.minZoom(), maxZoom: this.maxZoom(), zoomControl: false, attributionControl: false,\n zoomAnimation: !reduced, fadeAnimation: !reduced, markerZoomAnimation: !reduced, inertia: !reduced, keyboard: true, scrollWheelZoom: this.scrollWheelZoom(),\n // one world, no repeats: a point (and the emitted bounds) is always inside [-180, 180]\n maxBounds: [[-90, -180], [90, 180]], maxBoundsViscosity: 1,\n });\n const engine: Engine = { L, map, markers: L.layerGroup().addTo(map), area: L.layerGroup().addTo(map), draft: L.layerGroup().addTo(map), tiles: null };\n // the new zoom and the window built for it are set together: ONE rebuild of the drawn places per zoom step (not one for zoomend and one for moveend)\n map.on('zoomend', () => this.zone.run(() => {\n this.zoomLevel.set(map.getZoom());\n this.updateRenderWindow(map, this.visibleBox(map));\n }));\n map.on('moveend', () => this.onMoveEnd(map));\n // while the map is moving (a long drag, inertia, an animation) the drawn area follows as soon as the view leaves its margin, not only at the end\n map.on('move', () => this.onMove(map));\n map.on('click', (ev: Leaflet.LeafletMouseEvent) => this.zone.run(() => this.onMapClick({ lat: clampLat(ev.latlng.lat), lng: clampLng(ev.latlng.lng) })));\n map.on('mousemove', (ev: Leaflet.LeafletMouseEvent) => this.onCursor(engine, { lat: clampLat(ev.latlng.lat), lng: clampLng(ev.latlng.lng) }));\n // anything the USER does to the view switches the automatic fit off for good (a programmatic move never does)\n map.on('dragstart boxzoomend', () => this.markUserMoved());\n this.listenersAbort = new AbortController();\n const opts = { signal: this.listenersAbort.signal, passive: true } as const;\n // a wheel turn is the user's zoom only while the map takes the wheel; with scrollWheelZoom off it scrolls the page\n host.addEventListener('wheel', () => { if (this.scrollWheelZoom()) this.markUserMoved(); }, opts);\n host.addEventListener('dblclick', () => this.markUserMoved(), opts);\n host.addEventListener('touchstart', (ev: TouchEvent) => { if (ev.touches.length > 1) this.markUserMoved(); }, opts);\n // Ctrl / Meta / Alt combinations are the browser's (page zoom, Back / Forward), not the map's: Leaflet ignores them too\n host.addEventListener('keydown', (ev: KeyboardEvent) => {\n if (!ev.ctrlKey && !ev.metaKey && !ev.altKey && /^(Arrow(Up|Down|Left|Right)|[+\\-=_])$/.test(ev.key)) this.markUserMoved();\n }, opts);\n if (typeof ResizeObserver === 'function') {\n this.resizeObserver = new ResizeObserver(() => map.invalidateSize());\n this.resizeObserver.observe(host);\n }\n this.autoFitDone = false;\n this.userMoved = false;\n this.lastFitKey = this.fitKey();\n this.pendingFit = false;\n this.renderInner = null;\n this.windowCell = -1;\n this.onMoveEnd(map); // the drawn area is known before the first marker is drawn\n this.zone.run(() => {\n this.zoomLevel.set(map.getZoom());\n this.engineFailed.set(false);\n this.engine.set(engine);\n this.resolveWaiters(true);\n });\n }\n\n private teardown(): void {\n if (this.emitTimer) { clearTimeout(this.emitTimer); this.emitTimer = null; }\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.listenersAbort?.abort();\n this.listenersAbort = null;\n const e = this.engine();\n if (e) {\n this.layerById.clear();\n this.itemById.clear();\n e.map.off();\n e.map.remove();\n this.engine.set(null);\n this.bounds.set(null);\n this.renderWindow.set(null);\n this.renderInner = null;\n }\n }\n\n private resolveWaiters(ok: boolean): void {\n const waiters = this.readyWaiters;\n this.readyWaiters = [];\n for (const w of waiters) w(ok);\n }\n\n private syncTiles(e: Engine): void {\n e.tiles?.remove();\n e.tiles = null;\n this.tilesFailed.set(false);\n if (this.tileState() !== 'ok') return;\n const tiles = e.L.tileLayer(this.tileUrlTemplate().trim(), {\n subdomains: normalizeSubdomains(this.subdomains()), minZoom: this.minZoom(), maxZoom: this.maxZoom(), attribution: '', crossOrigin: false, noWrap: true,\n });\n tiles.on('tileerror', () => this.zone.run(() => this.tilesFailed.set(true)));\n tiles.on('load', () => this.zone.run(() => this.tilesFailed.set(false)));\n tiles.addTo(e.map);\n e.tiles = tiles;\n e.map.setMinZoom(this.minZoom());\n e.map.setMaxZoom(this.maxZoom());\n }\n\n /** The map stopped moving: the `bounds` signal follows at once (the list uses it), the outputs after the idle delay. */\n private onMoveEnd(map: Leaflet.Map): void {\n const b = map.getBounds();\n const c = map.getCenter();\n // the world does not repeat: a screen wider than the world still reports [-180, 180] with west < east\n const next: UiMapBounds = {\n north: clampLat(b.getNorth()), south: clampLat(b.getSouth()), east: clampLng(b.getEast()), west: clampLng(b.getWest()), zoom: map.getZoom(),\n };\n this.centerNow = { lat: clampLat(c.lat), lng: clampLng(c.lng) };\n this.zone.run(() => {\n this.bounds.set(next);\n this.updateRenderWindow(map, next);\n });\n if (this.emitTimer) { clearTimeout(this.emitTimer); this.emitTimer = null; }\n const emit = (): void => this.zone.run(() => {\n this.boundsChange.emit(next);\n this.viewChange.emit({ center: this.centerNow, zoom: next.zoom });\n });\n const delay = Math.max(0, this.idleDelay());\n // idleDelay 0 = no debounce: emit at once\n if (delay === 0) emit();\n else this.emitTimer = setTimeout(() => { this.emitTimer = null; emit(); }, delay);\n }\n\n /** The visible part of the map, clamped to the world (no events, no signals). */\n private visibleBox(map: Leaflet.Map): UiMapBounds {\n const b = map.getBounds();\n return { north: clampLat(b.getNorth()), south: clampLat(b.getSouth()), east: clampLng(b.getEast()), west: clampLng(b.getWest()), zoom: map.getZoom() };\n }\n\n /** `move` fires all through a drag or an animation: a cheap comparison with the margin, and a rebuild only once the view is past it. */\n private onMove(map: Leaflet.Map): void {\n const inner = this.renderInner;\n if (!inner) return;\n const v = this.visibleBox(map);\n if (v.north <= inner.north && v.south >= inner.south && v.east <= inner.east && v.west >= inner.west) return;\n this.zone.run(() => this.updateRenderWindow(map, v));\n }\n\n /**\n * Rebuilds the drawn area when the zoom changed or the view left the margin of the last build; panning inside the margin keeps the drawn places.\n * The margin is at least one grouping cell: a cell that touches the visible area is then drawn whole, so no group shows a count that leaves out places\n * beyond the window's edge (inner margin >= 1 cell, outer margin >= inner + 1 cell, both at least a quarter / half of the screen).\n */\n private updateRenderWindow(map: Leaflet.Map, v: UiMapBounds, force = false): void {\n const inner = this.renderInner;\n const current = this.renderWindow();\n if (!force && inner && current && current.zoom === v.zoom && v.north <= inner.north && v.south >= inner.south && v.east <= inner.east && v.west >= inner.west) return;\n const size = map.getSize();\n const cell = this.clustering() ? Math.max(1, this.clusterRadius()) : 0;\n const inX = Math.max(size.x * 0.25, cell), inY = Math.max(size.y * 0.25, cell);\n const outX = Math.max(size.x * 0.5, inX + cell), outY = Math.max(size.y * 0.5, inY + cell);\n const grow = (mx: number, my: number): GeoBounds => {\n const nw = map.containerPointToLatLng([-mx, -my]);\n const se = map.containerPointToLatLng([size.x + mx, size.y + my]);\n return { north: clampLat(nw.lat), south: clampLat(se.lat), east: clampLng(se.lng), west: clampLng(nw.lng) };\n };\n this.windowCell = cell;\n this.renderInner = grow(inX, inY);\n this.renderWindow.set({ outer: grow(outX, outY), zoom: v.zoom });\n }\n\n private syncMarkers(e: Engine): void {\n const items = this.renderItems();\n const selected = this.selectedId();\n const keep = new Set<string>();\n const doc = e.map.getContainer().ownerDocument;\n for (const item of items) {\n const id = item.kind === 'marker' ? `m:${item.item.id}` : item.id;\n keep.add(id);\n this.itemById.set(id, item);\n let signature: string;\n let latLng: [number, number];\n let build: () => Leaflet.DivIcon;\n let title: string;\n if (item.kind === 'marker') {\n const m = item.item;\n const st = this.styles().get(m.id) ?? pinStyle(m, this.categories());\n const glyph = pinGlyph(m);\n const isSelected = m.id === selected;\n signature = `${m.lat},${m.lng}|${st.shape}|${st.color}|${glyph}|${isSelected}|${m.label}`;\n latLng = [m.lat, m.lng];\n title = m.label;\n build = () => e.L.divIcon({ html: buildPin(doc, st, glyph, isSelected), className: 'ui-map__icon', iconSize: [PIN_SIZE, PIN_SIZE], iconAnchor: [PIN_SIZE / 2, PIN_SIZE / 2] });\n } else {\n title = this.labels.t('map.clusterTitle', { count: item.count });\n signature = `${item.lat},${item.lng}|c${item.count}|${title}`;\n latLng = [item.lat, item.lng];\n build = () => e.L.divIcon({ html: buildCluster(doc, this.labels.formatNumber(item.count)), className: 'ui-map__icon', iconSize: [CLUSTER_SIZE, CLUSTER_SIZE], iconAnchor: [CLUSTER_SIZE / 2, CLUSTER_SIZE / 2] });\n }\n const existing = this.layerById.get(id);\n if (existing && existing.signature === signature) continue;\n if (existing) {\n existing.layer.setLatLng(latLng);\n existing.layer.options.title = title;\n existing.layer.setZIndexOffset(item.kind === 'marker' && item.item.id === selected ? 1000 : 0);\n existing.layer.setIcon(build());\n existing.signature = signature;\n this.markIconHidden(existing.layer);\n continue;\n }\n const layer = e.L.marker(latLng, { icon: build(), keyboard: false, title, alt: '', riseOnHover: true, zIndexOffset: item.kind === 'marker' && item.item.id === selected ? 1000 : 0 });\n layer.on('click', () => this.zone.run(() => this.onItemClick(id)));\n layer.addTo(e.markers);\n this.markIconHidden(layer);\n this.layerById.set(id, { layer, signature });\n }\n for (const [id, entry] of this.layerById) {\n if (keep.has(id)) continue;\n entry.layer.remove();\n this.layerById.delete(id);\n this.itemById.delete(id);\n }\n }\n\n /** The pins are decoration for pointer users: the list is the way for screen readers and the keyboard, so the pin icons are hidden from them. */\n private markIconHidden(layer: Leaflet.Marker): void {\n layer.getElement()?.setAttribute('aria-hidden', 'true');\n }\n\n private onItemClick(id: string): void {\n const item = this.itemById.get(id);\n if (!item) return;\n if (this.session) return;\n if (item.kind === 'cluster') {\n // zoom in far enough for the group to dissolve, whatever `fitMaxZoom` says for fitting places\n this.fitBounds(item.bounds, undefined, this.dissolveZoom());\n return;\n }\n this.selectedId.set(item.item.id);\n this.markerClick.emit(item.item);\n this.announceSelected(item.item);\n }\n\n private panToMarker(m: UiMapMarker<T>): void {\n const e = this.engine();\n if (!e) return;\n if (!e.map.getBounds().contains([m.lat, m.lng])) e.map.panTo([m.lat, m.lng], { animate: !this.reducedMotion() });\n }\n\n // ─── View ─────────────────────────────────────────────────\n\n private applyControlledView(e: Engine): void {\n const c = this.center();\n const z = this.zoom();\n if (c === null && z === null) return;\n this.pendingFit = false; // the host controls the view: a fit that was waiting would fight it (and be stale once control is given back)\n const now = e.map.getCenter();\n const target = c ?? { lat: now.lat, lng: now.lng };\n const level = z ?? e.map.getZoom();\n if (!isValidLatLng(target)) return;\n // closer than half a pixel at this zoom (the map's own rounding) is the same place: a host that feeds `viewChange` back must not make it move again\n const half = 360 / (256 * Math.pow(2, level)) / 2;\n if (Math.abs(now.lat - target.lat) < half && Math.abs(now.lng - target.lng) < half && level === e.map.getZoom()) return;\n e.map.setView([target.lat, target.lng], level, { animate: false });\n }\n\n /** The one automatic fit: the first time there are places, unless the user already moved the map or the view is controlled. */\n private autoFit(): void {\n if (this.center() !== null || this.zoom() !== null) { this.pendingFit = false; return; }\n if (this.validMarkers().length === 0) return;\n // a `fitKey` change that arrived before any place: it fits now, whatever the user did (it is the host's explicit request), and uses up the waiting fit\n if (this.pendingFit) {\n // still loading: the places may change again, so only the end of the loading (see the loading effect) fits, once, on the final set\n if (this.loading()) return;\n this.pendingFit = false;\n this.autoFitDone = true;\n this.fitMarkers(false);\n return;\n }\n if (this.autoFitDone || this.userMoved || !this.fitToMarkers()) return;\n this.autoFitDone = true;\n this.fitMarkers(false);\n }\n\n /**\n * `fitKey` changed: fit now (also after the user moved the map). With no places yet (a search whose results are still loading) nothing is fitted and the\n * fit stays PENDING until the places arrive (the next change of the set of places, or `loading` going from true to false); the first-fit rule is untouched.\n */\n private fitOnKey(key: unknown): void {\n if (Object.is(key, this.lastFitKey)) return;\n this.lastFitKey = key;\n if (this.center() !== null || this.zoom() !== null) { this.pendingFit = false; return; }\n if (this.validMarkers().length === 0 || this.loading()) { this.pendingFit = true; return; }\n this.pendingFit = false;\n this.autoFitDone = true;\n this.fitMarkers(false);\n }\n\n // ─── Area and drawing ─────────────────────────────────────\n\n private describeArea(a: UiMapArea): string {\n const n = (v: number) => this.labels.formatNumber(v, { maximumFractionDigits: 5 });\n switch (a.type) {\n case 'circle': return this.labels.t('map.area.circle', { lat: n(a.lat), lng: n(a.lng), radius: this.describeRadius(a.radiusMeters) });\n case 'bbox': return this.labels.t('map.area.bbox', { north: n(a.north), south: n(a.south), east: n(a.east), west: n(a.west) });\n case 'polygon': return this.labels.t('map.area.polygon', { count: a.points.length });\n }\n }\n\n private describeRadius(meters: number): string {\n if (meters >= 1000) return this.labels.t('map.unitKilometers', { value: this.labels.formatNumber(meters / 1000, { maximumFractionDigits: 2 }) });\n return this.labels.t('map.unitMeters', { value: this.labels.formatNumber(Math.round(meters)) });\n }\n\n private announce(text: string): void {\n this.announcement.set(text === this.announcement() ? text + ' ' : text);\n }\n\n private onMapClick(p: LatLng): void {\n if (this.session) { this.addDrawPoint(p); return; }\n if (this.selectedId() !== null) this.closeInfo();\n }\n\n private addDrawPoint(p: LatLng): void {\n const s = this.session;\n if (!s) return;\n const r = s.addPoint(p);\n if (r.status === 'rejected') { this.announce(this.labels.t(r.reason === 'self-intersecting' ? 'map.draw.selfIntersecting' : 'map.draw.rejected')); return; }\n if (r.status === 'finished') { this.commitArea(r.area); return; }\n this.draftPoints.set([...s.points]);\n this.announce(this.labels.t('map.draw.pointAdded', { count: r.count }));\n }\n\n private commitArea(area: UiMapArea): void {\n this.endSession();\n this.lastDrawn = area;\n this.area.set(area);\n this.announce(this.labels.t('map.draw.finished', { area: this.describeArea(area) }));\n }\n\n private endSession(): void {\n this.session = null;\n this.cursor = null;\n this.draftPoints.set([]);\n this.drawing.set(null);\n }\n\n private syncDrawMode(e: Engine): void {\n const drawing = this.drawing() !== null;\n const container = e.map.getContainer();\n container.classList.toggle('leaflet-crosshair', drawing);\n if (drawing) e.map.doubleClickZoom.disable(); else e.map.doubleClickZoom.enable();\n }\n\n private syncArea(e: Engine): void {\n e.area.clearLayers();\n const a = this.area();\n if (!a) return;\n const opts = { className: 'ui-map__area', interactive: false } as const;\n if (a.type === 'circle') e.L.circle([a.lat, a.lng], { ...opts, radius: a.radiusMeters }).addTo(e.area);\n else if (a.type === 'bbox') e.L.rectangle([[a.south, a.west], [a.north, a.east]], opts).addTo(e.area);\n else e.L.polygon(a.points.map(p => [p.lat, p.lng] as [number, number]), opts).addTo(e.area);\n // an area that was typed or loaded (not drawn here) is brought into view\n if (this.fitToArea() && !sameArea(a, this.lastDrawn) && this.center() === null && this.zoom() === null) {\n const b = areaBounds(a);\n if (b) this.fitBounds(b, false);\n }\n }\n\n private onCursor(e: Engine, p: LatLng): void {\n if (!this.session || this.session.points.length === 0) return;\n this.cursor = p;\n this.drawDraft(e);\n }\n\n private syncDraft(e: Engine): void { this.drawDraft(e); }\n\n /** Draws the points clicked so far and, while the pointer moves, the shape they would make with the pointer's position. */\n private drawDraft(e: Engine): void {\n e.draft.clearLayers();\n const s = this.session;\n const shape = this.drawing();\n if (!s || !shape) return;\n const pts = s.points;\n const style = { className: 'ui-map__draft', interactive: false } as const;\n const dot = { className: 'ui-map__draft-point', interactive: false, radius: 6 } as const;\n for (const p of pts) e.L.circleMarker([p.lat, p.lng], dot).addTo(e.draft);\n const cur = this.cursor;\n if (shape === 'polygon') {\n const line = pts.map(p => [p.lat, p.lng] as [number, number]);\n if (cur) line.push([cur.lat, cur.lng]);\n if (line.length > 1) (line.length > 2 ? e.L.polygon(line, style) : e.L.polyline(line, style)).addTo(e.draft);\n } else if (pts.length === 1 && cur) {\n if (shape === 'circle') {\n // the same distance the committed circle uses (DrawSession), so the preview shows the radius that will be saved\n const radius = haversineMeters(pts[0], cur);\n if (radius > 0) e.L.circle([pts[0].lat, pts[0].lng], { ...style, radius }).addTo(e.draft);\n } else {\n e.L.rectangle([[pts[0].lat, pts[0].lng], [cur.lat, cur.lng]], style).addTo(e.draft);\n }\n }\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, effect, inject, input, model, signal, untracked } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { ButtonComponent, FormRowComponent, FormSectionComponent, SelectComponent, TextInputComponent, UiLabelsService } from '@forgeroute/ui';\nimport { LatLng, isSimplePolygon, isValidLat, isValidLng } from './geo/geo';\nimport { isValidArea, sameArea } from './geo/area';\nimport { UiMapArea, UiMapDrawShape } from './map.types';\n\nexport type UiMapRadiusUnit = 'm' | 'km' | 'mi';\n\n/** Metres in one of each unit. */\nconst UNIT_METERS: Record<UiMapRadiusUnit, number> = { m: 1, km: 1000, mi: 1609.344 };\n\nconst asNumber = (value: unknown): number | null => (typeof value === 'number' && Number.isFinite(value) ? value : null);\n\n/**\n * The typed way to set a search area: the keyboard- and screen-reader-friendly twin of drawing on the map. Place it next to a `ui-map` and share\n * the area signal: `<ui-map [(area)]=\"area\" /> <ui-map-area-form [(area)]=\"area\" />`. Circle (centre latitude / longitude + radius with a unit),\n * rectangle (north / south / east / west) and polygon (add points one by one, remove any, at least 3) are supported; every field shows its own\n * message and Apply stays blocked while one is wrong. A new `area` from outside (drawn on the map, loaded from a saved search) fills the form.\n */\n@Component({\n selector: 'ui-map-area-form',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, ButtonComponent, FormRowComponent, FormSectionComponent, SelectComponent, TextInputComponent],\n styles: [`\n :host { display: block; }\n .maf-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: #0f172a; text-transform: uppercase; letter-spacing: .04em; }\n .maf-points { list-style: none; margin: 0; padding: 0; border: 1px solid #e2e8f0; border-radius: 8px; }\n .maf-points > li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 12px; font-size: 13px; color: #0f172a; }\n .maf-points > li + li { border-top: 1px solid #e2e8f0; }\n .maf-empty { margin: 0; font-size: 13px; color: #475569; }\n .maf-error { margin: 0; font-size: 12px; color: #b91c1c; }\n .maf-actions { display: flex; flex-wrap: wrap; gap: 8px; }\n .maf-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }\n @media (forced-colors: active) { .maf-points { border: 1px solid CanvasText; } .maf-error { color: CanvasText; } }\n `],\n template: `\n <ui-form-section>\n <p class=\"maf-title\">{{ labels.t('map.form.title') }}</p>\n <ui-select [label]=\"labels.t('map.form.shape')\" [options]=\"shapeOptions()\" [ngModel]=\"shape()\" (ngModelChange)=\"setShape($event)\" [disabled]=\"readOnly()\" />\n\n @switch (shape()) {\n @case ('circle') {\n <ui-form-row>\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.centerLat')\" [required]=\"true\"\n [ngModel]=\"lat()\" (ngModelChange)=\"lat.set(num($event))\" [error]=\"errors().lat\" [disabled]=\"readOnly()\" inputTestId=\"maf-lat\" />\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.centerLng')\" [required]=\"true\"\n [ngModel]=\"lng()\" (ngModelChange)=\"lng.set(num($event))\" [error]=\"errors().lng\" [disabled]=\"readOnly()\" inputTestId=\"maf-lng\" />\n </ui-form-row>\n <ui-form-row>\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.radius')\" [required]=\"true\"\n [ngModel]=\"radius()\" (ngModelChange)=\"onRadius(num($event))\" [error]=\"errors().radius\" [disabled]=\"readOnly()\" inputTestId=\"maf-radius\" />\n <ui-select [label]=\"labels.t('map.form.radiusUnit')\" [options]=\"unitOptions()\" [ngModel]=\"unit()\" (ngModelChange)=\"setUnit($event)\" [disabled]=\"readOnly()\" />\n </ui-form-row>\n }\n @case ('rectangle') {\n <ui-form-row>\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.north')\" [required]=\"true\"\n [ngModel]=\"north()\" (ngModelChange)=\"north.set(num($event))\" [error]=\"errors().north\" [disabled]=\"readOnly()\" inputTestId=\"maf-north\" />\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.south')\" [required]=\"true\"\n [ngModel]=\"south()\" (ngModelChange)=\"south.set(num($event))\" [error]=\"errors().south\" [disabled]=\"readOnly()\" inputTestId=\"maf-south\" />\n </ui-form-row>\n <ui-form-row>\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.west')\" [required]=\"true\"\n [ngModel]=\"west()\" (ngModelChange)=\"west.set(num($event))\" [error]=\"errors().west\" [disabled]=\"readOnly()\" inputTestId=\"maf-west\" />\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.east')\" [required]=\"true\"\n [ngModel]=\"east()\" (ngModelChange)=\"east.set(num($event))\" [error]=\"errors().east\" [disabled]=\"readOnly()\" inputTestId=\"maf-east\" />\n </ui-form-row>\n }\n @case ('polygon') {\n <ui-form-row>\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.pointLat')\"\n [ngModel]=\"pointLat()\" (ngModelChange)=\"pointLat.set(num($event))\" [error]=\"errors().pointLat\" [disabled]=\"readOnly()\" inputTestId=\"maf-point-lat\" />\n <ui-text-input type=\"number\" valueType=\"number\" inputmode=\"decimal\" [label]=\"labels.t('map.form.pointLng')\"\n [ngModel]=\"pointLng()\" (ngModelChange)=\"pointLng.set(num($event))\" [error]=\"errors().pointLng\" [disabled]=\"readOnly()\" inputTestId=\"maf-point-lng\" />\n </ui-form-row>\n <div class=\"maf-actions\">\n <ui-button variant=\"secondary\" size=\"sm\" [disabled]=\"readOnly()\" (click)=\"addPoint()\">{{ labels.t('map.form.addPoint') }}</ui-button>\n </div>\n <div role=\"group\" [attr.aria-label]=\"labels.t('map.form.pointsLabel')\" (focusout)=\"pointsTouched.set(true)\">\n @if (points().length === 0) {\n <p class=\"maf-empty\">{{ labels.t('map.form.noPoints') }}</p>\n } @else {\n <ul class=\"maf-points\">\n @for (p of points(); track $index) {\n <li>\n <span>{{ labels.t('map.form.pointItem', { n: $index + 1, lat: fmt(p.lat), lng: fmt(p.lng) }) }}</span>\n <ui-button variant=\"ghost\" size=\"sm\" [disabled]=\"readOnly()\" [ariaLabel]=\"labels.t('map.form.removePoint', { n: $index + 1 })\" (click)=\"removePoint($index)\">\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M6 6l12 12M18 6 6 18\"/></svg>\n </ui-button>\n </li>\n }\n </ul>\n }\n @if (pointsMessage(); as message) { <p class=\"maf-error\" role=\"alert\">{{ message }}</p> }\n </div>\n }\n }\n\n <div class=\"maf-actions\">\n <ui-button variant=\"primary\" size=\"sm\" [disabled]=\"readOnly() || (touched() && hasErrors())\" (click)=\"apply()\">{{ labels.t('map.form.apply') }}</ui-button>\n <ui-button variant=\"ghost\" size=\"sm\" [disabled]=\"readOnly() || !area()\" (click)=\"clear()\">{{ labels.t('map.form.clear') }}</ui-button>\n </div>\n <div class=\"maf-sr\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</div>\n </ui-form-section>\n `,\n})\nexport class MapAreaFormComponent {\n protected readonly labels = inject(UiLabelsService);\n\n /** The search area (two-way: `[(area)]`). Apply sets it, Clear sets it to `null`; a value that arrives from outside fills the form. */\n readonly area = model<UiMapArea | null>(null);\n /** Which shapes the shape select offers. */\n readonly shapes = input<readonly UiMapDrawShape[]>(['circle', 'rectangle', 'polygon']);\n /** The unit the radius field starts in. */\n readonly defaultUnit = input<UiMapRadiusUnit>('mi');\n /** true = every field and button is disabled (a read-only user). */\n readonly readOnly = input(false);\n\n protected readonly shape = signal<UiMapDrawShape>('circle');\n protected readonly unit = signal<UiMapRadiusUnit>('mi');\n protected readonly lat = signal<number | null>(null);\n protected readonly lng = signal<number | null>(null);\n /** What the radius field SHOWS, in the chosen unit (rounded to 6 decimals for display only). */\n protected readonly radius = signal<number | null>(null);\n /** The radius in metres, exact: what Apply saves. Switching the unit only changes how it is shown, so m -> mi -> m never drifts. */\n private readonly meters = signal<number | null>(null);\n protected readonly north = signal<number | null>(null);\n protected readonly south = signal<number | null>(null);\n protected readonly east = signal<number | null>(null);\n protected readonly west = signal<number | null>(null);\n protected readonly pointLat = signal<number | null>(null);\n protected readonly pointLng = signal<number | null>(null);\n protected readonly points = signal<LatLng[]>([]);\n /** Errors show after the first Apply (or Add point), not while the user is still typing the first value. */\n protected readonly touched = signal(false);\n /** True once the user worked with the point list (added or removed a point, or moved focus out of the list). */\n protected readonly pointsTouched = signal(false);\n protected readonly pointTouched = signal(false);\n protected readonly announcement = signal('');\n\n private lastApplied: UiMapArea | null = null;\n private unitChosen = false;\n\n protected readonly shapeOptions = computed(() => this.shapes().map(value => ({\n value,\n label: this.labels.t(value === 'circle' ? 'map.form.circle' : value === 'rectangle' ? 'map.form.rectangle' : 'map.form.polygon'),\n })));\n protected readonly unitOptions = computed(() => [\n { value: 'm', label: this.labels.t('map.form.unitM') },\n { value: 'km', label: this.labels.t('map.form.unitKm') },\n { value: 'mi', label: this.labels.t('map.form.unitMi') },\n ]);\n\n /** The message of every field (an empty string = fine). */\n protected readonly errors = computed(() => {\n const show = this.touched();\n const latMsg = (v: number | null) => (v === null ? this.labels.t('map.form.errorNumber') : isValidLat(v) ? '' : this.labels.t('map.form.errorLat'));\n const lngMsg = (v: number | null) => (v === null ? this.labels.t('map.form.errorNumber') : isValidLng(v) ? '' : this.labels.t('map.form.errorLng'));\n const r = this.radius();\n const n = this.north(), s = this.south(), e = this.east(), w = this.west();\n const out = { lat: '', lng: '', radius: '', north: '', south: '', east: '', west: '', pointLat: '', pointLng: '', points: '' };\n if (show) {\n if (this.shape() === 'circle') {\n out.lat = latMsg(this.lat());\n out.lng = lngMsg(this.lng());\n out.radius = r === null ? this.labels.t('map.form.errorNumber') : r > 0 ? '' : this.labels.t('map.form.errorRadius');\n } else if (this.shape() === 'rectangle') {\n out.north = latMsg(n);\n out.south = latMsg(s);\n out.east = lngMsg(e);\n out.west = lngMsg(w);\n if (!out.north && !out.south && n! <= s!) out.north = this.labels.t('map.form.errorNorthSouth');\n if (!out.east && !out.west && e! <= w!) out.east = this.labels.t('map.form.errorEastWest');\n } else if (this.points().length < 3) {\n out.points = this.labels.t('map.form.errorPolygon');\n } else if (!isSimplePolygon(this.points())) {\n out.points = this.labels.t('map.form.errorSelfIntersecting');\n }\n }\n if (this.pointTouched()) {\n out.pointLat = latMsg(this.pointLat());\n out.pointLng = lngMsg(this.pointLng());\n }\n return out;\n });\n /** The polygon message under the point list: only after a failed Apply AND the user worked with the list (added/removed a point or left it); a failed Apply on an untouched polygon (empty, or 1-2 points that arrived from outside) shows nothing there. */\n protected readonly pointsMessage = computed(() => this.touched() && this.pointsTouched() ? this.errors().points : '');\n /**\n * Whether the SHAPE has a problem (what Apply cares about). The messages of the \"add a point\" fields belong to Add point: a half-typed point never blocks\n * Apply of a polygon that is already valid (it is simply not part of the area).\n */\n protected readonly hasErrors = computed(() => Object.entries(this.errors()).some(([field, m]) => m !== '' && field !== 'pointLat' && field !== 'pointLng'));\n\n constructor() {\n effect(() => { const unit = this.defaultUnit(); untracked(() => { if (!this.unitChosen) this.unit.set(unit); }); });\n effect(() => {\n const a = this.area();\n untracked(() => {\n if (a === null) { if (this.lastApplied !== null) this.reset(); return; }\n if (sameArea(a, this.lastApplied)) return;\n this.fillFrom(a);\n });\n });\n }\n\n // ─── Template handlers ────────────────────────────────────\n\n protected num(value: unknown): number | null { return asNumber(value); }\n\n /** The user typed a radius: it is in the unit chosen now. */\n protected onRadius(value: number | null): void {\n this.radius.set(value);\n this.meters.set(value === null ? null : value * UNIT_METERS[this.unit()]);\n }\n protected fmt(value: number): string { return this.labels.formatNumber(value, { maximumFractionDigits: 6 }); }\n\n protected setShape(value: string): void {\n if (value !== 'circle' && value !== 'rectangle' && value !== 'polygon') return;\n this.shape.set(value);\n this.touched.set(false);\n this.pointsTouched.set(false);\n this.pointTouched.set(false);\n }\n\n /** Changing the unit keeps the length the user means: 2 miles becomes 3.218688 km, not 2 km. */\n protected setUnit(value: string): void {\n if (value !== 'm' && value !== 'km' && value !== 'mi') return;\n this.unitChosen = true;\n const m = this.meters();\n if (m !== null) this.radius.set(this.round(m / UNIT_METERS[value]));\n this.unit.set(value);\n }\n\n protected addPoint(): void {\n this.pointTouched.set(true);\n this.pointsTouched.set(true);\n const la = this.pointLat();\n const ln = this.pointLng();\n if (la === null || ln === null || !isValidLat(la) || !isValidLng(ln)) return;\n this.points.update(list => [...list, { lat: la, lng: ln }]);\n this.pointLat.set(null);\n this.pointLng.set(null);\n this.pointTouched.set(false);\n }\n\n protected removePoint(index: number): void {\n this.pointsTouched.set(true);\n this.points.update(list => list.filter((_, i) => i !== index));\n }\n\n protected apply(): void {\n this.touched.set(true);\n if (this.hasErrors()) return;\n const next = this.build();\n if (!next || !isValidArea(next)) return;\n this.lastApplied = next;\n this.area.set(next);\n this.announce(this.labels.t('map.form.applied'));\n }\n\n protected clear(): void {\n this.reset();\n this.lastApplied = null;\n this.area.set(null);\n this.announce(this.labels.t('map.draw.cleared'));\n }\n\n // ─── Internals ────────────────────────────────────────────\n\n private build(): UiMapArea | null {\n switch (this.shape()) {\n case 'circle': {\n const lat = this.lat(), lng = this.lng(), m = this.meters();\n if (lat === null || lng === null || m === null) return null;\n return { type: 'circle', lat, lng, radiusMeters: m };\n }\n case 'rectangle': {\n const n = this.north(), s = this.south(), e = this.east(), w = this.west();\n if (n === null || s === null || e === null || w === null) return null;\n return { type: 'bbox', north: n, south: s, east: e, west: w };\n }\n case 'polygon':\n return { type: 'polygon', points: this.points().map(p => ({ ...p })) };\n }\n }\n\n private fillFrom(a: UiMapArea): void {\n this.touched.set(false);\n this.pointsTouched.set(false);\n this.pointTouched.set(false);\n if (a.type === 'circle') {\n this.shape.set('circle');\n this.lat.set(a.lat);\n this.lng.set(a.lng);\n this.meters.set(a.radiusMeters);\n this.radius.set(this.round(a.radiusMeters / UNIT_METERS[this.unit()]));\n } else if (a.type === 'bbox') {\n this.shape.set('rectangle');\n this.north.set(a.north);\n this.south.set(a.south);\n this.east.set(a.east);\n this.west.set(a.west);\n } else {\n this.shape.set('polygon');\n this.points.set(a.points.map(p => ({ ...p })));\n }\n }\n\n private reset(): void {\n this.touched.set(false);\n this.pointsTouched.set(false);\n this.pointTouched.set(false);\n for (const s of [this.lat, this.lng, this.radius, this.north, this.south, this.east, this.west, this.pointLat, this.pointLng]) s.set(null);\n this.points.set([]);\n this.meters.set(null);\n }\n\n private round(v: number): number { return Math.round(v * 1e6) / 1e6; }\n\n private announce(text: string): void {\n this.announcement.set(text === this.announcement() ? text + ' ' : text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