function padStart(v: string | number, len = 2, str = "0"): string {
   v = String(v)
   if (v.length >= 2) return v
   for (let i = 0, l = len - v.length; i < l; i++) {
      v = str + v
   }
   return v
}
export function formatTime(seconds: number): string {
   if (!isFinite(seconds)) return "-"
   if (seconds <= 0) return "00:00"

   seconds = Math.ceil(seconds)
   if (seconds < 60) return `00:${padStart(seconds)}`
   if (seconds < 3600) {
      return `${padStart(Math.floor(seconds / 60))}:${padStart(seconds % 60)}`
   }
   return `${padStart(Math.floor(seconds / 3600))}:${padStart(Math.floor((seconds % 3600) / 60))}:${padStart(seconds % 60)}`
}
