@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,43 +1,52 @@
1
- import {
2
- resolveLocalToUtc
3
- } from "./chunk-N4B5JNMA.js";
4
- import "./chunk-KFTJMMG7.js";
5
1
  import {
6
2
  natalChart,
7
3
  resolvedChart,
8
4
  utcOf
9
- } from "./chunk-L6ZHWJZ6.js";
5
+ } from "./chunk-TZVPZHZM.js";
10
6
  import {
11
- dateFrom
12
- } from "./chunk-CPALRSPC.js";
13
- import {
14
- findLongitudeCrossingsWith
15
- } from "./chunk-AECKV73C.js";
16
- import "./chunk-PFGUCNOK.js";
7
+ readOptions
8
+ } from "./chunk-47ERTK5X.js";
17
9
  import {
18
10
  bodyLongitude,
11
+ ephemerisOver,
12
+ fallbacksAt,
19
13
  midpoint
20
- } from "./chunk-WOU7JVD3.js";
14
+ } from "./chunk-QLIEEICB.js";
15
+ import {
16
+ dateFrom
17
+ } from "./chunk-CPALRSPC.js";
18
+ import {
19
+ ASPECTS,
20
+ ASPECT_BODY_SET,
21
+ matchAspect
22
+ } from "./chunk-B4M2Y7FT.js";
23
+ import "./chunk-2PZYJQV5.js";
21
24
  import {
22
25
  outsideReferenceSpan
23
- } from "./chunk-KHBLFXFG.js";
24
- import "./chunk-ONBZ4HK7.js";
26
+ } from "./chunk-B5LKF437.js";
27
+ import {
28
+ findLongitudeCrossingsWith
29
+ } from "./chunk-TSS2SZWQ.js";
30
+ import "./chunk-767FTO7O.js";
31
+ import "./chunk-YPU3MDNI.js";
32
+ import "./chunk-Y4E3WJU5.js";
25
33
  import {
26
34
  HOUSE_SYSTEMS
27
- } from "./chunk-4NV4ZEFZ.js";
35
+ } from "./chunk-NNOSOOWS.js";
28
36
  import {
29
- ASPECTS,
30
- ASPECT_BODIES,
31
37
  SIGNS,
32
- SIGN_NAMES,
33
- matchAspect,
38
+ SIGN_SLUGS,
34
39
  normalizeLongitude,
35
40
  signIndexForLongitude
36
- } from "./chunk-2OWGBT3O.js";
41
+ } from "./chunk-RMBWKZI2.js";
42
+ import "./chunk-BHJXUY67.js";
43
+ import {
44
+ resolveLocalToUtc
45
+ } from "./chunk-7Y2F2IWN.js";
46
+ import "./chunk-KFTJMMG7.js";
47
+ import "./chunk-BMDASNPB.js";
37
48
 
38
- // src/techniques/shared.ts
39
- var DAY_MS = 864e5;
40
- var MAX_DATE_MS = 864e13;
49
+ // src/techniques/names.ts
41
50
  var BODY_NAMES = [
42
51
  "Sun",
43
52
  "Moon",
@@ -56,19 +65,6 @@ function bodyName(value, label) {
56
65
  if (typeof value === "string" && BODY_NAMES.includes(value)) return value;
57
66
  throw new RangeError(`${label} must be a body name.`);
58
67
  }
59
- function readOptions(value, allowed, label) {
60
- const out = /* @__PURE__ */ Object.create(null);
61
- if (value === void 0) return out;
62
- const prototype = value !== null && typeof value === "object" && !Array.isArray(value) ? Object.getPrototypeOf(value) : void 0;
63
- if (prototype !== Object.prototype && prototype !== null) throw new RangeError(`${label} must be a plain options object.`);
64
- for (const key of Reflect.ownKeys(value)) {
65
- const slot = Object.getOwnPropertyDescriptor(value, key);
66
- if (typeof key !== "string" || !allowed.includes(key)) throw new RangeError(`${label} has an unknown option: ${String(key)}.`);
67
- if (!slot || !("value" in slot) || !slot.enumerable) throw new RangeError(`${label} must contain only plain data properties.`);
68
- if (slot.value !== void 0) out[key] = slot.value;
69
- }
70
- return out;
71
- }
72
68
  function oneOf(value, allowed, fallback, label) {
73
69
  if (value === void 0) return fallback;
74
70
  if (typeof value === "string" && allowed.includes(value)) return value;
@@ -78,6 +74,10 @@ function finiteDegrees(value, label) {
78
74
  if (typeof value !== "number" || !Number.isFinite(value)) throw new RangeError(`${label} must be a finite number of degrees.`);
79
75
  return value;
80
76
  }
77
+
78
+ // src/techniques/shared.ts
79
+ var DAY_MS = 864e5;
80
+ var MAX_DATE_MS = 864e13;
81
81
  function placeOf(value, label) {
82
82
  const { latitude, longitude } = value ?? {};
83
83
  if (typeof latitude !== "number" || !(Math.abs(latitude) <= 90) || typeof longitude !== "number" || !(Math.abs(longitude) <= 180)) {
@@ -90,7 +90,24 @@ function dateAt(milliseconds, label) {
90
90
  return new Date(milliseconds);
91
91
  }
92
92
  function techniqueFlags(instants) {
93
- return Object.freeze(instants.some((milliseconds) => outsideReferenceSpan(new Date(milliseconds))) ? ["outside-reference-span"] : []);
93
+ const flags = instants.some((milliseconds) => outsideReferenceSpan(new Date(milliseconds))) ? ["outside-reference-span"] : [];
94
+ return Object.freeze([...flags, ...fallbacksAt(instants)]);
95
+ }
96
+ function labelOver(instants) {
97
+ return { ephemeris: Object.freeze(ephemerisOver(instants)), flags: techniqueFlags(instants) };
98
+ }
99
+ function detailed(value, instants) {
100
+ return Object.freeze({ value, ...labelOver(instants) });
101
+ }
102
+ var CHART_FLAGS = ["outside-reference-span", "de440-unavailable", "outside-de440-span"];
103
+ function labelOfCharts(charts) {
104
+ const named = charts.map((chart) => chart.ephemeris ?? null);
105
+ const first = named[0] ?? null;
106
+ const same = first !== null && named.every((one) => one !== null && one.name === first.name && one.version === first.version);
107
+ return {
108
+ ephemeris: same ? Object.freeze({ name: first.name, version: first.version }) : null,
109
+ flags: Object.freeze(CHART_FLAGS.filter((flag) => charts.some((chart) => chart.flags.includes(flag))))
110
+ };
94
111
  }
95
112
 
96
113
  // src/techniques/returns.ts
@@ -101,35 +118,40 @@ var LUNAR_RETURN_HORIZON_DAYS = 40;
101
118
  var LUNAR_RETURN_STEP_DAYS = 0.25;
102
119
  var SELECTIONS = ["nearest", "most-recent"];
103
120
  function solarReturnInstant(natalSunLongitude, near) {
121
+ return solarReturnSearch(natalSunLongitude, near).value;
122
+ }
123
+ function solarReturnInstantDetailed(natalSunLongitude, near) {
124
+ const { value, from, to } = solarReturnSearch(natalSunLongitude, near);
125
+ return detailed(value, [from, to]);
126
+ }
127
+ function solarReturnSearch(natalSunLongitude, near) {
104
128
  const target = finiteDegrees(natalSunLongitude, "natalSunLongitude");
105
129
  const center = dateFrom(near, "near").getTime();
106
- const crossings = findLongitudeCrossingsWith(
107
- bodyLongitude,
108
- "Sun",
109
- target,
110
- dateAt(center - SOLAR_RETURN_WINDOW_DAYS * DAY_MS, "The solar return window"),
111
- dateAt(center + SOLAR_RETURN_WINDOW_DAYS * DAY_MS, "The solar return window"),
112
- SOLAR_RETURN_STEP_DAYS
113
- );
130
+ const lower = dateAt(center - SOLAR_RETURN_WINDOW_DAYS * DAY_MS, "The solar return window");
131
+ const upper = dateAt(center + SOLAR_RETURN_WINDOW_DAYS * DAY_MS, "The solar return window");
132
+ const crossings = findLongitudeCrossingsWith(bodyLongitude, "Sun", target, lower, upper, SOLAR_RETURN_STEP_DAYS);
114
133
  const first = crossings[0];
115
134
  if (first === void 0) throw new RangeError("No solar return found in the scan window.");
116
135
  const closest = crossings.reduce((best, crossing) => Math.abs(crossing.at.getTime() - center) < Math.abs(best.at.getTime() - center) ? crossing : best, first);
117
- return new Date(closest.at.getTime());
136
+ return { value: new Date(closest.at.getTime()), from: lower.getTime(), to: upper.getTime() };
118
137
  }
119
138
  function mostRecentSolarReturnInstant(natalSunLongitude, at) {
139
+ return mostRecentSolarReturnSearch(natalSunLongitude, at).value;
140
+ }
141
+ function mostRecentSolarReturnInstantDetailed(natalSunLongitude, at) {
142
+ const { value, from, to } = mostRecentSolarReturnSearch(natalSunLongitude, at);
143
+ return detailed(value, [from, to]);
144
+ }
145
+ function mostRecentSolarReturnSearch(natalSunLongitude, at) {
120
146
  const target = finiteDegrees(natalSunLongitude, "natalSunLongitude");
121
147
  const end = dateFrom(at, "at").getTime();
122
- const crossings = findLongitudeCrossingsWith(
123
- bodyLongitude,
124
- "Sun",
125
- target,
126
- dateAt(end - SOLAR_RETURN_LOOKBACK_DAYS * DAY_MS, "The solar return window"),
127
- new Date(end),
128
- SOLAR_RETURN_STEP_DAYS
129
- ).filter((crossing) => crossing.at.getTime() <= end);
148
+ const lower = dateAt(end - SOLAR_RETURN_LOOKBACK_DAYS * DAY_MS, "The solar return window");
149
+ const crossings = findLongitudeCrossingsWith(bodyLongitude, "Sun", target, lower, new Date(end), SOLAR_RETURN_STEP_DAYS).filter(
150
+ (crossing) => crossing.at.getTime() <= end
151
+ );
130
152
  const last = crossings[crossings.length - 1];
131
153
  if (last === void 0) throw new RangeError("No previous solar return found in the scan window.");
132
- return new Date(last.at.getTime());
154
+ return { value: new Date(last.at.getTime()), from: lower.getTime(), to: end };
133
155
  }
134
156
  function moonLongitude(date) {
135
157
  const longitude = bodyLongitude("Moon", date);
@@ -137,6 +159,13 @@ function moonLongitude(date) {
137
159
  return longitude;
138
160
  }
139
161
  function lunarReturnInstant(natalMoonLongitude, after) {
162
+ return lunarReturnSearch(natalMoonLongitude, after).value;
163
+ }
164
+ function lunarReturnInstantDetailed(natalMoonLongitude, after) {
165
+ const { value, from, to } = lunarReturnSearch(natalMoonLongitude, after);
166
+ return detailed(value, [from, to]);
167
+ }
168
+ function lunarReturnSearch(natalMoonLongitude, after) {
140
169
  const longitude = finiteDegrees(natalMoonLongitude, "natalMoonLongitude");
141
170
  const start = dateFrom(after, "after").getTime();
142
171
  const upper = start + LUNAR_RETURN_HORIZON_DAYS * DAY_MS;
@@ -155,7 +184,7 @@ function lunarReturnInstant(natalMoonLongitude, after) {
155
184
  const instants = [...new Set(crossings.map((crossing) => crossing.at.getTime()))].filter((instant) => instant > start && instant <= upper).sort((a, b) => a - b);
156
185
  const first = instants[0];
157
186
  if (first === void 0) throw new RangeError("No lunar return was found in the 40-day scan.");
158
- return new Date(first);
187
+ return { value: new Date(first), from: start, to: upper };
159
188
  }
160
189
  function setup(natal, body, options) {
161
190
  const houseSystem = options.houseSystem === void 0 ? void 0 : oneOf(options.houseSystem, HOUSE_SYSTEMS, "whole", "houseSystem");
@@ -205,7 +234,7 @@ function lunarReturn(natal, after, options) {
205
234
  });
206
235
  }
207
236
 
208
- // src/techniques/relationship.ts
237
+ // src/techniques/composite.ts
209
238
  function positions(list, label) {
210
239
  if (!Array.isArray(list)) throw new RangeError(`${label} must be an array of { body, lon }.`);
211
240
  const seen = /* @__PURE__ */ new Set();
@@ -226,7 +255,7 @@ function compositeMidpoints(first, second) {
226
255
  return Object.freeze(out);
227
256
  }
228
257
  function compositeAspects(points) {
229
- const list = positions(points, "points").filter((point) => ASPECT_BODIES.has(point.body));
258
+ const list = positions(points, "points").filter((point) => ASPECT_BODY_SET.has(point.body));
230
259
  const out = [];
231
260
  list.forEach((a, i) => {
232
261
  for (const b of list.slice(i + 1)) {
@@ -236,9 +265,13 @@ function compositeAspects(points) {
236
265
  });
237
266
  return Object.freeze(out.sort((x, y) => x.orb - y.orb));
238
267
  }
268
+
269
+ // src/techniques/relationship.ts
239
270
  function compositeChart(first, second) {
240
- const bodies = compositeMidpoints(resolvedChart(first).chart.bodies, resolvedChart(second).chart.bodies);
241
- return Object.freeze({ bodies, aspects: compositeAspects(bodies) });
271
+ const a = resolvedChart(first).chart;
272
+ const b = resolvedChart(second).chart;
273
+ const bodies = compositeMidpoints(a.bodies, b.bodies);
274
+ return Object.freeze({ bodies, aspects: compositeAspects(bodies), ...labelOfCharts([a, b]) });
242
275
  }
243
276
  var PLACES = ["coordinates", "great-circle"];
244
277
  var DEG = Math.PI / 180;
@@ -247,11 +280,14 @@ function wrapLongitude(value) {
247
280
  return wrapped === -180 ? 180 : wrapped;
248
281
  }
249
282
  function davisonPlace(first, second, convention = "coordinates") {
250
- if (convention === "coordinates") {
251
- const east = ((second.longitude - first.longitude) % 360 + 360) % 360;
283
+ const kind = oneOf(convention, PLACES, "coordinates", "convention");
284
+ const a = placeOf(first, "first");
285
+ const b = placeOf(second, "second");
286
+ if (kind === "coordinates") {
287
+ const east = ((b.longitude - a.longitude) % 360 + 360) % 360;
252
288
  return Object.freeze({
253
- latitude: (first.latitude + second.latitude) / 2,
254
- longitude: wrapLongitude(first.longitude + (east > 180 ? east - 360 : east) / 2)
289
+ latitude: (a.latitude + b.latitude) / 2,
290
+ longitude: wrapLongitude(a.longitude + (east > 180 ? east - 360 : east) / 2)
255
291
  });
256
292
  }
257
293
  const vector = ({ latitude, longitude }) => [
@@ -259,8 +295,8 @@ function davisonPlace(first, second, convention = "coordinates") {
259
295
  Math.cos(latitude * DEG) * Math.sin(longitude * DEG),
260
296
  Math.sin(latitude * DEG)
261
297
  ];
262
- const [x1 = 0, y1 = 0, z1 = 0] = vector(first);
263
- const [x2 = 0, y2 = 0, z2 = 0] = vector(second);
298
+ const [x1 = 0, y1 = 0, z1 = 0] = vector(a);
299
+ const [x2 = 0, y2 = 0, z2 = 0] = vector(b);
264
300
  const [x, y, z] = [x1 + x2, y1 + y2, z1 + z2];
265
301
  const horizontal = Math.hypot(x, y);
266
302
  if (Math.hypot(horizontal, z) < 1e-12) throw new RangeError("Antipodal places have no single great-circle midpoint.");
@@ -282,12 +318,12 @@ function davisonChart(first, second, options) {
282
318
 
283
319
  // src/techniques/void-of-course.ts
284
320
  var VOID_BODIES = /* @__PURE__ */ Object.freeze({
285
- modern: Object.freeze(["Sun", "Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"]),
286
- traditional: Object.freeze(["Sun", "Mercury", "Venus", "Mars", "Jupiter", "Saturn"])
321
+ modern: /* @__PURE__ */ Object.freeze(["Sun", "Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"]),
322
+ traditional: /* @__PURE__ */ Object.freeze(["Sun", "Mercury", "Venus", "Mars", "Jupiter", "Saturn"])
287
323
  });
288
324
  var VOID_OF_COURSE_CONVENTION = /* @__PURE__ */ Object.freeze({
289
325
  name: "last-exact-ptolemaic-aspect-to-sign-exit",
290
- aspects: Object.freeze(["conjunction", "sextile", "square", "trine", "opposition"]),
326
+ aspects: /* @__PURE__ */ Object.freeze(["conjunction", "sextile", "square", "trine", "opposition"]),
291
327
  defaultBodies: "modern",
292
328
  source: "Lilly, Christian Astrology (1647), p. 112"
293
329
  });
@@ -315,6 +351,9 @@ function delta(a, b) {
315
351
  const d = ((b - a) % 360 + 360) % 360;
316
352
  return d > 180 ? d - 360 : d;
317
353
  }
354
+ var INGRESS_STEP_MS = DAY_MS / 4;
355
+ var ASPECT_STEP_MS = DAY_MS / 8;
356
+ var around = (at, half, fromT, toT) => labelOver([Math.max(fromT, at - half), Math.min(toT, at + half)]);
318
357
  function ingresses(fromT, toT) {
319
358
  const out = [];
320
359
  if (!(toT > fromT)) return out;
@@ -340,7 +379,7 @@ function aspects(fromT, toT, bodies) {
340
379
  const cur = delta((bodyLons.get(body) ?? 0) + offset, moonLon);
341
380
  const before = prev[i];
342
381
  if (cur === 0 && before !== 0 && Math.abs(before) < 90) {
343
- out.push({ at: new Date(t), body, aspect: type, moonLon });
382
+ out.push({ at: new Date(t), body, aspect: type, moonLon, ...around(t, ASPECT_STEP_MS, fromT, toT) });
344
383
  } else if (before !== 0 && cur !== 0 && Math.sign(cur) !== Math.sign(before) && Math.abs(cur) < 90 && Math.abs(before) < 90) {
345
384
  let lo = prevT;
346
385
  let hi = t;
@@ -351,7 +390,7 @@ function aspects(fromT, toT, bodies) {
351
390
  else lo = mid;
352
391
  }
353
392
  const at = new Date(hi);
354
- out.push({ at, body, aspect: type, moonLon: bodyLongitude("Moon", at) });
393
+ out.push({ at, body, aspect: type, moonLon: bodyLongitude("Moon", at), ...around(hi, ASPECT_STEP_MS, fromT, toT) });
355
394
  }
356
395
  prev[i] = cur;
357
396
  });
@@ -360,7 +399,8 @@ function aspects(fromT, toT, bodies) {
360
399
  return out.sort((a, b) => a.at.getTime() - b.at.getTime());
361
400
  }
362
401
  function windows(fromT, toT, bodies) {
363
- const list = ingresses(fromT - 4 * DAY_MS, toT);
402
+ const scanFrom = fromT - 4 * DAY_MS;
403
+ const list = ingresses(scanFrom, toT);
364
404
  const out = [];
365
405
  for (let i = 1; i < list.length; i += 1) {
366
406
  const entered = list[i - 1];
@@ -374,15 +414,22 @@ function windows(fromT, toT, bodies) {
374
414
  from: new Date((lastAspect ?? entered).at.getTime()),
375
415
  to: new Date(end),
376
416
  lastAspect: lastAspect && Object.freeze(lastAspect),
377
- sign: SIGN_NAMES[entered.signIndex],
378
- nextSign: SIGN_NAMES[leaving.signIndex]
417
+ sign: SIGN_SLUGS[entered.signIndex],
418
+ nextSign: SIGN_SLUGS[leaving.signIndex],
419
+ // Its two ingresses and every aspect scanned between them.
420
+ ...labelOver([Math.max(scanFrom, entered.at.getTime() - INGRESS_STEP_MS), Math.min(toT, end + INGRESS_STEP_MS)])
379
421
  })
380
422
  );
381
423
  }
382
424
  return out;
383
425
  }
384
426
  function moonIngresses(from, to) {
385
- return Object.freeze(ingresses(...span(from, to)).map((row) => Object.freeze({ at: row.at, sign: SIGN_NAMES[row.signIndex] })));
427
+ const [fromT, toT] = span(from, to);
428
+ return Object.freeze(
429
+ ingresses(fromT, toT).map(
430
+ (row) => Object.freeze({ at: row.at, sign: SIGN_SLUGS[row.signIndex], ...around(row.at.getTime(), INGRESS_STEP_MS, fromT, toT) })
431
+ )
432
+ );
386
433
  }
387
434
  function moonAspects(from, to, options) {
388
435
  const bodies = bodiesOf(options);
@@ -395,9 +442,17 @@ function voidOfCourseWindows(from, to, options) {
395
442
  function voidOfCourseAt(at, options) {
396
443
  const bodies = bodiesOf(options);
397
444
  const t = dateFrom(at, "at").getTime();
398
- const list = windows(t - 3 * DAY_MS, t + 6 * DAY_MS, bodies);
445
+ const [fromT, toT] = [t - 3 * DAY_MS, t + 6 * DAY_MS];
446
+ const list = windows(fromT, toT, bodies);
399
447
  const current = list.find((window) => window.from.getTime() <= t && t < window.to.getTime()) ?? null;
400
- return Object.freeze({ at: new Date(t), isVoid: current !== null, current, next: list.find((window) => window.from.getTime() > t) ?? null });
448
+ return Object.freeze({
449
+ at: new Date(t),
450
+ isVoid: current !== null,
451
+ current,
452
+ next: list.find((window) => window.from.getTime() > t) ?? null,
453
+ // Every position the windows read: from four days before their scan to its end.
454
+ ...labelOver([fromT - 4 * DAY_MS, toT])
455
+ });
401
456
  }
402
457
 
403
458
  // src/techniques/aspect-patterns.ts
@@ -540,10 +595,11 @@ function aspectPatterns(points, aspects2) {
540
595
  }
541
596
  function chartAspectPatterns(natal) {
542
597
  const { chart } = resolvedChart(natal);
543
- return aspectPatterns(
598
+ const found = aspectPatterns(
544
599
  chart.bodies.map((row) => ({ body: row.body, lon: row.lon })),
545
600
  chart.aspects.map((row) => ({ a: row.a, b: row.b, type: row.type, orb: row.orb }))
546
601
  );
602
+ return Object.freeze({ ...found, ...labelOfCharts([chart]) });
547
603
  }
548
604
  var KIND_ORDER = ["grand-cross", "kite", "grand-trine", "t-square"];
549
605
  function patternContainment(patterns) {
@@ -596,12 +652,12 @@ var EXALTATIONS = /* @__PURE__ */ Object.freeze({
596
652
  Saturn: "libra"
597
653
  });
598
654
  var TRIPLICITY_LORDS = /* @__PURE__ */ Object.freeze({
599
- fire: Object.freeze({ day: "Sun", night: "Jupiter", participating: "Saturn" }),
600
- earth: Object.freeze({ day: "Venus", night: "Moon", participating: "Mars" }),
601
- air: Object.freeze({ day: "Saturn", night: "Mercury", participating: "Jupiter" }),
602
- water: Object.freeze({ day: "Venus", night: "Mars", participating: "Moon" })
655
+ fire: /* @__PURE__ */ Object.freeze({ day: "Sun", night: "Jupiter", participating: "Saturn" }),
656
+ earth: /* @__PURE__ */ Object.freeze({ day: "Venus", night: "Moon", participating: "Mars" }),
657
+ air: /* @__PURE__ */ Object.freeze({ day: "Saturn", night: "Mercury", participating: "Jupiter" }),
658
+ water: /* @__PURE__ */ Object.freeze({ day: "Venus", night: "Mars", participating: "Moon" })
603
659
  });
604
- var terms = (...rows) => Object.freeze(Object.fromEntries(SIGN_NAMES.map((sign, index) => [sign, Object.freeze(rows[index].map((row) => Object.freeze(row)))])));
660
+ var terms = (...rows) => Object.freeze(Object.fromEntries(SIGN_SLUGS.map((sign, index) => [sign, Object.freeze(rows[index].map((row) => Object.freeze(row)))])));
605
661
  var EGYPTIAN_TERMS = /* @__PURE__ */ terms(
606
662
  [["Jupiter", 6], ["Venus", 12], ["Mercury", 20], ["Mars", 25], ["Saturn", 30]],
607
663
  [["Venus", 8], ["Mercury", 14], ["Jupiter", 22], ["Saturn", 27], ["Mars", 30]],
@@ -617,12 +673,12 @@ var EGYPTIAN_TERMS = /* @__PURE__ */ terms(
617
673
  [["Venus", 12], ["Jupiter", 16], ["Mercury", 19], ["Mars", 28], ["Saturn", 30]]
618
674
  );
619
675
  var CHALDEAN_FACES = /* @__PURE__ */ Object.freeze(
620
- Array.from({ length: 36 }, (_, index) => ["Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter"][index % 7])
676
+ /* @__PURE__ */ Array.from({ length: 36 }, (_, index) => ["Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter"][index % 7])
621
677
  );
622
- var opposite = (sign) => SIGN_NAMES[(SIGN_NAMES.indexOf(sign) + 6) % 12];
678
+ var opposite = (sign) => SIGN_SLUGS[(SIGN_SLUGS.indexOf(sign) + 6) % 12];
623
679
  var isClassical = (body) => CLASSICAL_PLANETS.includes(body);
624
680
  function signName(value) {
625
- if (typeof value === "string" && SIGN_NAMES.includes(value)) return value;
681
+ if (typeof value === "string" && SIGN_SLUGS.includes(value)) return value;
626
682
  throw new RangeError("sign must be a lowercase zodiac sign name.");
627
683
  }
628
684
  function hasClassicalDignities(planet) {
@@ -647,7 +703,7 @@ function dignityFor(planet, sign) {
647
703
  function dignityRulersAt(longitude) {
648
704
  const lon = normalizeLongitude(finiteDegrees(longitude, "longitude"));
649
705
  const index = signIndexForLongitude(lon);
650
- const sign = SIGN_NAMES[index];
706
+ const sign = SIGN_SLUGS[index];
651
707
  const degree = Math.max(0, lon - index * 30);
652
708
  const row = EGYPTIAN_TERMS[sign];
653
709
  const at = Math.max(0, row.findIndex(([, end]) => degree < end));
@@ -729,14 +785,22 @@ function signsOver(fromT, toT) {
729
785
  const first = signIndexForLongitude(bodyLongitude("Moon", new Date(fromT)));
730
786
  const last = signIndexForLongitude(bodyLongitude("Moon", new Date(toT)));
731
787
  const count = (last - first + 12) % 12;
732
- return Array.from({ length: count + 1 }, (_, step) => SIGN_NAMES[(first + step) % 12]);
788
+ return Array.from({ length: count + 1 }, (_, step) => SIGN_SLUGS[(first + step) % 12]);
733
789
  }
734
790
  function moonSignsBetween(from, to) {
791
+ const [fromT, toT] = moonSignSpan(from, to);
792
+ return Object.freeze(signsOver(fromT, toT));
793
+ }
794
+ function moonSignsBetweenDetailed(from, to) {
795
+ const [fromT, toT] = moonSignSpan(from, to);
796
+ return detailed(Object.freeze(signsOver(fromT, toT)), [fromT, toT]);
797
+ }
798
+ function moonSignSpan(from, to) {
735
799
  const fromT = dateFrom(from, "from").getTime();
736
800
  const toT = dateFrom(to, "to").getTime();
737
801
  if (fromT > toT) throw new RangeError("from must not be after to.");
738
802
  if (toT - fromT > MOON_SIGN_MAX_SPAN_DAYS * DAY_MS) throw new RangeError(`The span must not exceed ${MOON_SIGN_MAX_SPAN_DAYS} days.`);
739
- return Object.freeze(signsOver(fromT, toT));
803
+ return [fromT, toT];
740
804
  }
741
805
  function civilDate(value) {
742
806
  const match = typeof value === "string" ? /^(\d{4})-(\d{2})-(\d{2})$/u.exec(value) : null;
@@ -816,15 +880,19 @@ export {
816
880
  hasClassicalDignities,
817
881
  lunarReturn,
818
882
  lunarReturnInstant,
883
+ lunarReturnInstantDetailed,
819
884
  moonAspects,
820
885
  moonIngresses,
821
886
  moonSignCandidates,
822
887
  moonSignsBetween,
888
+ moonSignsBetweenDetailed,
823
889
  mostRecentSolarReturnInstant,
890
+ mostRecentSolarReturnInstantDetailed,
824
891
  mutualReceptions,
825
892
  patternContainment,
826
893
  solarReturn,
827
894
  solarReturnInstant,
895
+ solarReturnInstantDetailed,
828
896
  voidOfCourseAt,
829
897
  voidOfCourseWindows
830
898
  };
@@ -0,0 +1,36 @@
1
+ import { DeltaT } from './deltat.js';
2
+ import { T as TimeScale } from './time-scale-DIFNa0gz.js';
3
+
4
+ /**
5
+ * The bands of the time basis (docs/time.md, "The time bands"): from the ΔT
6
+ * band and the UT1 − UTC band an instant records, the 1-σ bands of the TT and
7
+ * the UT1 the engine used, by the scale the instant was given on and the basis
8
+ * that gave UT1 and TT. `@zodiacs/engine/calc` carries them into its results
9
+ * (docs/calc.md, "Bands") and `@zodiacs/engine/time` exports them. This module
10
+ * imports types only, so that the two entries can share it.
11
+ */
12
+
13
+ /** The 1-σ bands, in seconds, of the TT and the UT1 a time basis gave an instant. They are not bounds (docs/time.md, "The time bands"). */
14
+ interface TimeBands {
15
+ readonly tt: number;
16
+ readonly ut1: number;
17
+ }
18
+ /**
19
+ * The bands of a recorded instant, from its `deltaT` and `timeScale`: a
20
+ * `TimeBasis`, a root `Chart`, a calc receipt's instant, or a natal
21
+ * envelope's result from the time-basis conventions set on. With d the ΔT
22
+ * band (`deltaT.sigma`, 0 for a pin) and u the UT1 − UTC band
23
+ * (`timeScale.ut1MinusUtc.sigma`, 0 where there is none), the bands are
24
+ * `{ tt: 0, ut1: d }` on TT input, `{ tt: d, ut1: 0 }` on UT1 input, and on
25
+ * UTC input `{ tt: 0, ut1: u }` on the IERS basis, `{ tt: u, ut1: u }` with a
26
+ * pin, and `{ tt: √(u² + d²), ut1: u }` on the ΔT model, where u is 0 before
27
+ * 1972. It reads those fields only and recomputes no σ. Throws RangeError for
28
+ * a record without a `deltaT` or a `timeScale`, or with a scale, a basis or a
29
+ * band it does not know.
30
+ */
31
+ declare function timeBands(record: {
32
+ readonly deltaT: DeltaT;
33
+ readonly timeScale: TimeScale;
34
+ }): TimeBands;
35
+
36
+ export { type TimeBands as T, timeBands as t };
@@ -0,0 +1,47 @@
1
+ import { DeltaT } from './deltat.js';
2
+
3
+ /** The scale an input instant is on. UTC unless a caller says otherwise. */
4
+ type TimeScaleName = "utc" | "ut1" | "tt";
5
+ declare const TIME_SCALE_NAMES: readonly TimeScaleName[];
6
+ /**
7
+ * The ΔT model name for a value derived from leap seconds and IERS UT1 − UTC:
8
+ * a chart's from 1972 to the end of the IERS UT1 table. DELTA_T_MODEL names
9
+ * the model used at every other instant.
10
+ */
11
+ declare const DELTA_T_IERS_MODEL = "iers-utc/1";
12
+ /** UT1 − UTC as used: IERS observed or predicted, or 0 within 0.9 s outside the table. */
13
+ interface Ut1MinusUtc {
14
+ seconds: number;
15
+ sigma: number;
16
+ source: "observed" | "predicted" | "fallback";
17
+ }
18
+ /** TAI − UTC, s; `listed` is false after the list expires and its last value is carried. */
19
+ interface LeapSeconds {
20
+ taiMinusUtc: number;
21
+ listed: boolean;
22
+ }
23
+ /** How an instant became UT1 and TT: "iers" (leap seconds, IERS UT1 − UTC), "delta-t" (read as UT1, the ΔT model) or "pinned". */
24
+ interface TimeScale {
25
+ input: TimeScaleName;
26
+ basis: "iers" | "delta-t" | "pinned";
27
+ /** Null before 1972. */
28
+ ut1MinusUtc: Ut1MinusUtc | null;
29
+ /** Null where TT did not come from the leap seconds. */
30
+ leapSeconds: LeapSeconds | null;
31
+ }
32
+ /** An instant's UT1 and TT, days since 2000-01-01T12:00 on each scale, with its record. */
33
+ interface TimeBasis {
34
+ /**
35
+ * The UTC instant, ms; where the civil instant is read as UT1, that instant.
36
+ * An instant inside a leap second (23:59:60 on UTC) has no JavaScript
37
+ * timestamp: it gets the one JavaScript gives that reading, the next day's
38
+ * 00:00:00, with the TAI − UTC and UT1 − UTC in force during the leap second.
39
+ */
40
+ utcMs: number;
41
+ ut1Days: number;
42
+ ttDays: number;
43
+ deltaT: DeltaT;
44
+ timeScale: TimeScale;
45
+ }
46
+
47
+ export { DELTA_T_IERS_MODEL as D, type LeapSeconds as L, type TimeScale as T, type Ut1MinusUtc as U, type TimeScaleName as a, type TimeBasis as b, TIME_SCALE_NAMES as c };
package/dist/time.d.ts ADDED
@@ -0,0 +1,81 @@
1
+ import { b as TimeBasis, a as TimeScaleName } from './time-scale-DIFNa0gz.js';
2
+ export { D as DELTA_T_IERS_MODEL, L as LeapSeconds, c as TIME_SCALE_NAMES, T as TimeScale, U as Ut1MinusUtc } from './time-scale-DIFNa0gz.js';
3
+ export { DeltaT, DeltaTSegment } from './deltat.js';
4
+ export { E as EPHEMERIS_SPAN } from './reference-span-CILpclrz.js';
5
+ export { T as TimeBands, t as timeBands } from './time-bands-CZA9AlLg.js';
6
+
7
+ /** The nutation and obliquity of date. */
8
+ interface Tilt {
9
+ /** Nutation in longitude Δψ, arcseconds. */
10
+ readonly dpsi: number;
11
+ /** Nutation in obliquity Δε, arcseconds. */
12
+ readonly deps: number;
13
+ /** Mean obliquity of date εA (IAU 2006), degrees. */
14
+ readonly mobl: number;
15
+ /** True obliquity of date, εA + Δε, degrees. */
16
+ readonly tobl: number;
17
+ /**
18
+ * Equation of the equinoxes, arcseconds: Δψ cos εA plus the two largest
19
+ * complementary terms of IERS Conventions (2010), table 5.2e, 2640.96 µas
20
+ * sin Ω and 63.52 µas sin 2Ω. The rest of that table adds up to at most
21
+ * 44.0 µas from 1800 to 2200.
22
+ */
23
+ readonly ee: number;
24
+ }
25
+
26
+ /** EQJ to the mean ecliptic and equinox of date at a TT instant, and that instant's tilt. */
27
+ interface EclipticFrame {
28
+ /** TT, days from J2000.0. */
29
+ readonly tt: number;
30
+ /**
31
+ * R1(εA) P, row by row: its first row is the mean equinox of date as an EQJ
32
+ * direction, its third the pole of the mean ecliptic.
33
+ */
34
+ readonly rows: readonly number[];
35
+ readonly tilt: Tilt;
36
+ }
37
+
38
+ /**
39
+ * An instant's UT1 and TT, days from 2000-01-01T12:00 on each scale, with the
40
+ * `deltaT` and `timeScale` records a chart carries: the engine's own time
41
+ * basis (docs/time.md). `ms` is the instant on `scale` (UTC unless given), in
42
+ * milliseconds since 1970 as JavaScript counts them, within the range of a
43
+ * `Date`; `pin`, when given, is a ΔT (TT − UT1) in seconds, at most 1e10 in
44
+ * size, which replaces the engine's. Throws `RangeError` for any other value.
45
+ */
46
+ declare function timeBasis(ms: number, scale?: TimeScaleName, pin?: number): TimeBasis;
47
+ /**
48
+ * The time between two samples taken `days` apart on an input's scale, in
49
+ * days: `days` where both lie in one piece of the time basis, and the TT
50
+ * between them where a step of the basis lies between them (a leap second, a
51
+ * change of basis). `before` and `after` are records `timeBasis` gave.
52
+ */
53
+ declare function elapsedDays(before: TimeBasis, after: TimeBasis, days: number): number;
54
+ /**
55
+ * The nutation and obliquity at `tt`, days of TT from J2000.0 (astronomy-engine's
56
+ * `time.tt`): IAU 2000B's Δψ and Δε, the IAU 2006 mean obliquity, the true
57
+ * obliquity and the equation of the equinoxes. The result is frozen.
58
+ */
59
+ declare function tilt(tt: number): Tilt;
60
+ /**
61
+ * The rotation from astronomy-engine's EQJ (the J2000 mean equator and
62
+ * equinox) to the mean ecliptic and equinox of date at `tt`, days of TT from
63
+ * J2000.0, with that instant's tilt. The result, its rows and its tilt are a
64
+ * frozen copy; the frame the engine keeps for its own next call is never
65
+ * handed out.
66
+ */
67
+ declare function eclipticFrame(tt: number): EclipticFrame;
68
+ /** An EQJ vector on the mean ecliptic and equinox of date, [x, y, z], in the frame `eclipticFrame` gave. */
69
+ declare function meanEcliptic(frame: EclipticFrame, x: number, y: number, z: number): [number, number, number];
70
+ /**
71
+ * An EQJ vector's longitude and latitude on the true ecliptic and equinox of
72
+ * date at `tt`, degrees: the mean-ecliptic longitude plus Δψ, and the
73
+ * latitude. A vector with no direction, such as the zero vector, throws
74
+ * `RangeError`.
75
+ */
76
+ declare function eclipticOfDate(x: number, y: number, z: number, tt: number): {
77
+ lon: number;
78
+ lat: number;
79
+ };
80
+
81
+ export { type EclipticFrame, type Tilt, TimeBasis, TimeScaleName, eclipticFrame, eclipticOfDate, elapsedDays, meanEcliptic, tilt, timeBasis };