@zodiacs/engine 0.1.1-rc.14 → 0.1.1-rc.15
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 +364 -6
- package/LICENSING.md +180 -14
- package/NOTICE +73 -9
- package/README.md +116 -69
- package/dist/api-CoB_kqE3.d.ts +198 -0
- package/dist/chunk-CWI4YUDL.js +355 -0
- package/dist/chunk-KFTJMMG7.js +61 -0
- package/dist/chunk-KHBLFXFG.js +227 -0
- package/dist/{chunk-NAJ735VN.js → chunk-MFF3VKO3.js} +1 -1
- package/dist/chunk-OYGRVGXD.js +25 -0
- package/dist/{chunk-4OSOCZY2.js → chunk-ZHVI3KWJ.js} +21 -6
- package/dist/{chunk-RETEVD4F.js → chunk-ZZPITHQS.js} +115 -110
- package/dist/crossings.d.ts +1 -1
- package/dist/deltat.d.ts +8 -8
- package/dist/geo.d.ts +137 -8
- package/dist/geo.js +414 -109
- package/dist/index.d.ts +7 -201
- package/dist/index.js +28 -305
- package/dist/{internal-math-BE2hcSHd.d.ts → internal-math-BbktkHCc.d.ts} +14 -1
- package/dist/internal-math.d.ts +2 -2
- package/dist/internal-math.js +2 -2
- package/dist/internal.d.ts +2 -1
- package/dist/internal.js +4 -4
- package/dist/receipt.d.ts +56 -36
- package/dist/receipt.js +188 -33
- package/dist/timing.d.ts +414 -0
- package/dist/timing.js +851 -0
- package/dist/{types-CeafogFp.d.ts → types-BsWaqwU_.d.ts} +35 -4
- package/dist/tzdb-2025c-00-6GVG6RYL.js +6 -0
- package/dist/tzdb-2025c-01-CEYMG3LE.js +6 -0
- package/dist/tzdb-2025c-02-NWQJCVUU.js +6 -0
- package/dist/tzdb-2025c-03-PLHP6VH4.js +6 -0
- package/dist/tzdb-2025c-04-MEKUJA6M.js +6 -0
- package/dist/tzdb-2025c-05-3K5YKZBL.js +6 -0
- package/dist/tzdb-2025c-06-L2VV5XJV.js +6 -0
- package/dist/tzdb-2025c-07-H3GLGJGY.js +6 -0
- package/dist/tzdb-2025c-08-DA7QQIGD.js +6 -0
- package/dist/tzdb-2025c-09-MTXIO3QL.js +6 -0
- package/dist/tzdb-2025c-10-ASL4UW5C.js +6 -0
- package/dist/tzdb-2025c-11-EQEOANYB.js +6 -0
- package/dist/tzdb-2025c-12-NKCCXJ5G.js +6 -0
- package/dist/tzdb-2025c-13-DYTF3UC7.js +6 -0
- package/dist/tzdb-2025c-14-C25H45R5.js +6 -0
- package/dist/tzdb-2025c-15-7OYYZWRY.js +6 -0
- package/dist/vedic.d.ts +394 -0
- package/dist/vedic.js +947 -0
- package/package.json +11 -3
- package/dist/chunk-GFT24GFR.js +0 -25
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeLongitude
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MFF3VKO3.js";
|
|
4
4
|
|
|
5
5
|
// src/houses.ts
|
|
6
6
|
var DEG = Math.PI / 180;
|
|
@@ -97,7 +97,7 @@ function placidusCusps(input, angles) {
|
|
|
97
97
|
const lon = eclipticLongitudeOfRightAscension(normalizeLongitude(ra), input.obliquity);
|
|
98
98
|
const declination = declinationOfLongitude(lon, input.obliquity);
|
|
99
99
|
const argument = Math.tan(phi) * Math.tan(declination * DEG);
|
|
100
|
-
if (Math.abs(argument) >= 1)
|
|
100
|
+
if (Math.abs(argument) >= 1) break;
|
|
101
101
|
const ascensionalDifference = Math.asin(argument) * RAD;
|
|
102
102
|
const next = ramc + offset + multiplier * ascensionalDifference;
|
|
103
103
|
if (Math.abs(normalizeLongitude(next - ra + 180) - 180) < 1e-9) {
|
|
@@ -107,15 +107,30 @@ function placidusCusps(input, angles) {
|
|
|
107
107
|
}
|
|
108
108
|
ra = next;
|
|
109
109
|
}
|
|
110
|
-
return
|
|
110
|
+
return eclipticLongitudeOfRightAscension(
|
|
111
|
+
normalizeLongitude(converged ? ra : bracketed(offset, multiplier)),
|
|
112
|
+
input.obliquity
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
function bracketed(offset, multiplier) {
|
|
116
|
+
const centre = ramc + offset;
|
|
117
|
+
let low = centre - 90 * multiplier - 1;
|
|
118
|
+
let high = centre + 90 * multiplier + 1;
|
|
119
|
+
for (let index = 0; index < 128; index += 1) {
|
|
120
|
+
const middle = (low + high) / 2;
|
|
121
|
+
if (!(middle > low && middle < high)) break;
|
|
122
|
+
const lon = eclipticLongitudeOfRightAscension(normalizeLongitude(middle), input.obliquity);
|
|
123
|
+
const declination = declinationOfLongitude(lon, input.obliquity);
|
|
124
|
+
const argument = Math.min(1, Math.max(-1, Math.tan(phi) * Math.tan(declination * DEG)));
|
|
125
|
+
if (centre + multiplier * Math.asin(argument) * RAD > middle) low = middle;
|
|
126
|
+
else high = middle;
|
|
127
|
+
}
|
|
128
|
+
return (low + high) / 2;
|
|
111
129
|
}
|
|
112
130
|
const cusp11 = iterate(30, 1 / 3);
|
|
113
131
|
const cusp12 = iterate(60, 2 / 3);
|
|
114
132
|
const cusp2 = iterate(120, 2 / 3);
|
|
115
133
|
const cusp3 = iterate(150, 1 / 3);
|
|
116
|
-
if (cusp11 === null || cusp12 === null || cusp2 === null || cusp3 === null) {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
134
|
return [
|
|
120
135
|
angles.asc,
|
|
121
136
|
cusp2,
|
|
@@ -3,14 +3,15 @@ import {
|
|
|
3
3
|
computeHouses,
|
|
4
4
|
eastPointOf,
|
|
5
5
|
vertexOf
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZHVI3KWJ.js";
|
|
7
7
|
import {
|
|
8
8
|
EPHEMERIS_SPAN,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
elapsedDays,
|
|
10
|
+
outsideReferenceSpan,
|
|
11
|
+
timeBasis
|
|
12
|
+
} from "./chunk-KHBLFXFG.js";
|
|
11
13
|
import {
|
|
12
|
-
deltaT
|
|
13
|
-
deltaTAt
|
|
14
|
+
deltaT
|
|
14
15
|
} from "./chunk-ONBZ4HK7.js";
|
|
15
16
|
import {
|
|
16
17
|
ENGINE_VERSION,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
findAspects,
|
|
19
20
|
normalizeLongitude,
|
|
20
21
|
signForLongitude
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MFF3VKO3.js";
|
|
22
23
|
|
|
23
24
|
// src/body-label.ts
|
|
24
25
|
var MAX_BODY_LABEL_LENGTH = 80;
|
|
@@ -351,41 +352,63 @@ import {
|
|
|
351
352
|
RotateVector,
|
|
352
353
|
Rotation_EQJ_ECT,
|
|
353
354
|
SetDeltaTFunction,
|
|
354
|
-
SiderealTime,
|
|
355
355
|
Vector,
|
|
356
356
|
e_tilt
|
|
357
357
|
} from "astronomy-engine";
|
|
358
358
|
var RAD3 = 180 / Math.PI;
|
|
359
|
-
var
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
var DAY = 864e5;
|
|
360
|
+
var UTC_CLOCK = { scale: "utc", pin: void 0 };
|
|
361
|
+
function timeOf(basis) {
|
|
362
|
+
const { from, to } = EPHEMERIS_SPAN.daysFromJ2000;
|
|
363
|
+
if (!(basis.ttDays >= from && basis.ttDays <= to)) {
|
|
364
|
+
throw new RangeError(
|
|
365
|
+
"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)."
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
const seconds = basis.deltaT.seconds;
|
|
369
|
+
SetDeltaTFunction(() => seconds);
|
|
370
|
+
return MakeTime(basis.ut1Days);
|
|
362
371
|
}
|
|
372
|
+
function sample(ms, stepDays) {
|
|
373
|
+
return ms + stepDays * DAY;
|
|
374
|
+
}
|
|
375
|
+
var basisAt = (ms, clock) => timeBasis(ms, clock.scale, clock.pin);
|
|
376
|
+
var timeAt = (ms, clock) => timeOf(basisAt(ms, clock));
|
|
363
377
|
function evaluated(run) {
|
|
364
378
|
try {
|
|
365
379
|
return run();
|
|
366
380
|
} catch (thrown) {
|
|
367
381
|
if (thrown instanceof Error) throw thrown;
|
|
368
382
|
throw new RangeError(`The ephemeris could not evaluate this instant: ${String(thrown)}`, { cause: thrown });
|
|
383
|
+
} finally {
|
|
384
|
+
SetDeltaTFunction(deltaT);
|
|
369
385
|
}
|
|
370
386
|
}
|
|
371
|
-
function
|
|
372
|
-
const
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
387
|
+
function gastHours(time) {
|
|
388
|
+
const t = time.tt / 36525;
|
|
389
|
+
const eqeq = 15 * e_tilt(time).ee;
|
|
390
|
+
const thet1 = 0.779057273264 + 0.00273781191135448 * time.ut;
|
|
391
|
+
const thet3 = time.ut % 1;
|
|
392
|
+
let theta = 360 * ((thet1 + thet3) % 1);
|
|
393
|
+
if (theta < 0) theta += 360;
|
|
394
|
+
const st = eqeq + 0.014506 + ((((-368e-10 * t - 29956e-9) * t - 44e-8) * t + 1.3915817) * t + 4612.156534) * t;
|
|
395
|
+
let gst = (st / 3600 + theta) % 360 / 15;
|
|
396
|
+
if (gst < 0) gst += 24;
|
|
397
|
+
return gst;
|
|
398
|
+
}
|
|
399
|
+
function onEngineClock(seconds, fn) {
|
|
400
|
+
SetDeltaTFunction(() => seconds);
|
|
401
|
+
try {
|
|
402
|
+
return fn();
|
|
403
|
+
} finally {
|
|
404
|
+
SetDeltaTFunction(deltaT);
|
|
378
405
|
}
|
|
379
|
-
return time;
|
|
380
|
-
}
|
|
381
|
-
function sampleDate(date, stepDays) {
|
|
382
|
-
return new Date(date.getTime() + stepDays * 864e5);
|
|
383
406
|
}
|
|
384
|
-
function
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
407
|
+
function onChartClock(ms, scale, pin, fn) {
|
|
408
|
+
return evaluated(() => {
|
|
409
|
+
const basis = timeBasis(ms, scale, pin);
|
|
410
|
+
return fn(timeOf(basis), basis);
|
|
411
|
+
});
|
|
389
412
|
}
|
|
390
413
|
var PLANETS = [
|
|
391
414
|
{ name: "Sun", body: Body.Sun },
|
|
@@ -398,20 +421,18 @@ var PLANETS = [
|
|
|
398
421
|
{ name: "Neptune", body: Body.Neptune },
|
|
399
422
|
{ name: "Pluto", body: Body.Pluto }
|
|
400
423
|
];
|
|
401
|
-
function eclipticOfDate(body,
|
|
402
|
-
const time = timeOf(date);
|
|
424
|
+
function eclipticOfDate(body, time) {
|
|
403
425
|
const equatorial = GeoVector(body, time, true);
|
|
404
426
|
const ecliptic = RotateVector(Rotation_EQJ_ECT(time), equatorial);
|
|
405
427
|
const lon = normalizeLongitude(Math.atan2(ecliptic.y, ecliptic.x) * RAD3);
|
|
406
428
|
const lat = Math.asin(ecliptic.z / Math.hypot(ecliptic.x, ecliptic.y, ecliptic.z)) * RAD3;
|
|
407
429
|
return { lon, lat };
|
|
408
430
|
}
|
|
409
|
-
function moonOfDate(
|
|
410
|
-
const moon = EclipticGeoMoon(
|
|
431
|
+
function moonOfDate(time) {
|
|
432
|
+
const moon = EclipticGeoMoon(time);
|
|
411
433
|
return { lon: normalizeLongitude(moon.lon), lat: moon.lat };
|
|
412
434
|
}
|
|
413
|
-
function trueNodeLongitude(
|
|
414
|
-
const time = timeOf(date);
|
|
435
|
+
function trueNodeLongitude(time) {
|
|
415
436
|
const state = GeoMoonState(time);
|
|
416
437
|
const angularMomentum = {
|
|
417
438
|
x: state.y * state.vz - state.z * state.vy,
|
|
@@ -424,38 +445,40 @@ function trueNodeLongitude(date) {
|
|
|
424
445
|
);
|
|
425
446
|
return normalizeLongitude(Math.atan2(eclipticMomentum.x, -eclipticMomentum.y) * RAD3);
|
|
426
447
|
}
|
|
427
|
-
function longitudeAt(body,
|
|
428
|
-
|
|
429
|
-
|
|
448
|
+
function longitudeAt(body, ms, clock) {
|
|
449
|
+
return longitudeOn(body, basisAt(ms, clock));
|
|
450
|
+
}
|
|
451
|
+
function longitudeOn(body, basis) {
|
|
452
|
+
const time = timeOf(basis);
|
|
453
|
+
if (body === "Moon") return moonOfDate(time).lon;
|
|
454
|
+
if (body === "North Node") return trueNodeLongitude(time);
|
|
430
455
|
if (body === "South Node") {
|
|
431
|
-
return normalizeLongitude(trueNodeLongitude(
|
|
456
|
+
return normalizeLongitude(trueNodeLongitude(time) + 180);
|
|
432
457
|
}
|
|
433
458
|
const planet = PLANETS.find((candidate) => candidate.name === body);
|
|
434
459
|
if (!planet) throw new RangeError(`Unknown body: ${body}`);
|
|
435
|
-
return eclipticOfDate(planet.body,
|
|
460
|
+
return eclipticOfDate(planet.body, time).lon;
|
|
436
461
|
}
|
|
437
462
|
function bodyLongitude(body, date) {
|
|
438
|
-
return evaluated(() =>
|
|
439
|
-
clock();
|
|
440
|
-
return longitudeAt(body, date);
|
|
441
|
-
});
|
|
463
|
+
return evaluated(() => longitudeAt(body, date.getTime(), UTC_CLOCK));
|
|
442
464
|
}
|
|
443
465
|
var SPEED_STEP_DAYS = 1e-3;
|
|
444
466
|
var NODE_SPEED_STEP_DAYS = 0.25;
|
|
445
467
|
function longitudeSpeed(body, date) {
|
|
446
|
-
return evaluated(() =>
|
|
447
|
-
clock();
|
|
448
|
-
return speedAt(body, date);
|
|
449
|
-
});
|
|
468
|
+
return evaluated(() => speedAt(body, date.getTime(), UTC_CLOCK));
|
|
450
469
|
}
|
|
451
|
-
function
|
|
452
|
-
const
|
|
453
|
-
const
|
|
454
|
-
const after =
|
|
455
|
-
let difference = after -
|
|
470
|
+
function centralDifference(longitudeOf, ms, clock, stepDays) {
|
|
471
|
+
const before = basisAt(sample(ms, -stepDays), clock);
|
|
472
|
+
const lonBefore = longitudeOf(before);
|
|
473
|
+
const after = basisAt(sample(ms, stepDays), clock);
|
|
474
|
+
let difference = longitudeOf(after) - lonBefore;
|
|
456
475
|
if (difference > 180) difference -= 360;
|
|
457
476
|
if (difference < -180) difference += 360;
|
|
458
|
-
return difference / (2 * stepDays);
|
|
477
|
+
return difference / elapsedDays(before, after, 2 * stepDays);
|
|
478
|
+
}
|
|
479
|
+
function speedAt(body, ms, clock) {
|
|
480
|
+
const stepDays = body === "North Node" || body === "South Node" ? NODE_SPEED_STEP_DAYS : SPEED_STEP_DAYS;
|
|
481
|
+
return centralDifference((basis) => longitudeOn(body, basis), ms, clock, stepDays);
|
|
459
482
|
}
|
|
460
483
|
function position(body, lon, lat, speed) {
|
|
461
484
|
return {
|
|
@@ -469,49 +492,45 @@ function position(body, lon, lat, speed) {
|
|
|
469
492
|
};
|
|
470
493
|
}
|
|
471
494
|
function computeBodies(date) {
|
|
472
|
-
return evaluated(() =>
|
|
473
|
-
clock();
|
|
474
|
-
return bodiesAt(date);
|
|
475
|
-
});
|
|
495
|
+
return evaluated(() => bodiesAt(date.getTime(), UTC_CLOCK));
|
|
476
496
|
}
|
|
477
|
-
function bodiesAt(
|
|
497
|
+
function bodiesAt(ms, clock) {
|
|
478
498
|
const bodies = [];
|
|
479
499
|
for (const planet of PLANETS) {
|
|
480
|
-
const coordinates = eclipticOfDate(planet.body,
|
|
500
|
+
const coordinates = eclipticOfDate(planet.body, timeAt(ms, clock));
|
|
481
501
|
bodies.push(
|
|
482
|
-
position(planet.name, coordinates.lon, coordinates.lat, speedAt(planet.name,
|
|
502
|
+
position(planet.name, coordinates.lon, coordinates.lat, speedAt(planet.name, ms, clock))
|
|
483
503
|
);
|
|
484
504
|
}
|
|
485
|
-
const moon = moonOfDate(
|
|
486
|
-
bodies.splice(1, 0, position("Moon", moon.lon, moon.lat, speedAt("Moon",
|
|
487
|
-
const northNode = trueNodeLongitude(
|
|
488
|
-
const nodeSpeed = speedAt("North Node",
|
|
505
|
+
const moon = moonOfDate(timeAt(ms, clock));
|
|
506
|
+
bodies.splice(1, 0, position("Moon", moon.lon, moon.lat, speedAt("Moon", ms, clock)));
|
|
507
|
+
const northNode = trueNodeLongitude(timeAt(ms, clock));
|
|
508
|
+
const nodeSpeed = speedAt("North Node", ms, clock);
|
|
489
509
|
bodies.push(
|
|
490
510
|
position("North Node", northNode, 0, nodeSpeed),
|
|
491
511
|
position("South Node", normalizeLongitude(northNode + 180), 0, nodeSpeed)
|
|
492
512
|
);
|
|
493
513
|
return bodies;
|
|
494
514
|
}
|
|
515
|
+
var clockOf = (input) => ({
|
|
516
|
+
scale: input.timeScale ?? "utc",
|
|
517
|
+
pin: input.deltaT
|
|
518
|
+
});
|
|
495
519
|
function computeChart(input) {
|
|
496
|
-
|
|
497
|
-
return evaluated(() => {
|
|
498
|
-
clock(pin);
|
|
499
|
-
try {
|
|
500
|
-
return chartAt(input, pin);
|
|
501
|
-
} finally {
|
|
502
|
-
if (pin !== void 0) clock();
|
|
503
|
-
}
|
|
504
|
-
});
|
|
520
|
+
return evaluated(() => chartAt(input));
|
|
505
521
|
}
|
|
506
|
-
function chartAt(input
|
|
522
|
+
function chartAt(input) {
|
|
507
523
|
const flags = [...input.flags ?? []];
|
|
508
|
-
const
|
|
524
|
+
const ms = input.utc.getTime();
|
|
525
|
+
const clock = clockOf(input);
|
|
526
|
+
const bodies = bodiesAt(ms, clock);
|
|
527
|
+
const basis = timeBasis(ms, clock.scale, clock.pin);
|
|
509
528
|
let angles = null;
|
|
510
529
|
let houses = null;
|
|
511
530
|
if (input.timeKnown && input.latitude !== void 0 && input.longitude !== void 0) {
|
|
512
|
-
const time = timeOf(
|
|
531
|
+
const time = timeOf(basis);
|
|
513
532
|
const angleInput = {
|
|
514
|
-
gastHours:
|
|
533
|
+
gastHours: gastHours(time),
|
|
515
534
|
latitude: input.latitude,
|
|
516
535
|
longitude: input.longitude,
|
|
517
536
|
obliquity: e_tilt(time).tobl
|
|
@@ -531,24 +550,17 @@ function chartAt(input, pin) {
|
|
|
531
550
|
houses,
|
|
532
551
|
aspects: findAspects(bodies),
|
|
533
552
|
flags,
|
|
534
|
-
deltaT:
|
|
553
|
+
deltaT: basis.deltaT,
|
|
554
|
+
timeScale: basis.timeScale,
|
|
535
555
|
engineVersion: ENGINE_VERSION
|
|
536
556
|
};
|
|
537
557
|
}
|
|
538
|
-
function meanLunarPoints(
|
|
539
|
-
const time = timeOf(
|
|
558
|
+
function meanLunarPoints(basis) {
|
|
559
|
+
const time = timeOf(basis);
|
|
540
560
|
const centuries = time.tt / 36525;
|
|
541
561
|
const nutation = e_tilt(time).dpsi / 3600;
|
|
542
562
|
return { node: meanNodeLongitude(centuries, nutation), apogee: meanApogee(centuries, nutation) };
|
|
543
563
|
}
|
|
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);
|
|
551
|
-
}
|
|
552
564
|
function pointPosition(point, lon, lat, speed) {
|
|
553
565
|
const longitude = normalizeLongitude(lon);
|
|
554
566
|
return {
|
|
@@ -561,15 +573,7 @@ function pointPosition(point, lon, lat, speed) {
|
|
|
561
573
|
};
|
|
562
574
|
}
|
|
563
575
|
function computePoints(chart) {
|
|
564
|
-
|
|
565
|
-
return evaluated(() => {
|
|
566
|
-
clock(pin);
|
|
567
|
-
try {
|
|
568
|
-
return pointsAt(chart);
|
|
569
|
-
} finally {
|
|
570
|
-
if (pin !== void 0) clock();
|
|
571
|
-
}
|
|
572
|
-
});
|
|
576
|
+
return evaluated(() => pointsAt(chart));
|
|
573
577
|
}
|
|
574
578
|
function computeChartDeclinations(chart) {
|
|
575
579
|
const input = chart?.input;
|
|
@@ -583,24 +587,23 @@ function computeChartDeclinations(chart) {
|
|
|
583
587
|
if (pin !== void 0 && (!Number.isFinite(pin) || typeof pin !== "number" || Math.abs(pin) > 1e10)) {
|
|
584
588
|
throw new RangeError("declination chart deltaT must be finite and at most 1e10 seconds in size.");
|
|
585
589
|
}
|
|
590
|
+
const scale = input.timeScale ?? "utc";
|
|
586
591
|
return evaluated(() => {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
};
|
|
594
|
-
} finally {
|
|
595
|
-
if (pin !== void 0) clock();
|
|
596
|
-
}
|
|
592
|
+
const basis = timeBasis(date.getTime(), scale, pin);
|
|
593
|
+
return {
|
|
594
|
+
...chartBodyDeclinations(bodies, e_tilt(timeOf(basis)).tobl),
|
|
595
|
+
utc: date.toISOString(),
|
|
596
|
+
deltaT: basis.deltaT
|
|
597
|
+
};
|
|
597
598
|
});
|
|
598
599
|
}
|
|
599
600
|
function pointsAt(chart) {
|
|
600
601
|
const { utc, latitude, longitude } = chart.input;
|
|
601
|
-
const
|
|
602
|
-
const
|
|
603
|
-
const
|
|
602
|
+
const ms = utc.getTime();
|
|
603
|
+
const clock = clockOf(chart.input);
|
|
604
|
+
const mean = meanLunarPoints(basisAt(ms, clock));
|
|
605
|
+
const nodeSpeed = centralDifference((basis) => meanLunarPoints(basis).node, ms, clock, SPEED_STEP_DAYS);
|
|
606
|
+
const apogeeSpeed = centralDifference((basis) => meanLunarPoints(basis).apogee.lon, ms, clock, SPEED_STEP_DAYS);
|
|
604
607
|
const points = [
|
|
605
608
|
pointPosition("Mean Node", mean.node, 0, nodeSpeed),
|
|
606
609
|
pointPosition("Mean South Node", mean.node + 180, 0, nodeSpeed),
|
|
@@ -609,9 +612,9 @@ function pointsAt(chart) {
|
|
|
609
612
|
if (chart.angles === null || latitude === void 0 || longitude === void 0) {
|
|
610
613
|
return { sect: null, points };
|
|
611
614
|
}
|
|
612
|
-
const time =
|
|
615
|
+
const time = timeAt(ms, clock);
|
|
613
616
|
const angleInput = {
|
|
614
|
-
gastHours:
|
|
617
|
+
gastHours: gastHours(time),
|
|
615
618
|
latitude,
|
|
616
619
|
longitude,
|
|
617
620
|
obliquity: e_tilt(time).tobl
|
|
@@ -671,6 +674,8 @@ export {
|
|
|
671
674
|
antiscion,
|
|
672
675
|
contraAntiscion,
|
|
673
676
|
midpoint,
|
|
677
|
+
onEngineClock,
|
|
678
|
+
onChartClock,
|
|
674
679
|
bodyLongitude,
|
|
675
680
|
SPEED_STEP_DAYS,
|
|
676
681
|
longitudeSpeed,
|
package/dist/crossings.d.ts
CHANGED
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
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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.
|
|
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
|
|
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
|
}
|
package/dist/geo.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { H as HouseSystem,
|
|
1
|
+
import { H as HouseSystem, d as BirthInput } from './types-BsWaqwU_.js';
|
|
2
|
+
import { NatalLocalResolution } from './receipt.js';
|
|
2
3
|
import './deltat.js';
|
|
3
4
|
|
|
4
5
|
interface City {
|
|
@@ -29,30 +30,158 @@ interface GeoNamesClient {
|
|
|
29
30
|
}
|
|
30
31
|
declare function createGeoNamesClient(options: GeoNamesClientOptions): GeoNamesClient;
|
|
31
32
|
|
|
33
|
+
/** The calendar a local date is written in. */
|
|
34
|
+
type CalendarName = "gregorian" | "julian";
|
|
35
|
+
/** The proleptic Gregorian date of a Julian calendar date (YYYY-MM-DD), or null when it is not one or leaves years 0000–9999. */
|
|
36
|
+
declare function julianToGregorian(value: string): string | null;
|
|
37
|
+
/** The Julian calendar date of a proleptic Gregorian date (YYYY-MM-DD), or null. */
|
|
38
|
+
declare function gregorianToJulian(value: string): string | null;
|
|
39
|
+
|
|
40
|
+
/** A source of the adoption table; `GREGORIAN_ADOPTION_SOURCES` cites each. */
|
|
41
|
+
type GregorianAdoptionSource = "tzdb" | "grotefend-1891" | "grotefend-1898";
|
|
42
|
+
/** The adoption table's sources, all in the public domain. */
|
|
43
|
+
declare const GREGORIAN_ADOPTION_SOURCES: Readonly<Record<GregorianAdoptionSource, string>>;
|
|
44
|
+
/** When a country's civil calendar became the Gregorian, in the region the dates belong to. */
|
|
45
|
+
interface GregorianAdoption {
|
|
46
|
+
/** ISO 3166-1 alpha-2. */
|
|
47
|
+
code: string;
|
|
48
|
+
/** The country's name in tzdata 2025c's iso3166.tab. */
|
|
49
|
+
country: string;
|
|
50
|
+
/** The region the dates are for, as the sources name it; null where they date the whole country. */
|
|
51
|
+
region: string | null;
|
|
52
|
+
/** The first New Style day, YYYY-MM-DD. */
|
|
53
|
+
firstGregorian: string;
|
|
54
|
+
/** The last Old Style (Julian) day before it. */
|
|
55
|
+
lastJulian: string;
|
|
56
|
+
/** The sources that give this date. */
|
|
57
|
+
sources: readonly GregorianAdoptionSource[];
|
|
58
|
+
/**
|
|
59
|
+
* The other regions the sources date, by their first New Style days, and
|
|
60
|
+
* where the sources disagree; a date is tzdb's unless another source is
|
|
61
|
+
* named. "" when there is nothing to add.
|
|
62
|
+
*/
|
|
63
|
+
note: string;
|
|
64
|
+
}
|
|
65
|
+
/** The adoption table, one row per country, sorted by code; docs/time.md describes it. */
|
|
66
|
+
declare const GREGORIAN_ADOPTION: readonly Readonly<GregorianAdoption>[];
|
|
67
|
+
/** The row for a country, by ISO 3166-1 alpha-2 code or its name in tzdata's iso3166.tab. */
|
|
68
|
+
declare function gregorianAdoption(country: string): Readonly<GregorianAdoption> | undefined;
|
|
69
|
+
/** Advice from a country's calendar history; see docs/time.md. */
|
|
70
|
+
interface CalendarNote {
|
|
71
|
+
kind: "old-style" | "new-style";
|
|
72
|
+
adoption: Readonly<GregorianAdoption>;
|
|
73
|
+
}
|
|
74
|
+
/** The note for a Gregorian date (as resolved) written in `calendar`, or null. */
|
|
75
|
+
declare function calendarNote(gregorianDate: string, calendar: CalendarName, country: string): CalendarNote | null;
|
|
76
|
+
|
|
77
|
+
/** The pinned tzdb release: its version, archive digest and the form its histories were compiled from. */
|
|
78
|
+
declare const TZDB: Readonly<{
|
|
79
|
+
readonly version: "2025c";
|
|
80
|
+
readonly sha256: "4aa79e4effee53fc4029ffe5f6ebe97937282ebcdf386d5d2da91ce84142f957";
|
|
81
|
+
readonly form: "main+backzone";
|
|
82
|
+
}>;
|
|
83
|
+
|
|
84
|
+
/** What changed at a transition, from the tzdb record. */
|
|
85
|
+
type TransitionCause = "dst" | "legal-change" | "date-line";
|
|
86
|
+
|
|
87
|
+
/** How to read a wall time (docs/time.md). Unknown keys and values throw RangeError. */
|
|
88
|
+
interface LocalTimeOptions {
|
|
89
|
+
/** The birthplace, degrees east: its own mean time replaces the zone's local mean time. */
|
|
90
|
+
longitude?: number | undefined;
|
|
91
|
+
/** The calendar `date` is written in; "gregorian" by default. */
|
|
92
|
+
calendar?: CalendarName | undefined;
|
|
93
|
+
/** ISO 3166-1 alpha-2 code, or the country's name in tzdata's iso3166.tab, for `calendarNote`. */
|
|
94
|
+
country?: string | undefined;
|
|
95
|
+
}
|
|
96
|
+
/** A change of the clock that read the wall time. */
|
|
97
|
+
interface ZoneTransition {
|
|
98
|
+
/** UTC, ISO 8601. */
|
|
99
|
+
at: string;
|
|
100
|
+
offsetBeforeMinutes: number;
|
|
101
|
+
offsetAfterMinutes: number;
|
|
102
|
+
cause: TransitionCause;
|
|
103
|
+
}
|
|
104
|
+
/** A wall time resolved; docs/time.md describes every field. */
|
|
32
105
|
interface LocalTimeResolution {
|
|
33
106
|
utc: Date;
|
|
34
|
-
/** Minutes east
|
|
107
|
+
/** Minutes east at the resolved instant; may be fractional. */
|
|
35
108
|
offsetMinutes: number;
|
|
36
|
-
|
|
109
|
+
/** A gap or fold of any cause ("dst-" names kept for compatibility; see `jump`), and a local mean time clock. */
|
|
110
|
+
flags: ("dst-gap" | "dst-fold" | "lmt")[];
|
|
111
|
+
/** The proleptic Gregorian date resolved. */
|
|
112
|
+
date: string;
|
|
113
|
+
writtenDate: string;
|
|
114
|
+
calendar: CalendarName;
|
|
115
|
+
jump: {
|
|
116
|
+
kind: "gap" | "fold";
|
|
117
|
+
cause: TransitionCause;
|
|
118
|
+
} | null;
|
|
119
|
+
/** The transition behind the offset, where known. */
|
|
120
|
+
transition: ZoneTransition | null;
|
|
121
|
+
/** Set where the birthplace's own mean time read the wall time. */
|
|
122
|
+
localMeanTime: {
|
|
123
|
+
longitude: number;
|
|
124
|
+
zoneOffsetMinutes: number;
|
|
125
|
+
} | null;
|
|
126
|
+
zone: {
|
|
127
|
+
source: "tzdb" | "intl";
|
|
128
|
+
tzdbVersion: string | null;
|
|
129
|
+
dataForm: "main+backzone" | "main" | "host";
|
|
130
|
+
abbreviation: string | null;
|
|
131
|
+
dst: boolean | null;
|
|
132
|
+
};
|
|
133
|
+
/** The host's offset where the shipped history answered, as a cross-check. */
|
|
134
|
+
intlOffsetMinutes: number | null;
|
|
135
|
+
calendarNote: CalendarNote | null;
|
|
136
|
+
/** For `createNatalEnvelope`'s `localResolution`. */
|
|
137
|
+
localResolution: NatalLocalResolution;
|
|
37
138
|
}
|
|
38
139
|
interface LocalBirthInput {
|
|
140
|
+
/** YYYY-MM-DD, in `calendar`. */
|
|
39
141
|
date: string;
|
|
40
142
|
/** Local 24-hour wall time. Defaults to noon when `timeKnown` is false. */
|
|
41
143
|
time?: string;
|
|
42
144
|
timeZone: string;
|
|
43
145
|
latitude?: number;
|
|
146
|
+
/** Also the birthplace's longitude for local mean time. */
|
|
44
147
|
longitude?: number;
|
|
45
148
|
houseSystem?: HouseSystem;
|
|
46
149
|
timeKnown?: boolean;
|
|
150
|
+
calendar?: CalendarName;
|
|
151
|
+
country?: string;
|
|
47
152
|
}
|
|
48
|
-
/** UTC offset for an IANA timezone at a UTC instant. */
|
|
153
|
+
/** UTC offset for an IANA timezone at a UTC instant, from the host's Intl. */
|
|
49
154
|
declare function offsetAt(timeZone: string, utcMilliseconds: number): number;
|
|
50
155
|
/**
|
|
51
|
-
* Resolve a local wall time
|
|
52
|
-
*
|
|
156
|
+
* Resolve a local wall time in an IANA zone to UTC: a repeated one takes the
|
|
157
|
+
* earlier instant, a skipped one moves forward by the jump. Before 1970 the
|
|
158
|
+
* shipped tzdb 2025c history answers, loaded by `prepareLocalTime` (a wall
|
|
159
|
+
* time before 1970-01-02 throws otherwise); from 1970, and in the fixed Etc
|
|
160
|
+
* zones, the host's Intl.
|
|
161
|
+
*/
|
|
162
|
+
declare function resolveLocalToUtc(date: string, time: string, timeZone: string, options?: LocalTimeOptions): LocalTimeResolution;
|
|
163
|
+
/**
|
|
164
|
+
* Load what a wall time on `date` (YYYY-MM-DD) in `timeZone` needs: up to
|
|
165
|
+
* 1970, the zone's shipped history (one of 16 buckets). A failed load rejects
|
|
166
|
+
* and is not remembered.
|
|
53
167
|
*/
|
|
54
|
-
declare function
|
|
168
|
+
declare function prepareLocalTime(date: string, timeZone: string): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* The zone's own offset at a UTC instant, minutes east: before 1970 the
|
|
171
|
+
* shipped history, which `prepareLocalTime` must have loaded, as for
|
|
172
|
+
* `resolveLocalToUtc` (an instant before 1970 throws until it has); from 1970,
|
|
173
|
+
* and in the fixed zones, Intl.
|
|
174
|
+
*/
|
|
175
|
+
declare function zoneOffsetAt(timeZone: string, utcMilliseconds: number): number;
|
|
176
|
+
/** A local birth resolved, with how its wall time was read and the receipt's `reference`. */
|
|
177
|
+
interface LocalBirthResolution {
|
|
178
|
+
birth: BirthInput;
|
|
179
|
+
resolution: LocalTimeResolution;
|
|
180
|
+
reference: "supplied-instant" | "local-noon";
|
|
181
|
+
}
|
|
182
|
+
/** Convert a local birth form into the core input, keeping how its wall time was read. */
|
|
183
|
+
declare function resolveLocalBirth(input: LocalBirthInput): LocalBirthResolution;
|
|
55
184
|
/** Convert a local birth form into the explicit UTC input accepted by the core. */
|
|
56
185
|
declare function resolveBirth(input: LocalBirthInput): BirthInput;
|
|
57
186
|
|
|
58
|
-
export { type City, type GeoNamesClient, type GeoNamesClientOptions, type GeoNamesIndexMetadata, type LocalBirthInput, type LocalTimeResolution, createGeoNamesClient, offsetAt, resolveBirth, resolveLocalToUtc };
|
|
187
|
+
export { type CalendarName, type CalendarNote, type City, GREGORIAN_ADOPTION, GREGORIAN_ADOPTION_SOURCES, type GeoNamesClient, type GeoNamesClientOptions, type GeoNamesIndexMetadata, type GregorianAdoption, type GregorianAdoptionSource, type LocalBirthInput, type LocalBirthResolution, type LocalTimeOptions, type LocalTimeResolution, TZDB, type TransitionCause, type ZoneTransition, calendarNote, createGeoNamesClient, gregorianAdoption, gregorianToJulian, julianToGregorian, offsetAt, prepareLocalTime, resolveBirth, resolveLocalBirth, resolveLocalToUtc, zoneOffsetAt };
|