"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = eventTemplate;

var _render = _interopRequireDefault(require("./render"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function eventTemplate({
  event,
  isEmail,
  uid
}) {
  const response = uid && event.responses && event.responses[uid] ? event.responses[uid] : 'no';
  const active = {
    no: '',
    maybe: '',
    yes: '',
    [response]: 'active'
  };
  const repeatsEveryUnit = event.repeats && ['day', 'week', 'month', 'year'].find(x => event.repeats.every[x]);
  const repeatsEndDateFinite = Number.isFinite(event.repeats && event.repeats.endDate);
  const reminders = event.reminders.sort((a, b) => a - b);
  return (0, _render.default)('partials/calendar/event/post', {
    event,
    isEmail,
    uid,
    response,
    active,
    repeatsEveryUnit,
    repeatsEndDateFinite,
    reminders
  });
}
//# sourceMappingURL=templates.js.map