cronli5 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,59 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.2]
10
+
11
+ ### Changed
12
+
13
+ - **Non-uniform steps in the time fields now list their fires** instead of
14
+ reading "every N". A step is a true "every N" cadence only when it tiles the
15
+ field's cycle evenly — `step` divides the cycle (60 for minutes/seconds, 24 for
16
+ hours) **and** `start < step`; otherwise the gap at the field boundary differs.
17
+ `*/7 * * * *` fires at :00, :07, …, :56 — the :56→:00 gap is 4 minutes, not 7 —
18
+ so it now reads "at 0, 7, 14, 21, 28, 35, 42, 49, and 56 minutes past the hour"
19
+ rather than "every seven minutes". `7/6` and `11/6` (the step divides 60 but
20
+ starts past it) enumerate too. Genuine "every N" steps (`*/6`, `*/15`, `5/6`,
21
+ `11/12`, `*/2` hours) are unchanged. German already rendered these; English,
22
+ Spanish, Finnish, and Chinese now match. Date/month/weekday steps are unchanged
23
+ (their cycles vary — a separate follow-up).
24
+ - **Chinese no longer drops the start of an offset step.** `5/6` had rendered as
25
+ "每6分钟" — identical to `*/6`, the wrong schedule — and now enumerates its
26
+ fires ("每小时5、11、…、59分"), matching how Chinese already rendered offset
27
+ second and hour steps.
28
+
29
+ ### Fixed
30
+
31
+ - **German** no longer doubles the period when a sentence ends in an ordinal
32
+ ("…am 3., 5. und 8." instead of "…8.."), and an hour list no longer takes
33
+ "von" ("in den Stunden 9, 11 und 13 Uhr", not "von 9, 11 und 13 Uhr"; genuine
34
+ "von … bis" ranges are unchanged).
35
+
36
+ ## [0.1.1]
37
+
38
+ ### Fixed
39
+
40
+ - A minute of `0` is no longer dropped when a sub-minute second makes the
41
+ cadence sub-minute. `* 0 * * * *` now reads "every second, zero minutes past
42
+ the hour, every hour" (was "every second, every hour", which described every
43
+ second of *every* minute, losing the minute-0 restriction). The bug affected
44
+ the wildcard-second + minute-0 combination over the every-hour, hour-range,
45
+ and hour-step idioms, in all five languages; fuzz coverage was added for the
46
+ shape so it cannot silently regress.
47
+
48
+ ### Changed
49
+
50
+ - A minute **list or range** within an **hour range** now closes on the bare
51
+ hour, with the minutes stated separately: `2,3,4 9-17 * * *` reads "at 2, 3,
52
+ and 4 minutes past the hour from 9 a.m. through 5 p.m." (was "through 5:04
53
+ p.m.", which glued the last fire's minute onto the bound and read as a
54
+ misleading continuous span). Single-minute (`30 9-17 * * *` → "through 5:30
55
+ p.m.") and wildcard (`* 9-17 * * *` → "through 5:59 p.m.") bounds are
56
+ unchanged. All five languages.
57
+
58
+ ## [0.1.0]
59
+
60
+ First non-beta release.
61
+
9
62
  ### Added
10
63
 
11
64
  - **Per-language documentation** under `docs/lang/` (`en.md`, `es.md`,
@@ -34,7 +87,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
34
87
  `ampm` option is ignored. Ships with a reviewed corpus, minimal
35
88
  pairs, language notes, and a review log under `test/lang/fi/`.
36
89
  Like Spanish, Finnish required zero core changes.
37
-
38
90
  - Descriptions for **lists containing range or step segments** (e.g.
39
91
  `0-30,45` or `9,17-19`) in every field. Minute and second lists read their
40
92
  spans discretely (`at five through ten and 20 minutes past the hour`), hour
@@ -87,6 +139,18 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
87
139
  - An explicitly supplied year is now always described: object input with a
88
140
  `year` property (e.g. `{hour: 9, year: 2030}`) previously validated the
89
141
  year and then silently dropped it from the description.
142
+ - Idiomatic descriptions for **lists** (`,`), **ranges** (`-`), and **compound**
143
+ patterns that combine multiple non-trivial fields (e.g.
144
+ `at 30 minutes past the hour from 9 a.m. through 5 p.m.`).
145
+ - Trailing day qualifiers for bare frequencies (e.g. `every minute on Monday`,
146
+ `every hour on January 13`).
147
+ - Dual **ESM** and **CommonJS** builds plus a minified **browser** global, an
148
+ `exports` map, and bundled **TypeScript** type definitions (`cronli5.d.ts`).
149
+ - Continuous integration (GitHub Actions) across Node 18/20/22, with a
150
+ coverage gate.
151
+ - Code coverage via **c8** with enforced thresholds (`npm run coverage`).
152
+ - Property-based tests (**fast-check**), smoke tests against the built
153
+ ESM/CJS artifacts, and type tests (**tsd**, `npm run test:types`).
90
154
 
91
155
  ### Changed
92
156
 
@@ -94,7 +158,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
94
158
  `uk` for the Ukrainian language, so the British-English style now uses the
95
159
  ISO-3166 country code `'gb'`. `{ dialect: 'uk' }` still works as a
96
160
  deprecated alias for `'gb'` and will be removed in a future release.
97
-
98
161
  - **Spanish now defaults to the 24-hour clock** (`a las 09:30`,
99
162
  `a las 17:00`), matching RAE convention for written Spanish. Pass
100
163
  `{ampm: true}` for the previous 12-hour behavior with day periods
@@ -166,6 +229,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
166
229
  `0-30` in minute lists, and clock-time windows like `9 a.m.-5:45 p.m.`).
167
230
  Previously short mode abbreviated names but left "through" in place for
168
231
  every field except weekdays.
232
+ - Source is now authored as an ES module in `src/` and bundled with esbuild.
233
+ - Date descriptions always use suffixed numeric ordinals (`1st`, `2nd`, ...).
234
+ - Modernized the toolchain: ESLint 9 (flat config), Mocha 11, Chai 4.
235
+ - Enforced explicit ESLint budgets for cyclomatic `complexity`, `max-depth`,
236
+ and `max-params` as regression guards.
169
237
 
170
238
  ### Fixed
171
239
 
@@ -236,36 +304,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
236
304
  own clause instead of cross-multiplying into a wall of times
237
305
  (`0,30 8-18/2 * * *` reads "at 0 and 30 minutes past the hour, at 8
238
306
  a.m., 10 a.m., ..." — six times, not twelve).
239
-
240
- ## [0.1.0]
241
-
242
- First non-beta release.
243
-
244
- ### Added
245
-
246
- - Idiomatic descriptions for **lists** (`,`), **ranges** (`-`), and **compound**
247
- patterns that combine multiple non-trivial fields (e.g.
248
- `at 30 minutes past the hour from 9 a.m. through 5 p.m.`).
249
- - Trailing day qualifiers for bare frequencies (e.g. `every minute on Monday`,
250
- `every hour on January 13`).
251
- - Dual **ESM** and **CommonJS** builds plus a minified **browser** global, an
252
- `exports` map, and bundled **TypeScript** type definitions (`cronli5.d.ts`).
253
- - Continuous integration (GitHub Actions) across Node 18/20/22, with a
254
- coverage gate.
255
- - Code coverage via **c8** with enforced thresholds (`npm run coverage`).
256
- - Property-based tests (**fast-check**), smoke tests against the built
257
- ESM/CJS artifacts, and type tests (**tsd**, `npm run test:types`).
258
-
259
- ### Changed
260
-
261
- - Source is now authored as an ES module in `src/` and bundled with esbuild.
262
- - Date descriptions always use suffixed numeric ordinals (`1st`, `2nd`, ...).
263
- - Modernized the toolchain: ESLint 9 (flat config), Mocha 11, Chai 4.
264
- - Enforced explicit ESLint budgets for cyclomatic `complexity`, `max-depth`,
265
- and `max-params` as regression guards.
266
-
267
- ### Fixed
268
-
269
307
  - Weekday/date/month-only patterns no longer drop their qualifier.
270
308
  - A specific minute within an hour range is no longer dropped.
271
309
 
package/cronli5.min.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";(()=>{var qn={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},Jn={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12},h={second:{cyclic:!0,max:59,min:0,top:59},minute:{cyclic:!0,max:59,min:0,top:59},hour:{cyclic:!0,max:23,min:0,top:23},date:{aliases:{"?":"*"},cyclic:!0,max:31,min:1,top:31},month:{cyclic:!0,max:12,min:1,numbers:Jn,top:12},weekday:{aliases:{"?":"*",L:"6"},cyclic:!0,max:7,min:0,numbers:qn,top:6},year:{max:9999,min:1970}},k=["second","minute","hour","date","month","weekday","year"],j={"@annually":"0 0 1 1 *","@yearly":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *"},U=6;function s(n,e){return(""+n).indexOf(e)!==-1}function F(n){return Array.from(new Set(n))}function I(n){return/^\d+$/.test(n)}function d(n,e){return I(n)?+n:e[n.toUpperCase()]}function sn(n){return k.forEach(function(r){Vn(n[r],h[r],r)}),n}function Vn(n,e,r){typeof n!="string"&&typeof n!="number"&&un(n,r);let t=""+n;t!=="*"&&(r==="date"&&C(t)||r==="weekday"&&w(t,e)||t.split(",").forEach(function(o){$n(o,e)||un(o,r)}))}function C(n){if(n==="L"||n==="LW"||n==="WL")return!0;let e=/^L-(\d{1,2})$/.exec(n);if(e)return+e[1]>=1&&+e[1]<=30;let r=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(r){let t=+(r[1]||r[2]);return t>=1&&t<=31}return!1}function w(n,e){if(/L$/.test(n))return v(n.slice(0,-1),e);let r=n.split("#");return r.length===2?v(r[0],e)&&/^[1-5]$/.test(r[1]):!1}function $n(n,e){return s(n,"/")?Yn(n,e):s(n,"-")?an(n,e):v(n,e)}function Yn(n,e){let r=n.split("/");return r.length!==2||!I(r[1])||+r[1]<1?!1:r[0]==="*"||v(r[0],e)||an(r[0],e,!0)}function an(n,e,r){let t=n.split("-");return t.length!==2||!v(t[0],e)||!v(t[1],e)?!1:e.cyclic&&!r?!0:d(t[0],e.numbers)<=d(t[1],e.numbers)}function v(n,e){return n==="*"?!1:I(n)?+n>=e.min&&+n<=e.max:e.numbers?n.toUpperCase()in e.numbers:!1}function un(n,e){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+e+" field.")}function cn(n){k.forEach(function(r){let t=h[r].aliases,i=t&&t[""+n[r]];i&&(n[r]=i)})}function mn(n){return k.forEach(function(r){let t=""+n[r];if(r==="date"&&C(t)||r==="weekday"&&w(t,h[r])){n[r]=t;return}n[r]=Bn(t,h[r])}),n}function Bn(n,e){let r=""+n;if(r==="*")return r;let t=r.split(",").map(function(o){return Xn(Kn(Gn(o,e),e),e)});return t.indexOf("*")!==-1?"*":F(t).sort(function(o,u){return ln(o,e)-ln(u,e)}).join(",")}function Gn(n,e){let r=n.split("/");if(!e.cyclic||r.length!==2||+r[1]!=1)return n;let t=r[0];return s(t,"-")?t:t==="*"||d(t,e.numbers)===e.min?"*":t+"-"+e.top}function Kn(n,e){let r=n.split("/");if(!e.cyclic||typeof e.top!="number"||r.length!==2||s(r[0],"-"))return n;let t=r[0];return(t==="*"?e.min:d(t,e.numbers))+ +r[1]<=e.top?n:t==="*"?""+e.min:t}function Xn(n,e){let r=n.split("/")[0];if(!s(r,"-"))return n;let t=r.split("-");return d(t[0],e.numbers)!==d(t[1],e.numbers)?n:t[0]}function ln(n,e){let r=n.split("/")[0].split("-")[0];return r==="*"?e.min:d(r,e.numbers)}function fn(n,e){let r=n instanceof Array;if(n===null||typeof n>"u"||n===""||r&&n.length===0)throw new Error("`cronli5` expects a non-empty cron pattern as the first argument.");if(r)return dn(n,e);if(typeof n=="object")return Zn(n);if(typeof n=="string")return _n(n,e);throw new Error("`cronli5` was passed an unexpected type.")}function dn(n,e){if(n.length>7)throw new Error("`cronli5` was passed a cron pattern with more than seven fields.");return!e.seconds&&n.length<(e.years?7:6)&&n.unshift("0"),{second:n[0]||"0",minute:n[1]||"*",hour:n[2]||"*",date:n[3]||"*",month:n[4]||"*",weekday:n[5]||"*",year:n[6]||"*"}}function Zn(n){if(!n.second&&!n.minute&&!n.hour)throw new Error("`cronli5` expects that any object being interpreted as a cron pattern have at least one of the following properties: `second`, `minute`, or `hour`");let e=typeof n.second<"u",r=typeof n.minute<"u",t=e?"*":"0",i=e||r?"*":"0";return{second:N(n.second,"0"),minute:N(n.minute,t),hour:N(n.hour,i),date:N(n.date,"*"),month:N(n.month,"*"),weekday:N(n.weekday,"*"),year:N(n.year,"*")}}function N(n,e){return typeof n>"u"?e:n}function _n(n,e){let r=ne(n).split(/\s+/);return dn(r,e)}function ne(n){let e=n.trim();if(e.charAt(0)!=="@")return n;let r=e.toLowerCase();if(Object.hasOwn(j,r))return j[r];throw new Error("`cronli5` does not recognize the macro `"+e+"`.")}function gn(n){return n!=="*"&&!s(n,",")&&!s(n,"-")&&!s(n,"/")}function Q(n){return s(n,"-")&&!s(n,",")&&!s(n,"/")}function ee(n){return s(n,"/")&&!s(n,",")}function q(n){return n!=="*"&&!s(n,"-")&&!s(n,"/")}function J(n){return n!=="*"&&!Q(n)&&!ee(n)}function R(n,e,r){let t=[],i=n;for(;i<=r;)t.push(i),i+=e;return t}function hn(n,e,r,t){let i=n.split("/"),o=+i[1];if(s(i[0],"-")){let f=i[0].split("-");return R(d(f[0],t),o,d(f[1],t))}let u=i[0]==="*"?e:d(i[0],t);return R(u,o,r)}function V(n,e,r){let t=[];return n.split(",").forEach(function(o){if(s(o,"/"))t.push(...hn(o,e,r));else if(s(o,"-")){let u=o.split("-");+u[0]<=+u[1]?t.push(...R(+u[0],1,+u[1])):(t.push(...R(+u[0],1,r)),t.push(...R(e,1,+u[1])))}else t.push(+o)}),F(t)}function re(n){return q(n)?n.split(",").map(Number):[0]}function te(n){if(n==="*")return[0,59];if(Q(n)){let e=n.split("-");if(+e[0]<=+e[1])return[+e[0],+e[1]]}return null}function ie(n){return n==="*"?59:Math.max(...V(n,0,59))}function oe(n){if(gn(n)&&n!=="0")return+n}function ue(n,e){return n==="*"?"wildcard":e==="date"&&C(n)||e==="weekday"&&w(n,h.weekday)?"quartz":s(n,",")?"list":s(n,"/")?"step":s(n,"-")?"range":"single"}function se(n,e,r){return e==="wildcard"||e==="quartz"?null:n.split(",").map(function(i){if(s(i,"/")){let o=i.split("/");return{fires:hn(i,r.min,r.top,r.numbers),interval:+o[1],kind:"step",startToken:o[0]}}return s(i,"-")?{bounds:i.split("-"),kind:"range"}:{kind:"single",value:i}})}function pn(n){let e={},r={};k.forEach(function(u){e[u]=ue(n[u],u),r[u]=se(n[u],e[u],h[u])});let i={analyses:{clockSecond:oe(n.second),lastMinuteFire:ie(n.minute),minuteSpan:te(n.minute),segments:r},pattern:n,shapes:e};return{...i,plan:ae(i)}}function ae(n){let{analyses:e,pattern:r,shapes:t}=n;if(r.second!=="0"){let i=le(r,t,e);if(i)return i}return yn(r,t,e)||Sn(r,t,e)}function le(n,e,r){let t=ce(n,e);return t||(n.hour==="*"&&e.minute==="single"&&n.second!=="*"?{kind:"secondsWithinMinute",singleSecond:e.second==="single"}:e.second==="single"&&q(n.minute)&&J(n.hour)?null:{kind:"composeSeconds",rest:yn(n,e,r)||Sn(n,e,r)})}function ce(n,e){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:e.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function yn(n,e,r){if(e.minute==="step")return{hours:fe(n,e,r),kind:"minuteFrequency"};if(e.hour==="single"&&r.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:r.minuteSpan};let t=de(n,e);if(t)return t;let i=me(n,e);if(i)return i;if(n.hour==="*")return ge(n,e)}function bn(n){let[e,r]=n.split("/"),t=e==="*"?0:+e;return e.indexOf("-")===-1&&24%+r===0&&t<+r}function me(n,e){return e.hour!=="step"?null:n.minute==="*"?bn(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:x(n.hour)}:e.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:null}function fe(n,e,r){if(e.hour==="list")return{kind:"during",times:x(n.hour)};if(e.hour==="range"){let t=n.hour.split("-");return{from:+t[0],kind:"window",last:r.lastMinuteFire,to:+t[1]}}return e.hour==="single"?{from:+n.hour,kind:"window",last:r.lastMinuteFire,to:+n.hour}:e.hour==="step"?bn(n.hour)?{kind:"step"}:{kind:"during",times:x(n.hour)}:{kind:"none"}}function de(n,e){return J(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:x(n.hour)}:e.minute==="range"||e.minute==="list"&&s(n.minute,"-")&&!s(n.minute,"/")?{form:e.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:x(n.hour)}:null:null}function ge(n,e){if(e.minute==="range")return{kind:"rangeOfMinutes"};if(e.minute==="list")return{kind:"multipleMinutes"};if(n.minute==="*")return{kind:"everyMinute"};if(n.minute!=="0")return{kind:"singleMinute"}}function Sn(n,e,r){if(e.hour==="range"){let t=n.hour.split("-"),i="lead";return n.minute==="*"?i="wildcard":e.minute==="range"&&(i="range"),{from:+t[0],kind:"hourRange",last:r.lastMinuteFire,minuteForm:i,to:+t[1]}}return e.hour==="step"&&n.minute==="0"?{kind:"hourStep"}:n.hour==="*"?{kind:"everyHour"}:he(n,r)}function he(n,e){let r=V(n.hour,0,23),t=re(n.minute);if(r.length*t.length>U)return{fold:t.length===1,kind:"compactClockTimes",minute:t[0]};let i=[];return r.forEach(function(u){t.forEach(function(l){i.push({hour:u,minute:l,second:e.clockSecond})})}),{kind:"clockTimes",times:i}}function x(n){let e=V(n,0,23);return e.length<=U?{fires:e,kind:"fires"}:{kind:"segments"}}function On(n,e){let r=fn(n,e);return cn(r),sn(r),mn(r)}function $(n){return n=""+n,n.length<2?"0"+n:n}function kn(n,e,r){return r.short?n:e[n]||n}function Y(n,{sep:e,pad:r,lean:t}){let i=r?$(n.hour):""+n.hour;return t&&!n.minute&&!n.second?i:i+e+$(n.minute)+(n.second?e+$(n.second):"")}var B={gb:{am:"am",closeUp:!0,dayFirst:!0,midday:"midday",midnight:"midnight",ordinals:!1,pm:"pm",sep:".",serialComma:!1,through:" to "},us:{am:"a.m.",closeUp:!1,dayFirst:!1,midday:"noon",midnight:"midnight",ordinals:!1,pm:"p.m.",sep:":",serialComma:!0,through:" through "},house:{am:"AM",closeUp:!1,dayFirst:!1,midday:"noon",midnight:"midnight",ordinals:!0,pm:"PM",sep:":",serialComma:!0,through:" - "}};function Nn(n){return typeof n=="object"&&n!==null?{...B.us,...n}:B[n==="uk"?"gb":n]||B.us}var pe=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],G=["th","st","nd","rd"],g=[null,["January","Jan"],["February","Feb"],["March","Mar"],["April","Apr"],["May","May"],["June","Jun"],["July","Jul"],["August","Aug"],["September","Sep"],["October","Oct"],["November","Nov"],["December","Dec"]],y=[["Sunday","Sun"],["Monday","Mon"],["Tuesday","Tue"],["Wednesday","Wed"],["Thursday","Thu"],["Friday","Fri"],["Saturday","Sat"]],ye={JAN:g[1],FEB:g[2],MAR:g[3],APR:g[4],MAY:g[5],JUN:g[6],JUL:g[7],AUG:g[8],SEP:g[9],OCT:g[10],NOV:g[11],DEC:g[12]},be={SUN:y[0],MON:y[1],TUE:y[2],WED:y[3],THU:y[4],FRI:y[5],SAT:y[6]},Se=[null,"first","second","third","fourth","fifth"];function Oe(n){return n=n||{},{ampm:typeof n.ampm=="boolean"?n.ampm:!0,lenient:!!n.lenient,seconds:!!n.seconds,short:!!n.short,style:Nn(n.dialect),years:!!n.years}}function ke(n,e){return Xe(zn(n,n.plan,e),n,e)}function zn(n,e,r){let t=Qe[e.kind];return t(n,e,r)}function Ne(n,e,r){return"every second"+a(n,r)}function ze(n,e,r){return H(n,r)+a(n,r)}function Pe(n,e,r){let t=n.pattern.second;return m(t,r)+" "+P(t,"second")+" past the minute, every minute"+a(n,r)}function ve(n,e,r){let t=n.pattern.minute,i=m(t,r),o=P(t,"minute");if(e.singleSecond){let u=n.pattern.second;return i+" "+o+" and "+m(u,r)+" "+P(u,"second")+" past the hour, every hour"+a(n,r)}return H(n,r)+", "+i+" "+o+" past the hour, every hour"+a(n,r)}function Ce(n,e,r){return H(n,r)+", "+zn(n,e.rest,r)}function H(n,e){let r=n.pattern.second,t=n.shapes.second;if(r==="*")return"every second";if(t==="step")return wn(n.analyses.segments.second[0],"second","minute",e);if(t==="range"){let i=r.split("-"),o=E(i,e);return"every second from "+o(i[0])+O(e)+o(i[1])+" past the minute"}return t==="single"?"at "+m(r,e)+" "+P(r,"second")+" past the minute":b(T(n.analyses.segments.second,e),"second","minute",e)}function we(n,e,r){return"every minute"+a(n,r)}function Re(n,e,r){let t=n.pattern.minute;return m(t,r)+" "+P(t,"minute")+" past the hour, every hour"+a(n,r)}function xe(n,e,r){return L(n.pattern.minute,r)+a(n,r)}function Me(n,e,r){return b(T(n.analyses.segments.minute,r),"minute","hour",r)+a(n,r)}function Te(n,e,r){let t=wn(n.analyses.segments.minute[0],"minute","hour",r);return e.hours.kind==="during"?t+=" during the "+Z(n,e.hours.times,!1,r)+" hours":e.hours.kind==="window"?t+=" "+Cn(e.hours,r):e.hours.kind==="step"&&(t+=" "+Pn(n.analyses.segments.hour[0],r)),t+a(n,r)}function Fe(n,e,r){return"every minute from "+c({hour:e.hour,minute:e.span[0]},r)+O(r)+c({hour:e.hour,minute:e.span[1]},r)+a(n,r)}function Ie(n,e,r){if(e.form==="wildcard")return"every minute during the "+Z(n,e.times,!1,r)+" hours"+a(n,r);let t=Z(n,e.times,!0,r);return(e.form==="range"?L(n.pattern.minute,r):b(T(n.analyses.segments.minute,r),"minute","hour",r))+", at "+t+a(n,r)}var He={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function Pn(n,e){let r="during every "+He[n.interval]+" hour",t=n.startToken==="*"?0:+n.startToken;return t===0?r:r+" starting at "+c({hour:t,minute:0},e)}function Le(n,e,r){let t=n.analyses.segments.hour[0];return e.form==="wildcard"?"every minute "+Pn(t,r)+a(n,r):L(n.pattern.minute,r)+", "+Rn(t,r)+a(n,r)}function L(n,e){let r=n.split("-"),t=E(r,e);return"every minute from "+t(r[0])+O(e)+t(r[1])+" past the hour"}function Ee(n,e,r){return"every hour"+a(n,r)}function Ae(n,e,r){let t=Cn(e,r);return e.minuteForm==="wildcard"?"every minute "+t+a(n,r):e.minuteForm==="range"?L(n.pattern.minute,r)+", "+t+a(n,r):vn(n,r)+" "+t+a(n,r)}function vn(n,e){return n.pattern.minute==="0"?"every hour":b(T(n.analyses.segments.minute,e),"minute","hour",e)}function We(n,e,r){return Rn(n.analyses.segments.hour[0],r)+a(n,r)}function Cn(n,e){return"from "+c({hour:n.from,minute:0},e)+O(e)+c({hour:n.to,minute:n.last},e)}function De(n,e,r){let t=rn(e.times),i=e.times.map(function(u){return c({hour:u.hour,minute:u.minute,second:u.second,plain:t},r)});return xn(n,r)+"at "+S(i,r)}function je(n,e,r){if(e.fold){if(n.analyses.segments.hour.some(function(f){return f.kind==="range"})&&!n.analyses.clockSecond)return Ue(n,e,r)+a(n,r);let o={minute:e.minute,second:n.analyses.clockSecond};return xn(n,r)+"at "+_(n,o,!0,r)}let t=b(T(n.analyses.segments.minute,r),"minute","hour",r)+", at "+_(n,{minute:0,second:null},!0,r)+a(n,r);return n.analyses.clockSecond?H(n,r)+", "+t:t}function Ue(n,e,r){let t=e.minute,i=[],o=[];n.analyses.segments.hour.forEach(function(l){l.kind==="range"?i.push("from "+c({hour:l.bounds[0],minute:0},r)+O(r)+c({hour:l.bounds[1],minute:t},r)):l.kind==="step"?o.push(...l.fires):o.push(+l.value)});let u=vn(n,r)+" "+S(i,r);return o.length&&(u+=" and at "+S(o.map(function(l){return c({hour:l,minute:t},r)}),r)),u}var Qe={clockTimes:De,compactClockTimes:je,composeSeconds:Ce,everyHour:Ee,everyMinute:we,everySecond:Ne,hourRange:Ae,hourStep:We,minuteFrequency:Te,minuteSpanAcrossHourStep:Le,minuteSpanInHour:Fe,minutesAcrossHours:Ie,multipleMinutes:Me,rangeOfMinutes:xe,secondPastMinute:Pe,secondsWithinMinute:ve,singleMinute:Re,standaloneSeconds:ze};function wn(n,e,r,t){if(n.startToken.indexOf("-")!==-1)return b(K(n.fires,t),e,r,t);let i=n.startToken==="*"?0:+n.startToken,o=n.interval;return i!==0?n.fires.length<=3?b(K(n.fires,t),e,r,t):"every "+m(o,t)+" "+e+"s from "+m(i,t)+" "+P(i,e)+" past the "+r:60%o===0?"every "+m(o,t)+" "+e+"s":n.fires.length<=2?b(K(n.fires,t),e,r,t):"every "+m(o,t)+" "+e+"s past the "+r}function Rn(n,e){if(n.startToken.indexOf("-")!==-1)return"at "+X(n.fires,e);let r=n.startToken==="*"?0:+n.startToken,t=n.interval;return r===0&&24%t===0?"every "+m(t,e)+" hours":n.fires.length<=3?"at "+X(n.fires,e):r===0?"every "+m(t,e)+" hours from midnight":"every "+m(t,e)+" hours from "+c({hour:r,minute:0},e)}function E(n,e){let r=n.some(function(i){return+i>10});return function(i){return r?""+i:m(i,e)}}function K(n,e){return n.map(E(n,e))}function T(n,e){let r=n.flatMap(function(o){return o.kind==="range"?o.bounds:o.kind==="step"?o.fires:[o.value]}),t=E(r,e);return n.flatMap(function(o){return o.kind==="range"?[t(o.bounds[0])+O(e)+t(o.bounds[1])]:o.kind==="step"?o.fires.map(t):[t(o.value)]})}function b(n,e,r,t){return"at "+S(n,t)+" "+e+"s past the "+r}function qe(n,e,r){return(+n==0||+n==12)&&+e==0&&!(typeof r=="number"&&r>0)}function rn(n){let e=n.filter(function(t){return qe(t.hour,t.minute,t.second)});return e.length>0&&e.length<n.length}function X(n,e){let r=rn(n.map(function(o){return{hour:o,minute:0}})),t=n.map(function(o){return c({hour:o,minute:0,plain:r},e)});return S(t,e)}function Z(n,e,r,t){return e.kind==="fires"?X(e.fires,t):_(n,{minute:0,second:null},r,t)}function Je(n){return n.kind==="range"?n.bounds:n.kind==="step"?n.fires:[n.value]}function _(n,e,r,t){let{minute:i,second:o}=e,u=n.analyses.segments.hour,f=rn(u.flatMap(function(p){return Je(p).map(function(D){return{hour:+D,minute:i,second:o}})})),l=[];return u.forEach(function(p){p.kind==="step"?l.push(...p.fires.map(function(D){return c({hour:D,minute:i,second:o,plain:f},t)})):p.kind==="range"?l.push(c({hour:p.bounds[0],minute:i,second:o,plain:f},t)+O(t)+c({hour:p.bounds[1],minute:i,second:o,plain:f},t)):l.push(c({hour:p.value,minute:i,second:o,plain:f},t))}),S(Ve(l,u,r),t)}function Ve(n,e,r){let t=e.some(function(o){return o.kind==="range"});return!r||!t?n:n.map(function(o,u){return u===0?o:"at "+o})}function S(n,e){if(n.length<=1)return n.join("");if(n.length===2)return n[0]+" and "+n[1];let r=e.style.serialComma?", and ":" and ";return n.slice(0,-1).join(", ")+r+n[n.length-1]}var $e={all:"",month:"in ",stepDate:"on ",weekday:"on "},Ye={all:"every day",month:"every day in ",stepDate:"",weekday:"every "};function a(n,e){let r=Mn(n,$e,e);return r&&" "+r}function xn(n,e){return Mn(n,Ye,e)+" "}function Mn(n,e,r){let t=n.pattern;return t.date!=="*"&&t.weekday!=="*"?Ge(n,r):t.date!=="*"?Be(n,e,r):t.weekday!=="*"?(In(t.weekday,r)||e.weekday+An(n,r))+z(n,r):t.month!=="*"?e.month+A(n,r):e.all}function Be(n,e,r){let t=n.pattern,i=Fn(t.date,r);return i?i+z(n,r):tn(t.date)?e.stepDate+Ln(t.date)+z(n,r):t.month!=="*"&&!Tn(n)?"on the "+nn(n,r)+z(n,r):t.month!=="*"?"on "+Hn(n,r):"on the "+nn(n,r)}function Tn(n){return!En(n.pattern.month)&&n.analyses.segments.month.every(function(r){return r.kind!=="range"})}function Ge(n,e){let r=n.pattern,t=In(r.weekday,e)||"on "+An(n,e),i=Fn(r.date,e);return i?i+z(n,e)+" or "+t:tn(r.date)?Ln(r.date)+z(n,e)+" or "+t:r.month!=="*"&&Tn(n)?"on "+Hn(n,e)+" or "+t+" in "+A(n,e):"on the "+nn(n,e)+" or "+t+z(n,e)}function Fn(n,e){if(n==="L")return"on the last day of the month";if(n==="LW"||n==="WL")return"on the last weekday of the month";let r=/^L-(\d{1,2})$/.exec(n);if(r)return m(+r[1],e)+" "+P(r[1],"day")+" before the last day of the month";let t=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(t)return"on the weekday nearest the "+M(t[1]||t[2])}function In(n,e){let r=n.split("#");if(r.length===2)return"on the "+Se[+r[1]]+" "+en(r[0],e)+" of the month";if(/L$/.test(n))return"on the last "+en(n.slice(0,-1),e)+" of the month"}function Hn(n,e){let r=A(n,e),t=W(n.analyses.segments.date,e.style.ordinals?M:Ke,e);return e.style.dayFirst?t+" "+r:r+" "+t}function Ke(n){return""+n}function z(n,e){return n.pattern.month==="*"?"":" in "+A(n,e)}function Ln(n){let e=n.split("/"),r=+e[1],t=e[0],o=(r===2?"every other":"every "+M(r))+" day of the month";return t!=="*"&&t!=="1"&&(o+=" from the "+M(t)),o}function nn(n,e){return W(n.analyses.segments.date,M,e)}function A(n,e){let r=En(n.pattern.month);return r||W(n.analyses.segments.month,function(i){return er(i,e)},e)}function En(n){if(!tn(n))return null;let[e,r]=n.split("/");return+r!=2?null:e==="*"||e==="1"?"every odd-numbered month":e==="2"?"every even-numbered month":null}function An(n,e){return W(n.analyses.segments.weekday,function(t){return en(t,e)},e)}function W(n,e,r){let t=[];return n.forEach(function(o){o.kind==="step"?t.push(...o.fires.map(e)):o.kind==="range"?t.push(o.bounds.map(e).join(O(r))):t.push(e(o.value))}),S(t,r)}function tn(n){return n.indexOf("/")!==-1&&n.indexOf("-")===-1&&n.indexOf(",")===-1}function Xe(n,e,r){let t=e.pattern.year;if(t==="*")return n;if(t.indexOf("/")!==-1)return n+" "+_e(t,r);let i=Ze(t,r);if(t.indexOf("-")===-1&&t.indexOf(",")===-1&&e.pattern.date!=="*"&&n.indexOf(" at ")!==-1){let o=r.style.dayFirst?" ":", ";return n.replace(" at ",o+i+" at ")}return n+" in "+i}function Ze(n,e){return n.indexOf(",")!==-1?S(n.split(","),e):n}function _e(n,e){let r=n.split("/"),t=+r[1],i=r[0];if(t<=1)return"every year";let o="every "+m(t,e)+" years";return i!=="*"&&i!=="0"&&(o+=" from "+i),o}function c(n,e){let{hour:r,minute:t,plain:i}=n,o=typeof n.second=="number"&&n.second>0?n.second:0;return e.ampm?nr({hour:r,minute:t,second:o,plain:i},e):Y({hour:r,minute:t,second:o},{pad:!0,sep:e.style.sep})}function nr(n,e){let{hour:r,minute:t,second:i,plain:o}=n,u=e.style;if(!o&&+t==0&&!i){if(+r==0)return u.midnight;if(+r==12)return u.midday}return Y({hour:r%12||12,minute:t,second:i},{lean:!0,sep:u.sep})+(u.closeUp?"":" ")+(r<12?u.am:u.pm)}function m(n,e){return kn(n,pe,e)}function P(n,e){return+n==1?e:e+"s"}function O(n){return n.short?"-":n.style.through}function M(n){let e=Math.abs(n),r=G[e];return r||(e=(e%100-20)%10,r=G[e]||G[0]),n+r}function er(n,e){let r=g[n]||ye[n];return r&&r[e.short?1:0]}function en(n,e){let r=n===7||n==="7"?0:n,t=y[r]||be[r];return t&&t[e.short?1:0]}var rr={describe:ke,fallback:"an unrecognizable cron pattern",options:Oe,reboot:"at system startup",sentence:n=>"Runs "+n+"."},Wn=rr;/**
1
+ "use strict";(()=>{var qn={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},Vn={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12},p={second:{cyclic:!0,max:59,min:0,top:59},minute:{cyclic:!0,max:59,min:0,top:59},hour:{cyclic:!0,max:23,min:0,top:23},date:{aliases:{"?":"*"},cyclic:!0,max:31,min:1,top:31},month:{cyclic:!0,max:12,min:1,numbers:Vn,top:12},weekday:{aliases:{"?":"*",L:"6"},cyclic:!0,max:7,min:0,numbers:qn,top:6},year:{max:9999,min:1970}},O=["second","minute","hour","date","month","weekday","year"],U={"@annually":"0 0 1 1 *","@yearly":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *"},Q=6;function s(n,e){return(""+n).indexOf(e)!==-1}function T(n){return Array.from(new Set(n))}function I(n){return/^\d+$/.test(n)}function d(n,e){return I(n)?+n:e[n.toUpperCase()]}function sn(n){return O.forEach(function(r){Jn(n[r],p[r],r)}),n}function Jn(n,e,r){typeof n!="string"&&typeof n!="number"&&un(n,r);let t=""+n;t!=="*"&&(r==="date"&&v(t)||r==="weekday"&&w(t,e)||t.split(",").forEach(function(o){$n(o,e)||un(o,r)}))}function v(n){if(n==="L"||n==="LW"||n==="WL")return!0;let e=/^L-(\d{1,2})$/.exec(n);if(e)return+e[1]>=1&&+e[1]<=30;let r=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(r){let t=+(r[1]||r[2]);return t>=1&&t<=31}return!1}function w(n,e){if(/L$/.test(n))return C(n.slice(0,-1),e);let r=n.split("#");return r.length===2?C(r[0],e)&&/^[1-5]$/.test(r[1]):!1}function $n(n,e){return s(n,"/")?Yn(n,e):s(n,"-")?an(n,e):C(n,e)}function Yn(n,e){let r=n.split("/");return r.length!==2||!I(r[1])||+r[1]<1?!1:r[0]==="*"||C(r[0],e)||an(r[0],e,!0)}function an(n,e,r){let t=n.split("-");return t.length!==2||!C(t[0],e)||!C(t[1],e)?!1:e.cyclic&&!r?!0:d(t[0],e.numbers)<=d(t[1],e.numbers)}function C(n,e){return n==="*"?!1:I(n)?+n>=e.min&&+n<=e.max:e.numbers?n.toUpperCase()in e.numbers:!1}function un(n,e){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+e+" field.")}var Bn={hour:24,minute:60,second:60};function cn(n){O.forEach(function(r){let t=p[r].aliases,i=t&&t[""+n[r]];i&&(n[r]=i)})}function mn(n){return O.forEach(function(r){let t=""+n[r];if(r==="date"&&v(t)||r==="weekday"&&w(t,p[r])){n[r]=t;return}n[r]=Gn(t,r,p[r])}),n}function Gn(n,e,r){let t=""+n;if(t==="*")return t;let i=Bn[e],o=t.split(",").map(function(a){return Xn(_n(Zn(Kn(a,r),r),r),r,i)}).join(",").split(",");return o.indexOf("*")!==-1?"*":T(o).sort(function(a,c){return ln(a,r)-ln(c,r)}).join(",")}function Kn(n,e){let r=n.split("/");if(!e.cyclic||r.length!==2||+r[1]!=1)return n;let t=r[0];return s(t,"-")?t:t==="*"||d(t,e.numbers)===e.min?"*":t+"-"+e.top}function Zn(n,e){let r=n.split("/");if(!e.cyclic||typeof e.top!="number"||r.length!==2||s(r[0],"-"))return n;let t=r[0];return(t==="*"?e.min:d(t,e.numbers))+ +r[1]<=e.top?n:t==="*"?""+e.min:t}function Xn(n,e,r){let t=n.split("/");if(typeof r!="number"||t.length!==2||s(t[0],"-"))return n;let i=+t[1],o=t[0]==="*"?e.min:d(t[0]);if(r%i===0&&o<i)return n;let u=[];for(let a=o;a<=e.top;a+=i)u.push(a);return u.join(",")}function _n(n,e){let r=n.split("/")[0];if(!s(r,"-"))return n;let t=r.split("-");return d(t[0],e.numbers)!==d(t[1],e.numbers)?n:t[0]}function ln(n,e){let r=n.split("/")[0].split("-")[0];return r==="*"?e.min:d(r,e.numbers)}function dn(n,e){let r=n instanceof Array;if(n===null||typeof n>"u"||n===""||r&&n.length===0)throw new Error("`cronli5` expects a non-empty cron pattern as the first argument.");if(r)return fn(n,e);if(typeof n=="object")return ne(n);if(typeof n=="string")return ee(n,e);throw new Error("`cronli5` was passed an unexpected type.")}function fn(n,e){if(n.length>7)throw new Error("`cronli5` was passed a cron pattern with more than seven fields.");return!e.seconds&&n.length<(e.years?7:6)&&n.unshift("0"),{second:n[0]||"0",minute:n[1]||"*",hour:n[2]||"*",date:n[3]||"*",month:n[4]||"*",weekday:n[5]||"*",year:n[6]||"*"}}function ne(n){if(!n.second&&!n.minute&&!n.hour)throw new Error("`cronli5` expects that any object being interpreted as a cron pattern have at least one of the following properties: `second`, `minute`, or `hour`");let e=typeof n.second<"u",r=typeof n.minute<"u",t=e?"*":"0",i=e||r?"*":"0";return{second:k(n.second,"0"),minute:k(n.minute,t),hour:k(n.hour,i),date:k(n.date,"*"),month:k(n.month,"*"),weekday:k(n.weekday,"*"),year:k(n.year,"*")}}function k(n,e){return typeof n>"u"?e:n}function ee(n,e){let r=re(n).split(/\s+/);return fn(r,e)}function re(n){let e=n.trim();if(e.charAt(0)!=="@")return n;let r=e.toLowerCase();if(Object.hasOwn(U,r))return U[r];throw new Error("`cronli5` does not recognize the macro `"+e+"`.")}function gn(n){return n!=="*"&&!s(n,",")&&!s(n,"-")&&!s(n,"/")}function q(n){return s(n,"-")&&!s(n,",")&&!s(n,"/")}function te(n){return s(n,"/")&&!s(n,",")}function V(n){return n!=="*"&&!s(n,"-")&&!s(n,"/")}function J(n){return n!=="*"&&!q(n)&&!te(n)}function R(n,e,r){let t=[],i=n;for(;i<=r;)t.push(i),i+=e;return t}function pn(n,e,r,t){let i=n.split("/"),o=+i[1];if(s(i[0],"-")){let a=i[0].split("-");return R(d(a[0],t),o,d(a[1],t))}let u=i[0]==="*"?e:d(i[0],t);return R(u,o,r)}function $(n,e,r){let t=[];return n.split(",").forEach(function(o){if(s(o,"/"))t.push(...pn(o,e,r));else if(s(o,"-")){let u=o.split("-");+u[0]<=+u[1]?t.push(...R(+u[0],1,+u[1])):(t.push(...R(+u[0],1,r)),t.push(...R(e,1,+u[1])))}else t.push(+o)}),T(t)}function ie(n){return V(n)?n.split(",").map(Number):[0]}function oe(n){if(n==="*")return[0,59];if(q(n)){let e=n.split("-");if(+e[0]<=+e[1])return[+e[0],+e[1]]}return null}function ue(n){return n==="*"?59:Math.max(...$(n,0,59))}function se(n){if(gn(n)&&n!=="0")return+n}function ae(n,e){return n==="*"?"wildcard":e==="date"&&v(n)||e==="weekday"&&w(n,p.weekday)?"quartz":s(n,",")?"list":s(n,"/")?"step":s(n,"-")?"range":"single"}function le(n,e,r){return e==="wildcard"||e==="quartz"?null:n.split(",").map(function(i){if(s(i,"/")){let o=i.split("/");return{fires:pn(i,r.min,r.top,r.numbers),interval:+o[1],kind:"step",startToken:o[0]}}return s(i,"-")?{bounds:i.split("-"),kind:"range"}:{kind:"single",value:i}})}function hn(n){let e={},r={};O.forEach(function(u){e[u]=ae(n[u],u),r[u]=le(n[u],e[u],p[u])});let i={analyses:{clockSecond:se(n.second),lastMinuteFire:ue(n.minute),minuteSpan:oe(n.minute),segments:r},pattern:n,shapes:e};return{...i,plan:ce(i)}}function ce(n){let{analyses:e,pattern:r,shapes:t}=n;if(r.second!=="0"){let i=me(r,t,e);if(i)return i}return yn(r,t,e)||Sn(r,t,e)}function me(n,e,r){let t=de(n,e);return t||(n.hour==="*"&&e.minute==="single"&&n.second!=="*"?{kind:"secondsWithinMinute",singleSecond:e.second==="single"}:e.second==="single"&&V(n.minute)&&J(n.hour)?null:{kind:"composeSeconds",rest:yn(n,e,r,!0)||Sn(n,e,r,!0)})}function de(n,e){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:e.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function yn(n,e,r,t=!1){if(e.minute==="step")return{hours:ge(n,e,r),kind:"minuteFrequency"};if(e.hour==="single"&&r.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:r.minuteSpan};let i=pe(n,e);if(i)return i;let o=fe(n,e);if(o)return o;if(n.hour==="*")return he(n,e,t)}function bn(n){let[e,r]=n.split("/"),t=e==="*"?0:+e;return e.indexOf("-")===-1&&24%+r===0&&t<+r}function fe(n,e){return e.hour!=="step"?null:n.minute==="*"?bn(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:M(n.hour)}:e.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:null}function ge(n,e,r){if(e.hour==="list")return{kind:"during",times:M(n.hour)};if(e.hour==="range"){let t=n.hour.split("-");return{from:+t[0],kind:"window",last:r.lastMinuteFire,to:+t[1]}}return e.hour==="single"?{from:+n.hour,kind:"window",last:r.lastMinuteFire,to:+n.hour}:e.hour==="step"?bn(n.hour)?{kind:"step"}:{kind:"during",times:M(n.hour)}:{kind:"none"}}function pe(n,e){return J(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:M(n.hour)}:e.minute==="range"||e.minute==="list"&&s(n.minute,"-")&&!s(n.minute,"/")?{form:e.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:M(n.hour)}:null:null}function he(n,e,r){if(e.minute==="range")return{kind:"rangeOfMinutes"};if(e.minute==="list")return{kind:"multipleMinutes"};if(n.minute==="*")return{kind:"everyMinute"};if(n.minute!=="0"||r)return{kind:"singleMinute"}}function Sn(n,e,r,t=!1){let i=t&&n.minute==="0";return e.hour==="range"&&!i?ye(n,e,r):e.hour==="step"&&n.minute==="0"&&!t?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:be(n,r,i)}function ye(n,e,r){let t=n.hour.split("-"),i="lead";return n.minute==="*"?i="wildcard":e.minute==="range"&&(i="range"),{boundMinute:e.minute==="range"||e.minute==="list"?null:r.lastMinuteFire,from:+t[0],kind:"hourRange",last:r.lastMinuteFire,minuteForm:i,to:+t[1]}}function be(n,e,r=!1){let t=$(n.hour,0,23),i=ie(n.minute);if(!r&&t.length*i.length>Q)return{fold:i.length===1,kind:"compactClockTimes",minute:i[0]};let o=[];return t.forEach(function(a){i.forEach(function(j){o.push({hour:a,minute:j,second:e.clockSecond})})}),{kind:"clockTimes",times:o}}function M(n){let e=$(n,0,23);return e.length<=Q?{fires:e,kind:"fires"}:{kind:"segments"}}function On(n,e){let r=dn(n,e);return cn(r),sn(r),mn(r)}function Y(n){return n=""+n,n.length<2?"0"+n:n}function kn(n,e,r){return r.short?n:e[n]||n}function B(n,{sep:e,pad:r,lean:t}){let i=r?Y(n.hour):""+n.hour;return t&&!n.minute&&!n.second?i:i+e+Y(n.minute)+(n.second?e+Y(n.second):"")}var G={gb:{am:"am",closeUp:!0,dayFirst:!0,midday:"midday",midnight:"midnight",ordinals:!1,pm:"pm",sep:".",serialComma:!1,through:" to "},us:{am:"a.m.",closeUp:!1,dayFirst:!1,midday:"noon",midnight:"midnight",ordinals:!1,pm:"p.m.",sep:":",serialComma:!0,through:" through "},house:{am:"AM",closeUp:!1,dayFirst:!1,midday:"noon",midnight:"midnight",ordinals:!0,pm:"PM",sep:":",serialComma:!0,through:" - "}};function Nn(n){return typeof n=="object"&&n!==null?{...G.us,...n}:G[n==="uk"?"gb":n]||G.us}var Se=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],K=["th","st","nd","rd"],f=[null,["January","Jan"],["February","Feb"],["March","Mar"],["April","Apr"],["May","May"],["June","Jun"],["July","Jul"],["August","Aug"],["September","Sep"],["October","Oct"],["November","Nov"],["December","Dec"]],y=[["Sunday","Sun"],["Monday","Mon"],["Tuesday","Tue"],["Wednesday","Wed"],["Thursday","Thu"],["Friday","Fri"],["Saturday","Sat"]],Oe={JAN:f[1],FEB:f[2],MAR:f[3],APR:f[4],MAY:f[5],JUN:f[6],JUL:f[7],AUG:f[8],SEP:f[9],OCT:f[10],NOV:f[11],DEC:f[12]},ke={SUN:y[0],MON:y[1],TUE:y[2],WED:y[3],THU:y[4],FRI:y[5],SAT:y[6]},Ne=[null,"first","second","third","fourth","fifth"];function ze(n){return n=n||{},{ampm:typeof n.ampm=="boolean"?n.ampm:!0,lenient:!!n.lenient,seconds:!!n.seconds,short:!!n.short,style:Nn(n.dialect),years:!!n.years}}function Pe(n,e){return er(Pn(n,n.plan,e),n,e)}function Pn(n,e,r){let t=$e[e.kind];return t(n,e,r)}function Ce(n,e,r){return"every second"+l(n,r)}function ve(n,e,r){return H(n,r)+l(n,r)}function we(n,e,r){let t=n.pattern.second;return g(t,r)+" "+P(t,"second")+" past the minute, every minute"+l(n,r)}function Re(n,e,r){let t=n.pattern.minute,i=g(t,r),o=P(t,"minute");if(e.singleSecond){let u=n.pattern.second;return i+" "+o+" and "+g(u,r)+" "+P(u,"second")+" past the hour, every hour"+l(n,r)}return H(n,r)+", "+i+" "+o+" past the hour, every hour"+l(n,r)}function Me(n,e,r){return H(n,r)+", "+Pn(n,e.rest,r)}function H(n,e){let r=n.pattern.second,t=n.shapes.second;if(r==="*")return"every second";if(t==="step")return Rn(n.analyses.segments.second[0],"second","minute",e);if(t==="range"){let i=r.split("-"),o=A(i,e);return"every second from "+o(i[0])+S(e)+o(i[1])+" past the minute"}return t==="single"?"at "+g(r,e)+" "+P(r,"second")+" past the minute":z(F(n.analyses.segments.second,e),"second","minute",e)}function xe(n,e,r){return"every minute"+l(n,r)}function Fe(n,e,r){let t=n.pattern.minute;return g(t,r)+" "+P(t,"minute")+" past the hour, every hour"+l(n,r)}function Te(n,e,r){return L(n.pattern.minute,r)+l(n,r)}function Ie(n,e,r){return z(F(n.analyses.segments.minute,r),"minute","hour",r)+l(n,r)}function He(n,e,r){let t=Rn(n.analyses.segments.minute[0],"minute","hour",r);return e.hours.kind==="during"?t+=" during the "+X(n,e.hours.times,!1,r)+" hours":e.hours.kind==="window"?t+=" "+wn(e.hours,r):e.hours.kind==="step"&&(t+=" "+Cn(n.analyses.segments.hour[0],r)),t+l(n,r)}function Le(n,e,r){return"every minute from "+m({hour:e.hour,minute:e.span[0]},r)+S(r)+m({hour:e.hour,minute:e.span[1]},r)+l(n,r)}function Ae(n,e,r){if(e.form==="wildcard")return"every minute during the "+X(n,e.times,!1,r)+" hours"+l(n,r);let t=X(n,e.times,!0,r);return(e.form==="range"?L(n.pattern.minute,r):z(F(n.analyses.segments.minute,r),"minute","hour",r))+", at "+t+l(n,r)}var Ee={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function Cn(n,e){let r="during every "+Ee[n.interval]+" hour",t=n.startToken==="*"?0:+n.startToken;return t===0?r:r+" starting at "+m({hour:t,minute:0},e)}function We(n,e,r){let t=n.analyses.segments.hour[0];return e.form==="wildcard"?"every minute "+Cn(t,r)+l(n,r):L(n.pattern.minute,r)+", "+Mn(t,r)+l(n,r)}function L(n,e){let r=n.split("-"),t=A(r,e);return"every minute from "+t(r[0])+S(e)+t(r[1])+" past the hour"}function je(n,e,r){return"every hour"+l(n,r)}function De(n,e,r){let t=wn(Qe(e),r);return e.minuteForm==="wildcard"?"every minute "+t+l(n,r):e.minuteForm==="range"?L(n.pattern.minute,r)+", "+t+l(n,r):vn(n,r)+" "+t+l(n,r)}function vn(n,e){return n.pattern.minute==="0"?"every hour":z(F(n.analyses.segments.minute,e),"minute","hour",e)}function Ue(n,e,r){return Mn(n.analyses.segments.hour[0],r)+l(n,r)}function Qe(n){return{from:n.from,last:n.boundMinute??0,to:n.to}}function wn(n,e){return"from "+m({hour:n.from,minute:0},e)+S(e)+m({hour:n.to,minute:n.last},e)}function qe(n,e,r){let t=rn(e.times),i=e.times.map(function(u){return m({hour:u.hour,minute:u.minute,second:u.second,plain:t},r)});return xn(n,r)+"at "+b(i,r)}function Ve(n,e,r){if(e.fold){if(n.analyses.segments.hour.some(function(a){return a.kind==="range"})&&!n.analyses.clockSecond)return Je(n,e,r)+l(n,r);let o={minute:e.minute,second:n.analyses.clockSecond};return xn(n,r)+"at "+_(n,o,!0,r)}let t=z(F(n.analyses.segments.minute,r),"minute","hour",r)+", at "+_(n,{minute:0,second:null},!0,r)+l(n,r);return n.analyses.clockSecond?H(n,r)+", "+t:t}function Je(n,e,r){let t=e.minute,i=[],o=[];n.analyses.segments.hour.forEach(function(c){c.kind==="range"?i.push("from "+m({hour:c.bounds[0],minute:0},r)+S(r)+m({hour:c.bounds[1],minute:t},r)):c.kind==="step"?o.push(...c.fires):o.push(+c.value)});let u=vn(n,r)+" "+b(i,r);return o.length&&(u+=" and at "+b(o.map(function(c){return m({hour:c,minute:t},r)}),r)),u}var $e={clockTimes:qe,compactClockTimes:Ve,composeSeconds:Me,everyHour:je,everyMinute:xe,everySecond:Ce,hourRange:De,hourStep:Ue,minuteFrequency:He,minuteSpanAcrossHourStep:We,minuteSpanInHour:Le,minutesAcrossHours:Ae,multipleMinutes:Ie,rangeOfMinutes:Te,secondPastMinute:we,secondsWithinMinute:Re,singleMinute:Fe,standaloneSeconds:ve};function Rn(n,e,r,t){if(n.startToken.indexOf("-")!==-1)return z(zn(n.fires,t),e,r,t);let i=n.startToken==="*"?0:+n.startToken,o=n.interval;return i!==0?n.fires.length<=3?z(zn(n.fires,t),e,r,t):"every "+g(o,t)+" "+e+"s from "+g(i,t)+" "+P(i,e)+" past the "+r:"every "+g(o,t)+" "+e+"s"}function Mn(n,e){if(n.startToken.indexOf("-")!==-1)return"at "+Z(n.fires,e);let r=n.startToken==="*"?0:+n.startToken,t=n.interval;return r===0?"every "+g(t,e)+" hours":n.fires.length<=3?"at "+Z(n.fires,e):"every "+g(t,e)+" hours from "+m({hour:r,minute:0},e)}function A(n,e){let r=n.some(function(i){return+i>10});return function(i){return r?""+i:g(i,e)}}function zn(n,e){return n.map(A(n,e))}function F(n,e){let r=n.flatMap(function(o){return o.kind==="range"?o.bounds:o.kind==="step"?o.fires:[o.value]}),t=A(r,e);return n.flatMap(function(o){return o.kind==="range"?[t(o.bounds[0])+S(e)+t(o.bounds[1])]:o.kind==="step"?o.fires.map(t):[t(o.value)]})}function z(n,e,r,t){return"at "+b(n,t)+" "+e+"s past the "+r}function Ye(n,e,r){return(+n==0||+n==12)&&+e==0&&!(typeof r=="number"&&r>0)}function rn(n){let e=n.filter(function(t){return Ye(t.hour,t.minute,t.second)});return e.length>0&&e.length<n.length}function Z(n,e){let r=rn(n.map(function(o){return{hour:o,minute:0}})),t=n.map(function(o){return m({hour:o,minute:0,plain:r},e)});return b(t,e)}function X(n,e,r,t){return e.kind==="fires"?Z(e.fires,t):_(n,{minute:0,second:null},r,t)}function Be(n){return n.kind==="range"?n.bounds:n.kind==="step"?n.fires:[n.value]}function _(n,e,r,t){let{minute:i,second:o}=e,u=n.analyses.segments.hour,a=rn(u.flatMap(function(h){return Be(h).map(function(D){return{hour:+D,minute:i,second:o}})})),c=[];return u.forEach(function(h){h.kind==="step"?c.push(...h.fires.map(function(D){return m({hour:D,minute:i,second:o,plain:a},t)})):h.kind==="range"?c.push(m({hour:h.bounds[0],minute:i,second:o,plain:a},t)+S(t)+m({hour:h.bounds[1],minute:i,second:o,plain:a},t)):c.push(m({hour:h.value,minute:i,second:o,plain:a},t))}),b(Ge(c,u,r),t)}function Ge(n,e,r){let t=e.some(function(o){return o.kind==="range"});return!r||!t?n:n.map(function(o,u){return u===0?o:"at "+o})}function b(n,e){if(n.length<=1)return n.join("");if(n.length===2)return n[0]+" and "+n[1];let r=e.style.serialComma?", and ":" and ";return n.slice(0,-1).join(", ")+r+n[n.length-1]}var Ke={all:"",month:"in ",stepDate:"on ",weekday:"on "},Ze={all:"every day",month:"every day in ",stepDate:"",weekday:"every "};function l(n,e){let r=Fn(n,Ke,e);return r&&" "+r}function xn(n,e){return Fn(n,Ze,e)+" "}function Fn(n,e,r){let t=n.pattern;return t.date!=="*"&&t.weekday!=="*"?_e(n,r):t.date!=="*"?Xe(n,e,r):t.weekday!=="*"?(Hn(t.weekday,r)||e.weekday+Wn(n,r))+N(n,r):t.month!=="*"?e.month+E(n,r):e.all}function Xe(n,e,r){let t=n.pattern,i=In(t.date,r);return i?i+N(n,r):tn(t.date)?e.stepDate+An(t.date)+N(n,r):t.month!=="*"&&!Tn(n)?"on the "+nn(n,r)+N(n,r):t.month!=="*"?"on "+Ln(n,r):"on the "+nn(n,r)}function Tn(n){return!En(n.pattern.month)&&n.analyses.segments.month.every(function(r){return r.kind!=="range"})}function _e(n,e){let r=n.pattern,t=Hn(r.weekday,e)||"on "+Wn(n,e),i=In(r.date,e);return i?i+N(n,e)+" or "+t:tn(r.date)?An(r.date)+N(n,e)+" or "+t:r.month!=="*"&&Tn(n)?"on "+Ln(n,e)+" or "+t+" in "+E(n,e):"on the "+nn(n,e)+" or "+t+N(n,e)}function In(n,e){if(n==="L")return"on the last day of the month";if(n==="LW"||n==="WL")return"on the last weekday of the month";let r=/^L-(\d{1,2})$/.exec(n);if(r)return g(+r[1],e)+" "+P(r[1],"day")+" before the last day of the month";let t=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(t)return"on the weekday nearest the "+x(t[1]||t[2])}function Hn(n,e){let r=n.split("#");if(r.length===2)return"on the "+Ne[+r[1]]+" "+en(r[0],e)+" of the month";if(/L$/.test(n))return"on the last "+en(n.slice(0,-1),e)+" of the month"}function Ln(n,e){let r=E(n,e),t=W(n.analyses.segments.date,e.style.ordinals?x:nr,e);return e.style.dayFirst?t+" "+r:r+" "+t}function nr(n){return""+n}function N(n,e){return n.pattern.month==="*"?"":" in "+E(n,e)}function An(n){let e=n.split("/"),r=+e[1],t=e[0],o=(r===2?"every other":"every "+x(r))+" day of the month";return t!=="*"&&t!=="1"&&(o+=" from the "+x(t)),o}function nn(n,e){return W(n.analyses.segments.date,x,e)}function E(n,e){let r=En(n.pattern.month);return r||W(n.analyses.segments.month,function(i){return or(i,e)},e)}function En(n){if(!tn(n))return null;let[e,r]=n.split("/");return+r!=2?null:e==="*"||e==="1"?"every odd-numbered month":e==="2"?"every even-numbered month":null}function Wn(n,e){return W(n.analyses.segments.weekday,function(t){return en(t,e)},e)}function W(n,e,r){let t=[];return n.forEach(function(o){o.kind==="step"?t.push(...o.fires.map(e)):o.kind==="range"?t.push(o.bounds.map(e).join(S(r))):t.push(e(o.value))}),b(t,r)}function tn(n){return n.indexOf("/")!==-1&&n.indexOf("-")===-1&&n.indexOf(",")===-1}function er(n,e,r){let t=e.pattern.year;if(t==="*")return n;if(t.indexOf("/")!==-1)return n+" "+tr(t,r);let i=rr(t,r);if(t.indexOf("-")===-1&&t.indexOf(",")===-1&&e.pattern.date!=="*"&&n.indexOf(" at ")!==-1){let o=r.style.dayFirst?" ":", ";return n.replace(" at ",o+i+" at ")}return n+" in "+i}function rr(n,e){return n.indexOf(",")!==-1?b(n.split(","),e):n}function tr(n,e){let r=n.split("/"),t=+r[1],i=r[0];if(t<=1)return"every year";let o="every "+g(t,e)+" years";return i!=="*"&&i!=="0"&&(o+=" from "+i),o}function m(n,e){let{hour:r,minute:t,plain:i}=n,o=typeof n.second=="number"&&n.second>0?n.second:0;return e.ampm?ir({hour:r,minute:t,second:o,plain:i},e):B({hour:r,minute:t,second:o},{pad:!0,sep:e.style.sep})}function ir(n,e){let{hour:r,minute:t,second:i,plain:o}=n,u=e.style;if(!o&&+t==0&&!i){if(+r==0)return u.midnight;if(+r==12)return u.midday}return B({hour:r%12||12,minute:t,second:i},{lean:!0,sep:u.sep})+(u.closeUp?"":" ")+(r<12?u.am:u.pm)}function g(n,e){return kn(n,Se,e)}function P(n,e){return+n==1?e:e+"s"}function S(n){return n.short?"-":n.style.through}function x(n){let e=Math.abs(n),r=K[e];return r||(e=(e%100-20)%10,r=K[e]||K[0]),n+r}function or(n,e){let r=f[n]||Oe[n];return r&&r[e.short?1:0]}function en(n,e){let r=n===7||n==="7"?0:n,t=y[r]||ke[r];return t&&t[e.short?1:0]}var ur={describe:Pe,fallback:"an unrecognizable cron pattern",options:ze,reboot:"at system startup",sentence:n=>"Runs "+n+"."},jn=ur;/**
2
2
  * @license MIT, Copyright (c) 2026 Andrew Brož
3
- */function tr(n,e){let r=e&&e.lang||Wn,t=r.options(e);if(!t.lenient)return Dn(jn(n,r,t),r,e);try{return Dn(jn(n,r,t),r,e)}catch{return r.fallback}}function Dn(n,e,r){return r&&r.sentence?e.sentence(n):n}function jn(n,e,r){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return e.reboot;let t=pn(On(n,r)),i=e.strategy?e.strategy(t,t.plan):t.plan;return e.describe({...t,plan:i},r)}var on=tr;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:on});var Dr=on;})();
3
+ */function sr(n,e){let r=e&&e.lang||jn,t=r.options(e);if(!t.lenient)return Dn(Un(n,r,t),r,e);try{return Dn(Un(n,r,t),r,e)}catch{return r.fallback}}function Dn(n,e,r){return r&&r.sentence?e.sentence(n):n}function Un(n,e,r){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return e.reboot;let t=hn(On(n,r)),i=e.strategy?e.strategy(t,t.plan):t.plan;return e.describe({...t,plan:i},r)}var on=sr;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:on});var qr=on;})();
package/dist/cronli5.cjs CHANGED
@@ -194,6 +194,11 @@ function throwInvalidField(value, field) {
194
194
  }
195
195
 
196
196
  // src/core/normalize.ts
197
+ var timeFieldCycle = {
198
+ hour: 24,
199
+ minute: 60,
200
+ second: 60
201
+ };
197
202
  function applyQuartzAliases(cronPattern) {
198
203
  fieldOrder.forEach(function apply(field) {
199
204
  const aliases = fieldSpecs[field].aliases;
@@ -210,21 +215,26 @@ function normalizeCronPattern(cronPattern) {
210
215
  cronPattern[field] = value;
211
216
  return;
212
217
  }
213
- cronPattern[field] = normalizeField(value, fieldSpecs[field]);
218
+ cronPattern[field] = normalizeField(value, field, fieldSpecs[field]);
214
219
  });
215
220
  return cronPattern;
216
221
  }
217
- function normalizeField(value, spec) {
222
+ function normalizeField(value, field, spec) {
218
223
  const stringValue = "" + value;
219
224
  if (stringValue === "*") {
220
225
  return stringValue;
221
226
  }
227
+ const cycle = timeFieldCycle[field];
222
228
  const segments = stringValue.split(",").map(function canonical(segment) {
223
- return collapseDegenerateRange(
224
- collapseOnceStep(collapseUnitStep(segment, spec), spec),
225
- spec
229
+ return enumerateNonUniformStep(
230
+ collapseDegenerateRange(
231
+ collapseOnceStep(collapseUnitStep(segment, spec), spec),
232
+ spec
233
+ ),
234
+ spec,
235
+ cycle
226
236
  );
227
- });
237
+ }).join(",").split(",");
228
238
  if (segments.indexOf("*") !== -1) {
229
239
  return "*";
230
240
  }
@@ -258,6 +268,22 @@ function collapseOnceStep(segment, spec) {
258
268
  }
259
269
  return start === "*" ? "" + spec.min : start;
260
270
  }
271
+ function enumerateNonUniformStep(segment, spec, cycle) {
272
+ const parts = segment.split("/");
273
+ if (typeof cycle !== "number" || parts.length !== 2 || includes(parts[0], "-")) {
274
+ return segment;
275
+ }
276
+ const interval = +parts[1];
277
+ const start = parts[0] === "*" ? spec.min : toFieldNumber(parts[0]);
278
+ if (cycle % interval === 0 && start < interval) {
279
+ return segment;
280
+ }
281
+ const fires = [];
282
+ for (let value = start; value <= spec.top; value += interval) {
283
+ fires.push(value);
284
+ }
285
+ return fires.join(",");
286
+ }
261
287
  function collapseDegenerateRange(segment, spec) {
262
288
  const start = segment.split("/")[0];
263
289
  if (!includes(start, "-")) {
@@ -532,7 +558,7 @@ function planSeconds(pattern, shapes, analyses) {
532
558
  }
533
559
  return {
534
560
  kind: "composeSeconds",
535
- rest: planMinutes(pattern, shapes, analyses) || planHours(pattern, shapes, analyses)
561
+ rest: planMinutes(pattern, shapes, analyses, true) || planHours(pattern, shapes, analyses, true)
536
562
  };
537
563
  }
538
564
  function planStandaloneSeconds(pattern, shapes) {
@@ -547,7 +573,7 @@ function planStandaloneSeconds(pattern, shapes) {
547
573
  }
548
574
  return { kind: "standaloneSeconds" };
549
575
  }
550
- function planMinutes(pattern, shapes, analyses) {
576
+ function planMinutes(pattern, shapes, analyses, subMinuteSecond = false) {
551
577
  if (shapes.minute === "step") {
552
578
  return {
553
579
  hours: planFrequencyHours(pattern, shapes, analyses),
@@ -570,7 +596,7 @@ function planMinutes(pattern, shapes, analyses) {
570
596
  return underStep;
571
597
  }
572
598
  if (pattern.hour === "*") {
573
- return planMinutesUnderOpenHour(pattern, shapes);
599
+ return planMinutesUnderOpenHour(pattern, shapes, subMinuteSecond);
574
600
  }
575
601
  }
576
602
  function cleanHourStride(hourField) {
@@ -640,7 +666,7 @@ function planMinutesAcrossHours(pattern, shapes) {
640
666
  }
641
667
  return null;
642
668
  }
643
- function planMinutesUnderOpenHour(pattern, shapes) {
669
+ function planMinutesUnderOpenHour(pattern, shapes, subMinuteSecond) {
644
670
  if (shapes.minute === "range") {
645
671
  return { kind: "rangeOfMinutes" };
646
672
  }
@@ -650,39 +676,45 @@ function planMinutesUnderOpenHour(pattern, shapes) {
650
676
  if (pattern.minute === "*") {
651
677
  return { kind: "everyMinute" };
652
678
  }
653
- if (pattern.minute !== "0") {
679
+ if (pattern.minute !== "0" || subMinuteSecond) {
654
680
  return { kind: "singleMinute" };
655
681
  }
656
682
  }
657
- function planHours(pattern, shapes, analyses) {
658
- if (shapes.hour === "range") {
659
- const bounds = pattern.hour.split("-");
660
- let minuteForm = "lead";
661
- if (pattern.minute === "*") {
662
- minuteForm = "wildcard";
663
- } else if (shapes.minute === "range") {
664
- minuteForm = "range";
665
- }
666
- return {
667
- from: +bounds[0],
668
- kind: "hourRange",
669
- last: analyses.lastMinuteFire,
670
- minuteForm,
671
- to: +bounds[1]
672
- };
683
+ function planHours(pattern, shapes, analyses, subMinuteSecond = false) {
684
+ const absorbsMinuteZero = subMinuteSecond && pattern.minute === "0";
685
+ if (shapes.hour === "range" && !absorbsMinuteZero) {
686
+ return planHourRange(pattern, shapes, analyses);
673
687
  }
674
- if (shapes.hour === "step" && pattern.minute === "0") {
688
+ if (shapes.hour === "step" && pattern.minute === "0" && !subMinuteSecond) {
675
689
  return { kind: "hourStep" };
676
690
  }
677
- if (pattern.hour === "*") {
691
+ if (pattern.hour === "*" && !absorbsMinuteZero) {
678
692
  return { kind: "everyHour" };
679
693
  }
680
- return planClockTimes(pattern, analyses);
694
+ return planClockTimes(pattern, analyses, absorbsMinuteZero);
695
+ }
696
+ function planHourRange(pattern, shapes, analyses) {
697
+ const bounds = pattern.hour.split("-");
698
+ let minuteForm = "lead";
699
+ if (pattern.minute === "*") {
700
+ minuteForm = "wildcard";
701
+ } else if (shapes.minute === "range") {
702
+ minuteForm = "range";
703
+ }
704
+ const multiValued = shapes.minute === "range" || shapes.minute === "list";
705
+ return {
706
+ boundMinute: multiValued ? null : analyses.lastMinuteFire,
707
+ from: +bounds[0],
708
+ kind: "hourRange",
709
+ last: analyses.lastMinuteFire,
710
+ minuteForm,
711
+ to: +bounds[1]
712
+ };
681
713
  }
682
- function planClockTimes(pattern, analyses) {
714
+ function planClockTimes(pattern, analyses, enumerate = false) {
683
715
  const hours = enumerateFires(pattern.hour, 0, 23);
684
716
  const minutes = enumerateValues(pattern.minute);
685
- if (hours.length * minutes.length > maxClockTimes) {
717
+ if (!enumerate && hours.length * minutes.length > maxClockTimes) {
686
718
  return {
687
719
  fold: minutes.length === 1,
688
720
  kind: "compactClockTimes",
@@ -996,7 +1028,7 @@ function renderEveryHour(ir, plan, opts) {
996
1028
  return "every hour" + trailingQualifier(ir, opts);
997
1029
  }
998
1030
  function renderHourRange(ir, plan, opts) {
999
- const window = hourWindow(plan, opts);
1031
+ const window = hourWindow(boundedWindow(plan), opts);
1000
1032
  if (plan.minuteForm === "wildcard") {
1001
1033
  return "every minute " + window + trailingQualifier(ir, opts);
1002
1034
  }
@@ -1019,6 +1051,9 @@ function rangeMinuteLead(ir, opts) {
1019
1051
  function renderHourStep(ir, plan, opts) {
1020
1052
  return stepHours(ir.analyses.segments.hour[0], opts) + trailingQualifier(ir, opts);
1021
1053
  }
1054
+ function boundedWindow(plan) {
1055
+ return { from: plan.from, last: plan.boundMinute ?? 0, to: plan.to };
1056
+ }
1022
1057
  function hourWindow(window, opts) {
1023
1058
  return "from " + getTime({ hour: window.from, minute: 0 }, opts) + through(opts) + getTime({ hour: window.to, minute: window.last }, opts);
1024
1059
  }
@@ -1117,13 +1152,7 @@ function stepCycle60(segment, unit, anchor, opts) {
1117
1152
  }
1118
1153
  return "every " + getNumber(interval, opts) + " " + unit + "s from " + getNumber(start, opts) + " " + pluralize(start, unit) + " past the " + anchor;
1119
1154
  }
1120
- if (60 % interval === 0) {
1121
- return "every " + getNumber(interval, opts) + " " + unit + "s";
1122
- }
1123
- if (segment.fires.length <= 2) {
1124
- return listPastThe(numberWords(segment.fires, opts), unit, anchor, opts);
1125
- }
1126
- return "every " + getNumber(interval, opts) + " " + unit + "s past the " + anchor;
1155
+ return "every " + getNumber(interval, opts) + " " + unit + "s";
1127
1156
  }
1128
1157
  function stepHours(segment, opts) {
1129
1158
  if (segment.startToken.indexOf("-") !== -1) {
@@ -1131,15 +1160,12 @@ function stepHours(segment, opts) {
1131
1160
  }
1132
1161
  const start = segment.startToken === "*" ? 0 : +segment.startToken;
1133
1162
  const interval = segment.interval;
1134
- if (start === 0 && 24 % interval === 0) {
1163
+ if (start === 0) {
1135
1164
  return "every " + getNumber(interval, opts) + " hours";
1136
1165
  }
1137
1166
  if (segment.fires.length <= 3) {
1138
1167
  return "at " + hourTimes(segment.fires, opts);
1139
1168
  }
1140
- if (start === 0) {
1141
- return "every " + getNumber(interval, opts) + " hours from midnight";
1142
- }
1143
1169
  return "every " + getNumber(interval, opts) + " hours from " + getTime({ hour: start, minute: 0 }, opts);
1144
1170
  }
1145
1171
  function seriesNumber(values, opts) {