@hebcal/rest-api 5.0.5 → 5.1.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.
@@ -1,302 +1,688 @@
1
- /*! @hebcal/rest-api v5.0.5 */
1
+ /*! @hebcal/rest-api v5.1.0 */
2
2
  var hebcalFullCalendar = (function (exports, core, leyning) {
3
3
  'use strict';
4
4
 
5
- var holidayDescription = {
6
- "Asara B'Tevet": "Fast commemorating the siege of Jerusalem",
7
- "Ben-Gurion Day": "Commemorates the life and vision of Israel's first Prime Minister David Ben-Gurion",
8
- "Birkat Hachamah": "A rare Jewish blessing recited once every 28 years thanking G-d for creating the sun",
9
- "Chag HaBanot": "North African Chanukah festival of daughters. Called Eid al-Banat in Arabic, the holiday was most preserved in Tunisia",
10
- "Chanukah": "Hanukkah, the Jewish festival of rededication. Also known as the Festival of Lights, the eight-day festival is observed by lighting the candles of a hanukkiah (menorah)",
11
- "Days of the Omer": "7 weeks from the second night of Pesach to the day before Shavuot. Also called Sefirat HaOmer, it is a practice that consists of a verbal counting of each of the forty-nine days between the two holidays",
12
- "Family Day": "Yom HaMishpacha, a day to honor the family unit",
13
- "Hebrew Language Day": "Promotes the Hebrew language in Israel and around the world. Occurs on the birthday of Eliezer Ben Yehuda, the father of modern spoken Hebrew",
14
- "Herzl Day": "Commemorates the life and vision of Zionist leader Theodor Herzl",
15
- "Jabotinsky Day": "Commemorates the life and vision of Zionist leader Ze'ev Jabotinsky",
16
- "Lag BaOmer": "33rd day of counting the Omer. The holiday is a temporary break from the semi-mourning period the counting of the Omer. Practices include lighting bonfires, getting haircuts, and Jewish weddings",
17
- "Leil Selichot": "Prayers for forgiveness in preparation for the High Holidays",
18
- "Pesach Sheni": "Second Passover, one month after Passover",
19
- "Pesach": "Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt",
20
- "Purim Katan": "Minor Purim celebration during Adar I on leap years",
21
- "Purim": "Celebration of Jewish deliverance as told by Megilat Esther. It commemorates a time when the Jewish people living in Persia were saved from extermination",
22
- "Purim Meshulash": "Triple Purim, spanning 3 days in Jerusalem and walled cities. It occurs when the 15th of Adar coincides with Shabbat",
23
- "Rosh Chodesh Nisan": "Start of month of Nisan on the Hebrew calendar. נִיסָן (transliterated Nisan or Nissan) is the 1st month of the Hebrew year, has 30 days, and corresponds to March or April on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
24
- "Rosh Chodesh Iyyar": "Start of month of Iyyar on the Hebrew calendar. אִיָיר (transliterated Iyyar or Iyar) is the 2nd month of the Hebrew year, has 29 days, and corresponds to April or May on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
25
- "Rosh Chodesh Sivan": "Start of month of Sivan on the Hebrew calendar. Sivan (סִיוָן) is the 3rd month of the Hebrew year, has 30 days, and corresponds to May or June on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
26
- "Rosh Chodesh Tamuz": "Start of month of Tamuz on the Hebrew calendar. תַּמּוּז (transliterated Tamuz or Tammuz) is the 4th month of the Hebrew year, has 29 days, and corresponds to June or July on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
27
- "Rosh Chodesh Av": "Start of month of Av on the Hebrew calendar. Av (אָב) is the 5th month of the Hebrew year, has 30 days, and corresponds to July or August on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
28
- "Rosh Chodesh Elul": "Start of month of Elul on the Hebrew calendar. Elul (אֱלוּל) is the 6th month of the Hebrew year, has 29 days, and corresponds to August or September on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
29
- "Rosh Chodesh Cheshvan": "Start of month of Cheshvan on the Hebrew calendar. חֶשְׁוָן (transliterated Cheshvan or Heshvan) is the 8th month of the Hebrew year, has 29 or 30 days, and corresponds to October or November on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
30
- "Rosh Chodesh Kislev": "Start of month of Kislev on the Hebrew calendar. Kislev (כִּסְלֵו) is the 9th month of the Hebrew year, has 30 or 29 days, and corresponds to November or December on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
31
- "Rosh Chodesh Tevet": "Start of month of Tevet on the Hebrew calendar. Tevet (טֵבֵת) is the 10th month of the Hebrew year, has 29 days, and corresponds to December or January on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
32
- "Rosh Chodesh Sh'vat": "Start of month of Sh'vat on the Hebrew calendar. שְׁבָט (transliterated Sh'vat or Shevat) is the 11th month of the Hebrew year, has 30 days, and corresponds to January or February on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
33
- "Rosh Chodesh Adar": "Start of month of Adar on the Hebrew calendar. Adar (אַדָר) is the 12th month of the Hebrew year, has 29 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
34
- "Rosh Chodesh Adar I": "Start of month of Adar I (on leap years) on the Hebrew calendar. Adar I (אַדָר א׳) is the 12th month of the Hebrew year, occurs only on leap years, has 30 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
35
- "Rosh Chodesh Adar II": "Start of month of Adar II (on leap years) on the Hebrew calendar. Adar II (אַדָר ב׳), sometimes \"Adar Bet\" or \"Adar Sheni\", is the 13th month of the Hebrew year, has 29 days, occurs only on leap years, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
36
- "Rosh Hashana": "The Jewish New Year. Also spelled Rosh Hashanah",
37
- "Rosh Hashana LaBehemot": "New Year for Tithing Animals",
38
- "Shabbat Chazon": "Shabbat of Prophecy/Shabbat of Vision. Shabbat before Tish'a B'Av",
39
- "Shabbat HaChodesh": "Shabbat before Rosh Chodesh Nissan. Read in preparation for Passover",
40
- "Shabbat HaGadol": "Shabbat before Pesach (The Great Shabbat)",
41
- "Shabbat Machar Chodesh": "When Shabbat falls the day before Rosh Chodesh",
42
- "Shabbat Mevarchim Chodesh": "Shabbat that precedes Rosh Chodesh. The congregation blesses the forthcoming new month",
43
- "Shabbat Nachamu": "Shabbat after Tish'a B'Av (Shabbat of Consolation). The first of seven Shabbatot leading up to Rosh Hashanah. Named after the Haftarah (from Isaiah 40) which begins with the verse נַחֲמוּ נַחֲמוּ, עַמִּי (\"Comfort, oh comfort my people\")",
44
- "Shabbat Parah": "Shabbat of the Red Heifer. Shabbat before Shabbat HaChodesh, in preparation for Passover",
45
- "Shabbat Rosh Chodesh": "When Shabbat falls on Rosh Chodesh",
46
- "Shabbat Shekalim": "Shabbat before Rosh Chodesh Adar. Read in preparation for Purim",
47
- "Shabbat Shirah": "Shabbat of Song. Shabbat that includes Parashat Beshalach",
48
- "Shabbat Shuva": "Shabbat of Returning. Shabbat that occurs during the Ten Days of Repentance between Rosh Hashanah and Yom Kippur",
49
- "Shabbat Zachor": "Shabbat of Remembrance. Shabbat before Purim",
50
- "Shavuot": "Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai",
51
- "Shmini Atzeret": "Eighth Day of Assembly. Immediately following Sukkot, it is observed as a separate holiday in the Diaspora and is combined with Simchat Torah in Israel",
52
- "Shushan Purim": "Purim celebrated in Jerusalem and walled cities",
53
- "Shushan Purim Katan": "Minor Purim celebration during Adar I on leap years in Jerusalem and walled cities",
54
- "Sigd": "Ethiopian Jewish holiday occurring 50 days after Yom Kippur",
55
- "Simchat Torah": "Day of Celebrating the Torah. Celebration marking the conclusion of the annual cycle of public Torah readings, and the beginning of a new cycle",
56
- "Sukkot": "Feast of Booths. Also called the Feast of Tabernacles, the seven-day holiday is one of the Three Pilgrimage Festivals (Hebrew: שלוש רגלים, shalosh regalim)",
57
- "Ta'anit Bechorot": "Fast of the First Born",
58
- "Ta'anit Esther": "Fast of Esther",
59
- "Tish'a B'Av": "The Ninth of Av. Fast commemorating the destruction of the two Temples",
60
- "Tu B'Av": "Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av",
61
- "Tu BiShvat": "New Year for Trees. Tu BiShvat is one of four “New Years” mentioned in the Mishnah",
62
- "Tzom Gedaliah": "Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah",
63
- "Tzom Tammuz": "Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple",
64
- "Yitzhak Rabin Memorial Day": "Commemorates the life of Israeli Prime Minister Yitzhak Rabin",
65
- "Yom HaAliyah": "Recognizes Aliyah, immigration to the Jewish State of Israel",
66
- "Yom HaAliyah School Observance": "Aliyah Day observed in Israeli schools",
67
- "Yom HaAtzma'ut": "Israeli Independence Day. Commemorates the declaration of independence of Israel in 1948. Although Yom HaAtzma'ut is normally observed on the 5th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaZikaron, which always precedes it) would conflict with Shabbat",
68
- "Yom HaShoah": "Holocaust Memorial Day",
69
- "Yom HaZikaron": "Israeli Memorial Day. Remembers those who died in the War of Independence and other wars in Israel. The full name of the holiday is Yom HaZikaron LeHalalei Ma'arakhot Yisrael ul'Nifge'ei Pe'ulot HaEivah (Hebrew: יוֹם הזִּכָּרוֹן לְחַלְלֵי מַעֲרָכוֹת יִשְׂרָאֵל וּלְנִפְגְעֵי פְּעֻלּוֹת הָאֵיבָה), Memorial Day for the Fallen Soldiers of the Wars of Israel and Victims of Actions of Terrorism. Although Yom Hazikaron is normally observed on the 4th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaAtzma'ut, which always follows it) would conflict with Shabbat",
70
- "Yom Kippur": "Day of Atonement. The holiest day of the year in Judaism, traditionally observed with a 25-hour period of fasting and intensive prayer",
71
- "Yom Kippur Katan": "Minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh",
72
- "Yom Yerushalayim": "Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"
5
+ /* eslint-disable @typescript-eslint/no-namespace, no-inner-declarations */
6
+ /** @private */
7
+ const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
8
+ /** @private */
9
+ const monthLengths = [lengths, lengths.slice()];
10
+ monthLengths[1][2] = 29;
11
+ /**
12
+ * @private
13
+ */
14
+ function mod(x, y) {
15
+ return x - y * Math.floor(x / y);
16
+ }
17
+ /**
18
+ * @private
19
+ */
20
+ function quotient(x, y) {
21
+ return Math.floor(x / y);
22
+ }
23
+ /**
24
+ * @private
25
+ * @param abs - R.D. number of days
26
+ */
27
+ function yearFromFixed(abs) {
28
+ const l0 = abs - 1;
29
+ const n400 = quotient(l0, 146097);
30
+ const d1 = mod(l0, 146097);
31
+ const n100 = quotient(d1, 36524);
32
+ const d2 = mod(d1, 36524);
33
+ const n4 = quotient(d2, 1461);
34
+ const d3 = mod(d2, 1461);
35
+ const n1 = quotient(d3, 365);
36
+ const year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
37
+ return n100 !== 4 && n1 !== 4 ? year + 1 : year;
38
+ }
39
+ /*
40
+ const ABS_14SEP1752 = 639797;
41
+ const ABS_2SEP1752 = 639785;
42
+ */
43
+ /**
44
+ * Gregorian date helper functions.
45
+ */
46
+ var greg;
47
+ (function (greg) {
48
+ /**
49
+ * Returns true if the Gregorian year is a leap year
50
+ * @param {number} year Gregorian year
51
+ * @return {boolean}
52
+ */
53
+ function isLeapYear(year) {
54
+ return !(year % 4) && (!!(year % 100) || !(year % 400));
55
+ }
56
+ greg.isLeapYear = isLeapYear;
57
+ /**
58
+ * Number of days in the Gregorian month for given year
59
+ * @param {number} month Gregorian month (1=January, 12=December)
60
+ * @param {number} year Gregorian year
61
+ * @return {number}
62
+ */
63
+ function daysInMonth(month, year) {
64
+ // 1 based months
65
+ return monthLengths[+isLeapYear(year)][month];
66
+ }
67
+ greg.daysInMonth = daysInMonth;
68
+ /**
69
+ * Returns true if the object is a Javascript Date
70
+ * @param {Object} obj
71
+ * @return {boolean}
72
+ */
73
+ function isDate(obj) {
74
+ // eslint-disable-next-line no-prototype-builtins
75
+ return typeof obj === 'object' && Date.prototype.isPrototypeOf(obj);
76
+ }
77
+ greg.isDate = isDate;
78
+ /**
79
+ * @private
80
+ * @param year
81
+ * @param month (1-12)
82
+ * @param day (1-31)
83
+ */
84
+ function toFixed(year, month, day) {
85
+ const py = year - 1;
86
+ return (365 * py +
87
+ quotient(py, 4) -
88
+ quotient(py, 100) +
89
+ quotient(py, 400) +
90
+ quotient(367 * month - 362, 12) +
91
+ (month <= 2 ? 0 : isLeapYear(year) ? -1 : -2) +
92
+ day);
93
+ }
94
+ /**
95
+ * Converts Gregorian date to absolute R.D. (Rata Die) days
96
+ * @param {Date} date Gregorian date
97
+ * @return {number}
98
+ */
99
+ function greg2abs(date) {
100
+ if (!isDate(date)) {
101
+ throw new TypeError(`Argument not a Date: ${date}`);
102
+ }
103
+ const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
104
+ /*
105
+ if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
106
+ throw new RangeError(`Invalid Date: ${date}`);
107
+ }
108
+ */
109
+ return abs;
110
+ }
111
+ greg.greg2abs = greg2abs;
112
+ /**
113
+ * Converts from Rata Die (R.D. number) to Gregorian date.
114
+ * See the footnote on page 384 of ``Calendrical Calculations, Part II:
115
+ * Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
116
+ * Clamen, Software--Practice and Experience, Volume 23, Number 4
117
+ * (April, 1993), pages 383-404 for an explanation.
118
+ * @param {number} abs - R.D. number of days
119
+ * @return {Date}
120
+ */
121
+ function abs2greg(abs) {
122
+ if (typeof abs !== 'number') {
123
+ throw new TypeError(`Argument not a Number: ${abs}`);
124
+ }
125
+ abs = Math.trunc(abs);
126
+ /*
127
+ if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
128
+ throw new RangeError(`Invalid Date: ${abs}`);
129
+ }
130
+ */
131
+ const year = yearFromFixed(abs);
132
+ const priorDays = abs - toFixed(year, 1, 1);
133
+ const correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear(year) ? 1 : 2;
134
+ const month = quotient(12 * (priorDays + correction) + 373, 367);
135
+ const day = abs - toFixed(year, month, 1) + 1;
136
+ const dt = new Date(year, month - 1, day);
137
+ if (year < 100 && year >= 0) {
138
+ dt.setFullYear(year);
139
+ }
140
+ return dt;
141
+ }
142
+ greg.abs2greg = abs2greg;
143
+ })(greg || (greg = {}));
144
+
145
+ const alefbet = {
146
+ א: 1,
147
+ ב: 2,
148
+ ג: 3,
149
+ ד: 4,
150
+ ה: 5,
151
+ ו: 6,
152
+ ז: 7,
153
+ ח: 8,
154
+ ט: 9,
155
+ י: 10,
156
+ כ: 20,
157
+ ל: 30,
158
+ מ: 40,
159
+ נ: 50,
160
+ ס: 60,
161
+ ע: 70,
162
+ פ: 80,
163
+ צ: 90,
164
+ ק: 100,
165
+ ר: 200,
166
+ ש: 300,
167
+ ת: 400,
73
168
  };
169
+ const heb2num = new Map();
170
+ const num2heb = new Map();
171
+ for (const [key, val] of Object.entries(alefbet)) {
172
+ heb2num.set(key, val);
173
+ num2heb.set(val, key);
174
+ }
74
175
 
75
176
  /**
177
+ * Formats a number with leading zeros so the resulting string is 4 digits long.
178
+ * Similar to `string.padStart(4, '0')` but will also format
179
+ * negative numbers similar to how the JavaScript date formats
180
+ * negative year numbers (e.g. `-37` is formatted as `-000037`).
76
181
  * @param {number} number
77
182
  * @return {string}
78
183
  */
79
- function pad2(number) {
80
- if (number < 10) {
81
- return '0' + number;
82
- }
83
- return '' + number;
184
+ function pad4(number) {
185
+ if (number < 0) {
186
+ return '-00' + pad4(-number);
187
+ }
188
+ else if (number < 10) {
189
+ return '000' + number;
190
+ }
191
+ else if (number < 100) {
192
+ return '00' + number;
193
+ }
194
+ else if (number < 1000) {
195
+ return '0' + number;
196
+ }
197
+ return String(number);
84
198
  }
85
-
86
199
  /**
200
+ * Formats a number with leading zeros so the resulting string is 2 digits long.
201
+ * Similar to `string.padStart(2, '0')`.
87
202
  * @param {number} number
88
203
  * @return {string}
89
204
  */
90
- function pad4(number) {
91
- if (number < 0) {
92
- return '-00' + pad4(-number);
93
- } else if (number < 10) {
94
- return '000' + number;
95
- } else if (number < 100) {
96
- return '00' + number;
97
- } else if (number < 1000) {
98
- return '0' + number;
99
- }
100
- return '' + number;
205
+ function pad2(number) {
206
+ if (number < 10) {
207
+ return '0' + number;
208
+ }
209
+ return String(number);
101
210
  }
102
-
103
211
  /**
104
- * Returns just the date portion as YYYY-MM-DD
105
- * @param {Date} d
212
+ * Returns YYYY-MM-DD in the local timezone
213
+ * @private
214
+ * @param {Date} dt
106
215
  * @return {string}
107
216
  */
108
- function toISOString(d) {
109
- return pad4(d.getFullYear()) + '-' + pad2(d.getMonth() + 1) + '-' + pad2(d.getDate());
217
+ function isoDateString(dt) {
218
+ return (pad4(dt.getFullYear()) +
219
+ '-' +
220
+ pad2(dt.getMonth() + 1) +
221
+ '-' +
222
+ pad2(dt.getDate()));
223
+ }
224
+
225
+ var poAshkenazi = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);" }, "contexts": { "": { "Tevet": ["Teves"] } } };
226
+
227
+ var poHe = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);" }, "contexts": { "": { "Adar": ["אַדָר"], "Adar I": ["אַדָר א׳"], "Adar II": ["אַדָר ב׳"], "Av": ["אָב"], "Cheshvan": ["חֶשְׁוָן"], "Elul": ["אֱלוּל"], "Iyyar": ["אִיָיר"], "Kislev": ["כִּסְלֵו"], "Nisan": ["נִיסָן"], "Sh'vat": ["שְׁבָט"], "Sivan": ["סִיוָן"], "Tamuz": ["תַּמּוּז"], "Tevet": ["טֵבֵת"], "Tishrei": ["תִּשְׁרֵי"] } } };
228
+
229
+ const noopLocale = {
230
+ headers: { 'plural-forms': 'nplurals=2; plural=(n!=1);' },
231
+ contexts: { '': {} },
232
+ };
233
+ const alias = {
234
+ 'h': 'he',
235
+ 'a': 'ashkenazi',
236
+ 's': 'en',
237
+ '': 'en',
238
+ };
239
+ /** @private */
240
+ const locales = new Map();
241
+ /** @private */
242
+ let activeLocale;
243
+ /** @private */
244
+ let activeName;
245
+ /**
246
+ * A locale in Hebcal is used for translations/transliterations of
247
+ * holidays. `@hebcal/hdate` supports four locales by default
248
+ * * `en` - default, Sephardic transliterations (e.g. "Shabbat")
249
+ * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
250
+ * * `he` - Hebrew (e.g. "שַׁבָּת")
251
+ * * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
252
+ */
253
+ class Locale {
254
+ /**
255
+ * Returns translation only if `locale` offers a non-empty translation for `id`.
256
+ * Otherwise, returns `undefined`.
257
+ * @param {string} id Message ID to translate
258
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
259
+ * @return {string}
260
+ */
261
+ static lookupTranslation(id, locale) {
262
+ const loc = (typeof locale === 'string' && locales.get(locale.toLowerCase())) || activeLocale;
263
+ const array = loc[id];
264
+ if ((array === null || array === void 0 ? void 0 : array.length) && array[0].length) {
265
+ return array[0];
266
+ }
267
+ return undefined;
268
+ }
269
+ /**
270
+ * By default, if no translation was found, returns `id`.
271
+ * @param {string} id Message ID to translate
272
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
273
+ * @return {string}
274
+ */
275
+ static gettext(id, locale) {
276
+ const text = this.lookupTranslation(id, locale);
277
+ if (typeof text === 'undefined') {
278
+ return id;
279
+ }
280
+ return text;
281
+ }
282
+ /**
283
+ * Register locale translations.
284
+ * @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
285
+ * @param {LocaleData} data parsed data from a `.po` file.
286
+ */
287
+ static addLocale(locale, data) {
288
+ if (typeof locale !== 'string') {
289
+ throw new TypeError(`Invalid locale name: ${locale}`);
290
+ }
291
+ if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
292
+ throw new TypeError(`Locale '${locale}' invalid compact format`);
293
+ }
294
+ locales.set(locale.toLowerCase(), data.contexts['']);
295
+ }
296
+ /**
297
+ * Adds a translation to `locale`, replacing any previous translation.
298
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
299
+ * @param {string} id Message ID to translate
300
+ * @param {string | string[]} translation Translation text
301
+ */
302
+ static addTranslation(locale, id, translation) {
303
+ if (typeof locale !== 'string') {
304
+ throw new TypeError(`Invalid locale name: ${locale}`);
305
+ }
306
+ const loc = locales.get(locale.toLowerCase());
307
+ if (!loc) {
308
+ throw new TypeError(`Unknown locale: ${locale}`);
309
+ }
310
+ if (typeof id !== 'string' || id.length === 0) {
311
+ throw new TypeError(`Invalid id: ${id}`);
312
+ }
313
+ const isArray = Array.isArray(translation);
314
+ if (isArray) {
315
+ const t0 = translation[0];
316
+ if (typeof t0 !== 'string' || t0.length === 0) {
317
+ throw new TypeError(`Invalid translation array: ${translation}`);
318
+ }
319
+ }
320
+ else if (typeof translation !== 'string') {
321
+ throw new TypeError(`Invalid translation: ${translation}`);
322
+ }
323
+ loc[id] = isArray ? translation : [translation];
324
+ }
325
+ /**
326
+ * Adds multiple translations to `locale`, replacing any previous translations.
327
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
328
+ * @param {LocaleData} data parsed data from a `.po` file.
329
+ */
330
+ static addTranslations(locale, data) {
331
+ if (typeof locale !== 'string') {
332
+ throw new TypeError(`Invalid locale name: ${locale}`);
333
+ }
334
+ const loc = locales.get(locale.toLowerCase());
335
+ if (!loc) {
336
+ throw new TypeError(`Unknown locale: ${locale}`);
337
+ }
338
+ if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
339
+ throw new TypeError(`Locale '${locale}' invalid compact format`);
340
+ }
341
+ const ctx = data.contexts[''];
342
+ Object.assign(loc, ctx);
343
+ }
344
+ /**
345
+ * Activates a locale. Throws an error if the locale has not been previously added.
346
+ * After setting the locale to be used, all strings marked for translations
347
+ * will be represented by the corresponding translation in the specified locale.
348
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
349
+ */
350
+ static useLocale(locale) {
351
+ const locale0 = locale.toLowerCase();
352
+ const obj = locales.get(locale0);
353
+ if (!obj) {
354
+ throw new RangeError(`Locale '${locale}' not found`);
355
+ }
356
+ activeName = alias[locale0] || locale0;
357
+ activeLocale = obj;
358
+ return activeLocale;
359
+ }
360
+ /**
361
+ * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
362
+ * @return {string}
363
+ */
364
+ static getLocaleName() {
365
+ return activeName;
366
+ }
367
+ /**
368
+ * Returns the names of registered locales
369
+ * @return {string[]}
370
+ */
371
+ static getLocaleNames() {
372
+ const keys = Array.from(locales.keys());
373
+ return keys.sort((a, b) => a.localeCompare(b));
374
+ }
375
+ /**
376
+ * @param {number} n
377
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
378
+ * @return {string}
379
+ */
380
+ static ordinal(n, locale) {
381
+ const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
382
+ const locale0 = locale1 || activeName;
383
+ if (!locale0) {
384
+ return this.getEnOrdinal(n);
385
+ }
386
+ switch (locale0) {
387
+ case 'en':
388
+ case 's':
389
+ case 'a':
390
+ case 'ashkenazi':
391
+ case 'ashkenazi_litvish':
392
+ case 'ashkenazi_poylish':
393
+ case 'ashkenazi_standard':
394
+ return this.getEnOrdinal(n);
395
+ case 'es':
396
+ return n + 'º';
397
+ case 'h':
398
+ case 'he':
399
+ case 'he-x-nonikud':
400
+ return String(n);
401
+ default:
402
+ return n + '.';
403
+ }
404
+ }
405
+ /**
406
+ * @private
407
+ * @param {number} n
408
+ * @return {string}
409
+ */
410
+ static getEnOrdinal(n) {
411
+ const s = ['th', 'st', 'nd', 'rd'];
412
+ const v = n % 100;
413
+ return n + (s[(v - 20) % 10] || s[v] || s[0]);
414
+ }
415
+ /**
416
+ * Removes nekudot from Hebrew string
417
+ * @param {string} str
418
+ * @return {string}
419
+ */
420
+ static hebrewStripNikkud(str) {
421
+ return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
422
+ }
110
423
  }
424
+ Locale.addLocale('en', noopLocale);
425
+ Locale.addLocale('s', noopLocale);
426
+ Locale.addLocale('', noopLocale);
427
+ Locale.useLocale('en');
428
+ /* Ashkenazic transliterations */
429
+ Locale.addLocale('ashkenazi', poAshkenazi);
430
+ Locale.addLocale('a', poAshkenazi);
431
+ /* Hebrew with nikkud */
432
+ Locale.addLocale('he', poHe);
433
+ Locale.addLocale('h', poHe);
434
+ /* Hebrew without nikkud */
435
+ const heStrs = poHe.contexts[''];
436
+ const heNoNikud = {};
437
+ for (const [key, val] of Object.entries(heStrs)) {
438
+ heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];
439
+ }
440
+ const poHeNoNikud = {
441
+ headers: poHe.headers,
442
+ contexts: { '': heNoNikud },
443
+ };
444
+ Locale.addLocale('he-x-NoNikud', poHeNoNikud);
445
+
446
+ var holidayDescription0 = {
447
+ "Asara B'Tevet": "Fast commemorating the siege of Jerusalem",
448
+ "Ben-Gurion Day": "Commemorates the life and vision of Israel's first Prime Minister David Ben-Gurion",
449
+ "Birkat Hachamah": "A rare Jewish blessing recited once every 28 years thanking G-d for creating the sun",
450
+ "Chag HaBanot": "North African Chanukah festival of daughters. Called Eid al-Banat in Arabic, the holiday was most preserved in Tunisia",
451
+ "Chanukah": "Hanukkah, the Jewish festival of rededication. Also known as the Festival of Lights, the eight-day festival is observed by lighting the candles of a hanukkiah (menorah)",
452
+ "Days of the Omer": "7 weeks from the second night of Pesach to the day before Shavuot. Also called Sefirat HaOmer, it is a practice that consists of a verbal counting of each of the forty-nine days between the two holidays",
453
+ "Family Day": "Yom HaMishpacha, a day to honor the family unit",
454
+ "Hebrew Language Day": "Promotes the Hebrew language in Israel and around the world. Occurs on the birthday of Eliezer Ben Yehuda, the father of modern spoken Hebrew",
455
+ "Herzl Day": "Commemorates the life and vision of Zionist leader Theodor Herzl",
456
+ "Jabotinsky Day": "Commemorates the life and vision of Zionist leader Ze'ev Jabotinsky",
457
+ "Lag BaOmer": "33rd day of counting the Omer. The holiday is a temporary break from the semi-mourning period the counting of the Omer. Practices include lighting bonfires, getting haircuts, and Jewish weddings",
458
+ "Leil Selichot": "Prayers for forgiveness in preparation for the High Holidays",
459
+ "Pesach Sheni": "Second Passover, one month after Passover",
460
+ "Pesach": "Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt",
461
+ "Purim Katan": "Minor Purim celebration during Adar I on leap years",
462
+ "Purim": "Celebration of Jewish deliverance as told by Megilat Esther. It commemorates a time when the Jewish people living in Persia were saved from extermination",
463
+ "Purim Meshulash": "Triple Purim, spanning 3 days in Jerusalem and walled cities. It occurs when the 15th of Adar coincides with Shabbat",
464
+ "Rosh Chodesh Nisan": "Start of month of Nisan on the Hebrew calendar. נִיסָן (transliterated Nisan or Nissan) is the 1st month of the Hebrew year, has 30 days, and corresponds to March or April on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
465
+ "Rosh Chodesh Iyyar": "Start of month of Iyyar on the Hebrew calendar. אִיָיר (transliterated Iyyar or Iyar) is the 2nd month of the Hebrew year, has 29 days, and corresponds to April or May on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
466
+ "Rosh Chodesh Sivan": "Start of month of Sivan on the Hebrew calendar. Sivan (סִיוָן) is the 3rd month of the Hebrew year, has 30 days, and corresponds to May or June on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
467
+ "Rosh Chodesh Tamuz": "Start of month of Tamuz on the Hebrew calendar. תַּמּוּז (transliterated Tamuz or Tammuz) is the 4th month of the Hebrew year, has 29 days, and corresponds to June or July on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
468
+ "Rosh Chodesh Av": "Start of month of Av on the Hebrew calendar. Av (אָב) is the 5th month of the Hebrew year, has 30 days, and corresponds to July or August on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
469
+ "Rosh Chodesh Elul": "Start of month of Elul on the Hebrew calendar. Elul (אֱלוּל) is the 6th month of the Hebrew year, has 29 days, and corresponds to August or September on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
470
+ "Rosh Chodesh Cheshvan": "Start of month of Cheshvan on the Hebrew calendar. חֶשְׁוָן (transliterated Cheshvan or Heshvan) is the 8th month of the Hebrew year, has 29 or 30 days, and corresponds to October or November on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
471
+ "Rosh Chodesh Kislev": "Start of month of Kislev on the Hebrew calendar. Kislev (כִּסְלֵו) is the 9th month of the Hebrew year, has 30 or 29 days, and corresponds to November or December on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
472
+ "Rosh Chodesh Tevet": "Start of month of Tevet on the Hebrew calendar. Tevet (טֵבֵת) is the 10th month of the Hebrew year, has 29 days, and corresponds to December or January on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
473
+ "Rosh Chodesh Sh'vat": "Start of month of Sh'vat on the Hebrew calendar. שְׁבָט (transliterated Sh'vat or Shevat) is the 11th month of the Hebrew year, has 30 days, and corresponds to January or February on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
474
+ "Rosh Chodesh Adar": "Start of month of Adar on the Hebrew calendar. Adar (אַדָר) is the 12th month of the Hebrew year, has 29 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
475
+ "Rosh Chodesh Adar I": "Start of month of Adar I (on leap years) on the Hebrew calendar. Adar I (אַדָר א׳) is the 12th month of the Hebrew year, occurs only on leap years, has 30 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
476
+ "Rosh Chodesh Adar II": "Start of month of Adar II (on leap years) on the Hebrew calendar. Adar II (אַדָר ב׳), sometimes \"Adar Bet\" or \"Adar Sheni\", is the 13th month of the Hebrew year, has 29 days, occurs only on leap years, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon",
477
+ "Rosh Hashana": "The Jewish New Year. Also spelled Rosh Hashanah",
478
+ "Rosh Hashana LaBehemot": "New Year for Tithing Animals",
479
+ "Shabbat Chazon": "Shabbat of Prophecy/Shabbat of Vision. Shabbat before Tish'a B'Av",
480
+ "Shabbat HaChodesh": "Shabbat before Rosh Chodesh Nissan. Read in preparation for Passover",
481
+ "Shabbat HaGadol": "Shabbat before Pesach (The Great Shabbat)",
482
+ "Shabbat Machar Chodesh": "When Shabbat falls the day before Rosh Chodesh",
483
+ "Shabbat Mevarchim Chodesh": "Shabbat that precedes Rosh Chodesh. The congregation blesses the forthcoming new month",
484
+ "Shabbat Nachamu": "Shabbat after Tish'a B'Av (Shabbat of Consolation). The first of seven Shabbatot leading up to Rosh Hashanah. Named after the Haftarah (from Isaiah 40) which begins with the verse נַחֲמוּ נַחֲמוּ, עַמִּי (\"Comfort, oh comfort my people\")",
485
+ "Shabbat Parah": "Shabbat of the Red Heifer. Shabbat before Shabbat HaChodesh, in preparation for Passover",
486
+ "Shabbat Rosh Chodesh": "When Shabbat falls on Rosh Chodesh",
487
+ "Shabbat Shekalim": "Shabbat before Rosh Chodesh Adar. Read in preparation for Purim",
488
+ "Shabbat Shirah": "Shabbat of Song. Shabbat that includes Parashat Beshalach",
489
+ "Shabbat Shuva": "Shabbat of Returning. Shabbat that occurs during the Ten Days of Repentance between Rosh Hashanah and Yom Kippur",
490
+ "Shabbat Zachor": "Shabbat of Remembrance. Shabbat before Purim",
491
+ "Shavuot": "Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai",
492
+ "Shmini Atzeret": "Eighth Day of Assembly. Immediately following Sukkot, it is observed as a separate holiday in the Diaspora and is combined with Simchat Torah in Israel",
493
+ "Shushan Purim": "Purim celebrated in Jerusalem and walled cities",
494
+ "Shushan Purim Katan": "Minor Purim celebration during Adar I on leap years in Jerusalem and walled cities",
495
+ "Sigd": "Ethiopian Jewish holiday occurring 50 days after Yom Kippur",
496
+ "Simchat Torah": "Day of Celebrating the Torah. Celebration marking the conclusion of the annual cycle of public Torah readings, and the beginning of a new cycle",
497
+ "Sukkot": "Feast of Booths. Also called the Feast of Tabernacles, the seven-day holiday is one of the Three Pilgrimage Festivals (Hebrew: שלוש רגלים, shalosh regalim)",
498
+ "Ta'anit Bechorot": "Fast of the First Born",
499
+ "Ta'anit Esther": "Fast of Esther",
500
+ "Tish'a B'Av": "The Ninth of Av. Fast commemorating the destruction of the two Temples",
501
+ "Tu B'Av": "Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av",
502
+ "Tu BiShvat": "New Year for Trees. Tu BiShvat is one of four “New Years” mentioned in the Mishnah",
503
+ "Tzom Gedaliah": "Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah",
504
+ "Tzom Tammuz": "Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple",
505
+ "Yitzhak Rabin Memorial Day": "Commemorates the life of Israeli Prime Minister Yitzhak Rabin",
506
+ "Yom HaAliyah": "Recognizes Aliyah, immigration to the Jewish State of Israel",
507
+ "Yom HaAliyah School Observance": "Aliyah Day observed in Israeli schools",
508
+ "Yom HaAtzma'ut": "Israeli Independence Day. Commemorates the declaration of independence of Israel in 1948. Although Yom HaAtzma'ut is normally observed on the 5th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaZikaron, which always precedes it) would conflict with Shabbat",
509
+ "Yom HaShoah": "Holocaust Memorial Day",
510
+ "Yom HaZikaron": "Israeli Memorial Day. Remembers those who died in the War of Independence and other wars in Israel. The full name of the holiday is Yom HaZikaron LeHalalei Ma'arakhot Yisrael ul'Nifge'ei Pe'ulot HaEivah (Hebrew: יוֹם הזִּכָּרוֹן לְחַלְלֵי מַעֲרָכוֹת יִשְׂרָאֵל וּלְנִפְגְעֵי פְּעֻלּוֹת הָאֵיבָה), Memorial Day for the Fallen Soldiers of the Wars of Israel and Victims of Actions of Terrorism. Although Yom Hazikaron is normally observed on the 4th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaAtzma'ut, which always follows it) would conflict with Shabbat",
511
+ "Yom Kippur": "Day of Atonement. The holiest day of the year in Judaism, traditionally observed with a 25-hour period of fasting and intensive prayer",
512
+ "Yom Kippur Katan": "Minor day of atonement occurring monthly on the day preceeding each Rosh Chodesh",
513
+ "Yom Yerushalayim": "Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"
514
+ };
111
515
 
516
+ const holidayDescription = holidayDescription0;
112
517
  /**
113
518
  * Returns a category and subcategory name
114
- * @param {Event} ev
115
- * @return {string[]}
116
519
  */
117
520
  function getEventCategories(ev) {
118
- const desc = ev.getDesc();
119
- if (desc === 'Purim' || desc === 'Erev Purim') {
120
- return ['holiday', 'major'];
121
- }
122
- return ev.getCategories();
521
+ const desc = ev.getDesc();
522
+ if (desc === 'Purim' || desc === 'Erev Purim') {
523
+ return ['holiday', 'major'];
524
+ }
525
+ return ev.getCategories();
123
526
  }
124
-
125
527
  const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT |
126
- core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT |
127
- core.flags.NACH_YOMI | core.flags.DAILY_LEARNING |
128
- core.flags.HEBREW_DATE | core.flags.YERUSHALMI_YOMI;
129
-
528
+ core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT |
529
+ core.flags.NACH_YOMI | core.flags.DAILY_LEARNING |
530
+ core.flags.HEBREW_DATE | core.flags.YERUSHALMI_YOMI;
130
531
  /**
131
532
  * Makes mulit-line text that summarizes Torah & Haftarah
132
- * @param {Event} ev
133
- * @param {boolean} il
134
- * @return {string}
135
533
  */
136
534
  function makeTorahMemoText(ev, il) {
137
- const mask = ev.getFlags();
138
- if ((mask & HOLIDAY_IGNORE_MASK) || (typeof ev.eventTime !== 'undefined')) {
139
- return '';
140
- }
141
- const reading = (mask & core.flags.PARSHA_HASHAVUA) ?
142
- leyning.getLeyningForParshaHaShavua(ev, il) :
143
- leyning.getLeyningForHoliday(ev, il);
144
- let memo = '';
145
- if (reading && (reading.summary || reading.haftara)) {
146
- if (reading.summary) {
147
- memo += `Torah: ${reading.summary}`;
148
- }
149
- if (reading.summary && reading.haftara) {
150
- memo += '\n';
151
- }
152
- if (reading.haftara) {
153
- memo += 'Haftarah: ' + reading.haftara;
154
- if (reading.reason?.haftara) {
155
- memo += ' | ' + reading.reason.haftara;
156
- }
157
- }
158
- }
159
- if (reading?.sephardic) {
160
- memo += '\nHaftarah for Sephardim: ' + reading.sephardic;
161
- }
162
- return memo;
535
+ var _a;
536
+ const mask = ev.getFlags();
537
+ if ((mask & HOLIDAY_IGNORE_MASK) || (typeof ev.eventTime !== 'undefined')) {
538
+ return '';
539
+ }
540
+ const reading = (mask & core.flags.PARSHA_HASHAVUA) ?
541
+ leyning.getLeyningForParshaHaShavua(ev, il) :
542
+ leyning.getLeyningForHoliday(ev, il);
543
+ let memo = '';
544
+ if (reading && (reading.summary || reading.haftara)) {
545
+ if (reading.summary) {
546
+ memo += `Torah: ${reading.summary}`;
547
+ }
548
+ if (reading.summary && reading.haftara) {
549
+ memo += '\n';
550
+ }
551
+ if (reading.haftara) {
552
+ memo += 'Haftarah: ' + reading.haftara;
553
+ if ((_a = reading.reason) === null || _a === void 0 ? void 0 : _a.haftara) {
554
+ memo += ' | ' + reading.reason.haftara;
555
+ }
556
+ }
557
+ }
558
+ if (reading === null || reading === void 0 ? void 0 : reading.sephardic) {
559
+ memo += '\nHaftarah for Sephardim: ' + reading.sephardic;
560
+ }
561
+ return memo;
163
562
  }
164
-
165
- /**
166
- * @private
167
- * @param {Event} ev
168
- * @param {boolean} il
169
- * @return {string}
170
- */
171
563
  function makeMemo(ev, il) {
172
- if (ev.getFlags() & core.flags.PARSHA_HASHAVUA) {
173
- try {
174
- const memo = makeTorahMemoText(ev, il);
175
- if (memo) {
176
- return memo;
177
- }
178
- } catch (err) {
179
- // fallthru
180
- }
181
- }
182
- return ev.memo || holidayDescription[ev.basename()];
564
+ if (ev.getFlags() & core.flags.PARSHA_HASHAVUA) {
565
+ try {
566
+ const memo = makeTorahMemoText(ev, il);
567
+ if (memo) {
568
+ return memo;
569
+ }
570
+ }
571
+ catch (err) {
572
+ // fallthru
573
+ }
574
+ }
575
+ return ev.memo || holidayDescription[ev.basename()];
183
576
  }
184
-
185
577
  /**
186
578
  * Appends utm_source and utm_medium parameters to a URL
187
- * @param {string} url
188
- * @param {boolean} il
189
- * @param {string} utmSource
190
- * @param {string} utmMedium
191
- * @param {string} utmCampaign
192
- * @return {string}
193
579
  */
194
580
  function appendIsraelAndTracking(url, il, utmSource, utmMedium, utmCampaign) {
195
- const u = new URL(url);
196
- const isHebcal = u.host === 'www.hebcal.com';
197
- if (isHebcal) {
198
- if (il) {
199
- u.searchParams.set('i', 'on');
200
- }
201
- const path = u.pathname;
202
- const isHolidays = path.startsWith('/holidays/');
203
- const isSedrot = path.startsWith('/sedrot/');
204
- const isOmer = path.startsWith('/omer/');
205
- if (isHolidays || isSedrot || isOmer) {
206
- u.host = 'hebcal.com';
207
- if (isHolidays) {
208
- u.pathname = '/h/' + path.substring(10);
209
- } else if (isSedrot) {
210
- u.pathname = '/s/' + path.substring(8);
211
- } else { // isOmer
212
- u.pathname = '/o/' + path.substring(6);
213
- }
214
- {
215
- if (utmSource) {
216
- u.searchParams.set('us', utmSource);
581
+ const u = new URL(url);
582
+ const isHebcal = u.host === 'www.hebcal.com';
583
+ if (isHebcal) {
584
+ if (il) {
585
+ u.searchParams.set('i', 'on');
217
586
  }
218
- {
219
- u.searchParams.set('um', utmMedium);
587
+ const path = u.pathname;
588
+ const isHolidays = path.startsWith('/holidays/');
589
+ const isSedrot = path.startsWith('/sedrot/');
590
+ const isOmer = path.startsWith('/omer/');
591
+ if (isHolidays || isSedrot || isOmer) {
592
+ u.host = 'hebcal.com';
593
+ if (isHolidays) {
594
+ u.pathname = '/h/' + path.substring(10);
595
+ }
596
+ else if (isSedrot) {
597
+ u.pathname = '/s/' + path.substring(8);
598
+ }
599
+ else { // isOmer
600
+ u.pathname = '/o/' + path.substring(6);
601
+ }
602
+ {
603
+ if (utmSource) {
604
+ u.searchParams.set('us', utmSource);
605
+ }
606
+ {
607
+ u.searchParams.set('um', utmMedium);
608
+ }
609
+ }
610
+ return u.toString();
220
611
  }
221
- }
222
- return u.toString();
223
- }
224
- }
225
- utmSource = isHebcal ? utmSource : 'hebcal.com';
226
- if (utmSource) {
227
- u.searchParams.set('utm_source', utmSource);
228
- }
229
- {
230
- u.searchParams.set('utm_medium', utmMedium);
231
- }
232
- return u.toString();
612
+ }
613
+ utmSource = isHebcal ? utmSource : 'hebcal.com';
614
+ if (utmSource) {
615
+ u.searchParams.set('utm_source', utmSource);
616
+ }
617
+ {
618
+ u.searchParams.set('utm_medium', utmMedium);
619
+ }
620
+ return u.toString();
233
621
  }
234
-
235
- /**
236
- * @private
237
- * @param {Event} ev
238
- * @return {boolean}
239
- */
240
622
  function shouldRenderBrief(ev) {
241
- if (typeof ev.eventTime !== 'undefined') return true;
242
- const mask = ev.getFlags();
243
- if (mask & core.flags.HEBREW_DATE) {
244
- const hd = ev.getDate();
245
- return (hd.getDate() === 1) ? false : true;
246
- } else if (mask & (core.flags.DAILY_LEARNING | core.flags.DAF_YOMI | core.flags.YERUSHALMI_YOMI)) {
247
- return true;
248
- } else if (mask & core.flags.MINOR_FAST && ev.getDesc().substring(0, 16) === 'Yom Kippur Katan') {
249
- return true;
250
- } else if (mask & core.flags.SHABBAT_MEVARCHIM) {
251
- return true;
252
- } else {
253
- return false;
254
- }
623
+ if (typeof ev.eventTime !== 'undefined') {
624
+ return true;
625
+ }
626
+ const mask = ev.getFlags();
627
+ if (mask & core.flags.HEBREW_DATE) {
628
+ const hd = ev.getDate();
629
+ return (hd.getDate() === 1) ? false : true;
630
+ }
631
+ else if (mask & (core.flags.DAILY_LEARNING | core.flags.DAF_YOMI | core.flags.YERUSHALMI_YOMI)) {
632
+ return true;
633
+ }
634
+ else if (mask & core.flags.MINOR_FAST && ev.getDesc().substring(0, 16) === 'Yom Kippur Katan') {
635
+ return true;
636
+ }
637
+ else if (mask & core.flags.SHABBAT_MEVARCHIM) {
638
+ return true;
639
+ }
640
+ else {
641
+ return false;
642
+ }
255
643
  }
256
644
 
257
645
  /**
258
646
  * Converts a Hebcal event to a FullCalendar.io object
259
- * @param {Event} ev
260
- * @param {string} tzid timeZone identifier
261
- * @param {boolean} il true if Israel
262
- * @return {Object}
263
647
  */
264
648
  function eventToFullCalendar(ev, tzid, il) {
265
- const classes = getEventCategories(ev);
266
- const mask = ev.getFlags();
267
- if (classes[0] == 'holiday' && mask & core.flags.CHAG) {
268
- classes.push('yomtov');
269
- }
270
- const timed = Boolean(ev.eventTime);
271
- const title = shouldRenderBrief(ev) ? ev.renderBrief() : ev.render();
272
- const start = timed ?
273
- core.Zmanim.formatISOWithTimeZone(tzid, ev.eventTime) :
274
- toISOString(ev.getDate().greg());
275
- const result = {
276
- title,
277
- start,
278
- allDay: !timed,
279
- className: classes.join(' '),
280
- };
281
- const hebrew = ev.renderBrief('he');
282
- if (hebrew) {
283
- result.hebrew = core.Locale.hebrewStripNikkud(hebrew);
284
- }
285
- const url = ev.url();
286
- if (url) {
287
- result.url = appendIsraelAndTracking(url, il, 'js', 'fc');
288
- }
289
- const desc = ev.getDesc();
290
- const candles = desc === 'Havdalah' || desc === 'Candle lighting';
291
- if (!candles) {
292
- const memo = makeMemo(ev, il);
293
- if (memo) {
294
- result.description = memo;
295
- } else if (typeof ev.linkedEvent !== 'undefined') {
296
- result.description = ev.linkedEvent.render();
297
- }
298
- }
299
- return result;
649
+ const classes = getEventCategories(ev);
650
+ const mask = ev.getFlags();
651
+ if (classes[0] == 'holiday' && mask & core.flags.CHAG) {
652
+ classes.push('yomtov');
653
+ }
654
+ const eventTime = ev.eventTime;
655
+ const timed = Boolean(eventTime);
656
+ const title = shouldRenderBrief(ev) ? ev.renderBrief() : ev.render();
657
+ const start = timed ?
658
+ core.Zmanim.formatISOWithTimeZone(tzid, eventTime) :
659
+ isoDateString(ev.getDate().greg());
660
+ const result = {
661
+ title,
662
+ start,
663
+ allDay: !timed,
664
+ className: classes.join(' '),
665
+ };
666
+ const hebrew = ev.renderBrief('he');
667
+ if (hebrew) {
668
+ result.hebrew = core.Locale.hebrewStripNikkud(hebrew);
669
+ }
670
+ const url = ev.url();
671
+ if (url) {
672
+ result.url = appendIsraelAndTracking(url, il, 'js', 'fc');
673
+ }
674
+ const desc = ev.getDesc();
675
+ const candles = desc === 'Havdalah' || desc === 'Candle lighting';
676
+ if (!candles) {
677
+ const memo = makeMemo(ev, il);
678
+ if (memo) {
679
+ result.description = memo;
680
+ }
681
+ else if (typeof ev.linkedEvent !== 'undefined') {
682
+ result.description = ev.linkedEvent.render();
683
+ }
684
+ }
685
+ return result;
300
686
  }
301
687
 
302
688
  exports.eventToFullCalendar = eventToFullCalendar;