@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.
- package/CHANGELOG.md +1020 -0
- package/LICENSING.md +168 -27
- package/NOTICE +78 -12
- package/README.md +288 -44
- package/dist/{api-WbxJ4Wj-.d.ts → api-ChL1N2Sr.d.ts} +33 -2
- package/dist/{ayanamsa--YQ46fET.d.ts → ayanamsa-ClFzkKmV.d.ts} +2 -1
- package/dist/calc.d.ts +90 -4
- package/dist/calc.js +360 -126
- package/dist/chunk-2PZYJQV5.js +83 -0
- package/dist/{chunk-7TRLIFFI.js → chunk-4XOYTBLS.js} +1 -1
- package/dist/chunk-767FTO7O.js +48 -0
- package/dist/{chunk-YIITY7Q7.js → chunk-7Y2F2IWN.js} +19 -17
- package/dist/{chunk-OG4OYTJJ.js → chunk-B4M2Y7FT.js} +1 -129
- package/dist/{chunk-PFGUCNOK.js → chunk-BMDASNPB.js} +6 -6
- package/dist/chunk-I3L4POY7.js +18 -0
- package/dist/{chunk-CHSYDKBL.js → chunk-LNGURVNH.js} +3 -3
- package/dist/{chunk-DMGHYCDI.js → chunk-NNOSOOWS.js} +1 -1
- package/dist/chunk-OVXQQEXL.js +41 -0
- package/dist/{chunk-SRXBTP5H.js → chunk-QLIEEICB.js} +201 -190
- package/dist/chunk-RMBWKZI2.js +130 -0
- package/dist/{chunk-FTX3JDJA.js → chunk-TZVPZHZM.js} +42 -23
- package/dist/{chunk-WS3TDSP3.js → chunk-WBTWY2OB.js} +7 -3
- package/dist/chunk-Y4E3WJU5.js +87 -0
- package/dist/chunk-YPU3MDNI.js +852 -0
- package/dist/conventions.d.ts +70 -0
- package/dist/conventions.js +26 -0
- package/dist/crossings.d.ts +15 -4
- package/dist/de440-pack.d.ts +43 -0
- package/dist/de440-pack.js +16 -0
- package/dist/de440.d.ts +113 -0
- package/dist/de440.js +19 -0
- package/dist/ephemeris-exTSqBgb.d.ts +60 -0
- package/dist/geo.d.ts +16 -4
- package/dist/geo.js +2 -2
- package/dist/{houses-CFERsAlK.d.ts → houses-Bh7GCnPi.d.ts} +3 -3
- package/dist/houses-extra.d.ts +5 -4
- package/dist/index.d.ts +8 -6
- package/dist/index.js +40 -28
- package/dist/{internal-math-DJJ8BYex.d.ts → internal-math-CxenuGfm.d.ts} +2 -2
- package/dist/internal-math.d.ts +4 -3
- package/dist/internal-math.js +14 -12
- package/dist/internal.d.ts +16 -7
- package/dist/internal.js +25 -4
- package/dist/lite-composite.js +114 -0
- package/dist/lite-declinations.js +253 -0
- package/dist/lite-dignities.js +333 -0
- package/dist/lite-sect.js +72 -0
- package/dist/lite.d.ts +82 -0
- package/dist/lite.js +4 -0
- package/dist/receipt.d.ts +3 -2
- package/dist/receipt.js +143 -65
- package/dist/{rulers-Dla6h_Sm.d.ts → rulers-CSSWtiWF.d.ts} +1 -1
- package/dist/sky.d.ts +4 -3
- package/dist/sky.js +17 -10
- package/dist/techniques.d.ts +102 -6
- package/dist/techniques.js +131 -56
- package/dist/time-bands-CZA9AlLg.d.ts +36 -0
- package/dist/time-scale-DIFNa0gz.d.ts +47 -0
- package/dist/time.d.ts +81 -0
- package/dist/time.js +74 -0
- package/dist/timing.d.ts +6 -5
- package/dist/timing.js +24 -17
- package/dist/types-DpPdtXgO.d.ts +335 -0
- package/dist/vedic.d.ts +112 -4
- package/dist/vedic.js +369 -14
- package/dist/window.d.ts +22 -2
- package/dist/window.js +86 -28
- package/dist/{zone-history-ghdyO0Sc.d.ts → zone-history-BxmDCcTK.d.ts} +32 -10
- package/package.json +24 -3
- package/dist/types-B-yb_tGL.d.ts +0 -240
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ENGINE_VERSION,
|
|
3
|
+
EPHEMERIS,
|
|
4
|
+
findAspects
|
|
5
|
+
} from "./chunk-B4M2Y7FT.js";
|
|
6
|
+
import {
|
|
7
|
+
eclipticFrame,
|
|
8
|
+
eclipticOfDate,
|
|
9
|
+
meanEcliptic
|
|
10
|
+
} from "./chunk-2PZYJQV5.js";
|
|
1
11
|
import {
|
|
2
12
|
EPHEMERIS_SPAN,
|
|
3
13
|
elapsedDays,
|
|
@@ -5,22 +15,25 @@ import {
|
|
|
5
15
|
timeBasis
|
|
6
16
|
} from "./chunk-B5LKF437.js";
|
|
7
17
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
18
|
+
shippedDe440Source
|
|
19
|
+
} from "./chunk-767FTO7O.js";
|
|
20
|
+
import {
|
|
21
|
+
tilt
|
|
22
|
+
} from "./chunk-Y4E3WJU5.js";
|
|
10
23
|
import {
|
|
11
24
|
computeAngles,
|
|
12
25
|
computeHouses,
|
|
13
26
|
eastPointOf,
|
|
14
|
-
meanObliquity,
|
|
15
27
|
vertexOf
|
|
16
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-NNOSOOWS.js";
|
|
17
29
|
import {
|
|
18
|
-
ENGINE_VERSION,
|
|
19
30
|
degreeInSign,
|
|
20
|
-
findAspects,
|
|
21
31
|
normalizeLongitude,
|
|
22
32
|
signForLongitude
|
|
23
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-RMBWKZI2.js";
|
|
34
|
+
import {
|
|
35
|
+
deltaT
|
|
36
|
+
} from "./chunk-BHJXUY67.js";
|
|
24
37
|
|
|
25
38
|
// src/body-label.ts
|
|
26
39
|
var MAX_BODY_LABEL_LENGTH = 80;
|
|
@@ -210,8 +223,8 @@ function placeBodies(bodies, trueObliquity, chartSun = false) {
|
|
|
210
223
|
if (!field || !Object.hasOwn(field, "value") || !field.enumerable) {
|
|
211
224
|
throw new RangeError("declination bodies must contain only enumerable data entries.");
|
|
212
225
|
}
|
|
213
|
-
const
|
|
214
|
-
const body = { body:
|
|
226
|
+
const source2 = dataFields(field.value, "declination body");
|
|
227
|
+
const body = { body: source2.body?.value, lon: source2.lon?.value, lat: source2.lat?.value };
|
|
215
228
|
bodyName(body.body);
|
|
216
229
|
if (seen.has(body.body)) throw new RangeError("duplicate declination body identifier.");
|
|
217
230
|
seen.add(body.body);
|
|
@@ -284,173 +297,27 @@ function chartBodyDeclinations(bodies, trueObliquity) {
|
|
|
284
297
|
return declinations(bodies, trueObliquity, DEFAULT_DECLINATION_ORB_POLICY, true);
|
|
285
298
|
}
|
|
286
299
|
|
|
287
|
-
// src/
|
|
300
|
+
// src/points.ts
|
|
288
301
|
var DEG2 = Math.PI / 180;
|
|
289
|
-
var ARCSEC = DEG2 / 3600;
|
|
290
|
-
var ARGUMENTS = [
|
|
291
|
-
485868.249036,
|
|
292
|
-
17179159232178e-4,
|
|
293
|
-
128710479305e-5,
|
|
294
|
-
1295965810481e-4,
|
|
295
|
-
335779.526232,
|
|
296
|
-
17395272628478e-4,
|
|
297
|
-
107226070369e-5,
|
|
298
|
-
1602961601209e-3,
|
|
299
|
-
450160.398036,
|
|
300
|
-
-69628905431e-4
|
|
301
|
-
];
|
|
302
|
-
var MULTIPLIERS = "2222322404224242222423222234043222222423324242140422403124241224232223122231244432423024232224222444204040224242424324041242342222224222322312243244042204232203212231244324222324440242223424224432142422243324034240402243424232140322203112424220332242234033122202424524242124231424222321144412422214440222333424422231323233222324221240332224122322243412464132332040332443024441222433404";
|
|
303
|
-
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";
|
|
304
|
-
var coefficientValues;
|
|
305
|
-
function coefficients() {
|
|
306
|
-
return coefficientValues ??= COEFFICIENT_TEXT.split(",").map(Number);
|
|
307
|
-
}
|
|
308
|
-
var OFFSETS = [-135e-6, 388e-6];
|
|
309
|
-
var NUTATION_TERMS = 77;
|
|
310
|
-
function nutation(t, terms = NUTATION_TERMS) {
|
|
311
|
-
const c = coefficients();
|
|
312
|
-
const re = [];
|
|
313
|
-
const im = [];
|
|
314
|
-
let om = 0;
|
|
315
|
-
for (let j = 0; j < 5; j += 1) {
|
|
316
|
-
const f = (ARGUMENTS[2 * j] + t * ARGUMENTS[2 * j + 1]) % 1296e3 * ARCSEC;
|
|
317
|
-
const cos = Math.cos(f);
|
|
318
|
-
const sin = Math.sin(f);
|
|
319
|
-
const o = 7 * j;
|
|
320
|
-
re[o + 1] = cos;
|
|
321
|
-
im[o + 1] = -sin;
|
|
322
|
-
re[o + 2] = 1;
|
|
323
|
-
im[o + 2] = 0;
|
|
324
|
-
for (let k = o + 3; k < o + 7; k += 1) {
|
|
325
|
-
re[k] = re[k - 1] * cos - im[k - 1] * sin;
|
|
326
|
-
im[k] = re[k - 1] * sin + im[k - 1] * cos;
|
|
327
|
-
}
|
|
328
|
-
re[o] = re[o + 4];
|
|
329
|
-
im[o] = -im[o + 4];
|
|
330
|
-
om = f;
|
|
331
|
-
}
|
|
332
|
-
let dp = 0;
|
|
333
|
-
let de = 0;
|
|
334
|
-
for (let i = terms - 1; i >= 0; i -= 1) {
|
|
335
|
-
let cos = 1;
|
|
336
|
-
let sin = 0;
|
|
337
|
-
for (let j = 0; j < 5; j += 1) {
|
|
338
|
-
const k2 = 7 * j + MULTIPLIERS.charCodeAt(5 * i + j) - 48;
|
|
339
|
-
const next = cos * re[k2] - sin * im[k2];
|
|
340
|
-
sin = cos * im[k2] + sin * re[k2];
|
|
341
|
-
cos = next;
|
|
342
|
-
}
|
|
343
|
-
const k = 6 * i;
|
|
344
|
-
dp += (c[k] + c[k + 1] * t) * sin + c[k + 2] * cos;
|
|
345
|
-
de += (c[k + 3] + c[k + 4] * t) * cos + c[k + 5] * sin;
|
|
346
|
-
}
|
|
347
|
-
return { dpsi: dp * 1e-7 + OFFSETS[0], deps: de * 1e-7 + OFFSETS[1], om };
|
|
348
|
-
}
|
|
349
|
-
function tilt(tt) {
|
|
350
|
-
const t = tt / 36525;
|
|
351
|
-
const { dpsi, deps, om } = nutation(t);
|
|
352
|
-
const mobl = meanObliquity(t);
|
|
353
|
-
return {
|
|
354
|
-
dpsi,
|
|
355
|
-
deps,
|
|
356
|
-
mobl,
|
|
357
|
-
tobl: mobl + deps / 3600,
|
|
358
|
-
ee: dpsi * Math.cos(mobl * DEG2) + 264096e-8 * Math.sin(om) + 6352e-8 * Math.sin(2 * om)
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// src/frame.ts
|
|
363
|
-
var DEG3 = Math.PI / 180;
|
|
364
|
-
var ASEC2RAD = DEG3 / 3600;
|
|
365
302
|
var RAD2 = 180 / Math.PI;
|
|
366
|
-
var
|
|
367
|
-
function eclipticFrame(tt) {
|
|
368
|
-
if (last !== void 0 && last.tt === tt) return last;
|
|
369
|
-
const t = tt / 36525;
|
|
370
|
-
let eps0 = 84381.406;
|
|
371
|
-
let psia = ((((-951e-10 * t + 132851e-9) * t - 114045e-8) * t - 1.0790069) * t + 5038.481507) * t;
|
|
372
|
-
let omegaa = ((((3337e-10 * t - 467e-9) * t - 772503e-8) * t + 0.0512623) * t - 0.025754) * t + eps0;
|
|
373
|
-
let chia = ((((-56e-9 * t + 170663e-9) * t - 121197e-8) * t - 2.3814292) * t + 10.556403) * t;
|
|
374
|
-
eps0 *= ASEC2RAD;
|
|
375
|
-
psia *= ASEC2RAD;
|
|
376
|
-
omegaa *= ASEC2RAD;
|
|
377
|
-
chia *= ASEC2RAD;
|
|
378
|
-
const sa = Math.sin(eps0);
|
|
379
|
-
const ca = Math.cos(eps0);
|
|
380
|
-
const sb = Math.sin(-psia);
|
|
381
|
-
const cb = Math.cos(-psia);
|
|
382
|
-
const sc = Math.sin(-omegaa);
|
|
383
|
-
const cc = Math.cos(-omegaa);
|
|
384
|
-
const sd = Math.sin(chia);
|
|
385
|
-
const cd = Math.cos(chia);
|
|
386
|
-
const xx = cd * cb - sb * sd * cc;
|
|
387
|
-
const yx = cd * sb * ca + sd * cc * cb * ca - sa * sd * sc;
|
|
388
|
-
const zx = cd * sb * sa + sd * cc * cb * sa + ca * sd * sc;
|
|
389
|
-
const xy = -sd * cb - sb * cd * cc;
|
|
390
|
-
const yy = -sd * sb * ca + cd * cc * cb * ca - sa * cd * sc;
|
|
391
|
-
const zy = -sd * sb * sa + cd * cc * cb * sa + ca * cd * sc;
|
|
392
|
-
const xz = sb * sc;
|
|
393
|
-
const yz = -sc * cb * ca - sa * cc;
|
|
394
|
-
const zz = -sc * cb * sa + cc * ca;
|
|
395
|
-
const at = tilt(tt);
|
|
396
|
-
const e = at.mobl * DEG3;
|
|
397
|
-
const ce = Math.cos(e);
|
|
398
|
-
const se = Math.sin(e);
|
|
399
|
-
last = {
|
|
400
|
-
tt,
|
|
401
|
-
rows: [
|
|
402
|
-
xx,
|
|
403
|
-
yx,
|
|
404
|
-
zx,
|
|
405
|
-
ce * xy + se * xz,
|
|
406
|
-
ce * yy + se * yz,
|
|
407
|
-
ce * zy + se * zz,
|
|
408
|
-
ce * xz - se * xy,
|
|
409
|
-
ce * yz - se * yy,
|
|
410
|
-
ce * zz - se * zy
|
|
411
|
-
],
|
|
412
|
-
tilt: at
|
|
413
|
-
};
|
|
414
|
-
return last;
|
|
415
|
-
}
|
|
416
|
-
function meanEcliptic(frame, x, y, z) {
|
|
417
|
-
const m = frame.rows;
|
|
418
|
-
return [
|
|
419
|
-
m[0] * x + m[1] * y + m[2] * z,
|
|
420
|
-
m[3] * x + m[4] * y + m[5] * z,
|
|
421
|
-
m[6] * x + m[7] * y + m[8] * z
|
|
422
|
-
];
|
|
423
|
-
}
|
|
424
|
-
function eclipticOfDate(x, y, z, tt) {
|
|
425
|
-
const frame = eclipticFrame(tt);
|
|
426
|
-
const [ex, ey, ez] = meanEcliptic(frame, x, y, z);
|
|
427
|
-
return {
|
|
428
|
-
lon: normalizeLongitude(Math.atan2(ey, ex) * RAD2 + frame.tilt.dpsi / 3600),
|
|
429
|
-
lat: Math.asin(ez / Math.hypot(ex, ey, ez)) * RAD2
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// src/points.ts
|
|
434
|
-
var DEG4 = Math.PI / 180;
|
|
435
|
-
var RAD3 = 180 / Math.PI;
|
|
436
|
-
var ARCSEC2 = 1 / 3600;
|
|
303
|
+
var ARCSEC = 1 / 3600;
|
|
437
304
|
function lunarMeanArguments(centuries) {
|
|
438
305
|
const t = centuries;
|
|
439
306
|
const l = 485868.249036 + t * (17179159232178e-4 + t * (31.8792 + t * (0.051635 + t * -2447e-7)));
|
|
440
307
|
const F = 335779.526232 + t * (17395272628478e-4 + t * (-12.7512 + t * (-1037e-6 + t * 417e-8)));
|
|
441
308
|
const node = 450160.398036 + t * (-69628905431e-4 + t * (7.4722 + t * (7702e-6 + t * -5939e-8)));
|
|
442
|
-
return { l: l *
|
|
309
|
+
return { l: l * ARCSEC, F: F * ARCSEC, node: node * ARCSEC };
|
|
443
310
|
}
|
|
444
311
|
var MEAN_LUNAR_INCLINATION = 5.1453964;
|
|
445
|
-
function meanNodeLongitude(centuries,
|
|
446
|
-
return normalizeLongitude(lunarMeanArguments(centuries).node +
|
|
312
|
+
function meanNodeLongitude(centuries, nutation) {
|
|
313
|
+
return normalizeLongitude(lunarMeanArguments(centuries).node + nutation);
|
|
447
314
|
}
|
|
448
|
-
function meanApogee(centuries,
|
|
315
|
+
function meanApogee(centuries, nutation) {
|
|
449
316
|
const { l, F, node } = lunarMeanArguments(centuries);
|
|
450
|
-
const u = (F - l + 180) *
|
|
451
|
-
const i = MEAN_LUNAR_INCLINATION *
|
|
452
|
-
const lon = node + Math.atan2(Math.cos(i) * Math.sin(u), Math.cos(u)) *
|
|
453
|
-
return { lon: normalizeLongitude(lon), lat: Math.asin(Math.sin(i) * Math.sin(u)) *
|
|
317
|
+
const u = (F - l + 180) * DEG2;
|
|
318
|
+
const i = MEAN_LUNAR_INCLINATION * DEG2;
|
|
319
|
+
const lon = node + Math.atan2(Math.cos(i) * Math.sin(u), Math.cos(u)) * RAD2 + nutation;
|
|
320
|
+
return { lon: normalizeLongitude(lon), lat: Math.asin(Math.sin(i) * Math.sin(u)) * RAD2 };
|
|
454
321
|
}
|
|
455
322
|
function sectOf(ascendant, sun) {
|
|
456
323
|
return normalizeLongitude(sun - ascendant) >= 180 ? "day" : "night";
|
|
@@ -498,9 +365,116 @@ import {
|
|
|
498
365
|
MakeTime,
|
|
499
366
|
SetDeltaTFunction
|
|
500
367
|
} from "astronomy-engine";
|
|
501
|
-
var
|
|
368
|
+
var RAD3 = 180 / Math.PI;
|
|
502
369
|
var DAY = 864e5;
|
|
503
370
|
var UTC_CLOCK = { scale: "utc", pin: void 0 };
|
|
371
|
+
var source = null;
|
|
372
|
+
var defaultName = "de440";
|
|
373
|
+
var DEFAULT_MARGIN_DAYS = 1;
|
|
374
|
+
var SECONDS_PER_DAY = 86400;
|
|
375
|
+
var shipped;
|
|
376
|
+
var shippedError = null;
|
|
377
|
+
function shippedDefault() {
|
|
378
|
+
if (shipped !== void 0) return shipped;
|
|
379
|
+
try {
|
|
380
|
+
const opened = shippedDe440Source();
|
|
381
|
+
shipped = {
|
|
382
|
+
source: opened,
|
|
383
|
+
fromTtDays: opened.pack.startEtSecTdb / SECONDS_PER_DAY + DEFAULT_MARGIN_DAYS,
|
|
384
|
+
toTtDays: opened.pack.stopEtSecTdb / SECONDS_PER_DAY - DEFAULT_MARGIN_DAYS
|
|
385
|
+
};
|
|
386
|
+
} catch (error) {
|
|
387
|
+
shipped = null;
|
|
388
|
+
shippedError = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
389
|
+
}
|
|
390
|
+
return shipped;
|
|
391
|
+
}
|
|
392
|
+
var ON_ASTRONOMY_ENGINE = { from: null, fallback: null };
|
|
393
|
+
function chosenAt(ttDays) {
|
|
394
|
+
if (source) return { from: source, fallback: null };
|
|
395
|
+
if (defaultName !== "de440") return ON_ASTRONOMY_ENGINE;
|
|
396
|
+
const pack = shippedDefault();
|
|
397
|
+
if (pack === null) return { from: null, fallback: "de440-unavailable" };
|
|
398
|
+
return ttDays >= pack.fromTtDays && ttDays <= pack.toTtDays ? { from: pack.source, fallback: null } : { from: null, fallback: "outside-de440-span" };
|
|
399
|
+
}
|
|
400
|
+
var noted = null;
|
|
401
|
+
function sourceAt(ttDays) {
|
|
402
|
+
const chosen = chosenAt(ttDays);
|
|
403
|
+
if (chosen.fallback !== null) noted?.add(chosen.fallback);
|
|
404
|
+
return chosen.from;
|
|
405
|
+
}
|
|
406
|
+
function notingFallbacks(run) {
|
|
407
|
+
const outer = noted;
|
|
408
|
+
const mine = /* @__PURE__ */ new Set();
|
|
409
|
+
noted = mine;
|
|
410
|
+
try {
|
|
411
|
+
const value = run();
|
|
412
|
+
return { value, fallbacks: EPHEMERIS_FALLBACKS.filter((reason) => mine.has(reason)) };
|
|
413
|
+
} finally {
|
|
414
|
+
noted = outer;
|
|
415
|
+
if (outer) for (const reason of mine) outer.add(reason);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function fallbacksAt(instants) {
|
|
419
|
+
const met = new Set(instants.map((ms) => Number.isFinite(ms) ? chosenAt(timeBasis(ms, "utc").ttDays).fallback : null));
|
|
420
|
+
return EPHEMERIS_FALLBACKS.filter((reason) => met.has(reason));
|
|
421
|
+
}
|
|
422
|
+
function ephemerisOver(instants) {
|
|
423
|
+
const sources = instants.filter((ms) => Number.isFinite(ms)).map((ms) => chosenAt(timeBasis(ms, "utc").ttDays).from);
|
|
424
|
+
const first = sources[0];
|
|
425
|
+
return first === void 0 || sources.some((from) => from === null) ? { ...EPHEMERIS } : named(first);
|
|
426
|
+
}
|
|
427
|
+
var EPHEMERIS_FALLBACKS = ["de440-unavailable", "outside-de440-span"];
|
|
428
|
+
var named = (from) => from ? { name: from.ephemeris.name, version: from.ephemeris.version } : { ...EPHEMERIS };
|
|
429
|
+
function ephemerisAt(ms, scale = "utc", pin) {
|
|
430
|
+
const { from, fallback } = chosenAt(timeBasis(ms, scale, pin).ttDays);
|
|
431
|
+
return { from, ephemeris: named(from), fallback };
|
|
432
|
+
}
|
|
433
|
+
function defaultEphemeris() {
|
|
434
|
+
const pack = shippedDefault();
|
|
435
|
+
return Object.freeze({
|
|
436
|
+
name: defaultName,
|
|
437
|
+
de440: Object.freeze({
|
|
438
|
+
opened: pack !== null,
|
|
439
|
+
version: pack?.source.ephemeris.version ?? null,
|
|
440
|
+
fromTtDays: pack?.fromTtDays ?? null,
|
|
441
|
+
toTtDays: pack?.toTtDays ?? null,
|
|
442
|
+
error: shippedError
|
|
443
|
+
})
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
function setDefaultEphemeris(name) {
|
|
447
|
+
if (name !== "de440" && name !== "astronomy-engine") throw new TypeError('setDefaultEphemeris takes "de440" or "astronomy-engine"');
|
|
448
|
+
defaultName = name;
|
|
449
|
+
}
|
|
450
|
+
function withEphemeris(positionSource, run) {
|
|
451
|
+
const named2 = positionSource?.ephemeris;
|
|
452
|
+
if (typeof positionSource?.place !== "function" || typeof positionSource.trueNode !== "function" || typeof named2?.name !== "string" || typeof named2.version !== "string" || typeof run !== "function")
|
|
453
|
+
throw new TypeError("withEphemeris needs a position source and a function");
|
|
454
|
+
const previous = source;
|
|
455
|
+
source = positionSource;
|
|
456
|
+
let result;
|
|
457
|
+
try {
|
|
458
|
+
result = run();
|
|
459
|
+
} finally {
|
|
460
|
+
source = previous;
|
|
461
|
+
}
|
|
462
|
+
const later = result;
|
|
463
|
+
if (typeof later?.then === "function" || typeof later?.next === "function") {
|
|
464
|
+
if (typeof later.then === "function") later.then(void 0, () => {
|
|
465
|
+
});
|
|
466
|
+
throw new TypeError("withEphemeris runs synchronous functions only");
|
|
467
|
+
}
|
|
468
|
+
return result;
|
|
469
|
+
}
|
|
470
|
+
function refuseUnderSource(what) {
|
|
471
|
+
if (source) throw new TypeError(`${what} does not run inside withEphemeris: it computes on the engine's own sources, not a caller's`);
|
|
472
|
+
}
|
|
473
|
+
var tidy = (lon) => lon === 360 ? 0 : lon + 0;
|
|
474
|
+
function sourceLongitude(from, body, ttDays, behind) {
|
|
475
|
+
if (body === "North Node") return tidy(from.trueNode(ttDays));
|
|
476
|
+
return body === "South Node" ? normalizeLongitude(from.trueNode(ttDays) + 180) : tidy(from.place(body, ttDays, behind).lon);
|
|
477
|
+
}
|
|
504
478
|
function timeOf(basis) {
|
|
505
479
|
const { from, to } = EPHEMERIS_SPAN.daysFromJ2000;
|
|
506
480
|
if (!(basis.ttDays >= from && basis.ttDays <= to)) {
|
|
@@ -573,12 +547,14 @@ function trueNodeLongitude(time) {
|
|
|
573
547
|
state.z * state.vx - state.x * state.vz,
|
|
574
548
|
state.x * state.vy - state.y * state.vx
|
|
575
549
|
);
|
|
576
|
-
return normalizeLongitude(Math.atan2(x, -y) *
|
|
550
|
+
return normalizeLongitude(Math.atan2(x, -y) * RAD3 + frame.tilt.dpsi / 3600);
|
|
577
551
|
}
|
|
578
552
|
function longitudeAt(body, ms, clock) {
|
|
579
|
-
|
|
553
|
+
const basis = basisAt(ms, clock);
|
|
554
|
+
return longitudeOn(body, basis, sourceAt(basis.ttDays));
|
|
580
555
|
}
|
|
581
|
-
function longitudeOn(body, basis) {
|
|
556
|
+
function longitudeOn(body, basis, from, behind) {
|
|
557
|
+
if (from) return sourceLongitude(from, body, basis.ttDays, behind);
|
|
582
558
|
const time = timeOf(basis);
|
|
583
559
|
if (body === "Moon") return moonOfDate(time).lon;
|
|
584
560
|
if (body === "North Node") return trueNodeLongitude(time);
|
|
@@ -606,11 +582,13 @@ function centralDifference(longitudeOf, ms, clock, stepDays) {
|
|
|
606
582
|
if (difference < -180) difference += 360;
|
|
607
583
|
return difference / elapsedDays(before, after, 2 * stepDays);
|
|
608
584
|
}
|
|
609
|
-
function speedAt(body, ms, clock) {
|
|
610
|
-
const
|
|
611
|
-
|
|
585
|
+
function speedAt(body, ms, clock, from = sourceAt(basisAt(ms, clock).ttDays), behind) {
|
|
586
|
+
const node = body === "North Node" || body === "South Node";
|
|
587
|
+
const stepDays = node ? NODE_SPEED_STEP_DAYS : SPEED_STEP_DAYS;
|
|
588
|
+
const side = from && !node && behind === void 0 ? from.place(body, basisAt(ms, clock).ttDays).behindDisc : behind;
|
|
589
|
+
return centralDifference((basis) => longitudeOn(body, basis, from, side), ms, clock, stepDays);
|
|
612
590
|
}
|
|
613
|
-
function position(body, lon, lat, speed) {
|
|
591
|
+
function position(body, lon, lat, speed, chosen) {
|
|
614
592
|
return {
|
|
615
593
|
body,
|
|
616
594
|
lon,
|
|
@@ -618,30 +596,43 @@ function position(body, lon, lat, speed) {
|
|
|
618
596
|
speed,
|
|
619
597
|
retrograde: speed < 0,
|
|
620
598
|
sign: signForLongitude(lon).slug,
|
|
621
|
-
degree: degreeInSign(lon)
|
|
599
|
+
degree: degreeInSign(lon),
|
|
600
|
+
ephemeris: chosen.from ? chosen.from.ephemeris.name : EPHEMERIS.name,
|
|
601
|
+
...chosen.fallback !== null && { fallback: chosen.fallback }
|
|
622
602
|
};
|
|
623
603
|
}
|
|
624
604
|
function computeBodies(date) {
|
|
625
605
|
return evaluated(() => bodiesAt(date.getTime(), UTC_CLOCK));
|
|
626
606
|
}
|
|
627
|
-
function bodiesAt(ms, clock) {
|
|
607
|
+
function bodiesAt(ms, clock, chosen = chosenAt(basisAt(ms, clock).ttDays)) {
|
|
608
|
+
if (chosen.fallback !== null) noted?.add(chosen.fallback);
|
|
609
|
+
if (chosen.from) return sourceBodiesAt(chosen, chosen.from, ms, clock);
|
|
628
610
|
const bodies = [];
|
|
629
611
|
for (const planet of PLANETS) {
|
|
630
612
|
const coordinates = planetOfDate(planet.body, timeAt(ms, clock));
|
|
631
613
|
bodies.push(
|
|
632
|
-
position(planet.name, coordinates.lon, coordinates.lat, speedAt(planet.name, ms, clock))
|
|
614
|
+
position(planet.name, coordinates.lon, coordinates.lat, speedAt(planet.name, ms, clock, null), chosen)
|
|
633
615
|
);
|
|
634
616
|
}
|
|
635
617
|
const moon = moonOfDate(timeAt(ms, clock));
|
|
636
|
-
bodies.splice(1, 0, position("Moon", moon.lon, moon.lat, speedAt("Moon", ms, clock)));
|
|
618
|
+
bodies.splice(1, 0, position("Moon", moon.lon, moon.lat, speedAt("Moon", ms, clock, null), chosen));
|
|
637
619
|
const northNode = trueNodeLongitude(timeAt(ms, clock));
|
|
638
|
-
const nodeSpeed = speedAt("North Node", ms, clock);
|
|
620
|
+
const nodeSpeed = speedAt("North Node", ms, clock, null);
|
|
639
621
|
bodies.push(
|
|
640
|
-
position("North Node", northNode, 0, nodeSpeed),
|
|
641
|
-
position("South Node", normalizeLongitude(northNode + 180), 0, nodeSpeed)
|
|
622
|
+
position("North Node", northNode, 0, nodeSpeed, chosen),
|
|
623
|
+
position("South Node", normalizeLongitude(northNode + 180), 0, nodeSpeed, chosen)
|
|
642
624
|
);
|
|
643
625
|
return bodies;
|
|
644
626
|
}
|
|
627
|
+
function sourceBodiesAt(chosen, from, ms, clock) {
|
|
628
|
+
const tt = basisAt(ms, clock).ttDays;
|
|
629
|
+
return ["Sun", "Moon", "Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto", "North Node", "South Node"].map(
|
|
630
|
+
(body) => {
|
|
631
|
+
const place = body === "North Node" || body === "South Node" ? { lon: sourceLongitude(from, body, tt), lat: 0 } : from.place(body, tt);
|
|
632
|
+
return position(body, tidy(place.lon), place.lat, speedAt(body, ms, clock, from, "behindDisc" in place ? place.behindDisc : void 0), chosen);
|
|
633
|
+
}
|
|
634
|
+
);
|
|
635
|
+
}
|
|
645
636
|
var clockOf = (input) => ({
|
|
646
637
|
scale: input.timeScale ?? "utc",
|
|
647
638
|
pin: input.deltaT
|
|
@@ -653,8 +644,10 @@ function chartAt(input) {
|
|
|
653
644
|
const flags = [...input.flags ?? []];
|
|
654
645
|
const ms = input.utc.getTime();
|
|
655
646
|
const clock = clockOf(input);
|
|
656
|
-
const bodies = bodiesAt(ms, clock);
|
|
657
647
|
const basis = timeBasis(ms, clock.scale, clock.pin);
|
|
648
|
+
const chosen = chosenAt(basis.ttDays);
|
|
649
|
+
const { from, fallback } = chosen;
|
|
650
|
+
const bodies = bodiesAt(ms, clock, chosen);
|
|
658
651
|
let angles = null;
|
|
659
652
|
let houses = null;
|
|
660
653
|
if (input.timeKnown && input.latitude !== void 0 && input.longitude !== void 0) {
|
|
@@ -673,6 +666,8 @@ function chartAt(input) {
|
|
|
673
666
|
flags.push("no-time");
|
|
674
667
|
}
|
|
675
668
|
if (outsideReferenceSpan(input.utc)) flags.push("outside-reference-span");
|
|
669
|
+
deltaTExtrapolated(basis, angles) && flags.push("delta-t-extrapolated");
|
|
670
|
+
if (fallback !== null) flags.push(fallback);
|
|
676
671
|
return {
|
|
677
672
|
input,
|
|
678
673
|
bodies,
|
|
@@ -682,14 +677,16 @@ function chartAt(input) {
|
|
|
682
677
|
flags,
|
|
683
678
|
deltaT: basis.deltaT,
|
|
684
679
|
timeScale: basis.timeScale,
|
|
685
|
-
engineVersion: ENGINE_VERSION
|
|
680
|
+
engineVersion: ENGINE_VERSION,
|
|
681
|
+
ephemeris: named(from)
|
|
686
682
|
};
|
|
687
683
|
}
|
|
684
|
+
var deltaTExtrapolated = ({ deltaT: d, timeScale: t }, ut1) => (ut1 || t.input != "tt") && t.basis == "delta-t" && /^e/.test(d.segment);
|
|
688
685
|
function meanLunarPoints(basis) {
|
|
689
686
|
const time = timeOf(basis);
|
|
690
687
|
const centuries = time.tt / 36525;
|
|
691
|
-
const
|
|
692
|
-
return { node: meanNodeLongitude(centuries,
|
|
688
|
+
const nutation = tilt(time.tt).dpsi / 3600;
|
|
689
|
+
return { node: meanNodeLongitude(centuries, nutation), apogee: meanApogee(centuries, nutation) };
|
|
693
690
|
}
|
|
694
691
|
function pointPosition(point, lon, lat, speed) {
|
|
695
692
|
const longitude = normalizeLongitude(lon);
|
|
@@ -703,7 +700,15 @@ function pointPosition(point, lon, lat, speed) {
|
|
|
703
700
|
};
|
|
704
701
|
}
|
|
705
702
|
function computePoints(chart) {
|
|
706
|
-
return evaluated(() => pointsAt(chart));
|
|
703
|
+
return { ...evaluated(() => pointsAt(chart)), ...chartLabel(chart) };
|
|
704
|
+
}
|
|
705
|
+
function chartLabel(chart) {
|
|
706
|
+
const named2 = chart.ephemeris;
|
|
707
|
+
const flags = Array.isArray(chart.flags) ? chart.flags : [];
|
|
708
|
+
return {
|
|
709
|
+
ephemeris: named2 ? { name: named2.name, version: named2.version } : null,
|
|
710
|
+
flags: EPHEMERIS_FALLBACKS.filter((reason) => flags.includes(reason))
|
|
711
|
+
};
|
|
707
712
|
}
|
|
708
713
|
function computeChartDeclinations(chart) {
|
|
709
714
|
const input = chart?.input;
|
|
@@ -723,7 +728,8 @@ function computeChartDeclinations(chart) {
|
|
|
723
728
|
return {
|
|
724
729
|
...chartBodyDeclinations(bodies, tilt(timeOf(basis).tt).tobl),
|
|
725
730
|
utc: date.toISOString(),
|
|
726
|
-
deltaT: basis.deltaT
|
|
731
|
+
deltaT: basis.deltaT,
|
|
732
|
+
...chartLabel(chart)
|
|
727
733
|
};
|
|
728
734
|
});
|
|
729
735
|
}
|
|
@@ -794,10 +800,6 @@ export {
|
|
|
794
800
|
declinationOrb,
|
|
795
801
|
findDeclinationAspects,
|
|
796
802
|
declinationsForBodies,
|
|
797
|
-
tilt,
|
|
798
|
-
eclipticFrame,
|
|
799
|
-
meanEcliptic,
|
|
800
|
-
eclipticOfDate,
|
|
801
803
|
lunarMeanArguments,
|
|
802
804
|
MEAN_LUNAR_INCLINATION,
|
|
803
805
|
meanNodeLongitude,
|
|
@@ -808,6 +810,14 @@ export {
|
|
|
808
810
|
antiscion,
|
|
809
811
|
contraAntiscion,
|
|
810
812
|
midpoint,
|
|
813
|
+
notingFallbacks,
|
|
814
|
+
fallbacksAt,
|
|
815
|
+
ephemerisOver,
|
|
816
|
+
ephemerisAt,
|
|
817
|
+
defaultEphemeris,
|
|
818
|
+
setDefaultEphemeris,
|
|
819
|
+
withEphemeris,
|
|
820
|
+
refuseUnderSource,
|
|
811
821
|
gastHours,
|
|
812
822
|
onChartClock,
|
|
813
823
|
bodyLongitude,
|
|
@@ -815,6 +825,7 @@ export {
|
|
|
815
825
|
longitudeSpeed,
|
|
816
826
|
computeBodies,
|
|
817
827
|
computeChart,
|
|
828
|
+
deltaTExtrapolated,
|
|
818
829
|
computePoints,
|
|
819
830
|
computeChartDeclinations
|
|
820
831
|
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// src/signs.ts
|
|
2
|
+
var ELEMENTS = /* @__PURE__ */ Object.freeze(["fire", "earth", "air", "water"]);
|
|
3
|
+
var MODALITIES = /* @__PURE__ */ Object.freeze(["cardinal", "fixed", "mutable"]);
|
|
4
|
+
var SIGNS = /* @__PURE__ */ Object.freeze([
|
|
5
|
+
/* @__PURE__ */ Object.freeze({
|
|
6
|
+
slug: "aries",
|
|
7
|
+
name: "Aries",
|
|
8
|
+
element: "fire",
|
|
9
|
+
modality: "cardinal",
|
|
10
|
+
polarity: "day",
|
|
11
|
+
naturalHouse: 1
|
|
12
|
+
}),
|
|
13
|
+
/* @__PURE__ */ Object.freeze({
|
|
14
|
+
slug: "taurus",
|
|
15
|
+
name: "Taurus",
|
|
16
|
+
element: "earth",
|
|
17
|
+
modality: "fixed",
|
|
18
|
+
polarity: "night",
|
|
19
|
+
naturalHouse: 2
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ Object.freeze({
|
|
22
|
+
slug: "gemini",
|
|
23
|
+
name: "Gemini",
|
|
24
|
+
element: "air",
|
|
25
|
+
modality: "mutable",
|
|
26
|
+
polarity: "day",
|
|
27
|
+
naturalHouse: 3
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ Object.freeze({
|
|
30
|
+
slug: "cancer",
|
|
31
|
+
name: "Cancer",
|
|
32
|
+
element: "water",
|
|
33
|
+
modality: "cardinal",
|
|
34
|
+
polarity: "night",
|
|
35
|
+
naturalHouse: 4
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ Object.freeze({
|
|
38
|
+
slug: "leo",
|
|
39
|
+
name: "Leo",
|
|
40
|
+
element: "fire",
|
|
41
|
+
modality: "fixed",
|
|
42
|
+
polarity: "day",
|
|
43
|
+
naturalHouse: 5
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ Object.freeze({
|
|
46
|
+
slug: "virgo",
|
|
47
|
+
name: "Virgo",
|
|
48
|
+
element: "earth",
|
|
49
|
+
modality: "mutable",
|
|
50
|
+
polarity: "night",
|
|
51
|
+
naturalHouse: 6
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ Object.freeze({
|
|
54
|
+
slug: "libra",
|
|
55
|
+
name: "Libra",
|
|
56
|
+
element: "air",
|
|
57
|
+
modality: "cardinal",
|
|
58
|
+
polarity: "day",
|
|
59
|
+
naturalHouse: 7
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ Object.freeze({
|
|
62
|
+
slug: "scorpio",
|
|
63
|
+
name: "Scorpio",
|
|
64
|
+
element: "water",
|
|
65
|
+
modality: "fixed",
|
|
66
|
+
polarity: "night",
|
|
67
|
+
naturalHouse: 8
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ Object.freeze({
|
|
70
|
+
slug: "sagittarius",
|
|
71
|
+
name: "Sagittarius",
|
|
72
|
+
element: "fire",
|
|
73
|
+
modality: "mutable",
|
|
74
|
+
polarity: "day",
|
|
75
|
+
naturalHouse: 9
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ Object.freeze({
|
|
78
|
+
slug: "capricorn",
|
|
79
|
+
name: "Capricorn",
|
|
80
|
+
element: "earth",
|
|
81
|
+
modality: "cardinal",
|
|
82
|
+
polarity: "night",
|
|
83
|
+
naturalHouse: 10
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ Object.freeze({
|
|
86
|
+
slug: "aquarius",
|
|
87
|
+
name: "Aquarius",
|
|
88
|
+
element: "air",
|
|
89
|
+
modality: "fixed",
|
|
90
|
+
polarity: "day",
|
|
91
|
+
naturalHouse: 11
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ Object.freeze({
|
|
94
|
+
slug: "pisces",
|
|
95
|
+
name: "Pisces",
|
|
96
|
+
element: "water",
|
|
97
|
+
modality: "mutable",
|
|
98
|
+
polarity: "night",
|
|
99
|
+
naturalHouse: 12
|
|
100
|
+
})
|
|
101
|
+
]);
|
|
102
|
+
var SIGN_SLUGS = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ SIGNS.map((sign) => sign.slug));
|
|
103
|
+
var SIGN_NAMES = SIGN_SLUGS;
|
|
104
|
+
function normalizeLongitude(lon) {
|
|
105
|
+
if (!Number.isFinite(lon)) throw new RangeError("Longitude must be finite.");
|
|
106
|
+
return (lon % 360 + 360) % 360;
|
|
107
|
+
}
|
|
108
|
+
function signIndexForLongitude(lon) {
|
|
109
|
+
return Math.floor(normalizeLongitude(lon) / 30);
|
|
110
|
+
}
|
|
111
|
+
function signForLongitude(lon) {
|
|
112
|
+
const sign = SIGNS[signIndexForLongitude(lon)];
|
|
113
|
+
if (!sign) throw new RangeError("Could not resolve zodiac sign.");
|
|
114
|
+
return sign;
|
|
115
|
+
}
|
|
116
|
+
function degreeInSign(lon) {
|
|
117
|
+
return normalizeLongitude(lon) % 30;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export {
|
|
121
|
+
ELEMENTS,
|
|
122
|
+
MODALITIES,
|
|
123
|
+
SIGNS,
|
|
124
|
+
SIGN_SLUGS,
|
|
125
|
+
SIGN_NAMES,
|
|
126
|
+
normalizeLongitude,
|
|
127
|
+
signIndexForLongitude,
|
|
128
|
+
signForLongitude,
|
|
129
|
+
degreeInSign
|
|
130
|
+
};
|