import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);

// src/pr-url-detector.ts
var PR_URL_REGEX = /https:\/\/github\.com\/[^/\s"]+\/[^/\s"]+\/pull\/\d+/g;
var PR_CREATION_RECENCY_MS = 5 * 60 * 1e3;
function findPrUrl(text) {
  return findPrUrls(text)[0] ?? null;
}
function findPrUrls(text) {
  return [...new Set(text.match(PR_URL_REGEX) ?? [])];
}
function wasCreatedByLogin(author, login) {
  if (!author || !login) return false;
  return author.toLowerCase() === login.toLowerCase();
}
function wasCreatedRecently(createdAtIso, nowMs, maxAgeMs = PR_CREATION_RECENCY_MS) {
  if (!createdAtIso) return false;
  const createdAt = new Date(createdAtIso);
  if (Number.isNaN(createdAt.getTime())) return false;
  return createdAt.getTime() >= nowMs - maxAgeMs;
}
export {
  PR_CREATION_RECENCY_MS,
  findPrUrl,
  findPrUrls,
  wasCreatedByLogin,
  wasCreatedRecently
};
//# sourceMappingURL=pr-url-detector.js.map