cronli5 0.3.4 → 0.8.0

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/README.md +63 -13
  3. package/cronli5.min.js +2 -2
  4. package/dist/cronli5.cjs +72 -9
  5. package/dist/cronli5.js +72 -9
  6. package/dist/lang/de.cjs +14 -6
  7. package/dist/lang/de.js +14 -6
  8. package/dist/lang/en.cjs +14 -6
  9. package/dist/lang/en.js +14 -6
  10. package/dist/lang/es.cjs +14 -6
  11. package/dist/lang/es.js +14 -6
  12. package/dist/lang/fi.cjs +14 -6
  13. package/dist/lang/fi.js +14 -6
  14. package/dist/lang/fr.cjs +1211 -0
  15. package/dist/lang/fr.js +1187 -0
  16. package/dist/lang/pt.cjs +1592 -0
  17. package/dist/lang/pt.js +1568 -0
  18. package/dist/lang/zh.cjs +58 -9
  19. package/dist/lang/zh.js +58 -9
  20. package/package.json +13 -2
  21. package/src/core/cadence.ts +25 -12
  22. package/src/core/index.ts +7 -3
  23. package/src/core/quartz.ts +97 -0
  24. package/src/core/schedule.ts +1 -0
  25. package/src/core/specs.ts +2 -2
  26. package/src/cronli5.ts +20 -3
  27. package/src/lang/de/index.ts +3 -2
  28. package/src/lang/en/index.ts +3 -2
  29. package/src/lang/es/index.ts +3 -2
  30. package/src/lang/fi/index.ts +3 -2
  31. package/src/lang/fr/dialects.ts +49 -0
  32. package/src/lang/fr/index.ts +2116 -0
  33. package/src/lang/fr/notes.md +280 -0
  34. package/src/lang/fr/status.json +8 -0
  35. package/src/lang/pt/dialects.ts +56 -0
  36. package/src/lang/pt/index.ts +2804 -0
  37. package/src/lang/pt/notes.md +199 -0
  38. package/src/lang/pt/status.json +8 -0
  39. package/src/lang/zh/index.ts +61 -5
  40. package/src/lang/zh/notes.md +16 -4
  41. package/src/lang/zh/status.json +10 -1
  42. package/src/types.ts +44 -0
  43. package/types/core/cadence.d.ts +1 -0
  44. package/types/core/quartz.d.ts +4 -0
  45. package/types/core/schedule.d.ts +1 -0
  46. package/types/cronli5.d.ts +4 -4
  47. package/types/lang/fr/dialects.d.ts +11 -0
  48. package/types/lang/fr/index.d.ts +4 -0
  49. package/types/lang/pt/dialects.d.ts +13 -0
  50. package/types/lang/pt/index.d.ts +4 -0
  51. package/types/types.d.ts +39 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,126 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.0]
10
+
11
+ ### Added
12
+
13
+ - **`quartz` option.** `cronli5(pattern, { quartz: true })` reads the schedule as
14
+ Quartz: day-of-week is `1`=Sunday … `7`=Saturday (so `0 0 ? * 2` is **Monday**),
15
+ with the DOW-indexed operators (`6L`, `2#2`) and `?` following Quartz. Without
16
+ it, day-of-week stays standard cron (`0`/`7`=Sun, `1`=Mon).
17
+ - **`cronli5.sentence(expr, opts)` and `cronli5.fragment(expr, opts)`** —
18
+ convenience methods on the callable: `.sentence()` returns the capitalized
19
+ standalone ("Runs …."), `.fragment()` the embeddable lowercase fragment (the
20
+ default). Sugar over the `{ sentence }` option. (Deliberately no `toString`
21
+ method — it would collide with `Function.prototype.toString`.)
22
+
23
+ ### Changed
24
+
25
+ - **Breaking: `?` now requires `{ quartz: true }`.** Previously `?` was silently
26
+ treated as `*` while day-of-week used standard indexing, so a genuine Quartz
27
+ cron like `0 0 ? * 2` rendered "every Tuesday" when the author meant Monday.
28
+ `?` (mandatory in Quartz, absent in standard cron) now throws a clear
29
+ `pass { quartz: true }` error by default — eliminating silent wrong output.
30
+ `L`, `W`, and `#` are unaffected and remain usable in standard mode.
31
+
32
+ ## [0.7.2]
33
+
34
+ ### Changed
35
+
36
+ - **Docs refresh.** README + CONTRIBUTING updated for the seven languages (incl.
37
+ pt-BR, fr-FR, and the zh-Hant variant), the Node 20+ requirement, the Vitest
38
+ test runner, the `IR`→`Schedule` rename, and the sibling-derivation
39
+ add-language workflow (blind pipeline now the fallback). Regenerated the
40
+ language-status and cRonstrue comparison tables.
41
+ - **CI:** bumped `actions/checkout` and `actions/setup-node` to v5.
42
+
43
+ ### Fixed
44
+
45
+ - A duplicate `engines` key left `engines.node` effectively `>=18`; deduped to a
46
+ single `>=20`, so the Node requirement declared in 0.7.1 is actually in force.
47
+
48
+ ## [0.7.1]
49
+
50
+ ### Changed
51
+
52
+ - **Require Node 20+** (`engines.node` `>=20`) and drop Node 18 from CI. Node 18
53
+ is EOL, and the dev/test toolchain (Vitest 4) requires Node 20.12+ (it imports
54
+ `node:util`'s `styleText`), which was failing the Node 18.x CI leg with a
55
+ startup `SyntaxError`. The published library's runtime is otherwise unchanged;
56
+ this just declares the supported Node range.
57
+
58
+ ## [0.7.0]
59
+
60
+ ### Added
61
+
62
+ - **French (fr-FR), beta.** A full French renderer via `{lang: fr}` — the
63
+ sibling-derivation workflow's stress test against the wider es→fr gap. 24h-only
64
+ ("à 9 h 30", minuit/midi; `{ampm}` is a no-op), the per-value "le 1er" ordinal,
65
+ du/des/au/aux contractions, masculine gender agreement, "le lundi" recurrence,
66
+ "soit X soit Y" union, "ouvrable" for the W operator. Validated by a blind
67
+ 3-persona fr-FR panel (0 misreads, all conventions ratified) and a clean
68
+ round-trip; ships **beta** pending fluent-human review (fr-CA is a future
69
+ dialect axis).
70
+
71
+ ## [0.6.0]
72
+
73
+ ### Added
74
+
75
+ - **Portuguese (pt-BR), beta.** A full Portuguese renderer via `{lang: pt}` — the
76
+ first language built with the new sibling-derivation workflow (derived from the
77
+ Spanish renderer). Natural pt-BR: preposition+article contractions
78
+ (do/da/no/na/à/às), gender agreement, "toda segunda-feira" recurrence, "dia 1º",
79
+ a 19h noite boundary. Validated by a blind 3-persona pt-BR panel and a clean
80
+ round-trip; ships **beta** pending fluent-human review (pt-PT is a future
81
+ dialect axis).
82
+
83
+ ### Changed
84
+
85
+ - **Add-language workflow: sibling-derivation is now the primary path.** A new
86
+ language is derived from its nearest *validated* sibling — translate its
87
+ reviewed corpus into a target candidate, port its renderer, TDD to green — then
88
+ validated objectively (round-trip, fuzz, OR-scope, cRonstrue comparison) plus
89
+ native review. The blind pipeline (which produced verbose, inconsistent
90
+ renderers) is now the no-sibling fallback. See
91
+ [tooling/docs/language-pipeline.md](tooling/docs/language-pipeline.md).
92
+ - Coverage enumeration keys off `status.json` so an in-progress language build
93
+ stays green.
94
+
95
+ ## [0.5.0]
96
+
97
+ ### Added
98
+
99
+ - **Traditional Chinese (`zh-Hant`).** The Chinese renderer now produces
100
+ Traditional output via `cronli5(pattern, {lang: zh, dialect: 'zh-Hant'})` — a
101
+ faithful within-zh variant (時/鐘/點/週/個/數/單/雙/後/間 …), with Simplified
102
+ (`zh` / `zh-Hans`) output unchanged and identical round-trip meaning. Ships
103
+ **experimental** pending a Traditional-native review (two vocabulary choices
104
+ are flagged in the backlog).
105
+
106
+ ## [0.4.0]
107
+
108
+ ### Fixed
109
+
110
+ - **Core: a bounded hour step lost its bound when it folded.** A bounded hour
111
+ step with more fires than the clock-time enumeration cap (e.g. `23 0-20/2`,
112
+ hours 0,2,…,20) folded to the compact "every N hours" form, which carried no
113
+ bound — so it read as running all day, in every language. The fold now keeps
114
+ the range bound ("every two hours from midnight through 8 p.m."); open `*/n`
115
+ and full-day-equivalent steps stay unbounded. Surfaced by the new cRonstrue
116
+ round-trip. (en/es/de/fi/zh.)
117
+
118
+ ### Added
119
+
120
+ - **cRonstrue comparison + migration guide (user support).** A generated,
121
+ CI-checked comparison (`docs/cronli5-vs-cronstrue.md`) grouping representative
122
+ patterns simple/medium/complex with cronli5 vs cRonstrue side by side, backed
123
+ by a blind reader panel (cronli5 preferred 81/108 — even on simple cadences,
124
+ decisive on medium/complex) and a round-trip correctness pass. A migration
125
+ guide (`docs/migrating-from-cronstrue.md`) with API, option, and locale
126
+ mappings and the behavior differences to expect. New tooling:
127
+ `tooling/scripts/cronstrue-divergence.mjs` (`npm run divergence`).
128
+
9
129
  ## [0.3.4]
10
130
 
11
131
  ### Fixed
package/README.md CHANGED
@@ -51,6 +51,8 @@ differ and which to pick.
51
51
 
52
52
  ## Installation
53
53
 
54
+ Requires **Node.js 20 or newer**.
55
+
54
56
  Install using npm:
55
57
  ```
56
58
  # For a Node project:
@@ -89,6 +91,23 @@ cronli5(['*/5', '*', '*', '*', '*']); // 'every five minutes'
89
91
  cronli5({ minute: '*/5' }); // 'every five minutes'
90
92
  ```
91
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
+
92
111
  TypeScript types are bundled, so usage is fully typed out of the box:
93
112
  ```ts
94
113
  import cronli5, { type Cronli5Options } from 'cronli5';
@@ -103,15 +122,29 @@ As a command line tool:
103
122
  $ cronli5 "*/5 * * * *"
104
123
  Runs every five minutes.
105
124
 
106
- # Other languages with --lang (de, es, fi, zh):
125
+ # Other languages with --lang (de, es, fi, fr, pt, zh):
107
126
  $ cronli5 --lang de "0 0 * * *"
108
127
  Läuft täglich um Mitternacht.
128
+ $ cronli5 --lang fr "0 0 * * *"
129
+ S'exécute tous les jours à minuit.
109
130
 
110
131
  # --fragment prints the bare, embeddable fragment instead of a sentence:
111
132
  $ cronli5 --fragment "*/5 * * * *"
112
133
  every five minutes
113
134
  ```
114
135
 
136
+ Dialects and script variants — including Traditional Chinese (`zh-Hant`) — are
137
+ selected through the library's [`dialect`](#options) option rather than the CLI;
138
+ the CLI exposes only `--lang` and `--fragment`.
139
+
140
+ ```js
141
+ import cronli5 from 'cronli5';
142
+ import zh from 'cronli5/lang/zh';
143
+
144
+ cronli5('0 0 * * *', {lang: zh}); // '每天凌晨0点' (Simplified, default)
145
+ cronli5('0 0 * * *', {lang: zh, dialect: 'zh-Hant'}); // '每天凌晨0點' (Traditional)
146
+ ```
147
+
115
148
  ## Input Formats
116
149
 
117
150
  `cronli5` accepts classic (five-part) cron patterns, extended (six-part) cron
@@ -131,8 +164,7 @@ It accepts the standard allowed values and the following operators:
131
164
  ### Extended Format Support
132
165
 
133
166
  Ranges in cyclic fields may wrap around (`22-2` is an overnight window, and
134
- `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), and `?` (no specific
135
- 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.
136
168
 
137
169
  ## Options
138
170
 
@@ -142,15 +174,16 @@ The `cronli5` function takes an `options` object as its 2nd parameter:
142
174
  | --- | --- | --- |
143
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). |
144
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). |
145
- | `lang` | English | A language module, e.g. `import es from 'cronli5/lang/es'`. Each language owns its words, conventions, and dialects — see [Languages](#languages). |
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). |
146
178
  | `lenient` | `false` | Never throw: invalid input returns the language's fallback description (`'an unrecognizable cron pattern'`) instead. Useful when rendering arbitrary user crontabs. |
147
- | `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`. |
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`. |
148
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.`). |
149
182
  | `seconds` | `false` | Always treat the first field of strings and arrays as the `second` field. |
150
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. |
151
184
 
152
- When a specific year is given — via a seven-field pattern, an object's
153
- `year` property, or a six-field pattern with `years: true` — it is
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
154
187
  folded into a specific calendar date (`'on January 1, 2030 at noon'`)
155
188
  or otherwise trails the description (`'every Friday at 1 p.m. in 2030'`).
156
189
 
@@ -202,12 +235,19 @@ docs below.
202
235
  | German | `cronli5/lang/de` | Duden (`de-AT`/`de-CH` dialects) | [docs/lang/de.md](./docs/lang/de.md) |
203
236
  | Spanish | `cronli5/lang/es` | RAE / FundéuRAE | [docs/lang/es.md](./docs/lang/es.md) |
204
237
  | Finnish | `cronli5/lang/fi` | Kielitoimiston ohjepankki; SFS 4175 | [docs/lang/fi.md](./docs/lang/fi.md) |
238
+ | French | `cronli5/lang/fr` | Imprimerie nationale / Académie française (fr-FR; fr-CA is a future axis) | [docs/lang/fr.md](./docs/lang/fr.md) |
239
+ | Portuguese | `cronli5/lang/pt` | VOLP / Academia Brasileira de Letras (pt-BR; pt-PT is a future axis) | [docs/lang/pt.md](./docs/lang/pt.md) |
205
240
  | Chinese (Mandarin) | `cronli5/lang/zh` | Simplified (`zh-Hans`) default; Traditional (`zh-Hant`) | [docs/lang/zh.md](./docs/lang/zh.md) |
206
241
 
207
242
  ### Language maturity
208
243
 
209
244
  Languages ship as **experimental** → **beta** → **stable** (model-drafted →
210
- model-validated by a blind persona panel → verified by a fluent human):
245
+ model-validated → verified by a fluent human). A new language is usually built
246
+ by **sibling-derivation** — deriving it from its nearest validated relative
247
+ (porting that renderer and translating its reviewed corpus, then TDD to green) —
248
+ and reaches **beta** once it passes the objective gates (round-trip, fuzz,
249
+ OR-scope, the cRonstrue comparison) and a blind persona-panel review. It
250
+ graduates to **stable** only on fluent-human review:
211
251
 
212
252
  <!-- BEGIN GENERATED: language-status -->
213
253
  | Language | Status |
@@ -216,7 +256,10 @@ model-validated by a blind persona panel → verified by a fluent human):
216
256
  | English | stable |
217
257
  | Spanish | beta |
218
258
  | Finnish | beta |
259
+ | French | beta |
260
+ | Portuguese | beta |
219
261
  | Chinese (Mandarin, Simplified) | beta |
262
+ | Chinese (Mandarin, Simplified) (`zh-Hant`) | experimental |
220
263
  <!-- END GENERATED: language-status -->
221
264
 
222
265
  For the review evidence behind each status, see
@@ -272,9 +315,9 @@ cronli5('0 0 15W * *'); // 'on the weekday nearest the 15th at midnight'
272
315
  [`cRonstrue`][cronstrue] is the most widely used cron-description library, but
273
316
  it differs from `cronli5` in philosophy. `cronli5` writes one flowing sentence
274
317
  and does additional validation; its languages are full renderers
275
- ([four so far](#languages)). cRonstrue assembles per-field fragments from
318
+ ([seven so far](#languages)). cRonstrue assembles per-field fragments from
276
319
  translated templates, which is how it covers 39 locales. The same compound
277
- pattern &mdash; `5,10 30 9 * * MON` &mdash; in every language:
320
+ pattern `5,10 30 9 * * MON` in every language:
278
321
 
279
322
  <!-- BEGIN GENERATED: cronstrue-head-to-head -->
280
323
  | Language | cronli5 | cRonstrue 3.14.0 |
@@ -283,10 +326,16 @@ pattern &mdash; `5,10 30 9 * * MON` &mdash; in every language:
283
326
  | 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
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 |
285
328
  | Finnish | 5 ja 10 sekunnin kohdalla, maanantaisin klo 9.30 | 5 ja 10 sekunnnin jälkeen, 30 minuuttia yli, klo 09:00, vain maanantai |
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 |
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 |
331
+ | Chinese (Simplified) | 每周一,9点30分第5、10秒 | 在一分钟后的第 5 和 10 秒, 在整点后的第 30 分钟, 在上午 09:00, 仅星期一 |
332
+ | Chinese (Traditional) | 每週一,9點30分第5、10秒 | 在一分鐘後的 5 和 10 秒, 在整點後的 30 分, 在 09:00, 僅在 星期一 |
286
333
  <!-- END GENERATED: cronstrue-head-to-head -->
287
334
 
288
335
  See [docs/cronli5-vs-cronstrue.md](./docs/cronli5-vs-cronstrue.md) for
289
- more generated side-by-side output tables.
336
+ more generated side-by-side output tables, and
337
+ [docs/migrating-from-cronstrue.md](./docs/migrating-from-cronstrue.md) if you
338
+ are switching from cRonstrue.
290
339
 
291
340
  ## Description Accuracy
292
341
 
@@ -330,8 +379,9 @@ required.
330
379
 
331
380
  ## Development
332
381
 
333
- The library has no runtime dependencies. The toolchain (ESLint, Vitest, Chai,
334
- esbuild) lives in `devDependencies`.
382
+ The library has no runtime dependencies. Development requires **Node.js 20 or
383
+ newer** (the Vitest 4 test runner needs it); the toolchain (ESLint, Vitest,
384
+ Chai, esbuild) lives in `devDependencies`.
335
385
 
336
386
  ```bash
337
387
  npm install # install dev dependencies (also wires the git hooks)
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 l(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 l(n,"/")?wr(n,r):l(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,m){return Hn(s,e)-Hn(m,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 l(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||l(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||l(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||!l(e[0],"-")?n:Dn(e[0],r)==="*"?"*/"+e[1]:n}function Dn(n,r){if(typeof r.top!="number"||l(n,"/")||!l(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(!l(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 sn(n,r){let{start:e,interval:t,cycle:i}=n,o=i%t===0;return e===0&&o?r.bare():e<t&&o?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!=="*"&&!l(n,",")&&!l(n,"-")&&!l(n,"/")}function an(n){return l(n,"-")&&!l(n,",")&&!l(n,"/")}function Rr(n){return l(n,"/")&&!l(n,",")}function cn(n){return n!=="*"&&!l(n,"-")&&!l(n,"/")}function ln(n){return n!=="*"&&!an(n)&&!Rr(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(l(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 mn(n,r,e){let t=[];return n.split(",").forEach(function(o){if(l(o,"/"))t.push(...Vn(o,r,e));else if(l(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 Ar(n){return cn(n)?n.split(",").map(Number):[0]}function Ur(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(...mn(n,0,59))}function Qr(n){if(Qn(n)&&n!=="0")return+n}function Vr(n,r){return n==="*"?"wildcard":r==="date"&&U(n)||r==="weekday"&&q(n,k.weekday)?"quartz":l(n,",")?"list":l(n,"/")?"step":l(n,"-")?"range":"single"}function Ir(n,r,e){return r==="wildcard"||r==="quartz"?null:n.split(",").map(function(i){if(l(i,"/")){let o=i.split("/");return{fires:Vn(i,e.min,e.top,e.numbers),interval:+o[1],kind:"step",startToken:o[0]}}return l(i,"-")?{bounds:i.split("-"),kind:"range"}:{kind:"single",value:i}})}function In(n){let r={},e={};M.forEach(function(u){r[u]=Vr(n[u],u),e[u]=Ir(n[u],r[u],k[u])});let i={analyses:{clockSecond:Qr(n.second),lastMinuteFire:qr(n.minute),minuteSpan:Ur(n.minute),segments:e},pattern:n,shapes:r};return{...i,plan:$r(i)}}function $r(n){let{analyses:r,pattern:e,shapes:t}=n;if(e.second!=="0"){let i=Jr(e,t,r);if(i)return i}return $n(e,t,r)||Jn(e,t,r)}function Jr(n,r,e){let t=Kr(n,r);return t||(n.hour==="*"&&r.minute==="single"&&n.second!=="*"?{kind:"secondsWithinMinute",singleSecond:r.second==="single"}:r.second==="single"&&cn(n.minute)&&ln(n.hour)?null:{kind:"composeSeconds",rest:$n(n,r,e,!0)||Jn(n,r,e,!0)})}function Kr(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:Gr(n,r,e),kind:"minuteFrequency"};if(r.hour==="single"&&e.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:e.minuteSpan};let i=Zr(n,r);if(i)return i;let o=Yr(n,r);if(o)return o;if(n.hour==="*")return Br(n,r,t)}function fn(n){let[r,e]=n.split("/"),t=r==="*"?0:+r;return r.indexOf("-")===-1&&24%+e===0&&t<+e}function Yr(n,r){return r.hour!=="step"?null:n.minute==="*"?fn(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:V(n.hour)}:r.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:r.minute==="list"&&fn(n.hour)?{form:"list",kind:"minuteSpanAcrossHourStep"}:null}function Gr(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"?fn(n.hour)?{kind:"step"}:{kind:"during",times:V(n.hour)}:{kind:"none"}}function Zr(n,r){return ln(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:V(n.hour)}:r.minute==="range"||r.minute==="list"&&l(n.minute,"-")&&!l(n.minute,"/")?{form:r.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:V(n.hour)}:null:null}function Br(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?Xr(n,r,e):r.hour==="step"&&n.minute==="0"&&!t?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:_r(n,e,i)}function Xr(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 _r(n,r,e=!1){let t=mn(n.hour,0,23),i=Ar(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=mn(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 ne=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],hn=["th","st","nd","rd"],re=[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"]],ee={SUN:P[0],MON:P[1],TUE:P[2],WED:P[3],THU:P[4],FRI:P[5],SAT:P[6]},te=[null,"first","second","third","fourth","fifth"];function ie(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 oe(n,r){let e=ce(n,r);if(e!==null)return Bn(e,n,r);let t=qe(n,r)??Xn(n,n.plan,r),i=K(n,r)?_e(n,r):"";return Bn(i+t,n,r)}function Xn(n,r,e){let t=Qe[r.kind];return t(n,r,e)}function pn(n){return n==="step"||n==="range"||n==="list"}function ue(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 se(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 ae(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 ce(n,r){if(!ue(n,r))return null;let e=se(n,r),t=ae(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 me(n,r,e){let t=n.pattern.second;return g(t,e)+" "+v(t,"second")+" past the minute, every minute"+a(n,e)}function de(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 ge(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 he(n,r,e){return+r.times[0].minute==0&&n.shapes.minute==="single"?D(n,e)+" for one minute at "+ye(n,r,e):D(n,e)+" of "+be(n,r,e)}function pe(n,r,e){let t=ge(n,r,e);return t!==null?t:r.rest.kind==="clockTimes"&&(n.shapes.second==="wildcard"||n.shapes.second==="step")?he(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 ye(n,r,e){let t=r.times.map(function(u){return f({hour:u.hour,minute:0},e)}),i=_(n,Cn,e);return p(t,e)+(i&&", "+i)}function be(n,r,e){let t=r.times.map(function(u){return f({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 Se(n,r,e){return"every minute"+a(n,e)}function ke(n,r,e){let t=n.pattern.minute;return g(t,e)+" "+v(t,"minute")+" past the hour, every hour"+a(n,e)}function Oe(n,r,e){return $(n.pattern.minute,e)+a(n,e)}function Ne(n,r,e){return(H(c(n,"minute"),"minute","hour",e)??z(F(c(n,"minute"),e),"minute","hour",e))+a(n,e)}function ze(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 ve(n,r,e){return n.pattern.minute==="*"?"every minute of the "+f({hour:r.hour,minute:0},e)+" hour"+a(n,e):"every minute from "+f({hour:r.hour,minute:r.span[0]},e)+h(e)+f({hour:r.hour,minute:r.span[1]},e)+a(n,e)}function we(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):Ke(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 "+f({hour:t,minute:0},r)}function Pe(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 Ce(n,r,e){return"every hour"+a(n,e)}function xe(n,r,e){let t=Te(Me(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 Fe(n,r,e){let t=J(n,e);return t!==null?t+a(n,e):or(O(n,"hour"),e)+a(n,e)}function Me(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 "+f({hour:e,minute:0},r);return r.style.untilWindow&&!r.short&&e!==t?o?u+" until "+f({hour:(t+1)%24,minute:0},r):u+h(r)+f({hour:t,minute:0},r):u+h(r)+f({hour:t,minute:i},r)}function Te(n,r){return R({continuous:n.continuous,from:n.from,throughMinute:n.closeMinute,to:n.to},r)}function We(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 f({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)?fr(n,r):""}function He(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 Le(n,r,e)+a(n,e);let m={minute:r.minute,second:n.analyses.clockSecond};return cr(n,e)+"at "+j(n,m,!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 Le(n,r,e){let t=r.minute,i=[],o=er(n).map(function(m){return f({hour:m,minute:t},e)});return c(n,"hour").forEach(function(m){m.kind==="range"&&i.push(R({continuous:!1,from:+m.bounds[0],throughMinute:t,to:+m.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 Ee(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 De(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 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 "+f({hour:t,minute:0},r)+" until "+f({hour:(t+1)%24,minute:0},r):n.pattern.minute!=="*"&&!W(n.pattern.minute)?" at "+f({hour:t,minute:0},r):" of the "+f({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 Re(n){if(n.shapes.hour!=="step")return!0;let r=O(n,"hour");return n.pattern.hour==="*/2"||r.startToken.indexOf("-")!==-1}function Ae(n){if(n.shapes.minute!=="list")return!1;let r=Z(c(n,"minute"));return r!==null&&on(r)!==null}function Ue(n,r){let{minute:e,hour:t}=n.pattern,i=W(e)&&e!=="*";return Re(n)?r.secondLead?i?e==="*/2"&&n.shapes.hour!=="range":!(Ae(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=Ee(n,r);if(!e||!Ue(n,e))return null;let t=e.secondLead?De(n,r):"";return e.text+t+je(n,r)+a(n,r)}var Qe={clockTimes:We,compactClockTimes:He,composeSeconds:pe,everyHour:Ce,everyMinute:Se,everySecond:le,hourRange:xe,hourStep:Fe,minuteFrequency:ze,minuteSpanAcrossHourStep:Pe,minuteSpanInHour:ve,minutesAcrossHours:we,multipleMinutes:Ne,rangeOfMinutes:Oe,secondPastMinute:me,secondsWithinMinute:de,singleMinute:ke,standaloneSeconds:fe};function ir(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,cycle:o},{bare:()=>m,offset:()=>m+" from "+g(t,r)+" "+v(t,u)+" past the "+s,bounded:()=>{let S=wn();return m+" 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 "+f({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,cycle:24},{bare:()=>o,offset:()=>o+" from "+f({hour:e,minute:0},r),bounded:()=>o+" from "+f({hour:e,minute:0},r)+h(r)+f({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)&&Ve(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 Ve(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 Ie(n){return c(n,"hour").some(function(e){return e.kind==="range"})}function $e(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 f({hour:s,minute:0},r)});return i+tr(o,r)}function vn(n,r,e){return r!==0||!Ie(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)+", "+$e(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 Je(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 Je(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 f({hour:o,minute:0,plain:e},r)});return p(t,r)}function Ke(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 Ye(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 Ye(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 f({hour:en,minute:i,second:o,plain:s},t)})):y.kind==="range"?m.push(f({hour:y.bounds[0],minute:i,second:o,plain:s},t)+h(t)+f({hour:y.bounds[1],minute:i,second:o,plain:s},t)):m.push(f({hour:y.value,minute:i,second:o,plain:s},t))}),p(Ge(m,u,e),t)}function Ge(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 Ze(n,r){return ar(n," or ",r)}var Be={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 fr(n,r);let e=_(n,Be,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 tt(n,e);if(t.date!=="*")return Xe(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 Xe(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!=="*"&&!lr(n)?"on the "+Sn(n,e)+dr(n,e):t.month!=="*"?"on "+mr(n,e):"on the "+Sn(n,e)}function lr(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 fr(n,r){let e=[...nt(n,r),...rt(n,r)];return" whenever the day is "+Ze(e,r)}function _e(n,r){return n.pattern.month==="*"?"":"in "+N(n,r)+" "}function nt(n,r){let e=n.pattern.date,t=nn(e,r);if(t)return[t.replace(/^on /,"")];let i=et(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 rt(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(m){i.push("a "+C(m,r))}):i.push("a "+C(u.value,r))}),i}function et(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 tt(n,r){let e=n.pattern,t=xn(e.weekday,r)||"on "+pr(n,!1,r);return e.month!=="*"&&lr(n)&&!nn(e.date,r)&&!E(e.date)?"on "+mr(n,r)+" or "+t+" in "+N(n,r):it(n,r)+" or "+t+ot(n,r)}function it(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 ot(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 "+te[+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 mr(n,r){let e=N(n,r),t=rn(c(n,"date"),r.style.ordinals?b:ut,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 ut(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 st(s,e)}:function(s){return C(s,e)},e)}function st(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+", "+ct(t,e);let i=at(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 at(n,r){return n.indexOf(",")!==-1?p(n.split(","),r):n.indexOf("-")!==-1?n.split("-").join(h(r)):n}function ct(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 f(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,ne,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=re[+n];return e&&e[r.short?1:0]}function C(n,r){let e=n===7||n==="7"?0:n,t=P[e]||ee[e];return t&&t[r.short?1:0]}var mt={describe:oe,fallback:"an unrecognizable cron pattern",options:ie,reboot:"at system startup",sentence:n=>"Runs "+n+(n.endsWith(".")?"":".")},yr=mt;/**
1
+ "use strict";(()=>{var wr={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},vr={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:vr,top:12},weekday:{aliases:{L:"6"},cyclic:!0,max:7,min:0,numbers:wr,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 Wn(n){return F.forEach(function(e){Cr(n[e],k[e],e)}),n}function Cr(n,r,e){typeof n!="string"&&typeof n!="number"&&Tn(n,e);let t=""+n;t!=="*"&&(e==="date"&&q(t)||e==="weekday"&&Q(t,r)||t.split(",").forEach(function(o){xr(o,r)||Tn(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 xr(n,r){return f(n,"/")?Pr(n,r):f(n,"-")?Hn(n,r):E(n,r)}function Pr(n,r){let e=n.split("/");return e.length!==2||!L(e[1])||+e[1]<1?!1:e[0]==="*"||E(e[0],r)||Hn(e[0],r,!0)}function Hn(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 Tn(n,r){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+r+" field.")}var Mr={hour:24,minute:60,second:60};function En(n){F.forEach(function(e){let t=k[e].aliases,i=t&&t[""+n[e]];i&&(n[e]=i)})}function jn(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]=Fr(t,e,k[e])}),n}function Fr(n,r,e){let t=""+n;if(t==="*")return t;let i=Mr[r],o=t.split(",").map(function(s){return Tr(Dn(Er(jr(Dr(Lr(Hr(s,e),e),e),e),e,i),e),e)}).join(",").split(",");return o.indexOf("*")!==-1?"*":G(o).sort(function(s,m){return Ln(s,e)-Ln(m,e)}).join(",")}function Tr(n,r){if(!r.numbers)return n;let e=n.split("/"),t=e[0].split("-").map(function(o){return Wr(o,r)}).join("-");return e.length===2?t+"/"+e[1]:t}function Wr(n,r){if(n==="*")return n;let e=d(n,r.numbers);return""+(e>r.top?r.min:e)}function Hr(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 Lr(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 Er(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 jr(n,r){let e=n.split("/");return e.length!==2||!f(e[0],"-")?n:Dn(e[0],r)==="*"?"*/"+e[1]:n}function Dn(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 Dr(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 Ln(n,r){let e=n.split("/")[0].split("-")[0];return e==="*"?r.min:d(e,r.numbers)}var Rr="`?` is a Quartz token \u2014 pass { quartz: true } to enable Quartz semantics.";function An(n,r){if(!r){Rn(n.date),Rn(n.weekday);return}if(""+n.date=="?"&&(n.date="*"),""+n.weekday=="?"){n.weekday="*";return}n.weekday=Ar(""+n.weekday)}function Rn(n){if(""+n=="?")throw new Error(Rr)}function Ar(n){return n==="*"?n:n.split(",").map(Ur).join(",")}function Ur(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 Un(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 Qr(n);if(typeof n=="string")return Vr(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 Qr(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 Vr(n,r){let e=Ir(n).split(/\s+/);return qn(e,r)}function Ir(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 Qn(n){return n===0?7:n}function Vn(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"?Qn(+t.bounds[0]):Qn(+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 $r(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===$r(e,t,o);return e===0&&u?r.bare():e<t&&u?r.offset():r.bounded()}function In(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 $n(n){return n!=="*"&&!f(n,",")&&!f(n,"-")&&!f(n,"/")}function an(n){return f(n,"-")&&!f(n,",")&&!f(n,"/")}function Jr(n){return f(n,"/")&&!f(n,",")}function cn(n){return n!=="*"&&!f(n,"-")&&!f(n,"/")}function fn(n){return n!=="*"&&!an(n)&&!Jr(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 Jn(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(...Jn(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 Kr(n){return cn(n)?n.split(",").map(Number):[0]}function Yr(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 Gr(n){return n==="*"?59:Math.max(...mn(n,0,59))}function Zr(n){if($n(n)&&n!=="0")return+n}function Br(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 Xr(n,r,e){return r==="wildcard"||r==="quartz"?null:n.split(",").map(function(i){if(f(i,"/")){let o=i.split("/");return{fires:Jn(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 Kn(n){let r={},e={};F.forEach(function(u){r[u]=Br(n[u],u),e[u]=Xr(n[u],r[u],k[u])});let i={analyses:{clockSecond:Zr(n.second),lastMinuteFire:Gr(n.minute),minuteSpan:Yr(n.minute),segments:e},pattern:n,shapes:r};return{...i,plan:_r(i)}}function _r(n){let{analyses:r,pattern:e,shapes:t}=n;if(e.second!=="0"){let i=ne(e,t,r);if(i)return i}return Yn(e,t,r)||Gn(e,t,r)}function ne(n,r,e){let t=re(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:Yn(n,r,e,!0)||Gn(n,r,e,!0)})}function re(n,r){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:r.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function Yn(n,r,e,t=!1){if(r.minute==="step")return{hours:te(n,r,e),kind:"minuteFrequency"};if(r.hour==="single"&&e.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:e.minuteSpan};let i=ie(n,r);if(i)return i;let o=ee(n,r);if(o)return o;if(n.hour==="*")return oe(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 ee(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 te(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 ie(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 oe(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 Gn(n,r,e,t=!1){let i=t&&n.minute==="0";return r.hour==="range"&&!i?ue(n,r,e):r.hour==="step"&&n.minute==="0"&&!t?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:se(n,e,i)}function ue(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 se(n,r,e=!1){let t=mn(n.hour,0,23),i=Kr(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 Zn(n,r){let e=Un(n,r);return An(e,r.quartz),En(e),Wn(e),jn(e)}function v(n){return n=""+n,n.length<2?"0"+n:n}function Bn(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 Xn(n){return typeof n=="object"&&n!==null?{...gn.us,untilWindow:!1,...n}:gn[n==="uk"?"gb":n]||gn.us}var ae=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],hn=["th","st","nd","rd"],ce=[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"]],fe={SUN:C[0],MON:C[1],TUE:C[2],WED:C[3],THU:C[4],FRI:C[5],SAT:C[6]},le=[null,"first","second","third","fourth","fifth"];function me(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:Xn(n.dialect),years:!!n.years}}function de(n,r){let e=ye(n,r);if(e!==null)return nr(e,n,r);let t=Ge(n,r)??rr(n,n.plan,r),i=Y(n,r)?st(n,r):"";return nr(i+t,n,r)}function rr(n,r,e){let t=Ze[r.kind];return t(n,r,e)}function pn(n){return n==="step"||n==="range"||n==="list"}function ge(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 he(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 pe(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 ye(n,r){if(!ge(n,r))return null;let e=he(n,r),t=pe(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 be(n,r,e){return"every second"+a(n,e)}function Se(n,r,e){return D(n,e)+a(n,e)}function ke(n,r,e){let t=n.pattern.second;return g(t,e)+" "+w(t,"second")+" past the minute, every minute"+a(n,e)}function Oe(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 Ne(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 ze(n,r,e){return+r.times[0].minute==0&&n.shapes.minute==="single"?D(n,e)+" for one minute at "+ve(n,r,e):D(n,e)+" of "+Ce(n,r,e)}function we(n,r,e){let t=Ne(n,r,e);return t!==null?t:r.rest.kind==="clockTimes"&&(n.shapes.second==="wildcard"||n.shapes.second==="step")?ze(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)+", ")+rr(n,r.rest,e)}function ve(n,r,e){let t=r.times.map(function(u){return l({hour:u.hour,minute:0},e)}),i=_(n,xn,e);return p(t,e)+(i&&", "+i)}function Ce(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,xn,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 xe(n,r,e){return"every minute"+a(n,e)}function Pe(n,r,e){let t=n.pattern.minute;return g(t,e)+" "+w(t,"minute")+" past the hour, every hour"+a(n,e)}function Me(n,r,e){return J(n.pattern.minute,e)+a(n,e)}function Fe(n,r,e){return(H(c(n,"minute"),"minute","hour",e)??z(M(c(n,"minute"),e),"minute","hour",e))+a(n,e)}function Te(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 r.hours.kind==="window"?t+=" "+A({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 He(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):rt(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 er={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function kn(n,r){let e="during every "+er[n.interval]+" hour",t=n.startToken==="*"?0:+n.startToken;return t===0?e:e+" starting at "+l({hour:t,minute:0},r)}function Le(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(M(c(n,"minute"),e),"minute","hour",e):J(n.pattern.minute,e),o=K(n,e);return i+", "+(o??ar(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 Ee(n,r,e){return"every hour"+a(n,e)}function je(n,r,e){let t=Ae(Re(r),e);return r.minuteForm==="wildcard"?"every minute "+t+a(n,e):r.minuteForm==="range"?J(n.pattern.minute,e)+", "+t+a(n,e):tr(n,e)+" "+t+a(n,e)}function tr(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 De(n,r,e){let t=K(n,e);return t!==null?t+a(n,e):ar(O(n,"hour"),e)+a(n,e)}function Re(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 Ae(n,r){return A({continuous:n.continuous,from:n.from,throughMinute:n.closeMinute,to:n.to},r)}function Ue(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=Cn(r.times),i=r.times.map(function(u){return l({hour:u.hour,minute:u.minute,second:u.second,plain:t},e)});return mr(n,e)+"at "+p(i,e)+ir(n,e)}function ir(n,r){return Y(n,r)?gr(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 Qe(n,r,e)+a(n,e);let m={minute:r.minute,second:n.analyses.clockSecond};return mr(n,e)+"at "+R(n,m,!0,e)+ir(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?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 Qe(n,r,e){let t=r.minute,i=[],o=or(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))}),tr(n,e)+" "+p(i,e)+ur(o,e)}function or(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 ur(n,r){return n.length?" and at "+p(n,r):""}function W(n){return n==="*"||n.startsWith("*/")&&n.indexOf("-")===-1}function Ve(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 Ie(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 $e(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 Je(n){if(n.shapes.hour!=="step")return!0;let r=O(n,"hour");return n.pattern.hour==="*/2"||r.startToken.indexOf("-")!==-1}function Ke(n){if(n.shapes.minute!=="list")return!1;let r=Z(c(n,"minute"));return r!==null&&on(r)!==null}function Ye(n,r){let{minute:e,hour:t}=n.pattern,i=W(e)&&e!=="*";return Je(n)?r.secondLead?i?e==="*/2"&&n.shapes.hour!=="range":!(Ke(n)||n.shapes.minute==="list"&&n.shapes.hour==="list"):t==="*/2"?!0:n.shapes.hour==="single"&&e==="*/2":!1}function Ge(n,r){if(!r.style.untilWindow||r.short||n.pattern.minute==="*"&&n.pattern.hour==="*")return null;let e=Ve(n,r);if(!e||!Ye(n,e))return null;let t=e.secondLead?Ie(n,r):"";return e.text+t+$e(n,r)+a(n,r)}var Ze={clockTimes:Ue,compactClockTimes:qe,composeSeconds:we,everyHour:Ee,everyMinute:xe,everySecond:be,hourRange:je,hourStep:De,minuteFrequency:Te,minuteSpanAcrossHourStep:Le,minuteSpanInHour:We,minutesAcrossHours:He,multipleMinutes:Fe,rangeOfMinutes:Me,secondPastMinute:ke,secondsWithinMinute:Oe,singleMinute:Pe,standaloneSeconds:Se};function sr(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?sr({...o,cycle:60,unit:r,anchor:e},t):null}function X(n,r,e,t){if(n.startToken.indexOf("-")!==-1)return z(_n(n.fires,t),r,e,t);let i=n.startToken==="*"?0:+n.startToken;return i!==0&&n.fires.length<=3?z(_n(n.fires,t),r,e,t):sr({interval:n.interval,start:i,last:n.fires[n.fires.length-1],cycle:60,unit:r,anchor:e},t)}function ar(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&&In(e)}function Nn(n){return n.pattern.second==="*"||n.shapes.second==="step"}function cr(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)&&Be(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):cr(n,r,e)+", "+B(t,e)+a(n,e)}function Be(n){let r=c(n,"hour"),e=r.length===1&&r[0];return!e||e.kind!=="step"||e.startToken.indexOf("-")!==-1||!(e.interval in er)?null:e}function Xe(n){return c(n,"hour").some(function(e){return e.kind==="range"})}function _e(n,r){let e=[],t=or(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+ur(o,r)}function wn(n,r,e){return r!==0||!Xe(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):cr(n,r,e)+", "+_e(n,e)+a(n,e)}function vn(){return function(r){return""+r}}function fr(n,r){return n>1?function(t){return""+t}:function(t){return g(t,r)}}function _n(n,r){return n.map(fr(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=fr(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 nt(n,r,e){return(+n==0||+n==12)&&+r==0&&!(typeof e=="number"&&e>0)}function Cn(n){let r=n.filter(function(t){return nt(t.hour,t.minute,t.second)});return r.length>0&&r.length<n.length}function yn(n,r){let e=Cn(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 rt(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 et(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=Cn(u.flatMap(function(y){return et(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(tt(m,u,e),t)}function tt(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 lr(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 lr(n," and ",r)}function it(n,r){return lr(n," or ",r)}var ot={all:"",month:"in ",recurringWeekday:!0,stepDate:"on ",weekday:"on "},xn={all:"every day",month:"every day in ",recurringWeekday:!1,stepDate:"",weekday:"every "};function a(n,r){if(Y(n,r))return gr(n,r);let e=_(n,ot,r);return e&&" "+e}function mr(n,r){return Y(n,r)?"":_(n,xn,r)+" "}function _(n,r,e){let t=n.pattern;if(t.date!=="*"&&t.weekday!=="*")return lt(n,e);if(t.date!=="*")return ut(n,r,e);if(t.weekday!=="*"){let i=Pn(t.weekday,e);return i?bn(i,n,e):r.weekday+Sr(n,r.recurringWeekday,e)+pr(n,e)}return t.month!=="*"?r.month+N(n,e):r.all}function ut(n,r,e){let t=n.pattern,i=nn(t.date,e);return i?bn(i,n,e):j(t.date)?bn(r.stepDate+yr(t.date),n,e):t.month!=="*"&&!dr(n)?"on the "+Sn(n,e)+pr(n,e):t.month!=="*"?"on "+hr(n,e):"on the "+Sn(n,e)}function dr(n){return!br(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 gr(n,r){let e=[...at(n,r),...ct(n,r)];return" whenever the day is "+it(e,r)}function st(n,r){return n.pattern.month==="*"?"":"in "+N(n,r)+" "}function at(n,r){let e=n.pattern.date,t=nn(e,r);if(t)return[t.replace(/^on /,"")];let i=ft(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 ct(n,r){let e=n.pattern.weekday,t=Pn(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 ft(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 lt(n,r){let e=n.pattern,t=Pn(e.weekday,r)||"on "+Sr(n,!1,r);return e.month!=="*"&&dr(n)&&!nn(e.date,r)&&!j(e.date)?"on "+hr(n,r)+" or "+t+" in "+N(n,r):mt(n,r)+" or "+t+dt(n,r)}function mt(n,r){let e=n.pattern,t=nn(e.date,r);return t||(j(e.date)?yr(e.date):"on the "+Sn(n,r))}function dt(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 Pn(n,r){let e=n.split("#");if(e.length===2)return"on the "+le[+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 hr(n,r){let e=N(n,r),t=rn(c(n,"date"),r.style.ordinals?b:gt,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 gt(n){return""+n}function pr(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 yr(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=br(n.pattern.month);return e||rn(c(n,"month"),function(i){return St(i,r)},r)}function br(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 Sr(n,r,e){let t=Vn(c(n,"weekday")),i=t.some(function(s){return s.kind==="range"});return rn(t,r&&!i?function(s){return ht(s,e)}:function(s){return x(s,e)},e)}function ht(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 nr(n,r,e){let t=r.pattern.year;if(t==="*")return n;if(t.indexOf("/")!==-1)return n+", "+yt(t,e);let i=pt(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 pt(n,r){return n.indexOf(",")!==-1?p(n.split(","),r):n.indexOf("-")!==-1?n.split("-").join(h(r)):n}function yt(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?bt({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 bt(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 Bn(n,ae,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 St(n,r){let e=ce[+n];return e&&e[r.short?1:0]}function x(n,r){let e=n===7||n==="7"?0:n,t=C[e]||fe[e];return t&&t[r.short?1:0]}var kt={describe:de,fallback:"an unrecognizable cron pattern",options:me,reboot:"at system startup",sentence:n=>"Runs "+n+(n.endsWith(".")?"":".")},kr=kt;/**
2
2
  * @license MIT, Copyright (c) 2026 Andrew Brož
3
- */function dt(n,r){let e=r&&r.lang||yr,t=e.options(r);if(!t.lenient)return br(Sr(n,e,t),e,r);try{return br(Sr(n,e,t),e,r)}catch{return e.fallback}}function br(n,r,e){return e&&e.sentence?r.sentence(n):n}function Sr(n,r,e){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return r.reboot;let t=In(Kn(n,e)),i=r.plan?r.plan(t,t.plan):t.plan;return r.describe({...t,plan:i},e)}var Fn=dt;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:Fn});var ti=Fn;})();
3
+ */function Mn(n,r){let e=r&&r.lang||kr,t=e.options(r);if(!t.lenient)return Or(Nr(n,e,t),e,r);try{return Or(Nr(n,e,t),e,r)}catch{return e.fallback}}function Or(n,r,e){return e&&e.sentence?r.sentence(n):n}function Nr(n,r,e){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return r.reboot;let t=Kn(Zn(n,e)),i=r.plan?r.plan(t,t.plan):t.plan;return r.describe({...t,plan:i},e)}function Ot(n,r){return Mn(n,{...r,sentence:!0})}function Nt(n,r){return Mn(n,{...r,sentence:!1})}var zt=Object.assign(Mn,{sentence:Ot,fragment:Nt}),Fn=zt;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:Fn});var pi=Fn;})();
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: { aliases: { "?": "*" }, cyclic: true, max: 31, min: 1, top: 31 },
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: { "?": "*", L: "6" },
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;
@@ -487,13 +534,20 @@ function singleValues(segments) {
487
534
  function offsetCleanStride(stride) {
488
535
  return stride.start < stride.interval && 24 % stride.interval === 0;
489
536
  }
537
+ function lastTileOf(start, interval, cycle) {
538
+ return cycle - 1 - (cycle - 1 - start) % interval;
539
+ }
490
540
  function renderStride(spec, parts) {
491
- const { start, interval, cycle } = spec;
492
- const tiles = cycle % interval === 0;
493
- if (start === 0 && tiles) {
541
+ const { start, interval, last, cycle } = spec;
542
+ const open = cycle % interval === 0 && last === lastTileOf(
543
+ start,
544
+ interval,
545
+ cycle
546
+ );
547
+ if (start === 0 && open) {
494
548
  return parts.bare();
495
549
  }
496
- if (start < interval && tiles) {
550
+ if (start < interval && open) {
497
551
  return parts.offset();
498
552
  }
499
553
  return parts.bounded();
@@ -885,6 +939,7 @@ function hourTimesPlan(hourField) {
885
939
  // src/core/index.ts
886
940
  function prepare(cronPattern, opts) {
887
941
  const pattern = parseCronPattern(cronPattern, opts);
942
+ applyQuartz(pattern, opts.quartz);
888
943
  applyQuartzAliases(pattern);
889
944
  validateCronPattern(pattern);
890
945
  return normalizeCronPattern(pattern);
@@ -1013,6 +1068,7 @@ function normalizeOptions(options) {
1013
1068
  return {
1014
1069
  ampm: typeof options.ampm === "boolean" ? options.ampm : true,
1015
1070
  lenient: !!options.lenient,
1071
+ quartz: !!options.quartz,
1016
1072
  seconds: !!options.seconds,
1017
1073
  short: !!options.short,
1018
1074
  style: resolveDialect(options.dialect),
@@ -1605,7 +1661,7 @@ var renderers = {
1605
1661
  function renderStride2(stride, opts) {
1606
1662
  const { interval, start, last, cycle, unit, anchor } = stride;
1607
1663
  const cadence = "every " + getNumber(interval, opts) + " " + unit + "s";
1608
- return renderStride({ start, interval, cycle }, {
1664
+ return renderStride({ start, interval, last, cycle }, {
1609
1665
  bare: () => cadence,
1610
1666
  // A clean wrap from a non-zero offset: name the start, no endpoint.
1611
1667
  offset: () => cadence + " from " + getNumber(start, opts) + " " + pluralize(start, unit) + " past the " + anchor,
@@ -1656,7 +1712,7 @@ function stepHours(segment, opts) {
1656
1712
  function hourStrideCadence(stride, opts) {
1657
1713
  const { start, interval, last } = stride;
1658
1714
  const cadence = "every " + getNumber(interval, opts) + " hours";
1659
- return renderStride({ start, interval, cycle: 24 }, {
1715
+ return renderStride({ start, interval, last, cycle: 24 }, {
1660
1716
  bare: () => cadence,
1661
1717
  offset: () => cadence + " from " + getTime({ hour: start, minute: 0 }, opts),
1662
1718
  bounded: () => cadence + " from " + getTime({ hour: start, minute: 0 }, opts) + through(opts) + getTime({ hour: last, minute: 0 }, opts)
@@ -2315,7 +2371,14 @@ function interpretCronPattern(cronPattern, lang, opts) {
2315
2371
  const plan = lang.plan ? lang.plan(schedule, schedule.plan) : schedule.plan;
2316
2372
  return lang.describe({ ...schedule, plan }, opts);
2317
2373
  }
2318
- var cronli5_default = cronli5;
2374
+ function sentence(cronPattern, options) {
2375
+ return cronli5(cronPattern, { ...options, sentence: true });
2376
+ }
2377
+ function fragment(cronPattern, options) {
2378
+ return cronli5(cronPattern, { ...options, sentence: false });
2379
+ }
2380
+ var callable = Object.assign(cronli5, { sentence, fragment });
2381
+ var cronli5_default = callable;
2319
2382
  /**
2320
2383
  * @license MIT, Copyright (c) 2026 Andrew Brož
2321
2384
  */