export const AUTO_REFRESH_IDLE_MS = 10_000; export const AUTO_REFRESH_REPEAT_MS = 30_000; export interface AutoRefreshState { now: number; lastInteractionAt: number; lastRefreshAt: number; connected: boolean; busy: boolean; editing: boolean; dragging: boolean; visible: boolean; } export function shouldAutoRefresh(state: AutoRefreshState): boolean { return state.connected && state.visible && !state.busy && !state.editing && !state.dragging && state.now - state.lastInteractionAt >= AUTO_REFRESH_IDLE_MS && state.now - state.lastRefreshAt >= AUTO_REFRESH_REPEAT_MS; }