@zodiacs/engine 1.0.0 → 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 (70) hide show
  1. package/CHANGELOG.md +1020 -0
  2. package/LICENSING.md +168 -27
  3. package/NOTICE +78 -12
  4. package/README.md +288 -44
  5. package/dist/{api-WbxJ4Wj-.d.ts → api-ChL1N2Sr.d.ts} +33 -2
  6. package/dist/{ayanamsa--YQ46fET.d.ts → ayanamsa-ClFzkKmV.d.ts} +2 -1
  7. package/dist/calc.d.ts +90 -4
  8. package/dist/calc.js +360 -126
  9. package/dist/chunk-2PZYJQV5.js +83 -0
  10. package/dist/{chunk-7TRLIFFI.js → chunk-4XOYTBLS.js} +1 -1
  11. package/dist/chunk-767FTO7O.js +48 -0
  12. package/dist/{chunk-YIITY7Q7.js → chunk-7Y2F2IWN.js} +19 -17
  13. package/dist/{chunk-OG4OYTJJ.js → chunk-B4M2Y7FT.js} +1 -129
  14. package/dist/{chunk-PFGUCNOK.js → chunk-BMDASNPB.js} +6 -6
  15. package/dist/chunk-I3L4POY7.js +18 -0
  16. package/dist/{chunk-CHSYDKBL.js → chunk-LNGURVNH.js} +3 -3
  17. package/dist/{chunk-DMGHYCDI.js → chunk-NNOSOOWS.js} +1 -1
  18. package/dist/chunk-OVXQQEXL.js +41 -0
  19. package/dist/{chunk-SRXBTP5H.js → chunk-QLIEEICB.js} +201 -190
  20. package/dist/chunk-RMBWKZI2.js +130 -0
  21. package/dist/{chunk-FTX3JDJA.js → chunk-TZVPZHZM.js} +42 -23
  22. package/dist/{chunk-WS3TDSP3.js → chunk-WBTWY2OB.js} +7 -3
  23. package/dist/chunk-Y4E3WJU5.js +87 -0
  24. package/dist/chunk-YPU3MDNI.js +852 -0
  25. package/dist/conventions.d.ts +70 -0
  26. package/dist/conventions.js +26 -0
  27. package/dist/crossings.d.ts +15 -4
  28. package/dist/de440-pack.d.ts +43 -0
  29. package/dist/de440-pack.js +16 -0
  30. package/dist/de440.d.ts +113 -0
  31. package/dist/de440.js +19 -0
  32. package/dist/ephemeris-exTSqBgb.d.ts +60 -0
  33. package/dist/geo.d.ts +16 -4
  34. package/dist/geo.js +2 -2
  35. package/dist/{houses-CFERsAlK.d.ts → houses-Bh7GCnPi.d.ts} +3 -3
  36. package/dist/houses-extra.d.ts +5 -4
  37. package/dist/index.d.ts +8 -6
  38. package/dist/index.js +40 -28
  39. package/dist/{internal-math-DJJ8BYex.d.ts → internal-math-CxenuGfm.d.ts} +2 -2
  40. package/dist/internal-math.d.ts +4 -3
  41. package/dist/internal-math.js +14 -12
  42. package/dist/internal.d.ts +16 -7
  43. package/dist/internal.js +25 -4
  44. package/dist/lite-composite.js +114 -0
  45. package/dist/lite-declinations.js +253 -0
  46. package/dist/lite-dignities.js +333 -0
  47. package/dist/lite-sect.js +72 -0
  48. package/dist/lite.d.ts +82 -0
  49. package/dist/lite.js +4 -0
  50. package/dist/receipt.d.ts +3 -2
  51. package/dist/receipt.js +143 -65
  52. package/dist/{rulers-Dla6h_Sm.d.ts → rulers-CSSWtiWF.d.ts} +1 -1
  53. package/dist/sky.d.ts +4 -3
  54. package/dist/sky.js +17 -10
  55. package/dist/techniques.d.ts +102 -6
  56. package/dist/techniques.js +131 -56
  57. package/dist/time-bands-CZA9AlLg.d.ts +36 -0
  58. package/dist/time-scale-DIFNa0gz.d.ts +47 -0
  59. package/dist/time.d.ts +81 -0
  60. package/dist/time.js +74 -0
  61. package/dist/timing.d.ts +6 -5
  62. package/dist/timing.js +24 -17
  63. package/dist/types-DpPdtXgO.d.ts +335 -0
  64. package/dist/vedic.d.ts +112 -4
  65. package/dist/vedic.js +369 -14
  66. package/dist/window.d.ts +22 -2
  67. package/dist/window.js +86 -28
  68. package/dist/{zone-history-ghdyO0Sc.d.ts → zone-history-BxmDCcTK.d.ts} +32 -10
  69. package/package.json +24 -3
  70. package/dist/types-B-yb_tGL.d.ts +0 -240
@@ -1,16 +1,3 @@
1
- import {
2
- dateFrom
3
- } from "./chunk-CPALRSPC.js";
4
- import {
5
- findLongitudeCrossingsWith,
6
- searchLongitudeCrossingsWith
7
- } from "./chunk-TSS2SZWQ.js";
8
- import {
9
- assertDerivedFlags,
10
- snapshotFlags,
11
- timeFlags,
12
- validateBirthSettings
13
- } from "./chunk-PFGUCNOK.js";
14
1
  import {
15
2
  SPEED_STEP_DAYS,
16
3
  bodyLongitude,
@@ -18,23 +5,42 @@ import {
18
5
  computeChart,
19
6
  computeChartDeclinations,
20
7
  computePoints,
21
- longitudeSpeed
22
- } from "./chunk-SRXBTP5H.js";
8
+ deltaTExtrapolated,
9
+ ephemerisAt,
10
+ longitudeSpeed,
11
+ notingFallbacks
12
+ } from "./chunk-QLIEEICB.js";
13
+ import {
14
+ dateFrom
15
+ } from "./chunk-CPALRSPC.js";
16
+ import {
17
+ ASPECT_BODY_SET,
18
+ EPHEMERIS,
19
+ matchAspect
20
+ } from "./chunk-B4M2Y7FT.js";
23
21
  import {
24
22
  TIME_SCALE_NAMES,
25
23
  outsideReferenceSpan,
26
24
  timeBasis
27
25
  } from "./chunk-B5LKF437.js";
26
+ import {
27
+ findLongitudeCrossingsWith,
28
+ searchLongitudeCrossingsWith
29
+ } from "./chunk-TSS2SZWQ.js";
28
30
  import {
29
31
  POLAR_FALLBACK,
30
32
  isPolarUndefinedHouseSystem
31
- } from "./chunk-DMGHYCDI.js";
33
+ } from "./chunk-NNOSOOWS.js";
32
34
  import {
33
- ASPECT_BODY_SET,
34
- matchAspect,
35
35
  normalizeLongitude,
36
36
  signForLongitude
37
- } from "./chunk-OG4OYTJJ.js";
37
+ } from "./chunk-RMBWKZI2.js";
38
+ import {
39
+ assertDerivedFlags,
40
+ snapshotFlags,
41
+ timeFlags,
42
+ validateBirthSettings
43
+ } from "./chunk-BMDASNPB.js";
38
44
 
39
45
  // src/returns.ts
40
46
  var DAY = 864e5;
@@ -51,7 +57,10 @@ function findLongitudeCrossings(body, targetLongitude, from, to, stepDays = 5) {
51
57
  return findLongitudeCrossingsWith(bodyLongitude, body, targetLongitude, windowEnd(from, "start"), windowEnd(to, "end"), stepDays);
52
58
  }
53
59
  function searchLongitudeCrossings(body, targetLongitude, from, to, options) {
54
- return searchLongitudeCrossingsWith(bodyLongitude, body, targetLongitude, windowEnd(from, "start"), windowEnd(to, "end"), options);
60
+ const { value, fallbacks } = notingFallbacks(
61
+ () => searchLongitudeCrossingsWith(bodyLongitude, body, targetLongitude, windowEnd(from, "start"), windowEnd(to, "end"), options)
62
+ );
63
+ return value.status === "complete" ? { ...value, flags: fallbacks } : value;
55
64
  }
56
65
  function groupIntoSeasons(crossings, gapDays = 400) {
57
66
  if (!Number.isFinite(gapDays) || gapDays <= 0) {
@@ -199,6 +208,11 @@ function resolvedChart(source) {
199
208
  expected.push("polar-fallback");
200
209
  }
201
210
  if (outsideReferenceSpan(input.utc)) expected.push("outside-reference-span");
211
+ if (resultFlags.values.length > expected.length && deltaTExtrapolated(timeBasis(+input.utc, input.timeScale, input.deltaT), hasHouses))
212
+ expected.push("delta-t-extrapolated");
213
+ if (source.ephemeris === void 0 || source.ephemeris?.name === "astronomy-engine") {
214
+ for (const reason of ["de440-unavailable", "outside-de440-span"]) if (resultFlags.values.includes(reason)) expected.push(reason);
215
+ }
202
216
  assertDerivedFlags(inputFlags?.values ?? [], expected);
203
217
  if (resultFlags.values.length !== expected.length || !expected.every((flag) => resultFlags.values.includes(flag))) {
204
218
  throw new RangeError("chart flags must agree with its input and supplied house result.");
@@ -246,7 +260,7 @@ function validateBirth(birth) {
246
260
  if (scale !== void 0 && !TIME_SCALE_NAMES.includes(scale)) {
247
261
  throw new RangeError('timeScale must be "utc", "ut1" or "tt".');
248
262
  }
249
- const possible = [];
263
+ const possible = ["delta-t-extrapolated", "de440-unavailable", "outside-de440-span"];
250
264
  if (settings.timeKnown === false) possible.push("no-time");
251
265
  else if (settings.houseSystem !== void 0 && isPolarUndefinedHouseSystem(settings.houseSystem) && settings.latitude !== void 0) {
252
266
  possible.push("polar-fallback");
@@ -311,12 +325,15 @@ function phaseName(angle) {
311
325
  function moonPhase(date) {
312
326
  const at = dateFrom(date, "date");
313
327
  const angle = normalizeLongitude(bodyLongitude("Moon", at) - bodyLongitude("Sun", at));
328
+ const { ephemeris, fallback } = ephemerisAt(at.getTime());
314
329
  return {
315
330
  at,
316
331
  angle,
317
332
  illumination: (1 - Math.cos(angle * Math.PI / 180)) / 2,
318
333
  name: phaseName(angle),
319
- waxing: angle < 180
334
+ waxing: angle < 180,
335
+ ephemeris: ephemeris.name,
336
+ ...fallback !== null && { fallback }
320
337
  };
321
338
  }
322
339
  function utcOf(input) {
@@ -334,7 +351,9 @@ function saturnReturn(birth) {
334
351
  validated.flags?.values.includes("polar-fallback") ? computedBirth(validated).input : validated.input
335
352
  );
336
353
  } else utc = dateFrom(birth, "birth");
337
- return computeSaturnReturns(utc);
354
+ const { value, fallbacks } = notingFallbacks(() => computeSaturnReturns(utc));
355
+ const ephemeris = fallbacks.length > 0 ? EPHEMERIS.name : ephemerisAt(utc.getTime()).ephemeris.name;
356
+ return { ...value, ephemeris, flags: fallbacks };
338
357
  }
339
358
 
340
359
  export {
@@ -1,14 +1,17 @@
1
1
  import {
2
2
  readOptions
3
3
  } from "./chunk-47ERTK5X.js";
4
+ import {
5
+ onChartClock,
6
+ refuseUnderSource
7
+ } from "./chunk-QLIEEICB.js";
4
8
  import {
5
9
  dateFrom
6
10
  } from "./chunk-CPALRSPC.js";
7
11
  import {
8
12
  eclipticFrame,
9
- meanEcliptic,
10
- onChartClock
11
- } from "./chunk-SRXBTP5H.js";
13
+ meanEcliptic
14
+ } from "./chunk-2PZYJQV5.js";
12
15
  import {
13
16
  REFERENCE_SPAN,
14
17
  TIME_SCALE_NAMES,
@@ -225,6 +228,7 @@ function bias(v) {
225
228
  return [x2, y1 - eta * z2, z2 + eta * y1];
226
229
  }
227
230
  function apparentStar(s, time) {
231
+ refuseUnderSource("A star-anchored ayanamsa");
228
232
  const ra = s.ra * DEG;
229
233
  const dec = s.dec * DEG;
230
234
  const p0 = bias([Math.cos(dec) * Math.cos(ra), Math.cos(dec) * Math.sin(ra), Math.sin(dec)]);
@@ -0,0 +1,87 @@
1
+ import {
2
+ meanObliquity
3
+ } from "./chunk-NNOSOOWS.js";
4
+
5
+ // src/nutation.ts
6
+ var DEG = Math.PI / 180;
7
+ var ARCSEC = DEG / 3600;
8
+ var ARGUMENTS = [
9
+ 485868.249036,
10
+ 17179159232178e-4,
11
+ 128710479305e-5,
12
+ 1295965810481e-4,
13
+ 335779.526232,
14
+ 17395272628478e-4,
15
+ 107226070369e-5,
16
+ 1602961601209e-3,
17
+ 450160.398036,
18
+ -69628905431e-4
19
+ ];
20
+ var MULTIPLIERS = "2222322404224242222423222234043222222423324242140422403124241224232223122231244432423024232224222444204040224242424324041242342222224222322312243244042204232203212231244324222324440242223424224432142422243324034240402243424232140322203112424220332242234033122202424524242124231424222321144412422214440222333424422231323233222324221240332224122322243412464132332040332443024441222433404";
21
+ var COEFFICIENT_TEXT = "-172064161,-174666,33386,92052331,9086,15377,-13170906,-1675,-13696,5730336,-3015,-4587,-2276413,-234,2796,978459,-485,1374,2074554,207,-698,-897492,470,-291,1475877,-3633,11817,73871,-184,-1924,-516821,1226,-524,224386,-677,-174,711159,73,-872,-6750,0,358,-387298,-367,380,200728,18,318,-301461,-36,816,129025,-63,367,215829,-494,111,-95929,299,132,128227,137,181,-68982,-9,39,123457,11,19,-53311,32,-4,156994,10,-168,-1235,0,82,63110,63,27,-33228,0,-9,-57976,-63,-189,31429,0,-75,-59641,-11,149,25543,-11,66,-51613,-42,129,26366,0,78,45893,50,31,-24236,-10,20,63384,11,-150,-1220,0,29,-38571,-1,158,16452,-11,68,32481,0,0,-13870,0,0,-47722,0,-18,477,0,-25,-31046,-1,131,13238,-11,59,28593,0,-1,-12338,10,-3,20441,21,10,-10758,0,-3,29243,0,-74,-609,0,13,25887,0,-66,-550,0,11,-14053,-25,79,8551,-2,-45,15164,10,11,-8001,0,-1,-15794,72,-16,6850,-42,-5,21783,0,13,-167,0,13,-12873,-10,-37,6953,0,-14,-12654,11,63,6415,0,26,-10204,0,25,5222,0,15,16707,-85,-10,168,-1,10,-7691,0,44,3268,0,19,-11024,0,-14,104,0,2,7566,-21,-11,-3250,0,-5,-6637,-11,25,3353,0,14,-7141,21,8,3070,0,4,-6302,-11,2,3272,0,4,5800,10,2,-3045,0,-1,6443,0,-7,-2768,0,-4,-5774,-11,-15,3041,0,-5,-5350,0,21,2695,0,12,-4752,-11,-3,2719,0,-3,-4940,-11,-21,2720,0,-9,7350,0,-8,-51,0,4,4065,0,6,-2206,0,1,6579,0,-24,-199,0,2,3579,0,5,-1900,0,1,4725,0,-6,-41,0,3,-3075,0,-2,1313,0,-1,-2904,0,15,1233,0,7,4348,0,-10,-81,0,2,-2878,0,8,1232,0,4,-4230,0,5,-20,0,-2,-2819,0,7,1207,0,3,-4056,0,5,40,0,-2,-2647,0,11,1129,0,5,-2294,0,-10,1266,0,-4,2481,0,-7,-1062,0,-3,2179,0,-2,-1129,0,-2,3276,0,1,-9,0,0,-3389,0,5,35,0,-2,3339,0,-13,-107,0,1,-1987,0,-6,1073,0,-2,-1981,0,0,854,0,0,4026,0,-353,-553,0,-139,1660,0,-5,-710,0,-2,-1521,0,9,647,0,4,1314,0,0,-700,0,0,-1283,0,0,672,0,0,-1331,0,8,663,0,4,1383,0,-2,-594,0,-2,1405,0,4,-610,0,2,1290,0,0,-556,0,0";
22
+ var coefficientValues;
23
+ function coefficients() {
24
+ return coefficientValues ??= COEFFICIENT_TEXT.split(",").map(Number);
25
+ }
26
+ var OFFSETS = [-135e-6, 388e-6];
27
+ var NUTATION_TERMS = 77;
28
+ function nutation(t, terms = NUTATION_TERMS) {
29
+ const c = coefficients();
30
+ const re = [];
31
+ const im = [];
32
+ let om = 0;
33
+ for (let j = 0; j < 5; j += 1) {
34
+ const f = (ARGUMENTS[2 * j] + t * ARGUMENTS[2 * j + 1]) % 1296e3 * ARCSEC;
35
+ const cos = Math.cos(f);
36
+ const sin = Math.sin(f);
37
+ const o = 7 * j;
38
+ re[o + 1] = cos;
39
+ im[o + 1] = -sin;
40
+ re[o + 2] = 1;
41
+ im[o + 2] = 0;
42
+ for (let k = o + 3; k < o + 7; k += 1) {
43
+ re[k] = re[k - 1] * cos - im[k - 1] * sin;
44
+ im[k] = re[k - 1] * sin + im[k - 1] * cos;
45
+ }
46
+ re[o] = re[o + 4];
47
+ im[o] = -im[o + 4];
48
+ om = f;
49
+ }
50
+ let dp = 0;
51
+ let de = 0;
52
+ for (let i = terms - 1; i >= 0; i -= 1) {
53
+ let cos = 1;
54
+ let sin = 0;
55
+ for (let j = 0; j < 5; j += 1) {
56
+ const k2 = 7 * j + MULTIPLIERS.charCodeAt(5 * i + j) - 48;
57
+ const next = cos * re[k2] - sin * im[k2];
58
+ sin = cos * im[k2] + sin * re[k2];
59
+ cos = next;
60
+ }
61
+ const k = 6 * i;
62
+ dp += (c[k] + c[k + 1] * t) * sin + c[k + 2] * cos;
63
+ de += (c[k + 3] + c[k + 4] * t) * cos + c[k + 5] * sin;
64
+ }
65
+ return { dpsi: dp * 1e-7 + OFFSETS[0], deps: de * 1e-7 + OFFSETS[1], om };
66
+ }
67
+ function tilt(tt) {
68
+ const t = tt / 36525;
69
+ const { dpsi, deps, om } = nutation(t);
70
+ const mobl = meanObliquity(t);
71
+ return {
72
+ dpsi,
73
+ deps,
74
+ mobl,
75
+ tobl: mobl + deps / 3600,
76
+ ee: dpsi * Math.cos(mobl * DEG) + 264096e-8 * Math.sin(om) + 6352e-8 * Math.sin(2 * om)
77
+ };
78
+ }
79
+
80
+ export {
81
+ ARGUMENTS,
82
+ MULTIPLIERS,
83
+ coefficients,
84
+ OFFSETS,
85
+ NUTATION_TERMS,
86
+ tilt
87
+ };