cronli5 0.1.5 → 0.1.7

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,77 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.7]
10
+
11
+ A correctness and clarity pass driven by blind, math-inclined native-speaker
12
+ review panels over four rounds of randomly sampled patterns (one reviewer per
13
+ language per round), plus a new conciseness CI gate. Each fix was written
14
+ test-first and validated by round-trip, fuzz, and the metamorphic invariant.
15
+
16
+ ### Added
17
+
18
+ - The conciseness sweep is wired into `npm run verify` as a gate: it exits
19
+ non-zero on any over-budget description and runs alongside lint, types, tests,
20
+ the metamorphic invariant, docs, and build. It is zero over-budget across all
21
+ five languages, guarding against verbosity regressions.
22
+
23
+ ### Fixed
24
+
25
+ - **en:** a month (or year) restriction on an "or"-day cron — both day-of-month
26
+ and day-of-week set, e.g. `15W 6-8 MON#2` — scoped only the day-of-month
27
+ branch, falsely implying the weekday branch fires every month; it now scopes
28
+ the whole or.
29
+ - **en/es/de:** an hour range under a fixed minute (`5 9-17`) folded the minute
30
+ into the window end only ("through 5:05 p.m." with a bare :00 start), a false
31
+ continuous span; now the bare hour window plus the minute clause.
32
+ - **es:** a fixed hour under a step or range minute (`3/2 0`) read "a las
33
+ 00:00", asserting a minute-:00 fire that never happens; now the hour context
34
+ ("a medianoche" / "al mediodía" / "de la hora de las HH").
35
+ - **de:** a standalone offset-clean hour step (`0 0 1/2`) enumerated its hours
36
+ instead of the cadence ("alle 2 Stunden ab 1 Uhr"); and a "jeder
37
+ Minute/Stunde" suffix was emitted even when that field is fixed
38
+ (`30 30 9-17/2`), contradicting it — now dropped unless the field is a
39
+ wildcard.
40
+ - **zh:** an offset hour stride at minute 0 under a sub-minute second enumerated
41
+ instead of its cadence; a month range ran into the day-of-month
42
+ (`6月至8月1日` → `6月至8月,1日`); and a single-hour minute-step with a `15W`
43
+ day dropped the month entirely (`*/25 12 15W 12`) — all fixed.
44
+
45
+ ### Changed
46
+
47
+ - Weekday lists now order Monday-first (Sunday last): `SAT,SUN` reads "Saturday
48
+ and Sunday" (and the equivalent in each language). Display order only — the IR
49
+ stays canonical (Sunday = 0), so ranges, single days, and the metamorphic
50
+ invariant are unaffected.
51
+
52
+ ## [0.1.6]
53
+
54
+ ### Fixed
55
+
56
+ - **Chinese no longer drops the minute** when an uneven minute step meets an uneven
57
+ hour step: `*/25 */5` read "凌晨0点、5点、…、20点" — silently losing minutes :25 and
58
+ :50 (a wrong schedule) — and now reads "从0点起每5小时,至20点,每小时0、25、50分".
59
+ - **A bounded hour step composed with a second no longer doubles the seconds
60
+ clause**: `30 */25 9-17/2` read "at 30 seconds past the minute, at 30 seconds past
61
+ the minute, …"; the clause is now emitted once (en/es/de/fi; zh's clock-time
62
+ variant likewise).
63
+ - **A sub-minute second under a minute list starting at 0 no longer repeats the
64
+ hour**: `* */25 9,17` read "9 a.m., 9 a.m., 9 a.m." (en/es) — fixed.
65
+
66
+ ### Changed
67
+
68
+ - **Far fewer enumerations: steps, ranges, and stepped hours now read as cadences
69
+ and spans throughout composed forms.** Extending 0.1.5's bounded-step cadence into
70
+ every context — a minute step under an hour range/list ("alle 2 Minuten von Minute
71
+ 3 bis 59 jeder Stunde, von 9 bis 17 Uhr"), an hour range or step under a fixed time
72
+ ("at 30 seconds past the hour, every hour from 9 a.m. through 5 p.m."), and
73
+ **offset/uneven hour steps** ("从1点起每2小时"; "every 5 hours from midnight through
74
+ 8 p.m."; "cada 5 horas de las 00:00 a las 20:00") — instead of listing every fire.
75
+ Irregular sets and runs of up to six clock times still read as explicit times. All
76
+ languages.
77
+ - **Chinese renders an hour range inside a list as a span**: `9-20,22` →
78
+ "9点至20点和22点" rather than thirteen enumerated hours.
79
+
9
80
  ## [0.1.5]
10
81
 
11
82
  ### Changed
package/README.md CHANGED
@@ -256,7 +256,7 @@ cronli5('0 0 * * FRI-MON'); // 'every Friday through Monday at midnight'
256
256
  cronli5('0,30 9 * * *'); // 'every day at 9 a.m. and 9:30 a.m.'
257
257
  cronli5('*/15 9-17 * * *'); // 'every 15 minutes from 9 a.m. through 5:45 p.m.'
258
258
  cronli5('30 9-17 * * *');
259
- // 'at 30 minutes past the hour from 9 a.m. through 5:30 p.m.'
259
+ // 'at 30 minutes past the hour from 9 a.m. through 5 p.m.'
260
260
  cronli5('0 12 1 1 *'); // 'on January 1 at noon'
261
261
  cronli5('0 * 13 * *'); // 'every hour on the 13th'
262
262
 
@@ -280,7 +280,7 @@ pattern — `5,10 30 9 * * MON` — in every language:
280
280
  | Language | cronli5 | cRonstrue 3.14.0 |
281
281
  | --- | --- | --- |
282
282
  | English | at five and ten seconds past the minute, every Monday at 9:30 a.m. | At 5 and 10 seconds past the minute, at 30 minutes past the hour, at 09:00 AM, only on Monday |
283
- | German | in den Sekunden 5 und 10 jeder Minute, um 9:30 Uhr montags | Bei Sekunde 5 und 10, bei Minute 30, um 09:00, nur jeden Montag |
283
+ | German | in den Sekunden 5 und 10, um 9:30 Uhr montags | Bei Sekunde 5 und 10, bei Minute 30, um 09:00, nur jeden Montag |
284
284
  | Spanish | los lunes, en los segundos 5 y 10 de las 09:30 | A los 5 y 10 segundos del minuto, a los 30 minutos de la hora, a las 09:00, sólo el lunes |
285
285
  | Finnish | 5 ja 10 sekunnin kohdalla, maanantaisin klo 9.30 | 5 ja 10 sekunnnin jälkeen, 30 minuuttia yli, klo 09:00, vain maanantai |
286
286
  <!-- END GENERATED: cronstrue-head-to-head -->
package/cronli5.min.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";(()=>{var Xn={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},_n={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12},y={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:_n,top:12},weekday:{aliases:{"?":"*",L:"6"},cyclic:!0,max:7,min:0,numbers:Xn,top:6},year:{max:9999,min:1970}},k=["second","minute","hour","date","month","weekday","year"],V={"@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 * * * *"},x=6;function a(n,e){return(""+n).indexOf(e)!==-1}function j(n){return Array.from(new Set(n))}function E(n){return/^\d+$/.test(n)}function $(n){if(n.length<5)return null;let e=n[1]-n[0];if(e<2)return null;for(let t=2;t<n.length;t+=1)if(n[t]-n[t-1]!==e)return null;return{start:n[0],interval:e,last:n[n.length-1]}}function f(n,e){return E(n)?+n:e[n.toUpperCase()]}function gn(n){return k.forEach(function(t){ne(n[t],y[t],t)}),n}function ne(n,e,t){typeof n!="string"&&typeof n!="number"&&dn(n,t);let r=""+n;r!=="*"&&(t==="date"&&T(r)||t==="weekday"&&F(r,e)||r.split(",").forEach(function(o){ee(o,e)||dn(o,t)}))}function T(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 t=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(t){let r=+(t[1]||t[2]);return r>=1&&r<=31}return!1}function F(n,e){if(/L$/.test(n))return v(n.slice(0,-1),e);let t=n.split("#");return t.length===2?v(t[0],e)&&/^[1-5]$/.test(t[1]):!1}function ee(n,e){return a(n,"/")?te(n,e):a(n,"-")?hn(n,e):v(n,e)}function te(n,e){let t=n.split("/");return t.length!==2||!E(t[1])||+t[1]<1?!1:t[0]==="*"||v(t[0],e)||hn(t[0],e,!0)}function hn(n,e,t){let r=n.split("-");return r.length!==2||!v(r[0],e)||!v(r[1],e)?!1:e.cyclic&&!t?!0:f(r[0],e.numbers)<=f(r[1],e.numbers)}function v(n,e){return n==="*"?!1:E(n)?+n>=e.min&&+n<=e.max:e.numbers?n.toUpperCase()in e.numbers:!1}function dn(n,e){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+e+" field.")}var re={hour:24,minute:60,second:60};function yn(n){k.forEach(function(t){let r=y[t].aliases,i=r&&r[""+n[t]];i&&(n[t]=i)})}function bn(n){return k.forEach(function(t){let r=""+n[t];if(t==="date"&&T(r)||t==="weekday"&&F(r,y[t])){n[t]=r;return}n[t]=ie(r,t,y[t])}),n}function ie(n,e,t){let r=""+n;if(r==="*")return r;let i=re[e],o=r.split(",").map(function(s){return oe(Sn(le(ce(me(ae(se(s,t),t),t),t),t,i),t),t)}).join(",").split(",");return o.indexOf("*")!==-1?"*":j(o).sort(function(s,c){return pn(s,t)-pn(c,t)}).join(",")}function oe(n,e){if(!e.numbers)return n;let t=n.split("/"),r=t[0].split("-").map(function(o){return ue(o,e)}).join("-");return t.length===2?r+"/"+t[1]:r}function ue(n,e){if(n==="*")return n;let t=f(n,e.numbers);return""+(t>e.top?e.min:t)}function se(n,e){let t=n.split("/");if(!e.cyclic||t.length!==2||+t[1]!=1)return n;let r=t[0];return a(r,"-")?r:r==="*"||f(r,e.numbers)===e.min?"*":r+"-"+e.top}function ae(n,e){let t=n.split("/");if(!e.cyclic||typeof e.top!="number"||t.length!==2||a(t[0],"-"))return n;let r=t[0];return(r==="*"?e.min:f(r,e.numbers))+ +t[1]<=e.top?n:r==="*"?""+e.min:r}function le(n,e,t){let r=n.split("/");if(typeof t!="number"||r.length!==2||a(r[0],"-"))return n;let i=+r[1],o=r[0]==="*"?e.min:f(r[0]);if(t%i===0&&o<i)return n;let u=[];for(let s=o;s<=e.top;s+=i)u.push(s);return u.join(",")}function ce(n,e){let t=n.split("/");return t.length!==2||!a(t[0],"-")?n:Sn(t[0],e)==="*"?"*/"+t[1]:n}function Sn(n,e){if(typeof e.top!="number"||a(n,"/")||!a(n,"-"))return n;let t=n.split("-"),r=f(t[0],e.numbers),i=f(t[1],e.numbers);if(r>i)return n;let o=e.top,u={};for(let s=r;s<=i;s+=1)u[s>o?e.min:s]=!0;for(let s=e.min;s<=o;s+=1)if(!u[s])return n;return"*"}function me(n,e){let t=n.split("/")[0];if(!a(t,"-"))return n;let r=t.split("-");return f(r[0],e.numbers)!==f(r[1],e.numbers)?n:r[0]}function pn(n,e){let t=n.split("/")[0].split("-")[0];return t==="*"?e.min:f(t,e.numbers)}function On(n,e){let t=n instanceof Array;if(n===null||typeof n>"u"||n===""||t&&n.length===0)throw new Error("`cronli5` expects a non-empty cron pattern as the first argument.");if(t)return kn(n,e);if(typeof n=="object")return fe(n);if(typeof n=="string")return de(n,e);throw new Error("`cronli5` was passed an unexpected type.")}function kn(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 fe(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",t=typeof n.minute<"u",r=e?"*":"0",i=e||t?"*":"0";return{second:N(n.second,"0"),minute:N(n.minute,r),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 de(n,e){let t=ge(n).split(/\s+/);return kn(t,e)}function ge(n){let e=n.trim();if(e.charAt(0)!=="@")return n;let t=e.toLowerCase();if(Object.hasOwn(V,t))return V[t];throw new Error("`cronli5` does not recognize the macro `"+e+"`.")}function Nn(n){return n!=="*"&&!a(n,",")&&!a(n,"-")&&!a(n,"/")}function J(n){return a(n,"-")&&!a(n,",")&&!a(n,"/")}function he(n){return a(n,"/")&&!a(n,",")}function Y(n){return n!=="*"&&!a(n,"-")&&!a(n,"/")}function B(n){return n!=="*"&&!J(n)&&!he(n)}function M(n,e,t){let r=[],i=n;for(;i<=t;)r.push(i),i+=e;return r}function zn(n,e,t,r){let i=n.split("/"),o=+i[1];if(a(i[0],"-")){let s=i[0].split("-");return M(f(s[0],r),o,f(s[1],r))}let u=i[0]==="*"?e:f(i[0],r);return M(u,o,t)}function K(n,e,t){let r=[];return n.split(",").forEach(function(o){if(a(o,"/"))r.push(...zn(o,e,t));else if(a(o,"-")){let u=o.split("-");+u[0]<=+u[1]?r.push(...M(+u[0],1,+u[1])):(r.push(...M(+u[0],1,t)),r.push(...M(e,1,+u[1])))}else r.push(+o)}),j(r)}function pe(n){return Y(n)?n.split(",").map(Number):[0]}function ye(n){if(n==="*")return[0,59];if(J(n)){let e=n.split("-");if(+e[0]<=+e[1])return[+e[0],+e[1]]}return null}function be(n){return n==="*"?59:Math.max(...K(n,0,59))}function Se(n){if(Nn(n)&&n!=="0")return+n}function Oe(n,e){return n==="*"?"wildcard":e==="date"&&T(n)||e==="weekday"&&F(n,y.weekday)?"quartz":a(n,",")?"list":a(n,"/")?"step":a(n,"-")?"range":"single"}function ke(n,e,t){return e==="wildcard"||e==="quartz"?null:n.split(",").map(function(i){if(a(i,"/")){let o=i.split("/");return{fires:zn(i,t.min,t.top,t.numbers),interval:+o[1],kind:"step",startToken:o[0]}}return a(i,"-")?{bounds:i.split("-"),kind:"range"}:{kind:"single",value:i}})}function Pn(n){let e={},t={};k.forEach(function(u){e[u]=Oe(n[u],u),t[u]=ke(n[u],e[u],y[u])});let i={analyses:{clockSecond:Se(n.second),lastMinuteFire:be(n.minute),minuteSpan:ye(n.minute),segments:t},pattern:n,shapes:e};return{...i,plan:Ne(i)}}function Ne(n){let{analyses:e,pattern:t,shapes:r}=n;if(t.second!=="0"){let i=ze(t,r,e);if(i)return i}return vn(t,r,e)||Rn(t,r,e)}function ze(n,e,t){let r=Pe(n,e);return r||(n.hour==="*"&&e.minute==="single"&&n.second!=="*"?{kind:"secondsWithinMinute",singleSecond:e.second==="single"}:e.second==="single"&&Y(n.minute)&&B(n.hour)?null:{kind:"composeSeconds",rest:vn(n,e,t,!0)||Rn(n,e,t,!0)})}function Pe(n,e){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:e.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function vn(n,e,t,r=!1){if(e.minute==="step")return{hours:Re(n,e,t),kind:"minuteFrequency"};if(e.hour==="single"&&t.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:t.minuteSpan};let i=Ce(n,e);if(i)return i;let o=ve(n,e);if(o)return o;if(n.hour==="*")return we(n,e,r)}function G(n){let[e,t]=n.split("/"),r=e==="*"?0:+e;return e.indexOf("-")===-1&&24%+t===0&&r<+t}function ve(n,e){return e.hour!=="step"?null:n.minute==="*"?G(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:I(n.hour)}:e.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:e.minute==="list"&&G(n.hour)?{form:"list",kind:"minuteSpanAcrossHourStep"}:null}function Re(n,e,t){if(e.hour==="list")return{kind:"during",times:I(n.hour)};if(e.hour==="range"){let r=n.hour.split("-");return{from:+r[0],kind:"window",last:t.lastMinuteFire,to:+r[1]}}return e.hour==="single"?{from:+n.hour,kind:"window",last:t.lastMinuteFire,to:+n.hour}:e.hour==="step"?G(n.hour)?{kind:"step"}:{kind:"during",times:I(n.hour)}:{kind:"none"}}function Ce(n,e){return B(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:I(n.hour)}:e.minute==="range"||e.minute==="list"&&a(n.minute,"-")&&!a(n.minute,"/")?{form:e.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:I(n.hour)}:null:null}function we(n,e,t){if(e.minute==="range")return{kind:"rangeOfMinutes"};if(e.minute==="list")return{kind:"multipleMinutes"};if(n.minute==="*")return{kind:"everyMinute"};if(n.minute!=="0"||t)return{kind:"singleMinute"}}function Rn(n,e,t,r=!1){let i=r&&n.minute==="0";return e.hour==="range"&&!i?xe(n,e,t):e.hour==="step"&&n.minute==="0"&&!r?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:Te(n,t,i)}function xe(n,e,t){let r=n.hour.split("-"),i="lead";return n.minute==="*"?i="wildcard":e.minute==="range"&&(i="range"),{boundMinute:e.minute==="range"||e.minute==="list"?null:t.lastMinuteFire,from:+r[0],kind:"hourRange",last:t.lastMinuteFire,minuteForm:i,to:+r[1]}}function Te(n,e,t=!1){let r=K(n.hour,0,23),i=pe(n.minute);if(!t&&r.length*i.length>x)return{fold:i.length===1,kind:"compactClockTimes",minute:i[0]};let o=[];return r.forEach(function(s){i.forEach(function(P){o.push({hour:s,minute:P,second:e.clockSecond})})}),{kind:"clockTimes",times:o}}function I(n){let e=K(n,0,23);return e.length<=x?{fires:e,kind:"fires"}:{kind:"segments"}}function Cn(n,e){let t=On(n,e);return yn(t),gn(t),bn(t)}function Z(n){return n=""+n,n.length<2?"0"+n:n}function wn(n,e,t){return t.short?n:e[n]||n}function X(n,{sep:e,pad:t,lean:r}){let i=t?Z(n.hour):""+n.hour;return r&&!n.minute&&!n.second?i:i+e+Z(n.minute)+(n.second?e+Z(n.second):"")}var _={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 xn(n){return typeof n=="object"&&n!==null?{..._.us,...n}:_[n==="uk"?"gb":n]||_.us}var Fe=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],nn=["th","st","nd","rd"],Me=[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"]],S=[["Sunday","Sun"],["Monday","Mon"],["Tuesday","Tue"],["Wednesday","Wed"],["Thursday","Thu"],["Friday","Fri"],["Saturday","Sat"]],Ie={SUN:S[0],MON:S[1],TUE:S[2],WED:S[3],THU:S[4],FRI:S[5],SAT:S[6]},He=[null,"first","second","third","fourth","fifth"];function Le(n){return n=n||{},{ampm:typeof n.ampm=="boolean"?n.ampm:!0,lenient:!!n.lenient,seconds:!!n.seconds,short:!!n.short,style:xn(n.dialect),years:!!n.years}}function We(n,e){return bt(Fn(n,n.plan,e),n,e)}function Fn(n,e,t){let r=ut[e.kind];return r(n,e,t)}function je(n,e,t){return"every second"+l(n,t)}function Ee(n,e,t){return R(n,t)+l(n,t)}function Ae(n,e,t){let r=n.pattern.second;return d(r,t)+" "+b(r,"second")+" past the minute, every minute"+l(n,t)}function De(n,e,t){let r=n.pattern.minute,i=d(r,t),o=b(r,"minute");if(e.singleSecond){let u=n.pattern.second;return i+" "+o+" and "+d(u,t)+" "+b(u,"second")+" past the hour, every hour"+l(n,t)}return R(n,t)+", "+i+" "+o+" past the hour, every hour"+l(n,t)}function Ue(n,e,t){return(e.rest.kind==="clockTimes"||e.rest.kind==="compactClockTimes")&&n.shapes.minute==="single"?an(n,+n.pattern.minute,t):null}function Qe(n,e,t){let r=Ue(n,e,t);return r!==null?r:e.rest.kind==="clockTimes"&&(n.shapes.second==="wildcard"||n.shapes.second==="step")?+e.rest.times[0].minute==0?R(n,t)+" for one minute at "+qe(n,e.rest,t):R(n,t)+" of "+Ve(n,e.rest,t):n.shapes.second==="wildcard"&&e.rest.kind==="minuteFrequency"&&e.rest.hours.kind==="none"&&n.pattern.minute==="*/2"?"every second of every other minute"+l(n,t):R(n,t)+", "+Fn(n,e.rest,t)}function qe(n,e,t){let r=e.times.map(function(u){return m({hour:u.hour,minute:0},t)}),i=D(n,cn,t);return h(r,t)+(i&&", "+i)}function Ve(n,e,t){let r=e.times.map(function(u){return m({hour:u.hour,minute:u.minute,second:u.second,explicit:!0},t)}),i=D(n,cn,t);return h(r,t)+(i&&", "+i)}function R(n,e){return H(n,"minute",e)}function H(n,e,t){let r=n.pattern.second,i=n.shapes.second;if(r==="*")return"every second";if(i==="step")return jn(n.analyses.segments.second[0],"second",e,t);if(i==="range"){let o=r.split("-"),u=W(o,t);return"every second from "+u(o[0])+p(t)+u(o[1])+" past the "+e}return i==="single"?"at "+d(r,t)+" "+b(r,"second")+" past the "+e:C(n.analyses.segments.second,"second",e,t)??O(w(n.analyses.segments.second,t),"second",e,t)}function $e(n,e,t){return"every minute"+l(n,t)}function Je(n,e,t){let r=n.pattern.minute;return d(r,t)+" "+b(r,"minute")+" past the hour, every hour"+l(n,t)}function Ye(n,e,t){return A(n.pattern.minute,t)+l(n,t)}function Be(n,e,t){return(C(n.analyses.segments.minute,"minute","hour",t)??O(w(n.analyses.segments.minute,t),"minute","hour",t))+l(n,t)}function Ge(n,e,t){let r=jn(n.analyses.segments.minute[0],"minute","hour",t);return e.hours.kind==="during"?r+=" during the "+tn(n,e.hours.times,!1,t)+" hours":e.hours.kind==="window"?r+=" "+Hn(e.hours,t):e.hours.kind==="step"&&(r+=" "+sn(n.analyses.segments.hour[0],t)),r+l(n,t)}function Ke(n,e,t){return n.pattern.minute==="*"?"every minute of the "+m({hour:e.hour,minute:0},t)+" hour"+l(n,t):"every minute from "+m({hour:e.hour,minute:e.span[0]},t)+p(t)+m({hour:e.hour,minute:e.span[1]},t)+l(n,t)}function Ze(n,e,t){if(e.form==="wildcard")return"every minute during the "+tn(n,e.times,!1,t)+" hours"+l(n,t);let r=tn(n,e.times,!0,t);return(e.form==="range"?A(n.pattern.minute,t):C(n.analyses.segments.minute,"minute","hour",t)??O(w(n.analyses.segments.minute,t),"minute","hour",t))+", at "+r+l(n,t)}var Mn={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function sn(n,e){let t="during every "+Mn[n.interval]+" hour",r=n.startToken==="*"?0:+n.startToken;return r===0?t:t+" starting at "+m({hour:r,minute:0},e)}function Xe(n,e,t){let r=n.analyses.segments.hour[0];return e.form==="wildcard"?"every minute "+sn(r,t)+l(n,t):(e.form==="list"?C(n.analyses.segments.minute,"minute","hour",t)??O(w(n.analyses.segments.minute,t),"minute","hour",t):A(n.pattern.minute,t))+", "+En(r,t)+l(n,t)}function A(n,e){let t=n.split("-"),r=W(t,e);return"every minute from "+r(t[0])+p(e)+r(t[1])+" past the hour"}function _e(n,e,t){return"every hour"+l(n,t)}function nt(n,e,t){let r=Hn(tt(e),t);return e.minuteForm==="wildcard"?"every minute "+r+l(n,t):e.minuteForm==="range"?A(n.pattern.minute,t)+", "+r+l(n,t):In(n,t)+" "+r+l(n,t)}function In(n,e){return n.pattern.minute==="0"?"every hour":C(n.analyses.segments.minute,"minute","hour",e)??O(w(n.analyses.segments.minute,e),"minute","hour",e)}function et(n,e,t){return En(n.analyses.segments.hour[0],t)+l(n,t)}function tt(n){return{from:n.from,last:n.boundMinute??0,to:n.to}}function Hn(n,e){return"from "+m({hour:n.from,minute:0},e)+p(e)+m({hour:n.to,minute:n.last},e)}function rt(n,e,t){if(n.shapes.minute==="single"){let o=an(n,+n.pattern.minute,t);if(o!==null)return o}let r=ln(e.times),i=e.times.map(function(u){return m({hour:u.hour,minute:u.minute,second:u.second,plain:r},t)});return Dn(n,t)+"at "+h(i,t)}function it(n,e,t){if(e.fold){let i=an(n,+e.minute,t);if(i!==null)return i;if(n.analyses.segments.hour.some(function(c){return c.kind==="range"})&&!n.analyses.clockSecond)return ot(n,e,t)+l(n,t);let u={minute:e.minute,second:n.analyses.clockSecond};return Dn(n,t)+"at "+rn(n,u,!0,t)}let r=(C(n.analyses.segments.minute,"minute","hour",t)??O(w(n.analyses.segments.minute,t),"minute","hour",t))+", at "+rn(n,{minute:0,second:null},!0,t)+l(n,t);return n.analyses.clockSecond?R(n,t)+", "+r:r}function ot(n,e,t){let r=e.minute,i=[],o=[];n.analyses.segments.hour.forEach(function(c){c.kind==="range"?i.push("from "+m({hour:c.bounds[0],minute:0},t)+p(t)+m({hour:c.bounds[1],minute:r},t)):c.kind==="step"?o.push(...c.fires):o.push(+c.value)});let u=In(n,t)+" "+h(i,t);return o.length&&(u+=" and at "+h(o.map(function(c){return m({hour:c,minute:r},t)}),t)),u}var ut={clockTimes:rt,compactClockTimes:it,composeSeconds:Qe,everyHour:_e,everyMinute:$e,everySecond:je,hourRange:nt,hourStep:et,minuteFrequency:Ge,minuteSpanAcrossHourStep:Xe,minuteSpanInHour:Ke,minutesAcrossHours:Ze,multipleMinutes:Be,rangeOfMinutes:Ye,secondPastMinute:Ae,secondsWithinMinute:De,singleMinute:Je,standaloneSeconds:Ee};function Ln(n,e){let{interval:t,start:r,last:i,cycle:o,unit:u,anchor:s}=n,c="every "+d(t,e)+" "+u+"s",P=o%t===0;if(r===0&&P)return c;if(r<t&&P)return c+" from "+d(r,e)+" "+b(r,u)+" past the "+s;let g=W([r,i],e);return c+" from "+g(r)+p(e)+g(i)+" "+b(i,u)+" past the "+s}function Wn(n){let e=[];for(let t of n){if(t.kind!=="single")return null;e.push(+t.value)}return e}function C(n,e,t,r){let i=Wn(n),o=i&&$(i);return o?Ln({...o,cycle:60,unit:e,anchor:t},r):null}function jn(n,e,t,r){if(n.startToken.indexOf("-")!==-1)return O(Tn(n.fires,r),e,t,r);let i=n.startToken==="*"?0:+n.startToken;return i!==0&&n.fires.length<=3?O(Tn(n.fires,r),e,t,r):Ln({interval:n.interval,start:i,last:n.fires[n.fires.length-1],cycle:60,unit:e,anchor:t},r)}function En(n,e){if(n.startToken.indexOf("-")!==-1)return"at "+en(n.fires,e);let t=n.startToken==="*"?0:+n.startToken,r=n.interval;return t===0?"every "+d(r,e)+" hours":n.fires.length<=3?"at "+en(n.fires,e):"every "+d(r,e)+" hours from "+m({hour:t,minute:0},e)}function st(n,e){let{start:t,interval:r,last:i}=n,o="every "+d(r,e)+" hours",u=24%r===0;return t===0&&u?o:t<r&&u?o+" from "+m({hour:t,minute:0},e):o+" from "+m({hour:t,minute:0},e)+p(e)+m({hour:i,minute:0},e)}function at(n){let e=n.analyses.segments.hour;if(e.length===1&&e[0].kind==="step"){let i=e[0],o=i.startToken==="*"?0:+i.startToken.split("-")[0];return{interval:i.interval,last:i.fires[i.fires.length-1],start:o}}let t=Wn(e);return t&&$(t)||null}function An(n){return n.pattern.second==="*"||n.shapes.second==="step"}function lt(n,e,t){if(e===0)return An(n)?H(n,"minute",t)+" for one minute":H(n,"hour",t);let r=d(e,t)+" "+b(e,"minute")+" past the hour";return n.pattern.second==="0"?r:H(n,"minute",t)+", "+r}function an(n,e,t){let r=at(n);if(!r)return null;let i=(r.last-r.start)/r.interval+1;if(n.pattern.second==="0"&&i<=x)return null;let o=e===0&&An(n)&&ct(n);return o?H(n,"minute",t)+" for one minute "+sn(o,t)+l(n,t):lt(n,e,t)+", "+st(r,t)+l(n,t)}function ct(n){let e=n.analyses.segments.hour,t=e.length===1&&e[0];return!t||t.kind!=="step"||t.startToken.indexOf("-")!==-1||!(t.interval in Mn)?null:t}function W(n,e){let t=n.some(function(i){return+i>10});return function(i){return t?""+i:d(i,e)}}function Tn(n,e){return n.map(W(n,e))}function w(n,e){let t=n.flatMap(function(o){return o.kind==="range"?o.bounds:o.kind==="step"?o.fires:[o.value]}),r=W(t,e);return n.flatMap(function(o){return o.kind==="range"?[r(o.bounds[0])+p(e)+r(o.bounds[1])]:o.kind==="step"?o.fires.map(r):[r(o.value)]})}function O(n,e,t,r){return"at "+h(n,r)+" "+e+"s past the "+t}function mt(n,e,t){return(+n==0||+n==12)&&+e==0&&!(typeof t=="number"&&t>0)}function ln(n){let e=n.filter(function(r){return mt(r.hour,r.minute,r.second)});return e.length>0&&e.length<n.length}function en(n,e){let t=ln(n.map(function(o){return{hour:o,minute:0}})),r=n.map(function(o){return m({hour:o,minute:0,plain:t},e)});return h(r,e)}function tn(n,e,t,r){return e.kind==="fires"?en(e.fires,r):rn(n,{minute:0,second:null},t,r)}function ft(n){return n.kind==="range"?n.bounds:n.kind==="step"?n.fires:[n.value]}function rn(n,e,t,r){let{minute:i,second:o}=e,u=n.analyses.segments.hour,s=ln(u.flatMap(function(g){return ft(g).map(function(q){return{hour:+q,minute:i,second:o}})})),c=[];return u.forEach(function(g){g.kind==="step"?c.push(...g.fires.map(function(q){return m({hour:q,minute:i,second:o,plain:s},r)})):g.kind==="range"?c.push(m({hour:g.bounds[0],minute:i,second:o,plain:s},r)+p(r)+m({hour:g.bounds[1],minute:i,second:o,plain:s},r)):c.push(m({hour:g.value,minute:i,second:o,plain:s},r))}),h(dt(c,u,t),r)}function dt(n,e,t){let r=e.some(function(o){return o.kind==="range"});return!t||!r?n:n.map(function(o,u){return u===0?o:"at "+o})}function h(n,e){if(n.length<=1)return n.join("");if(n.length===2)return n[0]+" and "+n[1];let t=e.style.serialComma?", and ":" and ";return n.slice(0,-1).join(", ")+t+n[n.length-1]}var gt={all:"",month:"in ",stepDate:"on ",weekday:"on "},cn={all:"every day",month:"every day in ",stepDate:"",weekday:"every "};function l(n,e){let t=D(n,gt,e);return t&&" "+t}function Dn(n,e){return D(n,cn,e)+" "}function D(n,e,t){let r=n.pattern;return r.date!=="*"&&r.weekday!=="*"?pt(n,t):r.date!=="*"?ht(n,e,t):r.weekday!=="*"?(qn(r.weekday,t)||e.weekday+Yn(n,t))+z(n,t):r.month!=="*"?e.month+U(n,t):e.all}function ht(n,e,t){let r=n.pattern,i=Qn(r.date,t);return i?i+z(n,t):mn(r.date)?e.stepDate+$n(r.date)+z(n,t):r.month!=="*"&&!Un(n)?"on the "+on(n,t)+z(n,t):r.month!=="*"?"on "+Vn(n,t):"on the "+on(n,t)}function Un(n){return!Jn(n.pattern.month)&&n.analyses.segments.month.every(function(t){return t.kind!=="range"})}function pt(n,e){let t=n.pattern,r=qn(t.weekday,e)||"on "+Yn(n,e),i=Qn(t.date,e);return i?i+z(n,e)+" or "+r:mn(t.date)?$n(t.date)+z(n,e)+" or "+r:t.month!=="*"&&Un(n)?"on "+Vn(n,e)+" or "+r+" in "+U(n,e):"on the "+on(n,e)+" or "+r+z(n,e)}function Qn(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 t=/^L-(\d{1,2})$/.exec(n);if(t)return d(+t[1],e)+" "+b(t[1],"day")+" before the last day of the month";let r=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(r)return"on the weekday nearest the "+L(r[1]||r[2])}function qn(n,e){let t=n.split("#");if(t.length===2)return"on the "+He[+t[1]]+" "+un(t[0],e)+" of the month";if(/L$/.test(n))return"on the last "+un(n.slice(0,-1),e)+" of the month"}function Vn(n,e){let t=U(n,e),r=Q(n.analyses.segments.date,e.style.ordinals?L:yt,e);return e.style.dayFirst?r+" "+t:t+" "+r}function yt(n){return""+n}function z(n,e){return n.pattern.month==="*"?"":" in "+U(n,e)}function $n(n){let e=n.split("/"),t=+e[1],r=e[0],o=(t===2?"every other":"every "+L(t))+" day of the month";return r!=="*"&&r!=="1"&&(o+=" from the "+L(r)),o}function on(n,e){return Q(n.analyses.segments.date,L,e)}function U(n,e){let t=Jn(n.pattern.month);return t||Q(n.analyses.segments.month,function(i){return Nt(i,e)},e)}function Jn(n){if(!mn(n))return null;let[e,t]=n.split("/");return+t!=2?null:e==="*"||e==="1"?"every odd-numbered month":e==="2"?"every even-numbered month":null}function Yn(n,e){return Q(n.analyses.segments.weekday,function(r){return un(r,e)},e)}function Q(n,e,t){let r=[];return n.forEach(function(o){o.kind==="step"?r.push(...o.fires.map(e)):o.kind==="range"?r.push(o.bounds.map(e).join(p(t))):r.push(e(o.value))}),h(r,t)}function mn(n){return n.indexOf("/")!==-1&&n.indexOf("-")===-1&&n.indexOf(",")===-1}function bt(n,e,t){let r=e.pattern.year;if(r==="*")return n;if(r.indexOf("/")!==-1)return n+" "+Ot(r,t);let i=St(r,t);if(r.indexOf("-")===-1&&r.indexOf(",")===-1&&e.pattern.date!=="*"&&n.indexOf(" at ")!==-1){let o=t.style.dayFirst?" ":", ";return n.replace(" at ",o+i+" at ")}return n+" in "+i}function St(n,e){return n.indexOf(",")!==-1?h(n.split(","),e):n}function Ot(n,e){let t=n.split("/"),r=+t[1],i=t[0];if(r<=1)return"every year";let o="every "+d(r,e)+" years";return i!=="*"&&i!=="0"&&(o+=" from "+i),o}function m(n,e){let{hour:t,minute:r,plain:i,explicit:o}=n,u=typeof n.second=="number"&&n.second>0?n.second:0;return e.ampm?kt({hour:t,minute:r,second:u,plain:i,explicit:o},e):X({hour:t,minute:r,second:u},{pad:!0,sep:e.style.sep})}function kt(n,e){let{hour:t,minute:r,second:i,plain:o,explicit:u}=n,s=e.style;if(!o&&!u&&+r==0&&!i){if(+t==0)return s.midnight;if(+t==12)return s.midday}return X({hour:t%12||12,minute:r,second:i},{lean:!u,sep:s.sep})+(s.closeUp?"":" ")+(t<12?s.am:s.pm)}function d(n,e){return wn(n,Fe,e)}function b(n,e){return+n==1?e:e+"s"}function p(n){return n.short?"-":n.style.through}function L(n){let e=Math.abs(n),t=nn[e];return t||(e=(e%100-20)%10,t=nn[e]||nn[0]),n+t}function Nt(n,e){let t=Me[+n];return t&&t[e.short?1:0]}function un(n,e){let t=n===7||n==="7"?0:n,r=S[t]||Ie[t];return r&&r[e.short?1:0]}var zt={describe:We,fallback:"an unrecognizable cron pattern",options:Le,reboot:"at system startup",sentence:n=>"Runs "+n+(n.endsWith(".")?"":".")},Bn=zt;/**
1
+ "use strict";(()=>{var ue={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},se={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12},y={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:se,top:12},weekday:{aliases:{"?":"*",L:"6"},cyclic:!0,max:7,min:0,numbers:ue,top:6},year:{max:9999,min:1970}},N=["second","minute","hour","date","month","weekday","year"],K={"@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 * * * *"},T=6;function a(n,t){return(""+n).indexOf(t)!==-1}function D(n){return Array.from(new Set(n))}function E(n){return/^\d+$/.test(n)}function bn(n){if(n.length<5)return null;let t=n[1]-n[0];if(t<2)return null;for(let e=2;e<n.length;e+=1)if(n[e]-n[e-1]!==t)return null;return{start:n[0],interval:t,last:n[n.length-1]}}function yn(n){return n===0?7:n}function Sn(n){let t=n.flatMap(function(i){return i.kind==="step"?i.fires.map(function(u){return{kind:"single",value:""+u}}):[i]});function e(r){return r.kind==="range"?yn(+r.bounds[0]):yn(+r.value)}return t.map(function(i,o){return[i,o]}).sort(function(i,o){return e(i[0])-e(o[0])||i[1]-o[1]}).map(function(i){return i[0]})}function f(n,t){return E(n)?+n:t[n.toUpperCase()]}function On(n){return N.forEach(function(e){ae(n[e],y[e],e)}),n}function ae(n,t,e){typeof n!="string"&&typeof n!="number"&&kn(n,e);let r=""+n;r!=="*"&&(e==="date"&&x(r)||e==="weekday"&&F(r,t)||r.split(",").forEach(function(o){le(o,t)||kn(o,e)}))}function x(n){if(n==="L"||n==="LW"||n==="WL")return!0;let t=/^L-(\d{1,2})$/.exec(n);if(t)return+t[1]>=1&&+t[1]<=30;let e=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(e){let r=+(e[1]||e[2]);return r>=1&&r<=31}return!1}function F(n,t){if(/L$/.test(n))return R(n.slice(0,-1),t);let e=n.split("#");return e.length===2?R(e[0],t)&&/^[1-5]$/.test(e[1]):!1}function le(n,t){return a(n,"/")?ce(n,t):a(n,"-")?Nn(n,t):R(n,t)}function ce(n,t){let e=n.split("/");return e.length!==2||!E(e[1])||+e[1]<1?!1:e[0]==="*"||R(e[0],t)||Nn(e[0],t,!0)}function Nn(n,t,e){let r=n.split("-");return r.length!==2||!R(r[0],t)||!R(r[1],t)?!1:t.cyclic&&!e?!0:f(r[0],t.numbers)<=f(r[1],t.numbers)}function R(n,t){return n==="*"?!1:E(n)?+n>=t.min&&+n<=t.max:t.numbers?n.toUpperCase()in t.numbers:!1}function kn(n,t){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+t+" field.")}var me={hour:24,minute:60,second:60};function Rn(n){N.forEach(function(e){let r=y[e].aliases,i=r&&r[""+n[e]];i&&(n[e]=i)})}function Pn(n){return N.forEach(function(e){let r=""+n[e];if(e==="date"&&x(r)||e==="weekday"&&F(r,y[e])){n[e]=r;return}n[e]=fe(r,e,y[e])}),n}function fe(n,t,e){let r=""+n;if(r==="*")return r;let i=me[t],o=r.split(",").map(function(s){return de(vn(ye(be(Se(pe(he(s,e),e),e),e),e,i),e),e)}).join(",").split(",");return o.indexOf("*")!==-1?"*":D(o).sort(function(s,m){return zn(s,e)-zn(m,e)}).join(",")}function de(n,t){if(!t.numbers)return n;let e=n.split("/"),r=e[0].split("-").map(function(o){return ge(o,t)}).join("-");return e.length===2?r+"/"+e[1]:r}function ge(n,t){if(n==="*")return n;let e=f(n,t.numbers);return""+(e>t.top?t.min:e)}function he(n,t){let e=n.split("/");if(!t.cyclic||e.length!==2||+e[1]!=1)return n;let r=e[0];return a(r,"-")?r:r==="*"||f(r,t.numbers)===t.min?"*":r+"-"+t.top}function pe(n,t){let e=n.split("/");if(!t.cyclic||typeof t.top!="number"||e.length!==2||a(e[0],"-"))return n;let r=e[0];return(r==="*"?t.min:f(r,t.numbers))+ +e[1]<=t.top?n:r==="*"?""+t.min:r}function ye(n,t,e){let r=n.split("/");if(typeof e!="number"||r.length!==2||a(r[0],"-"))return n;let i=+r[1],o=r[0]==="*"?t.min:f(r[0]);if(e%i===0&&o<i)return n;let u=[];for(let s=o;s<=t.top;s+=i)u.push(s);return u.join(",")}function be(n,t){let e=n.split("/");return e.length!==2||!a(e[0],"-")?n:vn(e[0],t)==="*"?"*/"+e[1]:n}function vn(n,t){if(typeof t.top!="number"||a(n,"/")||!a(n,"-"))return n;let e=n.split("-"),r=f(e[0],t.numbers),i=f(e[1],t.numbers);if(r>i)return n;let o=t.top,u={};for(let s=r;s<=i;s+=1)u[s>o?t.min:s]=!0;for(let s=t.min;s<=o;s+=1)if(!u[s])return n;return"*"}function Se(n,t){let e=n.split("/")[0];if(!a(e,"-"))return n;let r=e.split("-");return f(r[0],t.numbers)!==f(r[1],t.numbers)?n:r[0]}function zn(n,t){let e=n.split("/")[0].split("-")[0];return e==="*"?t.min:f(e,t.numbers)}function wn(n,t){let e=n instanceof Array;if(n===null||typeof n>"u"||n===""||e&&n.length===0)throw new Error("`cronli5` expects a non-empty cron pattern as the first argument.");if(e)return Cn(n,t);if(typeof n=="object")return ke(n);if(typeof n=="string")return Oe(n,t);throw new Error("`cronli5` was passed an unexpected type.")}function Cn(n,t){if(n.length>7)throw new Error("`cronli5` was passed a cron pattern with more than seven fields.");return!t.seconds&&n.length<(t.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 ke(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 t=typeof n.second<"u",e=typeof n.minute<"u",r=t?"*":"0",i=t||e?"*":"0";return{second:z(n.second,"0"),minute:z(n.minute,r),hour:z(n.hour,i),date:z(n.date,"*"),month:z(n.month,"*"),weekday:z(n.weekday,"*"),year:z(n.year,"*")}}function z(n,t){return typeof n>"u"?t:n}function Oe(n,t){let e=Ne(n).split(/\s+/);return Cn(e,t)}function Ne(n){let t=n.trim();if(t.charAt(0)!=="@")return n;let e=t.toLowerCase();if(Object.hasOwn(K,e))return K[e];throw new Error("`cronli5` does not recognize the macro `"+t+"`.")}function Tn(n){return n!=="*"&&!a(n,",")&&!a(n,"-")&&!a(n,"/")}function Y(n){return a(n,"-")&&!a(n,",")&&!a(n,"/")}function ze(n){return a(n,"/")&&!a(n,",")}function B(n){return n!=="*"&&!a(n,"-")&&!a(n,"/")}function G(n){return n!=="*"&&!Y(n)&&!ze(n)}function I(n,t,e){let r=[],i=n;for(;i<=e;)r.push(i),i+=t;return r}function xn(n,t,e,r){let i=n.split("/"),o=+i[1];if(a(i[0],"-")){let s=i[0].split("-");return I(f(s[0],r),o,f(s[1],r))}let u=i[0]==="*"?t:f(i[0],r);return I(u,o,e)}function X(n,t,e){let r=[];return n.split(",").forEach(function(o){if(a(o,"/"))r.push(...xn(o,t,e));else if(a(o,"-")){let u=o.split("-");+u[0]<=+u[1]?r.push(...I(+u[0],1,+u[1])):(r.push(...I(+u[0],1,e)),r.push(...I(t,1,+u[1])))}else r.push(+o)}),D(r)}function Re(n){return B(n)?n.split(",").map(Number):[0]}function Pe(n){if(n==="*")return[0,59];if(Y(n)){let t=n.split("-");if(+t[0]<=+t[1])return[+t[0],+t[1]]}return null}function ve(n){return n==="*"?59:Math.max(...X(n,0,59))}function we(n){if(Tn(n)&&n!=="0")return+n}function Ce(n,t){return n==="*"?"wildcard":t==="date"&&x(n)||t==="weekday"&&F(n,y.weekday)?"quartz":a(n,",")?"list":a(n,"/")?"step":a(n,"-")?"range":"single"}function Te(n,t,e){return t==="wildcard"||t==="quartz"?null:n.split(",").map(function(i){if(a(i,"/")){let o=i.split("/");return{fires:xn(i,e.min,e.top,e.numbers),interval:+o[1],kind:"step",startToken:o[0]}}return a(i,"-")?{bounds:i.split("-"),kind:"range"}:{kind:"single",value:i}})}function Fn(n){let t={},e={};N.forEach(function(u){t[u]=Ce(n[u],u),e[u]=Te(n[u],t[u],y[u])});let i={analyses:{clockSecond:we(n.second),lastMinuteFire:ve(n.minute),minuteSpan:Pe(n.minute),segments:e},pattern:n,shapes:t};return{...i,plan:xe(i)}}function xe(n){let{analyses:t,pattern:e,shapes:r}=n;if(e.second!=="0"){let i=Fe(e,r,t);if(i)return i}return In(e,r,t)||Mn(e,r,t)}function Fe(n,t,e){let r=Ie(n,t);return r||(n.hour==="*"&&t.minute==="single"&&n.second!=="*"?{kind:"secondsWithinMinute",singleSecond:t.second==="single"}:t.second==="single"&&B(n.minute)&&G(n.hour)?null:{kind:"composeSeconds",rest:In(n,t,e,!0)||Mn(n,t,e,!0)})}function Ie(n,t){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:t.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function In(n,t,e,r=!1){if(t.minute==="step")return{hours:He(n,t,e),kind:"minuteFrequency"};if(t.hour==="single"&&e.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:e.minuteSpan};let i=We(n,t);if(i)return i;let o=Me(n,t);if(o)return o;if(n.hour==="*")return Le(n,t,r)}function Z(n){let[t,e]=n.split("/"),r=t==="*"?0:+t;return t.indexOf("-")===-1&&24%+e===0&&r<+e}function Me(n,t){return t.hour!=="step"?null:n.minute==="*"?Z(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:M(n.hour)}:t.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:t.minute==="list"&&Z(n.hour)?{form:"list",kind:"minuteSpanAcrossHourStep"}:null}function He(n,t,e){if(t.hour==="list")return{kind:"during",times:M(n.hour)};if(t.hour==="range"){let r=n.hour.split("-");return{from:+r[0],kind:"window",last:e.lastMinuteFire,to:+r[1]}}return t.hour==="single"?{from:+n.hour,kind:"window",last:e.lastMinuteFire,to:+n.hour}:t.hour==="step"?Z(n.hour)?{kind:"step"}:{kind:"during",times:M(n.hour)}:{kind:"none"}}function We(n,t){return G(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:M(n.hour)}:t.minute==="range"||t.minute==="list"&&a(n.minute,"-")&&!a(n.minute,"/")?{form:t.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:M(n.hour)}:null:null}function Le(n,t,e){if(t.minute==="range")return{kind:"rangeOfMinutes"};if(t.minute==="list")return{kind:"multipleMinutes"};if(n.minute==="*")return{kind:"everyMinute"};if(n.minute!=="0"||e)return{kind:"singleMinute"}}function Mn(n,t,e,r=!1){let i=r&&n.minute==="0";return t.hour==="range"&&!i?je(n,t,e):t.hour==="step"&&n.minute==="0"&&!r?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:De(n,e,i)}function je(n,t,e){let r=n.hour.split("-"),i="lead";return n.minute==="*"?i="wildcard":t.minute==="range"&&(i="range"),{boundMinute:t.minute==="range"||t.minute==="list"?null:e.lastMinuteFire,from:+r[0],kind:"hourRange",last:e.lastMinuteFire,minuteForm:i,to:+r[1]}}function De(n,t,e=!1){let r=X(n.hour,0,23),i=Re(n.minute);if(!e&&r.length*i.length>T)return{fold:i.length===1,kind:"compactClockTimes",minute:i[0]};let o=[];return r.forEach(function(s){i.forEach(function(O){o.push({hour:s,minute:O,second:t.clockSecond})})}),{kind:"clockTimes",times:o}}function M(n){let t=X(n,0,23);return t.length<=T?{fires:t,kind:"fires"}:{kind:"segments"}}function Hn(n,t){let e=wn(n,t);return Rn(e),On(e),Pn(e)}function _(n){return n=""+n,n.length<2?"0"+n:n}function Wn(n,t,e){return e.short?n:t[n]||n}function nn(n,{sep:t,pad:e,lean:r}){let i=e?_(n.hour):""+n.hour;return r&&!n.minute&&!n.second?i:i+t+_(n.minute)+(n.second?t+_(n.second):"")}var en={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 Ln(n){return typeof n=="object"&&n!==null?{...en.us,...n}:en[n==="uk"?"gb":n]||en.us}var Ee=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],tn=["th","st","nd","rd"],Ae=[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"]],S=[["Sunday","Sun"],["Monday","Mon"],["Tuesday","Tue"],["Wednesday","Wed"],["Thursday","Thu"],["Friday","Fri"],["Saturday","Sat"]],Ue={SUN:S[0],MON:S[1],TUE:S[2],WED:S[3],THU:S[4],FRI:S[5],SAT:S[6]},Qe=[null,"first","second","third","fourth","fifth"];function qe(n){return n=n||{},{ampm:typeof n.ampm=="boolean"?n.ampm:!0,lenient:!!n.lenient,seconds:!!n.seconds,short:!!n.short,style:Ln(n.dialect),years:!!n.years}}function Ve(n,t){return Tt(Dn(n,n.plan,t),n,t)}function Dn(n,t,e){let r=ht[t.kind];return r(n,t,e)}function $e(n,t,e){return"every second"+l(n,e)}function Je(n,t,e){return v(n,e)+l(n,e)}function Ke(n,t,e){let r=n.pattern.second;return d(r,e)+" "+b(r,"second")+" past the minute, every minute"+l(n,e)}function Ye(n,t,e){let r=n.pattern.minute,i=d(r,e),o=b(r,"minute");if(t.singleSecond){let u=n.pattern.second;return i+" "+o+" and "+d(u,e)+" "+b(u,"second")+" past the hour, every hour"+l(n,e)}return v(n,e)+", "+i+" "+o+" past the hour, every hour"+l(n,e)}function Be(n,t,e){if(!(t.rest.kind==="clockTimes"||t.rest.kind==="compactClockTimes")||n.shapes.minute!=="single")return null;let i=+n.pattern.minute;return mn(n,i,e)??fn(n,i,e)}function Ge(n,t,e){return+t.times[0].minute==0&&n.shapes.minute==="single"?v(n,e)+" for one minute at "+Xe(n,t,e):v(n,e)+" of "+_e(n,t,e)}function Ze(n,t,e){let r=Be(n,t,e);return r!==null?r:t.rest.kind==="clockTimes"&&(n.shapes.second==="wildcard"||n.shapes.second==="step")?Ge(n,t.rest,e):n.shapes.second==="wildcard"&&t.rest.kind==="minuteFrequency"&&t.rest.hours.kind==="none"&&n.pattern.minute==="*/2"?"every second of every other minute"+l(n,e):(t.rest.kind==="compactClockTimes"&&n.analyses.clockSecond?"":v(n,e)+", ")+Dn(n,t.rest,e)}function Xe(n,t,e){let r=t.times.map(function(u){return c({hour:u.hour,minute:0},e)}),i=q(n,gn,e);return h(r,e)+(i&&", "+i)}function _e(n,t,e){let r=t.times.map(function(u){return c({hour:u.hour,minute:u.minute,second:u.second,explicit:!0},e)}),i=q(n,gn,e);return h(r,e)+(i&&", "+i)}function v(n,t){return P(n,"minute",t)}function P(n,t,e){let r=n.pattern.second,i=n.shapes.second;if(r==="*")return"every second";if(i==="step")return Vn(n.analyses.segments.second[0],"second",t,e);if(i==="range"){let o=r.split("-"),u=L(o,e);return"every second from "+u(o[0])+p(e)+u(o[1])+" past the "+t}return i==="single"?"at "+d(r,e)+" "+b(r,"second")+" past the "+t:w(n.analyses.segments.second,"second",t,e)??k(C(n.analyses.segments.second,e),"second",t,e)}function nt(n,t,e){return"every minute"+l(n,e)}function et(n,t,e){let r=n.pattern.minute;return d(r,e)+" "+b(r,"minute")+" past the hour, every hour"+l(n,e)}function tt(n,t,e){return Q(n.pattern.minute,e)+l(n,e)}function rt(n,t,e){return(w(n.analyses.segments.minute,"minute","hour",e)??k(C(n.analyses.segments.minute,e),"minute","hour",e))+l(n,e)}function it(n,t,e){let r=Vn(n.analyses.segments.minute[0],"minute","hour",e);if(t.hours.kind==="during"){let i=W(n,e);r+=i?", "+i:" during the "+un(n,t.hours.times,!1,e)+" hours"}else t.hours.kind==="window"?r+=" "+Un(t.hours,e):t.hours.kind==="step"&&(r+=" "+ln(n.analyses.segments.hour[0],e));return r+l(n,e)}function ot(n,t,e){return n.pattern.minute==="*"?"every minute of the "+c({hour:t.hour,minute:0},e)+" hour"+l(n,e):"every minute from "+c({hour:t.hour,minute:t.span[0]},e)+p(e)+c({hour:t.hour,minute:t.span[1]},e)+l(n,e)}function ut(n,t,e){let r=W(n,e);if(t.form==="wildcard")return r!==null?"every minute, "+r+l(n,e):"every minute during the "+un(n,t.times,!1,e)+" hours"+l(n,e);let i=t.form==="range"?Q(n.pattern.minute,e):w(n.analyses.segments.minute,"minute","hour",e)??k(C(n.analyses.segments.minute,e),"minute","hour",e);if(r!==null)return i+", "+r+l(n,e);let o=un(n,t.times,!0,e);return i+", at "+o+l(n,e)}var En={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function ln(n,t){let e="during every "+En[n.interval]+" hour",r=n.startToken==="*"?0:+n.startToken;return r===0?e:e+" starting at "+c({hour:r,minute:0},t)}function st(n,t,e){let r=n.analyses.segments.hour[0];if(t.form==="wildcard")return"every minute "+ln(r,e)+l(n,e);let i=t.form==="list"?w(n.analyses.segments.minute,"minute","hour",e)??k(C(n.analyses.segments.minute,e),"minute","hour",e):Q(n.pattern.minute,e),o=W(n,e);return i+", "+(o??$n(r,e))+l(n,e)}function Q(n,t){let e=n.split("-"),r=L(e,t);return"every minute from "+r(e[0])+p(t)+r(e[1])+" past the hour"}function at(n,t,e){return"every hour"+l(n,e)}function lt(n,t,e){let r=Un(mt(t),e);return t.minuteForm==="wildcard"?"every minute "+r+l(n,e):t.minuteForm==="range"?Q(n.pattern.minute,e)+", "+r+l(n,e):An(n,e)+" "+r+l(n,e)}function An(n,t){return n.pattern.minute==="0"?"every hour":w(n.analyses.segments.minute,"minute","hour",t)??k(C(n.analyses.segments.minute,t),"minute","hour",t)}function ct(n,t,e){let r=W(n,e);return r!==null?r+l(n,e):$n(n.analyses.segments.hour[0],e)+l(n,e)}function mt(n){let t=n.minuteForm==="wildcard"?n.boundMinute??0:0;return{from:n.from,last:t,to:n.to}}function Un(n,t){return"from "+c({hour:n.from,minute:0},t)+p(t)+c({hour:n.to,minute:n.last},t)}function ft(n,t,e){if(n.shapes.minute==="single"){let o=+n.pattern.minute,u=mn(n,o,e)??fn(n,o,e);if(u!==null)return u}let r=dn(t.times),i=t.times.map(function(u){return c({hour:u.hour,minute:u.minute,second:u.second,plain:r},e)});return Bn(n,e)+"at "+h(i,e)}function dt(n,t,e){if(t.fold){let u=mn(n,+t.minute,e)??fn(n,+t.minute,e);if(u!==null)return u;if(n.analyses.segments.hour.some(function(g){return g.kind==="range"})&&!n.analyses.clockSecond)return gt(n,t,e)+l(n,e);let m={minute:t.minute,second:n.analyses.clockSecond};return Bn(n,e)+"at "+U(n,m,!0,e)}let r=w(n.analyses.segments.minute,"minute","hour",e)??k(C(n.analyses.segments.minute,e),"minute","hour",e),i=W(n,e),o=i?r+", "+i+l(n,e):r+", at "+U(n,{minute:0,second:null},!0,e)+l(n,e);return n.analyses.clockSecond?v(n,e)+", "+o:o}function gt(n,t,e){let r=t.minute,i=[],o=[];n.analyses.segments.hour.forEach(function(m){m.kind==="range"?i.push("from "+c({hour:m.bounds[0],minute:0},e)+p(e)+c({hour:m.bounds[1],minute:r},e)):m.kind==="step"?o.push(...m.fires):o.push(+m.value)});let u=An(n,e)+" "+h(i,e);return o.length&&(u+=" and at "+h(o.map(function(m){return c({hour:m,minute:r},e)}),e)),u}var ht={clockTimes:ft,compactClockTimes:dt,composeSeconds:Ze,everyHour:at,everyMinute:nt,everySecond:$e,hourRange:lt,hourStep:ct,minuteFrequency:it,minuteSpanAcrossHourStep:st,minuteSpanInHour:ot,minutesAcrossHours:ut,multipleMinutes:rt,rangeOfMinutes:tt,secondPastMinute:Ke,secondsWithinMinute:Ye,singleMinute:et,standaloneSeconds:Je};function Qn(n,t){let{interval:e,start:r,last:i,cycle:o,unit:u,anchor:s}=n,m="every "+d(e,t)+" "+u+"s",O=o%e===0;if(r===0&&O)return m;if(r<e&&O)return m+" from "+d(r,t)+" "+b(r,u)+" past the "+s;let g=L([r,i],t);return m+" from "+g(r)+p(t)+g(i)+" "+b(i,u)+" past the "+s}function qn(n){let t=[];for(let e of n){if(e.kind!=="single")return null;t.push(+e.value)}return t}function w(n,t,e,r){let i=qn(n),o=i&&bn(i);return o?Qn({...o,cycle:60,unit:t,anchor:e},r):null}function Vn(n,t,e,r){if(n.startToken.indexOf("-")!==-1)return k(jn(n.fires,r),t,e,r);let i=n.startToken==="*"?0:+n.startToken;return i!==0&&n.fires.length<=3?k(jn(n.fires,r),t,e,r):Qn({interval:n.interval,start:i,last:n.fires[n.fires.length-1],cycle:60,unit:t,anchor:e},r)}function $n(n,t){if(n.startToken.indexOf("-")!==-1)return"at "+on(n.fires,t);let e=n.startToken==="*"?0:+n.startToken,r=n.interval;return e===0?"every "+d(r,t)+" hours":n.fires.length<=3?"at "+on(n.fires,t):"every "+d(r,t)+" hours from "+c({hour:e,minute:0},t)}function rn(n,t){let{start:e,interval:r,last:i}=n,o="every "+d(r,t)+" hours",u=24%r===0;return e===0&&u?o:e<r&&u?o+" from "+c({hour:e,minute:0},t):o+" from "+c({hour:e,minute:0},t)+p(t)+c({hour:i,minute:0},t)}function Jn(n){return n.start<n.interval&&24%n.interval===0}function W(n,t){let e=Kn(n);return!e||Jn(e)?null:rn(e,t)}function pt(n){if(n.length<2)return null;let t=n[1]-n[0];if(t<2)return null;for(let e=2;e<n.length;e+=1)if(n[e]-n[e-1]!==t)return null;return n[0]!==0&&n.length<5?null:{interval:t,last:n[n.length-1],start:n[0]}}function Kn(n){let t=n.analyses.segments.hour;if(t.length===1&&t[0].kind==="step"){let r=t[0];if(r.fires.length<2)return null;let i=r.startToken==="*"?0:+r.startToken.split("-")[0];return{interval:r.interval,last:r.fires[r.fires.length-1],start:i}}let e=qn(t);return e&&pt(e)}function cn(n){return n.pattern.second==="*"||n.shapes.second==="step"}function Yn(n,t,e){if(t===0)return cn(n)?P(n,"minute",e)+" for one minute":P(n,"hour",e);let r=d(t,e)+" "+b(t,"minute")+" past the hour";return n.pattern.second==="0"?r:P(n,"minute",e)+", "+r}function mn(n,t,e){let r=Kn(n);if(!r)return null;let i=(r.last-r.start)/r.interval+1;if(n.pattern.second==="0"&&i<=T&&Jn(r))return null;let o=t===0&&cn(n)&&yt(n);return o?P(n,"minute",e)+" for one minute "+ln(o,e)+l(n,e):t===0&&n.pattern.second==="0"?rn(r,e)+l(n,e):Yn(n,t,e)+", "+rn(r,e)+l(n,e)}function yt(n){let t=n.analyses.segments.hour,e=t.length===1&&t[0];return!e||e.kind!=="step"||e.startToken.indexOf("-")!==-1||!(e.interval in En)?null:e}function bt(n){return n.analyses.segments.hour.some(function(e){return e.kind==="range"})}function St(n,t){let e=[],r=[];n.analyses.segments.hour.forEach(function(u){u.kind==="range"?e.push("from "+c({hour:+u.bounds[0],minute:0},t)+p(t)+c({hour:+u.bounds[1],minute:0},t)):u.kind==="step"?r.push(...u.fires):r.push(+u.value)});let i="every hour "+h(e,t);return r.length&&(i+=" and at "+h(r.map(function(u){return c({hour:u,minute:0},t)}),t)),i}function fn(n,t,e){return t!==0||!bt(n)||n.pattern.second==="0"?null:cn(n)?P(n,"minute",e)+" for one minute during the "+U(n,{minute:0,second:null},!1,e)+" hours"+l(n,e):Yn(n,t,e)+", "+St(n,e)+l(n,e)}function L(n,t){let e=n.some(function(i){return+i>10});return function(i){return e?""+i:d(i,t)}}function jn(n,t){return n.map(L(n,t))}function C(n,t){let e=n.flatMap(function(o){return o.kind==="range"?o.bounds:o.kind==="step"?o.fires:[o.value]}),r=L(e,t);return n.flatMap(function(o){return o.kind==="range"?[r(o.bounds[0])+p(t)+r(o.bounds[1])]:o.kind==="step"?o.fires.map(r):[r(o.value)]})}function k(n,t,e,r){return"at "+h(n,r)+" "+t+"s past the "+e}function kt(n,t,e){return(+n==0||+n==12)&&+t==0&&!(typeof e=="number"&&e>0)}function dn(n){let t=n.filter(function(r){return kt(r.hour,r.minute,r.second)});return t.length>0&&t.length<n.length}function on(n,t){let e=dn(n.map(function(o){return{hour:o,minute:0}})),r=n.map(function(o){return c({hour:o,minute:0,plain:e},t)});return h(r,t)}function un(n,t,e,r){return t.kind==="fires"?on(t.fires,r):U(n,{minute:0,second:null},e,r)}function Ot(n){return n.kind==="range"?n.bounds:n.kind==="step"?n.fires:[n.value]}function U(n,t,e,r){let{minute:i,second:o}=t,u=n.analyses.segments.hour,s=dn(u.flatMap(function(g){return Ot(g).map(function(J){return{hour:+J,minute:i,second:o}})})),m=[];return u.forEach(function(g){g.kind==="step"?m.push(...g.fires.map(function(J){return c({hour:J,minute:i,second:o,plain:s},r)})):g.kind==="range"?m.push(c({hour:g.bounds[0],minute:i,second:o,plain:s},r)+p(r)+c({hour:g.bounds[1],minute:i,second:o,plain:s},r)):m.push(c({hour:g.value,minute:i,second:o,plain:s},r))}),h(Nt(m,u,e),r)}function Nt(n,t,e){let r=t.some(function(o){return o.kind==="range"});return!e||!r?n:n.map(function(o,u){return u===0?o:"at "+o})}function h(n,t){if(n.length<=1)return n.join("");if(n.length===2)return n[0]+" and "+n[1];let e=t.style.serialComma?", and ":" and ";return n.slice(0,-1).join(", ")+e+n[n.length-1]}var zt={all:"",month:"in ",stepDate:"on ",weekday:"on "},gn={all:"every day",month:"every day in ",stepDate:"",weekday:"every "};function l(n,t){let e=q(n,zt,t);return e&&" "+e}function Bn(n,t){return q(n,gn,t)+" "}function q(n,t,e){let r=n.pattern;return r.date!=="*"&&r.weekday!=="*"?Pt(n,e):r.date!=="*"?Rt(n,t,e):r.weekday!=="*"?(Zn(r.weekday,e)||t.weekday+ee(n,e))+A(n,e):r.month!=="*"?t.month+j(n,e):t.all}function Rt(n,t,e){let r=n.pattern,i=hn(r.date,e);return i?i+A(n,e):$(r.date)?t.stepDate+_n(r.date)+A(n,e):r.month!=="*"&&!Gn(n)?"on the "+sn(n,e)+A(n,e):r.month!=="*"?"on "+Xn(n,e):"on the "+sn(n,e)}function Gn(n){return!ne(n.pattern.month)&&n.analyses.segments.month.every(function(e){return e.kind!=="range"})}function Pt(n,t){let e=n.pattern,r=Zn(e.weekday,t)||"on "+ee(n,t);return e.month!=="*"&&Gn(n)&&!hn(e.date,t)&&!$(e.date)?"on "+Xn(n,t)+" or "+r+" in "+j(n,t):vt(n,t)+" or "+r+wt(n,t)}function vt(n,t){let e=n.pattern,r=hn(e.date,t);return r||($(e.date)?_n(e.date):"on the "+sn(n,t))}function wt(n,t){return n.pattern.month==="*"?"":", in "+j(n,t)}function hn(n,t){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 e=/^L-(\d{1,2})$/.exec(n);if(e)return d(+e[1],t)+" "+b(e[1],"day")+" before the last day of the month";let r=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(r)return"on the weekday nearest the "+H(r[1]||r[2])}function Zn(n,t){let e=n.split("#");if(e.length===2)return"on the "+Qe[+e[1]]+" "+an(e[0],t)+" of the month";if(/L$/.test(n))return"on the last "+an(n.slice(0,-1),t)+" of the month"}function Xn(n,t){let e=j(n,t),r=V(n.analyses.segments.date,t.style.ordinals?H:Ct,t);return t.style.dayFirst?r+" "+e:e+" "+r}function Ct(n){return""+n}function A(n,t){return n.pattern.month==="*"?"":" in "+j(n,t)}function _n(n){let t=n.split("/"),e=+t[1],r=t[0],o=(e===2?"every other":"every "+H(e))+" day of the month";return r!=="*"&&r!=="1"&&(o+=" from the "+H(r)),o}function sn(n,t){return V(n.analyses.segments.date,H,t)}function j(n,t){let e=ne(n.pattern.month);return e||V(n.analyses.segments.month,function(i){return Mt(i,t)},t)}function ne(n){if(!$(n))return null;let[t,e]=n.split("/");return+e!=2?null:t==="*"||t==="1"?"every odd-numbered month":t==="2"?"every even-numbered month":null}function ee(n,t){let e=Sn(n.analyses.segments.weekday);return V(e,function(i){return an(i,t)},t)}function V(n,t,e){let r=[];return n.forEach(function(o){o.kind==="step"?r.push(...o.fires.map(t)):o.kind==="range"?r.push(o.bounds.map(t).join(p(e))):r.push(t(o.value))}),h(r,e)}function $(n){return n.indexOf("/")!==-1&&n.indexOf("-")===-1&&n.indexOf(",")===-1}function Tt(n,t,e){let r=t.pattern.year;if(r==="*")return n;if(r.indexOf("/")!==-1)return n+" "+Ft(r,e);let i=xt(r,e);if(r.indexOf("-")===-1&&r.indexOf(",")===-1&&t.pattern.date!=="*"&&n.indexOf(" at ")!==-1){let o=e.style.dayFirst?" ":", ";return n.replace(" at ",o+i+" at ")}return n+" in "+i}function xt(n,t){return n.indexOf(",")!==-1?h(n.split(","),t):n}function Ft(n,t){let e=n.split("/"),r=+e[1],i=e[0];if(r<=1)return"every year";let o="every "+d(r,t)+" years";return i!=="*"&&i!=="0"&&(o+=" from "+i),o}function c(n,t){let{hour:e,minute:r,plain:i,explicit:o}=n,u=typeof n.second=="number"&&n.second>0?n.second:0;return t.ampm?It({hour:e,minute:r,second:u,plain:i,explicit:o},t):nn({hour:e,minute:r,second:u},{pad:!0,sep:t.style.sep})}function It(n,t){let{hour:e,minute:r,second:i,plain:o,explicit:u}=n,s=t.style;if(!o&&!u&&+r==0&&!i){if(+e==0)return s.midnight;if(+e==12)return s.midday}return nn({hour:e%12||12,minute:r,second:i},{lean:!u,sep:s.sep})+(s.closeUp?"":" ")+(e<12?s.am:s.pm)}function d(n,t){return Wn(n,Ee,t)}function b(n,t){return+n==1?t:t+"s"}function p(n){return n.short?"-":n.style.through}function H(n){let t=Math.abs(n),e=tn[t];return e||(t=(t%100-20)%10,e=tn[t]||tn[0]),n+e}function Mt(n,t){let e=Ae[+n];return e&&e[t.short?1:0]}function an(n,t){let e=n===7||n==="7"?0:n,r=S[e]||Ue[e];return r&&r[t.short?1:0]}var Ht={describe:Ve,fallback:"an unrecognizable cron pattern",options:qe,reboot:"at system startup",sentence:n=>"Runs "+n+(n.endsWith(".")?"":".")},te=Ht;/**
2
2
  * @license MIT, Copyright (c) 2026 Andrew Brož
3
- */function Pt(n,e){let t=e&&e.lang||Bn,r=t.options(e);if(!r.lenient)return Gn(Kn(n,t,r),t,e);try{return Gn(Kn(n,t,r),t,e)}catch{return t.fallback}}function Gn(n,e,t){return t&&t.sentence?e.sentence(n):n}function Kn(n,e,t){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return e.reboot;let r=Pn(Cn(n,t)),i=e.strategy?e.strategy(r,r.plan):r.plan;return e.describe({...r,plan:i},t)}var fn=Pt;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:fn});var ar=fn;})();
3
+ */function Wt(n,t){let e=t&&t.lang||te,r=e.options(t);if(!r.lenient)return re(ie(n,e,r),e,t);try{return re(ie(n,e,r),e,t)}catch{return e.fallback}}function re(n,t,e){return e&&e.sentence?t.sentence(n):n}function ie(n,t,e){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return t.reboot;let r=Fn(Hn(n,e)),i=t.strategy?t.strategy(r,r.plan):r.plan;return t.describe({...r,plan:i},e)}var pn=Wt;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:pn});var Sr=pn;})();
package/dist/cronli5.cjs CHANGED
@@ -110,6 +110,26 @@ function arithmeticStep(values) {
110
110
  }
111
111
  return { start: values[0], interval, last: values[values.length - 1] };
112
112
  }
113
+ function weekdayDisplayKey(value) {
114
+ return value === 0 ? 7 : value;
115
+ }
116
+ function orderWeekdaysForDisplay(segments) {
117
+ const flattened = segments.flatMap(function flat(segment) {
118
+ return segment.kind === "step" ? segment.fires.map(function single(value) {
119
+ return { kind: "single", value: "" + value };
120
+ }) : [segment];
121
+ });
122
+ function key(segment) {
123
+ return segment.kind === "range" ? weekdayDisplayKey(+segment.bounds[0]) : weekdayDisplayKey(+segment.value);
124
+ }
125
+ return flattened.map(function index(segment, position) {
126
+ return [segment, position];
127
+ }).sort(function byDisplayKey(a, b) {
128
+ return key(a[0]) - key(b[0]) || a[1] - b[1];
129
+ }).map(function unwrap(pair) {
130
+ return pair[0];
131
+ });
132
+ }
113
133
  function toFieldNumber(token, numberMap) {
114
134
  return isNonNegativeInteger(token) ? +token : numberMap[token.toUpperCase()];
115
135
  }
@@ -972,7 +992,17 @@ function renderSecondsWithinMinute(ir, plan, opts) {
972
992
  }
973
993
  function composeHourCadence(ir, plan, opts) {
974
994
  const clockRest = plan.rest.kind === "clockTimes" || plan.rest.kind === "compactClockTimes";
975
- return clockRest && ir.shapes.minute === "single" ? hourCadence(ir, +ir.pattern.minute, opts) : null;
995
+ if (!clockRest || ir.shapes.minute !== "single") {
996
+ return null;
997
+ }
998
+ const minute = +ir.pattern.minute;
999
+ return hourCadence(ir, minute, opts) ?? hourRangeCadence(ir, minute, opts);
1000
+ }
1001
+ function clockTimesConfinement(ir, rest, opts) {
1002
+ if (+rest.times[0].minute === 0 && ir.shapes.minute === "single") {
1003
+ return secondsLeadClause(ir, opts) + " for one minute at " + durationHours(ir, rest, opts);
1004
+ }
1005
+ return secondsLeadClause(ir, opts) + " of " + clockTimesOf(ir, rest, opts);
976
1006
  }
977
1007
  function renderComposeSeconds(ir, plan, opts) {
978
1008
  const cadence = composeHourCadence(ir, plan, opts);
@@ -980,16 +1010,14 @@ function renderComposeSeconds(ir, plan, opts) {
980
1010
  return cadence;
981
1011
  }
982
1012
  if (plan.rest.kind === "clockTimes" && (ir.shapes.second === "wildcard" || ir.shapes.second === "step")) {
983
- const minute = plan.rest.times[0].minute;
984
- if (+minute === 0) {
985
- return secondsLeadClause(ir, opts) + " for one minute at " + durationHours(ir, plan.rest, opts);
986
- }
987
- return secondsLeadClause(ir, opts) + " of " + clockTimesOf(ir, plan.rest, opts);
1013
+ return clockTimesConfinement(ir, plan.rest, opts);
988
1014
  }
989
1015
  if (ir.shapes.second === "wildcard" && plan.rest.kind === "minuteFrequency" && plan.rest.hours.kind === "none" && ir.pattern.minute === "*/2") {
990
1016
  return "every second of every other minute" + trailingQualifier(ir, opts);
991
1017
  }
992
- return secondsLeadClause(ir, opts) + ", " + render(ir, plan.rest, opts);
1018
+ const restOwnsLead = plan.rest.kind === "compactClockTimes" && ir.analyses.clockSecond;
1019
+ const lead = restOwnsLead ? "" : secondsLeadClause(ir, opts) + ", ";
1020
+ return lead + render(ir, plan.rest, opts);
993
1021
  }
994
1022
  function durationHours(ir, plan, opts) {
995
1023
  const hours = plan.times.map(function clock(time) {
@@ -1072,7 +1100,8 @@ function renderMinuteFrequency(ir, plan, opts) {
1072
1100
  opts
1073
1101
  );
1074
1102
  if (plan.hours.kind === "during") {
1075
- phrase += " during the " + hourTimesFromPlan(ir, plan.hours.times, false, opts) + " hours";
1103
+ const cadence = unevenHourCadence(ir, opts);
1104
+ phrase += cadence ? ", " + cadence : " during the " + hourTimesFromPlan(ir, plan.hours.times, false, opts) + " hours";
1076
1105
  } else if (plan.hours.kind === "window") {
1077
1106
  phrase += " " + hourWindow(plan.hours, opts);
1078
1107
  } else if (plan.hours.kind === "step") {
@@ -1087,10 +1116,13 @@ function renderMinuteSpanInHour(ir, plan, opts) {
1087
1116
  return "every minute from " + getTime({ hour: plan.hour, minute: plan.span[0] }, opts) + through(opts) + getTime({ hour: plan.hour, minute: plan.span[1] }, opts) + trailingQualifier(ir, opts);
1088
1117
  }
1089
1118
  function renderMinutesAcrossHours(ir, plan, opts) {
1119
+ const cadence = unevenHourCadence(ir, opts);
1090
1120
  if (plan.form === "wildcard") {
1121
+ if (cadence !== null) {
1122
+ return "every minute, " + cadence + trailingQualifier(ir, opts);
1123
+ }
1091
1124
  return "every minute during the " + hourTimesFromPlan(ir, plan.times, false, opts) + " hours" + trailingQualifier(ir, opts);
1092
1125
  }
1093
- const times = hourTimesFromPlan(ir, plan.times, true, opts);
1094
1126
  const lead = plan.form === "range" ? minuteRangeLead(ir.pattern.minute, opts) : (
1095
1127
  // The 'list' form is a minute list, which has segments; an offset/uneven
1096
1128
  // step enumerated to that list reads as a stride.
@@ -1101,6 +1133,10 @@ function renderMinutesAcrossHours(ir, plan, opts) {
1101
1133
  opts
1102
1134
  )
1103
1135
  );
1136
+ if (cadence !== null) {
1137
+ return lead + ", " + cadence + trailingQualifier(ir, opts);
1138
+ }
1139
+ const times = hourTimesFromPlan(ir, plan.times, true, opts);
1104
1140
  return lead + ", at " + times + trailingQualifier(ir, opts);
1105
1141
  }
1106
1142
  var stepOrdinals = {
@@ -1127,7 +1163,8 @@ function renderMinuteSpanAcrossHourStep(ir, plan, opts) {
1127
1163
  "hour",
1128
1164
  opts
1129
1165
  ) : minuteRangeLead(ir.pattern.minute, opts);
1130
- return lead + ", " + stepHours(segment, opts) + trailingQualifier(ir, opts);
1166
+ const cadence = unevenHourCadence(ir, opts);
1167
+ return lead + ", " + (cadence ?? stepHours(segment, opts)) + trailingQualifier(ir, opts);
1131
1168
  }
1132
1169
  function minuteRangeLead(minuteField, opts) {
1133
1170
  const bounds = minuteField.split("-");
@@ -1164,17 +1201,23 @@ function rangeMinuteLead(ir, opts) {
1164
1201
  );
1165
1202
  }
1166
1203
  function renderHourStep(ir, plan, opts) {
1204
+ const cadence = unevenHourCadence(ir, opts);
1205
+ if (cadence !== null) {
1206
+ return cadence + trailingQualifier(ir, opts);
1207
+ }
1167
1208
  return stepHours(ir.analyses.segments.hour[0], opts) + trailingQualifier(ir, opts);
1168
1209
  }
1169
1210
  function boundedWindow(plan) {
1170
- return { from: plan.from, last: plan.boundMinute ?? 0, to: plan.to };
1211
+ const last = plan.minuteForm === "wildcard" ? plan.boundMinute ?? 0 : 0;
1212
+ return { from: plan.from, last, to: plan.to };
1171
1213
  }
1172
1214
  function hourWindow(window, opts) {
1173
1215
  return "from " + getTime({ hour: window.from, minute: 0 }, opts) + through(opts) + getTime({ hour: window.to, minute: window.last }, opts);
1174
1216
  }
1175
1217
  function renderClockTimes(ir, plan, opts) {
1176
1218
  if (ir.shapes.minute === "single") {
1177
- const cadence = hourCadence(ir, +ir.pattern.minute, opts);
1219
+ const minute = +ir.pattern.minute;
1220
+ const cadence = hourCadence(ir, minute, opts) ?? hourRangeCadence(ir, minute, opts);
1178
1221
  if (cadence !== null) {
1179
1222
  return cadence;
1180
1223
  }
@@ -1192,9 +1235,9 @@ function renderClockTimes(ir, plan, opts) {
1192
1235
  }
1193
1236
  function renderCompactClockTimes(ir, plan, opts) {
1194
1237
  if (plan.fold) {
1195
- const cadence = hourCadence(ir, +plan.minute, opts);
1196
- if (cadence !== null) {
1197
- return cadence;
1238
+ const cadence2 = hourCadence(ir, +plan.minute, opts) ?? hourRangeCadence(ir, +plan.minute, opts);
1239
+ if (cadence2 !== null) {
1240
+ return cadence2;
1198
1241
  }
1199
1242
  const hasRange = ir.analyses.segments.hour.some(function range(segment) {
1200
1243
  return segment.kind === "range";
@@ -1205,16 +1248,18 @@ function renderCompactClockTimes(ir, plan, opts) {
1205
1248
  const fold = { minute: plan.minute, second: ir.analyses.clockSecond };
1206
1249
  return interpretDayQualifier(ir, opts) + "at " + hourSegmentTimes(ir, fold, true, opts);
1207
1250
  }
1208
- const phrase = (
1251
+ const minuteLead = (
1209
1252
  // The non-fold branch is a minute list, which has segments. An
1210
1253
  // offset/uneven step enumerated to that list reads as a stride.
1211
- (strideFromSegments(ir.analyses.segments.minute, "minute", "hour", opts) ?? listPastThe(
1254
+ strideFromSegments(ir.analyses.segments.minute, "minute", "hour", opts) ?? listPastThe(
1212
1255
  segmentWords(ir.analyses.segments.minute, opts),
1213
1256
  "minute",
1214
1257
  "hour",
1215
1258
  opts
1216
- )) + ", at " + hourSegmentTimes(ir, { minute: 0, second: null }, true, opts) + trailingQualifier(ir, opts)
1259
+ )
1217
1260
  );
1261
+ const cadence = unevenHourCadence(ir, opts);
1262
+ const phrase = cadence ? minuteLead + ", " + cadence + trailingQualifier(ir, opts) : minuteLead + ", at " + hourSegmentTimes(ir, { minute: 0, second: null }, true, opts) + trailingQualifier(ir, opts);
1218
1263
  return ir.analyses.clockSecond ? secondsLeadClause(ir, opts) + ", " + phrase : phrase;
1219
1264
  }
1220
1265
  function foldedHourWindows(ir, plan, opts) {
@@ -1332,16 +1377,46 @@ function hourStrideCadence(stride, opts) {
1332
1377
  }
1333
1378
  return cadence + " from " + getTime({ hour: start, minute: 0 }, opts) + through(opts) + getTime({ hour: last, minute: 0 }, opts);
1334
1379
  }
1380
+ function offsetCleanStride(stride) {
1381
+ return stride.start < stride.interval && 24 % stride.interval === 0;
1382
+ }
1383
+ function unevenHourCadence(ir, opts) {
1384
+ const stride = hourStride(ir);
1385
+ if (!stride || offsetCleanStride(stride)) {
1386
+ return null;
1387
+ }
1388
+ return hourStrideCadence(stride, opts);
1389
+ }
1390
+ function hourListStride(values) {
1391
+ if (values.length < 2) {
1392
+ return null;
1393
+ }
1394
+ const interval = values[1] - values[0];
1395
+ if (interval < 2) {
1396
+ return null;
1397
+ }
1398
+ for (let i = 2; i < values.length; i += 1) {
1399
+ if (values[i] - values[i - 1] !== interval) {
1400
+ return null;
1401
+ }
1402
+ }
1403
+ if (values[0] !== 0 && values.length < 5) {
1404
+ return null;
1405
+ }
1406
+ return { interval, last: values[values.length - 1], start: values[0] };
1407
+ }
1335
1408
  function hourStride(ir) {
1336
1409
  const segments = ir.analyses.segments.hour;
1337
1410
  if (segments.length === 1 && segments[0].kind === "step") {
1338
1411
  const segment = segments[0];
1412
+ if (segment.fires.length < 2) {
1413
+ return null;
1414
+ }
1339
1415
  const start = segment.startToken === "*" ? 0 : +segment.startToken.split("-")[0];
1340
1416
  return { interval: segment.interval, last: segment.fires[segment.fires.length - 1], start };
1341
1417
  }
1342
1418
  const values = singleValues(segments);
1343
- const step = values && arithmeticStep(values);
1344
- return step || null;
1419
+ return values && hourListStride(values);
1345
1420
  }
1346
1421
  function subMinuteSecond(ir) {
1347
1422
  return ir.pattern.second === "*" || ir.shapes.second === "step";
@@ -1365,13 +1440,16 @@ function hourCadence(ir, minute, opts) {
1365
1440
  return null;
1366
1441
  }
1367
1442
  const fires = (stride.last - stride.start) / stride.interval + 1;
1368
- if (ir.pattern.second === "0" && fires <= maxClockTimes) {
1443
+ if (ir.pattern.second === "0" && fires <= maxClockTimes && offsetCleanStride(stride)) {
1369
1444
  return null;
1370
1445
  }
1371
1446
  const confinement = minute === 0 && subMinuteSecond(ir) && cleanStrideSegment(ir);
1372
1447
  if (confinement) {
1373
1448
  return secondsClause(ir, "minute", opts) + " for one minute " + everyNthHour(confinement, opts) + trailingQualifier(ir, opts);
1374
1449
  }
1450
+ if (minute === 0 && ir.pattern.second === "0") {
1451
+ return hourStrideCadence(stride, opts) + trailingQualifier(ir, opts);
1452
+ }
1375
1453
  return hourCadenceLead(ir, minute, opts) + ", " + hourStrideCadence(stride, opts) + trailingQualifier(ir, opts);
1376
1454
  }
1377
1455
  function cleanStrideSegment(ir) {
@@ -1382,6 +1460,46 @@ function cleanStrideSegment(ir) {
1382
1460
  }
1383
1461
  return segment;
1384
1462
  }
1463
+ function hasHourWindow(ir) {
1464
+ return ir.analyses.segments.hour.some(function range(segment) {
1465
+ return segment.kind === "range";
1466
+ });
1467
+ }
1468
+ function hourRangeWindowTail(ir, opts) {
1469
+ const windows = [];
1470
+ const singles = [];
1471
+ ir.analyses.segments.hour.forEach(function classify(segment) {
1472
+ if (segment.kind === "range") {
1473
+ windows.push("from " + getTime(
1474
+ { hour: +segment.bounds[0], minute: 0 },
1475
+ opts
1476
+ ) + through(opts) + getTime({ hour: +segment.bounds[1], minute: 0 }, opts));
1477
+ } else if (segment.kind === "step") {
1478
+ singles.push(...segment.fires);
1479
+ } else {
1480
+ singles.push(+segment.value);
1481
+ }
1482
+ });
1483
+ let phrase = "every hour " + joinList(windows, opts);
1484
+ if (singles.length) {
1485
+ phrase += " and at " + joinList(singles.map(function time(hour) {
1486
+ return getTime({ hour, minute: 0 }, opts);
1487
+ }), opts);
1488
+ }
1489
+ return phrase;
1490
+ }
1491
+ function hourRangeCadence(ir, minute, opts) {
1492
+ if (minute !== 0 || !hasHourWindow(ir)) {
1493
+ return null;
1494
+ }
1495
+ if (ir.pattern.second === "0") {
1496
+ return null;
1497
+ }
1498
+ if (subMinuteSecond(ir)) {
1499
+ return secondsClause(ir, "minute", opts) + " for one minute during the " + hourSegmentTimes(ir, { minute: 0, second: null }, false, opts) + " hours" + trailingQualifier(ir, opts);
1500
+ }
1501
+ return hourCadenceLead(ir, minute, opts) + ", " + hourRangeWindowTail(ir, opts) + trailingQualifier(ir, opts);
1502
+ }
1385
1503
  function seriesNumber(values, opts) {
1386
1504
  const anyBig = values.some(function big(v) {
1387
1505
  return +v > 10;
@@ -1546,17 +1664,27 @@ function monthFoldsIntoDate(ir) {
1546
1664
  function dateOrWeekday(ir, opts) {
1547
1665
  const pattern = ir.pattern;
1548
1666
  const weekdayPart = quartzWeekdayPhrase(pattern.weekday, opts) || "on " + weekdayPhrase(ir, opts);
1667
+ if (pattern.month !== "*" && monthFoldsIntoDate(ir) && !quartzDatePhrase(pattern.date, opts) && !isOpenStep(pattern.date)) {
1668
+ return "on " + monthDatePhrase(ir, opts) + " or " + weekdayPart + " in " + monthName(ir, opts);
1669
+ }
1670
+ return datePart(ir, opts) + " or " + weekdayPart + orMonthScope(ir, opts);
1671
+ }
1672
+ function datePart(ir, opts) {
1673
+ const pattern = ir.pattern;
1549
1674
  const quartzDate = quartzDatePhrase(pattern.date, opts);
1550
1675
  if (quartzDate) {
1551
- return quartzDate + monthScope(ir, opts) + " or " + weekdayPart;
1676
+ return quartzDate;
1552
1677
  }
1553
1678
  if (isOpenStep(pattern.date)) {
1554
- return stepDates(pattern.date) + monthScope(ir, opts) + " or " + weekdayPart;
1679
+ return stepDates(pattern.date);
1555
1680
  }
1556
- if (pattern.month !== "*" && monthFoldsIntoDate(ir)) {
1557
- return "on " + monthDatePhrase(ir, opts) + " or " + weekdayPart + " in " + monthName(ir, opts);
1681
+ return "on the " + dateOrdinals(ir, opts);
1682
+ }
1683
+ function orMonthScope(ir, opts) {
1684
+ if (ir.pattern.month === "*") {
1685
+ return "";
1558
1686
  }
1559
- return "on the " + dateOrdinals(ir, opts) + " or " + weekdayPart + monthScope(ir, opts);
1687
+ return ", in " + monthName(ir, opts);
1560
1688
  }
1561
1689
  function quartzDatePhrase(dateField, opts) {
1562
1690
  if (dateField === "L") {
@@ -1638,7 +1766,8 @@ function oddEvenMonth(monthField) {
1638
1766
  return start === "2" ? "every even-numbered month" : null;
1639
1767
  }
1640
1768
  function weekdayPhrase(ir, opts) {
1641
- return renderSegments(ir.analyses.segments.weekday, function name(value) {
1769
+ const segments = orderWeekdaysForDisplay(ir.analyses.segments.weekday);
1770
+ return renderSegments(segments, function name(value) {
1642
1771
  return getWeekday(value, opts);
1643
1772
  }, opts);
1644
1773
  }