"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.secondsToReadable = secondsToReadable; exports.printNetworkError = printNetworkError; const axios_1 = __importDefault(require("axios")); const logger_1 = require("./logger"); function secondsToReadable(secs, roundToMinutes = false) { const totalSeconds = roundToMinutes ? Math.round(secs / 60) * 60 : secs; var days = Math.floor(totalSeconds / (3600 * 24)); var hours = Math.floor((totalSeconds % (3600 * 24)) / 3600); var minutes = Math.floor((totalSeconds % 3600) / 60); var seconds = Math.floor(totalSeconds % 60); var dayDisplay = days > 0 ? days + (days === 1 ? " day, " : " days, ") : ""; var hourDisplay = hours > 0 ? hours + (hours === 1 ? " hour, " : " hours, ") : ""; var minuteDisplay = minutes > 0 ? minutes + (minutes === 1 ? " minute, " : " minutes, ") : ""; var secondDisplay = seconds > 0 ? seconds + (seconds === 1 ? " second" : " seconds") : ""; return (dayDisplay + hourDisplay + minuteDisplay + secondDisplay).replace(/,\s*$/, ""); } function printNetworkError(error) { if (axios_1.default.isAxiosError(error)) { (0, logger_1.logError)("Axios error details:", { message: error.message, status: error.response?.status, statusText: error.response?.statusText, data: error.response?.data, url: error.config?.url, }); } else { (0, logger_1.logError)("Unexpected error:", error); } }