"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.calcTooltips = void 0;
var _locale = require("@mirai/locale");
var _calcMinStay = require("./calcMinStay");
var _helpers = require("../../../../helpers");
var _Calendar = require("../Calendar.l10n");
const calcTooltips = function () {
  let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
    from = _ref.from,
    minStayDates = _ref.minStayDates,
    minStayType = _ref.minStayType,
    propRangeMinDays = _ref.rangeMinDays,
    to = _ref.to,
    _ref$translate = _ref.translate,
    translate = _ref$translate === void 0 ? _locale.translate : _ref$translate;
  if (!(0, _locale.isDate)(from) || to && !(0, _locale.isDate)(to)) return;
  const value = {};
  const rangeMinDays = (0, _calcMinStay.calcMinStay)({
    from,
    minStayDates,
    minStayType,
    rangeMinDays: propRangeMinDays,
    to
  });
  if (minStayType !== undefined && from && !to && rangeMinDays > 1) {
    value[(0, _locale.dateFormat)(from, {
      format: _helpers.CALENDAR_FORMAT
    })] = {
      text: translate(_Calendar.L10N.LABEL_MIN_NIGHTS, {
        value: rangeMinDays
      }),
      pressable: false
    };
  }
  return value;
};
exports.calcTooltips = calcTooltips;
//# sourceMappingURL=calcTooltips.js.map