{"version":3,"file":"types.cjs","names":[],"sources":["../../src/geo/types.ts"],"sourcesContent":["/**\n * WGS84 geographic coordinate. Mirrors the `Coordinate` schema from\n * `tempest-fastapi-sdk` (`geo/schemas.py`) — `latitude` in `[-90, 90]`,\n * `longitude` in `[-180, 180]`, serialized snake_case on the wire.\n */\nexport interface Coordinate {\n    /** WGS84 latitude in degrees, `[-90, 90]`. E.g. `-23.5505`. */\n    latitude: number;\n    /** WGS84 longitude in degrees, `[-180, 180]`. E.g. `-46.6333`. */\n    longitude: number;\n}\n\n/**\n * A pin plotted on a map: a {@link Coordinate} plus optional presentation and\n * an identity used for click callbacks. Shared by `TrajectoryMap` and the\n * Brazil maps' `markers` prop.\n */\nexport interface GeoMarker extends Coordinate {\n    /** Stable identity (returned by click handlers). Falls back to the index. */\n    id?: string;\n    /** Tooltip / accessible label for the pin. */\n    label?: string;\n    /** Fill color. Defaults to the primary token. */\n    color?: string;\n    /** Radius in pixels. Default: 6. */\n    radius?: number;\n}\n\n/**\n * A single sample in a recorded trajectory: a {@link Coordinate} stamped with\n * the epoch millisecond it was captured, plus the optional accuracy radius\n * reported by the Geolocation API.\n */\nexport interface TrackPoint extends Coordinate {\n    /** Capture time in epoch milliseconds (`GeolocationPosition.timestamp`). */\n    timestamp: number;\n    /** Horizontal accuracy radius in meters, if the device reported one. */\n    accuracy?: number;\n}\n\n/**\n * Travel mode. Mirrors the `TravelMode` string enum from `tempest-fastapi-sdk`\n * (`geo/enums.py`) — the on-the-wire value is the raw string.\n */\nexport type TravelMode = \"car\" | \"motorcycle\" | \"bus\";\n\n/**\n * Estimated travel between two coordinates. Mirrors the `TravelEstimate`\n * schema from `tempest-fastapi-sdk` (`geo/schemas.py`), snake_case preserved so\n * a response deserializes straight into this type.\n */\nexport interface TravelEstimate {\n    /** Travel mode the estimate was computed for. */\n    mode: TravelMode;\n    /** Great-circle distance scaled by circuity, in kilometers (`>= 0`). */\n    distance_km: number;\n    /** Estimated duration in minutes (`>= 0`). */\n    duration_minutes: number;\n    /** How the estimate was produced. `\"heuristic\"` (offline) or `\"osrm\"`. */\n    source: \"heuristic\" | \"osrm\";\n}\n\n/**\n * Axis-aligned geographic bounding box. `min`/`max` follow the same degree\n * ranges as {@link Coordinate}.\n */\nexport interface GeoBounds {\n    minLatitude: number;\n    maxLatitude: number;\n    minLongitude: number;\n    maxLongitude: number;\n}\n\n/** True when `value` is a finite latitude in `[-90, 90]`. */\nexport function isValidLatitude(value: number): boolean {\n    return Number.isFinite(value) && value >= -90 && value <= 90;\n}\n\n/** True when `value` is a finite longitude in `[-180, 180]`. */\nexport function isValidLongitude(value: number): boolean {\n    return Number.isFinite(value) && value >= -180 && value <= 180;\n}\n\n/**\n * Type guard for {@link Coordinate}: an object with finite, in-range\n * `latitude` and `longitude`.\n */\nexport function isCoordinate(value: unknown): value is Coordinate {\n    if (typeof value !== \"object\" || value === null) return false;\n    const candidate = value as Record<string, unknown>;\n    return (\n        typeof candidate.latitude === \"number\" &&\n        typeof candidate.longitude === \"number\" &&\n        isValidLatitude(candidate.latitude) &&\n        isValidLongitude(candidate.longitude)\n    );\n}\n\n/** Clamp a latitude into the valid `[-90, 90]` range. */\nexport function clampLatitude(latitude: number): number {\n    return Math.min(90, Math.max(-90, latitude));\n}\n\n/**\n * Normalize a longitude into the `[-180, 180]` range, wrapping values that\n * cross the antimeridian (e.g. `190` → `-170`).\n */\nexport function normalizeLongitude(longitude: number): number {\n    const wrapped = ((((longitude + 180) % 360) + 360) % 360) - 180;\n    return wrapped;\n}\n"],"mappings":"AA0EA,SAAgB,EAAgB,EAAwB,CACpD,OAAO,OAAO,SAAS,CAAK,GAAK,GAAS,KAAO,GAAS,EAC9D,CAGA,SAAgB,EAAiB,EAAwB,CACrD,OAAO,OAAO,SAAS,CAAK,GAAK,GAAS,MAAQ,GAAS,GAC/D,CAMA,SAAgB,EAAa,EAAqC,CAC9D,GAAI,OAAO,GAAU,WAAY,EAAgB,MAAO,GACxD,IAAM,EAAY,EAClB,OACI,OAAO,EAAU,UAAa,UAC9B,OAAO,EAAU,WAAc,UAC/B,EAAgB,EAAU,QAAQ,GAClC,EAAiB,EAAU,SAAS,CAE5C,CAGA,SAAgB,EAAc,EAA0B,CACpD,OAAO,KAAK,IAAI,GAAI,KAAK,IAAI,IAAK,CAAQ,CAAC,CAC/C,CAMA,SAAgB,EAAmB,EAA2B,CAE1D,QADoB,EAAY,KAAO,IAAO,KAAO,IAAO,GAEhE"}