@zodiacs/engine 0.1.1-rc.16 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +1478 -0
  2. package/LICENSING.md +184 -30
  3. package/NOTICE +81 -14
  4. package/README.md +345 -67
  5. package/dist/{api-VOW6Umy5.d.ts → api-ChL1N2Sr.d.ts} +44 -7
  6. package/dist/ayanamsa-ClFzkKmV.d.ts +135 -0
  7. package/dist/calc.d.ts +218 -21
  8. package/dist/calc.js +580 -160
  9. package/dist/chunk-2PZYJQV5.js +83 -0
  10. package/dist/chunk-47ERTK5X.js +27 -0
  11. package/dist/{chunk-O3NJRGJ2.js → chunk-4XOYTBLS.js} +1 -1
  12. package/dist/chunk-767FTO7O.js +48 -0
  13. package/dist/{chunk-N4B5JNMA.js → chunk-7Y2F2IWN.js} +40 -28
  14. package/dist/chunk-B4M2Y7FT.js +96 -0
  15. package/dist/{chunk-KHBLFXFG.js → chunk-B5LKF437.js} +29 -28
  16. package/dist/{chunk-ONBZ4HK7.js → chunk-BHJXUY67.js} +4 -2
  17. package/dist/{chunk-PFGUCNOK.js → chunk-BMDASNPB.js} +6 -6
  18. package/dist/chunk-I3L4POY7.js +18 -0
  19. package/dist/{chunk-I7O5EGFV.js → chunk-LNGURVNH.js} +3 -3
  20. package/dist/{chunk-4NV4ZEFZ.js → chunk-NNOSOOWS.js} +4 -4
  21. package/dist/chunk-OVXQQEXL.js +41 -0
  22. package/dist/{chunk-WOU7JVD3.js → chunk-QLIEEICB.js} +205 -194
  23. package/dist/chunk-RMBWKZI2.js +130 -0
  24. package/dist/{chunk-AECKV73C.js → chunk-TSS2SZWQ.js} +8 -2
  25. package/dist/{chunk-L6ZHWJZ6.js → chunk-TZVPZHZM.js} +51 -29
  26. package/dist/chunk-WBTWY2OB.js +478 -0
  27. package/dist/chunk-Y4E3WJU5.js +87 -0
  28. package/dist/chunk-YPU3MDNI.js +852 -0
  29. package/dist/conventions.d.ts +70 -0
  30. package/dist/conventions.js +26 -0
  31. package/dist/crossings.d.ts +22 -10
  32. package/dist/crossings.js +1 -1
  33. package/dist/de440-pack.d.ts +43 -0
  34. package/dist/de440-pack.js +16 -0
  35. package/dist/de440.d.ts +113 -0
  36. package/dist/de440.js +19 -0
  37. package/dist/deltat.d.ts +28 -3
  38. package/dist/deltat.js +1 -1
  39. package/dist/ephemeris-exTSqBgb.d.ts +60 -0
  40. package/dist/geo.d.ts +46 -13
  41. package/dist/geo.js +4 -2
  42. package/dist/{houses-q1O2GGp4.d.ts → houses-Bh7GCnPi.d.ts} +14 -4
  43. package/dist/houses-extra.d.ts +22 -7
  44. package/dist/houses-extra.js +4 -2
  45. package/dist/index.d.ts +36 -49
  46. package/dist/index.js +54 -34
  47. package/dist/{internal-math-CmJ9xtaW.d.ts → internal-math-CxenuGfm.d.ts} +41 -27
  48. package/dist/internal-math.d.ts +4 -3
  49. package/dist/internal-math.js +14 -12
  50. package/dist/internal.d.ts +16 -7
  51. package/dist/internal.js +27 -6
  52. package/dist/lite-composite.js +114 -0
  53. package/dist/lite-declinations.js +253 -0
  54. package/dist/lite-dignities.js +333 -0
  55. package/dist/lite-sect.js +72 -0
  56. package/dist/lite.d.ts +82 -0
  57. package/dist/lite.js +4 -0
  58. package/dist/receipt.d.ts +3 -268
  59. package/dist/receipt.js +202 -89
  60. package/dist/reference-span-CILpclrz.d.ts +40 -0
  61. package/dist/{rulers-9wljfVaO.d.ts → rulers-CSSWtiWF.d.ts} +7 -2
  62. package/dist/sky.d.ts +26 -10
  63. package/dist/sky.js +23 -14
  64. package/dist/techniques.d.ts +160 -21
  65. package/dist/techniques.js +157 -89
  66. package/dist/time-bands-CZA9AlLg.d.ts +36 -0
  67. package/dist/time-scale-DIFNa0gz.d.ts +47 -0
  68. package/dist/time.d.ts +81 -0
  69. package/dist/time.js +74 -0
  70. package/dist/timing.d.ts +55 -17
  71. package/dist/timing.js +33 -45
  72. package/dist/types-DpPdtXgO.d.ts +335 -0
  73. package/dist/vedic.d.ts +150 -123
  74. package/dist/vedic.js +398 -440
  75. package/dist/window.d.ts +102 -80
  76. package/dist/window.js +108 -51
  77. package/dist/zone-history-BxmDCcTK.d.ts +290 -0
  78. package/package.json +26 -3
  79. package/dist/chunk-2OWGBT3O.js +0 -219
  80. package/dist/types-B4MCoCCS.d.ts +0 -228
@@ -1,40 +1,47 @@
1
- import { g as AspectType, c as BodyPosition, n as Aspect, Z as ZodiacSign, u as SignDefinition } from './types-B4MCoCCS.js';
2
- import './houses-q1O2GGp4.js';
1
+ import { f as AspectType, c as BodyPosition, o as Aspect, Z as ZodiacSign, v as SignDefinition } from './types-DpPdtXgO.js';
2
+ import './houses-Bh7GCnPi.js';
3
3
 
4
4
  interface AspectDefinition {
5
- type: AspectType;
6
- angle: number;
7
- orb: number;
8
- luminaryOrb: number;
5
+ readonly type: AspectType;
6
+ readonly angle: number;
7
+ readonly orb: number;
8
+ readonly luminaryOrb: number;
9
9
  }
10
10
  declare const ASPECT_TYPES: readonly ["conjunction", "sextile", "square", "trine", "opposition"];
11
- declare const ASPECTS: readonly [{
11
+ /** The five major aspects and their orbs, frozen: matchAspect returns these objects themselves. */
12
+ declare const ASPECTS: readonly [Readonly<{
12
13
  readonly type: "conjunction";
13
14
  readonly angle: 0;
14
15
  readonly orb: 8;
15
16
  readonly luminaryOrb: 10;
16
- }, {
17
+ }>, Readonly<{
17
18
  readonly type: "sextile";
18
19
  readonly angle: 60;
19
20
  readonly orb: 4;
20
21
  readonly luminaryOrb: 5;
21
- }, {
22
+ }>, Readonly<{
22
23
  readonly type: "square";
23
24
  readonly angle: 90;
24
25
  readonly orb: 7;
25
26
  readonly luminaryOrb: 8;
26
- }, {
27
+ }>, Readonly<{
27
28
  readonly type: "trine";
28
29
  readonly angle: 120;
29
30
  readonly orb: 7;
30
31
  readonly luminaryOrb: 8;
31
- }, {
32
+ }>, Readonly<{
32
33
  readonly type: "opposition";
33
34
  readonly angle: 180;
34
35
  readonly orb: 8;
35
36
  readonly luminaryOrb: 10;
36
- }];
37
- declare const ASPECT_BODIES: Set<string>;
37
+ }>];
38
+ /**
39
+ * The bodies `findAspects`, `findInterAspects`, `elementBalance` and
40
+ * `modalityBalance` take into account: the Sun to Pluto, without the nodes.
41
+ * A copy for reading; the engine keeps its own, so changing this set changes
42
+ * nothing it computes.
43
+ */
44
+ declare const ASPECT_BODIES: ReadonlySet<string>;
38
45
  /** Whether an aspect's orb is shrinking, growing, or neither, at an instant. */
39
46
  type AspectMotion = "applying" | "separating" | "stationary";
40
47
  /**
@@ -66,95 +73,102 @@ declare function findAspects(bodies: readonly BodyPosition[]): Aspect[];
66
73
 
67
74
  declare const ELEMENTS: readonly ["fire", "earth", "air", "water"];
68
75
  declare const MODALITIES: readonly ["cardinal", "fixed", "mutable"];
69
- declare const SIGNS: readonly [{
76
+ /** The twelve signs, frozen: signForLongitude returns these objects themselves. */
77
+ declare const SIGNS: readonly [Readonly<{
70
78
  readonly slug: "aries";
71
79
  readonly name: "Aries";
72
80
  readonly element: "fire";
73
81
  readonly modality: "cardinal";
74
82
  readonly polarity: "day";
75
83
  readonly naturalHouse: 1;
76
- }, {
84
+ }>, Readonly<{
77
85
  readonly slug: "taurus";
78
86
  readonly name: "Taurus";
79
87
  readonly element: "earth";
80
88
  readonly modality: "fixed";
81
89
  readonly polarity: "night";
82
90
  readonly naturalHouse: 2;
83
- }, {
91
+ }>, Readonly<{
84
92
  readonly slug: "gemini";
85
93
  readonly name: "Gemini";
86
94
  readonly element: "air";
87
95
  readonly modality: "mutable";
88
96
  readonly polarity: "day";
89
97
  readonly naturalHouse: 3;
90
- }, {
98
+ }>, Readonly<{
91
99
  readonly slug: "cancer";
92
100
  readonly name: "Cancer";
93
101
  readonly element: "water";
94
102
  readonly modality: "cardinal";
95
103
  readonly polarity: "night";
96
104
  readonly naturalHouse: 4;
97
- }, {
105
+ }>, Readonly<{
98
106
  readonly slug: "leo";
99
107
  readonly name: "Leo";
100
108
  readonly element: "fire";
101
109
  readonly modality: "fixed";
102
110
  readonly polarity: "day";
103
111
  readonly naturalHouse: 5;
104
- }, {
112
+ }>, Readonly<{
105
113
  readonly slug: "virgo";
106
114
  readonly name: "Virgo";
107
115
  readonly element: "earth";
108
116
  readonly modality: "mutable";
109
117
  readonly polarity: "night";
110
118
  readonly naturalHouse: 6;
111
- }, {
119
+ }>, Readonly<{
112
120
  readonly slug: "libra";
113
121
  readonly name: "Libra";
114
122
  readonly element: "air";
115
123
  readonly modality: "cardinal";
116
124
  readonly polarity: "day";
117
125
  readonly naturalHouse: 7;
118
- }, {
126
+ }>, Readonly<{
119
127
  readonly slug: "scorpio";
120
128
  readonly name: "Scorpio";
121
129
  readonly element: "water";
122
130
  readonly modality: "fixed";
123
131
  readonly polarity: "night";
124
132
  readonly naturalHouse: 8;
125
- }, {
133
+ }>, Readonly<{
126
134
  readonly slug: "sagittarius";
127
135
  readonly name: "Sagittarius";
128
136
  readonly element: "fire";
129
137
  readonly modality: "mutable";
130
138
  readonly polarity: "day";
131
139
  readonly naturalHouse: 9;
132
- }, {
140
+ }>, Readonly<{
133
141
  readonly slug: "capricorn";
134
142
  readonly name: "Capricorn";
135
143
  readonly element: "earth";
136
144
  readonly modality: "cardinal";
137
145
  readonly polarity: "night";
138
146
  readonly naturalHouse: 10;
139
- }, {
147
+ }>, Readonly<{
140
148
  readonly slug: "aquarius";
141
149
  readonly name: "Aquarius";
142
150
  readonly element: "air";
143
151
  readonly modality: "fixed";
144
152
  readonly polarity: "day";
145
153
  readonly naturalHouse: 11;
146
- }, {
154
+ }>, Readonly<{
147
155
  readonly slug: "pisces";
148
156
  readonly name: "Pisces";
149
157
  readonly element: "water";
150
158
  readonly modality: "mutable";
151
159
  readonly polarity: "night";
152
160
  readonly naturalHouse: 12;
153
- }];
161
+ }>];
162
+ /** The twelve signs' slugs, "aries" to "pisces", in zodiac order. */
163
+ declare const SIGN_SLUGS: readonly ZodiacSign[];
164
+ /**
165
+ * The twelve signs' slugs, as SIGN_SLUGS.
166
+ * @deprecated It holds slugs ("aries"), not names ("Aries"); use SIGN_SLUGS.
167
+ */
154
168
  declare const SIGN_NAMES: readonly ZodiacSign[];
155
169
  declare function normalizeLongitude(lon: number): number;
156
170
  declare function signIndexForLongitude(lon: number): number;
157
171
  declare function signForLongitude(lon: number): SignDefinition;
158
172
  declare function degreeInSign(lon: number): number;
159
173
 
160
- export { ASPECTS as A, ELEMENTS as E, MODALITIES as M, SIGNS as S, ASPECT_BODIES as a, ASPECT_TYPES as b, type AspectDefinition as c, type AspectMotion as d, SIGN_NAMES as e, STATIONARY_RELATIVE_SPEED as f, aspectMotion as g, degreeInSign as h, findAspects as i, signForLongitude as j, signIndexForLongitude as k, matchAspect as m, normalizeLongitude as n, separation as s };
174
+ export { type AspectMotion as A, ELEMENTS as E, MODALITIES as M, SIGNS as S, ASPECTS as a, ASPECT_BODIES as b, ASPECT_TYPES as c, type AspectDefinition as d, SIGN_NAMES as e, SIGN_SLUGS as f, STATIONARY_RELATIVE_SPEED as g, aspectMotion as h, degreeInSign as i, findAspects as j, signForLongitude as k, signIndexForLongitude as l, matchAspect as m, normalizeLongitude as n, separation as s };
@@ -1,4 +1,5 @@
1
- export { A as ASPECTS, a as ASPECT_BODIES, b as ASPECT_TYPES, c as AspectDefinition, d as AspectMotion, f as STATIONARY_RELATIVE_SPEED, g as aspectMotion, i as findAspects, m as matchAspect, n as normalizeLongitude, s as separation } from './internal-math-CmJ9xtaW.js';
2
- export { A as AngleInput, H as HOUSE_SYSTEMS, P as PLACIDUS_POLAR_FALLBACK, a as POLAR_FALLBACK, b as POLAR_UNDEFINED_HOUSE_SYSTEMS, c as alcabitiusCusps, d as campanusCusps, e as computeAngles, f as computeHouses, g as eastPointOf, h as equalCusps, i as equalMcCusps, j as houseOf, k as isPolarUndefinedHouseSystem, l as kochCusps, m as meanObliquity, n as meridianCusps, o as morinusCusps, p as placidusCusps, q as porphyryCusps, r as ramcOf, s as regiomontanusCusps, t as topocentricCusps, v as vehlowCusps, u as vertexOf, w as wholeSignCusps } from './houses-q1O2GGp4.js';
3
- export { A as Angles, n as Aspect, g as AspectType, B as BodyName, c as BodyPosition, d as Chart, e as ChartFlag, C as ChartInput, o as ENGINE_VERSION, b as HouseNumber, H as HouseSystem, a as Houses } from './types-B4MCoCCS.js';
1
+ export { a as ASPECTS, b as ASPECT_BODIES, c as ASPECT_TYPES, d as AspectDefinition, A as AspectMotion, g as STATIONARY_RELATIVE_SPEED, h as aspectMotion, j as findAspects, m as matchAspect, n as normalizeLongitude, s as separation } from './internal-math-CxenuGfm.js';
2
+ export { A as AngleInput, H as HOUSE_SYSTEMS, P as PLACIDUS_POLAR_FALLBACK, a as POLAR_FALLBACK, b as POLAR_UNDEFINED_HOUSE_SYSTEMS, c as alcabitiusCusps, d as campanusCusps, e as computeAngles, f as computeHouses, g as eastPointOf, h as equalCusps, i as equalMcCusps, j as houseOf, k as isPolarUndefinedHouseSystem, l as kochCusps, m as meanObliquity, n as meridianCusps, o as morinusCusps, p as placidusCusps, q as porphyryCusps, r as ramcOf, s as regiomontanusCusps, t as topocentricCusps, v as vehlowCusps, u as vertexOf, w as wholeSignCusps } from './houses-Bh7GCnPi.js';
3
+ export { A as Angles, o as Aspect, f as AspectType, B as BodyName, c as BodyPosition, d as Chart, g as ChartFlag, C as ChartInput, p as ENGINE_VERSION, b as HouseNumber, H as HouseSystem, a as Houses } from './types-DpPdtXgO.js';
4
4
  import './deltat.js';
5
+ import './time-scale-DIFNa0gz.js';
@@ -1,3 +1,14 @@
1
+ import {
2
+ ASPECTS,
3
+ ASPECT_BODIES,
4
+ ASPECT_TYPES,
5
+ ENGINE_VERSION,
6
+ STATIONARY_RELATIVE_SPEED,
7
+ aspectMotion,
8
+ findAspects,
9
+ matchAspect,
10
+ separation
11
+ } from "./chunk-B4M2Y7FT.js";
1
12
  import {
2
13
  HOUSE_SYSTEMS,
3
14
  PLACIDUS_POLAR_FALLBACK,
@@ -24,19 +35,10 @@ import {
24
35
  vehlowCusps,
25
36
  vertexOf,
26
37
  wholeSignCusps
27
- } from "./chunk-4NV4ZEFZ.js";
38
+ } from "./chunk-NNOSOOWS.js";
28
39
  import {
29
- ASPECTS,
30
- ASPECT_BODIES,
31
- ASPECT_TYPES,
32
- ENGINE_VERSION,
33
- STATIONARY_RELATIVE_SPEED,
34
- aspectMotion,
35
- findAspects,
36
- matchAspect,
37
- normalizeLongitude,
38
- separation
39
- } from "./chunk-2OWGBT3O.js";
40
+ normalizeLongitude
41
+ } from "./chunk-RMBWKZI2.js";
40
42
  export {
41
43
  ASPECTS,
42
44
  ASPECT_BODIES,
@@ -1,10 +1,19 @@
1
- import { B as BodyName, c as BodyPosition, C as ChartInput, d as Chart } from './types-B4MCoCCS.js';
1
+ import { B as BodyName, D as DetailedResult } from './types-DpPdtXgO.js';
2
+ export { E as EphemerisFallback } from './types-DpPdtXgO.js';
3
+ export { b as bodyLongitude, c as computeBodies, a as computeChart, l as longitudeSpeed } from './ephemeris-exTSqBgb.js';
2
4
  import './deltat.js';
5
+ import './time-scale-DIFNa0gz.js';
3
6
 
4
- /** Apparent longitude at a UTC instant, on the engine's time basis. */
5
- declare function bodyLongitude(body: BodyName, date: Date): number;
6
- declare function longitudeSpeed(body: BodyName, date: Date): number;
7
- declare function computeBodies(date: Date): BodyPosition[];
8
- declare function computeChart(input: ChartInput): Chart;
7
+ /**
8
+ * `bodyLongitude`'s longitude as `value`, with the ephemeris it came from and
9
+ * the flag that says why that is astronomy-engine where the shipped DE440
10
+ * pack was the default (`DetailedResult`).
11
+ */
12
+ declare function bodyLongitudeDetailed(body: BodyName, date: Date): DetailedResult<number>;
13
+ /**
14
+ * `longitudeSpeed`'s speed as `value`, labelled as `bodyLongitudeDetailed`'s
15
+ * is: both samples are read on the source chosen at `date`.
16
+ */
17
+ declare function longitudeSpeedDetailed(body: BodyName, date: Date): DetailedResult<number>;
9
18
 
10
- export { bodyLongitude, computeBodies, computeChart, longitudeSpeed };
19
+ export { DetailedResult, bodyLongitudeDetailed, longitudeSpeedDetailed };
package/dist/internal.js CHANGED
@@ -2,15 +2,36 @@ import {
2
2
  bodyLongitude,
3
3
  computeBodies,
4
4
  computeChart,
5
+ ephemerisOver,
6
+ fallbacksAt,
5
7
  longitudeSpeed
6
- } from "./chunk-WOU7JVD3.js";
7
- import "./chunk-KHBLFXFG.js";
8
- import "./chunk-ONBZ4HK7.js";
9
- import "./chunk-4NV4ZEFZ.js";
10
- import "./chunk-2OWGBT3O.js";
8
+ } from "./chunk-QLIEEICB.js";
9
+ import "./chunk-B4M2Y7FT.js";
10
+ import "./chunk-2PZYJQV5.js";
11
+ import "./chunk-B5LKF437.js";
12
+ import "./chunk-767FTO7O.js";
13
+ import "./chunk-YPU3MDNI.js";
14
+ import "./chunk-Y4E3WJU5.js";
15
+ import "./chunk-NNOSOOWS.js";
16
+ import "./chunk-RMBWKZI2.js";
17
+ import "./chunk-BHJXUY67.js";
18
+
19
+ // src/internal.ts
20
+ function bodyLongitudeDetailed(body, date) {
21
+ return detailedAt(bodyLongitude(body, date), date);
22
+ }
23
+ function longitudeSpeedDetailed(body, date) {
24
+ return detailedAt(longitudeSpeed(body, date), date);
25
+ }
26
+ function detailedAt(value, date) {
27
+ const at = [date.getTime()];
28
+ return Object.freeze({ value, ephemeris: Object.freeze(ephemerisOver(at)), flags: Object.freeze(fallbacksAt(at)) });
29
+ }
11
30
  export {
12
31
  bodyLongitude,
32
+ bodyLongitudeDetailed,
13
33
  computeBodies,
14
34
  computeChart,
15
- longitudeSpeed
35
+ longitudeSpeed,
36
+ longitudeSpeedDetailed
16
37
  };
@@ -0,0 +1,114 @@
1
+ // src/aspects.ts
2
+ var ASPECTS = /* @__PURE__ */ Object.freeze([
3
+ /* @__PURE__ */ Object.freeze({ type: "conjunction", angle: 0, orb: 8, luminaryOrb: 10 }),
4
+ /* @__PURE__ */ Object.freeze({ type: "sextile", angle: 60, orb: 4, luminaryOrb: 5 }),
5
+ /* @__PURE__ */ Object.freeze({ type: "square", angle: 90, orb: 7, luminaryOrb: 8 }),
6
+ /* @__PURE__ */ Object.freeze({ type: "trine", angle: 120, orb: 7, luminaryOrb: 8 }),
7
+ /* @__PURE__ */ Object.freeze({ type: "opposition", angle: 180, orb: 8, luminaryOrb: 10 })
8
+ ]);
9
+ var LUMINARIES = /* @__PURE__ */ new Set(["Sun", "Moon"]);
10
+ var ASPECT_BODY_NAMES = /* @__PURE__ */ Object.freeze([
11
+ "Sun",
12
+ "Moon",
13
+ "Mercury",
14
+ "Venus",
15
+ "Mars",
16
+ "Jupiter",
17
+ "Saturn",
18
+ "Uranus",
19
+ "Neptune",
20
+ "Pluto"
21
+ ]);
22
+ var ASPECT_BODY_SET = /* @__PURE__ */ new Set(ASPECT_BODY_NAMES);
23
+ function separation(a, b) {
24
+ const difference = Math.abs(((a - b) % 360 + 360) % 360);
25
+ return difference > 180 ? 360 - difference : difference;
26
+ }
27
+ function matchAspect(aBody, aLongitude, bBody, bLongitude) {
28
+ const distance = separation(aLongitude, bLongitude);
29
+ const hasLuminary = LUMINARIES.has(aBody) || LUMINARIES.has(bBody);
30
+ let best = null;
31
+ for (const definition of ASPECTS) {
32
+ const orb = Math.abs(distance - definition.angle);
33
+ const maximum = hasLuminary ? definition.luminaryOrb : definition.orb;
34
+ if (orb <= maximum && (!best || orb < best.orb)) {
35
+ best = { definition, orb };
36
+ }
37
+ }
38
+ return best;
39
+ }
40
+
41
+ // src/signs.ts
42
+ function normalizeLongitude(lon) {
43
+ if (!Number.isFinite(lon)) throw new RangeError("Longitude must be finite.");
44
+ return (lon % 360 + 360) % 360;
45
+ }
46
+
47
+ // src/points.ts
48
+ var DEG = Math.PI / 180;
49
+ var RAD = 180 / Math.PI;
50
+ var ARCSEC = 1 / 3600;
51
+ function midpoint(first, second) {
52
+ const arc = normalizeLongitude(second - first);
53
+ return normalizeLongitude(first + (arc > 180 ? arc - 360 : arc) / 2);
54
+ }
55
+
56
+ // src/techniques/names.ts
57
+ var BODY_NAMES = [
58
+ "Sun",
59
+ "Moon",
60
+ "Mercury",
61
+ "Venus",
62
+ "Mars",
63
+ "Jupiter",
64
+ "Saturn",
65
+ "Uranus",
66
+ "Neptune",
67
+ "Pluto",
68
+ "North Node",
69
+ "South Node"
70
+ ];
71
+ function bodyName(value, label) {
72
+ if (typeof value === "string" && BODY_NAMES.includes(value)) return value;
73
+ throw new RangeError(`${label} must be a body name.`);
74
+ }
75
+ function finiteDegrees(value, label) {
76
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new RangeError(`${label} must be a finite number of degrees.`);
77
+ return value;
78
+ }
79
+
80
+ // src/techniques/composite.ts
81
+ function positions(list, label) {
82
+ if (!Array.isArray(list)) throw new RangeError(`${label} must be an array of { body, lon }.`);
83
+ const seen = /* @__PURE__ */ new Set();
84
+ return list.map((row) => {
85
+ const body = bodyName(row?.body, `${label}'s body`);
86
+ if (seen.has(body)) throw new RangeError(`${label} names ${body} twice.`);
87
+ seen.add(body);
88
+ return { body, lon: finiteDegrees(row?.lon, `${label}'s ${body}`) };
89
+ });
90
+ }
91
+ function compositeMidpoints(first, second) {
92
+ const b = new Map(positions(second, "second").map((row) => [row.body, row.lon]));
93
+ const out = [];
94
+ for (const row of positions(first, "first")) {
95
+ const other = b.get(row.body);
96
+ if (other !== void 0) out.push(Object.freeze({ body: row.body, lon: midpoint(row.lon, other) }));
97
+ }
98
+ return Object.freeze(out);
99
+ }
100
+ function compositeAspects(points) {
101
+ const list = positions(points, "points").filter((point) => ASPECT_BODY_SET.has(point.body));
102
+ const out = [];
103
+ list.forEach((a, i) => {
104
+ for (const b of list.slice(i + 1)) {
105
+ const match = matchAspect(a.body, a.lon, b.body, b.lon);
106
+ if (match) out.push(Object.freeze({ a: a.body, b: b.body, type: match.definition.type, orb: match.orb }));
107
+ }
108
+ });
109
+ return Object.freeze(out.sort((x, y) => x.orb - y.orb));
110
+ }
111
+ export {
112
+ compositeAspects,
113
+ compositeMidpoints
114
+ };
@@ -0,0 +1,253 @@
1
+ // src/body-label.ts
2
+ var MAX_BODY_LABEL_LENGTH = 80;
3
+ function checkedBodyLabel(value) {
4
+ if (typeof value !== "string" || value.length === 0 || value.length > MAX_BODY_LABEL_LENGTH || value.trim() !== value || /[\u0000-\u001f\u007f]/u.test(value)) {
5
+ throw new RangeError(
6
+ "Body labels must be nonempty, trimmed strings of at most 80 characters, without control characters."
7
+ );
8
+ }
9
+ return value;
10
+ }
11
+
12
+ // src/exact.ts
13
+ var SAFE_MAGNITUDE = 2 ** 1e3;
14
+ function add(partials, value) {
15
+ let x = value;
16
+ let kept = 0;
17
+ for (let index = 0; index < partials.length; index += 1) {
18
+ let y = partials[index];
19
+ if (Math.abs(x) < Math.abs(y)) {
20
+ const larger = y;
21
+ y = x;
22
+ x = larger;
23
+ }
24
+ const high = x + y;
25
+ const low = y - (high - x);
26
+ if (low !== 0) partials[kept++] = low;
27
+ x = high;
28
+ }
29
+ partials.length = kept;
30
+ if (x !== 0) partials.push(x);
31
+ }
32
+ function exactSum(...terms) {
33
+ const partials = [];
34
+ for (const term of terms) {
35
+ if (typeof term === "number") add(partials, term);
36
+ else for (const part of term) add(partials, part);
37
+ }
38
+ return partials;
39
+ }
40
+ function negated(sum) {
41
+ return sum.map((part) => -part);
42
+ }
43
+ function signOf(sum) {
44
+ const top = sum[sum.length - 1];
45
+ return top === void 0 ? 0 : top > 0 ? 1 : -1;
46
+ }
47
+ function compareExact(a, b) {
48
+ return signOf(exactSum(a, typeof b === "number" ? -b : negated(b)));
49
+ }
50
+ function absolute(sum) {
51
+ return signOf(sum) < 0 ? negated(sum) : sum;
52
+ }
53
+ function roundedValue(sum) {
54
+ let index = sum.length;
55
+ if (index === 0) return 0;
56
+ let high = sum[--index];
57
+ let low = 0;
58
+ while (index > 0) {
59
+ const x = high;
60
+ const y = sum[--index];
61
+ high = x + y;
62
+ low = y - (high - x);
63
+ if (low !== 0) break;
64
+ }
65
+ const below = index > 0 ? sum[index - 1] : 0;
66
+ if (low < 0 && below < 0 || low > 0 && below > 0) {
67
+ const twice = low * 2;
68
+ const moved = high + twice;
69
+ if (moved - high === twice) high = moved;
70
+ }
71
+ return high;
72
+ }
73
+
74
+ // src/declination.ts
75
+ var DEG = Math.PI / 180;
76
+ var RAD = 180 / Math.PI;
77
+ var DECLINATION_ORB = 1;
78
+ var DECLINATION_ORB_LUMINARY = 1.5;
79
+ var DEFAULT_DECLINATION_ORB_POLICY = /* @__PURE__ */ Object.freeze({
80
+ orb: DECLINATION_ORB,
81
+ luminaryOrb: DECLINATION_ORB_LUMINARY
82
+ });
83
+ var RA_POLE_TOLERANCE = 32 * Number.EPSILON;
84
+ var MAX_DECLINATION_BODIES = 256;
85
+ var SUN_BOUND_LATITUDE = 1e-3;
86
+ function finite(value, label) {
87
+ if (typeof value !== "number" || !Number.isFinite(value)) {
88
+ throw new RangeError(`${label} must be finite.`);
89
+ }
90
+ }
91
+ function obliquity(value) {
92
+ finite(value, "true obliquity");
93
+ if (value < 0 || value > 90) throw new RangeError("true obliquity must be in [0,90] degrees.");
94
+ }
95
+ function normalize(value) {
96
+ const remainder = value % 360;
97
+ if (remainder === 0) return 0;
98
+ return remainder > 0 ? remainder : Math.min(remainder + 360, 359.99999999999994);
99
+ }
100
+ function policyOf(policy) {
101
+ const fields = dataFields(policy, "declination orb policy");
102
+ if (Object.keys(fields).length !== 2 || !Object.hasOwn(fields, "orb") || !Object.hasOwn(fields, "luminaryOrb")) {
103
+ throw new RangeError("declination orb policy requires only orb and luminaryOrb.");
104
+ }
105
+ const checked = { orb: fields.orb.value, luminaryOrb: fields.luminaryOrb.value };
106
+ for (const key of ["orb", "luminaryOrb"]) {
107
+ finite(checked[key], `declination policy ${key}`);
108
+ if (checked[key] < 0 || checked[key] > 90) throw new RangeError("declination orbs must be in [0,90] degrees.");
109
+ }
110
+ return checked;
111
+ }
112
+ function dataFields(value, label) {
113
+ if (value === null || typeof value !== "object" || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) {
114
+ throw new RangeError(`${label} must be a plain data object.`);
115
+ }
116
+ const fields = Object.getOwnPropertyDescriptors(value);
117
+ if (Reflect.ownKeys(value).length !== Object.keys(fields).length || Object.values(fields).some((field) => !Object.hasOwn(field, "value") || !field.enumerable)) {
118
+ throw new RangeError(`${label} must contain only enumerable data properties.`);
119
+ }
120
+ return fields;
121
+ }
122
+ function bodyName(body) {
123
+ checkedBodyLabel(body);
124
+ }
125
+ function eclipticToEquatorial(longitudeDeg, latitudeDeg, trueObliquityDeg) {
126
+ finite(longitudeDeg, "ecliptic longitude");
127
+ finite(latitudeDeg, "ecliptic latitude");
128
+ if (latitudeDeg < -90 || latitudeDeg > 90) throw new RangeError("ecliptic latitude must be in [-90,90] degrees.");
129
+ obliquity(trueObliquityDeg);
130
+ const lon = normalize(longitudeDeg) * DEG;
131
+ const lat = latitudeDeg * DEG;
132
+ const tilt = trueObliquityDeg * DEG;
133
+ const cosLat = Math.cos(lat);
134
+ const x = cosLat * Math.cos(lon);
135
+ const y = cosLat * Math.sin(lon) * Math.cos(tilt) - Math.sin(lat) * Math.sin(tilt);
136
+ const z = cosLat * Math.sin(lon) * Math.sin(tilt) + Math.sin(lat) * Math.cos(tilt);
137
+ const horizontal = Math.hypot(x, y);
138
+ const raDefined = horizontal > RA_POLE_TOLERANCE;
139
+ let dec = trueObliquityDeg === 0 ? latitudeDeg : Math.atan2(z, horizontal) * RAD;
140
+ if (latitudeDeg === 0) dec = Math.max(-trueObliquityDeg, Math.min(trueObliquityDeg, dec));
141
+ return {
142
+ ra: raDefined ? trueObliquityDeg === 0 ? normalize(longitudeDeg) : normalize(Math.atan2(y, x) * RAD) : null,
143
+ dec: dec === 0 ? 0 : dec,
144
+ raDefined
145
+ };
146
+ }
147
+ function declinationOf(lon, lat, trueObliquity) {
148
+ return eclipticToEquatorial(lon, lat, trueObliquity).dec;
149
+ }
150
+ function declinationOrb(a, b, policy = DEFAULT_DECLINATION_ORB_POLICY) {
151
+ bodyName(a);
152
+ bodyName(b);
153
+ const checked = policyOf(policy);
154
+ return a === "Sun" || a === "Moon" || b === "Sun" || b === "Moon" ? checked.luminaryOrb : checked.orb;
155
+ }
156
+ function placeBodies(bodies, trueObliquity, chartSun = false) {
157
+ obliquity(trueObliquity);
158
+ if (!Array.isArray(bodies) || Object.getPrototypeOf(bodies) !== Array.prototype) {
159
+ throw new RangeError("declination bodies must be a standard array.");
160
+ }
161
+ const fields = Object.getOwnPropertyDescriptors(bodies);
162
+ const length = fields.length.value;
163
+ if (length > MAX_DECLINATION_BODIES || Reflect.ownKeys(bodies).length !== length + 1) {
164
+ throw new RangeError("declination bodies must be dense, undecorated, and contain at most 256 entries.");
165
+ }
166
+ const seen = /* @__PURE__ */ new Set();
167
+ const placed = [];
168
+ const longitudes = [];
169
+ for (let index = 0; index < length; index += 1) {
170
+ const field = fields[String(index)];
171
+ if (!field || !Object.hasOwn(field, "value") || !field.enumerable) {
172
+ throw new RangeError("declination bodies must contain only enumerable data entries.");
173
+ }
174
+ const source = dataFields(field.value, "declination body");
175
+ const body = { body: source.body?.value, lon: source.lon?.value, lat: source.lat?.value };
176
+ bodyName(body.body);
177
+ if (seen.has(body.body)) throw new RangeError("duplicate declination body identifier.");
178
+ seen.add(body.body);
179
+ const position = eclipticToEquatorial(body.lon, body.lat, trueObliquity);
180
+ const exemptSun = body.body === "Sun" && (chartSun || Math.abs(body.lat) <= SUN_BOUND_LATITUDE);
181
+ placed.push({
182
+ body: body.body,
183
+ lon: normalize(body.lon),
184
+ lat: body.lat,
185
+ ...position,
186
+ outOfBounds: !exemptSun && Math.abs(position.dec) > trueObliquity,
187
+ boundMarginArcsec: (Math.abs(position.dec) - trueObliquity) * 3600
188
+ });
189
+ longitudes.push(body.lon);
190
+ }
191
+ return { rows: placed, longitudes };
192
+ }
193
+ function longitudeSeparation(a, b) {
194
+ let difference = exactSum(a % 360, -(b % 360));
195
+ while (signOf(difference) < 0) difference = exactSum(difference, 360);
196
+ while (compareExact(difference, 360) >= 0) difference = exactSum(difference, -360);
197
+ return roundedValue(compareExact(difference, 180) > 0 ? exactSum(360, negated(difference)) : difference);
198
+ }
199
+ function aspectsFor({ rows, longitudes }, policy) {
200
+ const found = [];
201
+ for (let i = 0; i < rows.length; i += 1) {
202
+ for (let j = i + 1; j < rows.length; j += 1) {
203
+ const a = rows[i];
204
+ const b = rows[j];
205
+ const parallel = absolute(exactSum(a.dec, -b.dec));
206
+ const contraparallel = absolute(exactSum(a.dec, b.dec));
207
+ const isParallel = compareExact(parallel, contraparallel) <= 0;
208
+ const exactOrb = isParallel ? parallel : contraparallel;
209
+ const maximumOrb = declinationOrb(a.body, b.body, policy);
210
+ if (compareExact(exactOrb, maximumOrb) > 0) continue;
211
+ found.push({ exactOrb, aspect: {
212
+ a: a.body,
213
+ b: b.body,
214
+ type: isParallel ? "parallel" : "contraparallel",
215
+ orb: roundedValue(exactOrb),
216
+ maximumOrb,
217
+ decA: a.dec,
218
+ decB: b.dec,
219
+ separation: longitudeSeparation(longitudes[i], longitudes[j])
220
+ } });
221
+ }
222
+ }
223
+ return found.sort((x, y) => compareExact(x.exactOrb, y.exactOrb)).map((entry) => entry.aspect);
224
+ }
225
+ function findDeclinationAspects(bodies, trueObliquity, policy = DEFAULT_DECLINATION_ORB_POLICY) {
226
+ const checked = policyOf(policy);
227
+ return aspectsFor(placeBodies(bodies, trueObliquity), checked);
228
+ }
229
+ function declinations(bodies, trueObliquity, policy, chartSun) {
230
+ const checked = policyOf(policy);
231
+ const placed = placeBodies(bodies, trueObliquity, chartSun);
232
+ return {
233
+ trueObliquity,
234
+ rows: placed.rows,
235
+ aspects: aspectsFor(placed, checked),
236
+ orbPolicy: checked,
237
+ convention: "true-equator-and-equinox-of-date; full-ecliptic-longitude-and-latitude",
238
+ receiptScope: "not-included-in-natal-receipt"
239
+ };
240
+ }
241
+ function declinationsForBodies(bodies, trueObliquity, policy = DEFAULT_DECLINATION_ORB_POLICY) {
242
+ return declinations(bodies, trueObliquity, policy, false);
243
+ }
244
+ export {
245
+ DEFAULT_DECLINATION_ORB_POLICY,
246
+ RA_POLE_TOLERANCE,
247
+ SUN_BOUND_LATITUDE,
248
+ declinationOf,
249
+ declinationOrb,
250
+ declinationsForBodies,
251
+ eclipticToEquatorial,
252
+ findDeclinationAspects
253
+ };