"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getAgeRange = void 0;
var _locale = require("@mirai/locale");
const UNDEFINED_MAX = 99; // ! TODO: Backend team should not return this value.

const L10N = {
  LABEL_AGE_FROM: {
    id: 'common.label.age_from'
  },
  LABEL_AGE_RANGE: {
    id: 'common.label.age_range'
  },
  LABEL_AGE_UP_TO: {
    id: 'common.label.age_up_to'
  }
};
const getAgeRange = function () {
  let [min, max] = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  let translate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _locale.translate;
  return min || max ? !min && max ? translate(L10N.LABEL_AGE_UP_TO, {
    years: max
  }) : min && (!max || max == UNDEFINED_MAX) ? translate(L10N.LABEL_AGE_FROM, {
    years: min
  }) : translate(L10N.LABEL_AGE_RANGE, {
    min,
    max
  }) : '';
};
exports.getAgeRange = getAgeRange;
//# sourceMappingURL=getAgeRange.js.map