@zodiacs/engine 0.1.1-rc.14 → 0.1.1-rc.16

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 (64) hide show
  1. package/CHANGELOG.md +797 -6
  2. package/LICENSING.md +354 -21
  3. package/NOTICE +166 -9
  4. package/README.md +327 -84
  5. package/dist/api-VOW6Umy5.d.ts +197 -0
  6. package/dist/calc.d.ts +279 -0
  7. package/dist/calc.js +853 -0
  8. package/dist/{chunk-NAJ735VN.js → chunk-2OWGBT3O.js} +1 -1
  9. package/dist/{chunk-4OSOCZY2.js → chunk-4NV4ZEFZ.js} +21 -6
  10. package/dist/chunk-A3U2ZS2W.js +29 -0
  11. package/dist/chunk-I7O5EGFV.js +25 -0
  12. package/dist/chunk-KFTJMMG7.js +61 -0
  13. package/dist/chunk-KHBLFXFG.js +227 -0
  14. package/dist/chunk-L6ZHWJZ6.js +355 -0
  15. package/dist/chunk-N4B5JNMA.js +473 -0
  16. package/dist/chunk-O3NJRGJ2.js +56 -0
  17. package/dist/{chunk-RETEVD4F.js → chunk-WOU7JVD3.js} +293 -154
  18. package/dist/crossings.d.ts +1 -1
  19. package/dist/deltat.d.ts +8 -8
  20. package/dist/geo.d.ts +137 -8
  21. package/dist/geo.js +28 -166
  22. package/dist/houses-extra.d.ts +81 -0
  23. package/dist/houses-extra.js +337 -0
  24. package/dist/houses-q1O2GGp4.d.ts +128 -0
  25. package/dist/index.d.ts +8 -201
  26. package/dist/index.js +38 -315
  27. package/dist/internal-math-CmJ9xtaW.d.ts +160 -0
  28. package/dist/internal-math.d.ts +3 -2
  29. package/dist/internal-math.js +2 -2
  30. package/dist/internal.d.ts +2 -1
  31. package/dist/internal.js +4 -4
  32. package/dist/receipt.d.ts +74 -29
  33. package/dist/receipt.js +194 -33
  34. package/dist/rulers-9wljfVaO.d.ts +10 -0
  35. package/dist/sky.d.ts +158 -0
  36. package/dist/sky.js +377 -0
  37. package/dist/techniques.d.ts +410 -0
  38. package/dist/techniques.js +830 -0
  39. package/dist/timing.d.ts +473 -0
  40. package/dist/timing.js +904 -0
  41. package/dist/{types-CeafogFp.d.ts → types-B4MCoCCS.d.ts} +35 -4
  42. package/dist/tzdb-2025c-00-6GVG6RYL.js +6 -0
  43. package/dist/tzdb-2025c-01-CEYMG3LE.js +6 -0
  44. package/dist/tzdb-2025c-02-NWQJCVUU.js +6 -0
  45. package/dist/tzdb-2025c-03-PLHP6VH4.js +6 -0
  46. package/dist/tzdb-2025c-04-MEKUJA6M.js +6 -0
  47. package/dist/tzdb-2025c-05-3K5YKZBL.js +6 -0
  48. package/dist/tzdb-2025c-06-L2VV5XJV.js +6 -0
  49. package/dist/tzdb-2025c-07-H3GLGJGY.js +6 -0
  50. package/dist/tzdb-2025c-08-DA7QQIGD.js +6 -0
  51. package/dist/tzdb-2025c-09-MTXIO3QL.js +6 -0
  52. package/dist/tzdb-2025c-10-ASL4UW5C.js +6 -0
  53. package/dist/tzdb-2025c-11-EQEOANYB.js +6 -0
  54. package/dist/tzdb-2025c-12-NKCCXJ5G.js +6 -0
  55. package/dist/tzdb-2025c-13-DYTF3UC7.js +6 -0
  56. package/dist/tzdb-2025c-14-C25H45R5.js +6 -0
  57. package/dist/tzdb-2025c-15-7OYYZWRY.js +6 -0
  58. package/dist/vedic.d.ts +393 -0
  59. package/dist/vedic.js +930 -0
  60. package/dist/window.d.ts +178 -0
  61. package/dist/window.js +961 -0
  62. package/package.json +31 -3
  63. package/dist/chunk-GFT24GFR.js +0 -25
  64. package/dist/internal-math-BE2hcSHd.d.ts +0 -271
@@ -1,24 +1,26 @@
1
+ import {
2
+ EPHEMERIS_SPAN,
3
+ elapsedDays,
4
+ outsideReferenceSpan,
5
+ timeBasis
6
+ } from "./chunk-KHBLFXFG.js";
7
+ import {
8
+ deltaT
9
+ } from "./chunk-ONBZ4HK7.js";
1
10
  import {
2
11
  computeAngles,
3
12
  computeHouses,
4
13
  eastPointOf,
14
+ meanObliquity,
5
15
  vertexOf
6
- } from "./chunk-4OSOCZY2.js";
7
- import {
8
- EPHEMERIS_SPAN,
9
- outsideReferenceSpan
10
- } from "./chunk-GFT24GFR.js";
11
- import {
12
- deltaT,
13
- deltaTAt
14
- } from "./chunk-ONBZ4HK7.js";
16
+ } from "./chunk-4NV4ZEFZ.js";
15
17
  import {
16
18
  ENGINE_VERSION,
17
19
  degreeInSign,
18
20
  findAspects,
19
21
  normalizeLongitude,
20
22
  signForLongitude
21
- } from "./chunk-NAJ735VN.js";
23
+ } from "./chunk-2OWGBT3O.js";
22
24
 
23
25
  // src/body-label.ts
24
26
  var MAX_BODY_LABEL_LENGTH = 80;
@@ -166,11 +168,11 @@ function eclipticToEquatorial(longitudeDeg, latitudeDeg, trueObliquityDeg) {
166
168
  obliquity(trueObliquityDeg);
167
169
  const lon = normalize(longitudeDeg) * DEG;
168
170
  const lat = latitudeDeg * DEG;
169
- const tilt = trueObliquityDeg * DEG;
171
+ const tilt2 = trueObliquityDeg * DEG;
170
172
  const cosLat = Math.cos(lat);
171
173
  const x = cosLat * Math.cos(lon);
172
- const y = cosLat * Math.sin(lon) * Math.cos(tilt) - Math.sin(lat) * Math.sin(tilt);
173
- const z = cosLat * Math.sin(lon) * Math.sin(tilt) + Math.sin(lat) * Math.cos(tilt);
174
+ const y = cosLat * Math.sin(lon) * Math.cos(tilt2) - Math.sin(lat) * Math.sin(tilt2);
175
+ const z = cosLat * Math.sin(lon) * Math.sin(tilt2) + Math.sin(lat) * Math.cos(tilt2);
174
176
  const horizontal = Math.hypot(x, y);
175
177
  const raDefined = horizontal > RA_POLE_TOLERANCE;
176
178
  let dec = trueObliquityDeg === 0 ? latitudeDeg : Math.atan2(z, horizontal) * RAD;
@@ -282,27 +284,173 @@ function chartBodyDeclinations(bodies, trueObliquity) {
282
284
  return declinations(bodies, trueObliquity, DEFAULT_DECLINATION_ORB_POLICY, true);
283
285
  }
284
286
 
285
- // src/points.ts
287
+ // src/nutation.ts
286
288
  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;
287
365
  var RAD2 = 180 / Math.PI;
288
- var ARCSEC = 1 / 3600;
366
+ var last;
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;
289
437
  function lunarMeanArguments(centuries) {
290
438
  const t = centuries;
291
439
  const l = 485868.249036 + t * (17179159232178e-4 + t * (31.8792 + t * (0.051635 + t * -2447e-7)));
292
440
  const F = 335779.526232 + t * (17395272628478e-4 + t * (-12.7512 + t * (-1037e-6 + t * 417e-8)));
293
441
  const node = 450160.398036 + t * (-69628905431e-4 + t * (7.4722 + t * (7702e-6 + t * -5939e-8)));
294
- return { l: l * ARCSEC, F: F * ARCSEC, node: node * ARCSEC };
442
+ return { l: l * ARCSEC2, F: F * ARCSEC2, node: node * ARCSEC2 };
295
443
  }
296
444
  var MEAN_LUNAR_INCLINATION = 5.1453964;
297
- function meanNodeLongitude(centuries, nutation) {
298
- return normalizeLongitude(lunarMeanArguments(centuries).node + nutation);
445
+ function meanNodeLongitude(centuries, nutation2) {
446
+ return normalizeLongitude(lunarMeanArguments(centuries).node + nutation2);
299
447
  }
300
- function meanApogee(centuries, nutation) {
448
+ function meanApogee(centuries, nutation2) {
301
449
  const { l, F, node } = lunarMeanArguments(centuries);
302
- const u = (F - l + 180) * DEG2;
303
- const i = MEAN_LUNAR_INCLINATION * DEG2;
304
- const lon = node + Math.atan2(Math.cos(i) * Math.sin(u), Math.cos(u)) * RAD2 + nutation;
305
- return { lon: normalizeLongitude(lon), lat: Math.asin(Math.sin(i) * Math.sin(u)) * RAD2 };
450
+ const u = (F - l + 180) * DEG4;
451
+ const i = MEAN_LUNAR_INCLINATION * DEG4;
452
+ const lon = node + Math.atan2(Math.cos(i) * Math.sin(u), Math.cos(u)) * RAD3 + nutation2;
453
+ return { lon: normalizeLongitude(lon), lat: Math.asin(Math.sin(i) * Math.sin(u)) * RAD3 };
306
454
  }
307
455
  function sectOf(ascendant, sun) {
308
456
  return normalizeLongitude(sun - ascendant) >= 180 ? "day" : "night";
@@ -344,48 +492,58 @@ function midpoint(first, second) {
344
492
  // src/ephemeris.ts
345
493
  import {
346
494
  Body,
347
- EclipticGeoMoon,
495
+ GeoMoon,
348
496
  GeoMoonState,
349
497
  GeoVector,
350
498
  MakeTime,
351
- RotateVector,
352
- Rotation_EQJ_ECT,
353
- SetDeltaTFunction,
354
- SiderealTime,
355
- Vector,
356
- e_tilt
499
+ SetDeltaTFunction
357
500
  } from "astronomy-engine";
358
- var RAD3 = 180 / Math.PI;
359
- var J2000_MS = Date.UTC(2e3, 0, 1, 12);
360
- function clock(pin) {
361
- SetDeltaTFunction(pin === void 0 ? deltaT : () => pin);
501
+ var RAD4 = 180 / Math.PI;
502
+ var DAY = 864e5;
503
+ var UTC_CLOCK = { scale: "utc", pin: void 0 };
504
+ function timeOf(basis) {
505
+ const { from, to } = EPHEMERIS_SPAN.daysFromJ2000;
506
+ if (!(basis.ttDays >= from && basis.ttDays <= to)) {
507
+ throw new RangeError(
508
+ "The instant is outside the ephemeris span: its Terrestrial Time, and that of each speed sample, must lie between 0001-04-30T12:00 and 3998-09-03T12:00 TT, the years astronomy-engine tabulates (EPHEMERIS_SPAN)."
509
+ );
510
+ }
511
+ const seconds = basis.deltaT.seconds;
512
+ SetDeltaTFunction(() => seconds);
513
+ return MakeTime(basis.ut1Days);
514
+ }
515
+ function sample(ms, stepDays) {
516
+ return ms + stepDays * DAY;
362
517
  }
518
+ var basisAt = (ms, clock) => timeBasis(ms, clock.scale, clock.pin);
519
+ var timeAt = (ms, clock) => timeOf(basisAt(ms, clock));
363
520
  function evaluated(run) {
364
521
  try {
365
522
  return run();
366
523
  } catch (thrown) {
367
524
  if (thrown instanceof Error) throw thrown;
368
525
  throw new RangeError(`The ephemeris could not evaluate this instant: ${String(thrown)}`, { cause: thrown });
526
+ } finally {
527
+ SetDeltaTFunction(deltaT);
369
528
  }
370
529
  }
371
- function timeOf(date) {
372
- const time = Number.isFinite(date.getTime()) ? MakeTime(date) : null;
373
- const { from, to } = EPHEMERIS_SPAN.daysFromJ2000;
374
- if (!(time !== null && time.tt >= from && time.tt <= to)) {
375
- throw new RangeError(
376
- "The instant is outside the ephemeris span: its Terrestrial Time, and that of each speed sample, must lie between 0001-04-30T12:00 and 3998-09-03T12:00 TT, the years astronomy-engine tabulates (EPHEMERIS_SPAN)."
377
- );
378
- }
379
- return time;
380
- }
381
- function sampleDate(date, stepDays) {
382
- return new Date(date.getTime() + stepDays * 864e5);
383
- }
384
- function deltaTFor(date, pin) {
385
- if (pin !== void 0) {
386
- return { seconds: pin, sigma: null, model: "pinned", table: null, tableDigest: null, segment: "pinned" };
387
- }
388
- return deltaTAt((date.getTime() - J2000_MS) / 864e5);
530
+ function gastHours(time) {
531
+ const t = time.tt / 36525;
532
+ const eqeq = tilt(time.tt).ee;
533
+ const thet1 = 0.779057273264 + 0.00273781191135448 * time.ut;
534
+ const thet3 = time.ut % 1;
535
+ let theta = 360 * ((thet1 + thet3) % 1);
536
+ if (theta < 0) theta += 360;
537
+ const st = eqeq + 0.014506 + ((((-368e-10 * t - 29956e-9) * t - 44e-8) * t + 1.3915817) * t + 4612.156534) * t;
538
+ let gst = (st / 3600 + theta) % 360 / 15;
539
+ if (gst < 0) gst += 24;
540
+ return gst;
541
+ }
542
+ function onChartClock(ms, scale, pin, fn) {
543
+ return evaluated(() => {
544
+ const basis = timeBasis(ms, scale, pin);
545
+ return fn(timeOf(basis), basis);
546
+ });
389
547
  }
390
548
  var PLANETS = [
391
549
  { name: "Sun", body: Body.Sun },
@@ -398,64 +556,59 @@ var PLANETS = [
398
556
  { name: "Neptune", body: Body.Neptune },
399
557
  { name: "Pluto", body: Body.Pluto }
400
558
  ];
401
- function eclipticOfDate(body, date) {
402
- const time = timeOf(date);
559
+ function planetOfDate(body, time) {
403
560
  const equatorial = GeoVector(body, time, true);
404
- const ecliptic = RotateVector(Rotation_EQJ_ECT(time), equatorial);
405
- const lon = normalizeLongitude(Math.atan2(ecliptic.y, ecliptic.x) * RAD3);
406
- const lat = Math.asin(ecliptic.z / Math.hypot(ecliptic.x, ecliptic.y, ecliptic.z)) * RAD3;
407
- return { lon, lat };
561
+ return eclipticOfDate(equatorial.x, equatorial.y, equatorial.z, time.tt);
408
562
  }
409
- function moonOfDate(date) {
410
- const moon = EclipticGeoMoon(timeOf(date));
411
- return { lon: normalizeLongitude(moon.lon), lat: moon.lat };
563
+ function moonOfDate(time) {
564
+ const equatorial = GeoMoon(time);
565
+ return eclipticOfDate(equatorial.x, equatorial.y, equatorial.z, time.tt);
412
566
  }
413
- function trueNodeLongitude(date) {
414
- const time = timeOf(date);
567
+ function trueNodeLongitude(time) {
415
568
  const state = GeoMoonState(time);
416
- const angularMomentum = {
417
- x: state.y * state.vz - state.z * state.vy,
418
- y: state.z * state.vx - state.x * state.vz,
419
- z: state.x * state.vy - state.y * state.vx
420
- };
421
- const eclipticMomentum = RotateVector(
422
- Rotation_EQJ_ECT(time),
423
- new Vector(angularMomentum.x, angularMomentum.y, angularMomentum.z, time)
569
+ const frame = eclipticFrame(time.tt);
570
+ const [x, y] = meanEcliptic(
571
+ frame,
572
+ state.y * state.vz - state.z * state.vy,
573
+ state.z * state.vx - state.x * state.vz,
574
+ state.x * state.vy - state.y * state.vx
424
575
  );
425
- return normalizeLongitude(Math.atan2(eclipticMomentum.x, -eclipticMomentum.y) * RAD3);
576
+ return normalizeLongitude(Math.atan2(x, -y) * RAD4 + frame.tilt.dpsi / 3600);
577
+ }
578
+ function longitudeAt(body, ms, clock) {
579
+ return longitudeOn(body, basisAt(ms, clock));
426
580
  }
427
- function longitudeAt(body, date) {
428
- if (body === "Moon") return moonOfDate(date).lon;
429
- if (body === "North Node") return trueNodeLongitude(date);
581
+ function longitudeOn(body, basis) {
582
+ const time = timeOf(basis);
583
+ if (body === "Moon") return moonOfDate(time).lon;
584
+ if (body === "North Node") return trueNodeLongitude(time);
430
585
  if (body === "South Node") {
431
- return normalizeLongitude(trueNodeLongitude(date) + 180);
586
+ return normalizeLongitude(trueNodeLongitude(time) + 180);
432
587
  }
433
588
  const planet = PLANETS.find((candidate) => candidate.name === body);
434
589
  if (!planet) throw new RangeError(`Unknown body: ${body}`);
435
- return eclipticOfDate(planet.body, date).lon;
590
+ return planetOfDate(planet.body, time).lon;
436
591
  }
437
592
  function bodyLongitude(body, date) {
438
- return evaluated(() => {
439
- clock();
440
- return longitudeAt(body, date);
441
- });
593
+ return evaluated(() => longitudeAt(body, date.getTime(), UTC_CLOCK));
442
594
  }
443
595
  var SPEED_STEP_DAYS = 1e-3;
444
596
  var NODE_SPEED_STEP_DAYS = 0.25;
445
597
  function longitudeSpeed(body, date) {
446
- return evaluated(() => {
447
- clock();
448
- return speedAt(body, date);
449
- });
598
+ return evaluated(() => speedAt(body, date.getTime(), UTC_CLOCK));
450
599
  }
451
- function speedAt(body, date) {
452
- const stepDays = body === "North Node" || body === "South Node" ? NODE_SPEED_STEP_DAYS : SPEED_STEP_DAYS;
453
- const before = longitudeAt(body, sampleDate(date, -stepDays));
454
- const after = longitudeAt(body, sampleDate(date, stepDays));
455
- let difference = after - before;
600
+ function centralDifference(longitudeOf, ms, clock, stepDays) {
601
+ const before = basisAt(sample(ms, -stepDays), clock);
602
+ const lonBefore = longitudeOf(before);
603
+ const after = basisAt(sample(ms, stepDays), clock);
604
+ let difference = longitudeOf(after) - lonBefore;
456
605
  if (difference > 180) difference -= 360;
457
606
  if (difference < -180) difference += 360;
458
- return difference / (2 * stepDays);
607
+ return difference / elapsedDays(before, after, 2 * stepDays);
608
+ }
609
+ function speedAt(body, ms, clock) {
610
+ const stepDays = body === "North Node" || body === "South Node" ? NODE_SPEED_STEP_DAYS : SPEED_STEP_DAYS;
611
+ return centralDifference((basis) => longitudeOn(body, basis), ms, clock, stepDays);
459
612
  }
460
613
  function position(body, lon, lat, speed) {
461
614
  return {
@@ -469,52 +622,48 @@ function position(body, lon, lat, speed) {
469
622
  };
470
623
  }
471
624
  function computeBodies(date) {
472
- return evaluated(() => {
473
- clock();
474
- return bodiesAt(date);
475
- });
625
+ return evaluated(() => bodiesAt(date.getTime(), UTC_CLOCK));
476
626
  }
477
- function bodiesAt(date) {
627
+ function bodiesAt(ms, clock) {
478
628
  const bodies = [];
479
629
  for (const planet of PLANETS) {
480
- const coordinates = eclipticOfDate(planet.body, date);
630
+ const coordinates = planetOfDate(planet.body, timeAt(ms, clock));
481
631
  bodies.push(
482
- position(planet.name, coordinates.lon, coordinates.lat, speedAt(planet.name, date))
632
+ position(planet.name, coordinates.lon, coordinates.lat, speedAt(planet.name, ms, clock))
483
633
  );
484
634
  }
485
- const moon = moonOfDate(date);
486
- bodies.splice(1, 0, position("Moon", moon.lon, moon.lat, speedAt("Moon", date)));
487
- const northNode = trueNodeLongitude(date);
488
- const nodeSpeed = speedAt("North Node", date);
635
+ const moon = moonOfDate(timeAt(ms, clock));
636
+ bodies.splice(1, 0, position("Moon", moon.lon, moon.lat, speedAt("Moon", ms, clock)));
637
+ const northNode = trueNodeLongitude(timeAt(ms, clock));
638
+ const nodeSpeed = speedAt("North Node", ms, clock);
489
639
  bodies.push(
490
640
  position("North Node", northNode, 0, nodeSpeed),
491
641
  position("South Node", normalizeLongitude(northNode + 180), 0, nodeSpeed)
492
642
  );
493
643
  return bodies;
494
644
  }
645
+ var clockOf = (input) => ({
646
+ scale: input.timeScale ?? "utc",
647
+ pin: input.deltaT
648
+ });
495
649
  function computeChart(input) {
496
- const pin = input.deltaT;
497
- return evaluated(() => {
498
- clock(pin);
499
- try {
500
- return chartAt(input, pin);
501
- } finally {
502
- if (pin !== void 0) clock();
503
- }
504
- });
650
+ return evaluated(() => chartAt(input));
505
651
  }
506
- function chartAt(input, pin) {
652
+ function chartAt(input) {
507
653
  const flags = [...input.flags ?? []];
508
- const bodies = bodiesAt(input.utc);
654
+ const ms = input.utc.getTime();
655
+ const clock = clockOf(input);
656
+ const bodies = bodiesAt(ms, clock);
657
+ const basis = timeBasis(ms, clock.scale, clock.pin);
509
658
  let angles = null;
510
659
  let houses = null;
511
660
  if (input.timeKnown && input.latitude !== void 0 && input.longitude !== void 0) {
512
- const time = timeOf(input.utc);
661
+ const time = timeOf(basis);
513
662
  const angleInput = {
514
- gastHours: SiderealTime(time),
663
+ gastHours: gastHours(time),
515
664
  latitude: input.latitude,
516
665
  longitude: input.longitude,
517
- obliquity: e_tilt(time).tobl
666
+ obliquity: tilt(time.tt).tobl
518
667
  };
519
668
  angles = computeAngles(angleInput);
520
669
  const result = computeHouses(input.houseSystem, angleInput, angles);
@@ -531,23 +680,16 @@ function chartAt(input, pin) {
531
680
  houses,
532
681
  aspects: findAspects(bodies),
533
682
  flags,
534
- deltaT: deltaTFor(input.utc, pin),
683
+ deltaT: basis.deltaT,
684
+ timeScale: basis.timeScale,
535
685
  engineVersion: ENGINE_VERSION
536
686
  };
537
687
  }
538
- function meanLunarPoints(date) {
539
- const time = timeOf(date);
688
+ function meanLunarPoints(basis) {
689
+ const time = timeOf(basis);
540
690
  const centuries = time.tt / 36525;
541
- const nutation = e_tilt(time).dpsi / 3600;
542
- return { node: meanNodeLongitude(centuries, nutation), apogee: meanApogee(centuries, nutation) };
543
- }
544
- function centralSpeed(longitudeOf, date) {
545
- const before = longitudeOf(sampleDate(date, -SPEED_STEP_DAYS));
546
- const after = longitudeOf(sampleDate(date, SPEED_STEP_DAYS));
547
- let difference = after - before;
548
- if (difference > 180) difference -= 360;
549
- if (difference < -180) difference += 360;
550
- return difference / (2 * SPEED_STEP_DAYS);
691
+ const nutation2 = tilt(time.tt).dpsi / 3600;
692
+ return { node: meanNodeLongitude(centuries, nutation2), apogee: meanApogee(centuries, nutation2) };
551
693
  }
552
694
  function pointPosition(point, lon, lat, speed) {
553
695
  const longitude = normalizeLongitude(lon);
@@ -561,15 +703,7 @@ function pointPosition(point, lon, lat, speed) {
561
703
  };
562
704
  }
563
705
  function computePoints(chart) {
564
- const pin = chart.input.deltaT;
565
- return evaluated(() => {
566
- clock(pin);
567
- try {
568
- return pointsAt(chart);
569
- } finally {
570
- if (pin !== void 0) clock();
571
- }
572
- });
706
+ return evaluated(() => pointsAt(chart));
573
707
  }
574
708
  function computeChartDeclinations(chart) {
575
709
  const input = chart?.input;
@@ -583,24 +717,23 @@ function computeChartDeclinations(chart) {
583
717
  if (pin !== void 0 && (!Number.isFinite(pin) || typeof pin !== "number" || Math.abs(pin) > 1e10)) {
584
718
  throw new RangeError("declination chart deltaT must be finite and at most 1e10 seconds in size.");
585
719
  }
720
+ const scale = input.timeScale ?? "utc";
586
721
  return evaluated(() => {
587
- clock(pin);
588
- try {
589
- return {
590
- ...chartBodyDeclinations(bodies, e_tilt(timeOf(date)).tobl),
591
- utc: date.toISOString(),
592
- deltaT: deltaTFor(date, pin)
593
- };
594
- } finally {
595
- if (pin !== void 0) clock();
596
- }
722
+ const basis = timeBasis(date.getTime(), scale, pin);
723
+ return {
724
+ ...chartBodyDeclinations(bodies, tilt(timeOf(basis).tt).tobl),
725
+ utc: date.toISOString(),
726
+ deltaT: basis.deltaT
727
+ };
597
728
  });
598
729
  }
599
730
  function pointsAt(chart) {
600
731
  const { utc, latitude, longitude } = chart.input;
601
- const mean = meanLunarPoints(utc);
602
- const nodeSpeed = centralSpeed((date) => meanLunarPoints(date).node, utc);
603
- const apogeeSpeed = centralSpeed((date) => meanLunarPoints(date).apogee.lon, utc);
732
+ const ms = utc.getTime();
733
+ const clock = clockOf(chart.input);
734
+ const mean = meanLunarPoints(basisAt(ms, clock));
735
+ const nodeSpeed = centralDifference((basis) => meanLunarPoints(basis).node, ms, clock, SPEED_STEP_DAYS);
736
+ const apogeeSpeed = centralDifference((basis) => meanLunarPoints(basis).apogee.lon, ms, clock, SPEED_STEP_DAYS);
604
737
  const points = [
605
738
  pointPosition("Mean Node", mean.node, 0, nodeSpeed),
606
739
  pointPosition("Mean South Node", mean.node + 180, 0, nodeSpeed),
@@ -609,12 +742,12 @@ function pointsAt(chart) {
609
742
  if (chart.angles === null || latitude === void 0 || longitude === void 0) {
610
743
  return { sect: null, points };
611
744
  }
612
- const time = timeOf(utc);
745
+ const time = timeAt(ms, clock);
613
746
  const angleInput = {
614
- gastHours: SiderealTime(time),
747
+ gastHours: gastHours(time),
615
748
  latitude,
616
749
  longitude,
617
- obliquity: e_tilt(time).tobl
750
+ obliquity: tilt(time.tt).tobl
618
751
  };
619
752
  points.push(
620
753
  pointPosition("Vertex", vertexOf(angleInput, computeAngles(angleInput)), 0, null),
@@ -661,6 +794,10 @@ export {
661
794
  declinationOrb,
662
795
  findDeclinationAspects,
663
796
  declinationsForBodies,
797
+ tilt,
798
+ eclipticFrame,
799
+ meanEcliptic,
800
+ eclipticOfDate,
664
801
  lunarMeanArguments,
665
802
  MEAN_LUNAR_INCLINATION,
666
803
  meanNodeLongitude,
@@ -671,6 +808,8 @@ export {
671
808
  antiscion,
672
809
  contraAntiscion,
673
810
  midpoint,
811
+ gastHours,
812
+ onChartClock,
674
813
  bodyLongitude,
675
814
  SPEED_STEP_DAYS,
676
815
  longitudeSpeed,
@@ -1,4 +1,4 @@
1
- import { B as BodyName } from './types-CeafogFp.js';
1
+ import { B as BodyName } from './types-B4MCoCCS.js';
2
2
  import './deltat.js';
3
3
 
4
4
  /**
package/dist/deltat.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * ΔT = TT − UT1 in seconds, with a 1-σ band: the model "zodiacs-deltat/1".
3
3
  *
4
- * The argument is astronomy-engine's `ut`, days since 2000-01-01T12:00Z, with
5
- * the instant read as UT1 (UTC is taken as UT1; UT1 − UTC and leap seconds
6
- * belong to the time-scale work, M3). Years are y = 2000 + ut / 365.25, so
7
- * y = 2027 falls on 2027-01-01T06:00Z.
4
+ * The argument is astronomy-engine's `ut`, days since 2000-01-01T12:00Z on
5
+ * UT1. Years are y = 2000 + ut / 365.25, so y = 2027 falls on
6
+ * 2027-01-01T06:00Z. Charts use the model before 1972 and after the IERS UT1
7
+ * table (docs/time.md).
8
8
  *
9
9
  * - y < −720, "long-term": the integral of Stephenson, Morrison & Hohenkerk
10
10
  * 2016 (SMH, Proc. R. Soc. A 472: 20160404, CC BY 4.0), eq. (5.1),
@@ -30,16 +30,16 @@
30
30
  * a calibrated 1-σ. Sources, licences and every number:
31
31
  * docs/platform/evidence/deltat-2026-09-25/ in the Zodiacs site repository.
32
32
  */
33
- type DeltaTSegment = "long-term" | "reconstructed" | "observed" | "predicted" | "extrapolated" | "pinned";
34
- /** ΔT with its band and provenance. A caller's pin has sigma, table and tableDigest null. */
33
+ type DeltaTSegment = "long-term" | "reconstructed" | "observed" | "predicted" | "extrapolated" | "pinned" | "fallback";
34
+ /** ΔT with its band and provenance: this model, "iers-utc/1" (docs/time.md), or a caller's pin, whose sigma, table and tableDigest are null. */
35
35
  interface DeltaT {
36
36
  seconds: number;
37
37
  /** 1-σ band in seconds; null for a pin. */
38
38
  sigma: number | null;
39
- model: "zodiacs-deltat/1" | "pinned";
39
+ model: "zodiacs-deltat/1" | "iers-utc/1" | "pinned";
40
40
  /** Date of the last observed IERS day behind the table; null for a pin. */
41
41
  table: string | null;
42
- /** DELTA_T_TABLE.digest; null for a pin. */
42
+ /** The table's digest (DELTA_T_TABLE's, or the UT1 table's); null for a pin. */
43
43
  tableDigest: string | null;
44
44
  segment: DeltaTSegment;
45
45
  }