/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
const l = "system", d = "unknown", f = Intl.DateTimeFormat().resolvedOptions().timeZone, c = {
  milliseconds: 1,
  seconds: 1e3,
  minutes: 6e4,
  hours: 36e5,
  days: 864e5,
  weeks: 6048e5,
  months: 26784e5,
  // 31 days
  years: 31536e6,
  // 365 days
  decades: 31536e7,
  centuries: 31536e8
};
function a(e, n, s) {
  return e === 0 ? 0 : e * c[n] / c[s];
}
function r(e) {
  return e instanceof Date && !Number.isNaN(e.getTime());
}
function g(e, n, s = "hours") {
  const t = new Date(e.getTime()), i = a(n, s, "milliseconds");
  return t.setTime(t.getTime() + i), t;
}
function u(e, n) {
  const s = a(n, "hours", "milliseconds"), t = new Date(e.getTime() + s), i = t.toISOString().slice(0, 10), o = t.getUTCHours() * 60 + t.getUTCMinutes();
  return { localDate: i, minutesSinceMidnight: o };
}
function T(e, n) {
  const s = e?.environment?.lighting;
  if (m(s)) {
    const t = s.displayUTCOffset ?? n ?? 0, i = s.date;
    if (r(i)) {
      const { localDate: o } = u(i, t);
      return o;
    }
  }
}
function m(e) {
  return e?.type === "sun";
}
export {
  f as a,
  r as b,
  a as c,
  u as d,
  T as g,
  m as i,
  g as o,
  l as s,
  d as u
};
