@hebcal/core 6.8.2 → 6.9.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/README.md +262 -4
- package/dist/bundle.js +1530 -944
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +18 -17
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/CalOptions.d.ts +12 -2
- package/dist/esm/DailyLearning.d.ts +5 -5
- package/dist/esm/DailyLearning.js +5 -5
- package/dist/esm/DailyLearning.js.map +1 -1
- package/dist/esm/HebrewDateEvent.d.ts +2 -2
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HebrewDateEvent.js.map +1 -1
- package/dist/esm/HolidayEvent.d.ts +9 -4
- package/dist/esm/HolidayEvent.js +8 -3
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.d.ts +4 -3
- package/dist/esm/MevarchimChodeshEvent.js +3 -2
- package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
- package/dist/esm/ParshaEvent.d.ts +16 -3
- package/dist/esm/ParshaEvent.js +14 -1
- package/dist/esm/ParshaEvent.js.map +1 -1
- package/dist/esm/TimedEvent.d.ts +16 -8
- package/dist/esm/TimedEvent.js +13 -5
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.d.ts +4 -3
- package/dist/esm/YomKippurKatanEvent.js +3 -2
- package/dist/esm/YomKippurKatanEvent.js.map +1 -1
- package/dist/esm/ashkenazi.po.js +1 -1
- package/dist/esm/calendar.d.ts +19 -9
- package/dist/esm/calendar.js +23 -10
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.d.ts +24 -6
- package/dist/esm/candles.js +20 -2
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/cities.json.d.ts +2 -0
- package/dist/esm/cities.json.js +68 -2
- package/dist/esm/cities.json.js.map +1 -1
- package/dist/esm/event.d.ts +3 -5
- package/dist/esm/event.js +3 -5
- package/dist/esm/event.js.map +1 -1
- package/dist/esm/getStartAndEnd.d.ts +1 -1
- package/dist/esm/getStartAndEnd.js +1 -1
- package/dist/esm/getStartAndEnd.js.map +1 -1
- package/dist/esm/hallel.d.ts +1 -1
- package/dist/esm/hallel.js +1 -1
- package/dist/esm/hallel.js.map +1 -1
- package/dist/esm/he-x-NoNikud.po.js +1 -1
- package/dist/esm/he.po.js +1 -1
- package/dist/esm/hebcal.d.ts +38 -103
- package/dist/esm/hebcal.js +34 -107
- package/dist/esm/hebcal.js.map +1 -1
- package/dist/esm/holidays.d.ts +9 -2
- package/dist/esm/holidays.js +2 -2
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.d.ts +29 -27
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/isAssurBemlacha.d.ts +1 -1
- package/dist/esm/isAssurBemlacha.js +6 -3
- package/dist/esm/isAssurBemlacha.js.map +1 -1
- package/dist/esm/isAveilut.js +1 -1
- package/dist/esm/isFastDay.d.ts +1 -1
- package/dist/esm/isFastDay.js +2 -2
- package/dist/esm/isFastDay.js.map +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/locale.js.map +1 -1
- package/dist/esm/location.d.ts +37 -9
- package/dist/esm/location.js +38 -10
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.d.ts +29 -23
- package/dist/esm/molad.js +27 -21
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.d.ts +11 -0
- package/dist/esm/moladBase.js +12 -1
- package/dist/esm/moladBase.js.map +1 -1
- package/dist/esm/moladDate.d.ts +11 -7
- package/dist/esm/moladDate.js +25 -18
- package/dist/esm/moladDate.js.map +1 -1
- package/dist/esm/omer.d.ts +21 -5
- package/dist/esm/omer.js +20 -4
- package/dist/esm/omer.js.map +1 -1
- package/dist/esm/parshaName.js +1 -1
- package/dist/esm/parshaName.js.map +1 -1
- package/dist/esm/parshaYear.d.ts +3 -3
- package/dist/esm/parshaYear.js +3 -3
- package/dist/esm/parshaYear.js.map +1 -1
- package/dist/esm/pkgVersion.d.ts +1 -1
- package/dist/esm/pkgVersion.js +2 -2
- package/dist/esm/pkgVersion.js.map +1 -1
- package/dist/esm/reformatTimeStr.d.ts +15 -3
- package/dist/esm/reformatTimeStr.js +15 -3
- package/dist/esm/reformatTimeStr.js.map +1 -1
- package/dist/esm/sedra.d.ts +45 -19
- package/dist/esm/sedra.js +39 -17
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/sefira.json.d.ts +6 -0
- package/dist/esm/sefira.json.js +65 -3
- package/dist/esm/sefira.json.js.map +1 -1
- package/dist/esm/staticHolidays.d.ts +0 -2
- package/dist/esm/staticHolidays.js +1 -3
- package/dist/esm/staticHolidays.js.map +1 -1
- package/dist/esm/string.js +1 -1
- package/dist/esm/tachanun.js +1 -1
- package/dist/esm/tachanun.js.map +1 -1
- package/dist/esm/zmanim.d.ts +177 -142
- package/dist/esm/zmanim.js +183 -148
- package/dist/esm/zmanim.js.map +1 -1
- package/package.json +18 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parshaName.js","sources":["../../../src/parshaName.ts"],"sourcesContent":["import {Locale} from './locale';\nimport {smartApostrophe} from './string';\n\n/** @private */\nexport function renderParshaName(parsha: string[], locale?: string): string {\n let name = Locale.gettext(parsha[0], locale);\n if (parsha.length === 2) {\n const hyphen = Locale.isHebrewLocale(locale) ? '־' : '-';\n name += hyphen + Locale.gettext(parsha[1], locale);\n }\n name = smartApostrophe(name);\n const str = Locale.gettext('Parashat', locale) + ' ' + name;\n return str.normalize();\n}\n"],"names":[],"mappings":";;;;;AAGA;AACM,SAAU,gBAAgB,CAAC,MAAgB,EAAE,MAAe,EAAA;AAChE,IAAA,IAAI,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;AAC5C,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACvB,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,GAAG;AACxD,QAAA,IAAI,IAAI,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IACpD;AACA,IAAA,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;AAC5B,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI;AAC3D,IAAA,OAAO,GAAG,CAAC,SAAS,EAAE;AACxB;;;;"}
|
|
1
|
+
{"version":3,"file":"parshaName.js","sources":["../../../src/parshaName.ts"],"sourcesContent":["import {Locale} from './locale.js';\nimport {smartApostrophe} from './string.js';\n\n/** @private */\nexport function renderParshaName(parsha: string[], locale?: string): string {\n let name = Locale.gettext(parsha[0], locale);\n if (parsha.length === 2) {\n const hyphen = Locale.isHebrewLocale(locale) ? '־' : '-';\n name += hyphen + Locale.gettext(parsha[1], locale);\n }\n name = smartApostrophe(name);\n const str = Locale.gettext('Parashat', locale) + ' ' + name;\n return str.normalize();\n}\n"],"names":[],"mappings":";;;;;AAGA;AACM,SAAU,gBAAgB,CAAC,MAAgB,EAAE,MAAe,EAAA;AAChE,IAAA,IAAI,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;AAC5C,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACvB,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,GAAG;AACxD,QAAA,IAAI,IAAI,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IACpD;AACA,IAAA,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;AAC5B,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI;AAC3D,IAAA,OAAO,GAAG,CAAC,SAAS,EAAE;AACxB;;;;"}
|
package/dist/esm/parshaYear.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParshaEvent } from './ParshaEvent';
|
|
1
|
+
import { ParshaEvent } from './ParshaEvent.js';
|
|
2
2
|
/**
|
|
3
3
|
* Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for
|
|
4
4
|
* an entire Hebrew year.
|
|
@@ -10,8 +10,8 @@ import { ParshaEvent } from './ParshaEvent';
|
|
|
10
10
|
* @example
|
|
11
11
|
* import {parshaYear} from '@hebcal/core';
|
|
12
12
|
* const events = parshaYear(5784, false);
|
|
13
|
-
* events[0].render('en'); // 'Parashat
|
|
14
|
-
* events[0].getDate().toString(); // '
|
|
13
|
+
* events[0].render('en'); // 'Parashat Ha’azinu'
|
|
14
|
+
* events[0].getDate().toString(); // '8 Tishrei 5784'
|
|
15
15
|
* @param year Hebrew year
|
|
16
16
|
* @param il Israel (false for Diaspora)
|
|
17
17
|
* @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular
|
package/dist/esm/parshaYear.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.9.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { HDate, months } from '@hebcal/hdate';
|
|
3
3
|
import { ParshaEvent } from './ParshaEvent.js';
|
|
4
4
|
import { getSedra } from './sedra.js';
|
|
@@ -14,8 +14,8 @@ import { getSedra } from './sedra.js';
|
|
|
14
14
|
* @example
|
|
15
15
|
* import {parshaYear} from '@hebcal/core';
|
|
16
16
|
* const events = parshaYear(5784, false);
|
|
17
|
-
* events[0].render('en'); // 'Parashat
|
|
18
|
-
* events[0].getDate().toString(); // '
|
|
17
|
+
* events[0].render('en'); // 'Parashat Ha’azinu'
|
|
18
|
+
* events[0].getDate().toString(); // '8 Tishrei 5784'
|
|
19
19
|
* @param year Hebrew year
|
|
20
20
|
* @param il Israel (false for Diaspora)
|
|
21
21
|
* @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parshaYear.js","sources":["../../../src/parshaYear.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\nimport {ParshaEvent} from './ParshaEvent';\nimport {getSedra} from './sedra';\n\n/**\n * Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for\n * an entire Hebrew year.\n *\n * Saturdays on which a Yom Tov reading displaces the regular parsha\n * (e.g. Shabbat Chol ha-Moed Pesach/Sukkot, Yom Kippur on Shabbat) are\n * skipped — for those use {@link getHolidaysOnDate} or\n * {@link Sedra.lookup}.\n * @example\n * import {parshaYear} from '@hebcal/core';\n * const events = parshaYear(5784, false);\n * events[0].render('en'); // 'Parashat
|
|
1
|
+
{"version":3,"file":"parshaYear.js","sources":["../../../src/parshaYear.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\nimport {ParshaEvent} from './ParshaEvent.js';\nimport {getSedra} from './sedra.js';\n\n/**\n * Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for\n * an entire Hebrew year.\n *\n * Saturdays on which a Yom Tov reading displaces the regular parsha\n * (e.g. Shabbat Chol ha-Moed Pesach/Sukkot, Yom Kippur on Shabbat) are\n * skipped — for those use {@link getHolidaysOnDate} or\n * {@link Sedra.lookup}.\n * @example\n * import {parshaYear} from '@hebcal/core';\n * const events = parshaYear(5784, false);\n * events[0].render('en'); // 'Parashat Ha’azinu'\n * events[0].getDate().toString(); // '8 Tishrei 5784'\n * @param year Hebrew year\n * @param il Israel (false for Diaspora)\n * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular\n * (non-holiday) Parashat HaShavua\n */\nexport function parshaYear(year: number, il: boolean): ParshaEvent[] {\n const sedra = getSedra(year, il);\n const startAbs = sedra.getFirstSaturday();\n const endAbs = HDate.hebrew2abs(year, months.ELUL, 29);\n const events: ParshaEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt += 7) {\n const parsha = sedra.lookup(absDt);\n if (!parsha.chag) {\n const ev = new ParshaEvent(parsha);\n events.push(ev);\n }\n }\n return events;\n}\n"],"names":[],"mappings":";;;;;AAIA;;;;;;;;;;;;;;;;;AAiBG;AACG,SAAU,UAAU,CAAC,IAAY,EAAE,EAAW,EAAA;IAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;AAChC,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,gBAAgB,EAAE;AACzC,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;IACtD,MAAM,MAAM,GAAkB,EAAE;AAChC,IAAA,KAAK,IAAI,KAAK,GAAG,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE;QACtD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;AAClC,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AAChB,YAAA,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;AAClC,YAAA,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACjB;IACF;AACA,IAAA,OAAO,MAAM;AACf;;;;"}
|
package/dist/esm/pkgVersion.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
2
|
-
export declare const version = "6.
|
|
2
|
+
export declare const version = "6.9.1";
|
package/dist/esm/pkgVersion.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.9.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
3
|
-
const version = '6.
|
|
3
|
+
const version = '6.9.1';
|
|
4
4
|
|
|
5
5
|
export { version };
|
|
6
6
|
//# sourceMappingURL=pkgVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pkgVersion.js","sources":["../../../src/pkgVersion.ts"],"sourcesContent":["/** DO NOT EDIT THIS AUTO-GENERATED FILE! */\nexport const version = '6.
|
|
1
|
+
{"version":3,"file":"pkgVersion.js","sources":["../../../src/pkgVersion.ts"],"sourcesContent":["/** DO NOT EDIT THIS AUTO-GENERATED FILE! */\nexport const version = '6.9.1';\n"],"names":[],"mappings":";AAAA;AACO,MAAM,OAAO,GAAG;;;;"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import { CalOptions } from './CalOptions';
|
|
1
|
+
import { CalOptions } from './CalOptions.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Helper function to format a 24-hour (00:00-23:59) time string in either
|
|
4
|
+
* 12-hour US format (e.g. `"8:13pm"`) or keep it in 24-hour format (e.g.
|
|
5
|
+
* `"20:13"`) for any other locale or country.
|
|
6
|
+
*
|
|
7
|
+
* The locale (and therefore default behavior) is derived from
|
|
8
|
+
* `options.location` / `options.locale`. The `options.hour12` override
|
|
9
|
+
* takes precedence: if `false`, locale is ignored and the result is always
|
|
10
|
+
* 24-hour; if `true`, locale is ignored and the result is always 12-hour.
|
|
11
|
+
* @example
|
|
12
|
+
* import {reformatTimeStr, Location} from '@hebcal/core';
|
|
13
|
+
* const opts = {location: Location.lookup('Chicago')};
|
|
14
|
+
* reformatTimeStr('20:30', 'pm', opts); // '8:30pm'
|
|
15
|
+
* reformatTimeStr('20:30', 'pm', {hour12: false}); // '20:30'
|
|
4
16
|
* @param timeStr - original time like "20:30"
|
|
5
17
|
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
6
|
-
* @param options
|
|
18
|
+
* @param options optional; `location`, `locale` and `hour12` are consulted
|
|
7
19
|
*/
|
|
8
20
|
export declare function reformatTimeStr(timeStr: string, suffix: string, options?: CalOptions): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.9.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
const hour12cc = {
|
|
3
3
|
US: 1,
|
|
4
4
|
CA: 1,
|
|
@@ -14,10 +14,22 @@ const hour12cc = {
|
|
|
14
14
|
ZA: 1,
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Helper function to format a 24-hour (00:00-23:59) time string in either
|
|
18
|
+
* 12-hour US format (e.g. `"8:13pm"`) or keep it in 24-hour format (e.g.
|
|
19
|
+
* `"20:13"`) for any other locale or country.
|
|
20
|
+
*
|
|
21
|
+
* The locale (and therefore default behavior) is derived from
|
|
22
|
+
* `options.location` / `options.locale`. The `options.hour12` override
|
|
23
|
+
* takes precedence: if `false`, locale is ignored and the result is always
|
|
24
|
+
* 24-hour; if `true`, locale is ignored and the result is always 12-hour.
|
|
25
|
+
* @example
|
|
26
|
+
* import {reformatTimeStr, Location} from '@hebcal/core';
|
|
27
|
+
* const opts = {location: Location.lookup('Chicago')};
|
|
28
|
+
* reformatTimeStr('20:30', 'pm', opts); // '8:30pm'
|
|
29
|
+
* reformatTimeStr('20:30', 'pm', {hour12: false}); // '20:30'
|
|
18
30
|
* @param timeStr - original time like "20:30"
|
|
19
31
|
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
20
|
-
* @param options
|
|
32
|
+
* @param options optional; `location`, `locale` and `hour12` are consulted
|
|
21
33
|
*/
|
|
22
34
|
function reformatTimeStr(timeStr, suffix, options) {
|
|
23
35
|
if (typeof timeStr !== 'string')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reformatTimeStr.js","sources":["../../../src/reformatTimeStr.ts"],"sourcesContent":["import {CalOptions} from './CalOptions';\n\nconst hour12cc: Record<string, number> = {\n US: 1,\n CA: 1,\n BR: 1,\n AU: 1,\n NZ: 1,\n DO: 1,\n PR: 1,\n GR: 1,\n IN: 1,\n KR: 1,\n NP: 1,\n ZA: 1,\n} as const;\n\n/**\n * @
|
|
1
|
+
{"version":3,"file":"reformatTimeStr.js","sources":["../../../src/reformatTimeStr.ts"],"sourcesContent":["import {CalOptions} from './CalOptions.js';\n\nconst hour12cc: Record<string, number> = {\n US: 1,\n CA: 1,\n BR: 1,\n AU: 1,\n NZ: 1,\n DO: 1,\n PR: 1,\n GR: 1,\n IN: 1,\n KR: 1,\n NP: 1,\n ZA: 1,\n} as const;\n\n/**\n * Helper function to format a 24-hour (00:00-23:59) time string in either\n * 12-hour US format (e.g. `\"8:13pm\"`) or keep it in 24-hour format (e.g.\n * `\"20:13\"`) for any other locale or country.\n *\n * The locale (and therefore default behavior) is derived from\n * `options.location` / `options.locale`. The `options.hour12` override\n * takes precedence: if `false`, locale is ignored and the result is always\n * 24-hour; if `true`, locale is ignored and the result is always 12-hour.\n * @example\n * import {reformatTimeStr, Location} from '@hebcal/core';\n * const opts = {location: Location.lookup('Chicago')};\n * reformatTimeStr('20:30', 'pm', opts); // '8:30pm'\n * reformatTimeStr('20:30', 'pm', {hour12: false}); // '20:30'\n * @param timeStr - original time like \"20:30\"\n * @param suffix - \"p\" or \"pm\" or \" P.M.\". Add leading space if you want it\n * @param options optional; `location`, `locale` and `hour12` are consulted\n */\nexport function reformatTimeStr(\n timeStr: string,\n suffix: string,\n options?: CalOptions\n): string {\n if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);\n const cc = options?.location?.getCountryCode() || (options?.il ? 'IL' : 'US');\n const hour12 = options?.hour12;\n if (hour12 !== undefined && !hour12) {\n return timeStr;\n }\n if (!hour12 && hour12cc[cc] === undefined) {\n return timeStr;\n }\n const hm = timeStr.split(':');\n let hour: string | number = parseInt(hm[0], 10);\n if (hour < 12 && suffix) {\n suffix = suffix.replace('p', 'a').replace('P', 'A');\n if (hour === 0) {\n hour = 12;\n }\n } else if (hour > 12) {\n hour = hour % 12;\n } else if (hour === 0) {\n hour = '00';\n }\n return `${hour}:${hm[1]}${suffix}`;\n}\n"],"names":[],"mappings":";AAEA,MAAM,QAAQ,GAA2B;AACvC,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;CACG;AAEV;;;;;;;;;;;;;;;;;AAiBG;SACa,eAAe,CAC7B,OAAe,EACf,MAAc,EACd,OAAoB,EAAA;IAEpB,IAAI,OAAO,OAAO,KAAK,QAAQ;AAAE,QAAA,MAAM,IAAI,SAAS,CAAC,gBAAgB,OAAO,CAAA,CAAE,CAAC;IAC/E,MAAM,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,OAAO,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAC7E,IAAA,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM;AAC9B,IAAA,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,EAAE;AACnC,QAAA,OAAO,OAAO;IAChB;IACA,IAAI,CAAC,MAAM,IAAI,QAAQ,CAAC,EAAE,CAAC,KAAK,SAAS,EAAE;AACzC,QAAA,OAAO,OAAO;IAChB;IACA,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;IAC7B,IAAI,IAAI,GAAoB,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC/C,IAAA,IAAI,IAAI,GAAG,EAAE,IAAI,MAAM,EAAE;AACvB,QAAA,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;AACnD,QAAA,IAAI,IAAI,KAAK,CAAC,EAAE;YACd,IAAI,GAAG,EAAE;QACX;IACF;AAAO,SAAA,IAAI,IAAI,GAAG,EAAE,EAAE;AACpB,QAAA,IAAI,GAAG,IAAI,GAAG,EAAE;IAClB;AAAO,SAAA,IAAI,IAAI,KAAK,CAAC,EAAE;QACrB,IAAI,GAAG,IAAI;IACb;IACA,OAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,EAAE,CAAC,CAAC,CAAC,CAAA,EAAG,MAAM,CAAA,CAAE;AACpC;;;;"}
|
package/dist/esm/sedra.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HDate } from '@hebcal/hdate';
|
|
2
|
-
import './locale';
|
|
2
|
+
import './locale.js';
|
|
3
3
|
/** The result from `Sedra.lookup()` */
|
|
4
4
|
export type SedraResult = {
|
|
5
5
|
/**
|
|
@@ -36,14 +36,14 @@ export type SedraResult = {
|
|
|
36
36
|
* Israel and the Diaspora diverge in some years when the 8th day of Pesach
|
|
37
37
|
* or the 2nd day of Shavuot fall on Shabbat).
|
|
38
38
|
*
|
|
39
|
-
* Prefer {@link getSedra}
|
|
39
|
+
* Prefer {@link getSedra} over
|
|
40
40
|
* calling this constructor directly, since both cache their results.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
43
|
* import {Sedra, HDate, months} from '@hebcal/core';
|
|
44
44
|
* const sedra = new Sedra(5784, false);
|
|
45
45
|
* const result = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
|
|
46
|
-
* console.log(result.parsha); // ['
|
|
46
|
+
* console.log(result.parsha); // ['Vayera']
|
|
47
47
|
*/
|
|
48
48
|
export declare class Sedra {
|
|
49
49
|
private readonly year;
|
|
@@ -72,15 +72,20 @@ export declare class Sedra {
|
|
|
72
72
|
* @example
|
|
73
73
|
* import {Sedra} from '@hebcal/core';
|
|
74
74
|
* const sedra = new Sedra(5784, false);
|
|
75
|
-
* sedra.find('Noach')?.toString();
|
|
76
|
-
* sedra.find(1)?.toString();
|
|
77
|
-
*
|
|
78
|
-
* sedra.find(
|
|
75
|
+
* sedra.find('Noach')?.toString(); // '6 Cheshvan 5784'
|
|
76
|
+
* sedra.find(1)?.toString(); // '6 Cheshvan 5784', by 0-based index
|
|
77
|
+
* // Matot and Masei are doubled in 5784, so the pair has a date...
|
|
78
|
+
* sedra.find('Matot-Masei')?.toString(); // '28 Tamuz 5784'
|
|
79
|
+
* sedra.find(['Matot', 'Masei'])?.toString(); // '28 Tamuz 5784'
|
|
80
|
+
* // ...but neither half is read on its own that year:
|
|
81
|
+
* sedra.find('Matot'); // null
|
|
79
82
|
* @param parsha if a `string`, specified with Sephardic transliterations
|
|
80
83
|
* like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element
|
|
81
84
|
* array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should
|
|
82
85
|
* be a 0-based parsha index (`0` for Bereshit, `1` for Noach) or a negative
|
|
83
|
-
* number for a doubled parsha (e.g. `-21` for Vayakhel-Pekudei)
|
|
86
|
+
* number for a doubled parsha (e.g. `-21` for Vayakhel-Pekudei).
|
|
87
|
+
* Note that this index is 0-based, unlike {@link SedraResult.num} which
|
|
88
|
+
* is 1-based.
|
|
84
89
|
*/
|
|
85
90
|
find(parsha: number | string | string[]): HDate | null;
|
|
86
91
|
private findInternal;
|
|
@@ -95,12 +100,19 @@ export declare class Sedra {
|
|
|
95
100
|
* will return the date of `'Matot'` alone.
|
|
96
101
|
* @example
|
|
97
102
|
* import {Sedra} from '@hebcal/core';
|
|
103
|
+
* // Matot and Masei are doubled in 5784, so each half resolves to the
|
|
104
|
+
* // date of the combined reading:
|
|
98
105
|
* const sedra = new Sedra(5784, false);
|
|
99
|
-
* //
|
|
100
|
-
* sedra.findContaining('
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
106
|
+
* sedra.findContaining('Matot')?.toString(); // '28 Tamuz 5784'
|
|
107
|
+
* sedra.findContaining('Masei')?.toString(); // '28 Tamuz 5784'
|
|
108
|
+
* @example
|
|
109
|
+
* import {Sedra} from '@hebcal/core';
|
|
110
|
+
* // They are read separately in 5795, so each half has its own date, and
|
|
111
|
+
* // asking for the doubled name returns the date of the first half:
|
|
112
|
+
* const sedra = new Sedra(5795, false);
|
|
113
|
+
* sedra.findContaining('Matot')?.toString(); // '21 Tamuz 5795'
|
|
114
|
+
* sedra.findContaining('Masei')?.toString(); // '28 Tamuz 5795'
|
|
115
|
+
* sedra.findContaining('Matot-Masei')?.toString(); // '21 Tamuz 5795'
|
|
104
116
|
*/
|
|
105
117
|
findContaining(parsha: number | string): HDate | null;
|
|
106
118
|
/**
|
|
@@ -137,11 +149,11 @@ export declare class Sedra {
|
|
|
137
149
|
* @example
|
|
138
150
|
* import {Sedra, HDate, months} from '@hebcal/core';
|
|
139
151
|
* const sedra = new Sedra(5784, false);
|
|
140
|
-
* // A
|
|
141
|
-
* const result = sedra.lookup(new HDate(
|
|
152
|
+
* // A Friday — returns the upcoming Shabbat's reading
|
|
153
|
+
* const result = sedra.lookup(new HDate(12, months.CHESHVAN, 5784));
|
|
142
154
|
* console.log(result.parsha); // ['Lech-Lecha']
|
|
143
155
|
* console.log(result.chag); // false
|
|
144
|
-
* console.log(result.hdate.toString()); // '
|
|
156
|
+
* console.log(result.hdate.toString()); // '13 Cheshvan 5784' (Saturday)
|
|
145
157
|
* @param hd Hebrew date or R.D. days
|
|
146
158
|
*/
|
|
147
159
|
lookup(hd: HDate | number): SedraResult;
|
|
@@ -155,6 +167,16 @@ export declare class Sedra {
|
|
|
155
167
|
*
|
|
156
168
|
* For the Tishrei weekdays before Sukkot or Simchat Torah, the weekday
|
|
157
169
|
* reading is *Vezot Haberakhah* even though it is not read on Shabbat.
|
|
170
|
+
* @example
|
|
171
|
+
* import {Sedra, HDate, months} from '@hebcal/core';
|
|
172
|
+
* const sedra = new Sedra(5784, false);
|
|
173
|
+
* // Monday 8 Cheshvan — begins the upcoming Shabbat's parsha
|
|
174
|
+
* sedra.lookupWeekday(new HDate(8, months.CHESHVAN, 5784))?.parsha; // ['Lech-Lecha']
|
|
175
|
+
* // Tuesday is neither Monday nor Thursday
|
|
176
|
+
* sedra.lookupWeekday(new HDate(9, months.CHESHVAN, 5784)); // undefined
|
|
177
|
+
* // Thursday 17 Nisan — the upcoming Shabbat is Chol ha-Moed Pesach,
|
|
178
|
+
* // so the next regular parsha is returned instead
|
|
179
|
+
* sedra.lookupWeekday(new HDate(17, months.NISAN, 5784))?.parsha; // ['Achrei Mot']
|
|
158
180
|
* @param hd Hebrew date or R.D. days
|
|
159
181
|
*/
|
|
160
182
|
lookupWeekday(hd: HDate | number): SedraResult | undefined;
|
|
@@ -170,7 +192,12 @@ export declare class Sedra {
|
|
|
170
192
|
* @type {string[]}
|
|
171
193
|
*/
|
|
172
194
|
export declare const parshiot: readonly string[];
|
|
173
|
-
|
|
195
|
+
/**
|
|
196
|
+
* An entry in the array returned by {@link Sedra.getSedraArray}: either a
|
|
197
|
+
* `number` identifying a parsha (or, when negative, a doubled parsha) or a
|
|
198
|
+
* `string` naming the holiday that displaces the weekly reading.
|
|
199
|
+
*/
|
|
200
|
+
export type NumberOrString = number | string;
|
|
174
201
|
/**
|
|
175
202
|
* Convenience function to create an instance of {@link Sedra} or reuse a
|
|
176
203
|
* previously created and cached instance for the same year and schedule.
|
|
@@ -181,9 +208,8 @@ type NumberOrString = number | string;
|
|
|
181
208
|
* import {getSedra, HDate, months} from '@hebcal/core';
|
|
182
209
|
* const sedra = getSedra(5784, false);
|
|
183
210
|
* const {parsha} = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
|
|
184
|
-
* console.log(parsha); // ['
|
|
211
|
+
* console.log(parsha); // ['Vayera']
|
|
185
212
|
* @param hyear Hebrew year
|
|
186
213
|
* @param il Use Israel sedra schedule (`false` for Diaspora)
|
|
187
214
|
*/
|
|
188
215
|
export declare function getSedra(hyear: number, il: boolean): Sedra;
|
|
189
|
-
export {};
|
package/dist/esm/sedra.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.9.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { HDate, months } from '@hebcal/hdate';
|
|
3
3
|
import QuickLRU from 'quick-lru';
|
|
4
4
|
import './locale.js';
|
|
@@ -58,14 +58,14 @@ function yearType(hyear) {
|
|
|
58
58
|
* Israel and the Diaspora diverge in some years when the 8th day of Pesach
|
|
59
59
|
* or the 2nd day of Shavuot fall on Shabbat).
|
|
60
60
|
*
|
|
61
|
-
* Prefer {@link getSedra}
|
|
61
|
+
* Prefer {@link getSedra} over
|
|
62
62
|
* calling this constructor directly, since both cache their results.
|
|
63
63
|
*
|
|
64
64
|
* @example
|
|
65
65
|
* import {Sedra, HDate, months} from '@hebcal/core';
|
|
66
66
|
* const sedra = new Sedra(5784, false);
|
|
67
67
|
* const result = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
|
|
68
|
-
* console.log(result.parsha); // ['
|
|
68
|
+
* console.log(result.parsha); // ['Vayera']
|
|
69
69
|
*/
|
|
70
70
|
class Sedra {
|
|
71
71
|
year;
|
|
@@ -118,15 +118,20 @@ class Sedra {
|
|
|
118
118
|
* @example
|
|
119
119
|
* import {Sedra} from '@hebcal/core';
|
|
120
120
|
* const sedra = new Sedra(5784, false);
|
|
121
|
-
* sedra.find('Noach')?.toString();
|
|
122
|
-
* sedra.find(1)?.toString();
|
|
123
|
-
*
|
|
124
|
-
* sedra.find(
|
|
121
|
+
* sedra.find('Noach')?.toString(); // '6 Cheshvan 5784'
|
|
122
|
+
* sedra.find(1)?.toString(); // '6 Cheshvan 5784', by 0-based index
|
|
123
|
+
* // Matot and Masei are doubled in 5784, so the pair has a date...
|
|
124
|
+
* sedra.find('Matot-Masei')?.toString(); // '28 Tamuz 5784'
|
|
125
|
+
* sedra.find(['Matot', 'Masei'])?.toString(); // '28 Tamuz 5784'
|
|
126
|
+
* // ...but neither half is read on its own that year:
|
|
127
|
+
* sedra.find('Matot'); // null
|
|
125
128
|
* @param parsha if a `string`, specified with Sephardic transliterations
|
|
126
129
|
* like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element
|
|
127
130
|
* array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should
|
|
128
131
|
* be a 0-based parsha index (`0` for Bereshit, `1` for Noach) or a negative
|
|
129
|
-
* number for a doubled parsha (e.g. `-21` for Vayakhel-Pekudei)
|
|
132
|
+
* number for a doubled parsha (e.g. `-21` for Vayakhel-Pekudei).
|
|
133
|
+
* Note that this index is 0-based, unlike {@link SedraResult.num} which
|
|
134
|
+
* is 1-based.
|
|
130
135
|
*/
|
|
131
136
|
find(parsha) {
|
|
132
137
|
if (typeof parsha === 'number') {
|
|
@@ -189,12 +194,19 @@ class Sedra {
|
|
|
189
194
|
* will return the date of `'Matot'` alone.
|
|
190
195
|
* @example
|
|
191
196
|
* import {Sedra} from '@hebcal/core';
|
|
197
|
+
* // Matot and Masei are doubled in 5784, so each half resolves to the
|
|
198
|
+
* // date of the combined reading:
|
|
192
199
|
* const sedra = new Sedra(5784, false);
|
|
193
|
-
* //
|
|
194
|
-
* sedra.findContaining('
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
200
|
+
* sedra.findContaining('Matot')?.toString(); // '28 Tamuz 5784'
|
|
201
|
+
* sedra.findContaining('Masei')?.toString(); // '28 Tamuz 5784'
|
|
202
|
+
* @example
|
|
203
|
+
* import {Sedra} from '@hebcal/core';
|
|
204
|
+
* // They are read separately in 5795, so each half has its own date, and
|
|
205
|
+
* // asking for the doubled name returns the date of the first half:
|
|
206
|
+
* const sedra = new Sedra(5795, false);
|
|
207
|
+
* sedra.findContaining('Matot')?.toString(); // '21 Tamuz 5795'
|
|
208
|
+
* sedra.findContaining('Masei')?.toString(); // '28 Tamuz 5795'
|
|
209
|
+
* sedra.findContaining('Matot-Masei')?.toString(); // '21 Tamuz 5795'
|
|
198
210
|
*/
|
|
199
211
|
findContaining(parsha) {
|
|
200
212
|
const hdate = this.find(parsha);
|
|
@@ -276,11 +288,11 @@ class Sedra {
|
|
|
276
288
|
* @example
|
|
277
289
|
* import {Sedra, HDate, months} from '@hebcal/core';
|
|
278
290
|
* const sedra = new Sedra(5784, false);
|
|
279
|
-
* // A
|
|
280
|
-
* const result = sedra.lookup(new HDate(
|
|
291
|
+
* // A Friday — returns the upcoming Shabbat's reading
|
|
292
|
+
* const result = sedra.lookup(new HDate(12, months.CHESHVAN, 5784));
|
|
281
293
|
* console.log(result.parsha); // ['Lech-Lecha']
|
|
282
294
|
* console.log(result.chag); // false
|
|
283
|
-
* console.log(result.hdate.toString()); // '
|
|
295
|
+
* console.log(result.hdate.toString()); // '13 Cheshvan 5784' (Saturday)
|
|
284
296
|
* @param hd Hebrew date or R.D. days
|
|
285
297
|
*/
|
|
286
298
|
lookup(hd) {
|
|
@@ -332,6 +344,16 @@ class Sedra {
|
|
|
332
344
|
*
|
|
333
345
|
* For the Tishrei weekdays before Sukkot or Simchat Torah, the weekday
|
|
334
346
|
* reading is *Vezot Haberakhah* even though it is not read on Shabbat.
|
|
347
|
+
* @example
|
|
348
|
+
* import {Sedra, HDate, months} from '@hebcal/core';
|
|
349
|
+
* const sedra = new Sedra(5784, false);
|
|
350
|
+
* // Monday 8 Cheshvan — begins the upcoming Shabbat's parsha
|
|
351
|
+
* sedra.lookupWeekday(new HDate(8, months.CHESHVAN, 5784))?.parsha; // ['Lech-Lecha']
|
|
352
|
+
* // Tuesday is neither Monday nor Thursday
|
|
353
|
+
* sedra.lookupWeekday(new HDate(9, months.CHESHVAN, 5784)); // undefined
|
|
354
|
+
* // Thursday 17 Nisan — the upcoming Shabbat is Chol ha-Moed Pesach,
|
|
355
|
+
* // so the next regular parsha is returned instead
|
|
356
|
+
* sedra.lookupWeekday(new HDate(17, months.NISAN, 5784))?.parsha; // ['Achrei Mot']
|
|
335
357
|
* @param hd Hebrew date or R.D. days
|
|
336
358
|
*/
|
|
337
359
|
lookupWeekday(hd) {
|
|
@@ -607,7 +629,7 @@ const sedraCache = new QuickLRU({ maxSize: 120 });
|
|
|
607
629
|
* import {getSedra, HDate, months} from '@hebcal/core';
|
|
608
630
|
* const sedra = getSedra(5784, false);
|
|
609
631
|
* const {parsha} = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
|
|
610
|
-
* console.log(parsha); // ['
|
|
632
|
+
* console.log(parsha); // ['Vayera']
|
|
611
633
|
* @param hyear Hebrew year
|
|
612
634
|
* @param il Use Israel sedra schedule (`false` for Diaspora)
|
|
613
635
|
*/
|
package/dist/esm/sedra.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sedra.js","sources":["../../../src/sedra.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n/*\n * Many of the following algorithms were taken from hebrew calendar\n * routines by Maimonedes, from his Mishneh Torah, and implemented by\n * Nachum Dershowitz Department of Computer Science\n * (217) 333-4219 University of Illinois at Urbana-Champaign\n * nachum@cs.uiuedu 1304 West Springfield Avenue\n * Urbana, Illinois 61801\n *\n * The routines were included in the emacs 19 distribution.\n *\n */\nimport {HDate, months} from '@hebcal/hdate';\nimport QuickLRU from 'quick-lru';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\n\nconst INCOMPLETE = 0;\nconst REGULAR = 1;\nconst COMPLETE = 2;\n\nfunction yearType(hyear: number): number {\n const longC = HDate.longCheshvan(hyear);\n const shortK = HDate.shortKislev(hyear);\n if (longC && !shortK) {\n return COMPLETE;\n }\n if (!longC && shortK) {\n return INCOMPLETE;\n }\n return REGULAR;\n}\n\n/** The result from `Sedra.lookup()` */\nexport type SedraResult = {\n /**\n * Name of the parsha (or parshiyot) read on\n * Hebrew date, e.g. `['Noach']` or `['Matot', 'Masei']`\n */\n parsha: string[];\n /**\n * False if this is a regular parashat HaShavua reading.\n * True if it's a special holiday reading.\n */\n chag: boolean;\n /**\n * The parsha number (or numbers) using 1-indexing.\n * A `number` for a regular (single) parsha, and a `number[]`\n * for a doubled parsha.\n * For Parashat *Bereshit*, `num` would be equal to `1`, and for\n * *Matot-Masei* it would be `[42, 43]`\n * For a chag (holiday) reading, `num` will be `0`.\n */\n num: number | number[];\n /** The date of the Shabbat this parsha is read */\n hdate: HDate;\n /** true if Israel, false for Diaspora */\n il: boolean;\n};\n\n/**\n * Represents the weekly Torah-reading (Parashat HaShavua) schedule for an\n * entire Hebrew year.\n *\n * The schedule depends on the year's *keviyah* — the day of week of Rosh\n * Hashana, whether the year is leap, whether Cheshvan/Kislev are long or\n * short, and whether the schedule is for Israel or the Diaspora (since\n * Israel and the Diaspora diverge in some years when the 8th day of Pesach\n * or the 2nd day of Shavuot fall on Shabbat).\n *\n * Prefer {@link getSedra} (or {@link HebrewCalendar.getSedra}) over\n * calling this constructor directly, since both cache their results.\n *\n * @example\n * import {Sedra, HDate, months} from '@hebcal/core';\n * const sedra = new Sedra(5784, false);\n * const result = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));\n * console.log(result.parsha); // ['Lech-Lecha']\n */\nexport class Sedra {\n private readonly year: number;\n private readonly il: boolean;\n private readonly rh: number;\n private readonly firstSaturday: number;\n private readonly theSedraArray: readonly NumberOrString[];\n private readonly yearKey: string;\n /**\n * Calculates the Parashat HaShavua schedule for an entire Hebrew year.\n * @param hyear - Hebrew year (e.g. 5749)\n * @param il - Use Israel sedra schedule (false for Diaspora)\n */\n constructor(hyear: number, il: boolean) {\n hyear = +hyear;\n this.year = hyear;\n\n const rh0 = new HDate(1, months.TISHREI, hyear);\n const rh = (this.rh = rh0.abs());\n const rhDay = rh0.getDay() + 1;\n\n // find the first Saturday on or after Rosh Hashana\n this.firstSaturday = HDate.dayOnOrBefore(6, rh + 6);\n const leap = +HDate.isLeapYear(hyear);\n this.il = Boolean(il);\n\n const type = yearType(hyear);\n let key = `${leap}${rhDay}${type}`;\n if (types[key]) {\n this.theSedraArray = types[key];\n this.yearKey = key;\n } else {\n key = key + +this.il; // cast to num, then concat\n this.theSedraArray = types[key];\n this.yearKey = key;\n }\n\n if (!this.theSedraArray) {\n throw new Error(`improper sedra year type ${key} calculated for ${hyear}`);\n }\n }\n\n /**\n * Returns the date a parsha is read this year, or `null` if it does not\n * occur in this year's schedule.\n *\n * A doubled parsha (e.g. `'Matot-Masei'`) will only return a date in years\n * where that pair is actually read together; in years where they are read\n * separately, this returns `null`. Use {@link findContaining} to find the\n * date a parsha is read regardless of whether it is doubled.\n *\n * Throws `RangeError` for an out-of-range numeric input or an invalid\n * doubled-parsha pair, and `TypeError` for a malformed array argument.\n * @example\n * import {Sedra} from '@hebcal/core';\n * const sedra = new Sedra(5784, false);\n * sedra.find('Noach')?.toString(); // '15 Cheshvan 5784'\n * sedra.find(1)?.toString(); // same, by 0-based index\n * sedra.find('Matot-Masei')?.toString(); // null in 5784 — read separately\n * sedra.find(['Matot', 'Masei']); // also null in 5784\n * @param parsha if a `string`, specified with Sephardic transliterations\n * like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element\n * array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should\n * be a 0-based parsha index (`0` for Bereshit, `1` for Noach) or a negative\n * number for a doubled parsha (e.g. `-21` for Vayakhel-Pekudei)\n */\n find(parsha: number | string | string[]): HDate | null {\n if (typeof parsha === 'number') {\n if (parsha >= parshiot.length || (parsha < 0 && !isValidDouble(parsha))) {\n throw new RangeError(`Invalid parsha number: ${parsha}`);\n }\n return this.findInternal(parsha);\n }\n if (typeof parsha === 'string') {\n const num = parsha2id.get(parsha);\n if (typeof num === 'number') {\n return this.find(num);\n }\n if (parsha.includes('-')) {\n if (parsha === CHMPESACH || parsha === CHMSUKOT) {\n return this.findInternal(parsha);\n }\n return this.find(parsha.split('-'));\n }\n // try to find Saturday holiday like 'Yom Kippur'\n return this.findInternal(parsha);\n }\n if (Array.isArray(parsha)) {\n const plen = parsha.length;\n if ((plen !== 1 && plen !== 2) || typeof parsha[0] !== 'string') {\n throw new TypeError(`Invalid parsha argument: ${JSON.stringify(parsha)}`);\n }\n if (plen === 1) {\n return this.find(parsha[0]);\n }\n const p1 = parsha[0];\n const p2 = parsha[1];\n const num1 = parsha2id.get(p1);\n const num2 = parsha2id.get(p2);\n if (\n typeof num1 !== 'number' ||\n typeof num2 !== 'number' ||\n num2 !== num1 + 1 ||\n !isValidDouble(-num1)\n ) {\n throw new RangeError(`Unrecognized parsha name: ${p1}-${p2}`);\n }\n return this.find(-num1);\n }\n return null; /* NOTREACHED */\n }\n\n private findInternal(parsha: NumberOrString): HDate | null {\n const idx = this.theSedraArray.indexOf(parsha);\n if (idx === -1) {\n return null; // doesn't occur this year\n }\n return new HDate(this.firstSaturday + idx * 7);\n }\n\n /**\n * Returns the date a parsha is read this year, looking through both\n * single and doubled forms.\n *\n * For example, if `'Matot'` is read individually this year, this returns\n * its date; if it is read as part of `'Matot-Masei'` this year, this\n * returns the date of `'Matot-Masei'` (and similarly for `'Masei'`).\n * Conversely, asking for `'Matot-Masei'` in a year where they are split\n * will return the date of `'Matot'` alone.\n * @example\n * import {Sedra} from '@hebcal/core';\n * const sedra = new Sedra(5784, false);\n * // Matot-Masei is split in 5784; both individual halves resolve:\n * sedra.findContaining('Matot')?.toString(); // '22 Tamuz 5784'\n * sedra.findContaining('Masei')?.toString(); // '29 Tamuz 5784'\n * // Asking for the doubled name returns the date of the first half:\n * sedra.findContaining('Matot-Masei')?.toString(); // '22 Tamuz 5784'\n */\n findContaining(parsha: number | string): HDate | null {\n const hdate = this.find(parsha);\n if (hdate) {\n return hdate;\n }\n if (typeof parsha === 'number') {\n // a valid negative number (double parsha in a year where they are\n // combined) would've been found above, and a invalid negative number\n // would've thrown an error, so this parsha must be a positive number\n // representing either p1 or p2\n const p1 = -parsha;\n if (isValidDouble(p1)) {\n return this.find(p1);\n } else {\n // this must be the second individual parsha of a doubled pair\n // for example 29 for Kedoshim, so check for -28 for Achrei Mot-Kedoshim\n return this.find(p1 + 1);\n }\n } else {\n const num = parsha2id.get(parsha);\n if (num) {\n // parsha is either the first or second individual parsha of\n // a pair that is doubled this year\n const p1 = -num;\n if (isValidDouble(p1)) {\n return this.find(p1);\n } else {\n return this.find(p1 + 1);\n }\n } else {\n // this was indeed a doubled parsha, so return date of the first half\n const [p1] = parsha.split('-');\n return this.find(p1);\n }\n }\n }\n\n /**\n * Returns the underlying annual reading schedule as an array, where each\n * entry corresponds to one Saturday (starting from the first Shabbat on\n * or after Rosh Hashana). Entries are either:\n * - a non-negative `number`: a 0-based parsha index (e.g. `0` for\n * *Bereshit*)\n * - a negative `number`: the negated first index of a doubled parsha\n * (e.g. `-21` for *Vayakhel-Pekudei*)\n * - a `string`: a holiday name when a Yom Tov displaces the weekly reading\n * (e.g. `'Pesach Shabbat Chol ha-Moed'`, `'Yom Kippur'`)\n *\n * Used by `@hebcal/triennial`.\n */\n getSedraArray(): readonly NumberOrString[] {\n return this.theSedraArray;\n }\n\n /**\n * Returns the R.D. (Rata Die / Fixed Date) absolute day number of the\n * first Saturday on or after Rosh Hashana of this year. This is the\n * anchor point for {@link getSedraArray} — index `0` of that array\n * corresponds to this date.\n */\n getFirstSaturday(): number {\n return this.firstSaturday;\n }\n\n /** Returns the Hebrew year this `Sedra` instance covers. */\n getYear(): number {\n return this.year;\n }\n\n /**\n * Returns details about the parsha read on the first Saturday on or after\n * `hd`. If `hd` is itself a Saturday, the reading for that date is\n * returned; otherwise the reading for the upcoming Saturday is returned.\n *\n * If the given date falls in the final days of the Hebrew year (after\n * the last reading of this year's schedule), this method transparently\n * delegates to the next year's `Sedra`.\n * @example\n * import {Sedra, HDate, months} from '@hebcal/core';\n * const sedra = new Sedra(5784, false);\n * // A weekday — returns the upcoming Shabbat's reading\n * const result = sedra.lookup(new HDate(13, months.CHESHVAN, 5784));\n * console.log(result.parsha); // ['Lech-Lecha']\n * console.log(result.chag); // false\n * console.log(result.hdate.toString()); // '15 Cheshvan 5784' (Saturday)\n * @param hd Hebrew date or R.D. days\n */\n lookup(hd: HDate | number): SedraResult {\n const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;\n\n if (isNaN(abs)) {\n throw new TypeError(`Bad date argument: ${hd}`);\n }\n if (abs < this.rh) {\n throw new RangeError(`Date ${hd} before start of Hebrew year ${this.year}`);\n }\n\n // find the first saturday on or after today's date\n const saturday = HDate.dayOnOrBefore(6, abs + 6);\n\n const weekNum = (saturday - this.firstSaturday) / 7;\n const index = this.theSedraArray[weekNum];\n\n if (index === undefined) {\n const sedra = getSedra(this.year + 1, this.il);\n return sedra.lookup(saturday); // must be next year\n }\n const hdate = new HDate(saturday);\n if (typeof index === 'string') {\n // Shabbat has a chag. Return a description\n return {parsha: [index], chag: true, hdate, il: this.il, num: 0};\n }\n if (index >= 0) {\n return {\n parsha: [parshiot[index]],\n chag: false,\n num: index + 1,\n hdate,\n il: this.il,\n };\n }\n\n const p1 = D(index); // undouble the parsha\n return {\n parsha: [parshiot[p1], parshiot[p1 + 1]],\n chag: false,\n num: [p1 + 1, p1 + 2],\n hdate,\n il: this.il,\n };\n }\n\n /**\n * Returns details about the parsha read on Monday or Thursday for `hd`, or\n * `undefined` if `hd` is not a Monday or Thursday.\n *\n * Weekday Torah readings generally begin the upcoming Shabbat parsha. When\n * the upcoming Shabbat is a holiday, this method returns the next regular\n * parsha instead.\n *\n * For the Tishrei weekdays before Sukkot or Simchat Torah, the weekday\n * reading is *Vezot Haberakhah* even though it is not read on Shabbat.\n * @param hd Hebrew date or R.D. days\n */\n lookupWeekday(hd: HDate | number): SedraResult | undefined {\n const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;\n\n if (isNaN(abs)) {\n throw new TypeError(`Bad date argument: ${hd}`);\n }\n if (abs < this.rh) {\n throw new RangeError(`Date ${hd} before start of Hebrew year ${this.year}`);\n }\n\n const hdate = new HDate(abs);\n const day = hdate.getDay();\n if (day !== 1 && day !== 4) {\n return undefined;\n }\n\n const saturday = new HDate(HDate.dayOnOrBefore(6, abs + 6));\n const parsha = this.lookup(saturday);\n if (!parsha.chag) {\n return parsha;\n }\n return this.findWeekdayParsha(saturday);\n }\n\n private findWeekdayParsha(saturday: HDate): SedraResult {\n const hyear = saturday.getFullYear();\n const il = this.il;\n\n if (saturday.getMonth() === months.TISHREI) {\n const dd = saturday.getDate();\n const simchatTorah = il ? 22 : 23;\n if (dd > 2 && dd <= simchatTorah) {\n return {\n parsha: ['Vezot Haberakhah'],\n chag: false,\n num: 54,\n hdate: saturday,\n il,\n };\n }\n }\n\n const sedra = hyear === this.year ? this : getSedra(hyear, il);\n const endOfYear = new HDate(1, months.TISHREI, hyear + 1).abs() - 1;\n const endAbs = endOfYear + 30;\n for (let sat2 = saturday.abs() + 7; sat2 <= endAbs; sat2 += 7) {\n const sedra2 = sat2 > endOfYear ? getSedra(hyear + 1, il) : sedra;\n const parsha2 = sedra2.lookup(sat2);\n if (!parsha2.chag) {\n return parsha2;\n }\n }\n /* NOTREACHED */\n throw new Error(`can't find weekday parsha for ${saturday}/${il}`);\n }\n}\n\n/**\n * The 54 parshiyot of the Torah as transilterated strings.\n * * parshiot[0] == `Bereshit`\n * * parshiot[1] == `Noach`\n * * parshiot[52] == `Ha'azinu`\n * * parshiot[53] == `Vezot Haberakhah`\n * @readonly\n * @type {string[]}\n */\nexport const parshiot: readonly string[] = [\n 'Bereshit',\n 'Noach',\n 'Lech-Lecha',\n 'Vayera',\n 'Chayei Sara',\n 'Toldot',\n 'Vayetzei',\n 'Vayishlach',\n 'Vayeshev',\n 'Miketz',\n 'Vayigash',\n 'Vayechi',\n 'Shemot',\n 'Vaera',\n 'Bo',\n 'Beshalach',\n 'Yitro',\n 'Mishpatim',\n 'Terumah',\n 'Tetzaveh',\n 'Ki Tisa',\n 'Vayakhel',\n 'Pekudei',\n 'Vayikra',\n 'Tzav',\n 'Shmini',\n 'Tazria',\n 'Metzora',\n 'Achrei Mot',\n 'Kedoshim',\n 'Emor',\n 'Behar',\n 'Bechukotai',\n 'Bamidbar',\n 'Nasso',\n \"Beha'alotcha\",\n \"Sh'lach\",\n 'Korach',\n 'Chukat',\n 'Balak',\n 'Pinchas',\n 'Matot',\n 'Masei',\n 'Devarim',\n 'Vaetchanan',\n 'Eikev',\n \"Re'eh\",\n 'Shoftim',\n 'Ki Teitzei',\n 'Ki Tavo',\n 'Nitzavim',\n 'Vayeilech',\n \"Ha'azinu\",\n 'Vezot Haberakhah',\n] as const;\n\n// 0-based parsha IDs\nconst parsha2id = new Map<string, number>();\nfor (let id = 0; id < parshiot.length; id++) {\n const name = parshiot[id];\n parsha2id.set(name, id);\n}\n\n// 0-based parsha IDs\nconst doubles = new Set([\n 21, // Vayakhel-Pekudei\n 26, // Tazria-Metzora\n 28, // Achrei Mot-Kedoshim\n 31, // Behar-Bechukotai\n 38, // Chukat-Balak\n 41, // Matot-Masei\n 50, // Nitzavim-Vayeilech\n]);\n\n/**\n * @private\n * @param id a negative number\n */\nfunction isValidDouble(id: number): boolean {\n return doubles.has(-id);\n}\n\n/**\n * parsha doubler/undoubler\n * @private\n * @param p\n */\nfunction D(p: number): number {\n return -p;\n}\n\nconst RH = 'Rosh Hashana'; // 0\nconst YK = 'Yom Kippur'; // 1\n\nconst SUKKOT = 'Sukkot'; // 0\nconst CHMSUKOT = 'Sukkot Shabbat Chol ha-Moed'; // 0\nconst SHMINI = 'Shmini Atzeret'; // 0\n\nconst PESACH = 'Pesach'; // 25\nconst PESACH1 = 'Pesach I';\nconst CHMPESACH = 'Pesach Shabbat Chol ha-Moed'; // 25\nconst PESACH7 = 'Pesach VII'; // 25\nconst PESACH8 = 'Pesach VIII';\nconst SHAVUOT = 'Shavuot'; // 33\n\n/**\n * Returns an array from start to end\n * @private\n * @param start beginning number, inclusive\n * @param stop ending number, inclusive\n */\nfunction range(start: number, stop: number): readonly number[] {\n return Array.from({length: stop - start + 1}, (v, k) => k + start);\n}\n\ntype NumberOrString = number | string;\n\nconst yearStartVayeilech: readonly NumberOrString[] = [51, 52, CHMSUKOT];\nconst yearStartHaazinu: readonly NumberOrString[] = [52, YK, CHMSUKOT];\nconst yearStartRH: readonly NumberOrString[] = [RH, 52, SUKKOT, SHMINI];\nconst r020 = range(0, 20);\nconst r027 = range(0, 27);\nconst r3340 = range(33, 40);\nconst r4349 = range(43, 49);\nconst r4350 = range(43, 50);\n\n/**\n * The ordinary year types (keviot)\n * names are leap/nonleap - day - incomplete/regular/complete - diaspora/Israel\n * @private\n * @readonly\n */\nconst types: Record<string, readonly NumberOrString[]> = {\n /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and\n * Kislev each have 29 days), and has Passover start on Tuesday. */\n // e.g. 5753\n '020': yearStartVayeilech.concat(\n r020,\n D(21),\n 23,\n 24,\n CHMPESACH,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n r3340,\n D(41),\n r4349,\n D(50)\n ),\n\n /* Hebrew year that starts on Monday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Thursday. */\n // e.g. 5756\n '0220': yearStartVayeilech.concat(\n r020,\n D(21),\n 23,\n 24,\n CHMPESACH,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n 33,\n SHAVUOT,\n range(34, 37),\n D(38),\n 40,\n D(41),\n r4349,\n D(50)\n ),\n\n /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Saturday. */\n // e.g. 5701\n '0510': yearStartHaazinu.concat(\n r020,\n D(21),\n 23,\n 24,\n PESACH1,\n PESACH8,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n r3340,\n D(41),\n r4350\n ),\n\n /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Saturday. */\n // e.g. 5745\n '0511': yearStartHaazinu.concat(\n r020,\n D(21),\n 23,\n 24,\n PESACH,\n 25,\n D(26),\n D(28),\n range(30, 40),\n D(41),\n r4350\n ),\n\n /* Hebrew year that starts on Thursday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Sunday. */\n // e.g. 5754\n '052': yearStartHaazinu.concat(\n range(0, 24),\n PESACH7,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n r3340,\n D(41),\n r4350\n ),\n\n /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev\n * each have 29 days), and has Passover start on Sunday. */\n // e.g. 5761\n '070': yearStartRH.concat(\n r020,\n D(21),\n 23,\n 24,\n PESACH7,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n r3340,\n D(41),\n r4350\n ),\n\n /* Hebrew year that starts on Saturday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Tuesday. */\n // e.g. 5716\n '072': yearStartRH.concat(\n r020,\n D(21),\n 23,\n 24,\n CHMPESACH,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n r3340,\n D(41),\n r4349,\n D(50)\n ),\n\n /* -- The leap year types (keviot) -- */\n /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and\n * Kislev each have 29 days), and has Passover start on Thursday. */\n // e.g. 5746\n '1200': yearStartVayeilech.concat(\n r027,\n CHMPESACH,\n range(28, 33),\n SHAVUOT,\n range(34, 37),\n D(38),\n 40,\n D(41),\n r4349,\n D(50)\n ),\n\n /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and\n * Kislev each have 29 days), and has Passover start on Thursday. */\n // e.g. 5746\n '1201': yearStartVayeilech.concat(\n r027,\n CHMPESACH,\n range(28, 40),\n D(41),\n r4349,\n D(50)\n ),\n\n /* Hebrew year that starts on Monday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Saturday. */\n // e.g.5752\n '1220': yearStartVayeilech.concat(\n r027,\n PESACH1,\n PESACH8,\n range(28, 40),\n D(41),\n r4350\n ),\n\n /* Hebrew year that starts on Monday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Saturday. */\n // e.g.5752\n '1221': yearStartVayeilech.concat(r027, PESACH, range(28, 50)),\n\n /* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and\n * Kislev both have 29 days), and has Passover start on Sunday. */\n // e.g. 5768\n '150': yearStartHaazinu.concat(range(0, 28), PESACH7, range(29, 50)),\n\n /* Hebrew year that starts on Thursday, is `complete' (Heshvan and\n * Kislev both have 30 days), and has Passover start on Tuesday. */\n // eg. 5771\n '152': yearStartHaazinu.concat(range(0, 28), CHMPESACH, range(29, 49), D(50)),\n\n /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and\n * Kislev each have 29 days), and has Passover start on Tuesday. */\n // e.g.5757\n '170': yearStartRH.concat(r027, CHMPESACH, range(28, 40), D(41), r4349, D(50)),\n\n /* Hebrew year that starts on Saturday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Thursday. */\n '1720': yearStartRH.concat(\n r027,\n CHMPESACH,\n range(28, 33),\n SHAVUOT,\n range(34, 37),\n D(38),\n 40,\n D(41),\n r4349,\n D(50)\n ),\n} as const;\n\n/* Hebrew year that starts on Monday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Thursday. */\ntypes['0221'] = types['020'];\n\n/* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Thursday. */\n// e.g. 5715\ntypes['0310'] = types['0220'];\n\n/* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Thursday. */\ntypes['0311'] = types['020'];\n\n/* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Saturday. */\n// e.g. 5715\ntypes['1310'] = types['1220'];\n/* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Saturday. */\ntypes['1311'] = types['1221'];\n\n/* Hebrew year that starts on Saturday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Thursday. */\ntypes['1721'] = types['170'];\n\nconst sedraCache = new QuickLRU<string, Sedra>({maxSize: 120});\n\n/**\n * Convenience function to create an instance of {@link Sedra} or reuse a\n * previously created and cached instance for the same year and schedule.\n *\n * Prefer this over `new Sedra(...)` when calling repeatedly — an internal\n * LRU cache (~120 entries) avoids recomputing the keviyah-specific schedule.\n * @example\n * import {getSedra, HDate, months} from '@hebcal/core';\n * const sedra = getSedra(5784, false);\n * const {parsha} = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));\n * console.log(parsha); // ['Lech-Lecha']\n * @param hyear Hebrew year\n * @param il Use Israel sedra schedule (`false` for Diaspora)\n */\nexport function getSedra(hyear: number, il: boolean): Sedra {\n const cacheKey = `${hyear}-${il ? 1 : 0}`;\n let sedra = sedraCache.get(cacheKey);\n if (!sedra) {\n sedra = new Sedra(hyear, il);\n sedraCache.set(cacheKey, sedra);\n }\n return sedra;\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAEH;;;;;;;;;;AAUG;AAKH,MAAM,UAAU,GAAG,CAAC;AACpB,MAAM,OA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KAAK,CAAC,MAAM,CAAC;AAE7B;AACoE;AACpE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;AAE5B,MAAM,UAAU,GAAG,IAAI,QAAQ,CAAgB,EAAC,OAAO,EAAE,GAAG,EAAC,CAAC;AAE9D;;;;;;;;;;;;;AAaG;AACG,SAAU,QAAQ,CAAC,KAAa,EAAE,EAAW,EAAA;AACjD,IAAA,MAAM,QAAQ,GAAG,CAAA,EAAG,KAAK,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE;IACzC,IAAI,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC;IACpC,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;AAC5B,QAAA,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC;IACjC;AACA,IAAA,OAAO,KAAK;AACd;;;;"}
|
|
1
|
+
{"version":3,"file":"sedra.js","sources":["../../../src/sedra.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n/*\n * Many of the following algorithms were taken from hebrew calendar\n * routines by Maimonedes, from his Mishneh Torah, and implemented by\n * Nachum Dershowitz Department of Computer Science\n * (217) 333-4219 University of Illinois at Urbana-Champaign\n * nachum@cs.uiuedu 1304 West Springfield Avenue\n * Urbana, Illinois 61801\n *\n * The routines were included in the emacs 19 distribution.\n *\n */\nimport {HDate, months} from '@hebcal/hdate';\nimport QuickLRU from 'quick-lru';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst INCOMPLETE = 0;\nconst REGULAR = 1;\nconst COMPLETE = 2;\n\nfunction yearType(hyear: number): number {\n const longC = HDate.longCheshvan(hyear);\n const shortK = HDate.shortKislev(hyear);\n if (longC && !shortK) {\n return COMPLETE;\n }\n if (!longC && shortK) {\n return INCOMPLETE;\n }\n return REGULAR;\n}\n\n/** The result from `Sedra.lookup()` */\nexport type SedraResult = {\n /**\n * Name of the parsha (or parshiyot) read on\n * Hebrew date, e.g. `['Noach']` or `['Matot', 'Masei']`\n */\n parsha: string[];\n /**\n * False if this is a regular parashat HaShavua reading.\n * True if it's a special holiday reading.\n */\n chag: boolean;\n /**\n * The parsha number (or numbers) using 1-indexing.\n * A `number` for a regular (single) parsha, and a `number[]`\n * for a doubled parsha.\n * For Parashat *Bereshit*, `num` would be equal to `1`, and for\n * *Matot-Masei* it would be `[42, 43]`\n * For a chag (holiday) reading, `num` will be `0`.\n */\n num: number | number[];\n /** The date of the Shabbat this parsha is read */\n hdate: HDate;\n /** true if Israel, false for Diaspora */\n il: boolean;\n};\n\n/**\n * Represents the weekly Torah-reading (Parashat HaShavua) schedule for an\n * entire Hebrew year.\n *\n * The schedule depends on the year's *keviyah* — the day of week of Rosh\n * Hashana, whether the year is leap, whether Cheshvan/Kislev are long or\n * short, and whether the schedule is for Israel or the Diaspora (since\n * Israel and the Diaspora diverge in some years when the 8th day of Pesach\n * or the 2nd day of Shavuot fall on Shabbat).\n *\n * Prefer {@link getSedra} over\n * calling this constructor directly, since both cache their results.\n *\n * @example\n * import {Sedra, HDate, months} from '@hebcal/core';\n * const sedra = new Sedra(5784, false);\n * const result = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));\n * console.log(result.parsha); // ['Vayera']\n */\nexport class Sedra {\n private readonly year: number;\n private readonly il: boolean;\n private readonly rh: number;\n private readonly firstSaturday: number;\n private readonly theSedraArray: readonly NumberOrString[];\n private readonly yearKey: string;\n /**\n * Calculates the Parashat HaShavua schedule for an entire Hebrew year.\n * @param hyear - Hebrew year (e.g. 5749)\n * @param il - Use Israel sedra schedule (false for Diaspora)\n */\n constructor(hyear: number, il: boolean) {\n hyear = +hyear;\n this.year = hyear;\n\n const rh0 = new HDate(1, months.TISHREI, hyear);\n const rh = (this.rh = rh0.abs());\n const rhDay = rh0.getDay() + 1;\n\n // find the first Saturday on or after Rosh Hashana\n this.firstSaturday = HDate.dayOnOrBefore(6, rh + 6);\n const leap = +HDate.isLeapYear(hyear);\n this.il = Boolean(il);\n\n const type = yearType(hyear);\n let key = `${leap}${rhDay}${type}`;\n if (types[key]) {\n this.theSedraArray = types[key];\n this.yearKey = key;\n } else {\n key = key + +this.il; // cast to num, then concat\n this.theSedraArray = types[key];\n this.yearKey = key;\n }\n\n if (!this.theSedraArray) {\n throw new Error(`improper sedra year type ${key} calculated for ${hyear}`);\n }\n }\n\n /**\n * Returns the date a parsha is read this year, or `null` if it does not\n * occur in this year's schedule.\n *\n * A doubled parsha (e.g. `'Matot-Masei'`) will only return a date in years\n * where that pair is actually read together; in years where they are read\n * separately, this returns `null`. Use {@link findContaining} to find the\n * date a parsha is read regardless of whether it is doubled.\n *\n * Throws `RangeError` for an out-of-range numeric input or an invalid\n * doubled-parsha pair, and `TypeError` for a malformed array argument.\n * @example\n * import {Sedra} from '@hebcal/core';\n * const sedra = new Sedra(5784, false);\n * sedra.find('Noach')?.toString(); // '6 Cheshvan 5784'\n * sedra.find(1)?.toString(); // '6 Cheshvan 5784', by 0-based index\n * // Matot and Masei are doubled in 5784, so the pair has a date...\n * sedra.find('Matot-Masei')?.toString(); // '28 Tamuz 5784'\n * sedra.find(['Matot', 'Masei'])?.toString(); // '28 Tamuz 5784'\n * // ...but neither half is read on its own that year:\n * sedra.find('Matot'); // null\n * @param parsha if a `string`, specified with Sephardic transliterations\n * like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element\n * array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should\n * be a 0-based parsha index (`0` for Bereshit, `1` for Noach) or a negative\n * number for a doubled parsha (e.g. `-21` for Vayakhel-Pekudei).\n * Note that this index is 0-based, unlike {@link SedraResult.num} which\n * is 1-based.\n */\n find(parsha: number | string | string[]): HDate | null {\n if (typeof parsha === 'number') {\n if (parsha >= parshiot.length || (parsha < 0 && !isValidDouble(parsha))) {\n throw new RangeError(`Invalid parsha number: ${parsha}`);\n }\n return this.findInternal(parsha);\n }\n if (typeof parsha === 'string') {\n const num = parsha2id.get(parsha);\n if (typeof num === 'number') {\n return this.find(num);\n }\n if (parsha.includes('-')) {\n if (parsha === CHMPESACH || parsha === CHMSUKOT) {\n return this.findInternal(parsha);\n }\n return this.find(parsha.split('-'));\n }\n // try to find Saturday holiday like 'Yom Kippur'\n return this.findInternal(parsha);\n }\n if (Array.isArray(parsha)) {\n const plen = parsha.length;\n if ((plen !== 1 && plen !== 2) || typeof parsha[0] !== 'string') {\n throw new TypeError(`Invalid parsha argument: ${JSON.stringify(parsha)}`);\n }\n if (plen === 1) {\n return this.find(parsha[0]);\n }\n const p1 = parsha[0];\n const p2 = parsha[1];\n const num1 = parsha2id.get(p1);\n const num2 = parsha2id.get(p2);\n if (\n typeof num1 !== 'number' ||\n typeof num2 !== 'number' ||\n num2 !== num1 + 1 ||\n !isValidDouble(-num1)\n ) {\n throw new RangeError(`Unrecognized parsha name: ${p1}-${p2}`);\n }\n return this.find(-num1);\n }\n return null; /* NOTREACHED */\n }\n\n private findInternal(parsha: NumberOrString): HDate | null {\n const idx = this.theSedraArray.indexOf(parsha);\n if (idx === -1) {\n return null; // doesn't occur this year\n }\n return new HDate(this.firstSaturday + idx * 7);\n }\n\n /**\n * Returns the date a parsha is read this year, looking through both\n * single and doubled forms.\n *\n * For example, if `'Matot'` is read individually this year, this returns\n * its date; if it is read as part of `'Matot-Masei'` this year, this\n * returns the date of `'Matot-Masei'` (and similarly for `'Masei'`).\n * Conversely, asking for `'Matot-Masei'` in a year where they are split\n * will return the date of `'Matot'` alone.\n * @example\n * import {Sedra} from '@hebcal/core';\n * // Matot and Masei are doubled in 5784, so each half resolves to the\n * // date of the combined reading:\n * const sedra = new Sedra(5784, false);\n * sedra.findContaining('Matot')?.toString(); // '28 Tamuz 5784'\n * sedra.findContaining('Masei')?.toString(); // '28 Tamuz 5784'\n * @example\n * import {Sedra} from '@hebcal/core';\n * // They are read separately in 5795, so each half has its own date, and\n * // asking for the doubled name returns the date of the first half:\n * const sedra = new Sedra(5795, false);\n * sedra.findContaining('Matot')?.toString(); // '21 Tamuz 5795'\n * sedra.findContaining('Masei')?.toString(); // '28 Tamuz 5795'\n * sedra.findContaining('Matot-Masei')?.toString(); // '21 Tamuz 5795'\n */\n findContaining(parsha: number | string): HDate | null {\n const hdate = this.find(parsha);\n if (hdate) {\n return hdate;\n }\n if (typeof parsha === 'number') {\n // a valid negative number (double parsha in a year where they are\n // combined) would've been found above, and a invalid negative number\n // would've thrown an error, so this parsha must be a positive number\n // representing either p1 or p2\n const p1 = -parsha;\n if (isValidDouble(p1)) {\n return this.find(p1);\n } else {\n // this must be the second individual parsha of a doubled pair\n // for example 29 for Kedoshim, so check for -28 for Achrei Mot-Kedoshim\n return this.find(p1 + 1);\n }\n } else {\n const num = parsha2id.get(parsha);\n if (num) {\n // parsha is either the first or second individual parsha of\n // a pair that is doubled this year\n const p1 = -num;\n if (isValidDouble(p1)) {\n return this.find(p1);\n } else {\n return this.find(p1 + 1);\n }\n } else {\n // this was indeed a doubled parsha, so return date of the first half\n const [p1] = parsha.split('-');\n return this.find(p1);\n }\n }\n }\n\n /**\n * Returns the underlying annual reading schedule as an array, where each\n * entry corresponds to one Saturday (starting from the first Shabbat on\n * or after Rosh Hashana). Entries are either:\n * - a non-negative `number`: a 0-based parsha index (e.g. `0` for\n * *Bereshit*)\n * - a negative `number`: the negated first index of a doubled parsha\n * (e.g. `-21` for *Vayakhel-Pekudei*)\n * - a `string`: a holiday name when a Yom Tov displaces the weekly reading\n * (e.g. `'Pesach Shabbat Chol ha-Moed'`, `'Yom Kippur'`)\n *\n * Used by `@hebcal/triennial`.\n */\n getSedraArray(): readonly NumberOrString[] {\n return this.theSedraArray;\n }\n\n /**\n * Returns the R.D. (Rata Die / Fixed Date) absolute day number of the\n * first Saturday on or after Rosh Hashana of this year. This is the\n * anchor point for {@link getSedraArray} — index `0` of that array\n * corresponds to this date.\n */\n getFirstSaturday(): number {\n return this.firstSaturday;\n }\n\n /** Returns the Hebrew year this `Sedra` instance covers. */\n getYear(): number {\n return this.year;\n }\n\n /**\n * Returns details about the parsha read on the first Saturday on or after\n * `hd`. If `hd` is itself a Saturday, the reading for that date is\n * returned; otherwise the reading for the upcoming Saturday is returned.\n *\n * If the given date falls in the final days of the Hebrew year (after\n * the last reading of this year's schedule), this method transparently\n * delegates to the next year's `Sedra`.\n * @example\n * import {Sedra, HDate, months} from '@hebcal/core';\n * const sedra = new Sedra(5784, false);\n * // A Friday — returns the upcoming Shabbat's reading\n * const result = sedra.lookup(new HDate(12, months.CHESHVAN, 5784));\n * console.log(result.parsha); // ['Lech-Lecha']\n * console.log(result.chag); // false\n * console.log(result.hdate.toString()); // '13 Cheshvan 5784' (Saturday)\n * @param hd Hebrew date or R.D. days\n */\n lookup(hd: HDate | number): SedraResult {\n const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;\n\n if (isNaN(abs)) {\n throw new TypeError(`Bad date argument: ${hd}`);\n }\n if (abs < this.rh) {\n throw new RangeError(`Date ${hd} before start of Hebrew year ${this.year}`);\n }\n\n // find the first saturday on or after today's date\n const saturday = HDate.dayOnOrBefore(6, abs + 6);\n\n const weekNum = (saturday - this.firstSaturday) / 7;\n const index = this.theSedraArray[weekNum];\n\n if (index === undefined) {\n const sedra = getSedra(this.year + 1, this.il);\n return sedra.lookup(saturday); // must be next year\n }\n const hdate = new HDate(saturday);\n if (typeof index === 'string') {\n // Shabbat has a chag. Return a description\n return {parsha: [index], chag: true, hdate, il: this.il, num: 0};\n }\n if (index >= 0) {\n return {\n parsha: [parshiot[index]],\n chag: false,\n num: index + 1,\n hdate,\n il: this.il,\n };\n }\n\n const p1 = D(index); // undouble the parsha\n return {\n parsha: [parshiot[p1], parshiot[p1 + 1]],\n chag: false,\n num: [p1 + 1, p1 + 2],\n hdate,\n il: this.il,\n };\n }\n\n /**\n * Returns details about the parsha read on Monday or Thursday for `hd`, or\n * `undefined` if `hd` is not a Monday or Thursday.\n *\n * Weekday Torah readings generally begin the upcoming Shabbat parsha. When\n * the upcoming Shabbat is a holiday, this method returns the next regular\n * parsha instead.\n *\n * For the Tishrei weekdays before Sukkot or Simchat Torah, the weekday\n * reading is *Vezot Haberakhah* even though it is not read on Shabbat.\n * @example\n * import {Sedra, HDate, months} from '@hebcal/core';\n * const sedra = new Sedra(5784, false);\n * // Monday 8 Cheshvan — begins the upcoming Shabbat's parsha\n * sedra.lookupWeekday(new HDate(8, months.CHESHVAN, 5784))?.parsha; // ['Lech-Lecha']\n * // Tuesday is neither Monday nor Thursday\n * sedra.lookupWeekday(new HDate(9, months.CHESHVAN, 5784)); // undefined\n * // Thursday 17 Nisan — the upcoming Shabbat is Chol ha-Moed Pesach,\n * // so the next regular parsha is returned instead\n * sedra.lookupWeekday(new HDate(17, months.NISAN, 5784))?.parsha; // ['Achrei Mot']\n * @param hd Hebrew date or R.D. days\n */\n lookupWeekday(hd: HDate | number): SedraResult | undefined {\n const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;\n\n if (isNaN(abs)) {\n throw new TypeError(`Bad date argument: ${hd}`);\n }\n if (abs < this.rh) {\n throw new RangeError(`Date ${hd} before start of Hebrew year ${this.year}`);\n }\n\n const hdate = new HDate(abs);\n const day = hdate.getDay();\n if (day !== 1 && day !== 4) {\n return undefined;\n }\n\n const saturday = new HDate(HDate.dayOnOrBefore(6, abs + 6));\n const parsha = this.lookup(saturday);\n if (!parsha.chag) {\n return parsha;\n }\n return this.findWeekdayParsha(saturday);\n }\n\n private findWeekdayParsha(saturday: HDate): SedraResult {\n const hyear = saturday.getFullYear();\n const il = this.il;\n\n if (saturday.getMonth() === months.TISHREI) {\n const dd = saturday.getDate();\n const simchatTorah = il ? 22 : 23;\n if (dd > 2 && dd <= simchatTorah) {\n return {\n parsha: ['Vezot Haberakhah'],\n chag: false,\n num: 54,\n hdate: saturday,\n il,\n };\n }\n }\n\n const sedra = hyear === this.year ? this : getSedra(hyear, il);\n const endOfYear = new HDate(1, months.TISHREI, hyear + 1).abs() - 1;\n const endAbs = endOfYear + 30;\n for (let sat2 = saturday.abs() + 7; sat2 <= endAbs; sat2 += 7) {\n const sedra2 = sat2 > endOfYear ? getSedra(hyear + 1, il) : sedra;\n const parsha2 = sedra2.lookup(sat2);\n if (!parsha2.chag) {\n return parsha2;\n }\n }\n /* NOTREACHED */\n throw new Error(`can't find weekday parsha for ${saturday}/${il}`);\n }\n}\n\n/**\n * The 54 parshiyot of the Torah as transilterated strings.\n * * parshiot[0] == `Bereshit`\n * * parshiot[1] == `Noach`\n * * parshiot[52] == `Ha'azinu`\n * * parshiot[53] == `Vezot Haberakhah`\n * @readonly\n * @type {string[]}\n */\nexport const parshiot: readonly string[] = [\n 'Bereshit',\n 'Noach',\n 'Lech-Lecha',\n 'Vayera',\n 'Chayei Sara',\n 'Toldot',\n 'Vayetzei',\n 'Vayishlach',\n 'Vayeshev',\n 'Miketz',\n 'Vayigash',\n 'Vayechi',\n 'Shemot',\n 'Vaera',\n 'Bo',\n 'Beshalach',\n 'Yitro',\n 'Mishpatim',\n 'Terumah',\n 'Tetzaveh',\n 'Ki Tisa',\n 'Vayakhel',\n 'Pekudei',\n 'Vayikra',\n 'Tzav',\n 'Shmini',\n 'Tazria',\n 'Metzora',\n 'Achrei Mot',\n 'Kedoshim',\n 'Emor',\n 'Behar',\n 'Bechukotai',\n 'Bamidbar',\n 'Nasso',\n \"Beha'alotcha\",\n \"Sh'lach\",\n 'Korach',\n 'Chukat',\n 'Balak',\n 'Pinchas',\n 'Matot',\n 'Masei',\n 'Devarim',\n 'Vaetchanan',\n 'Eikev',\n \"Re'eh\",\n 'Shoftim',\n 'Ki Teitzei',\n 'Ki Tavo',\n 'Nitzavim',\n 'Vayeilech',\n \"Ha'azinu\",\n 'Vezot Haberakhah',\n] as const;\n\n// 0-based parsha IDs\nconst parsha2id = new Map<string, number>();\nfor (let id = 0; id < parshiot.length; id++) {\n const name = parshiot[id];\n parsha2id.set(name, id);\n}\n\n// 0-based parsha IDs\nconst doubles = new Set([\n 21, // Vayakhel-Pekudei\n 26, // Tazria-Metzora\n 28, // Achrei Mot-Kedoshim\n 31, // Behar-Bechukotai\n 38, // Chukat-Balak\n 41, // Matot-Masei\n 50, // Nitzavim-Vayeilech\n]);\n\n/**\n * @private\n * @param id a negative number\n */\nfunction isValidDouble(id: number): boolean {\n return doubles.has(-id);\n}\n\n/**\n * parsha doubler/undoubler\n * @private\n * @param p\n */\nfunction D(p: number): number {\n return -p;\n}\n\nconst RH = 'Rosh Hashana'; // 0\nconst YK = 'Yom Kippur'; // 1\n\nconst SUKKOT = 'Sukkot'; // 0\nconst CHMSUKOT = 'Sukkot Shabbat Chol ha-Moed'; // 0\nconst SHMINI = 'Shmini Atzeret'; // 0\n\nconst PESACH = 'Pesach'; // 25\nconst PESACH1 = 'Pesach I';\nconst CHMPESACH = 'Pesach Shabbat Chol ha-Moed'; // 25\nconst PESACH7 = 'Pesach VII'; // 25\nconst PESACH8 = 'Pesach VIII';\nconst SHAVUOT = 'Shavuot'; // 33\n\n/**\n * Returns an array from start to end\n * @private\n * @param start beginning number, inclusive\n * @param stop ending number, inclusive\n */\nfunction range(start: number, stop: number): readonly number[] {\n return Array.from({length: stop - start + 1}, (v, k) => k + start);\n}\n\n/**\n * An entry in the array returned by {@link Sedra.getSedraArray}: either a\n * `number` identifying a parsha (or, when negative, a doubled parsha) or a\n * `string` naming the holiday that displaces the weekly reading.\n */\nexport type NumberOrString = number | string;\n\nconst yearStartVayeilech: readonly NumberOrString[] = [51, 52, CHMSUKOT];\nconst yearStartHaazinu: readonly NumberOrString[] = [52, YK, CHMSUKOT];\nconst yearStartRH: readonly NumberOrString[] = [RH, 52, SUKKOT, SHMINI];\nconst r020 = range(0, 20);\nconst r027 = range(0, 27);\nconst r3340 = range(33, 40);\nconst r4349 = range(43, 49);\nconst r4350 = range(43, 50);\n\n/**\n * The ordinary year types (keviot)\n * names are leap/nonleap - day - incomplete/regular/complete - diaspora/Israel\n * @private\n * @readonly\n */\nconst types: Record<string, readonly NumberOrString[]> = {\n /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and\n * Kislev each have 29 days), and has Passover start on Tuesday. */\n // e.g. 5753\n '020': yearStartVayeilech.concat(\n r020,\n D(21),\n 23,\n 24,\n CHMPESACH,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n r3340,\n D(41),\n r4349,\n D(50)\n ),\n\n /* Hebrew year that starts on Monday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Thursday. */\n // e.g. 5756\n '0220': yearStartVayeilech.concat(\n r020,\n D(21),\n 23,\n 24,\n CHMPESACH,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n 33,\n SHAVUOT,\n range(34, 37),\n D(38),\n 40,\n D(41),\n r4349,\n D(50)\n ),\n\n /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Saturday. */\n // e.g. 5701\n '0510': yearStartHaazinu.concat(\n r020,\n D(21),\n 23,\n 24,\n PESACH1,\n PESACH8,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n r3340,\n D(41),\n r4350\n ),\n\n /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Saturday. */\n // e.g. 5745\n '0511': yearStartHaazinu.concat(\n r020,\n D(21),\n 23,\n 24,\n PESACH,\n 25,\n D(26),\n D(28),\n range(30, 40),\n D(41),\n r4350\n ),\n\n /* Hebrew year that starts on Thursday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Sunday. */\n // e.g. 5754\n '052': yearStartHaazinu.concat(\n range(0, 24),\n PESACH7,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n r3340,\n D(41),\n r4350\n ),\n\n /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev\n * each have 29 days), and has Passover start on Sunday. */\n // e.g. 5761\n '070': yearStartRH.concat(\n r020,\n D(21),\n 23,\n 24,\n PESACH7,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n r3340,\n D(41),\n r4350\n ),\n\n /* Hebrew year that starts on Saturday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Tuesday. */\n // e.g. 5716\n '072': yearStartRH.concat(\n r020,\n D(21),\n 23,\n 24,\n CHMPESACH,\n 25,\n D(26),\n D(28),\n 30,\n D(31),\n r3340,\n D(41),\n r4349,\n D(50)\n ),\n\n /* -- The leap year types (keviot) -- */\n /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and\n * Kislev each have 29 days), and has Passover start on Thursday. */\n // e.g. 5746\n '1200': yearStartVayeilech.concat(\n r027,\n CHMPESACH,\n range(28, 33),\n SHAVUOT,\n range(34, 37),\n D(38),\n 40,\n D(41),\n r4349,\n D(50)\n ),\n\n /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and\n * Kislev each have 29 days), and has Passover start on Thursday. */\n // e.g. 5746\n '1201': yearStartVayeilech.concat(\n r027,\n CHMPESACH,\n range(28, 40),\n D(41),\n r4349,\n D(50)\n ),\n\n /* Hebrew year that starts on Monday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Saturday. */\n // e.g.5752\n '1220': yearStartVayeilech.concat(\n r027,\n PESACH1,\n PESACH8,\n range(28, 40),\n D(41),\n r4350\n ),\n\n /* Hebrew year that starts on Monday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Saturday. */\n // e.g.5752\n '1221': yearStartVayeilech.concat(r027, PESACH, range(28, 50)),\n\n /* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and\n * Kislev both have 29 days), and has Passover start on Sunday. */\n // e.g. 5768\n '150': yearStartHaazinu.concat(range(0, 28), PESACH7, range(29, 50)),\n\n /* Hebrew year that starts on Thursday, is `complete' (Heshvan and\n * Kislev both have 30 days), and has Passover start on Tuesday. */\n // eg. 5771\n '152': yearStartHaazinu.concat(range(0, 28), CHMPESACH, range(29, 49), D(50)),\n\n /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and\n * Kislev each have 29 days), and has Passover start on Tuesday. */\n // e.g.5757\n '170': yearStartRH.concat(r027, CHMPESACH, range(28, 40), D(41), r4349, D(50)),\n\n /* Hebrew year that starts on Saturday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Thursday. */\n '1720': yearStartRH.concat(\n r027,\n CHMPESACH,\n range(28, 33),\n SHAVUOT,\n range(34, 37),\n D(38),\n 40,\n D(41),\n r4349,\n D(50)\n ),\n} as const;\n\n/* Hebrew year that starts on Monday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Thursday. */\ntypes['0221'] = types['020'];\n\n/* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Thursday. */\n// e.g. 5715\ntypes['0310'] = types['0220'];\n\n/* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Thursday. */\ntypes['0311'] = types['020'];\n\n/* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Saturday. */\n// e.g. 5715\ntypes['1310'] = types['1220'];\n/* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29\n * days and Kislev has 30 days), and has Passover start on Saturday. */\ntypes['1311'] = types['1221'];\n\n/* Hebrew year that starts on Saturday, is `complete' (Heshvan and\n * Kislev each have 30 days), and has Passover start on Thursday. */\ntypes['1721'] = types['170'];\n\nconst sedraCache = new QuickLRU<string, Sedra>({maxSize: 120});\n\n/**\n * Convenience function to create an instance of {@link Sedra} or reuse a\n * previously created and cached instance for the same year and schedule.\n *\n * Prefer this over `new Sedra(...)` when calling repeatedly — an internal\n * LRU cache (~120 entries) avoids recomputing the keviyah-specific schedule.\n * @example\n * import {getSedra, HDate, months} from '@hebcal/core';\n * const sedra = getSedra(5784, false);\n * const {parsha} = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));\n * console.log(parsha); // ['Vayera']\n * @param hyear Hebrew year\n * @param il Use Israel sedra schedule (`false` for Diaspora)\n */\nexport function getSedra(hyear: number, il: boolean): Sedra {\n const cacheKey = `${hyear}-${il ? 1 : 0}`;\n let sedra = sedraCache.get(cacheKey);\n if (!sedra) {\n sedra = new Sedra(hyear, il);\n sedraCache.set(cacheKey, sedra);\n }\n return sedra;\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAEH;;;;;;;;;;AAUG;AAKH,MAAM,UAAU,GAAG,CAAC;AACpB,MAAM,OAAO,GAAG,CAAC;AACjB,MAAM,QAAQ,GAAG,CAAC;AAElB,SAAS,QAAQ,CAAC,KAAa,EAAA;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC;IACvC,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC;AACvC,IAAA,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE;AACpB,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,CAAC,KAAK,IAAI,MAAM,EAAE;AACpB,QAAA,OAAO,UAAU;IACnB;AACA,IAAA,OAAO,OAAO;AAChB;AA6BA;;;;;;;;;;;;;;;;;;AAkBG;MACU,KAAK,CAAA;AACC,IAAA,IAAI;AACJ,IAAA,EAAE;AACF,IAAA,EAAE;AACF,IAAA,aAAa;AACb,IAAA,aAAa;AACb,IAAA,OAAO;AACxB;;;;AAIG;I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