const TAU_DAYS = 30;
const MS_PER_DAY = 864e5;
function recencyMultiplier(publishedDate, now = /* @__PURE__ */ new Date()) {
  if (!publishedDate) return 1;
  const parsed = new Date(publishedDate);
  const t = parsed.getTime();
  if (Number.isNaN(t)) return 1;
  const ageMs = Math.max(0, now.getTime() - t);
  const ageDays = ageMs / MS_PER_DAY;
  const raw = 1 + Math.exp(-ageDays / TAU_DAYS);
  if (raw < 1) return 1;
  if (raw > 2) return 2;
  return raw;
}
const TEMPORAL_WORD_RE = /\b(latest|today|yesterday|this week|this month|this year|news|breaking|recent|update|now|current)\b/i;
const TEMPORAL_YEAR_RE = /\b(20[2-3][0-9])\b/;
const TEMPORAL_LAST_RE = /\blast\s+\d+\s+(day|days|week|weeks|month|months|year|years)\b/i;
const TEMPORAL_PAST_RE = /\bpast\s+\d+\s+(day|days|week|weeks|month|months|year|years)\b/i;
function hasTemporalIntent(query) {
  if (!query) return false;
  if (TEMPORAL_WORD_RE.test(query)) return true;
  if (TEMPORAL_YEAR_RE.test(query)) {
    const m = query.match(TEMPORAL_YEAR_RE);
    if (m) {
      const y = Number(m[1]);
      if (y >= 2020 && y <= 2030) return true;
    }
  }
  if (TEMPORAL_LAST_RE.test(query)) return true;
  if (TEMPORAL_PAST_RE.test(query)) return true;
  return false;
}
export {
  hasTemporalIntent,
  recencyMultiplier
};
//# sourceMappingURL=recency-boost.js.map