import { x as resolveDateTimestampMs } from "./number-coercion-CU7MBp2A.js";
import { a as resolveUserTimezone, i as resolveUserTimeFormat, n as formatUserTime } from "./date-time-BdpeJWA0.js";
//#region src/agents/current-time.ts
function resolveCronStyleNow(cfg, nowMs) {
	const userTimezone = resolveUserTimezone(cfg.agents?.defaults?.userTimezone);
	const userTimeFormat = resolveUserTimeFormat(cfg.agents?.defaults?.timeFormat);
	const timestampMs = resolveDateTimestampMs(nowMs);
	const date = new Date(timestampMs);
	const formattedTime = formatUserTime(date, userTimezone, userTimeFormat) ?? date.toISOString();
	return {
		userTimezone,
		formattedTime,
		timeLine: `Current time: ${formattedTime} (${userTimezone})\nReference UTC: ${date.toISOString().replace("T", " ").slice(0, 16) + " UTC"}`
	};
}
function appendCronStyleCurrentTimeLine(text, cfg, nowMs) {
	const base = text.trimEnd();
	if (!base || base.includes("Current time:")) return base;
	const { timeLine } = resolveCronStyleNow(cfg, nowMs);
	return `${base}\n${timeLine}`;
}
//#endregion
export { resolveCronStyleNow as n, appendCronStyleCurrentTimeLine as t };
