import { millisecondsInHour as l, millisecondsInMinute as m, millisecondsInSecond as f } from "./index-constants5.js";
import { numericPatterns as s } from "./index-constants4.js";
function h(e, r) {
  return e && {
    value: r(e.value),
    rest: e.rest
  };
}
function i(e, r) {
  var n = r.match(e);
  return n ? {
    value: parseInt(n[0], 10),
    rest: r.slice(n[0].length)
  } : null;
}
function p(e, r) {
  var n = r.match(e);
  if (!n)
    return null;
  if (n[0] === "Z")
    return {
      value: 0,
      rest: r.slice(1)
    };
  var u = n[1] === "+" ? 1 : -1, t = n[2] ? parseInt(n[2], 10) : 0, a = n[3] ? parseInt(n[3], 10) : 0, c = n[5] ? parseInt(n[5], 10) : 0;
  return {
    value: u * (t * l + a * m + c * f),
    rest: r.slice(n[0].length)
  };
}
function D(e) {
  return i(s.anyDigitsSigned, e);
}
function d(e, r) {
  switch (e) {
    case 1:
      return i(s.singleDigit, r);
    case 2:
      return i(s.twoDigits, r);
    case 3:
      return i(s.threeDigits, r);
    case 4:
      return i(s.fourDigits, r);
    default:
      return i(new RegExp("^\\d{1," + e + "}"), r);
  }
}
function I(e, r) {
  switch (e) {
    case 1:
      return i(s.singleDigitSigned, r);
    case 2:
      return i(s.twoDigitsSigned, r);
    case 3:
      return i(s.threeDigitsSigned, r);
    case 4:
      return i(s.fourDigitsSigned, r);
    default:
      return i(new RegExp("^-?\\d{1," + e + "}"), r);
  }
}
function w(e) {
  switch (e) {
    case "morning":
      return 4;
    case "evening":
      return 17;
    case "pm":
    case "noon":
    case "afternoon":
      return 12;
    case "am":
    case "midnight":
    case "night":
    default:
      return 0;
  }
}
function x(e, r) {
  var n = r > 0, u = n ? r : 1 - r, t;
  if (u <= 50)
    t = e || 100;
  else {
    var a = u + 50, c = Math.floor(a / 100) * 100, o = e >= a % 100;
    t = e + c - (o ? 100 : 0);
  }
  return n ? t : 1 - t;
}
function P(e) {
  return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
}
export {
  w as dayPeriodEnumToHours,
  P as isLeapYearIndex,
  h as mapValue,
  x as normalizeTwoDigitYear,
  D as parseAnyDigitsSigned,
  d as parseNDigits,
  I as parseNDigitsSigned,
  i as parseNumericPattern,
  p as parseTimezonePattern
};
