@hebcal/leyning 8.1.0 → 8.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js DELETED
@@ -1,1207 +0,0 @@
1
- /*! @hebcal/leyning v8.1.0 */
2
- 'use strict';
3
-
4
- var core = require('@hebcal/core');
5
-
6
- const Genesis=[0,31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,54,33,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,33,26];const Exodus=[0,22,25,22,31,23,30,29,28,35,29,10,51,22,31,27,36,16,27,25,26,37,30,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,38];const Leviticus=[0,17,16,17,35,26,23,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,46,34];const Numbers=[0,54,34,51,49,31,27,89,26,23,36,35,16,33,45,41,35,28,32,22,29,35,41,30,25,19,65,23,31,39,17,54,42,56,29,34,13];const Deuteronomy=[0,46,37,29,49,30,25,26,20,29,22,32,31,19,29,23,22,20,22,21,20,23,29,26,22,19,19,26,69,28,20,30,52,29,12];const Joshua=[0,18,24,17,24,15,27,26,35,27,43,23,24,33,15,63,10,18,28,51,9,45,34,16,33];const Judges=[0,36,23,31,24,31,40,25,35,57,18,40,15,25,20,20,31,13,31,30,48,25];const Ruth=[0,22,23,18,22];const Isaiah=[0,31,22,26,6,30,13,25,23,20,34,16,6,22,32,9,14,14,7,25,6,17,25,18,23,12,21,13,29,24,33,9,20,24,17,10,22,38,22,8,31,29,25,28,28,25,13,15,22,26,11,23,15,12,17,13,12,21,14,21,22,11,12,19,11,25,24];const Jeremiah=[0,19,37,25,31,31,30,34,23,25,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,21,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34];const Lamentations=[0,22,22,66,22,22];const Baruch=[0,22,35,38,37,9,72];const Esther=[0,22,23,15,17,14,14,10,17,32,3];const Ecclesiastes=[0,18,26,22,17,19,12,29,17,18,20,10,14];const Ezekiel=[0,28,10,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,44,37,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35];const Daniel=[0,21,49,100,34,30,29,28,27,27,21,45,13,64,42];const Hosea=[0,9,25,5,19,15,11,16,14,17,15,11,15,15,10];const Joel=[0,20,27,5,21];const Amos=[0,15,16,15,13,27,14,17,14,15];const Obadiah=[0,21];const Jonah=[0,16,11,10,11];const Micah=[0,16,13,12,14,14,16,20];const Nachum=[0,14,14,19];const Habakkuk=[0,17,20,19];const Zephaniah=[0,18,15,20];const Haggai=[0,15,23];const Zechariah=[0,17,17,10,14,11,15,14,23,17,12,17,14,9,21];const Malachi=[0,14,17,24];var numverses = {Genesis:Genesis,Exodus:Exodus,Leviticus:Leviticus,Numbers:Numbers,Deuteronomy:Deuteronomy,Joshua:Joshua,Judges:Judges,Ruth:Ruth,"I Samuel":[0,28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,42,16,23,28,23,43,25,12,25,11,31,13],"II Samuel":[0,27,32,39,12,25,23,29,18,13,19,27,31,39,33,37,23,29,32,44,26,22,51,39,25],"I Kings":[0,53,46,28,20,32,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,54],"II Kings":[0,18,25,27,44,27,33,20,29,37,36,20,22,25,29,38,20,41,37,37,21,26,20,37,20,30],Isaiah:Isaiah,Jeremiah:Jeremiah,Lamentations:Lamentations,Baruch:Baruch,Esther:Esther,Ecclesiastes:Ecclesiastes,"Song of Songs":[0,17,17,11,16,16,12,14,14],Ezekiel:Ezekiel,Daniel:Daniel,Hosea:Hosea,Joel:Joel,Amos:Amos,Obadiah:Obadiah,Jonah:Jonah,Micah:Micah,Nachum:Nachum,Habakkuk:Habakkuk,Zephaniah:Zephaniah,Haggai:Haggai,Zechariah:Zechariah,Malachi:Malachi};
7
-
8
- /**
9
- * Names of the books of the Torah. BOOK[1] === 'Genesis'
10
- * @readonly
11
- * @const {string[]}
12
- */
13
- const BOOK = ['', 'Genesis', 'Exodus', 'Leviticus', 'Numbers', 'Deuteronomy'];
14
-
15
- /**
16
- * Formats parsha as a string
17
- * @param {string|string[]} parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
18
- * @return {string}
19
- */
20
- function parshaToString(parsha) {
21
- if (typeof parsha === 'string') {
22
- return parsha;
23
- } else if (!Array.isArray(parsha) || parsha.length === 0 || parsha.length > 2) {
24
- throw new TypeError(`Bad parsha argument: ${parsha}`);
25
- }
26
- let s = parsha[0];
27
- if (parsha.length == 2) {
28
- s += '-' + parsha[1];
29
- }
30
- return s;
31
- }
32
-
33
- /**
34
- * Represents an aliyah
35
- * @typedef {Object} Aliyah
36
- * @property {string} k - Book (e.g. "Numbers")
37
- * @property {string} b - beginning verse (e.g. "28:9")
38
- * @property {string} e - ending verse (e.g. "28:15")
39
- * @property {number} [v] - number of verses
40
- * @property {number} [p] - parsha number (1=Bereshit, 54=Vezot HaBracha)
41
- */
42
-
43
- /**
44
- * Makes a deep copy of the src object using JSON stringify and parse
45
- * @param {any} src
46
- * @return {any}
47
- */
48
- function clone(src) {
49
- return JSON.parse(JSON.stringify(src));
50
- }
51
-
52
- /**
53
- * Calculates the number of verses in an aliyah or haftara based on
54
- * the `b` (begin verse), `e` (end verse) and `k` (book).
55
- * Modifies `aliyah` by setting the `v` field.
56
- * @param {Aliyah} aliyah
57
- * @return {number}
58
- */
59
- function calculateNumVerses(aliyah) {
60
- if (aliyah.v) {
61
- return aliyah.v;
62
- }
63
- const chapVerseBegin = aliyah.b.split(':');
64
- const chapVerseEnd = aliyah.e.split(':');
65
- const c1 = parseInt(chapVerseBegin[0], 10);
66
- const c2 = parseInt(chapVerseEnd[0], 10);
67
- const v1 = parseInt(chapVerseBegin[1], 10);
68
- const v2 = parseInt(chapVerseEnd[1], 10);
69
- if (c1 === c2) {
70
- aliyah.v = v2 - v1 + 1;
71
- } else if (typeof aliyah.k === 'string') {
72
- const numv = numverses[aliyah.k];
73
- if (typeof numv !== 'object' || !numv.length) {
74
- throw new ReferenceError(`Can't find numverses for ${aliyah.k}`);
75
- }
76
- let total = numv[c1] - v1 + 1;
77
- for (let chap = c1 + 1; chap < c2; chap++) {
78
- total += numv[chap];
79
- }
80
- total += v2;
81
- aliyah.v = total;
82
- }
83
- return aliyah.v;
84
- }
85
-
86
- /**
87
- * Formats an aliyah object like "Numbers 28:9-28:15"
88
- * @param {Aliyah} a aliyah
89
- * @return {string}
90
- */
91
- function formatAliyahWithBook(a) {
92
- return `${a.k} ${a.b}-${a.e}`;
93
- }
94
-
95
- /**
96
- * Formats an aliyah object like "Numbers 28:9-15"
97
- * @param {Aliyah} aliyah
98
- * @param {boolean} showBook
99
- * @return {string}
100
- */
101
- function formatAliyahShort(aliyah, showBook) {
102
- const begin = aliyah.b;
103
- const end0 = aliyah.e;
104
- const prefix = showBook ? aliyah.k + ' ' : '';
105
- if (begin === end0) {
106
- return `${prefix}${begin}`;
107
- }
108
- const cv1 = begin.split(':');
109
- const cv2 = end0.split(':');
110
- const end = cv1[0] === cv2[0] ? cv2[1] : end0;
111
- return `${prefix}${begin}-${end}`;
112
- }
113
-
114
- /**
115
- * Returns the total number of verses in an array of Aliyah (or haftarah) objects
116
- * @param {Aliyah|Aliyah[]} aliyot
117
- * @return {number}
118
- */
119
- function sumVerses(aliyot) {
120
- return Array.isArray(aliyot) ? aliyot.reduce((prev, cur) => prev + cur.v, 0) : aliyot.v;
121
- }
122
-
123
- /**
124
- * @private
125
- * @param {Aliyah|Aliyah[]} haft
126
- * @return {Aliyah|Aliyah[]}
127
- */
128
- function cloneHaftara(haft) {
129
- if (!haft) {
130
- return haft;
131
- }
132
- const dest = clone(haft);
133
- if (Array.isArray(dest)) {
134
- dest.map(calculateNumVerses);
135
- } else {
136
- calculateNumVerses(dest);
137
- }
138
- return dest;
139
- }
140
-
141
- /**
142
- * @private
143
- * @param {string} a
144
- * @param {string} b
145
- * @return {boolean}
146
- */
147
- function isChapVerseBefore(a, b) {
148
- const cv1 = a.split(':').map(x => +x);
149
- const cv2 = b.split(':').map(x => +x);
150
- return cv1[0] * 100 + cv1[1] < cv2[0] * 100 + cv2[1];
151
- }
152
-
153
- /**
154
- * Summarizes an `AliyotMap` by collapsing all adjacent aliyot.
155
- * Finds any non-overlapping parts (e.g. special 7th aliyah or maftir)
156
- * @param {Object<string,Aliyah>} aliyot
157
- * @return {Aliyah[]}
158
- */
159
- function makeLeyningParts(aliyot) {
160
- const nums = Object.keys(aliyot).filter(x => {
161
- if (x.length === 1) {
162
- return true;
163
- }
164
- const code = x.charCodeAt(0);
165
- return code >= 48 && code <= 57;
166
- });
167
- let start = aliyot[nums[0]];
168
- let end = start;
169
- const parts = [];
170
- for (let i = 0; i < nums.length; i++) {
171
- const num = nums[i];
172
- const aliyah = aliyot[num];
173
- if (i === nums.length - 1 && aliyah.k === end.k && aliyah.e === end.e) {
174
- // short-circuit when final aliyah is within the previous (e.g. M inside of 7)
175
- continue;
176
- }
177
- const prevEndChap = +end.e.split(':')[0];
178
- const curStartChap = +aliyah.b.split(':')[0];
179
- const sameOrNextChap = curStartChap === prevEndChap || curStartChap === prevEndChap + 1;
180
- if (i !== 0 && (aliyah.k !== start.k || isChapVerseBefore(aliyah.b, start.e) || !sameOrNextChap)) {
181
- parts.push({
182
- k: start.k,
183
- b: start.b,
184
- e: end.e
185
- });
186
- start = aliyah;
187
- }
188
- end = aliyah;
189
- }
190
- parts.push({
191
- k: start.k,
192
- b: start.b,
193
- e: end.e
194
- });
195
- return parts;
196
- }
197
-
198
- /**
199
- * Returns a string representation of the leyning parts.
200
- * Separate verse ranges read from the same book are separated
201
- * by commas, e.g. `Isaiah 6:1-7:6, 9:5-6`.
202
- * Verse ranges from different books are separated by semicolons,
203
- * e.g. `Genesis 21:1-34; Numbers 29:1-6`.
204
- * @param {Aliyah|Aliyah[]} parts
205
- * @return {string}
206
- */
207
- function makeSummaryFromParts(parts) {
208
- if (!Array.isArray(parts)) {
209
- parts = [parts];
210
- }
211
- let prev = parts[0];
212
- let summary = formatAliyahShort(prev, true);
213
- for (let i = 1; i < parts.length; i++) {
214
- const part = parts[i];
215
- if (part.k === prev.k) {
216
- summary += ', ';
217
- } else {
218
- summary += `; ${part.k} `;
219
- }
220
- summary += formatAliyahShort(part, false);
221
- prev = part;
222
- }
223
- return summary;
224
- }
225
-
226
- /**
227
- * Makes a summary of the leyning, like "Genesis 6:9-11:32"
228
- * @param {Object<string,Aliyah>} aliyot
229
- * @return {string}
230
- */
231
- function makeLeyningSummary(aliyot) {
232
- const parts = makeLeyningParts(aliyot);
233
- return makeSummaryFromParts(parts);
234
- }
235
-
236
- const Shavuot={note:"Israel only",il:true,megillah:"Ruth",haft:[{k:"Ezekiel",b:"1:1",e:"1:28"},{k:"Ezekiel",b:"3:12",e:"3:12"}],fullkriyah:{"1":{p:17,k:2,b:"19:1",e:"19:6"},"2":{p:17,k:2,b:"19:7",e:"19:13"},"3":{p:17,k:2,b:"19:14",e:"19:19"},"4":{p:17,k:2,b:"19:20",e:"20:14"},"5":{p:17,k:2,b:"20:15",e:"20:23"},M:{p:41,k:4,b:"28:26",e:"28:31"}}};const Purim={megillah:"Esther",fullkriyah:{"1":{p:16,k:2,b:"17:8",e:"17:10"},"2":{p:16,k:2,b:"17:11",e:"17:13"},"3":{p:16,k:2,b:"17:14",e:"17:16"}}};var festivals = {"Pesach I":{haft:{k:"Joshua",b:"5:2",e:"6:1"},fullkriyah:{"1":{p:15,k:2,b:"12:21",e:"12:24"},"2":{p:15,k:2,b:"12:25",e:"12:28"},"3":{p:15,k:2,b:"12:29",e:"12:36"},"4":{p:15,k:2,b:"12:37",e:"12:42"},"5":{p:15,k:2,b:"12:43",e:"12:51"},M:{p:41,k:4,b:"28:16",e:"28:25"}}},"Pesach I (on Shabbat)":{haft:{k:"Joshua",b:"5:2",e:"6:1"},fullkriyah:{"1":{p:15,k:2,b:"12:21",e:"12:24"},"2":{p:15,k:2,b:"12:25",e:"12:28"},"3":{p:15,k:2,b:"12:29",e:"12:32"},"4":{p:15,k:2,b:"12:33",e:"12:36"},"5":{p:15,k:2,b:"12:37",e:"12:42"},"6":{p:15,k:2,b:"12:43",e:"12:47"},"7":{p:15,k:2,b:"12:48",e:"12:51"},M:{p:41,k:4,b:"28:16",e:"28:25"}}},"Pesach II":{haft:[{k:"II Kings",b:"23:1",e:"23:9"},{k:"II Kings",b:"23:21",e:"23:25"}],fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:3"},"2":{p:31,k:3,b:"23:4",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:22"},"4":{p:31,k:3,b:"23:23",e:"23:32"},"5":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"28:16",e:"28:25"}}},"Pesach II (CH''M)":{note:"Israel only - according to Vaani T'fillati Siddur Yisraeli",il:true,fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:8"},"2":{p:31,k:3,b:"23:9",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:44"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 1":{fullkriyah:{"1":{p:15,k:2,b:"13:1",e:"13:4"},"2":{p:15,k:2,b:"13:5",e:"13:10"},"3":{p:15,k:2,b:"13:11",e:"13:16"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 2":{fullkriyah:{"1":{p:18,k:2,b:"22:24",e:"22:26"},"2":{p:18,k:2,b:"22:27",e:"23:5"},"3":{p:18,k:2,b:"23:6",e:"23:19"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 3":{fullkriyah:{"1":{p:21,k:2,b:"34:1",e:"34:10"},"2":{p:21,k:2,b:"34:11",e:"34:17"},"3":{p:21,k:2,b:"34:18",e:"34:26"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 4":{fullkriyah:{"1":{p:36,k:4,b:"9:1",e:"9:5"},"2":{p:36,k:4,b:"9:6",e:"9:8"},"3":{p:36,k:4,b:"9:9",e:"9:14"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Shabbat Chol ha-Moed":{megillah:"Song of Songs",haft:{k:"Ezekiel",b:"37:1",e:"37:14"},fullkriyah:{"1":{p:21,k:2,b:"33:12",e:"33:16"},"2":{p:21,k:2,b:"33:17",e:"33:19"},"3":{p:21,k:2,b:"33:20",e:"33:23"},"4":{p:21,k:2,b:"34:1",e:"34:3"},"5":{p:21,k:2,b:"34:4",e:"34:10"},"6":{p:21,k:2,b:"34:11",e:"34:17"},"7":{p:21,k:2,b:"34:18",e:"34:26"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VII":{haft:{k:"II Samuel",b:"22:1",e:"22:51"},fullkriyah:{"1":{p:16,k:2,b:"13:17",e:"13:22"},"2":{p:16,k:2,b:"14:1",e:"14:8"},"3":{p:16,k:2,b:"14:9",e:"14:14"},"4":{p:16,k:2,b:"14:15",e:"14:25"},"5":{p:16,k:2,b:"14:26",e:"15:26"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VII (on Shabbat)":{haft:{k:"II Samuel",b:"22:1",e:"22:51"},fullkriyah:{"1":{p:16,k:2,b:"13:17",e:"13:19"},"2":{p:16,k:2,b:"13:20",e:"13:22"},"3":{p:16,k:2,b:"14:1",e:"14:4"},"4":{p:16,k:2,b:"14:5",e:"14:8"},"5":{p:16,k:2,b:"14:9",e:"14:14"},"6":{p:16,k:2,b:"14:15",e:"14:25"},"7":{p:16,k:2,b:"14:26",e:"15:26"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VIII":{haft:{k:"Isaiah",b:"10:32",e:"12:6"},fullkriyah:{"1":{p:47,k:5,b:"15:19",e:"15:23"},"2":{p:47,k:5,b:"16:1",e:"16:3"},"3":{p:47,k:5,b:"16:4",e:"16:8"},"4":{p:47,k:5,b:"16:9",e:"16:12"},"5":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VIII (on Shabbat)":{haft:{k:"Isaiah",b:"10:32",e:"12:6"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"15:23"},"4":{p:47,k:5,b:"16:1",e:"16:3"},"5":{p:47,k:5,b:"16:4",e:"16:8"},"6":{p:47,k:5,b:"16:9",e:"16:12"},"7":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach III (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 1"},"Pesach IV (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 2"},"Pesach V (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 3"},"Pesach VI (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 4"},"Pesach Chol ha-Moed Day 2 on Sunday":{alias:true,il:false,key:"Pesach Chol ha-Moed Day 1"},"Pesach Chol ha-Moed Day 3 on Monday":{alias:true,il:false,key:"Pesach Chol ha-Moed Day 2"},Shavuot:Shavuot,"Shavuot I":{haft:[{k:"Ezekiel",b:"1:1",e:"1:28"},{k:"Ezekiel",b:"3:12",e:"3:12"}],fullkriyah:{"1":{p:17,k:2,b:"19:1",e:"19:6"},"2":{p:17,k:2,b:"19:7",e:"19:13"},"3":{p:17,k:2,b:"19:14",e:"19:19"},"4":{p:17,k:2,b:"19:20",e:"20:14"},"5":{p:17,k:2,b:"20:15",e:"20:23"},M:{p:41,k:4,b:"28:26",e:"28:31"}}},"Shavuot II":{megillah:"Ruth",haft:{k:"Habakkuk",b:"3:1",e:"3:19"},fullkriyah:{"1":{p:47,k:5,b:"15:19",e:"15:23"},"2":{p:47,k:5,b:"16:1",e:"16:3"},"3":{p:47,k:5,b:"16:4",e:"16:8"},"4":{p:47,k:5,b:"16:9",e:"16:12"},"5":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:26",e:"28:31"}}},"Shavuot II (on Shabbat)":{megillah:"Ruth",haft:{k:"Habakkuk",b:"3:1",e:"3:19"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"15:23"},"4":{p:47,k:5,b:"16:1",e:"16:3"},"5":{p:47,k:5,b:"16:4",e:"16:8"},"6":{p:47,k:5,b:"16:9",e:"16:12"},"7":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:26",e:"28:31"}}},"Fast Day (Morning)":{fullkriyah:{"1":{p:21,k:2,b:"32:11",e:"32:14"},"2":{p:21,k:2,b:"34:1",e:"34:3"},"3":{p:21,k:2,b:"34:4",e:"34:10"}}},"Fast Day (Afternoon)":{haft:{k:"Isaiah",b:"55:6",e:"56:8"},fullkriyah:{"1":{p:21,k:2,b:"32:11",e:"32:14"},"2":{p:21,k:2,b:"34:1",e:"34:3"},M:{p:21,k:2,b:"34:4",e:"34:10"}}},"Asara B'Tevet":{alias:true,key:"Fast Day (Morning)"},"Ta'anit Esther":{alias:true,key:"Fast Day (Morning)"},"Tzom Gedaliah":{alias:true,key:"Fast Day (Morning)"},"Tzom Tammuz":{alias:true,key:"Fast Day (Morning)"},"Asara B'Tevet (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Ta'anit Esther (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Tzom Gedaliah (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Tzom Tammuz (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Erev Tish'a B'Av":{megillah:"Lamentations"},"Tish'a B'Av":{haft:{k:"Jeremiah",b:"8:13",e:"9:23"},fullkriyah:{"1":{p:45,k:5,b:"4:25",e:"4:29"},"2":{p:45,k:5,b:"4:30",e:"4:35"},"3":{p:45,k:5,b:"4:36",e:"4:40"}}},"Tish'a B'Av (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Rosh Hashana I":{haft:{k:"I Samuel",b:"1:1",e:"2:10"},fullkriyah:{"1":{p:4,k:1,b:"21:1",e:"21:4"},"2":{p:4,k:1,b:"21:5",e:"21:12"},"3":{p:4,k:1,b:"21:13",e:"21:21"},"4":{p:4,k:1,b:"21:22",e:"21:27"},"5":{p:4,k:1,b:"21:28",e:"21:34"},M:{p:41,k:4,b:"29:1",e:"29:6"}}},"Rosh Hashana I (on Shabbat)":{haft:{k:"I Samuel",b:"1:1",e:"2:10"},fullkriyah:{"1":{p:4,k:1,b:"21:1",e:"21:4"},"2":{p:4,k:1,b:"21:5",e:"21:8"},"3":{p:4,k:1,b:"21:9",e:"21:12"},"4":{p:4,k:1,b:"21:13",e:"21:17"},"5":{p:4,k:1,b:"21:18",e:"21:21"},"6":{p:4,k:1,b:"21:22",e:"21:27"},"7":{p:4,k:1,b:"21:28",e:"21:34"},M:{p:41,k:4,b:"29:1",e:"29:6"}}},"Rosh Hashana II":{haft:{k:"Jeremiah",b:"31:1",e:"31:19"},fullkriyah:{"1":{p:4,k:1,b:"22:1",e:"22:3"},"2":{p:4,k:1,b:"22:4",e:"22:8"},"3":{p:4,k:1,b:"22:9",e:"22:14"},"4":{p:4,k:1,b:"22:15",e:"22:19"},"5":{p:4,k:1,b:"22:20",e:"22:24"},M:{p:41,k:4,b:"29:1",e:"29:6"}}},"Yom Kippur":{haft:{k:"Isaiah",b:"57:14",e:"58:14"},fullkriyah:{"1":{p:29,k:3,b:"16:1",e:"16:6"},"2":{p:29,k:3,b:"16:7",e:"16:11"},"3":{p:29,k:3,b:"16:12",e:"16:17"},"4":{p:29,k:3,b:"16:18",e:"16:24"},"5":{p:29,k:3,b:"16:25",e:"16:30"},"6":{p:29,k:3,b:"16:31",e:"16:34"},M:{p:41,k:4,b:"29:7",e:"29:11"}}},"Yom Kippur (on Shabbat)":{haft:{k:"Isaiah",b:"57:14",e:"58:14"},fullkriyah:{"1":{p:29,k:3,b:"16:1",e:"16:3"},"2":{p:29,k:3,b:"16:4",e:"16:6"},"3":{p:29,k:3,b:"16:7",e:"16:11"},"4":{p:29,k:3,b:"16:12",e:"16:17"},"5":{p:29,k:3,b:"16:18",e:"16:24"},"6":{p:29,k:3,b:"16:25",e:"16:30"},"7":{p:29,k:3,b:"16:31",e:"16:34"},M:{p:41,k:4,b:"29:7",e:"29:11"}}},"Yom Kippur (Mincha)":{alias:true,key:"Yom Kippur (Mincha, Traditional)"},"Yom Kippur (Mincha, Traditional)":{haft:[{k:"Jonah",b:"1:1",e:"4:11"},{k:"Micah",b:"7:18",e:"7:20"}],fullkriyah:{"1":{p:29,k:3,b:"18:1",e:"18:5"},"2":{p:29,k:3,b:"18:6",e:"18:21"},M:{p:29,k:3,b:"18:22",e:"18:30"}}},"Yom Kippur (Mincha, Alternate)":{haft:[{k:"Jonah",b:"1:1",e:"4:11"},{k:"Micah",b:"7:18",e:"7:20"}],fullkriyah:{"1":{p:30,k:3,b:"19:1",e:"19:4"},"2":{p:30,k:3,b:"19:5",e:"19:10"},M:{p:30,k:3,b:"19:11",e:"19:18"}}},"Sukkot I":{haft:{k:"Zechariah",b:"14:1",e:"14:21"},fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:3"},"2":{p:31,k:3,b:"23:4",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:22"},"4":{p:31,k:3,b:"23:23",e:"23:32"},"5":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"29:12",e:"29:16"}}},"Sukkot I (on Shabbat)":{haft:{k:"Zechariah",b:"14:1",e:"14:21"},fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"22:33"},"2":{p:31,k:3,b:"23:1",e:"23:3"},"3":{p:31,k:3,b:"23:4",e:"23:8"},"4":{p:31,k:3,b:"23:9",e:"23:14"},"5":{p:31,k:3,b:"23:15",e:"23:22"},"6":{p:31,k:3,b:"23:23",e:"23:32"},"7":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"29:12",e:"29:16"}}},"Sukkot II":{haft:{k:"I Kings",b:"8:2",e:"8:21"},fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:3"},"2":{p:31,k:3,b:"23:4",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:22"},"4":{p:31,k:3,b:"23:23",e:"23:32"},"5":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"29:12",e:"29:16"}}},"Sukkot Chol ha-Moed Day 1":{fullkriyah:{"1":{p:41,k:4,b:"29:17",e:"29:19"},"2":{p:41,k:4,b:"29:20",e:"29:22"},"3":{p:41,k:4,b:"29:23",e:"29:25"},"4":{p:41,k:4,b:"29:17",e:"29:22"}}},"Sukkot Chol ha-Moed Day 2":{fullkriyah:{"1":{p:41,k:4,b:"29:20",e:"29:22"},"2":{p:41,k:4,b:"29:23",e:"29:25"},"3":{p:41,k:4,b:"29:26",e:"29:28"},"4":{p:41,k:4,b:"29:20",e:"29:25"}}},"Sukkot Chol ha-Moed Day 3":{fullkriyah:{"1":{p:41,k:4,b:"29:23",e:"29:25"},"2":{p:41,k:4,b:"29:26",e:"29:28"},"3":{p:41,k:4,b:"29:29",e:"29:31"},"4":{p:41,k:4,b:"29:23",e:"29:28"}}},"Sukkot Chol ha-Moed Day 4":{fullkriyah:{"1":{p:41,k:4,b:"29:26",e:"29:28"},"2":{p:41,k:4,b:"29:29",e:"29:31"},"3":{p:41,k:4,b:"29:32",e:"29:34"},"4":{p:41,k:4,b:"29:26",e:"29:31"}}},"Sukkot Chol ha-Moed Day 5":{fullkriyah:{"1":{p:41,k:4,b:"29:29",e:"29:31"},"2":{p:41,k:4,b:"29:32",e:"29:34"},"3":{p:41,k:4,b:"29:35",e:"29:37"},"4":{p:41,k:4,b:"29:29",e:"29:34"}}},"Sukkot Shabbat Chol ha-Moed":{megillah:"Ecclesiastes",haft:{k:"Ezekiel",b:"38:18",e:"39:16"},fullkriyah:{"1":{p:21,k:2,b:"33:12",e:"33:16"},"2":{p:21,k:2,b:"33:17",e:"33:19"},"3":{p:21,k:2,b:"33:20",e:"33:23"},"4":{p:21,k:2,b:"34:1",e:"34:3"},"5":{p:21,k:2,b:"34:4",e:"34:10"},"6":{p:21,k:2,b:"34:11",e:"34:17"},"7":{p:21,k:2,b:"34:18",e:"34:26"},"M-day1":{p:41,k:4,b:"29:17",e:"29:22"},"M-day2":{p:41,k:4,b:"29:20",e:"29:25"},"M-day3":{p:41,k:4,b:"29:23",e:"29:28"},"M-day4":{p:41,k:4,b:"29:26",e:"29:31"},"M-day5":{p:41,k:4,b:"29:29",e:"29:34"}}},"Sukkot Final Day (Hoshana Raba)":{fullkriyah:{"1":{p:41,k:4,b:"29:26",e:"29:28"},"2":{p:41,k:4,b:"29:29",e:"29:31"},"3":{p:41,k:4,b:"29:32",e:"29:34"},"4":{p:41,k:4,b:"29:29",e:"29:34"}}},"Shmini Atzeret":{haft:{k:"I Kings",b:"8:54",e:"8:66"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"16:3"},"4":{p:47,k:5,b:"16:4",e:"16:8"},"5":{p:47,k:5,b:"16:9",e:"16:17"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Shmini Atzeret (on Shabbat)":{haft:{k:"I Kings",b:"8:54",e:"8:66"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"15:23"},"4":{p:47,k:5,b:"16:1",e:"16:3"},"5":{p:47,k:5,b:"16:4",e:"16:8"},"6":{p:47,k:5,b:"16:9",e:"16:12"},"7":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Erev Simchat Torah":{fullkriyah:{"1":{p:54,k:5,b:"33:1",e:"33:7"},"2":{p:54,k:5,b:"33:8",e:"33:12"},"3":{p:54,k:5,b:"33:13",e:"33:17"}}},"Simchat Torah":{haft:{k:"Joshua",b:"1:1",e:"1:18"},fullkriyah:{"1":{p:54,k:5,b:"33:1",e:"33:7"},"2":{p:54,k:5,b:"33:8",e:"33:12"},"3":{p:54,k:5,b:"33:13",e:"33:17"},"4":{p:54,k:5,b:"33:18",e:"33:21"},"5":{p:54,k:5,b:"33:22",e:"33:26"},"6":{p:54,k:5,b:"33:27",e:"34:12"},"7":{p:1,k:1,b:"1:1",e:"2:3"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Shabbat Rosh Chodesh Chanukah":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{"7":{p:41,k:4,b:"28:9",e:"28:15"},M:{p:35,k:4,b:"7:42",e:"7:47"}}},"Chanukah Day 1":{fullkriyah:{"1":{p:35,k:4,b:"7:1",e:"7:11"},"2":{p:35,k:4,b:"7:12",e:"7:14"},"3":{p:35,k:4,b:"7:15",e:"7:17"}},alt:{"1":{p:35,k:4,b:"7:1",e:"7:3"},"2":{p:35,k:4,b:"7:4",e:"7:11"},"3":{p:35,k:4,b:"7:12",e:"7:17"}}},"Chanukah Day 1 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:1",e:"7:17"}}},"Chanukah Day 2":{fullkriyah:{"1":{p:35,k:4,b:"7:18",e:"7:20"},"2":{p:35,k:4,b:"7:21",e:"7:23"},"3":{p:35,k:4,b:"7:24",e:"7:29"}},alt:{"1":{p:35,k:4,b:"7:18",e:"7:20"},"2":{p:35,k:4,b:"7:21",e:"7:23"},"3":{p:35,k:4,b:"7:18",e:"7:23"}}},"Chanukah Day 2 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:18",e:"7:23"}}},"Chanukah Day 3":{fullkriyah:{"1":{p:35,k:4,b:"7:24",e:"7:26"},"2":{p:35,k:4,b:"7:27",e:"7:29"},"3":{p:35,k:4,b:"7:30",e:"7:35"}},alt:{"1":{p:35,k:4,b:"7:24",e:"7:26"},"2":{p:35,k:4,b:"7:27",e:"7:29"},"3":{p:35,k:4,b:"7:24",e:"7:29"}}},"Chanukah Day 3 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:24",e:"7:29"}}},"Chanukah Day 4":{fullkriyah:{"1":{p:35,k:4,b:"7:30",e:"7:32"},"2":{p:35,k:4,b:"7:33",e:"7:35"},"3":{p:35,k:4,b:"7:36",e:"7:41"}},alt:{"1":{p:35,k:4,b:"7:30",e:"7:32"},"2":{p:35,k:4,b:"7:33",e:"7:35"},"3":{p:35,k:4,b:"7:30",e:"7:35"}}},"Chanukah Day 4 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:30",e:"7:35"}}},"Chanukah Day 5":{fullkriyah:{"1":{p:35,k:4,b:"7:36",e:"7:38"},"2":{p:35,k:4,b:"7:39",e:"7:41"},"3":{p:35,k:4,b:"7:42",e:"7:47"}},alt:{"1":{p:35,k:4,b:"7:36",e:"7:38"},"2":{p:35,k:4,b:"7:39",e:"7:41"},"3":{p:35,k:4,b:"7:36",e:"7:41"}}},"Chanukah Day 5 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:36",e:"7:41"}}},"Chanukah Day 6":{fullkriyah:{"1":{p:41,k:4,b:"28:1",e:"28:5"},"2":{p:41,k:4,b:"28:6",e:"28:10"},"3":{p:41,k:4,b:"28:11",e:"28:15"},"4":{p:35,k:4,b:"7:42",e:"7:47"}}},"Chanukah Day 7":{fullkriyah:{"1":{p:35,k:4,b:"7:48",e:"7:50"},"2":{p:35,k:4,b:"7:51",e:"7:53"},"3":{p:35,k:4,b:"7:54",e:"7:59"}},alt:{"1":{p:35,k:4,b:"7:48",e:"7:50"},"2":{p:35,k:4,b:"7:51",e:"7:53"},"3":{p:35,k:4,b:"7:48",e:"7:53"}}},"Chanukah Day 7 (on Rosh Chodesh)":{fullkriyah:{"1":{p:41,k:4,b:"28:1",e:"28:5"},"2":{p:41,k:4,b:"28:6",e:"28:10"},"3":{p:41,k:4,b:"28:11",e:"28:15"},"4":{p:35,k:4,b:"7:48",e:"7:53"}}},"Chanukah Day 7 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:48",e:"7:53"}}},"Chanukah Day 8":{fullkriyah:{"1":{p:35,k:4,b:"7:54",e:"7:56"},"2":{p:35,k:4,b:"7:57",e:"7:59"},"3":{p:35,k:4,b:"7:60",e:"8:4"}}},"Chanukah Day 8 (on Shabbat)":{haft:{k:"I Kings",b:"7:40",e:"7:50"},fullkriyah:{M:{p:35,k:4,b:"7:54",e:"8:4"}}},"Erev Purim":{megillah:"Esther"},Purim:Purim,"Shushan Purim":{note:"Jerusalem & walled cities only",il:true,megillah:"Esther",fullkriyah:{"1":{p:16,k:2,b:"17:8",e:"17:10"},"2":{p:16,k:2,b:"17:11",e:"17:13"},"3":{p:16,k:2,b:"17:14",e:"17:16"}}},"Shushan Purim (on Shabbat)":{il:true,note:"Jerusalem & walled cities only: special maftir Exodus 17:8-16, same Haftara as Shabbat Zachor"},"Shabbat HaChodesh":{haft:{k:"Ezekiel",b:"45:16",e:"46:18"},fullkriyah:{M:{p:15,k:2,b:"12:1",e:"12:20"}}},"Shabbat HaChodesh (on Rosh Chodesh)":{haft:{k:"Ezekiel",b:"45:16",e:"46:18"},fullkriyah:{"7":{p:41,k:4,b:"28:9",e:"28:15"},M:{p:15,k:2,b:"12:1",e:"12:20"}}},"Shabbat HaGadol":{haft:{k:"Malachi",b:"3:4",e:"3:24"}},"Shabbat Parah":{haft:{k:"Ezekiel",b:"36:16",e:"36:38"},fullkriyah:{M:{p:39,k:4,b:"19:1",e:"19:22"}}},"Shabbat Shekalim":{haft:{k:"II Kings",b:"12:1",e:"12:17"},fullkriyah:{M:{p:21,k:2,b:"30:11",e:"30:16"}}},"Shabbat Shekalim (on Rosh Chodesh)":{haft:{k:"II Kings",b:"12:1",e:"12:17"},fullkriyah:{"7":{p:41,k:4,b:"28:9",e:"28:15"},M:{p:21,k:2,b:"30:11",e:"30:16"}}},"Shabbat Shuva (with Vayeilech)":{haft:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Micah",b:"7:18",e:"7:20"}]},"Shabbat Shuva (with Ha'azinu)":{haft:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Joel",b:"2:15",e:"2:27"}],seph:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Micah",b:"7:18",e:"7:20"}]},"Shabbat Shuva":{haft:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Micah",b:"7:18",e:"7:20"},{k:"Joel",b:"2:15",e:"2:27"}]},"Shabbat Zachor":{haft:{k:"I Samuel",b:"15:2",e:"15:34"},fullkriyah:{M:{p:49,k:5,b:"25:17",e:"25:19"}}},"Pinchas occurring after 17 Tammuz":{haft:{k:"Jeremiah",b:"1:1",e:"2:3"}},"Masei on Shabbat Rosh Chodesh":{haft:[{k:"Jeremiah",b:"2:4",e:"2:28"},{k:"Jeremiah",b:"3:4",e:"3:4"},{k:"Isaiah",b:"66:1",e:"66:1"},{k:"Isaiah",b:"66:23",e:"66:23"}]},"Matot-Masei on Shabbat Rosh Chodesh":{alias:true,key:"Masei on Shabbat Rosh Chodesh"},"Ki Teitzei with 3rd Haftarah of Consolation":{haft:[{k:"Isaiah",b:"54:1",e:"54:10"},{k:"Isaiah",b:"54:11",e:"55:5"}]},"Rosh Chodesh":{fullkriyah:{"1":{p:41,k:4,b:"28:1",e:"28:3"},"2":{p:41,k:4,b:"28:3",e:"28:5"},"3":{p:41,k:4,b:"28:6",e:"28:10"},"4":{p:41,k:4,b:"28:11",e:"28:15"}}},"Rosh Chodesh Nisan":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Iyyar":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Sivan":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Tamuz":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Av":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Elul":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Tishrei":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Cheshvan":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Kislev":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Sh'vat":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Adar":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Adar I":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Adar II":{alias:true,key:"Rosh Chodesh"},"Shabbat Rosh Chodesh":{haft:{k:"Isaiah",b:"66:1",e:"66:24"},fullkriyah:{M:{p:41,k:4,b:"28:9",e:"28:15"}}},"Shabbat Machar Chodesh":{haft:{k:"I Samuel",b:"20:18",e:"20:42"}}};
237
-
238
- /**
239
- * Is there a special festival Torah Reading for `holiday`?
240
- * @param {string} holiday
241
- * @return {boolean}
242
- */
243
- function hasFestival(holiday) {
244
- return typeof festivals[holiday] === 'object';
245
- }
246
-
247
- /**
248
- * Returns the raw metadata for festival reading for `holiday`
249
- * @param {string} holiday
250
- * @return {any}
251
- */
252
- function lookupFestival(holiday) {
253
- let src = festivals[holiday];
254
- if (typeof src === 'undefined') {
255
- return undefined;
256
- }
257
- if (src.alias) {
258
- const tmp = festivals[src.key];
259
- if (typeof tmp === 'undefined') {
260
- throw new Error(`Leyning alias ${holiday} => ${src.key} not found`);
261
- }
262
- src = tmp;
263
- }
264
- const result = src.fullkriyah ? clone(src) : src;
265
- if (result.fullkriyah) {
266
- for (const aliyah of Object.values(result.fullkriyah)) {
267
- if (typeof aliyah.k === 'number') {
268
- aliyah.k = BOOK[aliyah.k];
269
- }
270
- }
271
- }
272
- if (src.note) {
273
- result.note = src.note;
274
- }
275
- return result;
276
- }
277
-
278
- const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT | core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT | core.flags.HEBREW_DATE | core.flags.MISHNA_YOMI | core.flags.MODERN_HOLIDAY | core.flags.YERUSHALMI_YOMI;
279
-
280
- /**
281
- * Based on the event date, type and title, finds the relevant leyning key
282
- * @param {Event} ev event
283
- * @param {boolean} [il] true if Israel holiday scheme
284
- * @return {string} key to look up in holiday-reading.json
285
- */
286
- function getLeyningKeyForEvent(ev, il = false) {
287
- if (typeof ev.eventTime !== 'undefined') {
288
- return undefined;
289
- }
290
- const mask = ev.getFlags();
291
- if (mask & HOLIDAY_IGNORE_MASK) {
292
- return undefined;
293
- }
294
- // Skip all Erevs except for Simchat Torah
295
- const desc = ev.getDesc();
296
- if (mask & core.flags.EREV && !hasFestival(desc)) {
297
- return undefined;
298
- }
299
- const hd = ev.getDate();
300
- const day = hd.getDate();
301
- const dow = hd.abs() % 7;
302
- const month = hd.getMonth();
303
- const isShabbat = dow == 6;
304
- const isRoshChodesh = day == 1 || day == 30;
305
- const holiday = ev.basename();
306
- const isPesach = holiday === 'Pesach';
307
- if (il && isPesach) {
308
- if (isShabbat) {
309
- return day === 15 || day === 21 ? desc + ' (on Shabbat)' : 'Pesach Shabbat Chol ha-Moed';
310
- }
311
- return desc;
312
- }
313
- const cholHaMoedDay = ev.cholHaMoedDay;
314
- if (day == 1 && month === core.months.TISHREI) {
315
- return isShabbat ? 'Rosh Hashana I (on Shabbat)' : 'Rosh Hashana I';
316
- } else if (cholHaMoedDay) {
317
- // Sukkot or Pesach
318
- if (isShabbat) {
319
- return holiday + ' Shabbat Chol ha-Moed';
320
- } else if (desc == 'Sukkot VII (Hoshana Raba)') {
321
- return 'Sukkot Final Day (Hoshana Raba)';
322
- }
323
- if (isPesach && cholHaMoedDay) {
324
- if (dow === 0 && desc === 'Pesach IV (CH\'\'M)') {
325
- return 'Pesach Chol ha-Moed Day 2 on Sunday';
326
- } else if (dow === 1 && desc === 'Pesach V (CH\'\'M)') {
327
- return 'Pesach Chol ha-Moed Day 3 on Monday';
328
- }
329
- }
330
- return `${holiday} Chol ha-Moed Day ${cholHaMoedDay}`;
331
- } else if (ev.chanukahDay) {
332
- if (isShabbat && isRoshChodesh) {
333
- return 'Shabbat Rosh Chodesh Chanukah';
334
- } else if (isRoshChodesh && ev.chanukahDay == 7) {
335
- return `Chanukah Day 7 (on Rosh Chodesh)`;
336
- } else if (isShabbat) {
337
- return `Chanukah Day ${ev.chanukahDay} (on Shabbat)`;
338
- } else {
339
- return `Chanukah Day ${ev.chanukahDay}`;
340
- }
341
- }
342
- if (isRoshChodesh && (desc == 'Shabbat HaChodesh' || desc == 'Shabbat Shekalim')) {
343
- return desc + ' (on Rosh Chodesh)';
344
- }
345
- if (il && desc == 'Shmini Atzeret') {
346
- return 'Simchat Torah';
347
- }
348
- if (desc === 'Chag HaBanot') {
349
- return undefined;
350
- }
351
- if (isShabbat && 'Shabbat' != desc.substring(0, 7)) {
352
- if (isRoshChodesh) {
353
- if (desc === 'Rosh Chodesh Tevet') {
354
- return 'Shabbat Rosh Chodesh Chanukah';
355
- }
356
- return 'Shabbat Rosh Chodesh';
357
- }
358
- const desc2 = desc + ' (on Shabbat)';
359
- if (hasFestival(desc2)) {
360
- return desc2;
361
- }
362
- }
363
- if (hasFestival(desc)) {
364
- return desc;
365
- }
366
- if (isShabbat) {
367
- const tommorow = hd.next().getDate();
368
- if (tommorow === 30 || tommorow === 1) {
369
- return 'Shabbat Machar Chodesh';
370
- }
371
- }
372
- if (desc === 'Rosh Hashana LaBehemot') {
373
- return undefined;
374
- }
375
- if (desc === 'Rosh Chodesh Tevet') {
376
- if (isShabbat) {
377
- return 'Shabbat Rosh Chodesh Chanukah';
378
- }
379
- if (day === 30 || core.HDate.shortKislev(hd.getFullYear())) {
380
- return 'Chanukah Day 6'; // 30th of Kislev or 1st of Tevet
381
- } else {
382
- return 'Chanukah Day 7 (on Rosh Chodesh)'; // 1st of Tevet
383
- }
384
- }
385
- if (isRoshChodesh) {
386
- return desc;
387
- }
388
- if (desc === 'Tish\'a B\'Av (observed)') {
389
- return 'Tish\'a B\'Av';
390
- }
391
- return undefined;
392
- }
393
-
394
- /**
395
- * Leyning for a parsha hashavua or holiday
396
- * @typedef {Object} SpecialReading
397
- * @property {Object<string,Aliyah>} aliyot - Map of aliyot `1` through `7` plus `M` for maftir
398
- * @property {Object<string,string>} [reason] - Explanations for special readings,
399
- * keyed by aliyah number, `M` for maftir or `haftara` for Haftarah
400
- * @property {Aliyah|Aliyah[]} haft - Haftarah object(s)
401
- * @property {Aliyah|Aliyah[]} seph - Haftarah object(s)
402
- */
403
-
404
- /**
405
- * @private
406
- * @param {Object<string,Aliyah>} aliyot
407
- */
408
- function aliyotCombine67(aliyot) {
409
- const a6 = clone(aliyot['6']);
410
- const a7 = aliyot['7'];
411
- if (a6.k !== a7.k) {
412
- throw new Error('Impossible to combine aliyot 6 & 7: ' + JSON.stringify(aliyot));
413
- }
414
- delete aliyot['7'];
415
- aliyot['6'] = {
416
- k: a6.k,
417
- b: a6.b,
418
- e: a7.e
419
- };
420
- if (a6.v && a7.v) {
421
- aliyot['6'].v = a6.v + a7.v;
422
- }
423
- }
424
-
425
- /**
426
- * @private
427
- * @param {Object<string,Aliyah>} aliyot
428
- * @param {Object<string,Aliyah>} special
429
- */
430
- function mergeAliyotWithSpecial(aliyot, special) {
431
- if (special['7']) {
432
- aliyotCombine67(aliyot);
433
- aliyot['7'] = clone(special['7']);
434
- calculateNumVerses(aliyot['7']);
435
- }
436
- if (special['M']) {
437
- aliyot['M'] = clone(special['M']);
438
- calculateNumVerses(aliyot['M']);
439
- }
440
- }
441
-
442
- /**
443
- * Determines if the regular parashat haShavua coincides with an event that requires
444
- * a special maftir or Haftara (for example Shabbat HaGadol, Shabbat Chanukah, Rosh
445
- * Chodesh or Machar Chodesh, etc.).
446
- *
447
- * This function does not modify `aliyot`. Instead, it returns a deep copy
448
- * with `aliyot['M']` replaced and sets `reason.M`
449
- * (and in some cases the 6th and 7th aliyah, setting `reason['7']`).
450
- *
451
- * If a special Haftarah applies, the result will have a `haft` property
452
- * pointing to Haftarah object and sets `reason.haftara`.
453
- * @param {string[]} parsha
454
- * @param {HDate} hd
455
- * @param {boolean} il
456
- * @param {Object<string,Aliyah>} aliyot
457
- * @return {SpecialReading}
458
- */
459
- function specialReadings2(parsha, hd, il, aliyot) {
460
- let haft;
461
- let seph;
462
- let specialHaft = false;
463
- const reason = {};
464
-
465
- // eslint-disable-next-line require-jsdoc
466
- function handleSpecial(key) {
467
- const special = lookupFestival(key);
468
- if (!special) {
469
- return;
470
- }
471
- if (typeof special.il === 'boolean' && il !== special.il) {
472
- return;
473
- }
474
- if (special.haft && !specialHaft) {
475
- haft = cloneHaftara(special.haft);
476
- reason.haftara = key;
477
- specialHaft = true;
478
- if (special.seph) {
479
- seph = cloneHaftara(special.seph);
480
- reason.sephardic = key;
481
- }
482
- }
483
- if (special.fullkriyah) {
484
- const aliyotMap = clone(aliyot);
485
- mergeAliyotWithSpecial(aliyotMap, special.fullkriyah);
486
- for (const num of Object.keys(special.fullkriyah)) {
487
- reason[num] = key;
488
- }
489
- aliyot = aliyotMap;
490
- }
491
- }
492
- const parshaName = parshaToString(parsha);
493
- const events0 = core.HebrewCalendar.getHolidaysOnDate(hd, il) || [];
494
- const events = events0.filter(ev => !(ev.getFlags() & core.flags.ROSH_CHODESH));
495
- for (const ev of events) {
496
- if (ev.getDesc() === 'Shabbat Shuva') {
497
- handleSpecial(`Shabbat Shuva (with ${parshaName})`);
498
- } else {
499
- const key = getLeyningKeyForEvent(ev, il);
500
- if (key) {
501
- handleSpecial(key);
502
- }
503
- }
504
- }
505
- if (!haft) {
506
- const day = hd.getDate();
507
- if (parshaName === 'Pinchas' && day > 17) {
508
- // Pinchas is always read in Tamuz (never another month)
509
- // either on the 14, 16, 17 (in Israel), 19, 21, 23, 24
510
- handleSpecial('Pinchas occurring after 17 Tammuz');
511
- } else if (day === 30 || day === 1) {
512
- const key = parshaName === 'Masei' || parshaName === 'Matot-Masei' ? `${parshaName} on Shabbat Rosh Chodesh` : 'Shabbat Rosh Chodesh';
513
- handleSpecial(key);
514
- } else if (parshaName === 'Ki Teitzei' && day === 14) {
515
- // Ki Teitzei is always read in Elul on 9, 11, 13 or 14
516
- // "Because Shabbat Re’eh was Rosh Ḥodesh, the usual 3rd haftarah of
517
- // consolation was not read. Chant the haftarah of Ki tetse and then
518
- // the haftarah of Re’eh as a single haftarah.
519
- // In the book of Isaiah these two brief passages are adjacent."
520
- // Source: Luaḥ Hashanah, Rabbi Miles B. Cohen and Leslie Rubin
521
- handleSpecial('Ki Teitzei with 3rd Haftarah of Consolation');
522
- } else if (hd.getMonth() !== core.months.AV) {
523
- // Parashat Re'eh is always read in Av on 25, 27, 29 or 30.
524
- // When it coincides with Erev Rosh Chodesh, the Haftarah is
525
- // עניה סוערה (Isaiah 54:11-55:5) and not מחר חדש
526
- const tommorow = hd.next().getDate();
527
- if (tommorow === 30 || tommorow === 1) {
528
- handleSpecial('Shabbat Machar Chodesh');
529
- }
530
- }
531
- }
532
- return {
533
- aliyot,
534
- reason,
535
- haft,
536
- seph
537
- };
538
- }
539
-
540
- /**
541
- * Looks up leyning for a given holiday key. Key should be an
542
- * (untranslated) string used in holiday-readings.json. Returns some
543
- * of full kriyah aliyot, special Maftir, special Haftarah
544
- * @param {string} key name from `holiday-readings.json` to find
545
- * @param {number} [cholHaMoedDay]
546
- * @param {boolean} [il]
547
- * @return {Leyning} map of aliyot
548
- */
549
- function getLeyningForHolidayKey(key, cholHaMoedDay, il) {
550
- if (typeof key !== 'string') {
551
- return undefined;
552
- }
553
- const src = lookupFestival(key);
554
- if (typeof src === 'undefined') {
555
- return undefined;
556
- }
557
- if (typeof src.il === 'boolean' && typeof il === 'boolean' && il !== src.il) {
558
- return undefined;
559
- }
560
- const leyning = {
561
- name: {
562
- en: key,
563
- he: core.Locale.lookupTranslation(key, 'he')
564
- }
565
- };
566
- if (src.fullkriyah) {
567
- leyning.fullkriyah = clone(src.fullkriyah);
568
- if (key === 'Sukkot Shabbat Chol ha-Moed' && cholHaMoedDay) {
569
- leyning.fullkriyah['M'] = leyning.fullkriyah[`M-day${cholHaMoedDay}`];
570
- for (let day = 1; day <= 5; day++) {
571
- delete leyning.fullkriyah[`M-day${day}`];
572
- }
573
- }
574
- if (typeof leyning.fullkriyah['1'] === 'object') {
575
- const parts = makeLeyningParts(leyning.fullkriyah);
576
- leyning.summary = makeSummaryFromParts(parts);
577
- if (parts.length > 1) {
578
- leyning.summaryParts = parts;
579
- }
580
- }
581
- Object.values(leyning.fullkriyah).map(aliyah => calculateNumVerses(aliyah));
582
- }
583
- if (src.haft) {
584
- const haft = leyning.haft = cloneHaftara(src.haft);
585
- leyning.haftara = makeSummaryFromParts(haft);
586
- leyning.haftaraNumV = sumVerses(haft);
587
- }
588
- if (src.seph) {
589
- const seph = leyning.seph = cloneHaftara(src.seph);
590
- leyning.sephardic = makeSummaryFromParts(seph);
591
- leyning.sephardicNumV = sumVerses(seph);
592
- }
593
- if (src.megillah) {
594
- const book = src.megillah;
595
- const chaps = numverses[book];
596
- const m = {};
597
- for (let i = 1; i < chaps.length; i++) {
598
- const numv = chaps[i];
599
- m[`${i}`] = {
600
- k: book,
601
- b: `${i}:1`,
602
- e: `${i}:${numv}`,
603
- v: numv
604
- };
605
- }
606
- leyning.megillah = m;
607
- }
608
- if (src.note) {
609
- leyning.note = src.note;
610
- }
611
- return leyning;
612
- }
613
-
614
- /**
615
- * Looks up leyning for a given holiday. Returns some
616
- * of full kriyah aliyot, special Maftir, special Haftarah
617
- * @param {Event} ev the Hebcal event associated with this leyning
618
- * @param {boolean} [il] true if Israel holiday scheme
619
- * @return {Leyning} map of aliyot
620
- */
621
- function getLeyningForHoliday(ev, il = false) {
622
- if (typeof ev !== 'object' || typeof ev.getFlags !== 'function') {
623
- throw new TypeError(`Bad event argument: ${ev}`);
624
- } else if (typeof ev.eventTime !== 'undefined') {
625
- return undefined;
626
- } else if (ev.getFlags() & core.flags.PARSHA_HASHAVUA) {
627
- throw new TypeError(`Event should be a holiday: ${ev.getDesc()}`);
628
- } else if (ev.getFlags() & HOLIDAY_IGNORE_MASK) {
629
- return undefined;
630
- }
631
- const key = getLeyningKeyForEvent(ev, il);
632
- const leyning = getLeyningForHolidayKey(key, ev.cholHaMoedDay, il);
633
- return leyning;
634
- }
635
-
636
- const Bereshit={num:1,hebrew:"בְּרֵאשִׁית",book:1,haft:{k:"Isaiah",b:"42:5",e:"43:10"},seph:{k:"Isaiah",b:"42:5",e:"42:21"},fullkriyah:{"1":["1:1","2:3"],"2":["2:4","2:19"],"3":["2:20","3:21"],"4":["3:22","4:18"],"5":["4:19","4:22"],"6":["4:23","5:24"],"7":["5:25","6:8"],M:["6:5","6:8"]},weekday:{"1":["1:1","1:5"],"2":["1:6","1:8"],"3":["1:9","1:13"]}};const Noach={num:2,hebrew:"נֹחַ",book:1,haft:{k:"Isaiah",b:"54:1",e:"55:5"},seph:{k:"Isaiah",b:"54:1",e:"54:10"},fullkriyah:{"1":["6:9","6:22"],"2":["7:1","7:16"],"3":["7:17","8:14"],"4":["8:15","9:7"],"5":["9:8","9:17"],"6":["9:18","10:32"],"7":["11:1","11:32"],M:["11:29","11:32"]},weekday:{"1":["6:9","6:16"],"2":["6:17","6:19"],"3":["6:20","6:22"]}};const Vayera={num:4,hebrew:"וַיֵּרָא",book:1,haft:{k:"II Kings",b:"4:1",e:"4:37"},seph:{k:"II Kings",b:"4:1",e:"4:23"},fullkriyah:{"1":["18:1","18:14"],"2":["18:15","18:33"],"3":["19:1","19:20"],"4":["19:21","21:4"],"5":["21:5","21:21"],"6":["21:22","21:34"],"7":["22:1","22:24"],M:["22:20","22:24"]},weekday:{"1":["18:1","18:5"],"2":["18:6","18:8"],"3":["18:9","18:14"]}};const Toldot={num:6,hebrew:"תּוֹלְדוֹת",book:1,haft:{k:"Malachi",b:"1:1",e:"2:7"},fullkriyah:{"1":["25:19","26:5"],"2":["26:6","26:12"],"3":["26:13","26:22"],"4":["26:23","26:29"],"5":["26:30","27:27"],"6":["27:28","28:4"],"7":["28:5","28:9"],M:["28:7","28:9"]},weekday:{"1":["25:19","25:22"],"2":["25:23","25:26"],"3":["25:27","26:5"]}};const Vayetzei={num:7,hebrew:"וַיֵּצֵא",book:1,haft:{k:"Hosea",b:"12:13",e:"14:10"},seph:{k:"Hosea",b:"11:7",e:"12:12"},fullkriyah:{"1":["28:10","28:22"],"2":["29:1","29:17"],"3":["29:18","30:13"],"4":["30:14","30:27"],"5":["30:28","31:16"],"6":["31:17","31:42"],"7":["31:43","32:3"],M:["32:1","32:3"]},weekday:{"1":["28:10","28:12"],"2":["28:13","28:17"],"3":["28:18","28:22"]}};const Vayishlach={num:8,hebrew:"וַיִּשְׁלַח",book:1,haft:{k:"Obadiah",b:"1:1",e:"1:21"},fullkriyah:{"1":["32:4","32:13"],"2":["32:14","32:30"],"3":["32:31","33:5"],"4":["33:6","33:20"],"5":["34:1","35:11"],"6":["35:12","36:19"],"7":["36:20","36:43"],M:["36:40","36:43"]},weekday:{"1":["32:4","32:6"],"2":["32:7","32:9"],"3":["32:10","32:13"]}};const Vayeshev={num:9,hebrew:"וַיֵּשֶׁב",book:1,haft:{k:"Amos",b:"2:6",e:"3:8"},fullkriyah:{"1":["37:1","37:11"],"2":["37:12","37:22"],"3":["37:23","37:36"],"4":["38:1","38:30"],"5":["39:1","39:6"],"6":["39:7","39:23"],"7":["40:1","40:23"],M:["40:20","40:23"]},weekday:{"1":["37:1","37:3"],"2":["37:4","37:7"],"3":["37:8","37:11"]}};const Miketz={num:10,hebrew:"מִקֵּץ",book:1,haft:{k:"I Kings",b:"3:15",e:"4:1"},fullkriyah:{"1":["41:1","41:14"],"2":["41:15","41:38"],"3":["41:39","41:52"],"4":["41:53","42:18"],"5":["42:19","43:15"],"6":["43:16","43:29"],"7":["43:30","44:17"],M:["44:14","44:17"]},weekday:{"1":["41:1","41:4"],"2":["41:5","41:7"],"3":["41:8","41:14"]}};const Vayigash={num:11,hebrew:"וַיִּגַּשׁ",book:1,haft:{k:"Ezekiel",b:"37:15",e:"37:28"},fullkriyah:{"1":["44:18","44:30"],"2":["44:31","45:7"],"3":["45:8","45:18"],"4":["45:19","45:27"],"5":["45:28","46:27"],"6":["46:28","47:10"],"7":["47:11","47:27"],M:["47:25","47:27"]},weekday:{"1":["44:18","44:20"],"2":["44:21","44:24"],"3":["44:25","44:30"]}};const Vayechi={num:12,hebrew:"וַיְחִי",book:1,haft:{k:"I Kings",b:"2:1",e:"2:12"},fullkriyah:{"1":["47:28","48:9"],"2":["48:10","48:16"],"3":["48:17","48:22"],"4":["49:1","49:18"],"5":["49:19","49:26"],"6":["49:27","50:20"],"7":["50:21","50:26"],M:["50:23","50:26"]},weekday:{"1":["47:28","47:31"],"2":["48:1","48:3"],"3":["48:4","48:9"]}};const Shemot={num:13,hebrew:"שְׁמוֹת",book:2,haft:[{k:"Isaiah",b:"27:6",e:"28:13"},{k:"Isaiah",b:"29:22",e:"29:23"}],seph:{k:"Jeremiah",b:"1:1",e:"2:3"},fullkriyah:{"1":["1:1","1:17"],"2":["1:18","2:10"],"3":["2:11","2:25"],"4":["3:1","3:15"],"5":["3:16","4:17"],"6":["4:18","4:31"],"7":["5:1","6:1"],M:["5:22","6:1"]},weekday:{"1":["1:1","1:7"],"2":["1:8","1:12"],"3":["1:13","1:17"]}};const Vaera={num:14,hebrew:"וָאֵרָא",book:2,haft:{k:"Ezekiel",b:"28:25",e:"29:21"},fullkriyah:{"1":["6:2","6:13"],"2":["6:14","6:28"],"3":["6:29","7:7"],"4":["7:8","8:6"],"5":["8:7","8:18"],"6":["8:19","9:16"],"7":["9:17","9:35"],M:["9:33","9:35"]},weekday:{"1":["6:2","6:5"],"2":["6:6","6:9"],"3":["6:10","6:13"]}};const Bo={num:15,hebrew:"בֹּא",book:2,haft:{k:"Jeremiah",b:"46:13",e:"46:28"},fullkriyah:{"1":["10:1","10:11"],"2":["10:12","10:23"],"3":["10:24","11:3"],"4":["11:4","12:20"],"5":["12:21","12:28"],"6":["12:29","12:51"],"7":["13:1","13:16"],M:["13:14","13:16"]},weekday:{"1":["10:1","10:3"],"2":["10:4","10:6"],"3":["10:7","10:11"]}};const Beshalach={num:16,hebrew:"בְּשַׁלַּח",book:2,haft:{k:"Judges",b:"4:4",e:"5:31"},seph:{k:"Judges",b:"5:1",e:"5:31"},fullkriyah:{"1":["13:17","14:8"],"2":["14:9","14:14"],"3":["14:15","14:25"],"4":["14:26","15:26"],"5":["15:27","16:10"],"6":["16:11","16:36"],"7":["17:1","17:16"],M:["17:14","17:16"]},weekday:{"1":["13:17","13:22"],"2":["14:1","14:4"],"3":["14:5","14:8"]}};const Yitro={num:17,hebrew:"יִתְרוֹ",book:2,haft:[{k:"Isaiah",b:"6:1",e:"7:6"},{k:"Isaiah",b:"9:5",e:"9:6"}],seph:{k:"Isaiah",b:"6:1",e:"6:13"},fullkriyah:{"1":["18:1","18:12"],"2":["18:13","18:23"],"3":["18:24","18:27"],"4":["19:1","19:6"],"5":["19:7","19:19"],"6":["19:20","20:14"],"7":["20:15","20:23"],M:["20:19","20:23"]},weekday:{"1":["18:1","18:4"],"2":["18:5","18:8"],"3":["18:9","18:12"]}};const Mishpatim={num:18,hebrew:"מִּשְׁפָּטִים",book:2,haft:[{k:"Jeremiah",b:"34:8",e:"34:22"},{k:"Jeremiah",b:"33:25",e:"33:26"}],fullkriyah:{"1":["21:1","21:19"],"2":["21:20","22:3"],"3":["22:4","22:26"],"4":["22:27","23:5"],"5":["23:6","23:19"],"6":["23:20","23:25"],"7":["23:26","24:18"],M:["24:15","24:18"]},weekday:{"1":["21:1","21:6"],"2":["21:7","21:11"],"3":["21:12","21:19"]}};const Terumah={num:19,hebrew:"תְּרוּמָה",book:2,haft:{k:"I Kings",b:"5:26",e:"6:13"},fullkriyah:{"1":["25:1","25:16"],"2":["25:17","25:30"],"3":["25:31","26:14"],"4":["26:15","26:30"],"5":["26:31","26:37"],"6":["27:1","27:8"],"7":["27:9","27:19"],M:["27:17","27:19"]},weekday:{"1":["25:1","25:5"],"2":["25:6","25:9"],"3":["25:10","25:16"]}};const Tetzaveh={num:20,hebrew:"תְּצַוֶּה",book:2,haft:{k:"Ezekiel",b:"43:10",e:"43:27"},fullkriyah:{"1":["27:20","28:12"],"2":["28:13","28:30"],"3":["28:31","28:43"],"4":["29:1","29:18"],"5":["29:19","29:37"],"6":["29:38","29:46"],"7":["30:1","30:10"],M:["30:8","30:10"]},weekday:{"1":["27:20","28:5"],"2":["28:6","28:9"],"3":["28:10","28:12"]}};const Vayakhel={num:22,hebrew:"וַיַּקְהֵל",book:2,haft:{k:"I Kings",b:"7:40",e:"7:50"},seph:{k:"I Kings",b:"7:13",e:"7:26"},fullkriyah:{"1":["35:1","35:20"],"2":["35:21","35:29"],"3":["35:30","36:7"],"4":["36:8","36:19"],"5":["36:20","37:16"],"6":["37:17","37:29"],"7":["38:1","38:20"],M:["38:18","38:20"]},weekday:{"1":["35:1","35:3"],"2":["35:4","35:10"],"3":["35:11","35:20"]}};const Pekudei={num:23,hebrew:"פְקוּדֵי",book:2,haft:{k:"I Kings",b:"7:51",e:"8:21"},seph:{k:"I Kings",b:"7:40",e:"7:50"},fullkriyah:{"1":["38:21","39:1"],"2":["39:2","39:21"],"3":["39:22","39:32"],"4":["39:33","39:43"],"5":["40:1","40:16"],"6":["40:17","40:27"],"7":["40:28","40:38"],M:["40:34","40:38"]},weekday:{"1":["38:21","38:23"],"2":["38:24","38:27"],"3":["38:28","39:1"]}};const Vayikra={num:24,hebrew:"וַיִּקְרָא",book:3,haft:{k:"Isaiah",b:"43:21",e:"44:23"},fullkriyah:{"1":["1:1","1:13"],"2":["1:14","2:6"],"3":["2:7","2:16"],"4":["3:1","3:17"],"5":["4:1","4:26"],"6":["4:27","5:10"],"7":["5:11","5:26"],M:["5:24","5:26"]},weekday:{"1":["1:1","1:4"],"2":["1:5","1:9"],"3":["1:10","1:13"]}};const Tzav={num:25,hebrew:"צַו",book:3,haft:[{k:"Jeremiah",b:"7:21",e:"8:3"},{k:"Jeremiah",b:"9:22",e:"9:23"}],fullkriyah:{"1":["6:1","6:11"],"2":["6:12","7:10"],"3":["7:11","7:38"],"4":["8:1","8:13"],"5":["8:14","8:21"],"6":["8:22","8:29"],"7":["8:30","8:36"],M:["8:33","8:36"]},weekday:{"1":["6:1","6:3"],"2":["6:4","6:6"],"3":["6:7","6:11"]}};const Shmini={num:26,hebrew:"שְּׁמִינִי",book:3,haft:{k:"II Samuel",b:"6:1",e:"7:17"},seph:{k:"II Samuel",b:"6:1",e:"6:19"},fullkriyah:{"1":["9:1","9:16"],"2":["9:17","9:23"],"3":["9:24","10:11"],"4":["10:12","10:15"],"5":["10:16","10:20"],"6":["11:1","11:32"],"7":["11:33","11:47"],M:["11:45","11:47"]},weekday:{"1":["9:1","9:6"],"2":["9:7","9:10"],"3":["9:11","9:16"]}};const Tazria={num:27,hebrew:"תַזְרִיעַ",book:3,haft:{k:"II Kings",b:"4:42",e:"5:19"},fullkriyah:{"1":["12:1","13:5"],"2":["13:6","13:17"],"3":["13:18","13:23"],"4":["13:24","13:28"],"5":["13:29","13:39"],"6":["13:40","13:54"],"7":["13:55","13:59"],M:["13:57","13:59"]},weekday:{"1":["12:1","12:4"],"2":["12:5","12:8"],"3":["13:1","13:5"]}};const Metzora={num:28,hebrew:"מְּצֹרָע",book:3,haft:{k:"II Kings",b:"7:3",e:"7:20"},fullkriyah:{"1":["14:1","14:12"],"2":["14:13","14:20"],"3":["14:21","14:32"],"4":["14:33","14:53"],"5":["14:54","15:15"],"6":["15:16","15:28"],"7":["15:29","15:33"],M:["15:31","15:33"]},weekday:{"1":["14:1","14:5"],"2":["14:6","14:9"],"3":["14:10","14:12"]}};const Kedoshim={num:30,hebrew:"קְדשִׁים",book:3,haft:{k:"Amos",b:"9:7",e:"9:15"},seph:{k:"Ezekiel",b:"20:2",e:"20:20"},fullkriyah:{"1":["19:1","19:14"],"2":["19:15","19:22"],"3":["19:23","19:32"],"4":["19:33","19:37"],"5":["20:1","20:7"],"6":["20:8","20:22"],"7":["20:23","20:27"],M:["20:25","20:27"]},weekday:{"1":["19:1","19:4"],"2":["19:5","19:10"],"3":["19:11","19:14"]}};const Emor={num:31,hebrew:"אֱמוֹר",book:3,haft:{k:"Ezekiel",b:"44:15",e:"44:31"},fullkriyah:{"1":["21:1","21:15"],"2":["21:16","22:16"],"3":["22:17","22:33"],"4":["23:1","23:22"],"5":["23:23","23:32"],"6":["23:33","23:44"],"7":["24:1","24:23"],M:["24:21","24:23"]},weekday:{"1":["21:1","21:6"],"2":["21:7","21:12"],"3":["21:13","21:15"]}};const Behar={num:32,hebrew:"בְּהַר",book:3,haft:{k:"Jeremiah",b:"32:6",e:"32:27"},fullkriyah:{"1":["25:1","25:13"],"2":["25:14","25:18"],"3":["25:19","25:24"],"4":["25:25","25:28"],"5":["25:29","25:38"],"6":["25:39","25:46"],"7":["25:47","26:2"],M:["25:55","26:2"]},weekday:{"1":["25:1","25:3"],"2":["25:4","25:7"],"3":["25:8","25:13"]}};const Bechukotai={num:33,hebrew:"בְּחֻקֹּתַי",book:3,haft:{k:"Jeremiah",b:"16:19",e:"17:14"},fullkriyah:{"1":["26:3","26:5"],"2":["26:6","26:9"],"3":["26:10","26:46"],"4":["27:1","27:15"],"5":["27:16","27:21"],"6":["27:22","27:28"],"7":["27:29","27:34"],M:["27:32","27:34"]},weekday:{"1":["26:3","26:5"],"2":["26:6","26:9"],"3":["26:10","26:13"]}};const Bamidbar={num:34,hebrew:"בְּמִדְבַּר",book:4,haft:{k:"Hosea",b:"2:1",e:"2:22"},fullkriyah:{"1":["1:1","1:19"],"2":["1:20","1:54"],"3":["2:1","2:34"],"4":["3:1","3:13"],"5":["3:14","3:39"],"6":["3:40","3:51"],"7":["4:1","4:20"],M:["4:17","4:20"]},weekday:{"1":["1:1","1:4"],"2":["1:5","1:16"],"3":["1:17","1:19"]}};const Nasso={num:35,hebrew:"נָשׂא",book:4,haft:{k:"Judges",b:"13:2",e:"13:25"},fullkriyah:{"1":["4:21","4:37"],"2":["4:38","4:49"],"3":["5:1","5:10"],"4":["5:11","6:27"],"5":["7:1","7:41"],"6":["7:42","7:71"],"7":["7:72","7:89"],M:["7:87","7:89"]},weekday:{"1":["4:21","4:24"],"2":["4:25","4:28"],"3":["4:29","4:33"]}};const Korach={num:38,hebrew:"קוֹרַח",book:4,haft:{k:"I Samuel",b:"11:14",e:"12:22"},fullkriyah:{"1":["16:1","16:13"],"2":["16:14","16:19"],"3":["16:20","17:8"],"4":["17:9","17:15"],"5":["17:16","17:24"],"6":["17:25","18:20"],"7":["18:21","18:32"],M:["18:30","18:32"]},weekday:{"1":["16:1","16:3"],"2":["16:4","16:7"],"3":["16:8","16:13"]}};const Chukat={num:39,hebrew:"חֻקַּת",book:4,haft:{k:"Judges",b:"11:1",e:"11:33"},fullkriyah:{"1":["19:1","19:17"],"2":["19:18","20:6"],"3":["20:7","20:13"],"4":["20:14","20:21"],"5":["20:22","21:9"],"6":["21:10","21:20"],"7":["21:21","22:1"],M:["21:34","22:1"]},weekday:{"1":["19:1","19:6"],"2":["19:7","19:9"],"3":["19:10","19:17"]}};const Balak={num:40,hebrew:"בָּלָק",book:4,haft:{k:"Micah",b:"5:6",e:"6:8"},fullkriyah:{"1":["22:2","22:12"],"2":["22:13","22:20"],"3":["22:21","22:38"],"4":["22:39","23:12"],"5":["23:13","23:26"],"6":["23:27","24:13"],"7":["24:14","25:9"],M:["25:7","25:9"]},weekday:{"1":["22:2","22:4"],"2":["22:5","22:7"],"3":["22:8","22:12"]}};const Pinchas={num:41,hebrew:"פִּינְחָס",book:4,haft:{k:"I Kings",b:"18:46",e:"19:21"},fullkriyah:{"1":["25:10","26:4"],"2":["26:5","26:51"],"3":["26:52","27:5"],"4":["27:6","27:23"],"5":["28:1","28:15"],"6":["28:16","29:11"],"7":["29:12","30:1"],M:["29:35","30:1"]},weekday:{"1":["25:10","25:12"],"2":["25:13","25:15"],"3":["25:16","26:4"]}};const Matot={num:42,hebrew:"מַּטּוֹת",book:4,haft:{k:"Jeremiah",b:"1:1",e:"2:3"},fullkriyah:{"1":["30:2","30:17"],"2":["31:1","31:12"],"3":["31:13","31:24"],"4":["31:25","31:41"],"5":["31:42","31:54"],"6":["32:1","32:19"],"7":["32:20","32:42"],M:["32:39","32:42"]},weekday:{"1":["30:2","30:9"],"2":["30:10","30:13"],"3":["30:14","30:17"]}};const Masei={num:43,hebrew:"מַסְעֵי",book:4,haft:[{k:"Jeremiah",b:"2:4",e:"2:28"},{k:"Jeremiah",b:"3:4",e:"3:4"}],seph:[{k:"Jeremiah",b:"2:4",e:"2:28"},{k:"Jeremiah",b:"4:1",e:"4:2"}],fullkriyah:{"1":["33:1","33:10"],"2":["33:11","33:49"],"3":["33:50","34:15"],"4":["34:16","34:29"],"5":["35:1","35:8"],"6":["35:9","35:34"],"7":["36:1","36:13"],M:["36:11","36:13"]},weekday:{"1":["33:1","33:3"],"2":["33:4","33:6"],"3":["33:7","33:10"]}};const Devarim={num:44,hebrew:"דְּבָרִים",book:5,haft:{k:"Isaiah",b:"1:1",e:"1:27"},fullkriyah:{"1":["1:1","1:10"],"2":["1:11","1:21"],"3":["1:22","1:38"],"4":["1:39","2:1"],"5":["2:2","2:30"],"6":["2:31","3:14"],"7":["3:15","3:22"],M:["3:20","3:22"]},weekday:{"1":["1:1","1:3"],"2":["1:4","1:7"],"3":["1:8","1:11"]}};const Vaetchanan={num:45,hebrew:"וָאֶתְחַנַּן",book:5,haft:{k:"Isaiah",b:"40:1",e:"40:26"},fullkriyah:{"1":["3:23","4:4"],"2":["4:5","4:40"],"3":["4:41","4:49"],"4":["5:1","5:18"],"5":["5:19","6:3"],"6":["6:4","6:25"],"7":["7:1","7:11"],M:["7:9","7:11"]},weekday:{"1":["3:23","3:25"],"2":["3:26","4:4"],"3":["4:5","4:8"]}};const Eikev={num:46,hebrew:"עֵקֶב",book:5,haft:{k:"Isaiah",b:"49:14",e:"51:3"},fullkriyah:{"1":["7:12","8:10"],"2":["8:11","9:3"],"3":["9:4","9:29"],"4":["10:1","10:11"],"5":["10:12","11:9"],"6":["11:10","11:21"],"7":["11:22","11:25"],M:["11:22","11:25"]},weekday:{"1":["7:12","7:21"],"2":["7:22","8:3"],"3":["8:4","8:10"]}};const Shoftim={num:48,hebrew:"שׁוֹפְטִים",book:5,haft:{k:"Isaiah",b:"51:12",e:"52:12"},fullkriyah:{"1":["16:18","17:13"],"2":["17:14","17:20"],"3":["18:1","18:5"],"4":["18:6","18:13"],"5":["18:14","19:13"],"6":["19:14","20:9"],"7":["20:10","21:9"],M:["21:7","21:9"]},weekday:{"1":["16:18","16:20"],"2":["16:21","17:10"],"3":["17:11","17:13"]}};const Nitzavim={num:51,hebrew:"נִצָּבִים",book:5,haft:{k:"Isaiah",b:"61:10",e:"63:9"},fullkriyah:{"1":["29:9","29:11"],"2":["29:12","29:14"],"3":["29:15","29:28"],"4":["30:1","30:6"],"5":["30:7","30:10"],"6":["30:11","30:14"],"7":["30:15","30:20"],M:["30:15","30:20"]},weekday:{"1":["29:9","29:11"],"2":["29:12","29:14"],"3":["29:15","29:28"]}};const Vayeilech={num:52,hebrew:"וַיֵּלֶךְ",book:5,haft:{k:"Isaiah",b:"55:6",e:"56:8"},fullkriyah:{"1":["31:1","31:3"],"2":["31:4","31:6"],"3":["31:7","31:9"],"4":["31:10","31:13"],"5":["31:14","31:19"],"6":["31:20","31:24"],"7":["31:25","31:30"],M:["31:28","31:30"]},weekday:{"1":["31:1","31:3"],"2":["31:4","31:6"],"3":["31:7","31:13"]}};var parshiyotObj = {Bereshit:Bereshit,Noach:Noach,"Lech-Lecha":{num:3,hebrew:"לֶךְ־לְךָ",book:1,haft:{k:"Isaiah",b:"40:27",e:"41:16"},fullkriyah:{"1":["12:1","12:13"],"2":["12:14","13:4"],"3":["13:5","13:18"],"4":["14:1","14:20"],"5":["14:21","15:6"],"6":["15:7","17:6"],"7":["17:7","17:27"],M:["17:24","17:27"]},weekday:{"1":["12:1","12:3"],"2":["12:4","12:9"],"3":["12:10","12:13"]}},Vayera:Vayera,"Chayei Sara":{num:5,hebrew:"חַיֵּי שָֹרָה",book:1,haft:{k:"I Kings",b:"1:1",e:"1:31"},fullkriyah:{"1":["23:1","23:16"],"2":["23:17","24:9"],"3":["24:10","24:26"],"4":["24:27","24:52"],"5":["24:53","24:67"],"6":["25:1","25:11"],"7":["25:12","25:18"],M:["25:16","25:18"]},weekday:{"1":["23:1","23:7"],"2":["23:8","23:12"],"3":["23:13","23:16"]}},Toldot:Toldot,Vayetzei:Vayetzei,Vayishlach:Vayishlach,Vayeshev:Vayeshev,Miketz:Miketz,Vayigash:Vayigash,Vayechi:Vayechi,Shemot:Shemot,Vaera:Vaera,Bo:Bo,Beshalach:Beshalach,Yitro:Yitro,Mishpatim:Mishpatim,Terumah:Terumah,Tetzaveh:Tetzaveh,"Ki Tisa":{num:21,hebrew:"כִּי תִשָּׂא",book:2,haft:{k:"I Kings",b:"18:1",e:"18:39"},seph:{k:"I Kings",b:"18:20",e:"18:39"},fullkriyah:{"1":["30:11","31:17"],"2":["31:18","33:11"],"3":["33:12","33:16"],"4":["33:17","33:23"],"5":["34:1","34:9"],"6":["34:10","34:26"],"7":["34:27","34:35"],M:["34:33","34:35"]},weekday:{"1":["30:11","30:13"],"2":["30:14","30:16"],"3":["30:17","30:21"]}},Vayakhel:Vayakhel,Pekudei:Pekudei,Vayikra:Vayikra,Tzav:Tzav,Shmini:Shmini,Tazria:Tazria,Metzora:Metzora,"Achrei Mot":{num:29,hebrew:"אַחֲרֵי מוֹת",book:3,haft:{k:"Ezekiel",b:"22:1",e:"22:19"},seph:{k:"Ezekiel",b:"22:1",e:"22:16"},fullkriyah:{"1":["16:1","16:17"],"2":["16:18","16:24"],"3":["16:25","16:34"],"4":["17:1","17:7"],"5":["17:8","18:5"],"6":["18:6","18:21"],"7":["18:22","18:30"],M:["18:28","18:30"]},weekday:{"1":["16:1","16:6"],"2":["16:7","16:11"],"3":["16:12","16:17"]}},Kedoshim:Kedoshim,Emor:Emor,Behar:Behar,Bechukotai:Bechukotai,Bamidbar:Bamidbar,Nasso:Nasso,"Beha'alotcha":{num:36,hebrew:"בְּהַעֲלֹתְךָ",book:4,haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{"1":["8:1","8:14"],"2":["8:15","8:26"],"3":["9:1","9:14"],"4":["9:15","10:10"],"5":["10:11","10:34"],"6":["10:35","11:29"],"7":["11:30","12:16"],M:["12:14","12:16"]},weekday:{"1":["8:1","8:4"],"2":["8:5","8:9"],"3":["8:10","8:14"]}},"Sh'lach":{num:37,hebrew:"שְׁלַח־לְךָ",book:4,haft:{k:"Joshua",b:"2:1",e:"2:24"},fullkriyah:{"1":["13:1","13:20"],"2":["13:21","14:7"],"3":["14:8","14:25"],"4":["14:26","15:7"],"5":["15:8","15:16"],"6":["15:17","15:26"],"7":["15:27","15:41"],M:["15:37","15:41"]},weekday:{"1":["13:1","13:3"],"2":["13:4","13:16"],"3":["13:17","13:20"]}},Korach:Korach,Chukat:Chukat,Balak:Balak,Pinchas:Pinchas,Matot:Matot,Masei:Masei,Devarim:Devarim,Vaetchanan:Vaetchanan,Eikev:Eikev,"Re'eh":{num:47,hebrew:"רְאֵה",book:5,haft:{k:"Isaiah",b:"54:11",e:"55:5"},fullkriyah:{"1":["11:26","12:10"],"2":["12:11","12:28"],"3":["12:29","13:19"],"4":["14:1","14:21"],"5":["14:22","14:29"],"6":["15:1","15:18"],"7":["15:19","16:17"],M:["16:13","16:17"]},weekday:{"1":["11:26","11:31"],"2":["11:32","12:5"],"3":["12:6","12:10"]}},Shoftim:Shoftim,"Ki Teitzei":{num:49,hebrew:"כִּי־תֵצֵא",book:5,haft:{k:"Isaiah",b:"54:1",e:"54:10"},fullkriyah:{"1":["21:10","21:21"],"2":["21:22","22:7"],"3":["22:8","23:7"],"4":["23:8","23:24"],"5":["23:25","24:4"],"6":["24:5","24:13"],"7":["24:14","25:19"],M:["25:17","25:19"]},weekday:{"1":["21:10","21:14"],"2":["21:15","21:17"],"3":["21:18","21:21"]}},"Ki Tavo":{num:50,hebrew:"כִּי־תָבוֹא",book:5,haft:{k:"Isaiah",b:"60:1",e:"60:22"},fullkriyah:{"1":["26:1","26:11"],"2":["26:12","26:15"],"3":["26:16","26:19"],"4":["27:1","27:10"],"5":["27:11","28:6"],"6":["28:7","28:69"],"7":["29:1","29:8"],M:["29:6","29:8"]},weekday:{"1":["26:1","26:3"],"2":["26:4","26:11"],"3":["26:12","26:15"]}},Nitzavim:Nitzavim,Vayeilech:Vayeilech,"Ha'azinu":{num:53,hebrew:"הַאֲזִינוּ",book:5,haft:{k:"II Samuel",b:"22:1",e:"22:51"},fullkriyah:{"1":["32:1","32:6"],"2":["32:7","32:12"],"3":["32:13","32:18"],"4":["32:19","32:28"],"5":["32:29","32:39"],"6":["32:40","32:43"],"7":["32:44","32:52"],M:["32:48","32:52"]},weekday:{"1":["32:1","32:3"],"2":["32:4","32:6"],"3":["32:7","32:12"]}},"Vezot Haberakhah":{num:54,hebrew:"וְזֹאת הַבְּרָכָה",book:5,haft:{k:"Joshua",b:"1:1",e:"1:18"},seph:{k:"Joshua",b:"1:1",e:"1:9"},fullkriyah:{"1":["33:1","33:7"],"2":["33:8","33:12"],"3":["33:13","33:17"],"4":["33:18","33:21"],"5":["33:22","33:26"],"6":["33:27","33:29"],"7":["34:1","34:12"]},weekday:{"1":["33:1","33:7"],"2":["33:8","33:12"],"3":["33:13","33:17"]}},"Vayakhel-Pekudei":{num:101,combined:true,p1:"Vayakhel",p2:"Pekudei",num1:22,num2:23,book:2,fullkriyah:{"1":["35:1","35:29"],"2":["35:30","37:16"],"3":["37:17","37:29"],"4":["38:1","39:1"],"5":["39:2","39:21"],"6":["39:22","39:43"],"7":["40:1","40:38"],M:["40:34","40:38"]}},"Tazria-Metzora":{num:102,combined:true,p1:"Tazria",p2:"Metzora",num1:27,num2:28,book:3,fullkriyah:{"1":["12:1","13:23"],"2":["13:24","13:39"],"3":["13:40","13:54"],"4":["13:55","14:20"],"5":["14:21","14:32"],"6":["14:33","15:15"],"7":["15:16","15:33"],M:["15:31","15:33"]}},"Achrei Mot-Kedoshim":{num:103,combined:true,p1:"Achrei Mot",p2:"Kedoshim",num1:29,num2:30,book:3,fullkriyah:{"1":["16:1","16:24"],"2":["16:25","17:7"],"3":["17:8","18:21"],"4":["18:22","19:14"],"5":["19:15","19:32"],"6":["19:33","20:7"],"7":["20:8","20:27"],M:["20:25","20:27"]}},"Behar-Bechukotai":{num:104,combined:true,p1:"Behar",p2:"Bechukotai",num1:32,num2:33,book:3,fullkriyah:{"1":["25:1","25:18"],"2":["25:19","25:28"],"3":["25:29","25:38"],"4":["25:39","26:9"],"5":["26:10","26:46"],"6":["27:1","27:15"],"7":["27:16","27:34"],M:["27:32","27:34"]}},"Chukat-Balak":{num:105,combined:true,p1:"Chukat",p2:"Balak",num1:39,num2:40,book:4,fullkriyah:{"1":["19:1","20:6"],"2":["20:7","20:21"],"3":["20:22","21:20"],"4":["21:21","22:12"],"5":["22:13","22:38"],"6":["22:39","23:26"],"7":["23:27","25:9"],M:["25:7","25:9"]}},"Matot-Masei":{num:106,combined:true,p1:"Matot",p2:"Masei",num1:42,num2:43,book:4,fullkriyah:{"1":["30:2","31:12"],"2":["31:13","31:54"],"3":["32:1","32:19"],"4":["32:20","33:49"],"5":["33:50","34:15"],"6":["34:16","35:8"],"7":["35:9","36:13"],M:["36:11","36:13"]}},"Nitzavim-Vayeilech":{num:107,combined:true,p1:"Nitzavim",p2:"Vayeilech",num1:51,num2:52,book:5,fullkriyah:{"1":["29:9","29:28"],"2":["30:1","30:6"],"3":["30:7","30:14"],"4":["30:15","31:6"],"5":["31:7","31:13"],"6":["31:14","31:19"],"7":["31:20","31:30"],M:["31:28","31:30"]}}};
637
-
638
- /**
639
- * Represents an aliyah
640
- * @private
641
- * @typedef {Object} Aliyah
642
- * @property {string} k - Book (e.g. "Numbers")
643
- * @property {string} b - beginning verse (e.g. "28:9")
644
- * @property {string} e - ending verse (e.g. "28:15")
645
- * @property {number} [v] - number of verses
646
- * @property {number} [p] - parsha number (1=Bereshit, 54=Vezot HaBracha)
647
- */
648
-
649
- /**
650
- * Name of the parsha hashavua or holiday
651
- * @typedef {Object} LeyningNames
652
- * @property {string} en English
653
- * @property {string} he Hebrew (with nikud)
654
- */
655
-
656
- /**
657
- * Leyning for a parsha hashavua or holiday
658
- * @typedef {Object} Leyning
659
- * @property {LeyningNames} name
660
- * @property {string[]} [parsha] - An array of either 1 (regular) or 2 (doubled parsha).
661
- * `undefined` for holiday readings
662
- * @property {number|number[]} [parshaNum] - 1 for Bereshit, 2 for Noach, etc. `undefined` for holiday readings
663
- * @property {string} summary - Such as `Genesis 1:1 - 6:8`
664
- * @property {Aliyah|Aliyah[]} haft - Haftarah object(s)
665
- * @property {string} haftara - Haftarah, such as `Isaiah 42:5 – 43:11`
666
- * @property {number} [haftaraNumV] - Number of verses in the Haftarah
667
- * @property {Aliyah|Aliyah[]} [seph] - Haftarah object(s) for Sephardim
668
- * @property {string} [sephardic] - Haftarah for Sephardim, such as `Isaiah 42:5 - 42:21`
669
- * @property {number} [sephardicNumV] - Number of verses in the Haftarah for Sephardim
670
- * @property {Object<string,Aliyah>} fullkriyah - Map of aliyot `1` through `7` plus `M` for maftir
671
- * @property {Object<string,Aliyah>} [weekday] - Optional map of weekday Torah Readings
672
- * aliyot `1` through `3` for Monday and Thursday
673
- * @property {Object<string,string>} [reason] - Explanations for special readings,
674
- * keyed by aliyah number, `M` for maftir or `haftara` for Haftarah
675
- * @property {Object<string,Aliyah>} [megillah] - Optional map of megillah reading.
676
- * Song of Songs is read on the sabbath of Passover week, the Book of Ruth on Shavuot,
677
- * Lamentations on Tisha be-Av, Ecclesiastes on the sabbath of the week of Sukkoth,
678
- * and the Book of Esther on Purim.
679
- */
680
-
681
- /**
682
- * on doubled parshiot, read only the second Haftarah
683
- * except for Nitzavim-Vayelech
684
- * @private
685
- * @param {string[]} parsha
686
- * @return {string}
687
- */
688
- function getHaftaraKey(parsha) {
689
- if (parsha.length == 1 || parsha[0] == 'Nitzavim') {
690
- return parsha[0];
691
- } else {
692
- return parsha[1];
693
- }
694
- }
695
-
696
- /**
697
- * Transliterated English and Hebrew names of this parsha
698
- * @param {string|string[]} parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
699
- * @return {LeyningNames}
700
- */
701
- function makeLeyningNames(parsha) {
702
- const name = parshaToString(parsha);
703
- return {
704
- en: name,
705
- he: parsha.map(s => core.Locale.lookupTranslation(s, 'he')).join('־')
706
- };
707
- }
708
-
709
- /**
710
- * Looks up regular leyning for a weekly parsha with no special readings
711
- * @private
712
- * @param {string|string[]} parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
713
- * @return {Leyning} map of aliyot
714
- */
715
- function getLeyningForParshaShabbatOnly(parsha) {
716
- const raw = lookupParsha(parsha);
717
- const fullkriyah = {};
718
- const book = BOOK[raw.book];
719
- for (const [num, src] of Object.entries(raw.fullkriyah)) {
720
- const aliyah = {
721
- k: book,
722
- b: src[0],
723
- e: src[1]
724
- };
725
- calculateNumVerses(aliyah);
726
- fullkriyah[num] = aliyah;
727
- }
728
- const name = parshaToString(parsha);
729
- const parshaNameArray = raw.combined ? [raw.p1, raw.p2] : [name];
730
- const parts = makeLeyningParts(fullkriyah);
731
- const summary = makeSummaryFromParts(parts);
732
- /** @type {Leyning} */
733
- const result = {
734
- name: makeLeyningNames(parshaNameArray),
735
- parsha: parshaNameArray,
736
- parshaNum: raw.num,
737
- summary,
738
- fullkriyah: fullkriyah
739
- };
740
- if (parts.length > 1) {
741
- result.summaryParts = parts;
742
- }
743
- const hkey = getHaftaraKey(parshaNameArray);
744
- const haft0 = parshiyotObj[hkey].haft;
745
- if (haft0) {
746
- const haft = result.haft = cloneHaftara(haft0);
747
- result.haftara = makeSummaryFromParts(haft);
748
- result.haftaraNumV = sumVerses(haft);
749
- }
750
- if (raw.seph) {
751
- const seph = result.seph = cloneHaftara(raw.seph);
752
- result.sephardic = makeSummaryFromParts(seph);
753
- result.sephardicNumV = sumVerses(seph);
754
- }
755
- return result;
756
- }
757
-
758
- /**
759
- * Looks up Monday/Thursday aliyot for a regular parsha
760
- * @param {string|string[]} parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
761
- * @return {Object<string,Aliyah>} map of aliyot
762
- */
763
- function getWeekdayReading(parsha) {
764
- const raw = lookupParsha(parsha);
765
- const parshaMeta = raw.combined ? lookupParsha(raw.p1) : raw;
766
- const aliyot = parshaMeta.weekday;
767
- if (!aliyot) {
768
- throw new Error(`Parsha missing weekday: ${parsha}`);
769
- }
770
- const book = BOOK[raw.book];
771
- const weekday = {};
772
- for (let i = 1; i <= 3; i++) {
773
- const num = '' + i;
774
- const src = aliyot[num];
775
- const aliyah = {
776
- k: book,
777
- b: src[0],
778
- e: src[1]
779
- };
780
- calculateNumVerses(aliyah);
781
- weekday[num] = aliyah;
782
- }
783
- return weekday;
784
- }
785
-
786
- /**
787
- * Looks up regular leyning for a weekly parsha with no special readings
788
- * @param {string|string[]} parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
789
- * @return {Leyning} map of aliyot
790
- */
791
- function getLeyningForParsha(parsha) {
792
- const result = getLeyningForParshaShabbatOnly(parsha);
793
- result.weekday = getWeekdayReading(parsha);
794
- return result;
795
- }
796
-
797
- /**
798
- * Looks up leyning for a regular Shabbat parsha, including any special
799
- * maftir or Haftara.
800
- * @param {Event} ev the Hebcal event associated with this leyning
801
- * @param {boolean} [il] in Israel
802
- * @return {Leyning} map of aliyot
803
- */
804
- function getLeyningForParshaHaShavua(ev, il = false) {
805
- if (typeof ev !== 'object' || typeof ev.getFlags !== 'function') {
806
- throw new TypeError(`Bad event argument: ${ev}`);
807
- } else if (ev.getFlags() != core.flags.PARSHA_HASHAVUA) {
808
- throw new TypeError(`Event must be parsha hashavua: ${ev.getDesc()}`);
809
- }
810
- // first, collect the default aliyot and haftara
811
- const parsha = ev.parsha;
812
- const result = getLeyningForParshaShabbatOnly(parsha);
813
- const hd = ev.getDate();
814
- // Now, check for special maftir or haftara on same date
815
- const special = specialReadings2(parsha, hd, il, result.fullkriyah);
816
- const reason = special.reason;
817
- if (special.haft) {
818
- const haft = result.haft = cloneHaftara(special.haft);
819
- result.haftara = makeSummaryFromParts(haft);
820
- result.haftaraNumV = sumVerses(haft);
821
- if (special.seph) {
822
- const seph = result.seph = cloneHaftara(special.seph);
823
- result.sephardic = makeSummaryFromParts(seph);
824
- result.sephardicNumV = sumVerses(seph);
825
- }
826
- }
827
- if (reason['7'] || reason['M']) {
828
- result.fullkriyah = special.aliyot;
829
- const parts = makeLeyningParts(result.fullkriyah);
830
- result.summary = makeSummaryFromParts(parts);
831
- result.summaryParts = parts;
832
- }
833
- const reasons = Object.keys(reason);
834
- if (reasons.length !== 0) {
835
- result.reason = reason;
836
- for (const num of reasons) {
837
- if (num === 'haftara' || num === 'sephardic') {
838
- const haftObj = result[num === 'haftara' ? 'haft' : 'seph'];
839
- const hafts = Array.isArray(haftObj) ? haftObj : [haftObj];
840
- for (const haft of hafts) {
841
- haft.reason = reason[num];
842
- }
843
- } else {
844
- const aliyah = result.fullkriyah[num];
845
- if (typeof aliyah === 'object') {
846
- aliyah.reason = reason[num];
847
- }
848
- }
849
- }
850
- }
851
- return result;
852
- }
853
-
854
- /**
855
- * Parsha metadata
856
- * @typedef {Object} ParshaMeta
857
- * @property {number} num - 1 for Bereshit, 2 for Noach, etc. `undefined` for holiday readings
858
- * @property {string} hebrew - parsha name in Hebrew with niqud
859
- * @property {number} book - 1 for Genesis, 2 for Exodus, 5 for Deuteronomy
860
- * @property {Aliyah|Aliyah[]} haft - Haftarah object(s)
861
- * @property {Aliyah|Aliyah[]} [seph] - Haftarah object(s) for Sephardim
862
- * @property {Object<string,string[]>} fullkriyah - Map of aliyot `1` through `7` plus `M` for maftir
863
- * @property {Object<string,string[]>} weekday - Map of weekday Torah Readings
864
- * aliyot `1` through `3` for Monday and Thursday
865
- */
866
-
867
- /**
868
- * Returns the parsha metadata
869
- * @param {string|string[]} parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
870
- * @return {ParshaMeta}
871
- */
872
- function lookupParsha(parsha) {
873
- const name = parshaToString(parsha);
874
- const raw = parshiyotObj[name];
875
- if (typeof raw !== 'object') {
876
- throw new TypeError(`Bad parsha argument: ${parsha}`);
877
- }
878
- return raw;
879
- }
880
-
881
- /**
882
- * @private
883
- * @param {HDate} saturday
884
- * @param {boolean} il
885
- * @return {Leyning}
886
- */
887
- function findParshaHaShavua(saturday, il) {
888
- const hyear = saturday.getFullYear();
889
- const sedra = core.HebrewCalendar.getSedra(hyear, il);
890
- const parsha = sedra.lookup(saturday);
891
- if (!parsha.chag) {
892
- return parsha;
893
- }
894
- // Special case between YK and Simchat Torah
895
- if (saturday.getMonth() === core.months.TISHREI) {
896
- const dd = saturday.getDate();
897
- const simchatTorah = il ? 22 : 23;
898
- if (dd > 10 && dd <= simchatTorah) {
899
- return {
900
- parsha: ['Vezot Haberakhah'],
901
- chag: false,
902
- num: 54
903
- };
904
- }
905
- }
906
- // Search for next regular parsha, which could even spill into next year
907
- const endOfYear = new core.HDate(1, core.months.TISHREI, hyear + 1).abs() - 1;
908
- const endAbs = endOfYear + 30;
909
- for (let sat2 = saturday.abs() + 7; sat2 <= endAbs; sat2 += 7) {
910
- const sedra2 = sat2 > endOfYear ? core.HebrewCalendar.getSedra(hyear + 1, il) : sedra;
911
- const parsha2 = sedra2.lookup(sat2);
912
- if (!parsha2.chag) {
913
- return parsha2;
914
- }
915
- }
916
- /* NOTREACHED */
917
- return null;
918
- }
919
-
920
- /**
921
- * Looks up leyning for a regular Shabbat, Monday/Thursday weekday or holiday.
922
- *
923
- * If `hdate` coincides with a holiday that has Torah reading, returns the
924
- * reading for that day (see {@link getLeyningForHoliday})
925
- *
926
- * Otherwise, if `hdate` is a Saturday, returns {@link getLeyningForParshaHaShavua}
927
- *
928
- * Otherwise, if `hdate` is a Monday or Thursday, returns {@link Leyning} for the
929
- * Parashat haShavua, containing only the `weekday` aliyot (no `fullkriyah`).
930
- *
931
- * Otherwise, returns `undefined`.
932
- *
933
- * @param {HDate} hdate Hebrew Date
934
- * @param {boolean} il in Israel
935
- * @param {boolean} [wantarray] to return an array of 0 or more readings
936
- * @return {Leyning|Leyning[]} map of aliyot
937
- */
938
- function getLeyningOnDate(hdate, il, wantarray = false) {
939
- const dow = hdate.getDay();
940
- if (dow === 6) {
941
- const hyear = hdate.getFullYear();
942
- const sedra = core.HebrewCalendar.getSedra(hyear, il);
943
- const parsha = sedra.lookup(hdate);
944
- if (!parsha.chag) {
945
- const parshaEvent = new core.ParshaEvent(hdate, parsha.parsha, il);
946
- const reading = getLeyningForParshaHaShavua(parshaEvent, il);
947
- return wantarray ? [reading] : reading;
948
- }
949
- }
950
- const events = core.HebrewCalendar.getHolidaysOnDate(hdate, il) || [];
951
- const arr = [];
952
- let hasFullKriyah = false;
953
- for (const ev of events) {
954
- const reading = getLeyningForHoliday(ev, il);
955
- if (reading) {
956
- arr.push(reading);
957
- if (reading.fullkriyah) {
958
- hasFullKriyah = true;
959
- }
960
- const mincha = getMincha(ev, il);
961
- if (mincha) {
962
- arr.push(mincha);
963
- }
964
- }
965
- }
966
- if (!hasFullKriyah && (dow === 1 || dow === 4)) {
967
- const saturday = hdate.onOrAfter(6);
968
- const parsha = findParshaHaShavua(saturday);
969
- const reading = {
970
- name: makeLeyningNames(parsha.parsha),
971
- parsha: parsha.parsha,
972
- parshaNum: parsha.num,
973
- weekday: getWeekdayReading(parsha.parsha)
974
- };
975
- arr.unshift(reading);
976
- }
977
- return wantarray ? arr : arr[0];
978
- }
979
- const minchaSuffix = ' (Mincha)';
980
-
981
- /**
982
- * @private
983
- * @param {Event} ev
984
- * @param {boolean} il
985
- * @return {Leyning}
986
- */
987
- function getMincha(ev, il) {
988
- const desc = ev.getDesc() + minchaSuffix;
989
- const reading1 = getLeyningForHolidayKey(desc, ev.cholHaMoedDay, il);
990
- if (reading1) {
991
- return reading1;
992
- }
993
- const desc2 = getLeyningKeyForEvent(ev, il);
994
- if (desc2) {
995
- const reading2 = getLeyningForHolidayKey(desc2 + minchaSuffix, ev.cholHaMoedDay, il);
996
- if (reading2) {
997
- return reading2;
998
- }
999
- }
1000
- return undefined;
1001
- }
1002
-
1003
- const fmt = new Intl.DateTimeFormat('en-US', {
1004
- year: 'numeric',
1005
- month: 'short',
1006
- day: '2-digit'
1007
- });
1008
-
1009
- /**
1010
- * @private
1011
- * @param {Date} dt
1012
- * @return {string}
1013
- */
1014
- function fmtDate(dt) {
1015
- const s = fmt.format(dt).split(' ');
1016
- return s[1].substring(0, 2) + '-' + s[0] + '-' + s[2];
1017
- }
1018
-
1019
- /**
1020
- * @private
1021
- * @param {Event[]} events
1022
- * @return {Object<string,boolean>}
1023
- */
1024
- function getParshaDates(events) {
1025
- const parshaEvents = events.filter(ev => ev.getFlags() === core.flags.PARSHA_HASHAVUA);
1026
- const parshaDates = parshaEvents.reduce((set, ev) => {
1027
- set[ev.getDate().toString()] = true;
1028
- return set;
1029
- }, {});
1030
- return parshaDates;
1031
- }
1032
-
1033
- /**
1034
- * @private
1035
- * @param {fs.WriteStream} stream
1036
- * @param {number} hyear
1037
- * @param {boolean} il
1038
- */
1039
- function writeFullKriyahCsv(stream, hyear, il) {
1040
- const events0 = core.HebrewCalendar.calendar({
1041
- year: hyear,
1042
- isHebrewYear: true,
1043
- sedrot: true,
1044
- il: il
1045
- });
1046
- const events = events0.filter(ev => ev.getDesc() !== 'Rosh Chodesh Tevet');
1047
- const parshaDates = getParshaDates(events);
1048
- stream.write('"Date","Parashah","Aliyah","Reading","Verses"\r\n');
1049
- for (const ev of events) {
1050
- if (ev.getFlags() === core.flags.PARSHA_HASHAVUA || !parshaDates[ev.getDate().toString()]) {
1051
- writeFullKriyahEvent(stream, ev, il);
1052
- }
1053
- }
1054
- }
1055
-
1056
- /**
1057
- * @private
1058
- * @param {Event} ev
1059
- * @return {boolean}
1060
- */
1061
- function ignore(ev) {
1062
- const mask = ev.getFlags();
1063
- if (mask === core.flags.SPECIAL_SHABBAT) {
1064
- return true;
1065
- }
1066
- if (mask !== core.flags.ROSH_CHODESH) {
1067
- return false;
1068
- }
1069
- return ev.getDate().getDay() === 6;
1070
- }
1071
-
1072
- /**
1073
- * @private
1074
- * @param {fs.WriteStream} stream
1075
- * @param {Event} ev
1076
- * @param {boolean} il
1077
- */
1078
- function writeFullKriyahEvent(stream, ev, il) {
1079
- if (ignore(ev)) {
1080
- return;
1081
- }
1082
- const mask = ev.getFlags();
1083
- const isParsha = mask === core.flags.PARSHA_HASHAVUA;
1084
- const reading = isParsha ? getLeyningForParshaHaShavua(ev, il) : getLeyningForHoliday(ev, il);
1085
- if (reading) {
1086
- writeCsvLines(stream, ev, reading, il, isParsha);
1087
- if (!isParsha) {
1088
- writeHolidayMincha(stream, ev, il);
1089
- }
1090
- }
1091
- }
1092
-
1093
- /**
1094
- * @private
1095
- * @param {fs.WriteStream} stream
1096
- * @param {Event} ev
1097
- * @param {boolean} il
1098
- */
1099
- function writeHolidayMincha(stream, ev, il) {
1100
- const desc = ev.getDesc();
1101
- const minchaDesc1 = desc + ' (Mincha)';
1102
- const readingMincha1 = getLeyningForHolidayKey(minchaDesc1, ev.cholHaMoedDay, il);
1103
- const readingMincha = readingMincha1 || getLeyningForHolidayKey(getLeyningKeyForEvent(ev, il) + ' (Mincha)', ev.cholHaMoedDay, il);
1104
- if (readingMincha) {
1105
- const minchaEv = new core.Event(ev.getDate(), minchaDesc1, core.flags.USER_EVENT);
1106
- writeCsvLines(stream, minchaEv, readingMincha, il, false);
1107
- }
1108
- }
1109
-
1110
- /**
1111
- * Formats reading for CSV
1112
- * @param {fs.WriteStream} stream
1113
- * @param {Event} ev
1114
- * @param {Leyning} reading
1115
- * @param {boolean} il
1116
- * @param {boolean} isParsha
1117
- */
1118
- function writeCsvLines(stream, ev, reading, il, isParsha) {
1119
- const parsha = isParsha ? ev.basename() : getLeyningKeyForEvent(ev, il) || ev.render();
1120
- const date = fmtDate(ev.getDate().greg());
1121
- const lines = getFullKriyahLines(reading);
1122
- for (const s of lines) {
1123
- const code = s[0].charCodeAt(0);
1124
- if (code < 48 || code > 57) {
1125
- s[0] = `"${s[0]}"`;
1126
- }
1127
- stream.write(`${date},"${parsha}",${s[0]},"${s[1]}",${s[2]}\r\n`);
1128
- }
1129
- stream.write('\r\n');
1130
- }
1131
-
1132
- /**
1133
- * @private
1134
- * @param {any} reading
1135
- * @return {any[]}
1136
- */
1137
- function getFullKriyahLines(reading) {
1138
- const lines = [];
1139
- if (reading.fullkriyah) {
1140
- for (const [num, a] of Object.entries(reading.fullkriyah)) {
1141
- if (typeof a !== 'undefined') {
1142
- var _reading$reason;
1143
- const k = num == 'M' ? 'maf' : num;
1144
- let aliyah = formatAliyahWithBook(a);
1145
- if ((_reading$reason = reading.reason) !== null && _reading$reason !== void 0 && _reading$reason[num]) {
1146
- aliyah += ' | ' + reading.reason[num];
1147
- }
1148
- lines.push([k, aliyah, a.v || '']);
1149
- }
1150
- }
1151
- }
1152
- let specialHaftara = false;
1153
- if (reading.haftara) {
1154
- var _reading$reason2;
1155
- let haftara = reading.haftara.replace(/,/g, ';');
1156
- if ((_reading$reason2 = reading.reason) !== null && _reading$reason2 !== void 0 && _reading$reason2.haftara) {
1157
- specialHaftara = true;
1158
- haftara += ' | ' + reading.reason.haftara;
1159
- }
1160
- lines.push(['Haftara', haftara, reading.haftaraNumV || '']);
1161
- }
1162
- if (reading.sephardic && !specialHaftara) {
1163
- const sephardic = reading.sephardic.replace(/,/g, ';');
1164
- lines.push(['Haftara for Sephardim', sephardic, reading.sephardicNumV || '']);
1165
- }
1166
- if (reading.triHaftara) {
1167
- const haftara = reading.triHaftara.replace(/,/g, ';');
1168
- lines.push(['Alternate Haftara', haftara, reading.triHaftaraNumV || '']);
1169
- }
1170
- if (reading.megillah) {
1171
- for (const [num, a] of Object.entries(reading.megillah)) {
1172
- if (typeof a !== 'undefined') {
1173
- const aliyah = formatAliyahWithBook(a);
1174
- lines.push([`Megillah Ch. ${num}`, aliyah, a.v || '']);
1175
- }
1176
- }
1177
- }
1178
- return lines;
1179
- }
1180
-
1181
- exports.BOOK = BOOK;
1182
- exports.calculateNumVerses = calculateNumVerses;
1183
- exports.clone = clone;
1184
- exports.cloneHaftara = cloneHaftara;
1185
- exports.formatAliyahShort = formatAliyahShort;
1186
- exports.formatAliyahWithBook = formatAliyahWithBook;
1187
- exports.getLeyningForHoliday = getLeyningForHoliday;
1188
- exports.getLeyningForHolidayKey = getLeyningForHolidayKey;
1189
- exports.getLeyningForParsha = getLeyningForParsha;
1190
- exports.getLeyningForParshaHaShavua = getLeyningForParshaHaShavua;
1191
- exports.getLeyningKeyForEvent = getLeyningKeyForEvent;
1192
- exports.getLeyningOnDate = getLeyningOnDate;
1193
- exports.getParshaDates = getParshaDates;
1194
- exports.getWeekdayReading = getWeekdayReading;
1195
- exports.hasFestival = hasFestival;
1196
- exports.lookupFestival = lookupFestival;
1197
- exports.lookupParsha = lookupParsha;
1198
- exports.makeLeyningNames = makeLeyningNames;
1199
- exports.makeLeyningParts = makeLeyningParts;
1200
- exports.makeLeyningSummary = makeLeyningSummary;
1201
- exports.makeSummaryFromParts = makeSummaryFromParts;
1202
- exports.parshaToString = parshaToString;
1203
- exports.specialReadings2 = specialReadings2;
1204
- exports.sumVerses = sumVerses;
1205
- exports.writeCsvLines = writeCsvLines;
1206
- exports.writeFullKriyahCsv = writeFullKriyahCsv;
1207
- exports.writeHolidayMincha = writeHolidayMincha;