cronli5 0.7.2 → 0.8.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 +57 -0
- package/README.md +30 -13
- package/cronli5.min.js +2 -2
- package/dist/cronli5.cjs +67 -7
- package/dist/cronli5.js +67 -7
- package/dist/lang/de.cjs +10 -9
- package/dist/lang/de.js +10 -9
- package/dist/lang/en.cjs +9 -4
- package/dist/lang/en.js +9 -4
- package/dist/lang/es.cjs +7 -3
- package/dist/lang/es.js +7 -3
- package/dist/lang/fi.cjs +11 -6
- package/dist/lang/fi.js +11 -6
- package/dist/lang/fr.cjs +7 -3
- package/dist/lang/fr.js +7 -3
- package/dist/lang/pt.cjs +7 -3
- package/dist/lang/pt.js +7 -3
- package/dist/lang/zh.cjs +29 -8
- package/dist/lang/zh.js +29 -8
- package/package.json +1 -1
- package/src/core/index.ts +7 -3
- package/src/core/quartz.ts +97 -0
- package/src/core/schedule.ts +1 -0
- package/src/core/specs.ts +2 -2
- package/src/cronli5.ts +20 -3
- package/src/lang/de/index.ts +41 -30
- package/src/lang/en/index.ts +25 -7
- package/src/lang/es/index.ts +23 -7
- package/src/lang/fi/index.ts +36 -18
- package/src/lang/fr/index.ts +23 -7
- package/src/lang/pt/index.ts +23 -6
- package/src/lang/zh/index.ts +81 -12
- package/src/types.ts +44 -0
- package/types/core/quartz.d.ts +4 -0
- package/types/core/schedule.d.ts +1 -0
- package/types/cronli5.d.ts +4 -4
- package/types/types.d.ts +39 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,63 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.8.2]
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Redundant hour scope under a stepped/ranged hour (all languages).** A minute
|
|
14
|
+
cadence under a restricted hour-step (e.g. `2/7 0/4`, `3/2 9-17/2`, `5/10 0/4`)
|
|
15
|
+
no longer asserts a generic every-hour scope alongside the hour clause
|
|
16
|
+
("past the hour" / "de cada hora" / "de chaque heure" / "每小时" / "jeder
|
|
17
|
+
Stunde"). The hour clause is now the sole authority, so the description recovers
|
|
18
|
+
the hour step rather than reading as "every hour." Hour windows (`9-17`) and
|
|
19
|
+
lists keep their bound (they already round-trip). Now uniform across
|
|
20
|
+
en/es/de/fi/fr/pt/zh.
|
|
21
|
+
- **Dangling seconds clause (zh, de, fi).** For a single fixed minute, the
|
|
22
|
+
"every second" clause now binds to the timestamp instead of floating — zh
|
|
23
|
+
"0点2分**的**每一秒" (was an ungrammatical bare "每秒"), de "**der Minute** 0:02",
|
|
24
|
+
fi "minuutin 0.02 **aikana**" — matching their own minute-0 form and
|
|
25
|
+
en/es/fr/pt.
|
|
26
|
+
|
|
27
|
+
## [0.8.1]
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- **Docs: review panels are Claude Sonnet instances.** Every reference to a
|
|
32
|
+
review "panel" now reads unambiguously as a blind panel of Claude Sonnet model
|
|
33
|
+
instances — including the cRonstrue comparison's "preferred cronli5 on 81 of
|
|
34
|
+
108" claim — with the human **beta → stable** graduation gate kept sharply
|
|
35
|
+
distinct (a fluent human, not a model). No confusion about human involvement.
|
|
36
|
+
- **Docs: the add-language workflow reframed.** A new language is always derived
|
|
37
|
+
from existing renderers — a same-family sibling is the fast path, otherwise
|
|
38
|
+
English (the universal anchor) plus typological neighbors for specific
|
|
39
|
+
mechanics. The blind from-scratch pipeline is the original experiment, retained
|
|
40
|
+
only as the clean-room `rewrite-test` soundness check — no longer presented as
|
|
41
|
+
a "no-sibling fallback".
|
|
42
|
+
|
|
43
|
+
## [0.8.0]
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
|
|
47
|
+
- **`quartz` option.** `cronli5(pattern, { quartz: true })` reads the schedule as
|
|
48
|
+
Quartz: day-of-week is `1`=Sunday … `7`=Saturday (so `0 0 ? * 2` is **Monday**),
|
|
49
|
+
with the DOW-indexed operators (`6L`, `2#2`) and `?` following Quartz. Without
|
|
50
|
+
it, day-of-week stays standard cron (`0`/`7`=Sun, `1`=Mon).
|
|
51
|
+
- **`cronli5.sentence(expr, opts)` and `cronli5.fragment(expr, opts)`** —
|
|
52
|
+
convenience methods on the callable: `.sentence()` returns the capitalized
|
|
53
|
+
standalone ("Runs …."), `.fragment()` the embeddable lowercase fragment (the
|
|
54
|
+
default). Sugar over the `{ sentence }` option. (Deliberately no `toString`
|
|
55
|
+
method — it would collide with `Function.prototype.toString`.)
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
|
|
59
|
+
- **Breaking: `?` now requires `{ quartz: true }`.** Previously `?` was silently
|
|
60
|
+
treated as `*` while day-of-week used standard indexing, so a genuine Quartz
|
|
61
|
+
cron like `0 0 ? * 2` rendered "every Tuesday" when the author meant Monday.
|
|
62
|
+
`?` (mandatory in Quartz, absent in standard cron) now throws a clear
|
|
63
|
+
`pass { quartz: true }` error by default — eliminating silent wrong output.
|
|
64
|
+
`L`, `W`, and `#` are unaffected and remain usable in standard mode.
|
|
65
|
+
|
|
9
66
|
## [0.7.2]
|
|
10
67
|
|
|
11
68
|
### Changed
|
package/README.md
CHANGED
|
@@ -91,6 +91,23 @@ cronli5(['*/5', '*', '*', '*', '*']); // 'every five minutes'
|
|
|
91
91
|
cronli5({ minute: '*/5' }); // 'every five minutes'
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
By default `cronli5(...)` returns the lowercase, embeddable **fragment**. For
|
|
95
|
+
the capitalized, standalone **sentence**, set [`sentence: true`](#options) — or
|
|
96
|
+
call the matching convenience method. `cronli5.sentence(...)` and
|
|
97
|
+
`cronli5.fragment(...)` are thin sugar over that option (each forwards all
|
|
98
|
+
other options) and read a little better at the call site:
|
|
99
|
+
```js
|
|
100
|
+
cronli5('0 0 * * *'); // 'every day at midnight' (fragment, default)
|
|
101
|
+
cronli5.fragment('0 0 * * *'); // 'every day at midnight' (same as above)
|
|
102
|
+
cronli5.sentence('0 0 * * *'); // 'Runs every day at midnight.'
|
|
103
|
+
cronli5.sentence('0 0 * * *', {lang: de}); // 'Läuft täglich um Mitternacht.'
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
(There is intentionally no `cronli5.toString(...)`: it would shadow
|
|
107
|
+
`Function.prototype.toString`, which the runtime calls with no arguments for
|
|
108
|
+
`String(cronli5)`, template literals, and console output — the named methods
|
|
109
|
+
sidestep that collision.)
|
|
110
|
+
|
|
94
111
|
TypeScript types are bundled, so usage is fully typed out of the box:
|
|
95
112
|
```ts
|
|
96
113
|
import cronli5, { type Cronli5Options } from 'cronli5';
|
|
@@ -147,8 +164,7 @@ It accepts the standard allowed values and the following operators:
|
|
|
147
164
|
### Extended Format Support
|
|
148
165
|
|
|
149
166
|
Ranges in cyclic fields may wrap around (`22-2` is an overnight window, and
|
|
150
|
-
`FRI-MON` is a long weekend). Quartz-style tokens are also supported in the date and weekday fields: `L` (last day, or `5L` for the last Friday), `W` (nearest weekday, e.g. `15W`), `#` (nth weekday, e.g. `1#2` for the second Monday)
|
|
151
|
-
value).
|
|
167
|
+
`FRI-MON` is a long weekend). Quartz-style tokens are also supported in the date and weekday fields: `L` (last day, or `5L` for the last Friday), `W` (nearest weekday, e.g. `15W`), and `#` (nth weekday, e.g. `1#2` for the second Monday). Quartz's `?` ("no specific value") and its day-of-week numbering (1 = Sunday) require the [`quartz` option](#options); see its note for why.
|
|
152
168
|
|
|
153
169
|
## Options
|
|
154
170
|
|
|
@@ -158,15 +174,16 @@ The `cronli5` function takes an `options` object as its 2nd parameter:
|
|
|
158
174
|
| --- | --- | --- |
|
|
159
175
|
| `ampm` | `true` (English) | Use a 12-hour clock. Set `false` for 24-hour time. The default is language-specific: English is 12-hour; Spanish and Finnish default to 24-hour (Finnish is 24-hour only). |
|
|
160
176
|
| `dialect` | `'us'` | The English style. `'us'` follows the [Chicago Manual of Style][chicago]: serial commas, `through` ranges, `9 a.m.`/`5:30 p.m.` times, `noon`/`midnight`, and `January 1` dates. `'gb'` follows the [Guardian style guide][guardian]: no serial comma, `to` ranges, `9am`/`5.30pm` times, `midday`/`midnight`, and `1 January` dates. `'house'` is cronli5's legacy voice (`9:30 AM`, `Monday - Friday`). A custom object defines your own style. (`'uk'` is a deprecated alias for `'gb'`.) See [docs/dialects.md](./docs/dialects.md). |
|
|
161
|
-
| `lang` | English | A language module, e.g. `import es from 'cronli5/lang/es'`. Each language owns its words, conventions, and dialects
|
|
177
|
+
| `lang` | English | A language module, e.g. `import es from 'cronli5/lang/es'`. Each language owns its words, conventions, and dialects — see [Languages](#languages). |
|
|
162
178
|
| `lenient` | `false` | Never throw: invalid input returns the language's fallback description (`'an unrecognizable cron pattern'`) instead. Useful when rendering arbitrary user crontabs. |
|
|
163
|
-
| `
|
|
179
|
+
| `quartz` | `false` | Read the pattern with [Quartz](https://www.quartz-scheduler.org/) semantics. Quartz numbers the day-of-week **1 = Sunday … 7 = Saturday** (standard cron uses 0/7 = Sunday, 1 = Monday) and requires exactly one of day-of-month or day-of-week to be `?` ("no specific value"). With this off, `?` is rejected outright rather than silently mis-read — a `?` is the unambiguous mark of a Quartz pattern, so `'0 0 ? * 2'` would otherwise read as Tuesday when its author meant Monday. The Quartz numbering also applies inside the day-of-week operators (`6L`, `2#2`) and the weekday `L` alias. Day names (`MON`) and the other fields are unaffected. Composable with `seconds`/`years`. |
|
|
180
|
+
| `sentence` | `false` | Return a complete standalone sentence (`'Runs every day at midnight.'`, `'Läuft täglich um Mitternacht.'`) instead of the embeddable fragment. Each language supplies its own wrapping. Wraps a schedule and `@reboot`, but not the lenient `fallback`. The methods `cronli5.sentence(...)` / `cronli5.fragment(...)` (see [Usage](#usage)) are sugar for this option set to `true` / `false`. |
|
|
164
181
|
| `short` | `false` | Compact output: abbreviated month and weekday names, and hyphenated ranges everywhere `through`/`to` would appear (`Mon-Fri`, `Jan-Mar`, `1st-5th`, `9 a.m.-5:45 p.m.`). |
|
|
165
182
|
| `seconds` | `false` | Always treat the first field of strings and arrays as the `second` field. |
|
|
166
183
|
| `years` | `false` | Treat the last field of a six-field string/array as the `year` field. Otherwise the first field of a six-field pattern is treated as the `second` field. Seven-field patterns are unambiguous (seconds first, year last) and need no option. |
|
|
167
184
|
|
|
168
|
-
When a specific year is given
|
|
169
|
-
`year` property, or a six-field pattern with `years: true`
|
|
185
|
+
When a specific year is given — via a seven-field pattern, an object's
|
|
186
|
+
`year` property, or a six-field pattern with `years: true` — it is
|
|
170
187
|
folded into a specific calendar date (`'on January 1, 2030 at noon'`)
|
|
171
188
|
or otherwise trails the description (`'every Friday at 1 p.m. in 2030'`).
|
|
172
189
|
|
|
@@ -229,8 +246,8 @@ model-validated → verified by a fluent human). A new language is usually built
|
|
|
229
246
|
by **sibling-derivation** — deriving it from its nearest validated relative
|
|
230
247
|
(porting that renderer and translating its reviewed corpus, then TDD to green) —
|
|
231
248
|
and reaches **beta** once it passes the objective gates (round-trip, fuzz,
|
|
232
|
-
OR-scope, the cRonstrue comparison) and a blind
|
|
233
|
-
graduates to **stable** only on fluent
|
|
249
|
+
OR-scope, the cRonstrue comparison) and review by a blind panel of Claude
|
|
250
|
+
Sonnet instances. It graduates to **stable** only on review by a fluent human:
|
|
234
251
|
|
|
235
252
|
<!-- BEGIN GENERATED: language-status -->
|
|
236
253
|
| Language | Status |
|
|
@@ -300,19 +317,19 @@ it differs from `cronli5` in philosophy. `cronli5` writes one flowing sentence
|
|
|
300
317
|
and does additional validation; its languages are full renderers
|
|
301
318
|
([seven so far](#languages)). cRonstrue assembles per-field fragments from
|
|
302
319
|
translated templates, which is how it covers 39 locales. The same compound
|
|
303
|
-
pattern
|
|
320
|
+
pattern — `5,10 30 9 * * MON` — in every language:
|
|
304
321
|
|
|
305
322
|
<!-- BEGIN GENERATED: cronstrue-head-to-head -->
|
|
306
323
|
| Language | cronli5 | cRonstrue 3.14.0 |
|
|
307
324
|
| --- | --- | --- |
|
|
308
325
|
| English | at 5 and 10 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 |
|
|
309
|
-
| German | in den Sekunden 5 und 10
|
|
326
|
+
| German | montags in den Sekunden 5 und 10 der Minute 9:30 | Bei Sekunde 5 und 10, bei Minute 30, um 09:00, nur jeden Montag |
|
|
310
327
|
| 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 |
|
|
311
|
-
| Finnish | 5 ja 10 sekunnin kohdalla
|
|
328
|
+
| Finnish | 5 ja 10 sekunnin kohdalla minuutin 9.30 aikana, maanantaisin | 5 ja 10 sekunnnin jälkeen, 30 minuuttia yli, klo 09:00, vain maanantai |
|
|
312
329
|
| French | le lundi, aux secondes 5 et 10 de 9 h 30 | 5 et 10 secondes après la minute, 30 minutes après l'heure, 09:00, uniquement le lundi |
|
|
313
330
|
| Portuguese | às segundas-feiras, nos segundos 5 e 10 das 09:30 | Aos 5 e 10 segundos do minuto, aos 30 minutos da hora, Às 09:00, somente de segunda-feira |
|
|
314
|
-
| Chinese (Simplified) | 每周一,9点30
|
|
315
|
-
| Chinese (Traditional) | 每週一,9點30
|
|
331
|
+
| Chinese (Simplified) | 每周一,9点30分的第5、10秒 | 在一分钟后的第 5 和 10 秒, 在整点后的第 30 分钟, 在上午 09:00, 仅星期一 |
|
|
332
|
+
| Chinese (Traditional) | 每週一,9點30分的第5、10秒 | 在一分鐘後的 5 和 10 秒, 在整點後的 30 分, 在 09:00, 僅在 星期一 |
|
|
316
333
|
<!-- END GENERATED: cronstrue-head-to-head -->
|
|
317
334
|
|
|
318
335
|
See [docs/cronli5-vs-cronstrue.md](./docs/cronli5-vs-cronstrue.md) for
|
package/cronli5.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";(()=>{var Or={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},Nr={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12},k={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:Nr,top:12},weekday:{aliases:{"?":"*",L:"6"},cyclic:!0,max:7,min:0,numbers:Or,top:6},year:{max:9999,min:1970}},M=["second","minute","hour","date","month","weekday","year"],tn={"@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 * * * *"},A=6;function m(n,r){return(""+n).indexOf(r)!==-1}function Y(n){return Array.from(new Set(n))}function G(n){return/^\d+$/.test(n)}function d(n,r){return G(n)?+n:r[n.toUpperCase()]}function Tn(n){return M.forEach(function(e){zr(n[e],k[e],e)}),n}function zr(n,r,e){typeof n!="string"&&typeof n!="number"&&Mn(n,e);let t=""+n;t!=="*"&&(e==="date"&&U(t)||e==="weekday"&&q(t,r)||t.split(",").forEach(function(o){vr(o,r)||Mn(o,e)}))}function U(n){if(n==="L"||n==="LW"||n==="WL")return!0;let r=/^L-(\d{1,2})$/.exec(n);if(r)return+r[1]>=1&&+r[1]<=30;let e=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(e){let t=+(e[1]||e[2]);return t>=1&&t<=31}return!1}function q(n,r){if(/L$/.test(n))return L(n.slice(0,-1),r);let e=n.split("#");return e.length===2?L(e[0],r)&&/^[1-5]$/.test(e[1]):!1}function vr(n,r){return m(n,"/")?wr(n,r):m(n,"-")?Wn(n,r):L(n,r)}function wr(n,r){let e=n.split("/");return e.length!==2||!G(e[1])||+e[1]<1?!1:e[0]==="*"||L(e[0],r)||Wn(e[0],r,!0)}function Wn(n,r,e){let t=n.split("-");return t.length!==2||!L(t[0],r)||!L(t[1],r)?!1:r.cyclic&&!e?!0:d(t[0],r.numbers)<=d(t[1],r.numbers)}function L(n,r){return n==="*"?!1:G(n)?+n>=r.min&&+n<=r.max:r.numbers?n.toUpperCase()in r.numbers:!1}function Mn(n,r){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+r+" field.")}var Pr={hour:24,minute:60,second:60};function Ln(n){M.forEach(function(e){let t=k[e].aliases,i=t&&t[""+n[e]];i&&(n[e]=i)})}function En(n){return M.forEach(function(e){let t=""+n[e];if(e==="date"&&U(t)||e==="weekday"&&q(t,k[e])){n[e]=t;return}n[e]=Cr(t,e,k[e])}),n}function Cr(n,r,e){let t=""+n;if(t==="*")return t;let i=Pr[r],o=t.split(",").map(function(s){return xr(Dn(Wr(Hr(Lr(Tr(Mr(s,e),e),e),e),e,i),e),e)}).join(",").split(",");return o.indexOf("*")!==-1?"*":Y(o).sort(function(s,f){return Hn(s,e)-Hn(f,e)}).join(",")}function xr(n,r){if(!r.numbers)return n;let e=n.split("/"),t=e[0].split("-").map(function(o){return Fr(o,r)}).join("-");return e.length===2?t+"/"+e[1]:t}function Fr(n,r){if(n==="*")return n;let e=d(n,r.numbers);return""+(e>r.top?r.min:e)}function Mr(n,r){let e=n.split("/");if(!r.cyclic||e.length!==2||+e[1]!=1)return n;let t=e[0];return m(t,"-")?t:t==="*"||d(t,r.numbers)===r.min?"*":t+"-"+r.top}function Tr(n,r){let e=n.split("/");if(!r.cyclic||typeof r.top!="number"||e.length!==2||m(e[0],"-"))return n;let t=e[0];return(t==="*"?r.min:d(t,r.numbers))+ +e[1]<=r.top?n:t==="*"?""+r.min:t}function Wr(n,r,e){let t=n.split("/");if(typeof e!="number"||t.length!==2||m(t[0],"-"))return n;let i=+t[1],o=t[0]==="*"?r.min:d(t[0]);if(e%i===0&&o<i)return n;let u=[];for(let s=o;s<=r.top;s+=i)u.push(s);return u.join(",")}function Hr(n,r){let e=n.split("/");return e.length!==2||!m(e[0],"-")?n:Dn(e[0],r)==="*"?"*/"+e[1]:n}function Dn(n,r){if(typeof r.top!="number"||m(n,"/")||!m(n,"-"))return n;let e=n.split("-"),t=d(e[0],r.numbers),i=d(e[1],r.numbers);if(t>i)return n;let o=r.top,u={};for(let s=t;s<=i;s+=1)u[s>o?r.min:s]=!0;for(let s=r.min;s<=o;s+=1)if(!u[s])return n;return"*"}function Lr(n,r){let e=n.split("/")[0];if(!m(e,"-"))return n;let t=e.split("-");return d(t[0],r.numbers)!==d(t[1],r.numbers)?n:t[0]}function Hn(n,r){let e=n.split("/")[0].split("-")[0];return e==="*"?r.min:d(e,r.numbers)}function jn(n,r){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 Rn(n,r);if(typeof n=="object")return Er(n);if(typeof n=="string")return Dr(n,r);throw new Error("`cronli5` was passed an unexpected type.")}function Rn(n,r){if(n.length>7)throw new Error("`cronli5` was passed a cron pattern with more than seven fields.");return!r.seconds&&n.length<(r.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 Er(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 r=typeof n.second<"u",e=typeof n.minute<"u",t=r?"*":"0",i=r||e?"*":"0";return{second:T(n.second,"0"),minute:T(n.minute,t),hour:T(n.hour,i),date:T(n.date,"*"),month:T(n.month,"*"),weekday:T(n.weekday,"*"),year:T(n.year,"*")}}function T(n,r){return typeof n>"u"?r:n}function Dr(n,r){let e=jr(n).split(/\s+/);return Rn(e,r)}function jr(n){let r=n.trim();if(r.charAt(0)!=="@")return n;let e=r.toLowerCase();if(Object.hasOwn(tn,e))return tn[e];throw new Error("`cronli5` does not recognize the macro `"+r+"`.")}function An(n){return n===0?7:n}function Un(n){let r=n.flatMap(function(i){return i.kind==="step"?i.fires.map(function(u){return{kind:"single",value:""+u}}):[i]});function e(t){return t.kind==="range"?An(+t.bounds[0]):An(+t.value)}return r.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 on(n){if(n.length<5)return null;let r=n[1]-n[0];if(r<2)return null;for(let e=2;e<n.length;e+=1)if(n[e]-n[e-1]!==r)return null;return{start:n[0],interval:r,last:n[n.length-1]}}function c(n,r){return n.analyses.segments[r]??[]}function O(n,r){return c(n,r)[0]}function Z(n){let r=[];for(let e of n){if(e.kind!=="single")return null;r.push(+e.value)}return r}function un(n){return n.start<n.interval&&24%n.interval===0}function Rr(n,r,e){return e-1-(e-1-n)%r}function sn(n,r){let{start:e,interval:t,last:i,cycle:o}=n,u=o%t===0&&i===Rr(e,t,o);return e===0&&u?r.bare():e<t&&u?r.offset():r.bounded()}function qn(n){if(n.length<2)return null;let r=n[1]-n[0];if(r<2)return null;for(let e=2;e<n.length;e+=1)if(n[e]-n[e-1]!==r)return null;return n[0]!==0&&n.length<5?null:{interval:r,last:n[n.length-1],start:n[0]}}function Qn(n){return n!=="*"&&!m(n,",")&&!m(n,"-")&&!m(n,"/")}function an(n){return m(n,"-")&&!m(n,",")&&!m(n,"/")}function Ar(n){return m(n,"/")&&!m(n,",")}function cn(n){return n!=="*"&&!m(n,"-")&&!m(n,"/")}function mn(n){return n!=="*"&&!an(n)&&!Ar(n)}function E(n){return n.indexOf("/")!==-1&&n.indexOf("-")===-1&&n.indexOf(",")===-1}function Q(n,r,e){let t=[],i=n;for(;i<=e;)t.push(i),i+=r;return t}function Vn(n,r,e,t){let i=n.split("/"),o=+i[1];if(m(i[0],"-")){let s=i[0].split("-");return Q(d(s[0],t),o,d(s[1],t))}let u=i[0]==="*"?r:d(i[0],t);return Q(u,o,e)}function fn(n,r,e){let t=[];return n.split(",").forEach(function(o){if(m(o,"/"))t.push(...Vn(o,r,e));else if(m(o,"-")){let u=o.split("-");+u[0]<=+u[1]?t.push(...Q(+u[0],1,+u[1])):(t.push(...Q(+u[0],1,e)),t.push(...Q(r,1,+u[1])))}else t.push(+o)}),Y(t)}function Ur(n){return cn(n)?n.split(",").map(Number):[0]}function qr(n){if(n==="*")return[0,59];if(an(n)){let r=n.split("-");if(+r[0]<=+r[1])return[+r[0],+r[1]]}return null}function Qr(n){return n==="*"?59:Math.max(...fn(n,0,59))}function Vr(n){if(Qn(n)&&n!=="0")return+n}function Ir(n,r){return n==="*"?"wildcard":r==="date"&&U(n)||r==="weekday"&&q(n,k.weekday)?"quartz":m(n,",")?"list":m(n,"/")?"step":m(n,"-")?"range":"single"}function $r(n,r,e){return r==="wildcard"||r==="quartz"?null:n.split(",").map(function(i){if(m(i,"/")){let o=i.split("/");return{fires:Vn(i,e.min,e.top,e.numbers),interval:+o[1],kind:"step",startToken:o[0]}}return m(i,"-")?{bounds:i.split("-"),kind:"range"}:{kind:"single",value:i}})}function In(n){let r={},e={};M.forEach(function(u){r[u]=Ir(n[u],u),e[u]=$r(n[u],r[u],k[u])});let i={analyses:{clockSecond:Vr(n.second),lastMinuteFire:Qr(n.minute),minuteSpan:qr(n.minute),segments:e},pattern:n,shapes:r};return{...i,plan:Jr(i)}}function Jr(n){let{analyses:r,pattern:e,shapes:t}=n;if(e.second!=="0"){let i=Kr(e,t,r);if(i)return i}return $n(e,t,r)||Jn(e,t,r)}function Kr(n,r,e){let t=Yr(n,r);return t||(n.hour==="*"&&r.minute==="single"&&n.second!=="*"?{kind:"secondsWithinMinute",singleSecond:r.second==="single"}:r.second==="single"&&cn(n.minute)&&mn(n.hour)?null:{kind:"composeSeconds",rest:$n(n,r,e,!0)||Jn(n,r,e,!0)})}function Yr(n,r){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:r.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function $n(n,r,e,t=!1){if(r.minute==="step")return{hours:Zr(n,r,e),kind:"minuteFrequency"};if(r.hour==="single"&&e.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:e.minuteSpan};let i=Br(n,r);if(i)return i;let o=Gr(n,r);if(o)return o;if(n.hour==="*")return Xr(n,r,t)}function ln(n){let[r,e]=n.split("/"),t=r==="*"?0:+r;return r.indexOf("-")===-1&&24%+e===0&&t<+e}function Gr(n,r){return r.hour!=="step"?null:n.minute==="*"?ln(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:V(n.hour)}:r.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:r.minute==="list"&&ln(n.hour)?{form:"list",kind:"minuteSpanAcrossHourStep"}:null}function Zr(n,r,e){if(r.hour==="list")return{kind:"during",times:V(n.hour)};if(r.hour==="range"){let t=n.hour.split("-");return{from:+t[0],kind:"window",last:e.lastMinuteFire,to:+t[1]}}return r.hour==="single"?{from:+n.hour,kind:"window",last:e.lastMinuteFire,to:+n.hour}:r.hour==="step"?ln(n.hour)?{kind:"step"}:{kind:"during",times:V(n.hour)}:{kind:"none"}}function Br(n,r){return mn(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:V(n.hour)}:r.minute==="range"||r.minute==="list"&&m(n.minute,"-")&&!m(n.minute,"/")?{form:r.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:V(n.hour)}:null:null}function Xr(n,r,e){if(r.minute==="range")return{kind:"rangeOfMinutes"};if(r.minute==="list")return{kind:"multipleMinutes"};if(n.minute==="*")return{kind:"everyMinute"};if(n.minute!=="0"||e)return{kind:"singleMinute"}}function Jn(n,r,e,t=!1){let i=t&&n.minute==="0";return r.hour==="range"&&!i?_r(n,r,e):r.hour==="step"&&n.minute==="0"&&!t?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:ne(n,e,i)}function _r(n,r,e){let t=n.hour.split("-"),i="lead";return n.minute==="*"?i="wildcard":r.minute==="range"&&(i="range"),{boundMinute:r.minute==="range"||r.minute==="list"?null:e.lastMinuteFire,from:+t[0],kind:"hourRange",last:e.lastMinuteFire,minuteForm:i,to:+t[1]}}function ne(n,r,e=!1){let t=fn(n.hour,0,23),i=Ur(n.minute);if(!e&&t.length*i.length>A)return{fold:i.length===1,kind:"compactClockTimes",minute:i[0]};let o=[];return t.forEach(function(s){i.forEach(function(S){o.push({hour:s,minute:S,second:r.clockSecond})})}),{kind:"clockTimes",times:o}}function V(n){let r=fn(n,0,23);return r.length<=A?{fires:r,kind:"fires"}:{kind:"segments"}}function Kn(n,r){let e=jn(n,r);return Ln(e),Tn(e),En(e)}function w(n){return n=""+n,n.length<2?"0"+n:n}function Yn(n,r,e){return e.short?n:r[n]||n}function dn(n,{sep:r,pad:e,lean:t}){let i=e?w(n.hour):""+n.hour;return t&&!n.minute&&!n.second?i:i+r+w(n.minute)+(n.second?r+w(n.second):"")}var gn={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 ",untilWindow:!0},house:{am:"AM",closeUp:!1,dayFirst:!1,midday:"noon",midnight:"midnight",ordinals:!0,pm:"PM",sep:":",serialComma:!0,through:" - "}};function Gn(n){return typeof n=="object"&&n!==null?{...gn.us,untilWindow:!1,...n}:gn[n==="uk"?"gb":n]||gn.us}var re=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],hn=["th","st","nd","rd"],ee=[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"]],P=[["Sunday","Sun"],["Monday","Mon"],["Tuesday","Tue"],["Wednesday","Wed"],["Thursday","Thu"],["Friday","Fri"],["Saturday","Sat"]],te={SUN:P[0],MON:P[1],TUE:P[2],WED:P[3],THU:P[4],FRI:P[5],SAT:P[6]},ie=[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:Gn(n.dialect),years:!!n.years}}function ue(n,r){let e=me(n,r);if(e!==null)return Bn(e,n,r);let t=Qe(n,r)??Xn(n,n.plan,r),i=K(n,r)?nt(n,r):"";return Bn(i+t,n,r)}function Xn(n,r,e){let t=Ve[r.kind];return t(n,r,e)}function pn(n){return n==="step"||n==="range"||n==="list"}function se(n,r){if(!r.style.untilWindow||r.short||n.plan.kind!=="composeSeconds"||n.plan.rest.kind==="clockTimes"||K(n,r))return!1;let{shapes:e}=n;return pn(e.second)&&pn(e.minute)&&pn(e.hour)}function ae(n,r){let e=On(n);if(e)return B(e,r);if(n.shapes.hour==="range"){let t=c(n,"hour").find(function(o){return o.kind==="range"});return R({continuous:!1,from:+t.bounds[0],throughMinute:0,to:+t.bounds[1]},r)}return"during the "+j(n,{minute:0,second:null},!1,r)+" hours"}function ce(n,r){return n.shapes.minute==="step"?X(O(n,"minute"),"minute","hour",r):n.shapes.minute==="range"?$(n.pattern.minute,r):H(c(n,"minute"),"minute","hour",r)??z(F(c(n,"minute"),r),"minute","hour",r)}function me(n,r){if(!se(n,r))return null;let e=ae(n,r),t=ce(n,r),i=x(n,"minute",r),o=e+", "+t+", and within each of those minutes, "+i,u=a(n,r).trim();return u?u+", "+o:o}function le(n,r,e){return"every second"+a(n,e)}function fe(n,r,e){return D(n,e)+a(n,e)}function de(n,r,e){let t=n.pattern.second;return g(t,e)+" "+v(t,"second")+" past the minute, every minute"+a(n,e)}function ge(n,r,e){let t=n.pattern.minute,i=g(t,e),o=v(t,"minute");if(r.singleSecond){let u=n.pattern.second;return i+" "+o+" and "+g(u,e)+" "+v(u,"second")+" past the hour, every hour"+a(n,e)}return D(n,e)+", "+i+" "+o+" past the hour, every hour"+a(n,e)}function he(n,r,e){if(!(r.rest.kind==="clockTimes"||r.rest.kind==="compactClockTimes")||n.shapes.minute!=="single")return null;let i=+n.pattern.minute;return zn(n,i,e)??vn(n,i,e)}function pe(n,r,e){return+r.times[0].minute==0&&n.shapes.minute==="single"?D(n,e)+" for one minute at "+be(n,r,e):D(n,e)+" of "+Se(n,r,e)}function ye(n,r,e){let t=he(n,r,e);return t!==null?t:r.rest.kind==="clockTimes"&&(n.shapes.second==="wildcard"||n.shapes.second==="step")?pe(n,r.rest,e):n.shapes.second==="wildcard"&&r.rest.kind==="minuteFrequency"&&r.rest.hours.kind==="none"&&n.pattern.minute==="*/2"?"every second of every other minute"+a(n,e):(r.rest.kind==="compactClockTimes"&&n.analyses.clockSecond?"":D(n,e)+", ")+Xn(n,r.rest,e)}function be(n,r,e){let t=r.times.map(function(u){return l({hour:u.hour,minute:0},e)}),i=_(n,Cn,e);return p(t,e)+(i&&", "+i)}function Se(n,r,e){let t=r.times.map(function(u){return l({hour:u.hour,minute:u.minute,second:u.second,explicit:!0},e)}),i=_(n,Cn,e);return p(t,e)+(i&&", "+i)}function D(n,r){return x(n,"minute",r)}function x(n,r,e){let t=n.pattern.second,i=n.shapes.second;if(t==="*")return"every second";if(i==="step")return X(O(n,"second"),"second",r,e);if(i==="range"){let o=t.split("-"),u=wn();return"every second from "+u(o[0])+h(e)+u(o[1])+" past the "+r}return i==="single"?"at "+g(t,e)+" "+v(t,"second")+" past the "+r:H(c(n,"second"),"second",r,e)??z(F(c(n,"second"),e),"second",r,e)}function ke(n,r,e){return"every minute"+a(n,e)}function Oe(n,r,e){let t=n.pattern.minute;return g(t,e)+" "+v(t,"minute")+" past the hour, every hour"+a(n,e)}function Ne(n,r,e){return $(n.pattern.minute,e)+a(n,e)}function ze(n,r,e){return(H(c(n,"minute"),"minute","hour",e)??z(F(c(n,"minute"),e),"minute","hour",e))+a(n,e)}function ve(n,r,e){let t=X(O(n,"minute"),"minute","hour",e);if(r.hours.kind==="during"){let i=J(n,e);t+=i?", "+i:" during the "+I(n,r.hours.times,!1,e)+" hours"}else r.hours.kind==="window"?t+=" "+R({continuous:!1,from:r.hours.from,throughMinute:r.hours.last,to:r.hours.to},e):r.hours.kind==="step"&&(t+=" "+kn(O(n,"hour"),e));return t+a(n,e)}function we(n,r,e){return n.pattern.minute==="*"?"every minute of the "+l({hour:r.hour,minute:0},e)+" hour"+a(n,e):"every minute from "+l({hour:r.hour,minute:r.span[0]},e)+h(e)+l({hour:r.hour,minute:r.span[1]},e)+a(n,e)}function Pe(n,r,e){let t=J(n,e);if(r.form==="wildcard")return t!==null?"every minute, "+t+a(n,e):"every minute during the "+I(n,r.times,!1,e)+" hours"+a(n,e);if(r.form==="range"){let u=$(n.pattern.minute,e);return t!==null?u+", "+t+a(n,e):Ye(r.times)?u+", at "+I(n,r.times,!0,e)+a(n,e):u+" during the "+I(n,r.times,!1,e)+" hours"+a(n,e)}let i=H(c(n,"minute"),"minute","hour",e)??z(F(c(n,"minute"),e),"minute","hour",e);if(t!==null)return i+", "+t+a(n,e);let o=I(n,r.times,!0,e);return i+", at "+o+a(n,e)}var _n={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function kn(n,r){let e="during every "+_n[n.interval]+" hour",t=n.startToken==="*"?0:+n.startToken;return t===0?e:e+" starting at "+l({hour:t,minute:0},r)}function Ce(n,r,e){let t=O(n,"hour");if(r.form==="wildcard")return"every minute "+kn(t,e)+a(n,e);let i=r.form==="list"?H(c(n,"minute"),"minute","hour",e)??z(F(c(n,"minute"),e),"minute","hour",e):$(n.pattern.minute,e),o=J(n,e);return i+", "+(o??or(t,e))+a(n,e)}function $(n,r){let e=n.split("-"),t=wn();return"every minute from "+t(e[0])+h(r)+t(e[1])+" past the hour"}function xe(n,r,e){return"every hour"+a(n,e)}function Fe(n,r,e){let t=We(Te(r),e);return r.minuteForm==="wildcard"?"every minute "+t+a(n,e):r.minuteForm==="range"?$(n.pattern.minute,e)+", "+t+a(n,e):nr(n,e)+" "+t+a(n,e)}function nr(n,r){return n.pattern.minute==="0"?"every hour":H(c(n,"minute"),"minute","hour",r)??z(F(c(n,"minute"),r),"minute","hour",r)}function Me(n,r,e){let t=J(n,e);return t!==null?t+a(n,e):or(O(n,"hour"),e)+a(n,e)}function Te(n){let r=n.minuteForm==="wildcard",e=r?n.boundMinute??0:0;return{from:n.from,closeMinute:e,to:n.to,continuous:r}}function R(n,r){let{from:e,to:t,throughMinute:i,continuous:o}=n,u="from "+l({hour:e,minute:0},r);return r.style.untilWindow&&!r.short&&e!==t?o?u+" until "+l({hour:(t+1)%24,minute:0},r):u+h(r)+l({hour:t,minute:0},r):u+h(r)+l({hour:t,minute:i},r)}function We(n,r){return R({continuous:n.continuous,from:n.from,throughMinute:n.closeMinute,to:n.to},r)}function He(n,r,e){if(n.shapes.minute==="single"){let o=+n.pattern.minute,u=zn(n,o,e)??vn(n,o,e);if(u!==null)return u}let t=Pn(r.times),i=r.times.map(function(u){return l({hour:u.hour,minute:u.minute,second:u.second,plain:t},e)});return cr(n,e)+"at "+p(i,e)+rr(n,e)}function rr(n,r){return K(n,r)?lr(n,r):""}function Le(n,r,e){if(r.fold){let u=zn(n,+r.minute,e)??vn(n,+r.minute,e);if(u!==null)return u;if(c(n,"hour").some(function(y){return y.kind==="range"})&&!n.analyses.clockSecond)return Ee(n,r,e)+a(n,e);let f={minute:r.minute,second:n.analyses.clockSecond};return cr(n,e)+"at "+j(n,f,!0,e)+rr(n,e)}let t=H(c(n,"minute"),"minute","hour",e)??z(F(c(n,"minute"),e),"minute","hour",e),i=J(n,e),o=i?t+", "+i+a(n,e):t+", at "+j(n,{minute:0,second:null},!0,e)+a(n,e);return n.analyses.clockSecond?D(n,e)+", "+o:o}function Ee(n,r,e){let t=r.minute,i=[],o=er(n).map(function(f){return l({hour:f,minute:t},e)});return c(n,"hour").forEach(function(f){f.kind==="range"&&i.push(R({continuous:!1,from:+f.bounds[0],throughMinute:t,to:+f.bounds[1]},e))}),nr(n,e)+" "+p(i,e)+tr(o,e)}function er(n){let r=[];return c(n,"hour").forEach(function(t){t.kind==="step"?r.push(...t.fires):t.kind!=="range"&&r.push(+t.value)}),r}function tr(n,r){return n.length?" and at "+p(n,r):""}function W(n){return n==="*"||n.startsWith("*/")&&n.indexOf("-")===-1}function De(n,r){let{second:e,minute:t}=n.pattern;return W(e)?{secondLead:!0,text:x(n,"minute",r)}:e==="0"&&W(t)?{secondLead:!1,text:t==="*"?"every minute":X(O(n,"minute"),"minute","hour",r)}:null}function je(n,r){let e=n.pattern.minute;if(e==="*")return"";if(W(e))return" of every other minute";let t=c(n,"minute");if(n.shapes.minute==="single")return" during minute :"+w(e);if(n.shapes.minute==="range"){let o=e.split("-");return" during minutes :"+w(o[0])+h(r)+":"+w(o[1])}let i=F(t,r).map(function(u){return":"+w(u)});return" during minutes "+p(i,r)}function Re(n,r){let e=n.pattern.hour;if(e==="*")return n.pattern.minute!=="*"&&!W(n.pattern.minute)?" of every hour":"";if(W(e))return e==="*/2"?" of every other hour":"";if(n.shapes.hour==="single"){let t=+e;return n.shapes.minute==="step"?" from "+l({hour:t,minute:0},r)+" until "+l({hour:(t+1)%24,minute:0},r):n.pattern.minute!=="*"&&!W(n.pattern.minute)?" at "+l({hour:t,minute:0},r):" of the "+l({hour:t,minute:0},r)+" hour"}if(n.shapes.hour==="range"){let t=e.split("-");return" "+R({continuous:n.pattern.minute==="*",from:+t[0],throughMinute:0,to:+t[1]},r)}return" during the "+j(n,{minute:0,second:null},!1,r)+" hours"}function Ae(n){if(n.shapes.hour!=="step")return!0;let r=O(n,"hour");return n.pattern.hour==="*/2"||r.startToken.indexOf("-")!==-1}function Ue(n){if(n.shapes.minute!=="list")return!1;let r=Z(c(n,"minute"));return r!==null&&on(r)!==null}function qe(n,r){let{minute:e,hour:t}=n.pattern,i=W(e)&&e!=="*";return Ae(n)?r.secondLead?i?e==="*/2"&&n.shapes.hour!=="range":!(Ue(n)||n.shapes.minute==="list"&&n.shapes.hour==="list"):t==="*/2"?!0:n.shapes.hour==="single"&&e==="*/2":!1}function Qe(n,r){if(!r.style.untilWindow||r.short||n.pattern.minute==="*"&&n.pattern.hour==="*")return null;let e=De(n,r);if(!e||!qe(n,e))return null;let t=e.secondLead?je(n,r):"";return e.text+t+Re(n,r)+a(n,r)}var Ve={clockTimes:He,compactClockTimes:Le,composeSeconds:ye,everyHour:xe,everyMinute:ke,everySecond:le,hourRange:Fe,hourStep:Me,minuteFrequency:ve,minuteSpanAcrossHourStep:Ce,minuteSpanInHour:we,minutesAcrossHours:Pe,multipleMinutes:ze,rangeOfMinutes:Ne,secondPastMinute:de,secondsWithinMinute:ge,singleMinute:Oe,standaloneSeconds:fe};function ir(n,r){let{interval:e,start:t,last:i,cycle:o,unit:u,anchor:s}=n,f="every "+g(e,r)+" "+u+"s";return sn({start:t,interval:e,last:i,cycle:o},{bare:()=>f,offset:()=>f+" from "+g(t,r)+" "+v(t,u)+" past the "+s,bounded:()=>{let S=wn();return f+" from "+S(t)+h(r)+S(i)+" "+v(i,u)+" past the "+s}})}function H(n,r,e,t){let i=Z(n),o=i&&on(i);return o?ir({...o,cycle:60,unit:r,anchor:e},t):null}function X(n,r,e,t){if(n.startToken.indexOf("-")!==-1)return z(Zn(n.fires,t),r,e,t);let i=n.startToken==="*"?0:+n.startToken;return i!==0&&n.fires.length<=3?z(Zn(n.fires,t),r,e,t):ir({interval:n.interval,start:i,last:n.fires[n.fires.length-1],cycle:60,unit:r,anchor:e},t)}function or(n,r){if(n.startToken.indexOf("-")!==-1)return"at "+yn(n.fires,r);let e=n.startToken==="*"?0:+n.startToken,t=n.interval;return e===0?"every "+g(t,r)+" hours":n.fires.length<=3?"at "+yn(n.fires,r):"every "+g(t,r)+" hours from "+l({hour:e,minute:0},r)}function B(n,r){let{start:e,interval:t,last:i}=n,o="every "+g(t,r)+" hours";return sn({start:e,interval:t,last:i,cycle:24},{bare:()=>o,offset:()=>o+" from "+l({hour:e,minute:0},r),bounded:()=>o+" from "+l({hour:e,minute:0},r)+h(r)+l({hour:i,minute:0},r)})}function J(n,r){let e=On(n);return!e||un(e)?null:B(e,r)}function On(n){let r=c(n,"hour");if(r.length===1&&r[0].kind==="step"){let t=r[0];if(t.fires.length<2)return null;let i=t.startToken==="*"?0:+t.startToken.split("-")[0];return{interval:t.interval,last:t.fires[t.fires.length-1],start:i}}let e=Z(r);return e&&qn(e)}function Nn(n){return n.pattern.second==="*"||n.shapes.second==="step"}function ur(n,r,e){if(r===0)return Nn(n)?x(n,"minute",e)+" for one minute":x(n,"hour",e);let t=g(r,e)+" "+v(r,"minute")+" past the hour";return n.pattern.second==="0"?t:x(n,"minute",e)+", "+t}function zn(n,r,e){let t=On(n);if(!t)return null;let i=(t.last-t.start)/t.interval+1;if(n.pattern.second==="0"&&i<=A&&un(t))return null;let o=r===0&&Nn(n)&&Ie(n);return o?x(n,"minute",e)+" for one minute "+kn(o,e)+a(n,e):r===0&&n.pattern.second==="0"?B(t,e)+a(n,e):ur(n,r,e)+", "+B(t,e)+a(n,e)}function Ie(n){let r=c(n,"hour"),e=r.length===1&&r[0];return!e||e.kind!=="step"||e.startToken.indexOf("-")!==-1||!(e.interval in _n)?null:e}function $e(n){return c(n,"hour").some(function(e){return e.kind==="range"})}function Je(n,r){let e=[],t=er(n);c(n,"hour").forEach(function(s){s.kind==="range"&&e.push(R({continuous:!1,from:+s.bounds[0],throughMinute:0,to:+s.bounds[1]},r))});let i="every hour "+p(e,r),o=t.map(function(s){return l({hour:s,minute:0},r)});return i+tr(o,r)}function vn(n,r,e){return r!==0||!$e(n)||n.pattern.second==="0"?null:Nn(n)?x(n,"minute",e)+" for one minute during the "+j(n,{minute:0,second:null},!1,e)+" hours"+a(n,e):ur(n,r,e)+", "+Je(n,e)+a(n,e)}function wn(){return function(r){return""+r}}function sr(n,r){return n>1?function(t){return""+t}:function(t){return g(t,r)}}function Zn(n,r){return n.map(sr(n.length,r))}function F(n,r){let e=n.reduce(function(o,u){return u.kind==="range"?o+1:o+(u.kind==="step"?u.fires.length:1)},0),t=sr(e,r);return n.flatMap(function(o){return o.kind==="range"?[t(o.bounds[0])+h(r)+t(o.bounds[1])]:o.kind==="step"?o.fires.map(t):[t(o.value)]})}function z(n,r,e,t){return"at "+p(n,t)+" "+r+"s past the "+e}function Ke(n,r,e){return(+n==0||+n==12)&&+r==0&&!(typeof e=="number"&&e>0)}function Pn(n){let r=n.filter(function(t){return Ke(t.hour,t.minute,t.second)});return r.length>0&&r.length<n.length}function yn(n,r){let e=Pn(n.map(function(o){return{hour:o,minute:0}})),t=n.map(function(o){return l({hour:o,minute:0,plain:e},r)});return p(t,r)}function Ye(n){return n.kind==="fires"&&n.fires.length===1}function I(n,r,e,t){return r.kind==="fires"?yn(r.fires,t):j(n,{minute:0,second:null},e,t)}function Ge(n){return n.kind==="range"?n.bounds:n.kind==="step"?n.fires:[n.value]}function j(n,r,e,t){let{minute:i,second:o}=r,u=c(n,"hour"),s=Pn(u.flatMap(function(y){return Ge(y).map(function(en){return{hour:+en,minute:i,second:o}})})),f=[];return u.forEach(function(y){y.kind==="step"?f.push(...y.fires.map(function(en){return l({hour:en,minute:i,second:o,plain:s},t)})):y.kind==="range"?f.push(l({hour:y.bounds[0],minute:i,second:o,plain:s},t)+h(t)+l({hour:y.bounds[1],minute:i,second:o,plain:s},t)):f.push(l({hour:y.value,minute:i,second:o,plain:s},t))}),p(Ze(f,u,e),t)}function Ze(n,r,e){let t=r.some(function(o){return o.kind==="range"});return!e||!t?n:n.map(function(o,u){return u===0?o:"at "+o})}function ar(n,r,e){if(n.length<=1)return n.join("");if(n.length===2)return n[0]+r+n[1];let t=e.style.serialComma?","+r:r;return n.slice(0,-1).join(", ")+t+n[n.length-1]}function p(n,r){return ar(n," and ",r)}function Be(n,r){return ar(n," or ",r)}var Xe={all:"",month:"in ",recurringWeekday:!0,stepDate:"on ",weekday:"on "},Cn={all:"every day",month:"every day in ",recurringWeekday:!1,stepDate:"",weekday:"every "};function a(n,r){if(K(n,r))return lr(n,r);let e=_(n,Xe,r);return e&&" "+e}function cr(n,r){return K(n,r)?"":_(n,Cn,r)+" "}function _(n,r,e){let t=n.pattern;if(t.date!=="*"&&t.weekday!=="*")return it(n,e);if(t.date!=="*")return _e(n,r,e);if(t.weekday!=="*"){let i=xn(t.weekday,e);return i?bn(i,n,e):r.weekday+pr(n,r.recurringWeekday,e)+dr(n,e)}return t.month!=="*"?r.month+N(n,e):r.all}function _e(n,r,e){let t=n.pattern,i=nn(t.date,e);return i?bn(i,n,e):E(t.date)?bn(r.stepDate+gr(t.date),n,e):t.month!=="*"&&!mr(n)?"on the "+Sn(n,e)+dr(n,e):t.month!=="*"?"on "+fr(n,e):"on the "+Sn(n,e)}function mr(n){return!hr(n.pattern.month)&&c(n,"month").every(function(e){return e.kind!=="range"})}function K(n,r){return n.pattern.date!=="*"&&n.pattern.weekday!=="*"&&!!r.style.untilWindow&&!r.short}function lr(n,r){let e=[...rt(n,r),...et(n,r)];return" whenever the day is "+Be(e,r)}function nt(n,r){return n.pattern.month==="*"?"":"in "+N(n,r)+" "}function rt(n,r){let e=n.pattern.date,t=nn(e,r);if(t)return[t.replace(/^on /,"")];let i=tt(e);if(i)return[i];let o=[];return c(n,"date").forEach(function(s){s.kind==="range"?o.push("from the "+b(s.bounds[0])+h(r)+"the "+b(s.bounds[1])):s.kind==="step"?s.fires.forEach(function(S){o.push("the "+b(S))}):o.push("the "+b(s.value))}),o}function et(n,r){let e=n.pattern.weekday,t=xn(e,r);if(t)return[t.replace(/^on /,"")];let i=[];return c(n,"weekday").forEach(function(u){u.kind==="range"&&u.bounds[0]==="1"&&u.bounds[1]==="5"?i.push("a weekday"):u.kind==="range"?i.push("a "+C(u.bounds[0],r)+h(r)+"a "+C(u.bounds[1],r)):u.kind==="step"?u.fires.forEach(function(f){i.push("a "+C(f,r))}):i.push("a "+C(u.value,r))}),i}function tt(n){if(!E(n))return null;let[r,e]=n.split("/");return+e!=2?null:r==="*"||r==="1"?"an odd-numbered day":r==="2"?"an even-numbered day":null}function it(n,r){let e=n.pattern,t=xn(e.weekday,r)||"on "+pr(n,!1,r);return e.month!=="*"&&mr(n)&&!nn(e.date,r)&&!E(e.date)?"on "+fr(n,r)+" or "+t+" in "+N(n,r):ot(n,r)+" or "+t+ut(n,r)}function ot(n,r){let e=n.pattern,t=nn(e.date,r);return t||(E(e.date)?gr(e.date):"on the "+Sn(n,r))}function ut(n,r){return n.pattern.month==="*"?"":", in "+N(n,r)}function nn(n,r){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 g(+e[1],r)+" "+v(e[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 "+b(t[1]||t[2])}function xn(n,r){let e=n.split("#");if(e.length===2)return"on the "+ie[+e[1]]+" "+C(e[0],r)+" of the month";if(/L$/.test(n))return"on the last "+C(n.slice(0,-1),r)+" of the month"}function fr(n,r){let e=N(n,r),t=rn(c(n,"date"),r.style.ordinals?b:st,r);return r.style.dayFirst&&n.shapes.date==="single"&&n.shapes.month!=="single"?"the "+b(n.pattern.date)+" of "+e:r.style.dayFirst?t+" "+e:e+" "+t}function st(n){return""+n}function dr(n,r){return n.pattern.month==="*"?"":" in "+N(n,r)}function bn(n,r,e){if(r.pattern.month==="*")return n;let t=n.indexOf(" of the month")!==-1;return t&&r.shapes.month==="range"?n.replace(" of the month"," of each month")+" from "+N(r,e):t&&(r.shapes.month==="single"||r.shapes.month==="step")?n.replace(" of the month","")+" in "+N(r,e):n+" in "+N(r,e)}function gr(n){let r=n.split("/"),e=+r[1],t=r[0],o=(e===2?"every other":"every "+b(e))+" day of the month";return t!=="*"&&t!=="1"&&(o+=" from the "+b(t)),o}function Sn(n,r){return rn(c(n,"date"),b,r)}function N(n,r){let e=hr(n.pattern.month);return e||rn(c(n,"month"),function(i){return ft(i,r)},r)}function hr(n){if(!E(n))return null;let[r,e]=n.split("/");return+e!=2?null:r==="*"||r==="1"?"every odd-numbered month":r==="2"?"every even-numbered month":null}function pr(n,r,e){let t=Un(c(n,"weekday")),i=t.some(function(s){return s.kind==="range"});return rn(t,r&&!i?function(s){return at(s,e)}:function(s){return C(s,e)},e)}function at(n,r){let e=C(n,r);return r.short?e:e+"s"}function rn(n,r,e){let t=[];return n.forEach(function(o){o.kind==="step"?t.push(...o.fires.map(r)):o.kind==="range"?t.push(o.bounds.map(r).join(h(e))):t.push(r(o.value))}),p(t,e)}function Bn(n,r,e){let t=r.pattern.year;if(t==="*")return n;if(t.indexOf("/")!==-1)return n+", "+mt(t,e);let i=ct(t,e);if(t.indexOf("-")===-1&&t.indexOf(",")===-1&&r.pattern.date!=="*"&&n.indexOf(" at ")!==-1){let o=e.style.dayFirst?" ":", ";return n.replace(" at ",o+i+" at ")}return n+" in "+i}function ct(n,r){return n.indexOf(",")!==-1?p(n.split(","),r):n.indexOf("-")!==-1?n.split("-").join(h(r)):n}function mt(n,r){let e=n.split("/"),t=+e[1],i=e[0];if(t<=1)return"every year";let o=t===2?"every other year":"every "+g(t,r)+" years";return i!=="*"&&i!=="0"&&(o+=" from "+i),o}function l(n,r){let{hour:e,minute:t,plain:i,explicit:o}=n,u=typeof n.second=="number"&&n.second>0?n.second:0;return r.ampm?lt({hour:e,minute:t,second:u,plain:i,explicit:o},r):dn({hour:e,minute:t,second:u},{pad:!0,sep:r.style.sep})}function lt(n,r){let{hour:e,minute:t,second:i,plain:o,explicit:u}=n,s=r.style;if(!o&&!u&&+t==0&&!i){if(+e==0)return s.midnight;if(+e==12)return s.midday}return dn({hour:e%12||12,minute:t,second:i},{lean:!u,sep:s.sep})+(s.closeUp?"":" ")+(e<12?s.am:s.pm)}function g(n,r){return Yn(n,re,r)}function v(n,r){return+n==1?r:r+"s"}function h(n){return n.short?"-":n.style.through}function b(n){let r=Math.abs(n),e=hn[r];return e||(r=(r%100-20)%10,e=hn[r]||hn[0]),n+e}function ft(n,r){let e=ee[+n];return e&&e[r.short?1:0]}function C(n,r){let e=n===7||n==="7"?0:n,t=P[e]||te[e];return t&&t[r.short?1:0]}var dt={describe:ue,fallback:"an unrecognizable cron pattern",options:oe,reboot:"at system startup",sentence:n=>"Runs "+n+(n.endsWith(".")?"":".")},yr=dt;/**
|
|
1
|
+
"use strict";(()=>{var vr={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},Cr={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12},k={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:{cyclic:!0,max:31,min:1,top:31},month:{cyclic:!0,max:12,min:1,numbers:Cr,top:12},weekday:{aliases:{L:"6"},cyclic:!0,max:7,min:0,numbers:vr,top:6},year:{max:9999,min:1970}},F=["second","minute","hour","date","month","weekday","year"],tn={"@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 f(n,r){return(""+n).indexOf(r)!==-1}function G(n){return Array.from(new Set(n))}function L(n){return/^\d+$/.test(n)}function d(n,r){return L(n)?+n:r[n.toUpperCase()]}function Hn(n){return F.forEach(function(e){xr(n[e],k[e],e)}),n}function xr(n,r,e){typeof n!="string"&&typeof n!="number"&&Wn(n,e);let t=""+n;t!=="*"&&(e==="date"&&q(t)||e==="weekday"&&Q(t,r)||t.split(",").forEach(function(o){Pr(o,r)||Wn(o,e)}))}function q(n){if(n==="L"||n==="LW"||n==="WL")return!0;let r=/^L-(\d{1,2})$/.exec(n);if(r)return+r[1]>=1&&+r[1]<=30;let e=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(e){let t=+(e[1]||e[2]);return t>=1&&t<=31}return!1}function Q(n,r){if(/L$/.test(n))return E(n.slice(0,-1),r);let e=n.split("#");return e.length===2?E(e[0],r)&&/^[1-5]$/.test(e[1]):!1}function Pr(n,r){return f(n,"/")?Mr(n,r):f(n,"-")?Ln(n,r):E(n,r)}function Mr(n,r){let e=n.split("/");return e.length!==2||!L(e[1])||+e[1]<1?!1:e[0]==="*"||E(e[0],r)||Ln(e[0],r,!0)}function Ln(n,r,e){let t=n.split("-");return t.length!==2||!E(t[0],r)||!E(t[1],r)?!1:r.cyclic&&!e?!0:d(t[0],r.numbers)<=d(t[1],r.numbers)}function E(n,r){return n==="*"?!1:L(n)?+n>=r.min&&+n<=r.max:r.numbers?n.toUpperCase()in r.numbers:!1}function Wn(n,r){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+r+" field.")}var Fr={hour:24,minute:60,second:60};function jn(n){F.forEach(function(e){let t=k[e].aliases,i=t&&t[""+n[e]];i&&(n[e]=i)})}function Dn(n){return F.forEach(function(e){let t=""+n[e];if(e==="date"&&q(t)||e==="weekday"&&Q(t,k[e])){n[e]=t;return}n[e]=Tr(t,e,k[e])}),n}function Tr(n,r,e){let t=""+n;if(t==="*")return t;let i=Fr[r],o=t.split(",").map(function(s){return Wr(Rn(jr(Dr(Rr(Er(Lr(s,e),e),e),e),e,i),e),e)}).join(",").split(",");return o.indexOf("*")!==-1?"*":G(o).sort(function(s,m){return En(s,e)-En(m,e)}).join(",")}function Wr(n,r){if(!r.numbers)return n;let e=n.split("/"),t=e[0].split("-").map(function(o){return Hr(o,r)}).join("-");return e.length===2?t+"/"+e[1]:t}function Hr(n,r){if(n==="*")return n;let e=d(n,r.numbers);return""+(e>r.top?r.min:e)}function Lr(n,r){let e=n.split("/");if(!r.cyclic||e.length!==2||+e[1]!=1)return n;let t=e[0];return f(t,"-")?t:t==="*"||d(t,r.numbers)===r.min?"*":t+"-"+r.top}function Er(n,r){let e=n.split("/");if(!r.cyclic||typeof r.top!="number"||e.length!==2||f(e[0],"-"))return n;let t=e[0];return(t==="*"?r.min:d(t,r.numbers))+ +e[1]<=r.top?n:t==="*"?""+r.min:t}function jr(n,r,e){let t=n.split("/");if(typeof e!="number"||t.length!==2||f(t[0],"-"))return n;let i=+t[1],o=t[0]==="*"?r.min:d(t[0]);if(e%i===0&&o<i)return n;let u=[];for(let s=o;s<=r.top;s+=i)u.push(s);return u.join(",")}function Dr(n,r){let e=n.split("/");return e.length!==2||!f(e[0],"-")?n:Rn(e[0],r)==="*"?"*/"+e[1]:n}function Rn(n,r){if(typeof r.top!="number"||f(n,"/")||!f(n,"-"))return n;let e=n.split("-"),t=d(e[0],r.numbers),i=d(e[1],r.numbers);if(t>i)return n;let o=r.top,u={};for(let s=t;s<=i;s+=1)u[s>o?r.min:s]=!0;for(let s=r.min;s<=o;s+=1)if(!u[s])return n;return"*"}function Rr(n,r){let e=n.split("/")[0];if(!f(e,"-"))return n;let t=e.split("-");return d(t[0],r.numbers)!==d(t[1],r.numbers)?n:t[0]}function En(n,r){let e=n.split("/")[0].split("-")[0];return e==="*"?r.min:d(e,r.numbers)}var Ar="`?` is a Quartz token \u2014 pass { quartz: true } to enable Quartz semantics.";function Un(n,r){if(!r){An(n.date),An(n.weekday);return}if(""+n.date=="?"&&(n.date="*"),""+n.weekday=="?"){n.weekday="*";return}n.weekday=Ur(""+n.weekday)}function An(n){if(""+n=="?")throw new Error(Ar)}function Ur(n){return n==="*"?n:n.split(",").map(qr).join(",")}function qr(n){let r=/(#\d+|L)$/.exec(n),e=r?r[0]:"",i=(e?n.slice(0,-e.length):n).split("/"),o=i[0].split("-").map(Qr).join("-");return(i.length===2?o+"/"+i[1]:o)+e}function Qr(n){if(!L(n))return n;if(n==="0")throw new Error('`cronli5` was passed an invalid Quartz day-of-week value "0"; Quartz numbers weekdays 1 (Sunday) through 7 (Saturday).');return""+(+n-1)}function qn(n,r){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 Qn(n,r);if(typeof n=="object")return Vr(n);if(typeof n=="string")return Ir(n,r);throw new Error("`cronli5` was passed an unexpected type.")}function Qn(n,r){if(n.length>7)throw new Error("`cronli5` was passed a cron pattern with more than seven fields.");return!r.seconds&&n.length<(r.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 Vr(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 r=typeof n.second<"u",e=typeof n.minute<"u",t=r?"*":"0",i=r||e?"*":"0";return{second:T(n.second,"0"),minute:T(n.minute,t),hour:T(n.hour,i),date:T(n.date,"*"),month:T(n.month,"*"),weekday:T(n.weekday,"*"),year:T(n.year,"*")}}function T(n,r){return typeof n>"u"?r:n}function Ir(n,r){let e=$r(n).split(/\s+/);return Qn(e,r)}function $r(n){let r=n.trim();if(r.charAt(0)!=="@")return n;let e=r.toLowerCase();if(Object.hasOwn(tn,e))return tn[e];throw new Error("`cronli5` does not recognize the macro `"+r+"`.")}function Vn(n){return n===0?7:n}function In(n){let r=n.flatMap(function(i){return i.kind==="step"?i.fires.map(function(u){return{kind:"single",value:""+u}}):[i]});function e(t){return t.kind==="range"?Vn(+t.bounds[0]):Vn(+t.value)}return r.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 on(n){if(n.length<5)return null;let r=n[1]-n[0];if(r<2)return null;for(let e=2;e<n.length;e+=1)if(n[e]-n[e-1]!==r)return null;return{start:n[0],interval:r,last:n[n.length-1]}}function c(n,r){return n.analyses.segments[r]??[]}function O(n,r){return c(n,r)[0]}function Z(n){let r=[];for(let e of n){if(e.kind!=="single")return null;r.push(+e.value)}return r}function un(n){return n.start<n.interval&&24%n.interval===0}function Jr(n,r,e){return e-1-(e-1-n)%r}function sn(n,r){let{start:e,interval:t,last:i,cycle:o}=n,u=o%t===0&&i===Jr(e,t,o);return e===0&&u?r.bare():e<t&&u?r.offset():r.bounded()}function $n(n){if(n.length<2)return null;let r=n[1]-n[0];if(r<2)return null;for(let e=2;e<n.length;e+=1)if(n[e]-n[e-1]!==r)return null;return n[0]!==0&&n.length<5?null:{interval:r,last:n[n.length-1],start:n[0]}}function Jn(n){return n!=="*"&&!f(n,",")&&!f(n,"-")&&!f(n,"/")}function an(n){return f(n,"-")&&!f(n,",")&&!f(n,"/")}function Kr(n){return f(n,"/")&&!f(n,",")}function cn(n){return n!=="*"&&!f(n,"-")&&!f(n,"/")}function fn(n){return n!=="*"&&!an(n)&&!Kr(n)}function j(n){return n.indexOf("/")!==-1&&n.indexOf("-")===-1&&n.indexOf(",")===-1}function V(n,r,e){let t=[],i=n;for(;i<=e;)t.push(i),i+=r;return t}function Kn(n,r,e,t){let i=n.split("/"),o=+i[1];if(f(i[0],"-")){let s=i[0].split("-");return V(d(s[0],t),o,d(s[1],t))}let u=i[0]==="*"?r:d(i[0],t);return V(u,o,e)}function mn(n,r,e){let t=[];return n.split(",").forEach(function(o){if(f(o,"/"))t.push(...Kn(o,r,e));else if(f(o,"-")){let u=o.split("-");+u[0]<=+u[1]?t.push(...V(+u[0],1,+u[1])):(t.push(...V(+u[0],1,e)),t.push(...V(r,1,+u[1])))}else t.push(+o)}),G(t)}function Yr(n){return cn(n)?n.split(",").map(Number):[0]}function Gr(n){if(n==="*")return[0,59];if(an(n)){let r=n.split("-");if(+r[0]<=+r[1])return[+r[0],+r[1]]}return null}function Zr(n){return n==="*"?59:Math.max(...mn(n,0,59))}function Br(n){if(Jn(n)&&n!=="0")return+n}function Xr(n,r){return n==="*"?"wildcard":r==="date"&&q(n)||r==="weekday"&&Q(n,k.weekday)?"quartz":f(n,",")?"list":f(n,"/")?"step":f(n,"-")?"range":"single"}function _r(n,r,e){return r==="wildcard"||r==="quartz"?null:n.split(",").map(function(i){if(f(i,"/")){let o=i.split("/");return{fires:Kn(i,e.min,e.top,e.numbers),interval:+o[1],kind:"step",startToken:o[0]}}return f(i,"-")?{bounds:i.split("-"),kind:"range"}:{kind:"single",value:i}})}function Yn(n){let r={},e={};F.forEach(function(u){r[u]=Xr(n[u],u),e[u]=_r(n[u],r[u],k[u])});let i={analyses:{clockSecond:Br(n.second),lastMinuteFire:Zr(n.minute),minuteSpan:Gr(n.minute),segments:e},pattern:n,shapes:r};return{...i,plan:ne(i)}}function ne(n){let{analyses:r,pattern:e,shapes:t}=n;if(e.second!=="0"){let i=re(e,t,r);if(i)return i}return Gn(e,t,r)||Zn(e,t,r)}function re(n,r,e){let t=ee(n,r);return t||(n.hour==="*"&&r.minute==="single"&&n.second!=="*"?{kind:"secondsWithinMinute",singleSecond:r.second==="single"}:r.second==="single"&&cn(n.minute)&&fn(n.hour)?null:{kind:"composeSeconds",rest:Gn(n,r,e,!0)||Zn(n,r,e,!0)})}function ee(n,r){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:r.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function Gn(n,r,e,t=!1){if(r.minute==="step")return{hours:ie(n,r,e),kind:"minuteFrequency"};if(r.hour==="single"&&e.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:e.minuteSpan};let i=oe(n,r);if(i)return i;let o=te(n,r);if(o)return o;if(n.hour==="*")return ue(n,r,t)}function ln(n){let[r,e]=n.split("/"),t=r==="*"?0:+r;return r.indexOf("-")===-1&&24%+e===0&&t<+e}function te(n,r){return r.hour!=="step"?null:n.minute==="*"?ln(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:I(n.hour)}:r.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:r.minute==="list"&&ln(n.hour)?{form:"list",kind:"minuteSpanAcrossHourStep"}:null}function ie(n,r,e){if(r.hour==="list")return{kind:"during",times:I(n.hour)};if(r.hour==="range"){let t=n.hour.split("-");return{from:+t[0],kind:"window",last:e.lastMinuteFire,to:+t[1]}}return r.hour==="single"?{from:+n.hour,kind:"window",last:e.lastMinuteFire,to:+n.hour}:r.hour==="step"?ln(n.hour)?{kind:"step"}:{kind:"during",times:I(n.hour)}:{kind:"none"}}function oe(n,r){return fn(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:I(n.hour)}:r.minute==="range"||r.minute==="list"&&f(n.minute,"-")&&!f(n.minute,"/")?{form:r.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:I(n.hour)}:null:null}function ue(n,r,e){if(r.minute==="range")return{kind:"rangeOfMinutes"};if(r.minute==="list")return{kind:"multipleMinutes"};if(n.minute==="*")return{kind:"everyMinute"};if(n.minute!=="0"||e)return{kind:"singleMinute"}}function Zn(n,r,e,t=!1){let i=t&&n.minute==="0";return r.hour==="range"&&!i?se(n,r,e):r.hour==="step"&&n.minute==="0"&&!t?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:ae(n,e,i)}function se(n,r,e){let t=n.hour.split("-"),i="lead";return n.minute==="*"?i="wildcard":r.minute==="range"&&(i="range"),{boundMinute:r.minute==="range"||r.minute==="list"?null:e.lastMinuteFire,from:+t[0],kind:"hourRange",last:e.lastMinuteFire,minuteForm:i,to:+t[1]}}function ae(n,r,e=!1){let t=mn(n.hour,0,23),i=Yr(n.minute);if(!e&&t.length*i.length>U)return{fold:i.length===1,kind:"compactClockTimes",minute:i[0]};let o=[];return t.forEach(function(s){i.forEach(function(S){o.push({hour:s,minute:S,second:r.clockSecond})})}),{kind:"clockTimes",times:o}}function I(n){let r=mn(n,0,23);return r.length<=U?{fires:r,kind:"fires"}:{kind:"segments"}}function Bn(n,r){let e=qn(n,r);return Un(e,r.quartz),jn(e),Hn(e),Dn(e)}function v(n){return n=""+n,n.length<2?"0"+n:n}function Xn(n,r,e){return e.short?n:r[n]||n}function dn(n,{sep:r,pad:e,lean:t}){let i=e?v(n.hour):""+n.hour;return t&&!n.minute&&!n.second?i:i+r+v(n.minute)+(n.second?r+v(n.second):"")}var gn={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 ",untilWindow:!0},house:{am:"AM",closeUp:!1,dayFirst:!1,midday:"noon",midnight:"midnight",ordinals:!0,pm:"PM",sep:":",serialComma:!0,through:" - "}};function _n(n){return typeof n=="object"&&n!==null?{...gn.us,untilWindow:!1,...n}:gn[n==="uk"?"gb":n]||gn.us}var ce=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],hn=["th","st","nd","rd"],fe=[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"]],C=[["Sunday","Sun"],["Monday","Mon"],["Tuesday","Tue"],["Wednesday","Wed"],["Thursday","Thu"],["Friday","Fri"],["Saturday","Sat"]],le={SUN:C[0],MON:C[1],TUE:C[2],WED:C[3],THU:C[4],FRI:C[5],SAT:C[6]},me=[null,"first","second","third","fourth","fifth"];function de(n){return n=n||{},{ampm:typeof n.ampm=="boolean"?n.ampm:!0,lenient:!!n.lenient,quartz:!!n.quartz,seconds:!!n.seconds,short:!!n.short,style:_n(n.dialect),years:!!n.years}}function ge(n,r){let e=be(n,r);if(e!==null)return rr(e,n,r);let t=Ze(n,r)??er(n,n.plan,r),i=Y(n,r)?at(n,r):"";return rr(i+t,n,r)}function er(n,r,e){let t=Be[r.kind];return t(n,r,e)}function pn(n){return n==="step"||n==="range"||n==="list"}function he(n,r){if(!r.style.untilWindow||r.short||n.plan.kind!=="composeSeconds"||n.plan.rest.kind==="clockTimes"||Y(n,r))return!1;let{shapes:e}=n;return pn(e.second)&&pn(e.minute)&&pn(e.hour)}function pe(n,r){let e=On(n);if(e)return B(e,r);if(n.shapes.hour==="range"){let t=c(n,"hour").find(function(o){return o.kind==="range"});return A({continuous:!1,from:+t.bounds[0],throughMinute:0,to:+t.bounds[1]},r)}return"during the "+R(n,{minute:0,second:null},!1,r)+" hours"}function ye(n,r){return n.shapes.minute==="step"?X(O(n,"minute"),"minute","hour",r):n.shapes.minute==="range"?J(n.pattern.minute,r):H(c(n,"minute"),"minute","hour",r)??z(M(c(n,"minute"),r),"minute","hour",r)}function be(n,r){if(!he(n,r))return null;let e=pe(n,r),t=ye(n,r),i=P(n,"minute",r),o=e+", "+t+", and within each of those minutes, "+i,u=a(n,r).trim();return u?u+", "+o:o}function Se(n,r,e){return"every second"+a(n,e)}function ke(n,r,e){return D(n,e)+a(n,e)}function Oe(n,r,e){let t=n.pattern.second;return g(t,e)+" "+w(t,"second")+" past the minute, every minute"+a(n,e)}function Ne(n,r,e){let t=n.pattern.minute,i=g(t,e),o=w(t,"minute");if(r.singleSecond){let u=n.pattern.second;return i+" "+o+" and "+g(u,e)+" "+w(u,"second")+" past the hour, every hour"+a(n,e)}return D(n,e)+", "+i+" "+o+" past the hour, every hour"+a(n,e)}function ze(n,r,e){if(!(r.rest.kind==="clockTimes"||r.rest.kind==="compactClockTimes")||n.shapes.minute!=="single")return null;let i=+n.pattern.minute;return zn(n,i,e)??wn(n,i,e)}function we(n,r,e){return+r.times[0].minute==0&&n.shapes.minute==="single"?D(n,e)+" for one minute at "+Ce(n,r,e):D(n,e)+" of "+xe(n,r,e)}function ve(n,r,e){let t=ze(n,r,e);return t!==null?t:r.rest.kind==="clockTimes"&&(n.shapes.second==="wildcard"||n.shapes.second==="step")?we(n,r.rest,e):n.shapes.second==="wildcard"&&r.rest.kind==="minuteFrequency"&&r.rest.hours.kind==="none"&&n.pattern.minute==="*/2"?"every second of every other minute"+a(n,e):(r.rest.kind==="compactClockTimes"&&n.analyses.clockSecond?"":D(n,e)+", ")+er(n,r.rest,e)}function Ce(n,r,e){let t=r.times.map(function(u){return l({hour:u.hour,minute:0},e)}),i=_(n,Pn,e);return p(t,e)+(i&&", "+i)}function xe(n,r,e){let t=r.times.map(function(u){return l({hour:u.hour,minute:u.minute,second:u.second,explicit:!0},e)}),i=_(n,Pn,e);return p(t,e)+(i&&", "+i)}function D(n,r){return P(n,"minute",r)}function P(n,r,e){let t=n.pattern.second,i=n.shapes.second;if(t==="*")return"every second";if(i==="step")return X(O(n,"second"),"second",r,e);if(i==="range"){let o=t.split("-"),u=vn();return"every second from "+u(o[0])+h(e)+u(o[1])+" past the "+r}return i==="single"?"at "+g(t,e)+" "+w(t,"second")+" past the "+r:H(c(n,"second"),"second",r,e)??z(M(c(n,"second"),e),"second",r,e)}function Pe(n,r,e){return"every minute"+a(n,e)}function Me(n,r,e){let t=n.pattern.minute;return g(t,e)+" "+w(t,"minute")+" past the hour, every hour"+a(n,e)}function Fe(n,r,e){return J(n.pattern.minute,e)+a(n,e)}function Te(n,r,e){return(H(c(n,"minute"),"minute","hour",e)??z(M(c(n,"minute"),e),"minute","hour",e))+a(n,e)}function We(n,r,e){let t=X(O(n,"minute"),"minute","hour",e);if(r.hours.kind==="during"){let i=K(n,e);t+=i?", "+i:" during the "+$(n,r.hours.times,!1,e)+" hours"}else if(r.hours.kind==="window")t+=" "+A({continuous:!1,from:r.hours.from,throughMinute:r.hours.last,to:r.hours.to},e);else if(r.hours.kind==="step"){let i=Cn(t);t=i+(i===t?" ":", ")+kn(O(n,"hour"),e)}return t+a(n,e)}function He(n,r,e){return n.pattern.minute==="*"?"every minute of the "+l({hour:r.hour,minute:0},e)+" hour"+a(n,e):"every minute from "+l({hour:r.hour,minute:r.span[0]},e)+h(e)+l({hour:r.hour,minute:r.span[1]},e)+a(n,e)}function Le(n,r,e){let t=K(n,e);if(r.form==="wildcard")return t!==null?"every minute, "+t+a(n,e):"every minute during the "+$(n,r.times,!1,e)+" hours"+a(n,e);if(r.form==="range"){let u=J(n.pattern.minute,e);return t!==null?u+", "+t+a(n,e):et(r.times)?u+", at "+$(n,r.times,!0,e)+a(n,e):u+" during the "+$(n,r.times,!1,e)+" hours"+a(n,e)}let i=H(c(n,"minute"),"minute","hour",e)??z(M(c(n,"minute"),e),"minute","hour",e);if(t!==null)return i+", "+t+a(n,e);let o=$(n,r.times,!0,e);return i+", at "+o+a(n,e)}var tr={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function kn(n,r){let e="during every "+tr[n.interval]+" hour",t=n.startToken==="*"?0:+n.startToken;return t===0?e:e+" starting at "+l({hour:t,minute:0},r)}function Ee(n,r,e){let t=O(n,"hour");if(r.form==="wildcard")return"every minute "+kn(t,e)+a(n,e);let i=Cn(r.form==="list"?H(c(n,"minute"),"minute","hour",e)??z(M(c(n,"minute"),e),"minute","hour",e):J(n.pattern.minute,e)),o=K(n,e);return i+", "+(o??cr(t,e))+a(n,e)}function J(n,r){let e=n.split("-"),t=vn();return"every minute from "+t(e[0])+h(r)+t(e[1])+" past the hour"}function je(n,r,e){return"every hour"+a(n,e)}function De(n,r,e){let t=Ue(Ae(r),e);return r.minuteForm==="wildcard"?"every minute "+t+a(n,e):r.minuteForm==="range"?J(n.pattern.minute,e)+", "+t+a(n,e):ir(n,e)+" "+t+a(n,e)}function ir(n,r){return n.pattern.minute==="0"?"every hour":H(c(n,"minute"),"minute","hour",r)??z(M(c(n,"minute"),r),"minute","hour",r)}function Re(n,r,e){let t=K(n,e);return t!==null?t+a(n,e):cr(O(n,"hour"),e)+a(n,e)}function Ae(n){let r=n.minuteForm==="wildcard",e=r?n.boundMinute??0:0;return{from:n.from,closeMinute:e,to:n.to,continuous:r}}function A(n,r){let{from:e,to:t,throughMinute:i,continuous:o}=n,u="from "+l({hour:e,minute:0},r);return r.style.untilWindow&&!r.short&&e!==t?o?u+" until "+l({hour:(t+1)%24,minute:0},r):u+h(r)+l({hour:t,minute:0},r):u+h(r)+l({hour:t,minute:i},r)}function Ue(n,r){return A({continuous:n.continuous,from:n.from,throughMinute:n.closeMinute,to:n.to},r)}function qe(n,r,e){if(n.shapes.minute==="single"){let o=+n.pattern.minute,u=zn(n,o,e)??wn(n,o,e);if(u!==null)return u}let t=xn(r.times),i=r.times.map(function(u){return l({hour:u.hour,minute:u.minute,second:u.second,plain:t},e)});return dr(n,e)+"at "+p(i,e)+or(n,e)}function or(n,r){return Y(n,r)?hr(n,r):""}function Qe(n,r,e){if(r.fold){let u=zn(n,+r.minute,e)??wn(n,+r.minute,e);if(u!==null)return u;if(c(n,"hour").some(function(y){return y.kind==="range"})&&!n.analyses.clockSecond)return Ve(n,r,e)+a(n,e);let m={minute:r.minute,second:n.analyses.clockSecond};return dr(n,e)+"at "+R(n,m,!0,e)+or(n,e)}let t=H(c(n,"minute"),"minute","hour",e)??z(M(c(n,"minute"),e),"minute","hour",e),i=K(n,e),o=i?Cn(t)+", "+i+a(n,e):t+", at "+R(n,{minute:0,second:null},!0,e)+a(n,e);return n.analyses.clockSecond?D(n,e)+", "+o:o}function Ve(n,r,e){let t=r.minute,i=[],o=ur(n).map(function(m){return l({hour:m,minute:t},e)});return c(n,"hour").forEach(function(m){m.kind==="range"&&i.push(A({continuous:!1,from:+m.bounds[0],throughMinute:t,to:+m.bounds[1]},e))}),ir(n,e)+" "+p(i,e)+sr(o,e)}function ur(n){let r=[];return c(n,"hour").forEach(function(t){t.kind==="step"?r.push(...t.fires):t.kind!=="range"&&r.push(+t.value)}),r}function sr(n,r){return n.length?" and at "+p(n,r):""}function W(n){return n==="*"||n.startsWith("*/")&&n.indexOf("-")===-1}function Ie(n,r){let{second:e,minute:t}=n.pattern;return W(e)?{secondLead:!0,text:P(n,"minute",r)}:e==="0"&&W(t)?{secondLead:!1,text:t==="*"?"every minute":X(O(n,"minute"),"minute","hour",r)}:null}function $e(n,r){let e=n.pattern.minute;if(e==="*")return"";if(W(e))return" of every other minute";let t=c(n,"minute");if(n.shapes.minute==="single")return" during minute :"+v(e);if(n.shapes.minute==="range"){let o=e.split("-");return" during minutes :"+v(o[0])+h(r)+":"+v(o[1])}let i=M(t,r).map(function(u){return":"+v(u)});return" during minutes "+p(i,r)}function Je(n,r){let e=n.pattern.hour;if(e==="*")return n.pattern.minute!=="*"&&!W(n.pattern.minute)?" of every hour":"";if(W(e))return e==="*/2"?" of every other hour":"";if(n.shapes.hour==="single"){let t=+e;return n.shapes.minute==="step"?" from "+l({hour:t,minute:0},r)+" until "+l({hour:(t+1)%24,minute:0},r):n.pattern.minute!=="*"&&!W(n.pattern.minute)?" at "+l({hour:t,minute:0},r):" of the "+l({hour:t,minute:0},r)+" hour"}if(n.shapes.hour==="range"){let t=e.split("-");return" "+A({continuous:n.pattern.minute==="*",from:+t[0],throughMinute:0,to:+t[1]},r)}return" during the "+R(n,{minute:0,second:null},!1,r)+" hours"}function Ke(n){if(n.shapes.hour!=="step")return!0;let r=O(n,"hour");return n.pattern.hour==="*/2"||r.startToken.indexOf("-")!==-1}function Ye(n){if(n.shapes.minute!=="list")return!1;let r=Z(c(n,"minute"));return r!==null&&on(r)!==null}function Ge(n,r){let{minute:e,hour:t}=n.pattern,i=W(e)&&e!=="*";return Ke(n)?r.secondLead?i?e==="*/2"&&n.shapes.hour!=="range":!(Ye(n)||n.shapes.minute==="list"&&n.shapes.hour==="list"):t==="*/2"?!0:n.shapes.hour==="single"&&e==="*/2":!1}function Ze(n,r){if(!r.style.untilWindow||r.short||n.pattern.minute==="*"&&n.pattern.hour==="*")return null;let e=Ie(n,r);if(!e||!Ge(n,e))return null;let t=e.secondLead?$e(n,r):"";return e.text+t+Je(n,r)+a(n,r)}var Be={clockTimes:qe,compactClockTimes:Qe,composeSeconds:ve,everyHour:je,everyMinute:Pe,everySecond:Se,hourRange:De,hourStep:Re,minuteFrequency:We,minuteSpanAcrossHourStep:Ee,minuteSpanInHour:He,minutesAcrossHours:Le,multipleMinutes:Te,rangeOfMinutes:Fe,secondPastMinute:Oe,secondsWithinMinute:Ne,singleMinute:Me,standaloneSeconds:ke};function ar(n,r){let{interval:e,start:t,last:i,cycle:o,unit:u,anchor:s}=n,m="every "+g(e,r)+" "+u+"s";return sn({start:t,interval:e,last:i,cycle:o},{bare:()=>m,offset:()=>m+" from "+g(t,r)+" "+w(t,u)+" past the "+s,bounded:()=>{let S=vn();return m+" from "+S(t)+h(r)+S(i)+" "+w(i,u)+" past the "+s}})}function H(n,r,e,t){let i=Z(n),o=i&&on(i);return o?ar({...o,cycle:60,unit:r,anchor:e},t):null}function X(n,r,e,t){if(n.startToken.indexOf("-")!==-1)return z(nr(n.fires,t),r,e,t);let i=n.startToken==="*"?0:+n.startToken;return i!==0&&n.fires.length<=3?z(nr(n.fires,t),r,e,t):ar({interval:n.interval,start:i,last:n.fires[n.fires.length-1],cycle:60,unit:r,anchor:e},t)}function cr(n,r){if(n.startToken.indexOf("-")!==-1)return"at "+yn(n.fires,r);let e=n.startToken==="*"?0:+n.startToken,t=n.interval;return e===0?"every "+g(t,r)+" hours":n.fires.length<=3?"at "+yn(n.fires,r):"every "+g(t,r)+" hours from "+l({hour:e,minute:0},r)}function B(n,r){let{start:e,interval:t,last:i}=n,o="every "+g(t,r)+" hours";return sn({start:e,interval:t,last:i,cycle:24},{bare:()=>o,offset:()=>o+" from "+l({hour:e,minute:0},r),bounded:()=>o+" from "+l({hour:e,minute:0},r)+h(r)+l({hour:i,minute:0},r)})}function K(n,r){let e=On(n);return!e||un(e)?null:B(e,r)}function On(n){let r=c(n,"hour");if(r.length===1&&r[0].kind==="step"){let t=r[0];if(t.fires.length<2)return null;let i=t.startToken==="*"?0:+t.startToken.split("-")[0];return{interval:t.interval,last:t.fires[t.fires.length-1],start:i}}let e=Z(r);return e&&$n(e)}function Nn(n){return n.pattern.second==="*"||n.shapes.second==="step"}function fr(n,r,e){if(r===0)return Nn(n)?P(n,"minute",e)+" for one minute":P(n,"hour",e);let t=g(r,e)+" "+w(r,"minute")+" past the hour";return n.pattern.second==="0"?t:P(n,"minute",e)+", "+t}function zn(n,r,e){let t=On(n);if(!t)return null;let i=(t.last-t.start)/t.interval+1;if(n.pattern.second==="0"&&i<=U&&un(t))return null;let o=r===0&&Nn(n)&&Xe(n);return o?P(n,"minute",e)+" for one minute "+kn(o,e)+a(n,e):r===0&&n.pattern.second==="0"?B(t,e)+a(n,e):fr(n,r,e)+", "+B(t,e)+a(n,e)}function Xe(n){let r=c(n,"hour"),e=r.length===1&&r[0];return!e||e.kind!=="step"||e.startToken.indexOf("-")!==-1||!(e.interval in tr)?null:e}function _e(n){return c(n,"hour").some(function(e){return e.kind==="range"})}function nt(n,r){let e=[],t=ur(n);c(n,"hour").forEach(function(s){s.kind==="range"&&e.push(A({continuous:!1,from:+s.bounds[0],throughMinute:0,to:+s.bounds[1]},r))});let i="every hour "+p(e,r),o=t.map(function(s){return l({hour:s,minute:0},r)});return i+sr(o,r)}function wn(n,r,e){return r!==0||!_e(n)||n.pattern.second==="0"?null:Nn(n)?P(n,"minute",e)+" for one minute during the "+R(n,{minute:0,second:null},!1,e)+" hours"+a(n,e):fr(n,r,e)+", "+nt(n,e)+a(n,e)}function vn(){return function(r){return""+r}}function lr(n,r){return n>1?function(t){return""+t}:function(t){return g(t,r)}}function nr(n,r){return n.map(lr(n.length,r))}function M(n,r){let e=n.reduce(function(o,u){return u.kind==="range"?o+1:o+(u.kind==="step"?u.fires.length:1)},0),t=lr(e,r);return n.flatMap(function(o){return o.kind==="range"?[t(o.bounds[0])+h(r)+t(o.bounds[1])]:o.kind==="step"?o.fires.map(t):[t(o.value)]})}function z(n,r,e,t){return"at "+p(n,t)+" "+r+"s past the "+e}function Cn(n){return n.replace(/ past the hour$/,"")}function rt(n,r,e){return(+n==0||+n==12)&&+r==0&&!(typeof e=="number"&&e>0)}function xn(n){let r=n.filter(function(t){return rt(t.hour,t.minute,t.second)});return r.length>0&&r.length<n.length}function yn(n,r){let e=xn(n.map(function(o){return{hour:o,minute:0}})),t=n.map(function(o){return l({hour:o,minute:0,plain:e},r)});return p(t,r)}function et(n){return n.kind==="fires"&&n.fires.length===1}function $(n,r,e,t){return r.kind==="fires"?yn(r.fires,t):R(n,{minute:0,second:null},e,t)}function tt(n){return n.kind==="range"?n.bounds:n.kind==="step"?n.fires:[n.value]}function R(n,r,e,t){let{minute:i,second:o}=r,u=c(n,"hour"),s=xn(u.flatMap(function(y){return tt(y).map(function(en){return{hour:+en,minute:i,second:o}})})),m=[];return u.forEach(function(y){y.kind==="step"?m.push(...y.fires.map(function(en){return l({hour:en,minute:i,second:o,plain:s},t)})):y.kind==="range"?m.push(l({hour:y.bounds[0],minute:i,second:o,plain:s},t)+h(t)+l({hour:y.bounds[1],minute:i,second:o,plain:s},t)):m.push(l({hour:y.value,minute:i,second:o,plain:s},t))}),p(it(m,u,e),t)}function it(n,r,e){let t=r.some(function(o){return o.kind==="range"});return!e||!t?n:n.map(function(o,u){return u===0?o:"at "+o})}function mr(n,r,e){if(n.length<=1)return n.join("");if(n.length===2)return n[0]+r+n[1];let t=e.style.serialComma?","+r:r;return n.slice(0,-1).join(", ")+t+n[n.length-1]}function p(n,r){return mr(n," and ",r)}function ot(n,r){return mr(n," or ",r)}var ut={all:"",month:"in ",recurringWeekday:!0,stepDate:"on ",weekday:"on "},Pn={all:"every day",month:"every day in ",recurringWeekday:!1,stepDate:"",weekday:"every "};function a(n,r){if(Y(n,r))return hr(n,r);let e=_(n,ut,r);return e&&" "+e}function dr(n,r){return Y(n,r)?"":_(n,Pn,r)+" "}function _(n,r,e){let t=n.pattern;if(t.date!=="*"&&t.weekday!=="*")return mt(n,e);if(t.date!=="*")return st(n,r,e);if(t.weekday!=="*"){let i=Mn(t.weekday,e);return i?bn(i,n,e):r.weekday+kr(n,r.recurringWeekday,e)+yr(n,e)}return t.month!=="*"?r.month+N(n,e):r.all}function st(n,r,e){let t=n.pattern,i=nn(t.date,e);return i?bn(i,n,e):j(t.date)?bn(r.stepDate+br(t.date),n,e):t.month!=="*"&&!gr(n)?"on the "+Sn(n,e)+yr(n,e):t.month!=="*"?"on "+pr(n,e):"on the "+Sn(n,e)}function gr(n){return!Sr(n.pattern.month)&&c(n,"month").every(function(e){return e.kind!=="range"})}function Y(n,r){return n.pattern.date!=="*"&&n.pattern.weekday!=="*"&&!!r.style.untilWindow&&!r.short}function hr(n,r){let e=[...ct(n,r),...ft(n,r)];return" whenever the day is "+ot(e,r)}function at(n,r){return n.pattern.month==="*"?"":"in "+N(n,r)+" "}function ct(n,r){let e=n.pattern.date,t=nn(e,r);if(t)return[t.replace(/^on /,"")];let i=lt(e);if(i)return[i];let o=[];return c(n,"date").forEach(function(s){s.kind==="range"?o.push("from the "+b(s.bounds[0])+h(r)+"the "+b(s.bounds[1])):s.kind==="step"?s.fires.forEach(function(S){o.push("the "+b(S))}):o.push("the "+b(s.value))}),o}function ft(n,r){let e=n.pattern.weekday,t=Mn(e,r);if(t)return[t.replace(/^on /,"")];let i=[];return c(n,"weekday").forEach(function(u){u.kind==="range"&&u.bounds[0]==="1"&&u.bounds[1]==="5"?i.push("a weekday"):u.kind==="range"?i.push("a "+x(u.bounds[0],r)+h(r)+"a "+x(u.bounds[1],r)):u.kind==="step"?u.fires.forEach(function(m){i.push("a "+x(m,r))}):i.push("a "+x(u.value,r))}),i}function lt(n){if(!j(n))return null;let[r,e]=n.split("/");return+e!=2?null:r==="*"||r==="1"?"an odd-numbered day":r==="2"?"an even-numbered day":null}function mt(n,r){let e=n.pattern,t=Mn(e.weekday,r)||"on "+kr(n,!1,r);return e.month!=="*"&&gr(n)&&!nn(e.date,r)&&!j(e.date)?"on "+pr(n,r)+" or "+t+" in "+N(n,r):dt(n,r)+" or "+t+gt(n,r)}function dt(n,r){let e=n.pattern,t=nn(e.date,r);return t||(j(e.date)?br(e.date):"on the "+Sn(n,r))}function gt(n,r){return n.pattern.month==="*"?"":", in "+N(n,r)}function nn(n,r){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 g(+e[1],r)+" "+w(e[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 "+b(t[1]||t[2])}function Mn(n,r){let e=n.split("#");if(e.length===2)return"on the "+me[+e[1]]+" "+x(e[0],r)+" of the month";if(/L$/.test(n))return"on the last "+x(n.slice(0,-1),r)+" of the month"}function pr(n,r){let e=N(n,r),t=rn(c(n,"date"),r.style.ordinals?b:ht,r);return r.style.dayFirst&&n.shapes.date==="single"&&n.shapes.month!=="single"?"the "+b(n.pattern.date)+" of "+e:r.style.dayFirst?t+" "+e:e+" "+t}function ht(n){return""+n}function yr(n,r){return n.pattern.month==="*"?"":" in "+N(n,r)}function bn(n,r,e){if(r.pattern.month==="*")return n;let t=n.indexOf(" of the month")!==-1;return t&&r.shapes.month==="range"?n.replace(" of the month"," of each month")+" from "+N(r,e):t&&(r.shapes.month==="single"||r.shapes.month==="step")?n.replace(" of the month","")+" in "+N(r,e):n+" in "+N(r,e)}function br(n){let r=n.split("/"),e=+r[1],t=r[0],o=(e===2?"every other":"every "+b(e))+" day of the month";return t!=="*"&&t!=="1"&&(o+=" from the "+b(t)),o}function Sn(n,r){return rn(c(n,"date"),b,r)}function N(n,r){let e=Sr(n.pattern.month);return e||rn(c(n,"month"),function(i){return kt(i,r)},r)}function Sr(n){if(!j(n))return null;let[r,e]=n.split("/");return+e!=2?null:r==="*"||r==="1"?"every odd-numbered month":r==="2"?"every even-numbered month":null}function kr(n,r,e){let t=In(c(n,"weekday")),i=t.some(function(s){return s.kind==="range"});return rn(t,r&&!i?function(s){return pt(s,e)}:function(s){return x(s,e)},e)}function pt(n,r){let e=x(n,r);return r.short?e:e+"s"}function rn(n,r,e){let t=[];return n.forEach(function(o){o.kind==="step"?t.push(...o.fires.map(r)):o.kind==="range"?t.push(o.bounds.map(r).join(h(e))):t.push(r(o.value))}),p(t,e)}function rr(n,r,e){let t=r.pattern.year;if(t==="*")return n;if(t.indexOf("/")!==-1)return n+", "+bt(t,e);let i=yt(t,e);if(t.indexOf("-")===-1&&t.indexOf(",")===-1&&r.pattern.date!=="*"&&n.indexOf(" at ")!==-1){let o=e.style.dayFirst?" ":", ";return n.replace(" at ",o+i+" at ")}return n+" in "+i}function yt(n,r){return n.indexOf(",")!==-1?p(n.split(","),r):n.indexOf("-")!==-1?n.split("-").join(h(r)):n}function bt(n,r){let e=n.split("/"),t=+e[1],i=e[0];if(t<=1)return"every year";let o=t===2?"every other year":"every "+g(t,r)+" years";return i!=="*"&&i!=="0"&&(o+=" from "+i),o}function l(n,r){let{hour:e,minute:t,plain:i,explicit:o}=n,u=typeof n.second=="number"&&n.second>0?n.second:0;return r.ampm?St({hour:e,minute:t,second:u,plain:i,explicit:o},r):dn({hour:e,minute:t,second:u},{pad:!0,sep:r.style.sep})}function St(n,r){let{hour:e,minute:t,second:i,plain:o,explicit:u}=n,s=r.style;if(!o&&!u&&+t==0&&!i){if(+e==0)return s.midnight;if(+e==12)return s.midday}return dn({hour:e%12||12,minute:t,second:i},{lean:!u,sep:s.sep})+(s.closeUp?"":" ")+(e<12?s.am:s.pm)}function g(n,r){return Xn(n,ce,r)}function w(n,r){return+n==1?r:r+"s"}function h(n){return n.short?"-":n.style.through}function b(n){let r=Math.abs(n),e=hn[r];return e||(r=(r%100-20)%10,e=hn[r]||hn[0]),n+e}function kt(n,r){let e=fe[+n];return e&&e[r.short?1:0]}function x(n,r){let e=n===7||n==="7"?0:n,t=C[e]||le[e];return t&&t[r.short?1:0]}var Ot={describe:ge,fallback:"an unrecognizable cron pattern",options:de,reboot:"at system startup",sentence:n=>"Runs "+n+(n.endsWith(".")?"":".")},Or=Ot;/**
|
|
2
2
|
* @license MIT, Copyright (c) 2026 Andrew Brož
|
|
3
|
-
*/function
|
|
3
|
+
*/function Fn(n,r){let e=r&&r.lang||Or,t=e.options(r);if(!t.lenient)return Nr(zr(n,e,t),e,r);try{return Nr(zr(n,e,t),e,r)}catch{return e.fallback}}function Nr(n,r,e){return e&&e.sentence?r.sentence(n):n}function zr(n,r,e){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return r.reboot;let t=Yn(Bn(n,e)),i=r.plan?r.plan(t,t.plan):t.plan;return r.describe({...t,plan:i},e)}function Nt(n,r){return Fn(n,{...r,sentence:!0})}function zt(n,r){return Fn(n,{...r,sentence:!1})}var wt=Object.assign(Fn,{sentence:Nt,fragment:zt}),Tn=wt;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:Tn});var yi=Tn;})();
|
package/dist/cronli5.cjs
CHANGED
|
@@ -52,10 +52,10 @@ var fieldSpecs = {
|
|
|
52
52
|
second: { cyclic: true, max: 59, min: 0, top: 59 },
|
|
53
53
|
minute: { cyclic: true, max: 59, min: 0, top: 59 },
|
|
54
54
|
hour: { cyclic: true, max: 23, min: 0, top: 23 },
|
|
55
|
-
date: {
|
|
55
|
+
date: { cyclic: true, max: 31, min: 1, top: 31 },
|
|
56
56
|
month: { cyclic: true, max: 12, min: 1, numbers: monthNumbers, top: 12 },
|
|
57
57
|
weekday: {
|
|
58
|
-
aliases: {
|
|
58
|
+
aliases: { L: "6" },
|
|
59
59
|
cyclic: true,
|
|
60
60
|
max: 7,
|
|
61
61
|
min: 0,
|
|
@@ -352,6 +352,53 @@ function firstFire(segment, spec) {
|
|
|
352
352
|
return start === "*" ? spec.min : toFieldNumber(start, spec.numbers);
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
+
// src/core/quartz.ts
|
|
356
|
+
var quartzTokenMessage = "`?` is a Quartz token \u2014 pass { quartz: true } to enable Quartz semantics.";
|
|
357
|
+
function applyQuartz(cronPattern, quartz) {
|
|
358
|
+
if (!quartz) {
|
|
359
|
+
rejectQuartzToken(cronPattern.date);
|
|
360
|
+
rejectQuartzToken(cronPattern.weekday);
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if ("" + cronPattern.date === "?") {
|
|
364
|
+
cronPattern.date = "*";
|
|
365
|
+
}
|
|
366
|
+
if ("" + cronPattern.weekday === "?") {
|
|
367
|
+
cronPattern.weekday = "*";
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
cronPattern.weekday = reindexWeekday("" + cronPattern.weekday);
|
|
371
|
+
}
|
|
372
|
+
function rejectQuartzToken(value) {
|
|
373
|
+
if ("" + value === "?") {
|
|
374
|
+
throw new Error(quartzTokenMessage);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function reindexWeekday(value) {
|
|
378
|
+
if (value === "*") {
|
|
379
|
+
return value;
|
|
380
|
+
}
|
|
381
|
+
return value.split(",").map(reindexSegment).join(",");
|
|
382
|
+
}
|
|
383
|
+
function reindexSegment(segment) {
|
|
384
|
+
const operator = /(#\d+|L)$/.exec(segment);
|
|
385
|
+
const suffix = operator ? operator[0] : "";
|
|
386
|
+
const core = suffix ? segment.slice(0, -suffix.length) : segment;
|
|
387
|
+
const step = core.split("/");
|
|
388
|
+
const range = step[0].split("-").map(reindexNumber).join("-");
|
|
389
|
+
const head = step.length === 2 ? range + "/" + step[1] : range;
|
|
390
|
+
return head + suffix;
|
|
391
|
+
}
|
|
392
|
+
function reindexNumber(token) {
|
|
393
|
+
if (!isNonNegativeInteger(token)) {
|
|
394
|
+
return token;
|
|
395
|
+
}
|
|
396
|
+
if (token === "0") {
|
|
397
|
+
throw new Error('`cronli5` was passed an invalid Quartz day-of-week value "0"; Quartz numbers weekdays 1 (Sunday) through 7 (Saturday).');
|
|
398
|
+
}
|
|
399
|
+
return "" + (+token - 1);
|
|
400
|
+
}
|
|
401
|
+
|
|
355
402
|
// src/core/parse.ts
|
|
356
403
|
function parseCronPattern(cronPattern, opts) {
|
|
357
404
|
const isArray = cronPattern instanceof Array;
|
|
@@ -892,6 +939,7 @@ function hourTimesPlan(hourField) {
|
|
|
892
939
|
// src/core/index.ts
|
|
893
940
|
function prepare(cronPattern, opts) {
|
|
894
941
|
const pattern = parseCronPattern(cronPattern, opts);
|
|
942
|
+
applyQuartz(pattern, opts.quartz);
|
|
895
943
|
applyQuartzAliases(pattern);
|
|
896
944
|
validateCronPattern(pattern);
|
|
897
945
|
return normalizeCronPattern(pattern);
|
|
@@ -1020,6 +1068,7 @@ function normalizeOptions(options) {
|
|
|
1020
1068
|
return {
|
|
1021
1069
|
ampm: typeof options.ampm === "boolean" ? options.ampm : true,
|
|
1022
1070
|
lenient: !!options.lenient,
|
|
1071
|
+
quartz: !!options.quartz,
|
|
1023
1072
|
seconds: !!options.seconds,
|
|
1024
1073
|
short: !!options.short,
|
|
1025
1074
|
style: resolveDialect(options.dialect),
|
|
@@ -1237,7 +1286,8 @@ function renderMinuteFrequency(schedule, plan, opts) {
|
|
|
1237
1286
|
to: plan.hours.to
|
|
1238
1287
|
}, opts);
|
|
1239
1288
|
} else if (plan.hours.kind === "step") {
|
|
1240
|
-
|
|
1289
|
+
const bound = withoutHourAnchor(phrase);
|
|
1290
|
+
phrase = bound + (bound === phrase ? " " : ", ") + everyNthHour(stepSegment(schedule, "hour"), opts);
|
|
1241
1291
|
}
|
|
1242
1292
|
return phrase + trailingQualifier(schedule, opts);
|
|
1243
1293
|
}
|
|
@@ -1300,7 +1350,7 @@ function renderMinuteSpanAcrossHourStep(schedule, plan, opts) {
|
|
|
1300
1350
|
if (plan.form === "wildcard") {
|
|
1301
1351
|
return "every minute " + everyNthHour(segment, opts) + trailingQualifier(schedule, opts);
|
|
1302
1352
|
}
|
|
1303
|
-
const lead = plan.form === "list" ? strideFromSegments(
|
|
1353
|
+
const lead = withoutHourAnchor(plan.form === "list" ? strideFromSegments(
|
|
1304
1354
|
segmentsOf(schedule, "minute"),
|
|
1305
1355
|
"minute",
|
|
1306
1356
|
"hour",
|
|
@@ -1310,7 +1360,7 @@ function renderMinuteSpanAcrossHourStep(schedule, plan, opts) {
|
|
|
1310
1360
|
"minute",
|
|
1311
1361
|
"hour",
|
|
1312
1362
|
opts
|
|
1313
|
-
) : minuteRangeLead(schedule.pattern.minute, opts);
|
|
1363
|
+
) : minuteRangeLead(schedule.pattern.minute, opts));
|
|
1314
1364
|
const cadence = unevenHourCadence(schedule, opts);
|
|
1315
1365
|
return lead + ", " + (cadence ?? stepHours(segment, opts)) + trailingQualifier(schedule, opts);
|
|
1316
1366
|
}
|
|
@@ -1429,7 +1479,7 @@ function renderCompactClockTimes(schedule, plan, opts) {
|
|
|
1429
1479
|
)
|
|
1430
1480
|
);
|
|
1431
1481
|
const cadence = unevenHourCadence(schedule, opts);
|
|
1432
|
-
const phrase = cadence ? minuteLead + ", " + cadence + trailingQualifier(schedule, opts) : minuteLead + ", at " + hourSegmentTimes(schedule, { minute: 0, second: null }, true, opts) + trailingQualifier(schedule, opts);
|
|
1482
|
+
const phrase = cadence ? withoutHourAnchor(minuteLead) + ", " + cadence + trailingQualifier(schedule, opts) : minuteLead + ", at " + hourSegmentTimes(schedule, { minute: 0, second: null }, true, opts) + trailingQualifier(schedule, opts);
|
|
1433
1483
|
return schedule.analyses.clockSecond ? secondsLeadClause(schedule, opts) + ", " + phrase : phrase;
|
|
1434
1484
|
}
|
|
1435
1485
|
function foldedHourWindows(schedule, plan, opts) {
|
|
@@ -1803,6 +1853,9 @@ function segmentWords(segments, opts) {
|
|
|
1803
1853
|
function listPastThe(words, unit, anchor, opts) {
|
|
1804
1854
|
return "at " + joinList(words, opts) + " " + unit + "s past the " + anchor;
|
|
1805
1855
|
}
|
|
1856
|
+
function withoutHourAnchor(lead) {
|
|
1857
|
+
return lead.replace(/ past the hour$/, "");
|
|
1858
|
+
}
|
|
1806
1859
|
function wordTime(hour, minute, second) {
|
|
1807
1860
|
return (+hour === 0 || +hour === 12) && +minute === 0 && !(typeof second === "number" && second > 0);
|
|
1808
1861
|
}
|
|
@@ -2322,7 +2375,14 @@ function interpretCronPattern(cronPattern, lang, opts) {
|
|
|
2322
2375
|
const plan = lang.plan ? lang.plan(schedule, schedule.plan) : schedule.plan;
|
|
2323
2376
|
return lang.describe({ ...schedule, plan }, opts);
|
|
2324
2377
|
}
|
|
2325
|
-
|
|
2378
|
+
function sentence(cronPattern, options) {
|
|
2379
|
+
return cronli5(cronPattern, { ...options, sentence: true });
|
|
2380
|
+
}
|
|
2381
|
+
function fragment(cronPattern, options) {
|
|
2382
|
+
return cronli5(cronPattern, { ...options, sentence: false });
|
|
2383
|
+
}
|
|
2384
|
+
var callable = Object.assign(cronli5, { sentence, fragment });
|
|
2385
|
+
var cronli5_default = callable;
|
|
2326
2386
|
/**
|
|
2327
2387
|
* @license MIT, Copyright (c) 2026 Andrew Brož
|
|
2328
2388
|
*/
|