import { isValidDateRangePreset } from "@open-mercato/ui/backend/date-range";
import { isValidGranularity } from "../../../lib/aggregations.js";
const DEFAULT_SETTINGS = {
  dateRange: "last_30_days",
  granularity: "day",
  showArea: true
};
function hydrateSettings(raw) {
  if (!raw || typeof raw !== "object") return { ...DEFAULT_SETTINGS };
  const obj = raw;
  return {
    dateRange: isValidDateRangePreset(obj.dateRange) ? obj.dateRange : DEFAULT_SETTINGS.dateRange,
    granularity: isValidGranularity(obj.granularity) ? obj.granularity : DEFAULT_SETTINGS.granularity,
    showArea: typeof obj.showArea === "boolean" ? obj.showArea : DEFAULT_SETTINGS.showArea
  };
}
export {
  DEFAULT_SETTINGS,
  hydrateSettings
};
//# sourceMappingURL=config.js.map
