import lodash from "lodash";
const convertDuration = (durationInMinutes, t) => {
  if (!lodash.isNumber(durationInMinutes)) {
    return "";
  }
  if (durationInMinutes < 60) {
    return t("VerticalEmbed_Units_Minute", { minutes: durationInMinutes });
  }
  const hours = durationInMinutes / 60;
  const rhours = Math.floor(hours);
  const minutes = (hours - rhours) * 60;
  const rminutes = Math.round(minutes);
  const durationInHours = rminutes === 0 ? t("VerticalEmbed_Units_Hour", { hours: rhours }) : t("VerticalEmbed_Units_Hour", { hours: rhours }) + " " + t("VerticalEmbed_Units_Minute", { minutes: rminutes });
  return durationInHours;
};
const convertDurations = (durations, t) => {
  if (!durations || durations.length === 0) {
    return "";
  }
  if (durations.length === 1) {
    return convertDuration(durations[0], t);
  }
  const minDuration = Math.min(...durations);
  const maxDuration = Math.max(...durations);
  const minFormatted = convertDuration(minDuration, t);
  const maxFormatted = convertDuration(maxDuration, t);
  return `${minFormatted} - ${maxFormatted}`;
};
export {
  convertDuration,
  convertDurations
};
//# sourceMappingURL=convert-duration.js.map
