const COORDINATE_RANGES = {
  latitude: { min: -90, max: 90 },
  longitude: { min: -180, max: 180 }
};
const DECIMAL_INPUT_PATTERN = /^[+-]?(\d+([.,]\d+)?|[.,]\d+)$/;
function parseCoordinate(trimmed) {
  if (!DECIMAL_INPUT_PATTERN.test(trimmed)) return null;
  const parsed = Number.parseFloat(trimmed.replace(",", "."));
  return Number.isFinite(parsed) ? parsed : null;
}
function validateCoordinateInput(kind, value) {
  const trimmed = typeof value === "string" ? value.trim() : "";
  if (!trimmed.length) return { status: "empty" };
  const parsed = parseCoordinate(trimmed);
  if (parsed === null) return { status: "invalid" };
  const { min, max } = COORDINATE_RANGES[kind];
  if (parsed < min || parsed > max) return { status: "outOfRange", min, max };
  return { status: "valid", value: parsed };
}
function normalizeCoordinateInput(value) {
  const trimmed = typeof value === "string" ? value.trim() : "";
  if (!trimmed.length) return void 0;
  const parsed = parseCoordinate(trimmed);
  return parsed === null ? void 0 : parsed;
}
export {
  COORDINATE_RANGES,
  normalizeCoordinateInput,
  validateCoordinateInput
};
//# sourceMappingURL=coordinates.js.map
