"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Footer = void 0;

var _preact = require("preact");

var _milliseconds = _interopRequireDefault(require("milliseconds"));

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

const currentYear = new Date().getFullYear();

const getUpdatedText = updatedDate => {
  if (Date.now() - updatedDate < _milliseconds.default.weeks(2)) {
    const date = new Date(updatedDate);
    return "".concat(date.getMonth() + 1, "/").concat(date.getDate(), "/").concat((date.getFullYear() + '').slice(2));
  }
};

const Footer = ({
  privacyUrl = 'https://legal.xchart.com/privacy',
  termsUrl = 'https://legal.xchart.com/terms',
  hipaaUrl = 'https://legal.xchart.com/hipaa',
  version,
  privacyUpdatedDate,
  hideLinks,
  extra,
  className = 'pt2 pb3 tc f6 gray mb7',
  linkClasses = 'link f6 gray no-underline underline-hover'
}) => {
  const updateText = privacyUpdatedDate && getUpdatedText(privacyUpdatedDate);
  return (0, _preact.h)("footer", {
    className: className
  }, "\xA9 ", currentYear, " Xchart Inc. ", version && "v".concat(version), ' ', !hideLinks && (0, _preact.h)("div", {
    className: "mt1 no-print"
  }, (0, _preact.h)("a", {
    className: linkClasses,
    href: termsUrl,
    rel: "noopener"
  }, "terms"), ' | ', (0, _preact.h)("a", {
    className: linkClasses,
    href: privacyUrl,
    rel: "noopener"
  }, "privacy"), ' | ', (0, _preact.h)("a", {
    className: linkClasses,
    href: hipaaUrl,
    rel: "noopener"
  }, "hipaa"), updateText && " (updated ".concat(updateText, ")")), extra);
};

exports.Footer = Footer;