kaabalah 6.16.0 → 6.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +19 -6
  2. package/dist/astrology/index.d.mts +3532 -151
  3. package/dist/astrology/index.d.ts +3532 -151
  4. package/dist/astrology/index.js +977 -59
  5. package/dist/astrology/index.mjs +4 -2
  6. package/dist/{chunk-MWLSSRHL.mjs → chunk-4BKDSA7L.mjs} +3 -4
  7. package/dist/chunk-4BKDSA7L.mjs.map +1 -0
  8. package/dist/{chunk-LQVHJ3VY.mjs → chunk-4RCPLGM2.mjs} +41 -41
  9. package/dist/{chunk-LQVHJ3VY.mjs.map → chunk-4RCPLGM2.mjs.map} +1 -1
  10. package/dist/chunk-4WVN4RMM.mjs +1139 -0
  11. package/dist/chunk-4WVN4RMM.mjs.map +1 -0
  12. package/dist/{chunk-J5Y325TG.mjs → chunk-4ZFY3GBP.mjs} +2210 -3
  13. package/dist/chunk-4ZFY3GBP.mjs.map +1 -0
  14. package/dist/chunk-66XGIFHW.js +23683 -0
  15. package/dist/chunk-66XGIFHW.js.map +1 -0
  16. package/dist/{chunk-PBBF5DKC.js → chunk-6SBCBVTZ.js} +21 -21
  17. package/dist/{chunk-CMXTZKWW.js → chunk-CHZUOTVW.js} +157 -157
  18. package/dist/{chunk-CMXTZKWW.js.map → chunk-CHZUOTVW.js.map} +1 -1
  19. package/dist/{chunk-WP5MRAYG.mjs → chunk-COEM6U4V.mjs} +3 -4
  20. package/dist/chunk-COEM6U4V.mjs.map +1 -0
  21. package/dist/chunk-CPXGTH2D.mjs +23395 -0
  22. package/dist/chunk-CPXGTH2D.mjs.map +1 -0
  23. package/dist/{chunk-3JMY4U4S.mjs → chunk-DBRPCQRR.mjs} +245 -211
  24. package/dist/chunk-DBRPCQRR.mjs.map +1 -0
  25. package/dist/{chunk-WRF3EORB.js → chunk-DCJYTCJZ.js} +16 -17
  26. package/dist/chunk-DCJYTCJZ.js.map +1 -0
  27. package/dist/{chunk-UO2RQQZO.mjs → chunk-DK2VS36Z.mjs} +2 -2
  28. package/dist/{chunk-HEZCZXQC.js → chunk-E353GPHE.js} +16 -16
  29. package/dist/{chunk-6LZOAU6E.js → chunk-GDJSVV46.js} +272 -241
  30. package/dist/chunk-GDJSVV46.js.map +1 -0
  31. package/dist/{chunk-Z3JZ5DZN.mjs → chunk-IZBM4CPN.mjs} +2 -2
  32. package/dist/{chunk-7OWGGDRF.js → chunk-JFRVH3TD.js} +2288 -80
  33. package/dist/chunk-JFRVH3TD.js.map +1 -0
  34. package/dist/chunk-MZBY6G5S.js +1182 -0
  35. package/dist/chunk-MZBY6G5S.js.map +1 -0
  36. package/dist/{chunk-7JWBIAUF.mjs → chunk-NS5AXNEW.mjs} +3 -3
  37. package/dist/{chunk-BKFHIKFY.js → chunk-XRSK74V5.js} +179 -180
  38. package/dist/chunk-XRSK74V5.js.map +1 -0
  39. package/dist/{chunk-2IC6H3FI.js → chunk-YVLKVB6W.js} +52 -52
  40. package/dist/cli.js +34679 -11579
  41. package/dist/cli.js.map +1 -1
  42. package/dist/core/index.js +56 -57
  43. package/dist/core/index.mjs +2 -3
  44. package/dist/core-B3_-9yli.d.mts +279 -0
  45. package/dist/core-cWIQtely.d.ts +279 -0
  46. package/dist/gematria/index.js +7 -8
  47. package/dist/gematria/index.mjs +2 -3
  48. package/dist/iching/index.d.mts +37 -37
  49. package/dist/iching/index.d.ts +37 -37
  50. package/dist/iching/index.js +46 -47
  51. package/dist/iching/index.mjs +3 -4
  52. package/dist/index.d.mts +139 -2
  53. package/dist/index.d.ts +139 -2
  54. package/dist/index.js +1652 -403
  55. package/dist/index.js.map +1 -1
  56. package/dist/index.mjs +190 -10
  57. package/dist/index.mjs.map +1 -1
  58. package/dist/numerology/index.d.mts +437 -252
  59. package/dist/numerology/index.d.ts +437 -252
  60. package/dist/numerology/index.js +108 -28
  61. package/dist/numerology/index.mjs +4 -4
  62. package/dist/schedule-types-DsR1_guG.d.mts +200 -0
  63. package/dist/schedule-types-DsR1_guG.d.ts +200 -0
  64. package/dist/semantic/index.d.mts +10 -9
  65. package/dist/semantic/index.d.ts +10 -9
  66. package/dist/semantic/index.js +41 -41
  67. package/dist/semantic/index.mjs +8 -8
  68. package/dist/swisseph.node-734BKSOZ.js +10 -0
  69. package/dist/swisseph.node-734BKSOZ.js.map +1 -0
  70. package/dist/swisseph.node-TDPYTBSS.mjs +8 -0
  71. package/dist/swisseph.node-TDPYTBSS.mjs.map +1 -0
  72. package/dist/tarot/index.js +30 -31
  73. package/dist/tarot/index.mjs +3 -4
  74. package/dist/visual/index.d.mts +1 -0
  75. package/dist/visual/index.d.ts +1 -0
  76. package/dist/visual/index.js +46 -47
  77. package/dist/visual/index.mjs +3 -4
  78. package/dist/wasm/build/swisseph.node-734BKSOZ.js +10 -0
  79. package/dist/wasm/build/swisseph.node-734BKSOZ.js.map +1 -0
  80. package/dist/wasm/build/swisseph.node-TDPYTBSS.mjs +8 -0
  81. package/dist/wasm/build/swisseph.node-TDPYTBSS.mjs.map +1 -0
  82. package/package.json +4 -2
  83. package/dist/chunk-3JMY4U4S.mjs.map +0 -1
  84. package/dist/chunk-3QN5V3DP.js +0 -4737
  85. package/dist/chunk-3QN5V3DP.js.map +0 -1
  86. package/dist/chunk-6LZOAU6E.js.map +0 -1
  87. package/dist/chunk-7OWGGDRF.js.map +0 -1
  88. package/dist/chunk-BKFHIKFY.js.map +0 -1
  89. package/dist/chunk-IT7GZ337.mjs +0 -4679
  90. package/dist/chunk-IT7GZ337.mjs.map +0 -1
  91. package/dist/chunk-J5Y325TG.mjs.map +0 -1
  92. package/dist/chunk-JY4QC6FR.js +0 -2214
  93. package/dist/chunk-JY4QC6FR.js.map +0 -1
  94. package/dist/chunk-MWLSSRHL.mjs.map +0 -1
  95. package/dist/chunk-RUE6NTVT.mjs +0 -2211
  96. package/dist/chunk-RUE6NTVT.mjs.map +0 -1
  97. package/dist/chunk-WP5MRAYG.mjs.map +0 -1
  98. package/dist/chunk-WRF3EORB.js.map +0 -1
  99. package/dist/swisseph.node-53QCJWTI.mjs +0 -3471
  100. package/dist/swisseph.node-53QCJWTI.mjs.map +0 -1
  101. package/dist/swisseph.node-CGBZTQ5N.js +0 -3473
  102. package/dist/swisseph.node-CGBZTQ5N.js.map +0 -1
  103. package/dist/swisseph.node-GPVFDOB6.wasm +0 -0
  104. package/dist/wasm/build/swisseph.node-53QCJWTI.mjs +0 -3471
  105. package/dist/wasm/build/swisseph.node-53QCJWTI.mjs.map +0 -1
  106. package/dist/wasm/build/swisseph.node-CGBZTQ5N.js +0 -3473
  107. package/dist/wasm/build/swisseph.node-CGBZTQ5N.js.map +0 -1
  108. package/dist/wasm/build/swisseph.node-GPVFDOB6.wasm +0 -0
  109. /package/dist/{chunk-PBBF5DKC.js.map → chunk-6SBCBVTZ.js.map} +0 -0
  110. /package/dist/{chunk-2IC6H3FI.js.map → chunk-DK2VS36Z.mjs.map} +0 -0
  111. /package/dist/{chunk-7JWBIAUF.mjs.map → chunk-E353GPHE.js.map} +0 -0
  112. /package/dist/{chunk-Z3JZ5DZN.mjs.map → chunk-IZBM4CPN.mjs.map} +0 -0
  113. /package/dist/{chunk-HEZCZXQC.js.map → chunk-NS5AXNEW.mjs.map} +0 -0
  114. /package/dist/{chunk-UO2RQQZO.mjs.map → chunk-YVLKVB6W.js.map} +0 -0
@@ -1,4 +1,5 @@
1
- import { calculateGematria } from './chunk-Z3JZ5DZN.mjs';
1
+ import { normalizeBirth, NumerologyScheduleError, resolveCivilDate, daysInMonth, MAX_CANDIDATE_DATES, isLeapYear, getNumerologySnapshot, fmt, mapDatePartsToBlocksOfTwo, parseDate, reduceToSingleWithSteps, reduceToSingle, compareCivilDates, completedYears, anniversaryInYear, addCivilDays, diffCivilDays, calculateKaabalisticLifePath, civilDateFromLocalDate, civilDateToLocalNoon, unavailable } from './chunk-4WVN4RMM.mjs';
2
+ import { calculateGematria } from './chunk-IZBM4CPN.mjs';
2
3
  import { freezeTextData } from './chunk-W2N7STO3.mjs';
3
4
  import { __export } from './chunk-NPQZ2DOY.mjs';
4
5
 
@@ -924,146 +925,193 @@ function getNumerologyData(language) {
924
925
  return language?.startsWith("pt") ? NUMEROLOGY_TEXT_DATA.pt : NUMEROLOGY_TEXT_DATA.en;
925
926
  }
926
927
 
927
- // src/numerology/index.ts
928
- function parseDate(date) {
929
- if (!date) {
930
- throw new Error("Date is required");
931
- }
932
- if (!(date instanceof Date)) {
933
- throw new Error("Date must be a Date object");
934
- }
935
- if (Number.isNaN(date.getTime())) {
936
- throw new Error("Date must be a valid Date object");
928
+ // src/numerology/partial-date.ts
929
+ function describePartialBirthDate(birth) {
930
+ const n = normalizeBirth(birth);
931
+ switch (n.kind) {
932
+ case "full":
933
+ return {
934
+ kind: "full",
935
+ computable: [
936
+ "personalYear",
937
+ "personalMonths",
938
+ "personalPeriods(1,2)",
939
+ "personalPeriods(3: needs first name)",
940
+ "heptads",
941
+ "ageCycles",
942
+ "fibonacci",
943
+ "lifePath",
944
+ "calendarFrame",
945
+ "pinnacles",
946
+ "challenges",
947
+ "lifePeriods"
948
+ ],
949
+ unavailable: []
950
+ };
951
+ case "month-day":
952
+ return {
953
+ kind: "month-day",
954
+ computable: ["personalYear", "personalMonths", "personalPeriods(3: needs first name)", "heptads", "calendarFrame"],
955
+ unavailable: [
956
+ "completedAge",
957
+ "personalPeriods(1)",
958
+ "personalPeriods(2)",
959
+ "ageCycles",
960
+ "fibonacci",
961
+ "lifePath",
962
+ "pinnacles",
963
+ "challenges",
964
+ "lifePeriods"
965
+ ].map((field) => ({
966
+ field,
967
+ reason: "birth-year-unknown",
968
+ detail: "The birth year is not known; nothing is guessed."
969
+ }))
970
+ };
971
+ case "year-month":
972
+ case "year": {
973
+ const reason = n.kind === "year" && n.approximate ? "birth-year-approximate" : "birth-day-or-month-unknown";
974
+ const detail = n.kind === "year-month" ? "Birth day unknown: use summarizeBirthDateCandidates for invariants and possible values." : n.approximate ? "Approximate year only: no day/month and no exact age." : "Only the birth year is known: use summarizeBirthDateCandidates for invariants and possible values.";
975
+ return {
976
+ kind: n.kind,
977
+ computable: n.kind === "year" && n.approximate ? ["firstNameSoulNumber"] : ["firstNameSoulNumber", "completedAgeRange", "candidateSummary"],
978
+ unavailable: [
979
+ "personalYear",
980
+ "personalMonths",
981
+ "personalPeriods",
982
+ "heptads",
983
+ "ageCycles",
984
+ "fibonacci",
985
+ "lifePath",
986
+ "calendarFrame",
987
+ "pinnacles",
988
+ "challenges",
989
+ "lifePeriods"
990
+ ].map((field) => ({ field, reason, detail }))
991
+ };
992
+ }
993
+ default:
994
+ return {
995
+ kind: "unknown",
996
+ computable: ["firstNameSoulNumber"],
997
+ unavailable: [
998
+ "personalYear",
999
+ "personalMonths",
1000
+ "personalPeriods",
1001
+ "heptads",
1002
+ "ageCycles",
1003
+ "fibonacci",
1004
+ "lifePath",
1005
+ "calendarFrame",
1006
+ "pinnacles",
1007
+ "challenges",
1008
+ "lifePeriods"
1009
+ ].map((field) => ({ field, reason: "birth-date-unknown", detail: "No birth date information." }))
1010
+ };
937
1011
  }
938
- return {
939
- day: String(date.getDate()).padStart(2, "0"),
940
- month: String(date.getMonth() + 1).padStart(2, "0"),
941
- year: String(date.getFullYear()).padStart(4, "0")
942
- };
943
1012
  }
944
- function mapDatePartsToBlocksOfTwo({
945
- day,
946
- month,
947
- year
948
- }) {
949
- return {
950
- day: day.padStart(2, "0"),
951
- month: month.padStart(2, "0"),
952
- year1: year.slice(0, 2),
953
- year2: year.slice(2)
954
- };
955
- }
956
- function digitSum(n) {
957
- let s = 0;
958
- for (const ch of String(Math.abs(n))) {
959
- s += ch.charCodeAt(0) - 48;
960
- }
961
- return s;
1013
+ function periodValue(p) {
1014
+ return p && p.value.available ? p.value.value : null;
962
1015
  }
963
- var MASTER_NUMBERS = [11, 22, 33, 44];
964
- function isMasterNumber(n) {
965
- return MASTER_NUMBERS.includes(n);
1016
+ function fieldsOf(s) {
1017
+ const f = {
1018
+ completedAge: s.completedAge,
1019
+ lastBirthdayYear: s.lastBirthdayYear,
1020
+ personalYear: s.birthdayYear?.personalYear.value ?? null,
1021
+ kaabalisticLifePath: s.fixedNumbers.lifePath.available ? s.fixedNumbers.lifePath.value : null,
1022
+ firstNameSoulNumber: s.fixedNumbers.firstNameSoulNumber.available ? s.fixedNumbers.firstNameSoulNumber.value : null,
1023
+ personalMonthPhase: s.personalMonth?.phase ?? null,
1024
+ personalMonthValue: s.personalMonth?.value.value ?? null,
1025
+ personalPeriodPhase: s.personalPeriod?.phase ?? null,
1026
+ personalPeriodValue: periodValue(s.personalPeriod),
1027
+ heptadPhase: s.heptad?.phase ?? null,
1028
+ dayInHeptad: s.heptad?.dayInHeptad ?? null,
1029
+ ageCycleLabel: s.ageCycle?.label ?? null,
1030
+ ageCycleBlockIndex: s.ageCycle?.absoluteIndex ?? null,
1031
+ yearInSevenYearBlock: s.ageCycle?.yearPosition ?? null,
1032
+ calendarPersonalYear: s.calendar?.personalYear.value ?? null,
1033
+ calendarPersonalMonth: s.calendar?.personalMonth.value ?? null,
1034
+ calendarPersonalDay: s.calendar?.personalDay.value ?? null,
1035
+ mainChallenge: s.lifeStages?.mainChallenge ?? null,
1036
+ pinnacle: s.lifeStages?.pinnacle?.value.value ?? null
1037
+ };
1038
+ for (const c of s.fibonacci?.cycles ?? [])
1039
+ f[`fibonacciCycle${c.phase}`] = c.value;
1040
+ return f;
966
1041
  }
967
- function reduceToSingle(n, options = { preserveMasters: false }) {
968
- if (n === 0) {
969
- return 0;
970
- }
971
- let reduced = n;
972
- while (reduced > 9) {
973
- if (options?.preserveMasters && isMasterNumber(reduced)) {
974
- break;
975
- }
976
- reduced = digitSum(reduced);
1042
+ function summarizeBirthDateCandidates(input) {
1043
+ const birth = normalizeBirth(input.birth);
1044
+ if (birth.kind !== "year-month" && !(birth.kind === "year" && !birth.approximate)) {
1045
+ throw new NumerologyScheduleError(
1046
+ "INVALID_ARGUMENT",
1047
+ "Candidate summaries need a year-month or an exact (non-approximate) year"
1048
+ );
977
1049
  }
978
- return reduced;
979
- }
980
- function reduceToSingleWithSteps(n, options = { preserveMasters: false }) {
981
- const steps = [n];
982
- if (n === 0) {
983
- return {
984
- reducedValue: 0,
985
- reductionSteps: steps
986
- };
1050
+ const asOf = resolveCivilDate(input.asOf, "asOf");
1051
+ const dates = [];
1052
+ const months = birth.kind === "year-month" ? [birth.month] : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
1053
+ for (const month of months) {
1054
+ for (let day = 1; day <= daysInMonth(birth.year, month); day++)
1055
+ dates.push({ year: birth.year, month, day });
987
1056
  }
988
- let reduced = n;
989
- while (reduced > 9) {
990
- if (options?.preserveMasters && isMasterNumber(reduced)) {
991
- break;
992
- }
993
- reduced = digitSum(reduced);
994
- steps.push(reduced);
1057
+ if (dates.length > MAX_CANDIDATE_DATES || birth.kind === "year" && dates.length !== (isLeapYear(birth.year) ? 366 : 365)) {
1058
+ throw new NumerologyScheduleError("RANGE_TOO_LARGE", "Too many candidate dates");
995
1059
  }
996
- return {
997
- reducedValue: reduced,
998
- reductionSteps: steps
1060
+ const { birth: _ignored, asOf: _asOf, ...options } = input;
1061
+ const collected = {};
1062
+ const boundaries = {};
1063
+ let after = 0;
1064
+ const add = (name, value) => (collected[name] ?? (collected[name] = [])).push(value);
1065
+ const addBoundary = (name, iv) => {
1066
+ if (!iv || iv.endExclusive === null)
1067
+ return;
1068
+ const b = boundaries[name] ?? (boundaries[name] = { starts: [], ends: [] });
1069
+ b.starts.push(iv.start);
1070
+ b.ends.push(iv.endExclusive);
999
1071
  };
1000
- }
1001
- function reduceBlock(block) {
1002
- const n = [...block].reduce(
1003
- (acc, curr) => acc + (curr.charCodeAt(0) - 48),
1004
- 0
1005
- );
1006
- if (n === 0) {
1007
- return 0;
1072
+ for (const date of dates) {
1073
+ const snap = getNumerologySnapshot({ ...options, birth: { kind: "full", date }, asOf });
1074
+ if (snap.status === "before-birth") {
1075
+ after++;
1076
+ continue;
1077
+ }
1078
+ if (snap.status !== "ok")
1079
+ continue;
1080
+ for (const [k, v] of Object.entries(fieldsOf(snap)))
1081
+ add(k, v);
1082
+ addBoundary("birthdayYear", snap.birthdayYear);
1083
+ addBoundary("personalMonth", snap.personalMonth);
1084
+ addBoundary("personalPeriod", snap.personalPeriod);
1085
+ addBoundary("heptad", snap.heptad);
1086
+ addBoundary("ageCycle", snap.ageCycle);
1008
1087
  }
1009
- return reduceToSingle(n);
1010
- }
1011
- function calculateKaabalisticLifePath(birthDate) {
1012
- const { day, month, year1, year2 } = mapDatePartsToBlocksOfTwo(
1013
- parseDate(birthDate)
1014
- );
1015
- const reducedDay = reduceBlock(day);
1016
- const reducedMonth = reduceBlock(month);
1017
- const reducedYear1 = reduceBlock(year1);
1018
- const reducedYear2 = reduceBlock(year2);
1019
- const dayMonthSynthesis = parseInt(`${reducedDay}${reducedMonth}`, 10);
1020
- const yearSynthesis = parseInt(`${reducedYear1}${reducedYear2}`, 10);
1021
- const reducedDayMonthSynthesis = reduceToSingle(dayMonthSynthesis);
1022
- const reducedYearSynthesis = reduceToSingle(yearSynthesis);
1023
- const finalSynthesis = parseInt(
1024
- `${reducedDayMonthSynthesis}${reducedYearSynthesis}`,
1025
- 10
1026
- );
1027
- const lifePath = reduceToSingleWithSteps(finalSynthesis, { preserveMasters: true });
1028
- const isMasterLifePath = isMasterNumber(lifePath.reducedValue);
1029
- const personalMythologyNumbers = [
1030
- parseInt(`${dayMonthSynthesis}${yearSynthesis}`, 10),
1031
- finalSynthesis
1032
- ];
1033
- if (finalSynthesis !== lifePath.reducedValue) {
1034
- personalMythologyNumbers.push(lifePath.reducedValue);
1088
+ const fields = {};
1089
+ for (const [name, values] of Object.entries(collected)) {
1090
+ const distinct = [...new Set(values)].sort((a, b) => a === null ? 1 : b === null ? -1 : a - b);
1091
+ fields[name] = { invariant: distinct.length === 1, value: distinct.length === 1 ? distinct[0] : null, possibleValues: distinct };
1035
1092
  }
1036
- const reducedLifePath = reduceToSingle(lifePath.reducedValue);
1037
- if (isMasterLifePath) {
1038
- personalMythologyNumbers.push(reducedLifePath);
1093
+ const ranges = {};
1094
+ for (const [name, b] of Object.entries(boundaries)) {
1095
+ const s = [...b.starts].sort();
1096
+ const e = [...b.ends].sort();
1097
+ ranges[name] = {
1098
+ start: { min: s[0], max: s[s.length - 1], invariant: s[0] === s[s.length - 1] },
1099
+ endExclusive: { min: e[0], max: e[e.length - 1], invariant: e[0] === e[e.length - 1] }
1100
+ };
1039
1101
  }
1040
1102
  return {
1041
- parts: { day, month, year1, year2 },
1042
- reducedParts: { reducedDay, reducedMonth, reducedYear1, reducedYear2 },
1043
- syntheses: {
1044
- dayMonthSynthesis,
1045
- yearSynthesis,
1046
- reducedDayMonthSynthesis,
1047
- reducedYearSynthesis,
1048
- finalSynthesis
1049
- },
1050
- lifePath,
1051
- personalMythologyNumbers
1052
- };
1053
- }
1054
- function calculateStraightAcrossReductionLifePath(birthDate) {
1055
- const { day, month, year } = parseDate(birthDate);
1056
- const result = reduceToSingleWithSteps(
1057
- parseInt(`${day}${month}${year}`, 10),
1058
- { preserveMasters: true }
1059
- );
1060
- return {
1061
- dayEnergy: reduceToSingleWithSteps(parseInt(day, 10), { preserveMasters: true }),
1062
- monthEnergy: reduceToSingleWithSteps(parseInt(month, 10), { preserveMasters: true }),
1063
- yearEnergy: reduceToSingleWithSteps(parseInt(year, 10), { preserveMasters: true }),
1064
- lifePath: result
1103
+ asOf: fmt(asOf),
1104
+ birth: birth.kind === "year-month" ? { kind: "year-month", year: birth.year, month: birth.month } : { kind: "year", year: birth.year },
1105
+ candidateCount: dates.length,
1106
+ candidatesBornAfterAsOf: after,
1107
+ selectedDate: null,
1108
+ fields,
1109
+ intervalBoundaryRanges: ranges,
1110
+ note: "Aggregates over every valid day of the known period. No birth date is selected or implied; the actual day is unknown."
1065
1111
  };
1066
1112
  }
1113
+
1114
+ // src/numerology/index.ts
1067
1115
  function getDateEnergies(birthDate) {
1068
1116
  const { day, month, year1, year2 } = mapDatePartsToBlocksOfTwo(
1069
1117
  parseDate(birthDate)
@@ -1100,19 +1148,18 @@ function calculateChallenges(birthDate) {
1100
1148
  subChallenge2
1101
1149
  };
1102
1150
  }
1103
- function addDays(date, days) {
1104
- const result = new Date(date);
1105
- result.setDate(result.getDate() + days);
1151
+ function toCivil(date) {
1152
+ parseDate(date);
1153
+ return civilDateFromLocalDate(date);
1154
+ }
1155
+ function civilToLocalMidnight(date) {
1156
+ const result = civilDateToLocalNoon(date);
1157
+ result.setHours(0, 0, 0, 0);
1106
1158
  return result;
1107
1159
  }
1108
- function getMostRecentStartDate(startDate, today) {
1109
- const startMonth = startDate.getMonth();
1110
- const startDay = startDate.getDate();
1111
- let recentStart = new Date(today.getFullYear(), startMonth, startDay);
1112
- if (recentStart > today) {
1113
- recentStart = new Date(today.getFullYear() - 1, startMonth, startDay);
1114
- }
1115
- return recentStart;
1160
+ function lastBirthdayCivil(birth, today) {
1161
+ const thisYear = anniversaryInYear(birth, today.year);
1162
+ return compareCivilDates(thisYear, today) <= 0 ? thisYear : anniversaryInYear(birth, today.year - 1);
1116
1163
  }
1117
1164
  function numberToHeptadCycle(number) {
1118
1165
  if (number < 1 || number > 7) {
@@ -1121,82 +1168,71 @@ function numberToHeptadCycle(number) {
1121
1168
  return number;
1122
1169
  }
1123
1170
  function calculateCycles(startDate, today) {
1124
- const mostRecentStart = getMostRecentStartDate(startDate, today);
1171
+ const birth = toCivil(startDate);
1172
+ const now = toCivil(today);
1173
+ const mostRecentStart = lastBirthdayCivil(birth, now);
1125
1174
  const cycleLength = 52;
1126
- const isFutureDate = startDate > today;
1175
+ const isFutureDate = compareCivilDates(birth, now) > 0;
1127
1176
  let currentYearlyCycle = null;
1128
1177
  let currentAgeCycle = null;
1178
+ let currentAgeBlockIndex = null;
1129
1179
  const ageCycles = [];
1130
1180
  const yearlyCycles = [];
1131
1181
  if (!isFutureDate) {
1132
- const birthYear = startDate.getFullYear();
1133
- const currentYear = today.getFullYear();
1134
- const ageInYears = currentYear - birthYear;
1135
- currentAgeCycle = Math.floor(ageInYears / 7) % 7 + 1;
1182
+ const completedAge = completedYears(birth, now);
1183
+ const block = Math.floor(completedAge / 7);
1184
+ currentAgeBlockIndex = block;
1185
+ currentAgeCycle = block % 7 + 1;
1186
+ currentYearlyCycle = completedAge % 7 + 1;
1187
+ const windowFirstBlock = Math.floor(block / 7) * 7;
1136
1188
  for (let i = 0; i < 7; i++) {
1137
- const cycleStart = new Date(
1138
- birthYear + i * 7,
1139
- startDate.getMonth(),
1140
- startDate.getDate()
1141
- );
1189
+ const absoluteIndex = windowFirstBlock + i;
1142
1190
  const cycle = i + 1;
1143
- const isCurrentCycle = cycle === currentAgeCycle;
1144
- if (isCurrentCycle) {
1145
- const yearsSinceBirth = ageInYears;
1146
- const yearWithinAgeCycle = yearsSinceBirth % 7;
1147
- currentYearlyCycle = yearWithinAgeCycle + 1;
1148
- for (let j = 0; j < 7; j++) {
1149
- const ageCycleStartYear = birthYear + Math.floor(ageInYears / 7) * 7;
1150
- const yearlyCycleStart = new Date(
1151
- ageCycleStartYear + j,
1152
- startDate.getMonth(),
1153
- startDate.getDate()
1154
- );
1155
- const yearlyCycle = j + 1;
1156
- const isCurrentYearlyCycle = yearlyCycle === currentYearlyCycle;
1157
- yearlyCycles.push({
1158
- number: yearlyCycle,
1159
- description: CYCLE_MEANINGS[numberToHeptadCycle(yearlyCycle)],
1160
- isActive: isCurrentYearlyCycle,
1161
- cycleStart: yearlyCycleStart
1162
- });
1163
- }
1164
- }
1165
1191
  ageCycles.push({
1166
1192
  number: cycle,
1167
1193
  description: CYCLE_MEANINGS[numberToHeptadCycle(cycle)],
1168
- isActive: isCurrentCycle,
1169
- cycleStart
1194
+ isActive: cycle === currentAgeCycle,
1195
+ cycleStart: civilToLocalMidnight(
1196
+ anniversaryInYear(birth, birth.year + absoluteIndex * 7)
1197
+ ),
1198
+ absoluteIndex
1199
+ });
1200
+ }
1201
+ for (let j = 0; j < 7; j++) {
1202
+ const yearlyCycle = j + 1;
1203
+ yearlyCycles.push({
1204
+ number: yearlyCycle,
1205
+ description: CYCLE_MEANINGS[numberToHeptadCycle(yearlyCycle)],
1206
+ isActive: yearlyCycle === currentYearlyCycle,
1207
+ cycleStart: civilToLocalMidnight(
1208
+ anniversaryInYear(birth, birth.year + block * 7 + j)
1209
+ )
1170
1210
  });
1171
1211
  }
1172
1212
  }
1173
1213
  const monthlyCycles = [];
1174
1214
  for (let i = 0; i < 7; i++) {
1175
- const cycleStart = addDays(mostRecentStart, i * cycleLength);
1176
1215
  monthlyCycles.push({
1177
1216
  number: i + 1,
1178
1217
  description: CYCLE_MEANINGS[numberToHeptadCycle(i + 1)],
1179
1218
  isActive: false,
1180
- cycleStart
1219
+ cycleStart: civilToLocalMidnight(addCivilDays(mostRecentStart, i * cycleLength))
1181
1220
  });
1182
1221
  }
1222
+ const nextAnniversary = anniversaryInYear(birth, mostRecentStart.year + 1);
1223
+ const daysSinceStart = diffCivilDays(mostRecentStart, now);
1183
1224
  let currentMonthlyCycle = null;
1184
1225
  let daysInMonthlyCycle = 0;
1185
1226
  for (let i = 0; i < 7; i++) {
1186
- const cycleStart = addDays(mostRecentStart, i * cycleLength);
1187
- const nextCycleStart = i < 6 ? addDays(mostRecentStart, (i + 1) * cycleLength) : addDays(mostRecentStart, 366);
1188
- if (today >= cycleStart && today < nextCycleStart) {
1227
+ const startOffset = i * cycleLength;
1228
+ const endOffset = i < 6 ? (i + 1) * cycleLength : diffCivilDays(mostRecentStart, nextAnniversary);
1229
+ if (daysSinceStart >= startOffset && daysSinceStart < endOffset) {
1189
1230
  currentMonthlyCycle = i + 1;
1190
- daysInMonthlyCycle = Math.floor(
1191
- (today.getTime() - cycleStart.getTime()) / (1e3 * 60 * 60 * 24)
1192
- ) + 1;
1231
+ daysInMonthlyCycle = daysSinceStart - startOffset + 1;
1193
1232
  monthlyCycles[i].isActive = true;
1194
1233
  break;
1195
1234
  }
1196
1235
  }
1197
- const totalDays = Math.floor(
1198
- (today.getTime() - mostRecentStart.getTime()) / (1e3 * 60 * 60 * 24)
1199
- ) + 1;
1200
1236
  return {
1201
1237
  yearlyCycles,
1202
1238
  ageCycles,
@@ -1205,14 +1241,17 @@ function calculateCycles(startDate, today) {
1205
1241
  currentAgeCycle,
1206
1242
  currentMonthlyCycle,
1207
1243
  daysInMonthlyCycle,
1208
- totalDays
1244
+ totalDays: daysSinceStart + 1,
1245
+ currentAgeBlockIndex
1209
1246
  };
1210
1247
  }
1211
1248
  function calculateAge(birthDate, today = /* @__PURE__ */ new Date()) {
1212
- return today.getFullYear() - birthDate.getFullYear();
1249
+ return completedYears(toCivil(birthDate), toCivil(today));
1213
1250
  }
1214
1251
  function calculateFibonacciCycle(birthDate, today) {
1215
- const currentAge = calculateAge(birthDate, today);
1252
+ return fibonacciFromAge(calculateAge(birthDate, today));
1253
+ }
1254
+ function fibonacciFromAge(currentAge) {
1216
1255
  const cycle1 = reduceToSingleWithSteps(currentAge);
1217
1256
  const cycle2 = reduceToSingleWithSteps(cycle1.reducedValue + 2);
1218
1257
  const cycle3 = reduceToSingleWithSteps(
@@ -1242,7 +1281,13 @@ function calculateFibonacciCycle(birthDate, today) {
1242
1281
  };
1243
1282
  }
1244
1283
  function calculateSoulNumber(firstName) {
1284
+ if (typeof firstName !== "string" || firstName.trim() === "") {
1285
+ return unavailable("first-name-missing", "No first name supplied; the soul number (personal period 3) is not computed.");
1286
+ }
1245
1287
  const vowels = calculateGematria(firstName).vowels;
1288
+ if (vowels.originalSum === 0 || vowels.finalValue === 0) {
1289
+ return unavailable("first-name-has-no-vowels", "The supplied name has no vowels recognised by the gematria mapping; soul number not computed.");
1290
+ }
1246
1291
  return {
1247
1292
  reducedValue: vowels.finalValue,
1248
1293
  reductionSteps: vowels.reductionSteps
@@ -1252,17 +1297,9 @@ function wrapMonth(month) {
1252
1297
  const wrappedMonth = ((month - 1) % 12 + 12) % 12;
1253
1298
  return wrappedMonth + 1;
1254
1299
  }
1255
- function getLastBirthdayYear(birthDate, today) {
1256
- const thisYearsBirthday = new Date(
1257
- today.getFullYear(),
1258
- birthDate.getMonth(),
1259
- birthDate.getDate()
1260
- );
1261
- return today >= thisYearsBirthday ? today.getFullYear() : today.getFullYear() - 1;
1262
- }
1263
1300
  function calculatePersonalYear(birthDate, today = /* @__PURE__ */ new Date()) {
1264
1301
  const { day, month } = parseDate(birthDate);
1265
- const yearToUse = getLastBirthdayYear(birthDate, today);
1302
+ const yearToUse = lastBirthdayCivil(toCivil(birthDate), toCivil(today)).year;
1266
1303
  return reduceToSingleWithSteps(
1267
1304
  parseInt(day, 10) + parseInt(month, 10) + yearToUse,
1268
1305
  { preserveMasters: true }
@@ -1289,18 +1326,17 @@ function calculatePersonalPeriods(birthDate, yearToUse, lifePath, soulNumber, cu
1289
1326
  {
1290
1327
  startMonth: wrapMonth(birthMonth + 8),
1291
1328
  endMonth: wrapMonth(birthMonth + 11),
1292
- value: reduceToSingleWithSteps(yearToUse + soulNumber, {
1293
- preserveMasters: true
1294
- })
1329
+ value: typeof soulNumber === "number" ? reduceToSingleWithSteps(yearToUse + soulNumber, { preserveMasters: true }) : soulNumber
1295
1330
  }
1296
1331
  ];
1297
1332
  return periods;
1298
1333
  }
1299
1334
  function diffInPersonalMonths(birthDate, today) {
1300
- const lastYear = getLastBirthdayYear(birthDate, today);
1301
- const base = new Date(lastYear, birthDate.getMonth(), birthDate.getDate());
1302
- let k = (today.getFullYear() - base.getFullYear()) * 12 + (today.getMonth() - base.getMonth());
1303
- if (today.getDate() < birthDate.getDate()) {
1335
+ const birth = toCivil(birthDate);
1336
+ const now = toCivil(today);
1337
+ const lastYear = lastBirthdayCivil(birth, now).year;
1338
+ let k = (now.year - lastYear) * 12 + (now.month - birth.month);
1339
+ if (now.day < birth.day) {
1304
1340
  k -= 1;
1305
1341
  }
1306
1342
  if (k < 0)
@@ -1327,19 +1363,17 @@ function calculatePersonalMonths(birthDate, personalYear, today) {
1327
1363
  };
1328
1364
  }
1329
1365
  function calculatePersonalCycles(birthDate, today = /* @__PURE__ */ new Date(), firstName) {
1330
- const yearToUse = getLastBirthdayYear(birthDate, today);
1366
+ const birth = toCivil(birthDate);
1367
+ const yearToUse = lastBirthdayCivil(birth, toCivil(today)).year;
1331
1368
  const personalYear = calculatePersonalYear(birthDate, today);
1332
- const currentAge = calculateAge(
1333
- birthDate,
1334
- new Date(yearToUse, today.getMonth(), today.getDate())
1335
- );
1369
+ const currentAge = yearToUse - birth.year;
1336
1370
  const { lifePath } = calculateKaabalisticLifePath(birthDate);
1337
1371
  const soulNumber = calculateSoulNumber(firstName);
1338
1372
  const personalPeriods = calculatePersonalPeriods(
1339
1373
  birthDate,
1340
1374
  yearToUse,
1341
1375
  lifePath.reducedValue,
1342
- soulNumber.reducedValue,
1376
+ soulNumber.reducedValue === void 0 ? soulNumber : soulNumber.reducedValue,
1343
1377
  currentAge
1344
1378
  );
1345
1379
  const { personalMonths, currentPersonalMonthIndex: currentPersonalMonth } = calculatePersonalMonths(birthDate, personalYear, today);
@@ -1359,6 +1393,6 @@ function calculatePersonalCycles(birthDate, today = /* @__PURE__ */ new Date(),
1359
1393
  };
1360
1394
  }
1361
1395
 
1362
- export { MASTER_NUMBERS, NUMEROLOGY_TEXT_DATA, calculateChallenges, calculateCycles, calculateFibonacciCycle, calculateKaabalisticLifePath, calculatePersonalCycles, calculatePersonalMonths, calculatePersonalPeriods, calculatePersonalYear, calculateStraightAcrossReductionLifePath, data_exports, getDateEnergies, getNumerologyData, isMasterNumber, reduceToSingle, reduceToSingleWithSteps };
1396
+ export { NUMEROLOGY_TEXT_DATA, calculateChallenges, calculateCycles, calculateFibonacciCycle, calculatePersonalCycles, calculatePersonalMonths, calculatePersonalPeriods, calculatePersonalYear, data_exports, describePartialBirthDate, fibonacciFromAge, getDateEnergies, getNumerologyData, summarizeBirthDateCandidates };
1363
1397
  //# sourceMappingURL=out.js.map
1364
- //# sourceMappingURL=chunk-3JMY4U4S.mjs.map
1398
+ //# sourceMappingURL=chunk-DBRPCQRR.mjs.map