{"version":3,"file":"_isFormatTime.mjs","names":[],"sources":["../../src/internal/_isFormatTime.ts"],"sourcesContent":["/**\n * Checks an offset-qualified clock and possible UTC leap-second minute.\n *\n * There is no calendar date to verify. A second of 60 requires the supplied\n * clock and offset to map to 23:59 UTC, with negative offsets normalized into\n * the day.\n *\n * @evidence contracts/common.md#principled-implementation The expression bounds clock and offset fields. Offset subtraction and a nonnegative modulo of 1440 minutes identify the final UTC minute without pretending a date is present.\n * @evidence contracts/common.md#clear-and-simple-design Ordinary seconds use the syntax result; the extra arithmetic is confined to the leap-second branch and needs no Date allocation.\n * @evidence contracts/common.md#prohibited-implementation-shortcuts Clock ranges and day wrapping apply to all inputs; no local-time conversion or fixture-specific leap-second allowance is used.\n * @evidence contracts/common.md#meaningful-documentation The doc states that an offset is required, that there is no date to verify and how a second of 60 maps to 23:59 UTC with negative offsets normalized into the day.\n */\nexport const _isFormatTime = (str: string): boolean => {\n  const match: RegExpExecArray | null = PATTERN.exec(str);\n  if (match === null) return false;\n  if (match[3] !== \"60\") return true;\n\n  // RFC 3339 admits `:60` only where a leap second is inserted, which is\n  // always 23:59:60 UTC. `date-time` decides that from the instant it can\n  // build; a clock carries no date, so it shifts itself by its own offset and\n  // asks the same question, wrapping the result back into the day.\n  const offset: number =\n    match[4] === undefined\n      ? 0\n      : (match[4] === \"+\" ? 1 : -1) *\n        (Number(match[5]) * 60 + Number(match[6]));\n  const minutes: number = Number(match[1]) * 60 + Number(match[2]) - offset;\n  return ((minutes % DAY) + DAY) % DAY === DAY - 1;\n};\n\nconst PATTERN =\n  /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(?:\\.[0-9]+)?(?:[Zz]|([+-])((?:[01][0-9]|2[0-3])):([0-5][0-9]))$/;\nconst DAY = 24 * 60;\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,iBAAiB,QAAyB;CACrD,MAAM,QAAgC,QAAQ,KAAK,GAAG;CACtD,IAAI,UAAU,MAAM,OAAO;CAC3B,IAAI,MAAM,OAAO,MAAM,OAAO;CAM9B,MAAM,SACJ,MAAM,OAAO,KAAA,IACT,KACC,MAAM,OAAO,MAAM,IAAI,OACvB,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE;CAE9C,SADwB,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE,IAAI,UAChD,MAAO,OAAO,QAAQ,MAAM;AACjD;AAEA,MAAM,UACJ;AACF,MAAM,MAAM"}