function f(t) {
  return typeof t == "string" ? t : !t || !Array.isArray(t) ? "" : t.filter((o) => o.type === "text").map((o) => o.text).join(" ");
}
function s(t) {
  return t.type === "ai";
}
function l(t) {
  return s(t) ? t.tool_calls && t.tool_calls.length > 0 ? !0 : Array.isArray(t.content) ? t.content.some(
    (r) => typeof r == "object" && r !== null && "type" in r && r.type === "tool_use"
  ) : !1 : !1;
}
function a(t) {
  return t.type === "tool";
}
function u(t) {
  const r = /* @__PURE__ */ new Date(), o = new Date(t), i = r.getTime() - o.getTime(), e = Math.floor(i / (1e3 * 60 * 60 * 24));
  if (e === 0)
    return "Today";
  if (e === 1)
    return "Yesterday";
  if (e < 7)
    return `${e} day${e > 1 ? "s" : ""} ago`;
  if (e < 30) {
    const n = Math.floor(e / 7);
    return `${n} week${n > 1 ? "s" : ""} ago`;
  } else {
    const n = Math.floor(e / 30);
    return `${n} month${n > 1 ? "s" : ""} ago`;
  }
}
export {
  u as formatRelativeTime,
  f as getContentString,
  s as isAIMessage,
  l as isAiWithToolCalls,
  a as isToolMessage
};
//# sourceMappingURL=utils.es.js.map
